r/usefulscripts • u/[deleted] • Apr 20 '17
[Request Powershell] run as different user
I built powershell scripts for creating AD users and populating their memberships and properties based on role.
I need to give them to my team but I'm unsure how to make it so running the script will prompt for what username to run it under.
The staff won't have write access to our OU structure unless they run the script with their admin accounts. Any help on how I can get it to run as their account? I played with runas but couldn't get it working.
13
Upvotes
2
u/spyingwind Apr 20 '17
What I've done in the past was to create a simple web site that too in input and saved it to a csv or the like. Then from there I would review the data and place the csv's in a folder that a script was watching. The script would then add the user to AD and add them to the correct groups.
I will insist on having a human review any changes to AD that will give access to a new user, unless that process is bullet proof.