- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to get pagefile settings using PowerShell?
Pagefile also Known as Virtual Memory file in the Windows Operating system is a very useful part of the OS. It helps to reduce the burden on the Physical memory by storing some paging file in the file call Pagefile.sys. Generally, this file in windows OS is stored in C:\ unless it is modified.
You can check the Pagefile settings in the Windows GUI using
System Properties → Advanced → Performance → Settings → Advanced → Virtual Memory → Change.
We have made a few blocks and circles in the above pagefile properties image. We will see them one by one.
First, to check if pagefile is automatically managed or not as shown in the first circle, we will use the below command.
PS C:\> (Get-CimInstance Win32_ComputerSystem).AutomaticManagedPagefile
Output:
True
In the above image, the pagefile is automatically managed so the output is true.
Second, we need to know if the pagefile is system managed or customized, you need to use CIMInstance or WMI class Win32_PageFileSetting, but the condition here is if the pagefile is automatically managed then the output will be Null because in the image itself you can see that System managed part is disabled.
So let's assume on one server Automatic pagefile management is disabled and when we use the Win32_pagefilesetting command then we will get the details below.
Get-CimInstance Win32_PageFileSetting | fl *
Output:
Caption : c:\ 'pagefile.sys' Description : 'pagefile.sys' @ c:\ SettingID : pagefile.sys @ c: InitialSize : 0 MaximumSize : 0 Name : c:\pagefile.sys PSComputerName : CimClass : root/cimv2:Win32_PageFileSetting CimInstanceProperties : {Caption, Description, SettingID, InitialSize...} CimSystemProperties : Microsoft.Management.Infrastructure.CimSystemProperties
In the above output, we have InitialSize and MaximumSize that mentions the custom size of the pagefile. If both are 0 then the pagefile is managed by the system.
Third, to know the pagefile drive and what is it current and peak usage, we need to use the CIMInstance method with class Win32_PagefileUsage class.
PS C:\Users\Administrator> Get-CimInstance Win32_PageFileUsage | fl *
Output:
Status : Name : C:\pagefile.sys CurrentUsage : 85 Caption : C:\pagefile.sys Description : C:\pagefile.sys InstallDate : 7/5/2020 12:01:30 PM AllocatedBaseSize : 1024 PeakUsage : 127 TempPageFile : False PSComputerName : CimClass : root/cimv2:Win32_PageFileUsage CimInstanceProperties : {Caption, Description, InstallDate, Name...} CimSystemProperties : Microsoft.Management.Infrastructure.CimSystemProperties
You can see the AllocatedBaseSize (i.e Currently allocated), TempPageFile (to check if temporary pagefile is created or not), and the CurrentUsage of the pagefile.
Unfortunately, we can’t get the Recommended size using PowerShell because it is managed by the system and the size changes as per system requirement.
You can get all page file settings mentioned above on the remove computers using -ComputerName parameter.
- Related Articles
- How to change Pagefile settings using PowerShell?
- How to change pagefile settings from custom to system managed using PowerShell?
- How to get IP address settings using PowerShell?
- How to get DNS IP Settings using PowerShell?
- How to get windows firewall profile settings using PowerShell?
- How to get the windows authentication settings using PowerShell?
- How to get the IIS Application Pool failure Settings using PowerShell?
- How to get the IIS Application Pool Recycle settings using PowerShell?
- How to get the Azure VM disk encryption settings using PowerShell?
- How to get the Azure VM disk caching settings using PowerShell?
- How to remove pagefile on the specific drive using PowerShell?
- How to enable the Azure VM accelerated settings using PowerShell?
- How to disable the Azure VM accelerated settings using PowerShell?
- How to set the local user account settings using PowerShell?
- How to get the JsonGenerator settings using Jackson in Java?
