Follow sqlserver-dba.com

Subscribe to RSS feed  Follow @jackvamvas - Twitter

*Use the Comments section for questions

SQLServer-DBA.com Links

Dba_db2_button

dba-ninja.com

SQL Server DBA Jobs

Get Server Total Physical Memory with Powershell

04 March,2019 by Tom Collins

Question: The server team have added a bunch og memory to a server .  How can I get the Total Physical Memory of a server using Powershell?    The server is a remote server.

Answer; A common method to extract the total physical memory of server is using : Get-WMIObject and TotalPhysicalMemory

According to the documentation : "The Get-WmiObject cmdlet gets instances of Windows Management Instrumentation (WMI) classes or information about the available WMI classes. "

There is an option to query a remote compueter by specifying a name on the -Computername switch.

An example of the Powershell code. The result will be in bytes. So you'll need to manipulate to get in GB or MB:

 

 

Get-WMIObject -Computername myservername -class win32_ComputerSystem | Select-Object -Expand TotalPhysicalMemory



Author: Tom Collins (http://www.sqlserver-dba.com)


Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on Get Server Total Physical Memory with Powershell


sqlserver-dba.com | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer