Skip to content

Instantly share code, notes, and snippets.

@Christwiest
Last active April 24, 2017 19:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Christwiest/127938c8adb999a814a348c87c366e2b to your computer and use it in GitHub Desktop.
Save Christwiest/127938c8adb999a814a348c87c366e2b to your computer and use it in GitHub Desktop.
$user = Read-Host -Prompt 'Input User name too run the script Example DOMAIN\User'
$pass = Read-Host -AsSecureString 'Input Password of user to run the script'
$path = Read-Host -Prompt 'Path to script Example C:\Temp'
$password = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($pass))
$Action = New-ScheduledTaskAction -Execute 'powershell.exe' -Argument "$path\Syncing_Staging_App-v_Citrix.ps1"
$Trigger = New-ScheduledTaskTrigger -AtStartup -RandomDelay 00:00:30
Register-ScheduledTask -TaskName "App-V Full sync" -action $Action -Trigger $Trigger -RunLevel Highest -User "$user" -Password "$password"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment