Monday, May 23, 2016

Managing Page File Using Powershell

Hi folks,

I have been planning deployment of more than one Exchange servers at a time, so in order to make work more effective and potentially save some time I was looking into automation of some, if not all, of the tasks.

One of them was to configure virtual memory on Windows 2012 R2 OS. You can read more on effective planning of paging file for Exchange 2013 and 2016 in this article.

During my investigations on this I found this article which provides a great code for a simple configuring configuration of RAM. All you need is to save it as Set-PageFile.ps1 file.

Let's imagine that we want to set our page file size to 16 GB+10 MB. You will need to run the following code (don't forget to navigate to the folder where it is stored):

 .\Set-PageFile.ps1 -InitialSize 16394 -MaximumSize 16394 -DriveLetter "C:"

After configuring the file you will need to restart your system and page file settings will become effective (similarly to the prompt which comes when you configure settings from GUI). After restart you can run this command to see if script execution was successful:

Get-CimInstance Win32_PageFileSetting | fl  *



Note parameters InitialSize and Maximum Size. They should be of the values you have run in the script.

Just in case if the link above gets broken or if you are too lazy you can upload the script from to this link.

However, I can't express how I am thankful to the article writer on this.

Enjoy!

No comments:

Post a Comment