Last active
July 16, 2025 21:20
-
-
Save joshooaj/e6537ed348dde0233e5187623b2b9b8f to your computer and use it in GitHub Desktop.
Find hardware in XProtect with an unrecognized driver and change to a new driver
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Get-VmsRecordingServer | ForEach-Object { | |
| $rec = $_ | |
| # Clear cached info about the hardware and drivers on the current recorder | |
| $rec.HardwareDriverFolder.ClearChildrenCache() | |
| $rec.HardwareFolder.ClearChildrenCache() | |
| # Cache all the available drivers on the current recording server | |
| $drivers = @{} | |
| $rec | Get-VmsHardwareDriver | ForEach-Object { | |
| $drivers[$_.Path] = $null | |
| } | |
| # Ask the user to select one or more hardware with an unrecognized driver | |
| # For example, you might choose all hardware with "Axis" in the model name | |
| $hardware = Get-VmsHardware | Where-Object { | |
| !$drivers.ContainsKey($_.HardwareDriverPath) | |
| } | Out-GridView -OutputMode Multiple | |
| if ($null -eq $hardware -or $hardware.Count -eq 0) { | |
| Write-Host "No hardware found with an unrecognized hardware driver!" -ForegroundColor Green | |
| return | |
| } | |
| # Ask the user to select the new driver to use for the selected hardware | |
| $newDriver = $rec | Get-VmsHardwareDriver | Out-GridView -Title "Select new driver" -OutputMode Single | |
| # Change the driver for selected hardware to the new driver | |
| $hardware | Set-VmsHardwareDriver -Driver $newDriver | |
| # Note: If the number of devices will decrease after changing the driver, | |
| # you must include the "-AllowDeletingDisabledDevices" parameter, and you | |
| # must ensure that the device channels to be removed are disabled first. | |
| # For example, if the current driver has 4 camera channels and the new | |
| # driver has 2, you would need to disable at least two camera channels | |
| # and then run the command like this: | |
| # $hardware | Set-VmsHardwareDriver -Driver $newDriver -AllowDeletingDisabledDevices | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment