Hi all,
i am new with the powershell and want to knwo how i can do a secure connection to the vcenter.
I knwo it is possible with the connect-viserver cmd´let. But i do not want do type my user an password in clear.
So i wan´t a connection with the local user that is logged on my pc. I read something about a cred file but i am not sure how it works
Thanks for your help
Frank
The default credentials that are used to connect to the vCenter server with the Connect-VIServer cmdlet, are the credentials that you logged into your client computer. If these credentials are sufficient to connect to the vCenter server, you don't have to specify the credentials to the cmdlet. In this case the next command will connect to your vcenter server:
Connect-VIServer YourvCenterServer
This is very usefull if you run a PowerCLI script as a scheduled task. Create a service account with enough rights and run the task with this account.
If you need to specify different credentials, you can do this without showing the password in clear text with:
Connect-VIServer YourvCenterServer -Credential (Get-Credential)
In this case you get a "Windows PowerShell Credential Request" pop-up box, in which you can specify the username and password.
Regards, Robert
Hi Frank,
You can try below step,
Firstly you need to store credential:
New-VICredentialStoreItem -Host 192.168.101.1 -Password password -User root -file C:\vicredentials.xml
This will save the password in encrypted form in an xml.
then you can use this cred file as shown below,
$creds = Get-VICredentialStoreItem -file C:\vicredentials.xml Connect-VIServer -Server $creds.Host -user $creds.User -password $creds.Password
-If you found this information useful, please consider awarding points for Correct or Helpful.
Hi thanks for the fast reply,
in the first section to store the credential, i do not want to type the passwort in the script. So is it possible to get something like a popup or window where you can write the credentials in it?
Frank
The default credentials that are used to connect to the vCenter server with the Connect-VIServer cmdlet, are the credentials that you logged into your client computer. If these credentials are sufficient to connect to the vCenter server, you don't have to specify the credentials to the cmdlet. In this case the next command will connect to your vcenter server:
Connect-VIServer YourvCenterServer
This is very usefull if you run a PowerCLI script as a scheduled task. Create a service account with enough rights and run the task with this account.
If you need to specify different credentials, you can do this without showing the password in clear text with:
Connect-VIServer YourvCenterServer -Credential (Get-Credential)
In this case you get a "Windows PowerShell Credential Request" pop-up box, in which you can specify the username and password.
Regards, Robert
Wow,
thanks both very much.
Thats what i am searching for.
Frank
If you find this information useful, please award points for "correct" or "helpful".
Wow,
thanks both very much.
Thats what i am searching for.
Frank
If you find this information useful, please award points for "correct" or "helpful".