Create PSCredential without a password

后端 未结 2 629
悲哀的现实
悲哀的现实 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:40

    Use the Get-Credential cmdlet, when the credential dialog appears, don't type a password

    $cred = Get-Credential pebrian27
    $cred.GetNetworkCredential() | select UserName,Password
    
    UserName   Password
    --------   --------
    pebrian27
    

提交回复
热议问题