#requires -version 3.0 #Run this with elevated admin credentials #define a location for the help files $HelpPath= "\\jdh-nvnas\files\PowerShell_Help" $TaskName="Download PowerShell v3 Help" #when to run the task $trigger = New-JobTrigger -Daily -At 6:00AM #define a scriptblock #This command is NOT taking any cultures into account $Action={Param([string]$Path) Save-Help -DestinationPath $Path -Force} #define some options $option = New-ScheduledJobOption -RunElevated -RequireNetwork #get a credential $cred = Get-Credential -UserName "$env:userdomain\$env:username" -Message "Enter a credential for the network share $helppath" #create the scheduled job under Microsoft\Windows\PowerShell\SchedJobs Register-ScheduledJob -Name $Taskname -Trigger $Trigger -ScriptBlock $Action -ArgumentList $HelpPath -ScheduledJobOption $option <# manually edit the scheduled task in task scheduler to set things like timeout and to store the password so non-local resources can be accessed. #>