Skip to content

Instantly share code, notes, and snippets.

@stack72
Created June 24, 2014 12:08
Show Gist options
  • Save stack72/234571095fb36257052a to your computer and use it in GitHub Desktop.
Save stack72/234571095fb36257052a to your computer and use it in GitHub Desktop.
This
if ( $LASTEXITCODE ) {
schtasks /create /TN "puppet upgrade task" /TR "C:\Windows\system32\WindowsPowershell\v1.0\powershell.exe -NoProfile -NonInteractive -NoLogo -ExecutionPolicy Bypass -File C:\Windows\Temp\UpgradePuppet.ps1 -version <%= @version %>" /SC Once /ST $startTime /RU SYSTEM
} else {
$today = (Get-Date -f "MM/dd/yyyy")
schtasks /change /TN "puppet upgrade task" /SD $today /ST $startTime /RU SYSTEM
}
Should change to
if ($scheduledTask -eq $true) {
$today = (Get-Date -f "MM/dd/yyyy")
schtasks /change /TN "puppet upgrade task" /SD $today /ST $startTime /RU SYSTEM
}
else {
schtasks /create /TN "puppet upgrade task" /TR "C:\Windows\system32\WindowsPowershell\v1.0\powershell.exe -NoProfile -NonInteractive -NoLogo -ExecutionPolicy Bypass -File C:\Windows\Temp\UpgradePuppet.ps1 -version <%= @version %>" /SC Once /ST $startTime /RU SYSTEM
}
@melissabilly
Copy link

melissabillyiloveyou

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment