Advertisement
Guest User

Untitled

a guest
Apr 24th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. $user = Read-Host -Prompt 'Input User name too run the script Example DOMAIN\User'
  2. $pass = Read-Host -AsSecureString 'Input Password of user to run the script'
  3. $path = Read-Host -Prompt 'Path to script Example C:\Temp'
  4. $password = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($pass))
  5.  
  6. $Action = New-ScheduledTaskAction -Execute 'powershell.exe' -Argument "$path\Syncing_Staging_App-v_Citrix.ps1"
  7. $Trigger = New-ScheduledTaskTrigger -AtStartup
  8. Register-ScheduledTask -TaskName "App-V Full sync" -action $Action -Trigger $Trigger -RunLevel Highest -User "$user" -Password "$password"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement