Power Shell: Difference between revisions
Jump to navigation
Jump to search
(Added "Using WMI") |
mNo edit summary |
||
Line 34: | Line 34: | ||
WeekInMonth : 5 | WeekInMonth : 5 | ||
Year : 2009 | Year : 2009 | ||
PS H:\> Get-WMIObject -query "Select * from Win32_OperatingSystem" -credential sysmgr -computer ukpgemon2 | |||
SystemDirectory : C:\WINDOWS\system32 | |||
Organization : Thomson Financial | |||
BuildNumber : 3790 | |||
RegisteredUser : Dell Image Rev 1 | |||
SerialNumber : 69712-640-3560061-45321 | |||
Version : 5.2.3790 | |||
[http://technet.microsoft.com/en-gb/magazine/2009.02.windowspowershell.aspx TechNet article: Windows PowerShell Best Inventory Tool Ever!] | [http://technet.microsoft.com/en-gb/magazine/2009.02.windowspowershell.aspx TechNet article: Windows PowerShell Best Inventory Tool Ever!] |
Revision as of 14:09, 27 August 2009
Using WMI
Cmdlet for using WMI via PowerShell is Get-WMIObject, which has an alias of gwmi, for example...
PS H:\> Get-WMIObject -query "Select * from Win32_OperatingSystem" SystemDirectory : C:\WINDOWS\system32 Organization : BuildNumber : 2600 RegisteredUser : TF SerialNumber : 76487-OEM-0011903-00102 Version : 5.1.2600
PS H:\> Get-WMIObject -query "SELECT * FROM Win32_UTCTime" __GENUS : 2 __CLASS : Win32_UTCTime __SUPERCLASS : Win32_CurrentTime __DYNASTY : Win32_CurrentTime __RELPATH : Win32_UTCTime=@ __PROPERTY_COUNT : 10 __DERIVATION : {Win32_CurrentTime} __SERVER : L-0STRUTTS1 __NAMESPACE : root\cimv2 __PATH : \\L-0STRUTTS1\root\cimv2:Win32_UTCTime=@ Day : 27 DayOfWeek : 4 Hour : 10 Milliseconds : Minute : 0 Month : 8 Quarter : 3 Second : 1 WeekInMonth : 5 Year : 2009
PS H:\> Get-WMIObject -query "Select * from Win32_OperatingSystem" -credential sysmgr -computer ukpgemon2 SystemDirectory : C:\WINDOWS\system32 Organization : Thomson Financial BuildNumber : 3790 RegisteredUser : Dell Image Rev 1 SerialNumber : 69712-640-3560061-45321 Version : 5.2.3790
TechNet article: Windows PowerShell Best Inventory Tool Ever!