Windows 如何使用不同的用户帐户运行powershell脚本或更改会话并执行代码?
我需要使用当前作为系统用户运行的ec2 userdata中的域用户帐户运行脚本 我的代码:Windows 如何使用不同的用户帐户运行powershell脚本或更改会话并执行代码?,windows,powershell,amazon-ec2,user-accounts,user-data,Windows,Powershell,Amazon Ec2,User Accounts,User Data,我需要使用当前作为系统用户运行的ec2 userdata中的域用户帐户运行脚本 我的代码: start-Process powershell.exe -Credential $credential -ArgumentList “Start-Process powershell.exe 'C:\Users\test\Desktop\Test\test.ps1' -Verb runAs” 但是它正在创建一个弹出窗口,这可能会导致执行中出现错误只需在末尾添加NoNewWindow开关即可 sta
start-Process powershell.exe -Credential $credential -ArgumentList “Start-Process powershell.exe
'C:\Users\test\Desktop\Test\test.ps1' -Verb runAs”
但是它正在创建一个弹出窗口,这可能会导致执行中出现错误只需在末尾添加NoNewWindow开关即可
start-Process powershell.exe -Credential $credential -ArgumentList “Start-Process powershell.exe 'C:\Users\test\Desktop\Test\test.ps1' -Verb runAs” -NoNewWindow