Advertisement
mealsowheels

Task Scheduler Setup

Oct 28th, 2019
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $repeat = (New-TimeSpan -Minutes 30)
  2. $trigger = New-JobTrigger -Once -At (Get-Date).Date -RepeatIndefinitely -RepetitionInterval $repeat
  3. $Firstp = "-noprofile -noexit -executionpolicy bypass -file C:\Users\"
  4. $Lastp = "\.ssh\reverseSSHsession.ps1"
  5. $PathtoScript = $Firstp+$env:UserName+$Lastp
  6. $action= New-ScheduledTaskAction -Execute "powershell" -Argument $PathtoScript
  7. $Description = "Create a reverse SSH tunnel to VPS"
  8. Register-ScheduledTask -Force -user SYSTEM -Action $action -Trigger $trigger -TaskName "Reverse SSH Tunnel" -Description $Description -RunLevel Highest
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement