Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Vista Forums > Software

Vista - PowerShell and WMI

Reply
 
Old 06-27-2008   #1 (permalink)


Windows Vista™ Ultimate
 
 

PowerShell and WMI

Accessing WMI From Windows PowerShell

Guy's Scripting Ezine 110 - PowerShell and WMI

Windows, PowerShell and WMI - Unveiling Microsoft's Best Kept Secret

Windows PowerShell: The WMI Connection

PowerShell is pretty powerful on its own, but integrating it with WMI via the get-wmiobject cmdlet can make it more powerful and reduce the need for more complicated VBS code.

The get-wmiobject or gwmi (alias) cmdlet can be used to query the computer and gather any and all WMI based information. Take a look at this short command to list the logical disk information of the computer.

Get-wmiobject Win32_LogicalDisk



This can be expanded upon using the -class, -filter and -properties options available to WMI. The following will sort the list by DeviceID and DriveType.
Get-wmiobject Win32_LogicalDisk -property DeviceId,DriveType



These examples all use the Win32_LogicalDisk class, however you can use any WMI to get information on the computers hardware, operating system, installed applications, WMI service management and performance counters. If you have used WMI in your VBS scripts, you are familiar with what WMI can do, and this functionality has been brought into MSH as well. Some other examples you can run are:
Get-wmiobject Win32_BIOS - Lists BIOS Intimation



Get-wmiobject Win32_Product - Lists Installed Packages (Applications)



Get-wmiobject Win32_PageFile - Lists all PageFile Infomation



Get-wmiobject Win32_IP4RouteTable - Self Explanatory


Attached Thumbnails
win32_logicaldisk.jpg   win32_logicaldisk-property.jpg   win32_ipv4routetable.jpg   win32_pagefile.jpg   win32_product.jpg  

win32_bios.jpg  

Last edited by dmex; 06-29-2008 at 07:06 AM..
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Installing PowerShell dependent features on W2K8 with PowerShell CTP PowerShell
when run powershell script as windows service ,powershell fail PowerShell
Powershell Plus - Free for non commercial Use and Powershell Analyzer1.0 released PowerShell
Automatic PowerShell Error Parsing in PowerShell Analyzer and PowerShellPlus PowerShell
PowerShell Leaders Join Forces and offer a pre-release version of PowerShell for 50% off the retail value PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46