Difference between revisions of "Power Shell"
Jump to navigation
Jump to search
m (→Variables: Added Syntax Highlight) |
m (→WMI: Added Syntax Highlight) |
||
Line 79: | Line 79: | ||
Cmdlet for using WMI via PowerShell is '''Get-WMIObject''', which has an alias of '''gwmi''', for example... | Cmdlet for using WMI via PowerShell is '''Get-WMIObject''', which has an alias of '''gwmi''', for example... | ||
< | <source lang="powershell"> | ||
PS H:\> Get-WMIObject -query "Select * from Win32_OperatingSystem" | PS H:\> Get-WMIObject -query "Select * from Win32_OperatingSystem" | ||
Line 129: | Line 129: | ||
FullName : Ypos-Consulting GmbH | FullName : Ypos-Consulting GmbH | ||
Name : pptp_ypos | Name : pptp_ypos | ||
</ | </source> | ||
Line 135: | Line 135: | ||
In order to find the correct class use... | In order to find the correct class use... | ||
< | <source lang="powershell"> | ||
Get-WMIObject -list -credential $cred -computer 159.104.224.167 | Select-String -InputObject {$_.Name} Win32* | Get-WMIObject -list -credential $cred -computer 159.104.224.167 | Select-String -InputObject {$_.Name} Win32* | ||
</ | </source> | ||
To then see all the properties of a class use (doesn't work on remote machines (access denied) - this is a known bug in Power Shell v1)... | To then see all the properties of a class use (doesn't work on remote machines (access denied) - this is a known bug in Power Shell v1)... | ||
< | <source lang="powershell"> | ||
Get-WMIObject Win32_BIOS | Format-List * | Get-WMIObject Win32_BIOS | Format-List * | ||
</ | </source> | ||
[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!] |