MilestoneSystemsInc / PowerShellSamples

A collection of samples for managing your Milestone XProtect VMS using MilestonePSTools in PowerShell
https://www.milestonepstools.com
MIT License
37 stars 12 forks source link

Connect-ManagementServer returns Object reference error #116

Closed jmisty closed 7 months ago

jmisty commented 11 months ago

MilestonePSTools version: 23.3.1 Milestone version: 2019 R2 OS: Windows Server 2019 Std build 10.0.17763

Issue: The Connect-ManagementServer cmdlet doesn't work correctly with my setup and returns the following error:

Connect-ManagementServer : Object reference not set to an instance of an object.
At line:1 char:1
+ Connect-ManagementServer -AcceptEula -ShowDialog
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : AuthenticationError: (:) [Connect-ManagementServer], NullReferenceException
    + FullyQualifiedErrorId : Object reference not set to an instance of an object.,MilestonePSTools.ConnectionCommand
   s.ConnectManagementServer

If using -ShowDialog the GUI does appear, but the same thing happens when I click on login. The same error was shown when I installed version 23 from the gallery.

Any idea what the problem could be? (I just need to export the stream properties of all cameras to a CSV file but in order to do so I first need to connect using that cmdlet).

Screenshot from 2023-11-28 12-54-39

Many thanks.

Tarterman commented 11 months ago

@jmisty, I can reproduce this on my 2019 R2 system. Troubleshooting it goes beyond my ability because the errors reference the C# code so @joshooaj will have to look into it. Josh, here's more details on the error.

image

Using the new Connect-Vms produces this.

image

joshooaj commented 11 months ago

Hi @jmisty,

I finally had a chance to dig into this and there seems to be some compatibility issues between the latest version of MIP SDK and 2019 R2. Probably older versions too, and maybe even some versions newer than that - I'm not sure yet.

Our products and MIP SDK have a limited support period, and versions older than 2020 R1 are terminated according to our product lifecycle which means it may not be possible for our SDK team to find and fix the compatibility issue.

From what I can tell from the behavior in PowerShell and some of the errors logged in C:\ProgramData\Milestone\MIPSDK\, it seems like some API calls made in the background between MIP SDK and the management server fail, but not spectacularly enough to get a ServerNotFoundMipException or some other more meaningful error.

I can successfully login using the .NET classes/methods from our SDK in PowerShell, but the LoginSettings object that is supposed to include the ID of the site shows an empty GUID instead.

Similarly, calling Configuration.Instance.GetItems() returns a Management Server item where the ObjectId, ParentId, and ServerId all have empty guids.

image

image

jamesangi commented 10 months ago

I was just about to open the same issue, but I'm seeing this on 2020R3 so maybe there is hope for it to be fixed after all?

thatonegeekguy commented 10 months ago

Encountering the same issue here using latest MilestonePSTools as of 1/15/2023 from the Gallery. 2023R1 system still presents the problem outlined above. Reverting to version 23.2.3 resolves the issue.

Z4YA commented 10 months ago

Same issue - MilestonePSTools v23.3.1 / 2020R2, reverting back to MilestonePSTools v23.2.3 resolved it.

codypaternostro commented 9 months ago

Tested Milestone versions 2019 R3, 2020 R1, 2020 R2, 2020 R3, 2022 R1 and was able to replicate the issue with these so far.

joshooaj commented 9 months ago

This issue is related to an unknown (to me) change in the 23.3 SDK. It seems only basic users work on VMS versions older than 2021 R1.

It's been reported to the MIP team but I'm not sure if anything will be changed to resolve it given the issue is only present on discontinued VMS versions as far as I can tell.

Either way we can add a better error message for this unique issue to the module.

joshooaj commented 7 months ago

Closing stale issue.