简体   繁体   中英

How to Powershell a script for Task Manager to "run whether a user is logged on or not"

Hell all. I am creating a script to start a Task Scheduler. I have most of the code written. Need to do a -WindowsStyle Hidden. It will pop the screen for just a moment then disappear. When I go to Task Scheduler and check the "run whether a user is logged on or not" box it will be all the way hidden. No screen pops.
I cannot manually set this attribute on every machine. These are not AD machines. These machines are completely offline and may have different user names and passwords.

So, I guess the question is how to set Attribute to "run whether a user is logged on or not" within the PS script?

Thanks in advance.

I do not have much experience with PowerShell. Do you create the task with PowerShell? If yes, try this:

$user = "NT AUTHORITY\SYSTEM" 
Register-ScheduledTask -User $User 

NT AUTHORITY\\SYSTEM is a built-in Windows account. It is the most powerful account on a local Windows instance (more powerful than any admin account).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM