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

Import Hardware PSTools #140

Closed nhuynh176 closed 4 months ago

nhuynh176 commented 4 months ago

Hello,

I'm using Milestone PSTools to import cameras from an existing system to a new one. On my new system, i need to import these cameras to prepare the migration. All camera are on the existing system and an other network because it's a working system. I have exported the hardware with MilestonePSTools However, I have an issue with the import on my new system 

PS C:\Windows\system32> get-recordingserver -name MyServer | import-vmshardware -path C:\_Sources \new.csv -verbose COMMENTAIRES: Hardware driver and credential provided for http://10.5.10.169/. Skipping hardware scan. COMMENTAIRES: Hardware driver and credential provided for http://10.5.10.147/. Skipping hardware scan. COMMENTAIRES : Opération «< Add-VmsHardware » en cours sur la cible « Milestone XProtect site 'MyServer' ». COMMENTAIRES: Mapped DriverNumber 768 to i-PRO/Panasonic
COMMENTAIRES: Awaiting 1 AddHardware requests
COMMENTAIRES: Tasks: Task[15]
COMMENTAIRES : Creating new VideoOS.ConfigurationApi.ClientService. IConfigurationService WCF channel. LoginSettings. IsOAuthConnection = True.
Add-VmsHardware: Add-VmsHardware failed with error code 60281. VM060281: Could not add the hardware.
It was not possible to connect to or receive information from the hardware. Verify that the following is correct: address, port, user name, password and hardware driver.
Au caractère C:\Program Files\Windows PowerShell\Modules\MilestonePSTools\MilestonePSTools.psm1:5530: 21 Add-VmsHardware @params -Force -SkipConfig | Forea ...
+ CategoryInfo
: Not Specified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException, Add-VmsHardware

PS C:\Windows\system32>

Here are the versions i'm using on the existing system and the new one

**- MilestonePSTools 23.3.2

I've tested the import with an other way : adding a camera on my new system, do an export and an import. It's ok if the camera is connected : 

PS C:\Windows\system32>
PS C:\Windows\system32> get-recordingserver -name MyServer | import-vmshardware -path C:\_Sources\new.csv
-verbose
COMMENTAIRES: Hardware driver and credential provided for http://10.5.240.177/. Skipping hardware scan.
COMMENTAIRES : Opération « Add-VmsHardware » en cours sur la cible « Milestone XProtect site 'MyServer' ». COMMENTAIRES : Mapped DriverNumber 768 to i-PRO/Panasonic
COMMENTAIRES : Awaiting 1 AddHardware requests
COMMENTAIRES : Tasks: Task[106]
COMMENTAIRES : Creating new VideoOS.ConfigurationApi.ClientService. IConfigurationService WCF channel. LoginSettings. IsOAuthConnection = True.
COMMENTAIRES : Completed configuration of i-PRO/Panasonic WV-S2552L (10.5.240.177) (http://10.5.240.177/) in 803ms

Name                Address                    Model                      Id                        Enabled                   LastModified 
i-PRO/Panasonic WV-52552L (10.5.240.177) http://10.5.240.177/ i-PRO/Panasonic WV-52552L True 11/07/2024 16:03:45 39F
PS C:\Windows\system32>

If the camera is not connected it's not ok

PS C:\Windows\system32> get-recordingserver -name MyServer| import-vmshardware -path C:\_Sources \new.csv
-verbose
COMMENTAIRES : Hardware driver and credential provided for http://10.5.240.177/. Skipping hardware scan. COMMENTAIRES : Opération << Add-VmsHardware » en cours sur la cible « Milestone XProtect site 'MyServer ». COMMENTAIRES : Mapped DriverNumber 768 to i-PRO/Panasonic
COMMENTAIRES : Awaiting 1 AddHardware requests
COMMENTAIRES : Tasks: Task[114]
COMMENTAIRES: Creating new Video05.ConfigurationApi.ClientService. IConfigurationService WCF channel. LoginSettings. IsOAuthConnection = True.
Add-VmsHardware: Add-VmsHardware failed with error code 60281. VM060281: Could not add the hardware.
It was not possible to connect to or receive information from the hardware. Verify that the following is correct: address, port, user name, password and hardware driver.
Au caractère C:\Program Files\WindowsPowerShell\Modules\MilestonePSTools\MilestonePSTools.psm1:5530: 21
+
+
+ CategoryInfo
Add-VmsHardware @params -Force -SkipConfig | Forea ...
: Not Specified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException, Add-VmsHardware
PS C:\Windows\system32>

Do i need to have my cameras to be connected to import them ? I thought it can be imported offline

joshooaj commented 4 months ago

Hi @nhuynh176,

Yes the cameras are required to be online to add them as XProtect provides no method of adding cameras any other way.

However, it might be possible for you to add the cameras using the Universal driver first, then use the Set-VmsHardwareDriver command later to "replace hardware" and set the cameras to use the real driver when you're ready.

https://www.milestonepstools.com/commands/en-US/Set-VmsHardwareDriver/

nhuynh176 commented 4 months ago

Hi @joshooaj

Ok, i thought that we could add it offline, because my colleague have done it with an older version (2019R3) and it worked

The Set-VmsHardwareDriver command requires Milestone 2023R1 but my version is 2022R3 and i can't update it now

joshooaj commented 4 months ago

Your colleague is a magician! Unless they were adding hardware using a driver like the virtual StableFPS or universal drivers that might not require the hardware to be online, it's never been possible to add offline cameras to the best of my knowledge. But adding offline cameras to XProtect is a popular request and I understand the desire.

Our APIs didn't support the "replace hardware" capability until the 2023 R1 release which is the reason that is the minimum version for the command. If you get a chance to upgrade, that can be a viable route to achieve your goal.

We have a 100k+ camera customer using this as a strategy to get mock cameras in place to configure in roles / rules / views ahead of time. On the other hand, if you're already automating the hardware installation, you can automate most other configuration as well which may minimize the need for placeholder cameras.

I'll close out this issue for now - please do open another if you have any other questions, issues, or feature requests!