Part of the Beginner’s Guide to Windows PowerShell
for one thing, you can use Windows PowerShell to access WMI and WMI data.
for one thing, you can use Windows PowerShell to access WMI and WMI data.
$strComputer = "." $colItems = get-wmiobject -class "Win32_Process" -namespace "root\cimv2" -computername $strComputer foreach ($objItem in $colItems) { write-host $objItem.Name, $objItem.WorkingSetSize }
Parameter | Description |
-class | The name of the WMI class we want to access. In sample script, that’s Win32_Process. |
-namespace | The WMI namespace where the class resides. If the class lives in root\cimv2 then you can leave out the –namespace parameter; that’s because root\cimv2 is the default value. |
-computername |
The computer we want to connect to. If the –computername parameter is not present then the script will retrieve information from the local machine. Here we’re using the value stored in the variable $strComputer; we could also hard-code in a computer name like so:
-computername "atl-dc-01" |
$colItems = get-wmiobject -class "StdRegProv" -namespace "root\default" -computername "atl-fs-99"
foreach ($objItem in $colItems) { write-host $objItem.Name, $objItem.WorkingSetSize }Read full article from Part of the Beginner’s Guide to Windows PowerShell
No comments:
Post a Comment