uj könyvtär Scripts
This commit is contained in:
24
Scripts/powershell/check_sharepoint_401.ps1
Normal file
24
Scripts/powershell/check_sharepoint_401.ps1
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
# SharePoint elérhetőség ellenőrzése - 401 válasz a cél
|
||||
$url = "http://srv-sharepoint.bhs.local"
|
||||
|
||||
try {
|
||||
$response = Invoke-WebRequest -Uri $url -UseBasicParsing -ErrorAction Stop
|
||||
$statusCode = $response.StatusCode
|
||||
} catch {
|
||||
# Ha kivétel van, akkor próbáljuk meg kiolvasni a státuszkódot a Response-tárgyból
|
||||
if ($_.Exception.Response) {
|
||||
$statusCode = $_.Exception.Response.StatusCode.Value__
|
||||
} else {
|
||||
Write-Host "2:Unbekannter Fehler: $($_.Exception.Message)"
|
||||
exit 2
|
||||
}
|
||||
}
|
||||
|
||||
if ($statusCode -eq 401) {
|
||||
Write-Host "0:SharePoint online, erwartete Antwort: 401 Unauthorized"
|
||||
exit 0
|
||||
} else {
|
||||
Write-Host "2:Unerwarteter HTTP-Statuscode: $statusCode"
|
||||
exit 2
|
||||
}
|
||||
Reference in New Issue
Block a user