windows - Register-ScheduledJob as the system account (without having to pass in credentials) -
i believe register-scheduledtask
can specify -user "system"
or like:
$principal = new-scheduledtaskprincipal -userid system -logontype serviceaccount -runlevel highest
how do register-scheduledjob
?
this command running context of local admin have access this. don't see option in cmdlet.
here example of how scheduled tasks cmdlet
edit: windows make impossible design? if open interactive ps session system (using psexec) , try create schedualed job error:
ps c:\windows\system32> register-scheduledjob -name systemsssss -scriptblock {'s dfsdfsdfsd'} register-scheduledjob : error occurred while registering scheduled job definition systemsssss windows task scheduler. task scheduler error is: (32,4):userid:. @ line:1 char:1 + register-scheduledjob -name systemsssss -scriptblock {'sdfsdfsdfsd'} + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + categoryinfo : invalidoperation: (microsoft.power...edjobdefini tion:scheduledjobdefinition) [register-scheduledjob], scheduledjobexceptio n + fullyqualifiederrorid : cantregisterscheduledjobdefinition,microsoft.pow ershell.scheduledjob.registerscheduledjobcommand
this same command works fine when run local administrator account
sorry, can't make comments reputation under 50.
can use group policy run start script? run local system account. doesn't cmdlet has -verb paramater runas.
looking at: https://technet.microsoft.com/en-us/library/hh849755.aspx under -scheduledjoboption there setting in there runelevated=$false, defualt. if set true run admin?
i haven't tried it, might work.
hope helps.
thanks, tim.
Comments
Post a Comment