21
Feb/10
0

WinDirStat: Visual Directory Statistics (Freeware)

WinDirStat is a very nice disk usage statistics viewer and cleanup tool for Microsoft Windows. You can get it for free at this location: http://windirstat.info

Print This Post
(2 votes, average: 2.50 out of 5)
Loading ... Loading ...
351 views
18
Feb/10
0

Add Domain Users / Groups to local Groups remotely

Script that adds a Domain User to a local Group remotely.

Change the “DomainName” variable to suit your requirements.

Requires 3 Arguments:
[Machine Name] [Local Group to modify] [Domain User/Group to add]

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
If (WScript.Arguments.Count < 3) Then
        WScript.Echo "3 Arguments required: [Machine Name] [Local Group to modify] [Domain User/Group to add]"
        WScript.Quit 1
End If
 
Dim DomainName
Set net = WScript.CreateObject("WScript.Network")
 
DomainName = "yourdomain.com"
 
WScript.Echo ""
WScript.Echo WScript.Arguments(0)
WScript.Echo "==================="
 
set group = GetObject("WinNT://"& WScript.Arguments(0) &"/"& WScript.Arguments(1) &"")
 
on error resume next
 
WScript.Echo "Before:"
For Each objUser In group.Members
  WScript.Echo objUser.Name
next
group.Add "WinNT://"& DomainName &"/"& WScript.Arguments(2) &""
CheckError
 
sub CheckError
        if not err.number=0 then
        set ole = CreateObject("ole.err")
                WScript.Echo ole.oleError(err.Number)
                err.clear
        else
                WScript.Echo ""
                WScript.Echo "After:"
                For Each objUser In group.Members
                  WScript.Echo objUser.Name
                next
        end if
end sub
Print This Post
(1 votes, average: 4.00 out of 5)
Loading ... Loading ...
508 views
18
Feb/10
0

Get Service Pack Levels of Servers via Active Directory

Script that queries Active Directory to retrieve Service Pack Levels (In this example only from Windows Server 2003 Machines)
Modify the strContainer variable to your requirements.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 
On Error Resume Next
 
Const ADS_SCOPE_SUBTREE = 2
strContainer = "DC=yourdomain,DC=com"
 
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = ("ADsDSOObject")
objConnection.Open "Active Directory Provider"
objCommand.ActiveConnection = objConnection
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.Properties("Page Size") = 1000
objCommand.CommandText = _
  "SELECT CN, operatingSystem, operatingSystemVersion, operatingSystemServicePack FROM 'LDAP://" & strContainer & "' " _
   & "WHERE objectCategory='computer' AND operatingSystem = 'Windows Server 2003' "
Set objRecordSet = objCommand.Execute
objRecordSet.Sort = "CN"
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
  Wscript.Echo objRecordSet.Fields("CN").Value & "," & objRecordSet.Fields("operatingSystem").Value & "," & objRecordSet.Fields("operatingSystemVersion").Value & "," 
  & objRecordSet.Fields("operatingSystemServicePack").Value
  objRecordSet.MoveNext
Loop
Print This Post
(1 votes, average: 5.00 out of 5)
Loading ... Loading ...
240 views
18
Feb/10
0

Set the local User Password remotely via script

3 simple Lines that update a local account using WinNT on a computer.
Requires 3 Arguments:
[Machine Name] [Local User] [New Password]

1
2
3
4
5
6
7
If (WScript.Arguments.Count &lt; 3) Then
   WScript.Echo "3 Arguments required: [Machine Name] [Local User] [New Password]"
   WScript.Quit 1
End If
Set objUser = GetObject("WinNT://" &amp; WScript.Arguments(0) &amp; "/" &amp; WScript.Arguments(1) &amp; ", user")
objUser.SetPassword WScript.Arguments(2)
objUser.SetInfo
Print This Post
(2 votes, average: 5.00 out of 5)
Loading ... Loading ...
231 views