PowerShell RunAs


$UserAccount = 'DOMAIN\USERNAME'#用单引号的目的是为了防止有特殊字符
$Password = 'PASSWORD'#同上
$ConvertedToSecurePassword = ConvertTo-SecureString $Password -AsPlainText -Force
$AccountCredential = New-Object System.Management.Automation.PSCredential $UserAccount, $ConvertedToSecurePassword
Start-Process "\\Executable_EXE_FILE_PATH.EXE" -Credential $AccountCredential
#编译成EXE就看不到密码了
×用微信扫描并分享
本文链接: https://www.pstips.net/powershell-runas.html
请尊重原作者和编辑的辛勤劳动,欢迎转载,并注明出处!

发表评论

电子邮件地址不会被公开。 必填项已用*标注