How can I use powershell's read-host function to accept a password for an external service?

前端 未结 2 1662
被撕碎了的回忆
被撕碎了的回忆 2020-12-15 03:44

I have a script I\'m writing that makes a connection to a SOAP service. After the connection is made, I need to pass in a the username/pass with every command I send. The pr

2条回答
  •  没有蜡笔的小新
    2020-12-15 04:37

    $Password is a Securestring, and this will return the plain text password.

    [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($Password))
    

提交回复
热议问题