Skip to content

Import-VmsHardware

SYNOPSIS

Imports devices from a CSV file and adds them to Milestone XProtect recording servers.

SYNTAX

ImportHardware (Default)

Import-VmsHardware [-RecordingServer <RecordingServer>] -Path <String> [-WhatIf] [-Confirm]
 [<CommonParameters>]

SaveTemplate

Import-VmsHardware -Path <String> [-SaveTemplate] [-Minimal] [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION

Imports devices from a CSV file and adds them to Milestone XProtect recording servers. There are many supported columns to define enabled devices, names, device groups and more. However there are only three mandatory columns: Address, UserName, and Password. And technically you can even omit UserName and Password to force a scan using the default driver passwords.

The CSV file is read using Import-Csv, so the order of the columns is not important. However it is required to define the column names in the first row. Like most things in PowerShell, the column names are not case-sensitive. You can also safely add custom columns that you might use for other purposes as long as the column names do not collide with the columns supported by this command.

There are some columns which accept multiple values using semicolons to delimit values. Because of this, and because there is currently no support for escaping characters in the CSV, the use of semicolons is not allowed as part of a device name. Below you will find a list of all supported columns with descriptions and examples. You can also use the SaveTemplate switch to save a sample CSV file that you can use as a template.

  • Address Address can be provided in IPv4, IPv6, or hostname/fqdn format, and if using HTTPS or a custom port number, address can be provided as a URI like http://192.168.1.100:8080.

  • UserName, Password, Username2, Password2, Username3, Pasword3, UseDefaultCredentials You can provide zero, or up to 3 credentials to try for each camera. If you do not specify any credentials, UseDefaultCredentials defaults to True, even if the parameter is not present.

  • DriverNumber, DriverFamily For the best performance you should provide at least one DriverNumber, and as few additional drivers as possible. The DriverNumber values can be found on the Supported Hardware List at https://www.milestonesys.com/community/business-partner-tools/supported-devices/ listed as the "Hardware id". You can also discover them from existing Recording Servers or Hardware in PowerShell using the Get-HardwareDriver cmdlet.

The DriverFamily column provides an easy shortcut to select all driver numbers under the group in a similar fashion to the Add Hardware dialog in Management Client. The valid DriverFamily values can be found by running `Get-RecordingServer | Select-Object -First 1 | Get-HardwareDriver | Select-Object -ExpandProperty GroupName -Unique`

Multiple values for either DriverNumber or DriverFamily can be specified by separating each value with a semicolon (;) symbol.

  • HardwareName Cameras are represented in Milestone with the "physical" hardware as a child of the Recording Server, and then each camera channel, microphone, speaker and other devices attached as children of the hardware. The HardwareName field allows you to provide a meaningful name for the hardware. If this field is left blank, the hardware will retain the default name which looks like "Bosch Dinion IP Starlight 8000 MP (192.168.1.100)" with the make, model and IP.

Note: If you provide a HardwareName and no names for cameras and other child devices, then all child devices will be named like "HardwareName - DeviceType ChannelNumber". For example, "Bosch Dinion IP Starlight 8000 MP (192.168.1.100) - Camera 1".

  • CameraName, MicrophoneName, SpeakerName, MetadataName, InputName, OutputName If any device names are provided, then the default value will be replaced with the values in the csv. Multiple values can be provided, so you can name all 4 cameras on a 4-channel device by delimiting each value with a semicolon (;) symbol. The first camera, which is considered channel 0, would be named by the first value, and camera 2, which is considered channel 1, would be named by the value after the first semicolon.

If you wanted to provide a name for Camera 1 and Camera 3, but not other cameras, you would enter the value like "cam1;;cam3". Note that the second value is empty because there is no text between the two semicolons. So the second camera channel would not be renamed.

  • EnabledCameraChannels, EnabledMicrophoneChannels, EnabledChannels The various EnabledChannels provide a way for you to decide which channels should be enabled automatically after the Add-VmsHardware process is complete. By default, the hardware, and the first camera channel are enabled while all other devices are disabled. To change the behavior you can specify channel numbers, counting from zero, and delimited by semicolons (;).

Example: "0;2;3" would enable the first, third, and fourth channels.

You can also specify "All" and it will be treated as if you specified channels 0-511.

  • CameraGroup, MicrophoneGroup, SpeakerGroup, MetadataGroup, InputGroup, OutputGroup Devices are not placed in a device group by default. To place devices in a group, you must provide at least one group path, and multiple groups can be entered by delimiting values with a semicolon (;) symbol.

Example: /Indoor Cameras/Second Floor/Stairs

The camera would be added to a group named "Stairs" which is a child group of "Second Floor" which itself is a child of the root group named "Indoor Cameras". If any group in the path does not exist already, then it will be created.

Example: /New cameras;/Indoor Cameras/Stairs

This camera would be added to both a "New cameras" group at the root of the camera group list as well as the "Stairs" subgroup of "Indoor Cameras".

  • RecordingServer While the Import-VmsHardware command accepts a RecordingServer object to specify which server to which the devices should be added, each row of the CSV file can override the default server by specifying an existing Recording Server name. The name should match the display name shown in Management Client for the destination Recording Server, but the value is not case sensitive.

Only one Recording Server can be specified per row, but you can add the same camera to multiple servers by having more than one row for the same camera.

  • Description The default hardware description is "Added using PowerShell on \<datetime>". You can provide your own hardware description, or if you want to avoid setting a description you can put in the special value "blank". You cannot set a description for the camera or other devices using Import-VmsHardware at this time.

Suggestion: If you want to do some extra configuration after the hardware has been added using Import-VmsHardware, you could put a unique value such as a GUID in the Description column, then match the Hardware objects in the VMS back to the CSV row using this unique value. Since you can add any number of additional custom columns to your CSV, this is a good way to extend this command to do additional custom configuration like changing stream settings.

EXAMPLES

EXAMPLE 1

Import-VmsHardware -Path ~\Desktop\new-hardware.csv

Imports all hardware defined in new-hardware.csv. Since the RecordingServer parameter was not specified, the RecordingServer column must be specified for each row in the CSV file.

EXAMPLE 2

Get-RecordingServer -Name Server5 | Import-VmsHardware -Path ~\Desktop\new-hardware.csv

Imports all hardware defined in new-hardware.csv. Since the RecordingServer parameter was specified, cameras will be added to Server5. If a row has a RecordingServer value specified in the CSV, then the camera will be added to that recording server instead.

EXAMPLE 3

Import-VmsHardware -Path ~\Desktop\new-hardware-template.csv -SaveTemplate

Saves a CSV template to new-hardware-template.csv. The template will provide examples of all supported columns and some information about how the values are entered.

EXAMPLE 4

Import-VmsHardware -Path ~\Desktop\new-hardware-minimal-template.csv -SaveTemplate -Minimal

Saves a CSV template to new-hardware-minimal-template.csv. The template will provides the minimal set of columns required to successfully use Import-VmsHardware.

PARAMETERS

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Minimal

Specifies that a minimilist template should be saved. There are a lot of columns you can fill, but only a few are mandatory. Only mandatory columns are included in the template when this is parameter is used, with the exception of the Description column. Descriptions are not required but is included in the minimal template as a way to offer more detail about the values in each row.

Type: SwitchParameter
Parameter Sets: SaveTemplate
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-Path

Specifies the file path to the CSV file to import. If you're not sure what format the CSV should be in, use the SaveTemplate switch to save a template file to the path specified in this parameter.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-RecordingServer

Specifies the Recording Server instance where cameras should be added. If rows contain a recording server name in the RecordingServer column, the value in the CSV file will override this parameter for that row. Think of this parameter as a "default recording server" which will be used unless a more specific recording server is specified in the CSV file.

Type: RecordingServer
Parameter Sets: ImportHardware
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-SaveTemplate

Instead of importing a CSV file, this will save a CSV file to the path specified. The CSV file can be used as a template.

Type: SwitchParameter
Parameter Sets: SaveTemplate
Aliases:

Required: True
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

NOTES

Online Help