SynopsisRemoves a pagefile set on a local or remote computer.
- Remove-Pagefile [-Location] [-Reboot] [-ComputerName] [-Credential]
DescriptionThe Remove-Pagefile cmdlet is used to remove a Windows pagefile on a local or remote computer.
- Location The pagefile to remove. Path must be local and in the format 'C:\PagefileDirectory\pagefile.sys'.
- Reboot Reboot the computer so that configuration changes take effect.
- ComputerName The computer against which to run the cmdlet. By default this parameter will be populated with the name of the local computer.
- Credential The credentials under which to run the cmdlet. By default this cmdlet will run as the current user. Using this parameter and the Get-PSCredential cmdlet you can specify an alternate set of credentials under which to execute this command.
InputsRemove-Pagefile accepts the output of Get-Pagefile as an input object. The ComputerName and Location parameters each accept pipeline input by property name.
OutputsRemove-Pagefile makes changes directly to Windows and does not output any Powershell objects.
NotesThe Remove-Pagefile cmdlet requires that the RPC service is started on the computer it is trying to access and that DNS services are available to resolve target host names.
Example 1This command will set the pagefile on the local computer to a user managed minimum size of 1024MB and a maximum size of 4094MB in the default location:
Remove-Pagefile -MinSize 1024 -MaxSize 4094
Example 2This command will set the pagefile on the local computer to a user managed minimum size of 1024MB and a maximum size of 4094MB in the location D:\pagefile.sys:
Remove-Pagefile -Location D:\Pagefile.sys -MinSize 1024 -MaxSize 4094
Example 3This command will set a system managed pagefile on remote computer PC01.The pagefile is also set to be wiped clean at shutdown, using the CleanAtShutdown parameter:
Remove-Pagefile -SystemManaged -Computer PC01 -CleanAtShutdown
Example 4This command will set the pagefile on the local computer to a user managed minimum size of 1024MB and a maximum size of 4094MB in the default location, and then reboot the computer so that the changes take effect:
Remove-Pagefile -MinSize 1024 -MaxSize 4094 -Reboot