Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

windows run powershell script from task scheduler

$Trigger= New-ScheduledTaskTrigger -At 10:00am –Daily # Specify the trigger settings
$User= "NT AUTHORITYSYSTEM" # Specify the account to run the script
$Action= New-ScheduledTaskAction -Execute "PowerShell.exe" -Argument "C:PSStartupScript.ps1" # Specify what program to run and with its parameters
Register-ScheduledTask -TaskName "MonitorGroupMembership" -Trigger $Trigger -User $User -Action $Action -RunLevel Highest –Force # Specify the name of the task
Source by blog.netwrix.com #
 
PREVIOUS NEXT
Tagged: #windows #run #powershell #script #task #scheduler
ADD COMMENT
Topic
Name
7+8 =