add CiscoUCSCentral
This commit is contained in:
parent
b76668c1e7
commit
f2ed54ce34
@ -15,7 +15,16 @@ function Connect-To {
|
|||||||
|
|
||||||
.PARAMETER Type
|
.PARAMETER Type
|
||||||
Specify the host type of the target. Currently implemented targets are: Possible connection values are:
|
Specify the host type of the target. Currently implemented targets are: Possible connection values are:
|
||||||
CiscoUcs, FTP, NetAppFAS, VMware, CisServer, ExchangeHTTP, ExchangeHTTPS, SCP.
|
|
||||||
|
- CiscoUcs
|
||||||
|
- CiscoUcsCentral
|
||||||
|
- CisServer
|
||||||
|
- ExchangeHTTP
|
||||||
|
- ExchangeHTTPS
|
||||||
|
- FTP
|
||||||
|
- NetAppFAS
|
||||||
|
- SCP
|
||||||
|
- VMware
|
||||||
|
|
||||||
.PARAMETER Credentials
|
.PARAMETER Credentials
|
||||||
Use this parameter to bypass the stored credentials. Without this parameter Connect-To tries to read the
|
Use this parameter to bypass the stored credentials. Without this parameter Connect-To tries to read the
|
||||||
@ -41,6 +50,9 @@ function Connect-To {
|
|||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Connect-To -RemoteHost "ucs.myside.local" -Type CiscoUcs
|
Connect-To -RemoteHost "ucs.myside.local" -Type CiscoUcs
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
Connect-To -RemoteHost "ucscentral.myside.local" -Type 'CiscoUcsCentral'
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Connect-To -RemoteHost "ftp.myside.local" -Type FTP
|
Connect-To -RemoteHost "ftp.myside.local" -Type FTP
|
||||||
|
|
||||||
@ -79,6 +91,7 @@ function Connect-To {
|
|||||||
[Parameter(Mandatory = $true, ParameterSetName = 'Private')]
|
[Parameter(Mandatory = $true, ParameterSetName = 'Private')]
|
||||||
[ValidateSet(
|
[ValidateSet(
|
||||||
'CiscoUcs',
|
'CiscoUcs',
|
||||||
|
'CiscoUcsCentral',
|
||||||
'FTP',
|
'FTP',
|
||||||
'NetAppFAS',
|
'NetAppFAS',
|
||||||
'VMware',
|
'VMware',
|
||||||
@ -189,6 +202,20 @@ function Connect-To {
|
|||||||
Write-Error @MessageParams
|
Write-Error @MessageParams
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
"CiscoUcsCentral" {
|
||||||
|
try {
|
||||||
|
$handle = Connect-UcsCentral -Name $RemoteHost -Credential $creds -NotDefault
|
||||||
|
$ExecutionContext.SessionState.PSVariable.Set('DefaultUcsCentral', $handle)
|
||||||
|
}
|
||||||
|
|
||||||
|
catch {
|
||||||
|
$MessageParams = @{
|
||||||
|
Message = ('Unable to connect to {0} using {1}' -f $RemoteHost, $Type)
|
||||||
|
ErrorAction = 'Stop'
|
||||||
|
}
|
||||||
|
Write-Error @MessageParams
|
||||||
|
}
|
||||||
|
}
|
||||||
"FTP" {
|
"FTP" {
|
||||||
# First establish the FTP session
|
# First establish the FTP session
|
||||||
$WinSCPConParams = @{
|
$WinSCPConParams = @{
|
||||||
|
@ -14,8 +14,17 @@ function Disconnect-From {
|
|||||||
same hostname.
|
same hostname.
|
||||||
|
|
||||||
.PARAMETER Type
|
.PARAMETER Type
|
||||||
Specify the host type of the target. Currently implemented targets are: CiscoUcs, FTP, NetAppFAS, VMware,
|
Specify the host type of the target. Currently implemented targets are:
|
||||||
CisServer, ExchangeHTTP, ExchangeHTTPS, SCP.
|
|
||||||
|
- CiscoUcs
|
||||||
|
- CiscoUcsCentral
|
||||||
|
- FTP
|
||||||
|
- NetAppFAS
|
||||||
|
- VMware
|
||||||
|
- CisServer
|
||||||
|
- ExchangeHTTP
|
||||||
|
- ExchangeHTTPS
|
||||||
|
- SCP
|
||||||
|
|
||||||
.PARAMETER Force
|
.PARAMETER Force
|
||||||
Force the disconnect, even if the disconnect would fail.
|
Force the disconnect, even if the disconnect would fail.
|
||||||
@ -64,6 +73,7 @@ function Disconnect-From {
|
|||||||
[Parameter(Mandatory = $true)]
|
[Parameter(Mandatory = $true)]
|
||||||
[ValidateSet(
|
[ValidateSet(
|
||||||
'CiscoUcs',
|
'CiscoUcs',
|
||||||
|
'CiscoUcsCentral',
|
||||||
'FTP',
|
'FTP',
|
||||||
'NetAppFAS',
|
'NetAppFAS',
|
||||||
'VMware',
|
'VMware',
|
||||||
@ -85,10 +95,10 @@ function Disconnect-From {
|
|||||||
"VMware" {
|
"VMware" {
|
||||||
try {
|
try {
|
||||||
if ($Force) {
|
if ($Force) {
|
||||||
Disconnect-VIServer -Server $RemoteHost -Confirm:$false -ErrorAction Stop -Force:$true
|
Disconnect-VIServer -Server $RemoteHost -Confirm:$false -ErrorAction 'Stop' -Force:$true
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Disconnect-VIServer -Server $RemoteHost -Confirm:$false -ErrorAction Stop
|
Disconnect-VIServer -Server $RemoteHost -Confirm:$false -ErrorAction 'Stop'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,10 +114,10 @@ function Disconnect-From {
|
|||||||
"CisServer" {
|
"CisServer" {
|
||||||
try {
|
try {
|
||||||
if ($Force) {
|
if ($Force) {
|
||||||
Disconnect-CisServer -Server $RemoteHost -Confirm:$false -ErrorAction Stop -Force:$true
|
Disconnect-CisServer -Server $RemoteHost -Confirm:$false -ErrorAction 'Stop' -Force:$true
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Disconnect-CisServer -Server $RemoteHost -Confirm:$false -ErrorAction Stop
|
Disconnect-CisServer -Server $RemoteHost -Confirm:$false -ErrorAction 'Stop'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,10 +181,24 @@ function Disconnect-From {
|
|||||||
Write-Error @MessageParams
|
Write-Error @MessageParams
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
"CiscoUCSCentral" {
|
||||||
|
try {
|
||||||
|
$handle = Connect-UcsCentral -Name $RemoteHost -Credential $creds -NotDefault
|
||||||
|
$ExecutionContext.SessionState.PSVariable.Set('DefaultUcsCentral', $handle)
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$MessageParams = @{
|
||||||
|
Message = "Unable to disconnect from {0} using Type {1}." -f $RemoteHost, $Type
|
||||||
|
ErrorAction = 'Stop'
|
||||||
|
}
|
||||||
|
Write-Error @MessageParams
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
"ExchangeHTTP*" {
|
"ExchangeHTTP*" {
|
||||||
try {
|
try {
|
||||||
Get-Variable -Name 'PSExchangeRemote' -Scope Global -ErrorAction Stop
|
Get-Variable -Name 'PSExchangeRemote' -Scope 'Global' -ErrorAction 'Stop'
|
||||||
Remove-PSSession -Session $Global:PSExchangeRemote -ErrorAction Stop
|
Remove-PSSession -Session $Global:PSExchangeRemote -ErrorAction 'Stop'
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
$MessageParams = @{
|
$MessageParams = @{
|
||||||
@ -206,6 +230,4 @@ function Disconnect-From {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
end {}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user