# Disable paging file on all drives
$RegPath = "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management"
Set-ItemProperty -Path $RegPath -Name "PagingFiles" -Value " "

# Set the paging file to manual configuration
Set-ItemProperty -Path $RegPath -Name "PagingFiles" -Value ""
Set-ItemProperty -Path $RegPath -Name "PagingFileSize" -Value 0

# Reboot is required for changes to take effect
Write-Host "Page file disabled. Please restart the computer for changes to take effect." -ForegroundColor Green