PowerShell script exchange
Post Reply
BenjaminB
Novice
Posts: 9
Liked: never
Joined: Mar 06, 2019 8:52 am
Full Name: Benjamin Bordasch
Contact:

Connect-VBRServer - Password AsSecureString

Post by BenjaminB »

Hello,

i try to connect with our backup-server. And i want to hide the password if i type it into the console:
Add-PSSnapin VeeamPSSnapin
$pass = Read-Host 'Password' -AsSecureString
Connect-VBRServer -server "<Backup-Server>" -User "<User>" -Password "$pass"
I tried it also with '$pass' and only $pass.

But it doesnt work...

Any Idea ?

Thanks !
veremin
Product Manager
Posts: 20284
Liked: 2258 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Connect-VBRServer - Password AsSecureString

Post by veremin » 1 person likes this post

It doesn't work, because -Password parameter expects String object, not Secure.String one. To fix it you will need to convert secure string to string first (ConvertFrom-SecureString). Thanks
BenjaminB
Novice
Posts: 9
Liked: never
Joined: Mar 06, 2019 8:52 am
Full Name: Benjamin Bordasch
Contact:

Re: Connect-VBRServer - Password AsSecureString

Post by BenjaminB »

Thanks for your quick reply.
It works now.
But now i use the following command:
Connect-VBRServer -server "<server>" -Credential (Get-Credential -Message "Test" -UserName "<user>")
Thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests