vMarkusK / Advanced-PRTG-Sensors

Collection of my Advanced PRTG Sensors
https://mycloudrevolution.com/
Apache License 2.0
67 stars 29 forks source link

PSRemote returns error "...Benennung "Disconnect-VBRServer" wurde..." #68

Closed DaStanka closed 3 years ago

DaStanka commented 3 years ago

I want to run the script from the PRTG Probe with -psremote so that I no longer have to install / update the Veeam console on the PRTG Probe.

This error occurs on the PRTG Probe (, of course, without the Veeam console installed):

PS C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML> ._PRTG-VeeamBRStats_2020_04.ps1 -brhost veeam.xyz.de -psremote

Successful-Backups 1 1 1 Warning-Backups 0 . . . 1 Running-Endpoints 0 1 1 C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML\_PRTG-VeeamBRStats_2020_04.ps1 : Die Benennung "Disconnect-VBRServer" wurde nicht als Name eines Cmdlet, einer Funktion, einer Skriptdatei oder eines ausführbaren Programms erkannt. Überprüfen Sie die Schreibweise des Namens, oder ob der Pfad korrekt ist (sofern enthalten), und wiederholen Sie den Vorgang. In Zeile:1 Zeichen:1 + .\_PRTG-VeeamBRStats_2020_04.ps1 -brhost sna-veeam-02.ad.snacs.de -ps ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Disconnect-VBRServer:String) [_PRTG-VeeamBRStats_2020_04.ps1], CommandN otFoundException + FullyQualifiedErrorId : CommandNotFoundException,_PRTG-VeeamBRStats_2020_04.ps1 PS C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML> If the script is executed directly on the Veeam server, it works. It looks like the script can't handle one or more REPO/s. . . . 1 Running-Endpoints 0 1 1 REPO - xyz-NAS-01 28 Percent 1 1 20 10 1 REPO - cloud1 . . . Here, as requested on Markus' Homepage, with "-debug". From the Probe (with -psremote): . . . Running-Endpoints 0 1 1 DEBUG: Veeam.Backup.Model.CBackupRepositoryInfo Bestätigung Vorgang fortsetzen? [J] Ja [A] Ja, alle [B] Befehl anhalten [H] Anhalten [?] Hilfe (Standard ist "J"): j DEBUG: Cloud Repo Section Entered... Bestätigung Vorgang fortsetzen? [J] Ja [A] Ja, alle [B] Befehl anhalten [H] Anhalten [?] Hilfe (Standard ist "J"): j C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML\_PRTG-VeeamBRStats_2020_04.ps1 : Die Benennung "Disconnect-VBRServer" wurde nicht als Name eines Cmdlet, einer Funktion, einer Skriptdatei oder eines ausführbaren Programms erkannt. Überprüfen Sie die Schreibweise des Namens, oder ob der Pfad korrekt ist (sofern enthalten), und wiederholen Sie den Vorgang. In Zeile:1 Zeichen:1 + .\_PRTG-VeeamBRStats_2020_04.ps1 -brhost sna-veeam-02.ad.snacs.de -ps ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Disconnect-VBRServer:String) [_PRTG-VeeamBRStats_2020_04.ps1], CommandN otFoundException + FullyQualifiedErrorId : CommandNotFoundException,_PRTG-VeeamBRStats_2020_04.ps1 PS C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML> And from the Veeam server: Running-Endpoints 0 1 1 DEBUG: Veeam.Backup.Model.CBackupRepositoryInfo Bestätigung Vorgang fortsetzen? [J] Ja [A] Ja, alle [B] Befehl anhalten [H] Anhalten [?] Hilfe (Standard ist "J"): j DEBUG: Cloud Repo Section Entered... Bestätigung Vorgang fortsetzen? [J] Ja [A] Ja, alle [B] Befehl anhalten [H] Anhalten [?] Hilfe (Standard ist "J"): j REPO - xyz-NAS-01 28 Percent 1 1 20 10 1 REPO - cloud1 52 Percent 1 1 20 10 1 REPO - cloud2 13 Percent 1 1 20 10 1 REPO - cloud3 19 Percent 1 1 20 10 1 REPO - cloud4 48 Percent 1 1 20 10 1 REPO - cloud5 55 Percent 1 1 20 10 1 REPO - cloud6 59 Percent 1 1 20 10 1 REPO - cloud7 39 Percent 1 1 20 10 1

Repository Name Free (GB) Total (GB) Free (%) Status


xyz-NAS-01 3133,70 11076,09 28 OK cloud1 534,94 1024 52 OK cloud2 130,09 1024 13 Warning cloud3 194,25 1024 19 Warning cloud4 489,31 1024 48 OK cloud5 568,04 1024 55 OK cloud6 602,48 1024 59 OK cloud7 400,12 1024 39 OK

Successful Backups : 1 Warning Backups : 0 Failes Backups : 0 Failed Backups : 0 Running Backups : 0 Total Backup Transfer : 13 Total Backup Read : 26 Warning BackupCopys : 0 Failes BackupCopys : 0 Failed BackupCopys : 0 Running BackupCopys : 0 Idle BackupCopys : 0 Successful Replications : 0 Warning Replications : 0 Failes Replications : 0 Failed Replications : 0 Running Replications : 0 Seccessful Endpoints : 0 Warning Endpoints : 0 Failes Endpoints : 0 Running Endpoints : 0

PS C:_xyz>

vMarkusK commented 3 years ago

Might you please verify this change in line 79:

trap{
    if($RemoteSession){Remove-PSSession -Session $RemoteSession}
    #Disconnect-VBRServer -ErrorAction SilentlyContinue

    Write-Error $_.ToString()
    Write-Error $_.ScriptStackTrace

    Write-Output "<prtg>"
    Write-Output " <error>1</error>"
    Write-Output " <text>$($_.ToString())</text>"
    Write-Output "</prtg>"

    Exit
}
vMarkusK commented 3 years ago

@DaStanka If you have already upgraded to v11, might you please verify the PR #76 ?

Your issue should be addressed.