Implement StorageGRID connection #79

Open
pinguinfuss wants to merge 23 commits from pinguinfuss/PSCredentialStore:ConnectTo-StorageGRID into master
Showing only changes of commit 22631f2836 - Show all commits

View File

@ -264,38 +264,30 @@ function Connect-To {
}
}
'NetAppFAS' {
# Construct the splatting for Connect-NcController
$params = @{
Name = $RemoteHost
Credential = $creds
HTTPS = $true
}
# Check if -PassThru was passed. If so, a) do not set the default variable and b) return the
# session object to the caller.
if ($PSBoundParameters.ContainsKey('PassThru')) {
$params.Add('Transient', $true)
}
try {
$null = Connect-NcController -Name $RemoteHost -Credential $creds -ErrorAction Stop -HTTPS
$handle = Connect-NcController @params
}
catch {
# Write a error message to the log.
Write-Error -Message ('Unable to connect to {0} using Type {1}.' -f $RemoteHost, $Type)
}
}
'VMware' {
try {
Connect-VIServer -Server $RemoteHost -Credential $creds -ErrorAction Stop | Out-Null
}
catch {
# Write a error message to the log.
Write-Error -Message ('Unable to connect to {0} using Type {1}.' -f $RemoteHost, $Type)
}
}
'VMwareCisServer' {
try {
if ($PassThru.IsPresent) {
Connect-CisServer -Server $RemoteHost -Credential $creds
}
else {
$null = Connect-CisServer -Server $RemoteHost -Credential $creds
}
}
catch {
# Write a error message to the log.
Write-Error -Message ('Unable to connect to {0} using Type {1}.' -f $RemoteHost, $Type)
if ($PSBoundParameters.ContainsKey('PassThru')) {
return $handle
}
}
'SCP' {
@ -324,6 +316,31 @@ function Connect-To {
Write-Error -Message $m
}
}
'VMware' {
try {
Connect-VIServer -Server $RemoteHost -Credential $creds -ErrorAction Stop | Out-Null
}
catch {
# Write a error message to the log.
Write-Error -Message ('Unable to connect to {0} using Type {1}.' -f $RemoteHost, $Type)
}
}
'VMwareCisServer' {
try {
if ($PassThru.IsPresent) {
Connect-CisServer -Server $RemoteHost -Credential $creds
}
else {
$null = Connect-CisServer -Server $RemoteHost -Credential $creds
}
}
catch {
# Write a error message to the log.
Write-Error -Message ('Unable to connect to {0} using Type {1}.' -f $RemoteHost, $Type)
}
}
default {
# Write a error message to the log.
Write-Error -Message ('Unable to connect to {0} using Type {1}.' -f $RemoteHost, $Type)