Question

So I'm trying to get a script to run a script from a server remotely on another server. This session has to be 32 bit because of a cmdlet. And the script has to be run as admin. I've tried this:

Invoke-Command -ComputerName isg108-81 -FilePath C:\inetpub\scrip\ConvertAppvPackages.ps1 -ConfigurationName microsoft.powershell32 -credentials Admin

So this starts the 32 bit version of powershell, but as soon as the script gets to the part where it needs elevated rights the shell tells me:

You must run this cmdlet using a Windows PowerShell elevated command prompt . To run
an elevated command prompt, right-click the Windows PowerShell or Command Prompt Start
menu object that you are using to start your Windows PowerShell sessions, and then 
Select Run as administrator.

Anybody got any ideas?

Thnx a lot for your help!

Was it helpful?

Solution 2

So it turned out that the ConverFrom-AppvLeagcyPackage cmdlet somehow is broken and can't be executed remotely. As a solution I used the program Psexec to run the script remotely, although it only works if you run it as the system user.

Thank you non the less for your help!

OTHER TIPS

If the server is a 64 bit OS, you'll have to call the 32 bit powershell.exe. What if you Invoked the server to run the 32 exe and run the script? Since your invoking it the program won't show up and the script would have to output some file to see any results.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top