Implements CisServer connection handling #10
20
appveyor.yml
20
appveyor.yml
@ -42,15 +42,15 @@ test_script:
|
|||||||
- ps: Invoke-AppVeyorTests
|
- ps: Invoke-AppVeyorTests
|
||||||
- ps: Invoke-CoverageReport
|
- ps: Invoke-CoverageReport
|
||||||
|
|
||||||
#deploy:
|
deploy:
|
||||||
# - provider: GitHub
|
- provider: GitHub
|
||||||
# auth_token:
|
auth_token:
|
||||||
# secure: M+bBX5/nKdJB0eViP7xtrLVTwf3vGDUA9N2MMprZp2i+9ZR3CBVcJnSzJWUmalhB
|
secure: M+bBX5/nKdJB0eViP7xtrLVTwf3vGDUA9N2MMprZp2i+9ZR3CBVcJnSzJWUmalhB
|
||||||
# artifact: PSCredentialStore.zip # upload all NuGet packages to release assets
|
artifact: PSCredentialStore.zip # upload all NuGet packages to release assets
|
||||||
# draft: false
|
draft: false
|
||||||
# prerelease: true
|
prerelease: true
|
||||||
# on:
|
on:
|
||||||
# branch: master # release from master branch only
|
branch: dev # release from master branch only
|
||||||
#
|
|
||||||
#after_deploy:
|
#after_deploy:
|
||||||
# - ps: Invoke-AppVeyorPSGallery
|
# - ps: Invoke-AppVeyorPSGallery
|
||||||
|
@ -19,6 +19,7 @@ function Connect-To {
|
|||||||
- FTP Establish a connection to a FTP host.
|
- FTP Establish a connection to a FTP host.
|
||||||
- NetAppFAS Establish a connection to a NetApp Clustered ONTAP filer.
|
- NetAppFAS Establish a connection to a NetApp Clustered ONTAP filer.
|
||||||
- VMware Establish a connection to a VMware vCenter or ESXi host.
|
- VMware Establish a connection to a VMware vCenter or ESXi host.
|
||||||
|
- CisServer Establish a connection to a Vmware CisServer.
|
||||||
|
|
||||||
.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
|
||||||
@ -40,10 +41,19 @@ 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 "ftp.myside.local" -Type FTP
|
Connect-To -RemoteHost "ftp.myside.local" -Type FTP
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
Connect-To -RemoteHost "fas.myside.local" -Type NetAppFAS
|
Connect-To -RemoteHost "fas.myside.local" -Type NetAppFAS
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
Connect-To -RemoteHost "esx01.myside.local" -Type VMware
|
Connect-To -RemoteHost "esx01.myside.local" -Type VMware
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
Connect-To -RemoteHost "vCenter.myside.local" -Type CisServer
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
$MyCreds = Get-Credential
|
$MyCreds = Get-Credential
|
||||||
Connect-To -RemoteHost "vcr01.myside.local" -Type VMware -Credentials $MyCreds
|
Connect-To -RemoteHost "vcr01.myside.local" -Type VMware -Credentials $MyCreds
|
||||||
@ -53,7 +63,7 @@ function Connect-To {
|
|||||||
.NOTES
|
.NOTES
|
||||||
File Name : Connect-To.ps1
|
File Name : Connect-To.ps1
|
||||||
Author : Marco Blessing - marco.blessing@googlemail.com
|
Author : Marco Blessing - marco.blessing@googlemail.com
|
||||||
Requires : PSFTP, PowerCLI
|
Requires :
|
||||||
|
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/OCram85/PSCredentialStore
|
https://github.com/OCram85/PSCredentialStore
|
||||||
@ -70,7 +80,7 @@ function Connect-To {
|
|||||||
|
|
||||||
[Parameter(Mandatory = $true, ParameterSetName = "Shared")]
|
[Parameter(Mandatory = $true, ParameterSetName = "Shared")]
|
||||||
[Parameter(Mandatory = $true, ParameterSetName = "Private")]
|
[Parameter(Mandatory = $true, ParameterSetName = "Private")]
|
||||||
[ValidateSet("CiscoUcs", "FTP", "NetAppFAS", "VMware")]
|
[ValidateSet("CiscoUcs", "FTP", "NetAppFAS", "VMware", "CisServer")]
|
||||||
[String]$Type,
|
[String]$Type,
|
||||||
|
|
||||||
[Parameter(Mandatory = $False, ParameterSetName = "Shared")]
|
[Parameter(Mandatory = $False, ParameterSetName = "Shared")]
|
||||||
@ -199,6 +209,20 @@ function Connect-To {
|
|||||||
Write-Error @MessageParams
|
Write-Error @MessageParams
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
"CisServer" {
|
||||||
|
try {
|
||||||
|
Connect-CisServer -Server $RemoteHost -Credential $creds -ErrorAction Stop | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
|
catch {
|
||||||
|
# Write a error message to the log.
|
||||||
|
$MessageParams = @{
|
||||||
|
Message = "Unable to connect to {0} using Type {1}." -f $RemoteHost, $Type
|
||||||
|
ErrorAction = "Stop"
|
||||||
|
}
|
||||||
|
Write-Error @MessageParams
|
||||||
|
}
|
||||||
|
}
|
||||||
default {
|
default {
|
||||||
# Write a error message to the log.
|
# Write a error message to the log.
|
||||||
$MessageParams = @{
|
$MessageParams = @{
|
||||||
|
@ -15,11 +15,11 @@ function Disconnect-From {
|
|||||||
|
|
||||||
.PARAMETER Type
|
.PARAMETER Type
|
||||||
Specify the host type of the target. Currently implemented targets are:
|
Specify the host type of the target. Currently implemented targets are:
|
||||||
- CiscoUcs Establish a connection to a Cisco UCS Fabric Interconnect.
|
- CiscoUcs Terminates the connection from a Cisco UCS Fabric Interconnect.
|
||||||
- FTP Establish a connection to a FTP host.
|
- FTP Terminates the connection from a FTP host.
|
||||||
- NetAppFAS Establish a connection to a NetApp Clustered ONTAP filer.
|
- NetAppFAS Terminates the connection from a NetApp Clustered ONTAP filer.
|
||||||
- VMware Establish a connection to a VMware vCenter or ESXi host.
|
- VMware Terminates the connection from a VMware vCenter or ESXi host.
|
||||||
|
- CisServer Terminates the connection from a Vmware CisServer.
|
||||||
.PARAMETER Force
|
.PARAMETER Force
|
||||||
Force the disconnect, even if the disconnect would fail.
|
Force the disconnect, even if the disconnect would fail.
|
||||||
|
|
||||||
@ -44,8 +44,11 @@ function Disconnect-From {
|
|||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Disconnect-From -RemoteHost "esx01.myside.local" -Type VMware -Force:$True
|
Disconnect-From -RemoteHost "esx01.myside.local" -Type VMware -Force:$True
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
Disconnect-From -RemoteHost "vcenter.myside.local" -Type CisServer
|
||||||
|
|
||||||
.NOTES
|
.NOTES
|
||||||
File Name : Disconnect-To.ps1
|
File Name : Disconnect-From.ps1
|
||||||
Author : Marco Blessing - marco.blessing@googlemail.com
|
Author : Marco Blessing - marco.blessing@googlemail.com
|
||||||
Requires :
|
Requires :
|
||||||
|
|
||||||
@ -59,7 +62,7 @@ function Disconnect-From {
|
|||||||
[string]$RemoteHost,
|
[string]$RemoteHost,
|
||||||
|
|
||||||
[Parameter(Mandatory = $true)]
|
[Parameter(Mandatory = $true)]
|
||||||
[ValidateSet("CiscoUcs", "FTP", "NetAppFAS", "VMware")]
|
[ValidateSet("CiscoUcs", "FTP", "NetAppFAS", "VMware", "CisServer")]
|
||||||
[string]$Type,
|
[string]$Type,
|
||||||
|
|
||||||
[Parameter(Mandatory = $false)]
|
[Parameter(Mandatory = $false)]
|
||||||
@ -85,7 +88,25 @@ function Disconnect-From {
|
|||||||
}
|
}
|
||||||
Write-Error @MessageParams
|
Write-Error @MessageParams
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
"CisServer" {
|
||||||
|
try {
|
||||||
|
if ($Force) {
|
||||||
|
Disconnect-CisServer -Server $RemoteHost -Confirm:$false -ErrorAction Stop -Force:$true
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Disconnect-CisServer -Server $RemoteHost -Confirm:$false -ErrorAction Stop
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
catch {
|
||||||
|
# Write a error message to the log.
|
||||||
|
$MessageParams = @{
|
||||||
|
Message = "Unable to disconnect from {0} using Type {1}." -f $RemoteHost, $Type
|
||||||
|
ErrorAction = "Stop"
|
||||||
|
}
|
||||||
|
Write-Error @MessageParams
|
||||||
|
}
|
||||||
}
|
}
|
||||||
# Check for an existing WinSCP Session var
|
# Check for an existing WinSCP Session var
|
||||||
"FTP" {
|
"FTP" {
|
||||||
|
@ -26,6 +26,12 @@
|
|||||||
"Modules": [
|
"Modules": [
|
||||||
"DataONTAP"
|
"DataONTAP"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "CisServer",
|
||||||
|
"Modules": [
|
||||||
|
"VMware.VimAutomation.Cis.Core"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user