How can I run a mixed user/admin remediation script in PowerShell?

0
1
Asked By TechieGuru42 On

I'm facing a dilemma with a remediation script I want to create for users. The goal is to automate common issues I've been getting ticket requests for. However, some tasks in the script need to run in the user context while others require admin privileges. I'm considering having users execute the script, but I'm concerned about the prompts for admin consent. Is there a method to maintain an elevated PowerShell session throughout the script execution, or should I compile a list of admin-required actions and run them using 'run as'? Any suggestions?

1 Answer

Answered By AdminWhisperer88 On

You can use `Enter-PSSession` with your admin credentials, which avoids those annoying prompts if everything is set correctly. Just ensure that PowerShell remoting is enabled on the devices. Check the Microsoft docs for guidelines on that.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.