Recipe 2.6. Viewing System PropertiesProblemYou want to view the system properties of a server. These properties include operating system version, system manufacturer and model, processors, memory, and logon domain to name a few. SolutionUsing a graphical user interfaceFrom the Start menu, select All Programs (or Programs on Windows 2000) You can also get some system information by going to Start OK. If you want to view the installed hardware on a machine, go to Start OK. Using a command-line interfaceThere are numerous ways to get system information from the command line. You can run the new Windows Server 2003 utility, systeminfo.exe against Windows 2000, Windows XP, or other Windows Server 2003 systems. Use the /s option to run the command against a remote server as in this example: > systeminfo /s <ServerName> The srvinfo.exe utility, which is available in the Windows Server 2003 and Windows 2000 Resource Kits, can also retrieve system information remotely. It displays a list of installed services, service packs, and hotfixes. > srvinfo \\<ServerName> Lastly, the Sysinternals psinfo.exe tool retrieves similar information for a local or remote system. The tool has options for viewing hotfixes (-h option), software (-s option), and disk volume (-d option) information. > psinfo -h -s -d \\<ServerName> Using VBScript' 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 DiscussionOne command-line tool I didn't mention in the solutions is wmic.exe. While it isn't available for Windows 2000, it is very handy on Windows Server 2003. I can simulate pretty much everything that the scripting solution does in four commands. Here they are: > wmic os list full > wmic computersystem list full > wmic cpu list full > wmic bios list full These commands actually print out more information than the scripting solution because they display all of the properties from the associated classes, not just the ones I chose to display. To run wmic against a remote computer, use the /node option and be sure to enclose the target server name in quotes: > wmic /node:"srv01" os list full |