mirror of
https://github.com/benclaussen/NetboxPS.git
synced 2025-12-13 18:02:29 +00:00
Connect: Add SkipCertificateCheck parameter (for PS5 and Core)
Also enable TLS 1.1 and 1.2 for PS5
This commit is contained in:
parent
1a2484db2c
commit
4800cc6564
1 changed files with 22 additions and 2 deletions
|
|
@ -49,7 +49,10 @@
|
||||||
|
|
||||||
[Parameter(ParameterSetName = 'URI',
|
[Parameter(ParameterSetName = 'URI',
|
||||||
Mandatory = $true)]
|
Mandatory = $true)]
|
||||||
[string]$URI
|
[string]$URI,
|
||||||
|
|
||||||
|
[Parameter(Mandatory = $false)]
|
||||||
|
[switch]$SkipCertificateCheck = $false
|
||||||
)
|
)
|
||||||
|
|
||||||
if (-not $Credential) {
|
if (-not $Credential) {
|
||||||
|
|
@ -64,7 +67,22 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$null = Set-NetboxCredential -Credential $Credential
|
$invokeParams = @{ SkipCertificateCheck = $SkipCertificateCheck; }
|
||||||
|
|
||||||
|
if ("Desktop" -eq $PSVersionTable.PsEdition) {
|
||||||
|
#Remove -SkipCertificateCheck from Invoke Parameter (not supported <= PS 5)
|
||||||
|
$invokeParams.remove("SkipCertificateCheck")
|
||||||
|
}
|
||||||
|
|
||||||
|
#for PowerShell (<=) 5 (Desktop), Enable TLS 1.1, 1.2 and Disable SSL chain trust
|
||||||
|
if ("Desktop" -eq $PSVersionTable.PsEdition) {
|
||||||
|
#Enable TLS 1.1 and 1.2
|
||||||
|
Set-NetboxCipherSSL
|
||||||
|
if ($SkipCertificateCheck) {
|
||||||
|
#Disable SSL chain trust...
|
||||||
|
Set-NetboxuntrustedSSL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch ($PSCmdlet.ParameterSetName) {
|
switch ($PSCmdlet.ParameterSetName) {
|
||||||
'Manual' {
|
'Manual' {
|
||||||
|
|
@ -80,8 +98,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$null = Set-NetboxHostName -Hostname $uriBuilder.Host
|
$null = Set-NetboxHostName -Hostname $uriBuilder.Host
|
||||||
|
$null = Set-NetboxCredential -Credential $Credential
|
||||||
$null = Set-NetboxHostScheme -Scheme $uriBuilder.Scheme
|
$null = Set-NetboxHostScheme -Scheme $uriBuilder.Scheme
|
||||||
$null = Set-NetboxHostPort -Port $uriBuilder.Port
|
$null = Set-NetboxHostPort -Port $uriBuilder.Port
|
||||||
|
$null = Set-NetboxInvokeParams -invokeParams $invokeParams
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Write-Verbose "Verifying API connectivity..."
|
Write-Verbose "Verifying API connectivity..."
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue