Skip to content

Export-LMDeviceData

Terminal window
Export-LMDeviceData -DeviceId <Int32> [-StartDate <DateTime>] [-EndDate <DateTime>]
[-DatasourceIncludeFilter <String>] [-DatasourceExcludeFilter <String>] [-ExportFormat <String>]
[-ExportPath <String>] [-ProgressAction <ActionPreference>] [<CommonParameters>]
Terminal window
Export-LMDeviceData -DeviceDisplayName <String> [-StartDate <DateTime>] [-EndDate <DateTime>]
[-DatasourceIncludeFilter <String>] [-DatasourceExcludeFilter <String>] [-ExportFormat <String>]
[-ExportPath <String>] [-ProgressAction <ActionPreference>] [<CommonParameters>]
Terminal window
Export-LMDeviceData -DeviceHostName <String> [-StartDate <DateTime>] [-EndDate <DateTime>]
[-DatasourceIncludeFilter <String>] [-DatasourceExcludeFilter <String>] [-ExportFormat <String>]
[-ExportPath <String>] [-ProgressAction <ActionPreference>] [<CommonParameters>]
Terminal window
Export-LMDeviceData -DeviceGroupId <String> [-StartDate <DateTime>] [-EndDate <DateTime>]
[-DatasourceIncludeFilter <String>] [-DatasourceExcludeFilter <String>] [-ExportFormat <String>]
[-ExportPath <String>] [-ProgressAction <ActionPreference>] [<CommonParameters>]
Terminal window
Export-LMDeviceData -DeviceGroupName <String> [-StartDate <DateTime>] [-EndDate <DateTime>]
[-DatasourceIncludeFilter <String>] [-DatasourceExcludeFilter <String>] [-ExportFormat <String>]
[-ExportPath <String>] [-ProgressAction <ActionPreference>] [<CommonParameters>]

The Export-LMDeviceData function exports monitoring data from LogicMonitor devices or device groups. It supports exporting data for specific time ranges and can filter datasources. Data can be exported in CSV or JSON format.

Terminal window
#Export device data to JSON
Export-LMDeviceData -DeviceId 12345 -StartDate (Get-Date).AddDays(-1) -ExportFormat json
Terminal window
#Export device group data to CSV with datasource filtering
Export-LMDeviceData -DeviceGroupName "Production" -DatasourceIncludeFilter "CPU*" -ExportFormat csv

The ID of the device to export data from. This parameter is part of a mutually exclusive parameter set.

Type: Int32
Parameter Sets: DeviceId
Aliases:
Required: True
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False

The display name of the device to export data from. This parameter is part of a mutually exclusive parameter set.

Type: String
Parameter Sets: DeviceDisplayName
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

The hostname of the device to export data from. This parameter is part of a mutually exclusive parameter set.

Type: String
Parameter Sets: DeviceHostName
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

The ID of the device group to export data from. This parameter is part of a mutually exclusive parameter set.

Type: String
Parameter Sets: DeviceGroupId
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

The name of the device group to export data from. This parameter is part of a mutually exclusive parameter set.

Type: String
Parameter Sets: DeviceGroupName
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

The start date and time for data collection. Defaults to 1 hour ago.

Type: DateTime
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: (Get-Date).AddHours(-1)
Accept pipeline input: False
Accept wildcard characters: False

The end date and time for data collection. Defaults to current time.

Type: DateTime
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: (Get-Date)
Accept pipeline input: False
Accept wildcard characters: False

A filter pattern to include specific datasources. Defaults to ”*” (all datasources).

Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: *
Accept pipeline input: False
Accept wildcard characters: False

A filter pattern to exclude specific datasources. Defaults to null (no exclusions).

Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

The format for the exported data. Valid values are “csv”, “json”, or “none”. Defaults to “none”.

Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

The path where exported files will be saved. Defaults to current directory.

Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: (Get-Location).Path
Accept pipeline input: False
Accept wildcard characters: False

Fill ProgressAction Description

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

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

None. You cannot pipe objects to this command.

Section titled “None. You cannot pipe objects to this command.”

Returns device data objects if ExportFormat is “none”, otherwise creates export files.

Section titled “Returns device data objects if ExportFormat is “none”, otherwise creates export files.”

You must run Connect-LMAccount before running this command.