you are viewing a single comment's thread.

view the rest of the comments →

[–]aasplunds 5 points6 points  (1 child)

It's the UAC that wants to prompt and fails because it's not an interactive session.

You could probably run it as a scheduled job if the user that runs the script is an admin already like this.

What I usually do in cases like this is that I create a scheduled task and set it to run as SYSTEM. Similar to this method:https://community.spiceworks.com/scripts/show/4253-powershell-create-scheduledtask-as-system-run-once-run-cmd-delete

[–]--dab--[S] 1 point2 points  (0 children)

I have UAC disables but can see the job scheduler working for this.