W2KSG: Retrieving System Information
I am going to jump on a bit in the Scripting Guide and skip to chapter 8 - Computer Assets. (Chapter 7 is working with AD which we will return to later). Chapter 8 uses WMI to work with your computer systems. In these examples we are working with the local machine but we can use the computername parameter to work with remote machines.
The section of the Scripting Guide we are dealing with can be found at
Get-WmiObject -Class Win32_OperatingSystem | Select Name, Version,ServicePackMajorVersion, ServicePackMinorVersion, Manufacturer, WindowsDirectory, Locale, FreePhysicalMemory, TotalVirtualMemorySize, FreeVirtualMemory | Format-List
Get-WmiObject -Class Win32_ComputerSystem | Select Name, Manufacturer, Model, CurrentTimeZone, TotalPhysicalmemory | Format-List
Get-WmiObject -Class Win32_Processor | Select Architecture, Description | Format-List
Get-WmiObject -Class Win32_Bios | Select Version | Format-List
We can use WMI to retrieve information on the Operating System, Computer, processor and Bios. Each of these WMI classes has a host of other information. Investigate the options and you can easily generate a script to document your systems. Note I have used 4 lines of PowerShell to duplicate the 33 lines on VBScript in the Guide's example.
|Share this post :|