[WIP] Implements optional dependency test

This commit is contained in:
OCram85 2017-09-20 16:09:59 +02:00
parent b31c201a1c
commit 97625881e9

View File

@ -22,7 +22,7 @@ function Connect-To {
.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
needed credentials from the CredenialStore. If you provide this parameter you skip this lookup behavior. needed credentials from the CredentialStore. If you provide this parameter you skip this lookup behavior.
So you can use it to enable credentials without preparing any user interaction. So you can use it to enable credentials without preparing any user interaction.
.PARAMETER Path .PARAMETER Path
@ -86,6 +86,10 @@ function Connect-To {
) )
begin { begin {
# First check the optional modules
If (-not (Resolve-Dependency -Name $Type)) {
Write-Error -Message ("Could not resolve the optional dependencies defined for {0}" -f $Type) -ErrorAction 'Stop'
}
switch ($Type) { switch ($Type) {
"VMware" { "VMware" {
# Disable the yellow certificate warning, since we haven't replaced the SSL certs for vCenter/ESXi # Disable the yellow certificate warning, since we haven't replaced the SSL certs for vCenter/ESXi
@ -98,7 +102,6 @@ function Connect-To {
} }
process { process {
# Set the correct CredentialStore Path depending on the used ParameterSetName # Set the correct CredentialStore Path depending on the used ParameterSetName
if ($PSCmdlet.ParameterSetName -eq "Private") { if ($PSCmdlet.ParameterSetName -eq "Private") {
$Path = "{0}\CredentialStore.json" -f $env:APPDATA $Path = "{0}\CredentialStore.json" -f $env:APPDATA