mkellerman / Invoke-CommandAs

Invoke Command As System/Interactive/GMSA/User on Local/Remote machine & returns PSObjects.
https://www.powershellgallery.com/packages/Invoke-CommandAs/
MIT License
457 stars 70 forks source link

Fix issue #51 #54

Closed SpaceCheetah closed 3 years ago

SpaceCheetah commented 3 years ago

The last pull request by hartleyj fixed running on battery power when running as a job, but not when running as a task, so it still didn't work for running with -AsSsytem, -AsInteractive, -AsUser, or -AsGMSA. Fixed that by adding a New-ScheduledTaskSettingsSet to $TaskParameters and setting -AllowStartIfOnBatteries and -DontStopIfGoingOnBatteries.