Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

This is as close to the exact question that I have, but looks like he found another way that fits the needs so it has been marked as answered:

I have a Powershell script running on server A that I want to launch a different Powershell script on server B.

The script on server B will run fine if I run it locally, but it has to be launched as if by the Run as Administrator option. I can't find a way to launch the script on server B from server A that won't give me a permissions issue.

So far, I've tried:

  • invoke-command using a PScreds object with the local admin account
  • start-process throw a PSSession using the -Verb runas flag modifying the server B script to "Self elevate", but it still fails from A
  • creating a batch file wrapper with Start-process

Is there another way to try that I haven't come up with? The purpose, (in case someone has an all-around better way) is to kick off Windows Updates on server B from server A. I want to be able to do this on demand and not have a Scheduled Task that I'll eventually forget about and have trigger when I don't want it to.

share|improve this question

migrated from stackoverflow.com Aug 23 '12 at 12:28

This question came from our site for professional and enthusiast programmers.

2 Answers 2

Is using psexec.exe an option? If so you can use it with the -h parameter.

If the target system is Vista or higher, has the process run with the account's elevated token, if available.

share|improve this answer

I'd be tempted to make a call to SCHTASKS.EXE, and use its /RL HIGHEST option. I appreciate that this is stepping outside of the Windows Server 2008 / PowerShell "remoting" arena, but it does at least work.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.