You can script the placement of the Windows page file in your SCCM Task Sequence. Sure you could use the good old wmic pagefileset but we’re in 2014, Powershell is your new friend!
SCCM Task Sequence Page File Location Script
My clients needed a script that :
- Disable page file on OS drive
- Move it to D:
- Set the page file based on the allocated memory installed (x1.5)
I used a Powershell module found here.
My Script then uses a function of this modules to fits my needs. Save this script in a .ps1 file.
#Reads the physical memory and multiplies it by 1.5
$PageFileSizeMB = [Math]::Truncate(((Get-WmiObject Win32_ComputerSystem).TotalPhysicalMemory) / 1MB) * 1.5
#Sets a Page File of 1.5 * Installed Physical Memory on D: drive
Set-OSCVirtualMemory -InitialSize $PageFileSizeMB -MaximumSize $PageFileSizeMB -DriveLetter “D:”
#Disable page file on C: drive
Set-OSCVirtualMemory -None -DriveLetter “C:”
**You can change the values for the drives and the size of the page file.
For the SCCM part :
- Create a package containing both the .psm1 module and YourScript.ps1
- Replicate to your DP
- Create a “Run Command Line” in your Task Sequence. Rename it to “Copy Set Page File Script Locally”
- Command : xcopy.exe .\*.* C:\OSDPageFile /s /i /y
- Point to your previously created package
- Create a “Run Command Line” in your Task Sequence. Rename it to “Set Page File”
- Command : powershell -command “import-module C:\OSDPageFile\AdjustVirtualMemoryPagingFileSize.psm1; C:\OSDPageFile\SetPageFile.ps1”
- Place the steps in your customization steps (usually near the end of the TS)
Verify in Windows once the TS completes. You SCCM Task Sequence Page File Location should be changed