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
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
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 |
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 |
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 < 3) Then WScript.Echo "3 Arguments required: [Machine Name] [Local User] [New Password]" WScript.Quit 1 End If Set objUser = GetObject("WinNT://" & WScript.Arguments(0) & "/" & WScript.Arguments(1) & ", user") objUser.SetPassword WScript.Arguments(2) objUser.SetInfo |
To manage Windows remotely through the command line interface, you can can use wmic (comes with windows).
Here’s the syntax to create a Windows File Share on a remote machine using a single line of code. With Windows NT some might remember rmtshare.exe which did the same thing, but crashes with more recent versions of Windows.
wmic /node:%REMOTESERVER% share call create “”, “%DESCRIPTION%”,”%MAX CONNECTIONS (LEAVE BLANK FOR UNLTD)%”, “%SHARENAME%”,”" , “%LOCAL PATH TO FOLDER%”, 0
Example:
wmic /node:SERVER1 share call create "", "User Homedrive for microtom","", "microtom$","" , "D:\Shares\Users\microtom", 0
You can find more information on WMIC here:
http://technet.microsoft.com/en-us/library/bb742610.aspx