40 lines
1.1 KiB
PowerShell
40 lines
1.1 KiB
PowerShell
<#
|
|
Author: Gabe Kerntke
|
|
Date: 04-29-2026
|
|
|
|
.Synopsis
|
|
Function to test if communication with the Artifactory is possible
|
|
# Placeholder Comment
|
|
|
|
.Modified
|
|
2026-04-29 (GabeK) - Original script created
|
|
2026-05-06 (GabeK) - Updated with new logic
|
|
#>
|
|
|
|
Set-StrictMode -Version 2.0
|
|
|
|
#Function to test if communication with the Artifactory is possible
|
|
Function Test-Artifactory {
|
|
$JFrog_URL = "https://URLHERE:PORT"
|
|
try {
|
|
$JFrog_Test = Invoke-WebRequest $JFrog_URL | Select-Object -ExpandProperty StatusCode
|
|
}
|
|
catch {
|
|
Write-Output "URL does not accept current TLS settings:"
|
|
[Net.ServicePointManager]::SecurityProtocol
|
|
Write-Output "`n"
|
|
Write-Output "Adding TLS 1.2"
|
|
#Adds TLS version 1.2 for communication
|
|
[Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
|
|
$JFrog_Test = Invoke-WebRequest $JFrog_URL | Select-Object -ExpandProperty StatusCode
|
|
}
|
|
|
|
If ($JFrog_Test -eq "200") {
|
|
return $true
|
|
}
|
|
Else {
|
|
Write-Output "Error: $JFrog_Test"
|
|
Write-Output "Can't communicate with the $JFrog_URL. Exiting"
|
|
Exit
|
|
}
|
|
} |