Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
$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
You can’t perform that action at this time.