Getting Files Info from Remote Server where WinRM is disabled

Hi All,

I need to collect a particular file size info from multiple servers, whereas in our domain environment WinRM service is disabled, so unable to use the invoke command and unable to initiate remote PSSession. Test-WSman is also failing.

Unable to find any WMI class which I can use to extract the info, as for testing if I am using “gwmi -Class win32_logicaldisk” command to get the disk space from remote server its working and giving the required output also.

$File = 'C:\Windows\explorer.exe'.Replace('\', '\\')
Get-CimInstance -ClassName CIM_DataFile -Filter "Name='$File'" |
    Select-Object -Property Name, FileSize

Try to use this with the parameter -CimSession to get the info from your remote servers.

1 Like

Thanks Olaf for your support. When I tried to create New-Cimsession getting credentials error, tried -Authentication parameter also, but no success.

Since Get-CimInstance don’t have the -Credentials Parameter, I tried with Get-WmiObject and it worked, got the required output.

Earlier also I tried this class but got confused with Filter parameter, can you help me with this parameter details as could not find much info on it.

What kind of help do you need?

I got the info by googling from Tobias Weltners great WebSite