Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
50 lines (42 sloc) 1.44 KB
Function Connect-vCenterServer {
Connect to VMWare vCenter Server
Connect to VMWare vCenter Server
.PARAMETER vCenterServer
Select the vCenterServer to connect to
Automatically appends the user's domain
Connect-vCenterServer -vCenterServer VC01
Connects to the VMWare vCenter server [if is your local DNS Domain]
Name: Connect-vCenterServer.ps1
Author: Robert Prüst
DateCreated: 16-03-2018
DateModified: 16-03-2018
[Parameter(Position = 0, Mandatory = $true)]
$Credential = (Get-Credential -Message 'Enter vCenter server credentials' -username $env:USERNAME)
$vCenterServerName = $vCenterServer + '.' + $Env:USERDNSDOMAIN
Write-Verbose $vCenterServerName
if ($global:DefaultVIServer.Name -notcontains $vCenterServerName) {
Write-Verbose "Connecting to vCenter server '$vCenterServerName' "
Connect-VIServer -Server $vCenterServerName -Credential $Credential
else {
Write-Warning "Already connected to vCenter server '$vCenterServerName'"