Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get free physical memory of remote computer using PowerShell

I have this:

(Get-WMIObject Win32_logicaldisk -computername computer).TotalPhysicalMemory

to get size of physical memory installed on remote computer. How do I get the FREE memory of that computer?

I've tried

(Get-WMIObject Win32_logicaldisk -computername computer).FreePhysicalMemory

and some other variants, but with no effect. Is there some list of possible "filters"?

like image 894
culter Avatar asked Sep 03 '12 15:09

culter


People also ask

How do I get Systeminfo from remote computer PowerShell?

If you want to get system information from remote computer, you need to use Invoke-Cmdlet which take has ComputerName parameter to specify one or more remote computer name. Get-ComputerInfo doesn't have any parameter to get remote computer information.

How do I check my RAM in remote Desktop?

Click Operation on the top, and then choose Task Manager to open it directly. Step 7. In the Task Manager, go to the Performance tab, and then you can check the CPU and memory usage of the remote computer intuitively.

Can I run PowerShell commands on remote computer?

Using the WS-Management protocol, Windows PowerShell remoting lets you run any Windows PowerShell command on one or more remote computers. You can establish persistent connections, start interactive sessions, and run scripts on remote computers.


2 Answers

Whenever you want to see all of the properties of an object, pipe it to Format-List *.

Get-WmiObject Win32_LogicalDisk | format-list *
Get-WmiObject Win32_OperatingSystem | fl *

Or if you are looking for a particular propery, you can use wildcard search

Get-WmiObject Win32_OperatingSystem | fl *free*

As Aquinas says, you want the Win32_OperatingSystem class, FreePhysicalMemory property. Win32_LogicalDisk tracks hard disks, not RAM.

like image 128
latkin Avatar answered Oct 11 '22 11:10

latkin


You can also try the Get-Counter cmdlet:

(Get-Counter -Counter "\Memory\Available MBytes" -ComputerName computer).CounterSamples[0].CookedValue
like image 40
Shay Levy Avatar answered Oct 11 '22 10:10

Shay Levy