Create PSCredential without a password

后端 未结 2 503
悲哀的现实
悲哀的现实 2020-12-18 17:59

How to create a instance of PSCredential that has no password? (Without manually filling out a Get-Credential dialog with no password, this is for unattended ru

2条回答
  •  有刺的猬
    2020-12-18 18:36

    Solution:

    $mycreds = New-Object System.Management.Automation.PSCredential 
                  ("username", (new-object System.Security.SecureString))
    

提交回复
热议问题