Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

How could I verify a password is correct before continuing the script?

$
0
0

I have a PS script which takes user input to build a command list, and then SSH'es into a network device to excute the command list.  The network device is not AD integrated.  The user inputs the password AsSecureString and then it is decrypted to enter into the network device.  All of this is working fine.

But the problem I have is when the user supplies the incorrect password.  The network device login will fail of course and be stuck at the "password" prompt and suspends the script.  You can enter the correct credentials, but the problem is ths prompt will repeat for every command in the list.

Is there a way to save the password encrypted in the PS script, and have it compared against the user input before continuing to the network device logon?  As long as the password is not stored as clear text in the script that would be acceptable.


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>