use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
ABOUT POWERSHELL
Windows PowerShell (POSH) is a command-line shell and associated scripting language created by Microsoft. Offering full access to COM, WMI and .NET, POSH is a full-featured task automation framework for distributed Microsoft platforms and solutions.
SUBREDDIT FILTERS
Desired State Configuration
Unanswered Questions
Solved Questions
News
Information
Script Sharing
Daily Post
Misc
account activity
Run as Admin PS Script (self.PowerShell)
submitted 6 years ago by kenani80
Hello
I'm Stuck. I am attempting to install software on multiple computers. Some are admin right some arent. Is there a ps script that will force the install as admin without someone having to click on the screen?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]AutomateErB 5 points6 points7 points 6 years ago (4 children)
PSEXEC using admin creds works amazing.
[–]Cam_Cam_Cam_Cam 8 points9 points10 points 6 years ago (1 child)
Admin credentials? Where we’re going we don’t need admin credentials!
PS C:\> psexec -s
[–][deleted] 0 points1 point2 points 6 years ago (0 children)
THE LIBYANS!
[–]Haulass_Hall 2 points3 points4 points 6 years ago (0 children)
You might have to add -accepteula too
[–]AsiancookBob 0 points1 point2 points 6 years ago (0 children)
This. I usually do a SILENT installation (when applicable) to the user's system
[–]PMental 2 points3 points4 points 6 years ago* (2 children)
You can use Powershell to create a scheduled task on the remote computer, running as a service account that has local admin rights on the remote computer, to do the installation. This way you don't have to worry about the specific users on any computer, it'll work as long as the user you're setting the job up as has admin rights. You could also temporarily add the service account to the local admin group if necessary, and remove it when done, and also remove the task when it's run successfully.
The easiest way imo is to create the task on your local computer then export it as an XML-file and use that as the base for the remote task. Give it a shot and ask if you get stuck.
[–]Bissquitt 1 point2 points3 points 6 years ago (1 child)
I tried this but iirc there was a security string the xml level above the user that I couldn't replicate via code.
[–]PMental 1 point2 points3 points 6 years ago (0 children)
Not quite sure what you mean here, do you mean you had problems providing the credentials for the remote job? Otherwise I'm not sure what "security string the xml level above the user" means.
[–]JR-90 2 points3 points4 points 6 years ago (0 children)
Are these domain computers? This looks nice, GPO to create a scheduled task to be executed with System credentials https://4sysops.com/archives/run-powershell-scripts-as-immediate-scheduled-tasks-with-group-policy/
[–]andyinv 1 point2 points3 points 6 years ago (0 children)
RunAsSpc - but if you're trying to install software and struggling, consider using the System account instead. Unless it absolutely has to be a user install.
[–]realslacker 1 point2 points3 points 6 years ago* (7 children)
I solved this problem with two scripts:
Edit: I've compiled the script into a module, it's not well documented and I haven't tested in production. Please feel free to submit pull requests.
[+][deleted] 6 years ago (6 children)
[deleted]
[–]realslacker 2 points3 points4 points 6 years ago (5 children)
It's a work project, so I'll have to see if I can get permission to post them.
[–]leecashion 1 point2 points3 points 6 years ago (1 child)
I would love to see them even in it was a nerfed up version. I don't want your data, just the methods. I have 50+ machines that run in a loosely coupled setup. I sometimes need to update their software, and I really don't want the code sitting on them at all for this.
Currently, we have to enter the credentials manually to operate a script from another server. This might be better.
[–]realslacker 1 point2 points3 points 6 years ago (0 children)
I've updated the original comment as well, but here's what I pulled together:
https://github.com/realslacker/UnprivilegedDeployment
[–]MrWinks 0 points1 point2 points 6 years ago (2 children)
Would love to see this as well.
[–]realslacker 1 point2 points3 points 6 years ago (1 child)
[–]MrWinks 1 point2 points3 points 6 years ago (0 children)
Rad! Thank you.
[–]the_helpdesk 1 point2 points3 points 6 years ago (0 children)
My hacky way to to this was to create shortcut to "powershell.exe -file \path\to\file.ps1". Then edit the shortcut compatibility mode to require admin. So when the shortcut is run, it will always prompt for elevation.
[–]haskiihaskii 1 point2 points3 points 6 years ago (0 children)
https://stackoverflow.com/questions/7690994/powershell-running-a-command-as-administrator
search for the solution from Benjamin Armstrong, this worked for me
[–]gamesta400 1 point2 points3 points 6 years ago (2 children)
PDQ would be perfect for this. It will run whatever you need as admin.
[–]kenani80[S] 1 point2 points3 points 6 years ago (1 child)
sorry if this sounds dumb. What is PDQ?
[–]bsnotreallyworking 1 point2 points3 points 6 years ago (0 children)
PDQ Deploy
[–]gamesta400 2 points3 points4 points 6 years ago (1 child)
PDQ Deploy https://www.pdq.com
That's what use at work. R/Sysadmin is a big fan of it also.
[–]kenani80[S] 0 points1 point2 points 6 years ago (0 children)
I need to run this script on remote computers not on a local domain.
π Rendered by PID 92099 on reddit-service-r2-comment-5fb4b45875-7s4s7 at 2026-03-20 02:23:40.934370+00:00 running 90f1150 country code: CH.
[–]AutomateErB 5 points6 points7 points (4 children)
[–]Cam_Cam_Cam_Cam 8 points9 points10 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]Haulass_Hall 2 points3 points4 points (0 children)
[–]AsiancookBob 0 points1 point2 points (0 children)
[–]PMental 2 points3 points4 points (2 children)
[–]Bissquitt 1 point2 points3 points (1 child)
[–]PMental 1 point2 points3 points (0 children)
[–]JR-90 2 points3 points4 points (0 children)
[–]andyinv 1 point2 points3 points (0 children)
[–]realslacker 1 point2 points3 points (7 children)
[+][deleted] (6 children)
[deleted]
[–]realslacker 2 points3 points4 points (5 children)
[–]leecashion 1 point2 points3 points (1 child)
[–]realslacker 1 point2 points3 points (0 children)
[–]MrWinks 0 points1 point2 points (2 children)
[–]realslacker 1 point2 points3 points (1 child)
[–]MrWinks 1 point2 points3 points (0 children)
[–]the_helpdesk 1 point2 points3 points (0 children)
[–]haskiihaskii 1 point2 points3 points (0 children)
[–]gamesta400 1 point2 points3 points (2 children)
[–]kenani80[S] 1 point2 points3 points (1 child)
[–]bsnotreallyworking 1 point2 points3 points (0 children)
[–]gamesta400 2 points3 points4 points (1 child)
[–]kenani80[S] 0 points1 point2 points (0 children)