Implements CisServer connection handling (#10)

### fixes #8 

- gh deployment for dev branch removed
  - duplicate deployment.
  - see appveyor artifacts.
- installation of dependencies moved to ps function
- modularize PSGallery Deployment branch
- update platPS docs
- enable private build
- Implements ConnectionType CisServer (#9)
This commit is contained in:
2017-10-23 10:53:52 +02:00
committed by GitHub
parent 855cb920c8
commit 599232ecec
29 changed files with 200 additions and 47 deletions

View File

@ -19,10 +19,11 @@ function Get-ChallengeFile {
.\Get-RandomKey -Path "C:\TMP\Challenge.bin"
.NOTES
```
File Name : Get-ChallengeFile.ps1
Author : Marco Blessing - marco.blessing@googlemail.com
Requires :
```
.LINK
https://github.com/OCram85/PSCredentialStore
#>

View File

@ -19,6 +19,7 @@ function Connect-To {
- FTP Establish a connection to a FTP host.
- NetAppFAS Establish a connection to a NetApp Clustered ONTAP filer.
- VMware Establish a connection to a VMware vCenter or ESXi host.
- CisServer Establish a connection to a Vmware CisServer.
.PARAMETER Credentials
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
Connect-To -RemoteHost "ucs.myside.local" -Type CiscoUcs
.EXAMPLE
Connect-To -RemoteHost "ftp.myside.local" -Type FTP
.EXAMPLE
Connect-To -RemoteHost "fas.myside.local" -Type NetAppFAS
.EXAMPLE
Connect-To -RemoteHost "esx01.myside.local" -Type VMware
.EXAMPLE
Connect-To -RemoteHost "vCenter.myside.local" -Type CisServer
.EXAMPLE
$MyCreds = Get-Credential
Connect-To -RemoteHost "vcr01.myside.local" -Type VMware -Credentials $MyCreds
@ -51,9 +61,11 @@ function Connect-To {
Disconnect-From -RemoteHost "vcr01.myside.local" -Type VMware
.NOTES
```
File Name : Connect-To.ps1
Author : Marco Blessing - marco.blessing@googlemail.com
Requires : PSFTP, PowerCLI
Requires :
```
.LINK
https://github.com/OCram85/PSCredentialStore
@ -70,7 +82,7 @@ function Connect-To {
[Parameter(Mandatory = $true, ParameterSetName = "Shared")]
[Parameter(Mandatory = $true, ParameterSetName = "Private")]
[ValidateSet("CiscoUcs", "FTP", "NetAppFAS", "VMware")]
[ValidateSet("CiscoUcs", "FTP", "NetAppFAS", "VMware", "CisServer")]
[String]$Type,
[Parameter(Mandatory = $False, ParameterSetName = "Shared")]
@ -199,6 +211,20 @@ function Connect-To {
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 {
# Write a error message to the log.
$MessageParams = @{

View File

@ -15,11 +15,11 @@ function Disconnect-From {
.PARAMETER Type
Specify the host type of the target. Currently implemented targets are:
- CiscoUcs Establish a connection to a Cisco UCS Fabric Interconnect.
- FTP Establish a connection to a FTP host.
- NetAppFAS Establish a connection to a NetApp Clustered ONTAP filer.
- VMware Establish a connection to a VMware vCenter or ESXi host.
- CiscoUcs Terminates the connection from a Cisco UCS Fabric Interconnect.
- FTP Terminates the connection from a FTP host.
- NetAppFAS Terminates the connection from a NetApp Clustered ONTAP filer.
- VMware Terminates the connection from a VMware vCenter or ESXi host.
- CisServer Terminates the connection from a Vmware CisServer.
.PARAMETER Force
Force the disconnect, even if the disconnect would fail.
@ -44,10 +44,15 @@ function Disconnect-From {
.EXAMPLE
Disconnect-From -RemoteHost "esx01.myside.local" -Type VMware -Force:$True
.EXAMPLE
Disconnect-From -RemoteHost "vcenter.myside.local" -Type CisServer
.NOTES
File Name : Disconnect-To.ps1
```
File Name : Disconnect-From.ps1
Author : Marco Blessing - marco.blessing@googlemail.com
Requires :
```
.LINK
https://github.com/OCram85/PSCredentialStore
@ -59,7 +64,7 @@ function Disconnect-From {
[string]$RemoteHost,
[Parameter(Mandatory = $true)]
[ValidateSet("CiscoUcs", "FTP", "NetAppFAS", "VMware")]
[ValidateSet("CiscoUcs", "FTP", "NetAppFAS", "VMware", "CisServer")]
[string]$Type,
[Parameter(Mandatory = $false)]
@ -85,7 +90,25 @@ function Disconnect-From {
}
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
"FTP" {

View File

@ -26,6 +26,12 @@
"Modules": [
"DataONTAP"
]
},
{
"Name": "CisServer",
"Modules": [
"VMware.VimAutomation.Cis.Core"
]
}
]
}

View File

@ -19,9 +19,11 @@ function Get-RandomKey {
.\Get-RandomKey -Size 24
.NOTES
```
File Name : Get-RandomKey.ps1
Author : Marco Blessing - marco.blessing@googlemail.com
Requires :
```
.LINK
https://github.com/OCram85/PSCredentialStore

View File

@ -40,9 +40,11 @@ function Resolve-Dependency {
}
.NOTES
```
File Name : ResolveDependency.ps1
Author : Marco Blessing - marco.blessing@googlemail.com
Requires :
```
.LINK
https://github.com/OCram85/PSCredentialStore

View File

@ -34,9 +34,11 @@ function Test-Module {
.\Test-Dependency -Name 'VMware.PowerCLI' -Type 'Module' -StopIfFails
.NOTES
```
File Name : Get-RandomKey.ps1
Author : Marco Blessing - marco.blessing@googlemail.com
Requires :
```
.LINK
https://github.com/OCram85/PSCredentialStore

View File

@ -31,10 +31,11 @@ function Get-CredentialStoreItem {
$myCreds = Get-CredentialStoreItem -Path "C:\TMP\mystore.json" -RemoteHost "esx01.myside.local"
.NOTES
```
File Name : Get-CredentialStoreItem.ps1
Author : Marco Blessing - marco.blessing@googlemail.com
Requires :
```
.LINK
https://github.com/OCram85/PSCredentialStore
#>

View File

@ -31,10 +31,11 @@ function New-CredentialStoreItem {
New-CredentialStoreItem -Path "C:\TMP\mystore.json" -RemoteHost "esx01.myside.local"
.NOTES
```
File Name : New-CredentialStoreItem.ps1
Author : Marco Blessing - marco.blessing@googlemail.com
Requires :
```
.LINK
https://github.com/OCram85/PSCredentialStore
#>

View File

@ -31,9 +31,11 @@ function Remove-CredentialStoreItem {
Remove-CredentialStoreItem -Path "C:\TMP\mystore.json" -RemoteHost "esx01.myside.local" -Identifier svc
.NOTES
```
File Name : Remove-CredentialStoreItem.ps1
Author : Marco Blessing - marco.blessing@googlemail.com
Requires :
```
.LINK
https://github.com/OCram85/PSCredentialStore

View File

@ -30,9 +30,11 @@ function Set-CredentialStoreItem {
Set-CredentialStoreItem -Path "C:\TMP\mystore.json" -RemoteHost "esx01.myside.local" -Identifier svc
.NOTES
```
File Name : Set-CredentialStoreItem.ps1
Author : Marco Blessing - marco.blessing@googlemail.com
Requires :
```
.LINK
https://github.com/OCram85/PSCredentialStore

View File

@ -37,9 +37,11 @@ function Test-CredentialStoreItem() {
}
.NOTES
```
File Name : Test-CredentialStoreItem.ps1
Author : Marco Blessing - marco.blessing@googlemail.com
Requires :
```
.LINK
https://github.com/OCram85/PSCredentialStore

View File

@ -25,10 +25,11 @@ function Get-CredentialStore {
$CSContent = Get-CredentialStore -Path "C:\TMP\mystore.json"
.NOTES
```
File Name : Get-CredentialStore.ps1
Author : Marco Blessing - marco.blessing@googlemail.com
Requires :
```
.LINK
https://github.com/OCram85/PSCredentialStore
#>

View File

@ -41,10 +41,11 @@ function New-CredentialStore {
# Creates a new shared CredentialStore in the given location.
.NOTES
```
File Name : New-CredentialStore.ps1
Author : Marco Blessing - marco.blessing@googlemail.com
Requires :
```
.LINK
https://github.com/OCram85/PSCredentialStore
#>

View File

@ -15,10 +15,11 @@ function Test-CredentialStore {
can be decrypted across systems.
.NOTES
```
File Name : Test-CredentialStore.ps1
Author : Marco Blessing - marco.blessing@googlemail.com
Requires :
```
.LINK
https://github.com/OCram85/PSCredentialStore
#>