我使用Invoke-Item
命令启动应用程序。当我运行它时,它会提示输入用户名和密码。我想通过PowerShell
自动填写,这可以实现吗?
答案 0 :(得分:0)
您可以使用[-Credential <PSCredential>]
PSCredential object
参数执行此操作:
# Edit your creds here
$user = "Domain\Username"
$password = ConvertTo-SecureString "MyPassword" -AsPlainText -Force
$mycreds = New-Object System.Management.Automation.PSCredential ($user, $password)
Invoke-Item "Your Application" -Credential $mycreds