Wmi

Windows Management Information WMI is very usefull to get information out the system of all kinds of info.
It is also possible to run this a remote computers within powershell even when they don't have powershell installed. It only needs the wmi agent running
So let's say you want the operating system info from several computers out of the computers.txt file
Create a file called computers.txt and place the computernames one by one each on a different line.
Next run the following code in powershell:

Get-WmiObject win32_operatingsystem -computer (type c:\test\computers.txt)

To view the WMI of remote computers you'll need to take a look at the security settings of WMI.
wmi.jpg

Open a mmc console and look at the security properties of the WMI
You can specify credentials of the remote computer like:

Get-WmiObject win32_operatingsystem -computer (type c:\test\computers.txt) -credentials "administrator"

To get the information about the network adapters for instance type:
Get-WmiObject -computer computername Win32_NetworkAdapterConfiguration | format-table Ipaddress, Description, DHCPEnabled -autosize

To find free space on a remote computer you would type:
Get-WMIObject Win32_LogicalDisk -Computername windowsxp01 | Foreach { 'Disk {0} has {1:0.0} MB space available' -f $_.Caption, ($_.FreeSpace / 1MB) }

To find the last bootime of a remote computer type
get-wmiobject -class win32_operatingsystem -namespace root\cimv2 -computername remotecomputername | Select __server,@{label='LastBootUpTime';expression={$_.ConvertToDateTime($_.Lastbootuptime)}}

a very very nice script structure of powershell and wmi is presented on this website crossroads

To repair wmi if it fails on all classes type the following in a command line:

Ran the commands given below:
For command prompt navigate to C:\>windows\system32\wbem
regsvr32 /s %systemroot%\system32\scecli.dll regsvr32 /s %systemroot%\system32\userenv.dll regsvr32 cimwin32.dllmofcomp cimwin32.mof mofcomp cimwin32.mfl mofcomp rsop.mof mofcomp rsop.mfl for /f %s in ('dir /b /s *.dll') do regsvr32 /s %s for /f %s in ('dir /b *.mof') do mofcomp %s for /f %s in ('dir /b *.mfl') do mofcomp %s regsvr32 wmisvc.dll)wmiprvse /regserver

More WMI
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License