By Robbie Allen
Book Price: $44.95 USD
£31.95 GBP
PDF Price: $35.99
Cover | Table of Contents | Colophon
http://support.microsoft.com/)
articles, or documentation from the Microsoft Developers Network
(MSDN) (http://msdn.microsoft.com).http://www.microsoft.com/windows/reskits/.
Some tools are freely available online, but others must be purchased
as part of a Resource Kit. The Windows 2000 Support Tools, which are
called the Windows Support Tools in Windows Server 2003, contain many
"must have" tools for people that
work with Windows Server. The installation MSI for the Windows
Support Tools can be found on a Windows 2000 Server or Windows Server
2003 CD in the \support\tools
directory.http://www.sysinternals.com/.
Mark Russinovich and Bryce Cogswell have developed a suite of
extremely useful tools that every Windows Server system administrator
should be familiar with. These tools are free and they often come
with complete source code for the tool.http://www.joeware.net/. Joe wrote many of
his tools, some in executable form and others in Perl, to help in
daily system administration tasks, so they are all very practical and
useful. And like Sysinternals, most are free.> runas /user:administrator@rallencorp.com /netonly "enumprop LDAP://dc1/ dc=rallencorp,dc=com"
> runas /user:administrator@rallencorp.com /netonly "mmc.exe"
/netonly option is necessary if the user you
are authenticating with does not have local logon rights on the
computer from which you are running the command, or if you want to
authenticate with an account from a nontrusted domain.strComputer = "." ' localhost
set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
set objDisks = objWMI.InstancesOf("Win32_LogicalDisk")
for each objDisk in objDisks
Wscript.Echo "DeviceID: " & objDisk.DeviceID
Wscript.Echo "FileSystem: " & objDisk.FileSystem
Wscript.Echo "FreeSpace: " & objDisk.FreeSpace
Wscript.Echo "Size: " & objDisk.Size
WScript.Echo ""
next/? as a
parameter. For example:> netsh /?
http://support.microsoft.com/default.aspx.
You can also append the KB article number to the end of this URL to
go directly to the article: http://support.microsoft.com/?kbid=.|
Tool
|
Windows Server 2003
|
Windows 2000 Server
|
Recipes
|
|---|---|---|---|
|
bootcfg
|
%SystemRoot%\system32
|
N/A
|
2.14
|
|
compname
|
http://www.willowhayes.co.uk/
|
|
Tool
|
Windows Server 2003
|
Windows 2000 Server
|
Recipes
|
|---|---|---|---|
|
bootcfg
|
%SystemRoot%\system32
|
N/A
|
2.14
|
|
compname
|
http://www.willowhayes.co.uk/
|
|
> %systemroot%\system32\oobe\msoobe /a
' This code activates a Windows Server 2003 system.
' ------ SCRIPT CONFIGURATION ------
strComputer = "."
boolActivateOnline = True ' If this is true, boolActivateOffline should
' be false
boolActivateOffline = False ' If this is true, boolActivateOnline should
' be false
strOfflineConfirmationCode = "1234-5678" ' if Activating offline, you need
' specify a confirmation code
' ------ END CONFIGURATION ---------
set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
set colWPA = objWMI.InstancesOf("Win32_WindowsProductActivation")
for each objWPA in colWPA
WScript.Echo "Activation Settings:"
Wscript.Echo " Activation Required: " & objWPA.ActivationRequired
Wscript.Echo " Caption: " & objWPA.Caption
Wscript.Echo " Description: " & objWPA.Description
Wscript.Echo " Notification On: " & objWPA.IsNotificationOn
Wscript.Echo " Product ID: " & objWPA.ProductID
Wscript.Echo " Remaining Eval Period: " & objWPA.RemainingEvaluationPeriod
Wscript.Echo " Remaining Grace Period: " & objWPA.RemainingGracePeriod
Wscript.Echo " Server Name: " & objWPA.ServerName
Wscript.Echo " Setting ID: " & objWPA.SettingID
WScript.Echo
if objWPA.ActivationRequired = True then
if boolActivateOnline = True then
intRC = objWPA.ActivateOnline
if intRC <> 0 then
WScript.Echo "Error activating online: " & intRC
else
WScript.Echo "Successfully activated online"
end if
end if
if boolActivateOffline = True then
intRC = objWPA.ActivateOffline(strOfflineConfirmationCode)
if intRC <> 0 then
WScript.Echo "Error activating offline: " & intRC
else
WScript.Echo "Successfully activated offline"
end if
end if
end if
next> reg add HKU\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer /t REG_DWORD /v NoWindowsUpdate /d 1
> reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer /t REG_ DWORD /v NoWindowsUpdate /d 1
' This code disables Windows Update in the .Default profile.
' ------ SCRIPT CONFIGURATION ------
strComputer = "."
' ------ END CONFIGURATION ---------
const HKEY_USERS = &H80000003
strKey = ".DEFAULT\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer"
set objReg=GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
objReg.SetDwordValue HKEY_USERS, strKey, "NoWindowsUpdate", 1
WScript.Echo "Windows Update disabled in .Default profile"[netoptionalcomponents] dns=1
> sysocmgr /i:%windir%\inf\sysoc.inf /u:c:\comp_install.txt
/x and
/q). For the complete list of
sysocmgr options, run sysocmgr
/? from a command line./s
option to run the command against a remote server as in
this example:> systeminfo /s <ServerName>
> srvinfo \\<ServerName>
-h option),
software (-s option), and disk volume
(-d option) information.> psinfo -h -s -d \\<ServerName>
' This code prints system information similar to the systeminfo command.
' ------ SCRIPT CONFIGURATION ------
strComputer = "." ' e.g. rallen-srv01
' ------ END CONFIGURATION ---------
set dicProductType = CreateObject("Scripting.Dictionary")
dicProductType.Add 1, "Workstation"
dicProductType.Add 2, "Domain Controller"
dicProductType.Add 3, "Standalone Server"
set objWMIDateTime = CreateObject("WbemScripting.SWbemDateTime")
set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
set colOS = objWMI.InstancesOf("Win32_OperatingSystem")
for each objOS in colOS
Wscript.Echo "Host Name: " & objOS.CSName
Wscript.Echo "OS Name: " & objOS.Caption
Wscript.Echo "OS Version: " & objOS.Version & " Build " & objOS.BuildNumber
Wscript.Echo "OS Manufacturer: " & objOS.Manufacturer
Wscript.Echo "OS Configuration: " & dicProductType.Item(objOS.ProductType)
Wscript.Echo "OS Build Type: " & objOS.BuildType
Wscript.Echo "Registered Owner: " & objOS.RegisteredUser
Wscript.Echo "Registered Organization: " & objOS.Organization
Wscript.Echo "Product ID: " & objOS.SerialNumber
objWMIDateTime.Value = objOS.InstallDate
Wscript.Echo "Original Install Date: " & objWMIDateTime.GetVarDate
objWMIDateTime.Value = objOS.LastBootUpTime
Wscript.Echo "System Up Time: " & objWMIDateTime.GetVarDate
Wscript.Echo "Windows Directory: " & objOS.WindowsDirectory
Wscript.Echo "System Directory: " & objOS.SystemDirectory
Wscript.Echo "BootDevice: " & objOS.BootDevice
Wscript.Echo "System Locale: " & objOS.Locale
Wscript.Echo "Time Zone: " & "GMT" & objOS.CurrentTimezone
Wscript.Echo "Total Physical Memory: " & _
round(objOS.TotalVisibleMemorySize / 1024) & " MB"
Wscript.Echo "Available Physical Memory: " & _
round(objOS.FreePhysicalMemory / 1024) & " MB"
Wscript.Echo "Page File: Max Size: " & _
round(objOS.TotalVirtualMemorySize / 1024) & " MB"
Wscript.Echo "Page File: Available: " & _
round(objOS.FreeVirtualMemory / 1024) & " MB"
next
set colCS = objWMI.InstancesOf("Win32_ComputerSystem")
for each objCS in colCS
Wscript.Echo "System Manufacturer: " & objCS.Manufacturer
Wscript.Echo "System Model: " & objCS.Model
Wscript.Echo "System Type: " & objCS.SystemType
WScript.Echo "Domain: " & objCS.Domain
Wscript.Echo "Processor(s): " & objCS.NumberofProcessors & _
" Processor(s) Installed."
next
intCount = 0
set colProcs = objWMI.InstancesOf("Win32_Processor")
for each objProc in colProcs
intCount = intCount + 1
Wscript.Echo vbTab & "[" & intcount & "]: " & _
objProc.Caption & " ~" & objProc.MaxClockSpeed & "Mhz"
next
set colBIOS = objWMI.InstancesOf("Win32_BIOS")
for each objBIOS in colBIOS
Wscript.Echo "BIOS Version: " & objBIOS.Version
next> time 23:02:00 > date 11/01/2005
> date /t & time /t & w32tm -tz
> reg query \\<ServerName>\HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation
> net time /setsntp:<ServerList>
> net time /setsntp:mytime.rallencorp.com,time.windows.com
> net time /querysntp
> net time /set
> hostname
http://www.willowhayes.co.uk/, can also
display the current computer name:> compname /s
> compname /c <NewServerName>
> netdom join <ComputerName> /Domain <DomainName> /UserD <DomainUserUPN> /PasswordD * /UserO <ComputerAdminUser> /PasswordO * /Reboot
/UserO and
/PasswordO options is the letter O, not the number
0.' This code joins a server to a domain. ' ------ SCRIPT CONFIGURATION ------ strComputer = "<ComputerName>" ' e.g. joe-xp strDomain = "<DomainName>" ' e.g. rallencorp.com strDomainUser = "<DomainUserUPN>" ' e.g. administrator@rallencorp.com strDomainPasswd = "<DomainUserPasswd>
> nltest /server:<ComputerName> /sc_query:<DomainName>
> nltest /server:<ComputerName> /sc_reset:<DomainName>
> set user
> wmic /node:"<ServerName>" environment list full
> echo %systemroot%
FOOBAR environment variable:> set FOOBAR=test