Jannos-443/PRTG-VMware-Snapshot

Latest Vcenter error: Object reference not set to an instance of an object.

cipo80 opened this issue · 5 comments

Hi Jannos, many thanks for your scripts and works!

Yesterday I've upgraded one of our two Vcenter to the latest release (7.0.3.00700), after that the snapshot script stop to working on that vcenter, I receive from PRTG this error:
Could not connect to vCenter server xxxx.xxxxx.xx. Error: Object reference not set to an instance of an object.
If I execute the script by windows is working and the output it's exactly the same as the other old vcenter (7.0.3.00500), check the screenshot below.

Any idea?

Thanks
2022-07-15_10h17_44

Same error with your other script PRTG-VMWare-Alerts.ps1

Hello cipo80,

could you please try the latest "PRTG-VMware-Snapshot.ps1" version?
if it still doesn´t work please try this steps:

  • try test version "PRTG-VMware-Snapshot_test.ps1"?
  • confirm the input for -ViServer, -Password and -User ist correct
  • confirm the credentials are valid and able to connect using web and powershell
  • try executing the script in powershell (x86)

Hello Jannos,

thank you for the asnswer, I tried the latest version before post, same result.
I just try the _test one and error change to "line:219 char:9 --- message: Object reference not set to an instance of an object. --- line: $null = Connect-VIServer -Server $ViServer -Credential $Credentials"
Same error launching on windows by Powershell 32-bit, the script it's working using Powershell 64-bit, check the screenshots below.
Seems to be not working the 64-bit forcing parameter, I try also using PSx64.exe used for that pourpose by another script (Veeam health), but again same error!
https://kb.paessler.com/en/topic/32033-is-it-possible-to-use-the-64bit-version-of-powershell-with-prtg#:~:text=As%20PRTG%20can%20start%2064bit,back%20the%20results%20to%20PRTG.

2022-07-18_09h05_18

2022-07-18_09h22_55

Maybe check if there is an Update for the Vmware powershell module.

Update-Module VMware.VimAutomation.Core or Update-Module VMware.PowerCLI

The update module did the trick!
Now it's working also the standard script (no test).

Thank you for the support!