Advertisement
guyrleech

Duplicate a Scheduled Task

Nov 30th, 2020
1,109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ## If the source scheduled task is set to run under an account other than that running PowerShell
  2.  
  3. Get-ScheduledTask -TaskName "Source Task" | ForEach-Object { Register-ScheduledTask -InputObject $_ -TaskName "Copy Task" -TaskPath "\Guy"  -Password "passwd" -User $_.Principal.UserId }
  4.  
  5. ## If source scheduled task is to run only when the user running the PowerShell is logged on
  6.  
  7. Get-ScheduledTask -TaskName "Source Task" | Register-ScheduledTask -TaskName "Copy Task" -TaskPath "\Guy"
  8.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement