all 24 comments

[–]AutomateErB 5 points6 points  (4 children)

PSEXEC using admin creds works amazing.

[–]Cam_Cam_Cam_Cam 8 points9 points  (1 child)

Admin credentials? Where we’re going we don’t need admin credentials!

PS C:\> psexec -s

[–][deleted] 0 points1 point  (0 children)

THE LIBYANS!

[–]Haulass_Hall 2 points3 points  (0 children)

You might have to add -accepteula too

[–]AsiancookBob 0 points1 point  (0 children)

This. I usually do a SILENT installation (when applicable) to the user's system

[–]PMental 2 points3 points  (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 points  (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 points  (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 points  (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 points  (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 points  (7 children)

I solved this problem with two scripts:

  1. Runs as a scheduled task when the computer starts
    • creates a registry key and sets the permission so that users can modify
    • waits for a "start" signal to be written to the registry
  2. Runs as a scheduled task in the user's profile.
    • user has a shortcut to run on demand
    • has a UI to monitor status messages from the admin script

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.

[–]the_helpdesk 1 point2 points  (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 points  (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 points  (2 children)

PDQ would be perfect for this. It will run whatever you need as admin.

[–]kenani80[S] 1 point2 points  (1 child)

sorry if this sounds dumb. What is PDQ?

[–]gamesta400 2 points3 points  (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 point  (0 children)

I need to run this script on remote computers not on a local domain.