Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Powershell 使用提升的权限执行远程32位PSSession_Powershell_Remote Connection - Fatal编程技术网

Powershell 使用提升的权限执行远程32位PSSession

Powershell 使用提升的权限执行远程32位PSSession,powershell,remote-connection,Powershell,Remote Connection,因此,我正在尝试获取一个脚本,以便在另一台服务器上远程运行来自服务器的脚本。由于cmdlet,此会话必须为32位。脚本必须以管理员身份运行。 我试过这个: Invoke-Command -ComputerName isg108-81 -FilePath C:\inetpub\scrip\ConvertAppvPackages.ps1 -ConfigurationName microsoft.powershell32 -credentials Admin 这将启动32位版本的powershell

因此,我正在尝试获取一个脚本,以便在另一台服务器上远程运行来自服务器的脚本。由于cmdlet,此会话必须为32位。脚本必须以管理员身份运行。 我试过这个:

Invoke-Command -ComputerName isg108-81 -FilePath C:\inetpub\scrip\ConvertAppvPackages.ps1 -ConfigurationName microsoft.powershell32 -credentials Admin
这将启动32位版本的powershell,但一旦脚本到达需要提升权限的部分,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.
有人有什么想法吗


非常感谢你的帮助

如果服务器是64位操作系统,则必须调用32位powershell.exe。如果您调用服务器来运行32 exe并运行脚本呢?由于您调用它,程序将不会显示,脚本必须输出一些文件才能看到任何结果。

因此,ConverFrom-AppvLeagcyPackage cmdlet不知何故已损坏,无法远程执行。作为一种解决方案,我使用程序Psexec远程运行脚本,尽管它仅在您作为系统用户运行时才起作用


非常感谢你的帮助

这很奇怪,因为远程处理会话通常已经运行提升模式,这就是为什么您需要管理员凭据来启动远程处理会话。在脚本运行时,有没有办法切换到提升模式@Keithhilth切换到提升模式的唯一方法是使用
启动进程powershell.exe-arg'c:\blah\script.ps1'-动词runas
。假定用户具有管理员权限,但在UAC中使用标准用户令牌运行。您还可以使用-Credentials参数而不是
-Verb runas
以具有管理员权限的其他用户身份运行。如果您有权访问远程计算机,我将坚持使用
$pid;在命令失败之前立即启动Sleep-secs 120
。返回pid后,登录到远程计算机,启动任务管理器,找到pid(应该是WinRM宿主进程),并查看进程是否提升。注意,您可能需要在“详细信息”视图中添加该列。