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
}
InitialSize Data type: uint32
Access type: Read/write
Qualifiers: MappingStrings ("Win32Registry|System\\CurrentControlSet\\Control\\Session Manager\\Memory Management|PagingFiles"), Units ("megabytes")
MaximumSize Data type: uint32
Access type: Read/write
Qualifiers: MappingStrings ("Win32Registry|System\\CurrentControlSet\\Control\\Session Manager\\Memory Management|PagingFiles"), Units ("megabytes")
Could you please try this once:
Set-WmiInstance Win32_PageFileSetting -Arguments @{Name='D:\pagefile.sys'; InitialSize=128; MaximumSize=512}
I know what is the problem and how to fix it.
These tricks help me to set the pagefile with whatever number I want
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.