简体   繁体   English

以提升的权限执行远程32位PSSession

[英]Execute a Remote 32 Bit PSSession with elevated rights

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. 由于有cmdlet,此会话必须为32位。 And the script has to be run as admin. 并且该脚本必须以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: 因此,这将启动Powershell的32位版本,但是一旦脚本到达需要提升权限的部分,Shell就会告诉我:

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! 非常感谢您的帮助!

If the server is a 64 bit OS, you'll have to call the 32 bit powershell.exe. 如果服务器是64位操作系统,则必须调用32位powershell.exe。 What if you Invoked the server to run the 32 exe and run the script? 如果调用服务器运行32 exe并运行脚本怎么办? Since your invoking it the program won't show up and the script would have to output some file to see any results. 自从您调用它以来,该程序将不会显示,并且脚本必须输出一些文件才能查看任何结果。

So it turned out that the ConverFrom-AppvLeagcyPackage cmdlet somehow is broken and can't be executed remotely. 因此,事实证明ConverFrom-AppvLeagcyPackage cmdlet某种程度上已损坏,无法远程执行。 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. 作为解决方案,我使用程序Psexec远程运行脚本,尽管仅当您以系统用户身份运行脚本时,该脚本才有效。

Thank you non the less for your help! 多谢您的帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM