PowerShell – Get Maximum Memory of Server with dbatools

Yesterday I blogged about the very famous Powershell free community tool dbatools. After writing this blog post, I received some interesting emails. I think lots of people confused this with native PowerShell. Well, actually dbatools is build using PowerShell scripts and runs under the hood script of PowerShell. The biggest advantage of the PowerShell is that it helps us to do multiple operations like finding the maximum memory of the server.

As I got lots of feedback from yesterday’s blog post that people would love to see how to get started with the dbatools, I have decided to show a very simple operation with this tool. Let us see how quickly we can find a maximum memory of server with dbatools for multiple servers.

Let us assume that I have two different servers on my system and they are named as cf\ss17 and cf\ss14. Here cf is a name of my domain and server. Now let us see how quickly we can find the value of the maximum memory configured for each of the server.

Run the following command to get maximum memory for any one of the server.

Get-DbaMaxMemory -SqlServer cf\ss17

Now you can add multiple servers with a comma at the end of it.

Get-DbaMaxMemory -SqlServer cf\ss17, cf\ss14

You can clearly see that the format is not friendly, so you can just add additional format command where you can show all the data in the table format.

Get-DbaMaxMemory -SqlServer cf\ss17, cf\ss14 | format-table

I guess you can see how easy it is to use to dbatools. If you want to get started with this tool, please read my earlier blog post here. Remember I use this took quite frequently in my Comprehensive Database Performance Health Check.

Reference: Pinal Dave (https://blog.sqlauthority.com)

Exit mobile version