Import-LMDevicesFromCSV
Syntax
Import (Default)
Import-LMDevicesFromCSV -FilePath <String> [-PassThru] [-CollectorId <Int32>] [-AutoBalancedCollectorGroupId <Int32>] [-ProgressAction <ActionPreference>] [<CommonParameters>]
Sample
Import-LMDevicesFromCSV [-GenerateExampleCSV] [-ProgressAction <ActionPreference>] [<CommonParameters>]
Description
The Import-LMDevicesFromCSV function imports devices from a CSV file into LogicMonitor. It requires a valid CSV file containing device information such as IP address, display name, host group, collector ID, and description. The function checks if the user is logged in and has valid API credentials before importing the devices.
Examples
Example 1
Import-LMDevicesFromCSV -FilePath "C:\Devices.csv" -CollectorId 1234Imports devices from the "Devices.csv" file located at "C:\Devices.csv" and assigns the collector with ID 1234 to the imported devices.
Example 2
Import-LMDevicesFromCSV -GenerateExampleCSVGenerates an example CSV file named "SampleLMDeviceImportCSV.csv" in the current directory with sample device information.
Parameters
-FilePath
Specifies the path to the CSV file containing the device information. This parameter is mandatory when the ‘Import’ parameter set is used.
Type: StringParameter Sets: ImportAliases:
Required: TruePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: False
-GenerateExampleCSV
Generates an example CSV file with sample device information. This parameter is optional and can be used with the ‘Sample’ parameter set.
Type: SwitchParameterParameter Sets: SampleAliases:
Required: FalsePosition: NamedDefault value: FalseAccept pipeline input: FalseAccept wildcard characters: False
-PassThru
Indicates whether to return the imported devices as output. This parameter is optional and can be used with the ‘Import’ parameter set.
Type: SwitchParameterParameter Sets: ImportAliases:
Required: FalsePosition: NamedDefault value: FalseAccept pipeline input: FalseAccept wildcard characters: False
-CollectorId
Specifies the collector ID to assign to the imported devices. This parameter is optional and can be used with the ‘Import’ parameter set.
Type: Int32Parameter Sets: ImportAliases:
Required: FalsePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: False
-AutoBalancedCollectorGroupId
Specifies the auto-balanced collector group ID to assign to the imported devices. This parameter is optional and can be used with the ‘Import’ parameter set.
Type: Int32Parameter Sets: ImportAliases:
Required: FalsePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: False
-ProgressAction
Fill ProgressAction Description
Type: ActionPreferenceParameter Sets: (All)Aliases: proga
Required: FalsePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept 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
- This function requires valid API credentials to connect to LogicMonitor.
- The CSV file must have the following columns: ip, displayname, hostgroup. collectorid, collectorgroupid, description, property.name1, property.name2.. are optional.
- The function creates device groups if they don’t exist based on the host group path specified in the CSV file.
- If the collector ID is not specified in the CSV file, the function uses the collector ID specified by the CollectorId parameter.