< Back

Submit-ScheduledRestartComputerJob

Sat Jan 18, 2020 4:34 pm

NAME Submit-ScheduledRestartComputerJob



SYNOPSIS

Schedule a restart of a computer using PowerShell scheduled jobs.





SYNTAX

Submit-ScheduledRestartComputerJob [-ComputerName] <String[]> [-RestartDateTime] <DateTime> [[-JobNamePrefix]

<String>] [[-Timeout] <Int32>] [-WhatIf] [[-RestartCommandParameters] <String>] [-Credential] <PSCredential>

[[-ScriptFilePath] <String>] [[-JobLogPath] <String>] [<CommonParameters>]





DESCRIPTION

Schedule a restart of a computer. You can specify a time in the future

when a computer or list of computers will be restarted.





PARAMETERS

-ComputerName <String[]>

Enter the name(s) of computers for which you need to schedule a restart.



Required? true

Position? 1

Default value

Accept pipeline input? true (ByValue, ByPropertyName)

Accept wildcard characters? false



-RestartDateTime <DateTime>

Enter a date/time in the future for when you need to restart the provided

computers.



Required? true

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



-JobNamePrefix <String>

The prefix of the scheduled restart computer job exists to differentiate

the restart jobs from other PowerShell scheduled jobs.



Required? false

Position? 3

Default value RestartComputer-

Accept pipeline input? false

Accept wildcard characters? false



-Timeout <Int32>

The timeout parameter specifies how long to allow the Restart-Computer job to wait

until it gives up.



Required? false

Position? 4

Default value 1200

Accept pipeline input? false

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]

Use the WhatIf switch to add a -WhatIf paramter to the Restart-Computer command to test

what would happen.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-RestartCommandParameters <String>

You can put your custom parameters that will be added to the Restart-Computer command in

the scheduled restart computer job.



Required? false

Position? 5

Default value "-Wait -Force -Timeout $TimeOut -Verbose"

Accept pipeline input? false

Accept wildcard characters? false



-Credential <PSCredential>

A credential object is required to schedule a restart of a remote computer.



Required? true

Position? 6

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ScriptFilePath <String>

The path to the script file that is executed by the scheduled restart computer

job.



Required? false

Position? 7

Default value C:\\Temp\\

Accept pipeline input? false

Accept wildcard characters? false



-JobLogPath <String>

The path where the scheduled restart computer job will store the transcript log.



Required? false

Position? 8

Default value C:\\Logs\\

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



NOTES





Created by: Jason Wasser @wasserja

Modified: 6/2/2017



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Submit-ScheduledRestartComputer -ComputerName SERVER01 -RestartDateTime 11:30pm -Credential $Credential













-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Submit-ScheduledRestartComputer -ComputerName SERVER01 -RestartDateTime '1/1/2020 12:00 AM' -Credential

$Credential



Requires -RunAsAdministrator

Requires -Modules PSScheduledJob











RELATED LINKS