I am trying to set pagefile size for C and D drive with the following code. But there is an odd issue with this. Sometimes the code will work perfectly. Sometimes it will throw an error saying
Set-WmiInstance : Value out of range
for both drives. And sometimes it will throw that error only for C or D drive.
Can anyone know the reason?
Note: I test this code in my laptop only.
Set-WmiInstance -Class Win32_PageFileSetting -Arguments @{
Name = "C:\pagefile.sys";
InitialSize = 800;
MaximumSize = 1600
}
Set-WmiInstance -Class Win32_PageFileSetting -Arguments @{
Name = "D:\pagefile.sys";
InitialSize = 1600;
MaximumSize = 3200
}
I know what is the problem and how to fix it.
These tricks help me to set the pagefile with whatever number I want