Closed vMarkusK closed 4 years ago
Hi @eulisan ,
I have split this request into a dedicated issue.
Have you tried to Connect via VBR Console from the server where the PowerShell script is executed?
First of all. Thank you for the quick reply. Yes i can use the VBR GUI Console with the remote VBR Server and the same user used by PRTG. In Addition iam also able to connect via Powershell and the Connect-VBRServer cmdlet.
Hi Both,
I am too getting the same error:
C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXE\PRTG-VeeamBRStats.ps1 : Failed to connect to Veeam BR Host At line:1 char:1
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,PRTG-VeeamBRStats.ps1
C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXE\PRTG-VeeamBRStats.ps1 : at
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,PRTG-VeeamBRStats.ps1
Any help will be much appreciated.
Thanks
@revilo55 Have you tried to Connect via VBR Console from the server where the PowerShell script is executed?
@eulisan and @revilo55 Have you tried to execute the script without PSx64.exe (same user and server) ?
@revilo55 Have you tried to Connect via VBR Console from the server where the PowerShell script is executed?
Yes, I'm able get a response from veeam.
@revilo55 and the script execution without PSx64?
I ran ./PRTG-VeeamBRStats.ps1 -BRhost "fqdn of host".
Using the original script.
That was run straight from powershell as admin, which gave a result.
Got the same results as revilo. Even when running PSx64 via PS Console without PRTG got the results. Just when the script is executed via PRTG it returns "Failed to connect to Veeam BRHost". Confusing.
When I run the script in Powershell 64 bit it runs fine. When I run the script in powershell x86 with PSx64 it gives an error "Failed to connect to Veeam BR Host". The remote console connects without issues.
Veeam version 9.5.4.2866 (community edition) Windows 1909
Got the same results as revilo. Even when running PSx64 via PS Console without PRTG got the results. Just when the script is executed via PRTG it returns "Failed to connect to Veeam BRHost". Confusing.
@eulisan Do you pass the Veeam Hostname as a parameter?
When I run the script in Powershell 64 bit it runs fine. When I run the script in powershell x86 with PSx64 it gives an error "Failed to connect to Veeam BR Host". The remote console connects without issues.
Veeam version 9.5.4.2866 (community edition) Windows 1909
@Legoracers Do you pass the Veeam Hostname as a parameter?
I have added additional Debug Output and Error Details during connection.
Might you please run a few tests with this version of the Script: https://github.com/mycloudrevolution/Advanced-PRTG-Sensors/blob/ConnectionDetails/Veeam/PRTG-VeeamBRStats.ps1
PS 64Bit: ./PRTG-VeeamBRStats.ps1 -Debug
PS 64Bit: ./PRTG-VeeamBRStats.ps1
PS 32Bit: ./PRTG-VeeamBRStats.ps1 -Debug
PS 32Bit: ./PRTG-VeeamBRStats.ps1
CMD: PSx64.exe -f="PRTG-VeeamBRStats.ps1"
When I run the script in Powershell 64 bit it runs fine. When I run the script in powershell x86 with PSx64 it gives an error "Failed to connect to Veeam BR Host". The remote console connects without issues. Veeam version 9.5.4.2866 (community edition) Windows 1909
@Legoracers Do you pass the Veeam Hostname as a parameter?
Yes, I tried the IP address and the hostname. Both of them don't work with the PSx64 but do in 64 bit powershell.
In 32 bit the Veeam PS snapin is not available.
These are the error codes when I try PSx64:
Microsoft.PowerShell.Commands.WriteErrorException,PRTG-VeeamBRStats.ps1
C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML\PRTG-VeeamBRStats.ps1 :
at <ScriptBlock>, C:\ProgramFiles (x86)\PRTG Network Monitor\Custom Sensors\EXEXML\PRTG-
VeeamBRStats.ps1: line 203
at <ScriptBlock>, <No file>: line 1
At line:1 char:1
+ &'C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML\P ...
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,PRTGVeeamBRStats.ps1
I assume there is an issue parsing the parameter from PSx64 to the Script itself.
Might you please replace the default value of the BRHost ("localhost") in the script with your Veeam B&R Server FQDN and run the script via PSx64 without any additional parameter.
You need to modify line 47:
[string] $BRHost = "localhost",
Thanks for your reply! The solution metioned works!
@eulisan have you also been able to verify the provided solution?
It read the states and triggers the sensor accordingly.
Hello, iam stuck in the connection. Changed localhost to our server:
param( [Parameter(Position=0, Mandatory=$false)] [string] $BRHost = "BKUP01",
With PSx64.exe i get the wanted XML output. But the Sensor Logs comes up with:
Failed to connect to Veeam BR Host
even when it is hardcoded in the powershell script. So i checked the user, its running with a credential which is approved to connect. Means i logged in on the same remote host the PRTG probe is installed and run the script with PSx64 which gives me the XML output.Error Output: `C:\Program Files (x86)\PRTG Network Monitor\custom sensors\EXEXML\VeeamBRStats.ps1 : Failed to connect to Veeam BR Host At line:1 char:1
`
` OS: WS 2016 PSx64: 18.1.1.6
0: Name Value
PSVersion 5.1.14393.3053 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.14393.3053 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1`
Also i tried with Parameters in PRTG as:
-f="FileName.ps1 -p="BKUP01"
and-f="FileName.ps1" -p="-BRHost BKUP01"
Any ideas here?
Originally posted by @eulisan in https://github.com/mycloudrevolution/Advanced-PRTG-Sensors/issues/42#issuecomment-561172604