Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

How to use multiple classes in Powershell

$
0
0

Hi Everyone,

i'm using following code to retrieve page file information, it gives the page file information but not computername. It says that

Get-WmiObject : Cannot validate argument on parameter 'ComputerName'. The argument is null or empty. Supply an argument
that is not null or empty and then try the command again.

When I tried to use the class Wmi32_computerSystem  but it is not giving page file info. I need page file info and computername both

Could anybody help me out?

$computers = Get-Content -Path C:\servernames.txt

foreach ($computer in $computers)
{
 
 Get-WmiObject Win32_PageFileUsage -computername $computer |Select-Object Name,AllocatedBaseSize,PeakUsage,CurrentUsage

}




Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>