PowerShell script exchange
BenjaminB
Novice
Posts: 9 Liked: never
Joined: Mar 06, 2019 8:52 am
Full Name: Benjamin Bordasch
Contact:
Post
by BenjaminB » Mar 20, 2019 10:43 am
this post
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: 20450 Liked: 2318 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:
Post
by veremin » Mar 20, 2019 11:42 am
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:
Post
by BenjaminB » Mar 20, 2019 12:49 pm
this post
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!
Users browsing this forum: No registered users and 5 guests