Quantcast
Channel: VMware Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 207710

Connect Vi-Server in secure way

$
0
0

Hi,

 

I have a script which will connect to a VC with following command:

 

connect-viserver -server VCName -User username -Pasword password

 

Now I want to do it in a secured way so that if anyone check the script can not know the password. I know there is way to conevert the password to secure string and store in a file as mentioned below:

 

read-host -assecurestring | convertfrom-securestring | output-file c:\cred.txt

 

then I will use the contents of cred.txt file to get the password as below:

 

$pass = get-content c:\cred.txt | covertto-securestring

connect-viserver -server vcname -user username -password $pass

 

But if the password contains a special character like @ or $ then it is not getting connected to the VC with a error like incorrect username and password.

 

Any help will be appreciated.


Viewing all articles
Browse latest Browse all 207710

Trending Articles



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