For all intents and purposes, I am a novice with PS.
The command I'd like to run (it works when run manually) is:
(I realize parts are probably redundant)
Start-Process -WindowStyle hidden "$psHome\powershell.exe" -verb runas -ArgumentList "-file c:\distributedfiles\source.ps1 -ErrorAction SilentlyContinue"
I want this ^ command to execute from a Scheduled Task which needs to be created via powershell.
I've tried such things as:
schtasks.exe /create /tn backuptest /tr "c:\distributedfiles" "powershell.exe `-executionpolicy unrestricted -file c:\distributedfiles\source.ps1 -verb runas -erroraction silentlycontinue`" /d mon /sc once /st 12:33 /rl highest /f /z
To no success. I know I am wayyy off the mark with my syntax. Help would be appreciated!
edit: in this case would it be easier to just have 2 .ps1 files one with my Start-Process command, it would be invoked by scheduled task - then invoke my main source script? I sorta imagine that being easiest.