Releases: logicmonitor/lm-powershell-module
Releases · logicmonitor/lm-powershell-module
v7.7.2
7.7.2
Hotfixes
- Send-LMWebhookMessage: Fixed payload formatting when sending webhook messages to LM Logs:
- JSON strings are now automatically detected and parsed into structured data, preventing escaped JSON in payloads
- Plain text messages are properly encapsulated in a
messageproperty for consistent parsing - Removed unnecessary payload wrapping that caused ingestion issues
- Resolve-LMDebugInfo: Fix bug where BearerTokens were not being obfuscated when running commands with the -Debug parameter.
#Sends multiple PSCustomObject events with additional properties merged into each payload.
$events = @(
[PSCustomObject]@{ eventType = "login"; user = "john.doe"; status = "success" }
[PSCustomObject]@{ eventType = "logout"; user = "jane.smith"; status = "success" }
)
Send-LMWebhookMessage -SourceName "AuthEvents" -Messages $events -Properties @{ source = "AD"; region = "us-east-1" }
#Sends a hashtable as a structured event and returns the result with status information.
$event = @{
eventType = "deployment"
version = "1.2.3"
environment = "production"
timestamp = (Get-Date).ToString("o")
}
Send-LMWebhookMessage -SourceName "Deployments" -Messages @($event) -PassThruv7.7.1
Change List
7.7.1
Hotfixes
- Fix bug with ConvertTo-LMUpdateDevice when trying to migrate Websites using an packet count of 50.
- Add missing parameter descriptions to 17 cmdlets.
- Automate future help/doc generation when a new release is published.
v7.7.0
Change List
7.7.0
New Cmdlets
- Get-LMRecentlyDeleted: Retrieve recycle-bin entries with optional date, resource type, and deleted-by filters.
- Restore-LMRecentlyDeleted: Batch restore recycle-bin items by recycle identifier.
- Remove-LMRecentlyDeleted: Permanently delete recycle-bin entries in bulk.
- Get-LMIntegration: Retrieve integration configurations from LogicMonitor.
- Remove-LMIntegration: Remove integrations by ID or name.
- Remove-LMEscalationChain: Remove escalation chains by ID or name.
- Invoke-LMReportExecution: Trigger on-demand execution of LogicMonitor reports with optional admin impersonation and custom email recipients.
- Get-LMReportExecutionTask: Check the status and retrieve results of previously triggered report executions.
- Invoke-LMAPIRequest: Universal API request cmdlet for advanced users to access any LogicMonitor API endpoint with custom payloads while leveraging module authentication, retry logic, and debug utilities.
- Import-LMLogicModuleFromFile: Import LogicModules using the new XML and JSON import endpoints with enhanced features including field preservation and conflict handling options. Supports datasources, configsources, eventsources, batchjobs, logsources, oids, topologysources, functions, and diagnosticsources.
Updated Cmdlets
- Update-LogicMonitorModule: Hardened for non-blocking version checks; failures are logged via
Write-Verboseand never terminate connecting cmdlets. - Export-LMDeviceData: CSV exports now expand datapoints into individual rows and JSON exports capture deeper datapoint structures.
- Set-LMWebsite: Added
alertExpralias forSSLAlertThresholdsparameter for improved API compatibility. Updated synopsis to reflect enhanced parameter validation. - New-LMWebsite: Added
alertExpralias forSSLAlertThresholdsparameter for improved API compatibility. - Format-LMFilter: Enhanced filter string escaping to properly handle special characters like parentheses, dollar signs, ampersands, and brackets in filter expressions.
- Import-LMLogicModule: Marked as deprecated with warnings. Users should migrate to
Import-LMLogicModuleFromFilefor access to newer API endpoints and features.
Bug Fixes
- Add-ObjectTypeInfo: Fixed "Cannot bind argument to parameter 'InputObject' because it is null" error by adding
[AllowNull()]attribute to handle successful but null API responses. - Resolve-LMDebugInfo: Improved HTTP method detection logic to correctly identify request types (GET, POST, PATCH, DELETE) based on cmdlet naming conventions and headers, fixing incorrect debug output.
- Invoke-LMRestMethod: Added cleanup of internal
__LMMethoddiagnostic header before dispatching requests to prevent API errors.
Examples
# Retrieve all recently deleted devices for the past seven days
Get-LMRecentlyDeleted -ResourceType device -DeletedBy "lmsupport" -Verbose
# Restore a previously deleted device and confirm the operation
Get-LMRecentlyDeleted -ResourceType device | Select-Object -First 1 -ExpandProperty id | Restore-LMRecentlyDeleted -Confirm:$false
# Permanently remove stale recycle-bin entries
Get-LMRecentlyDeleted -DeletedAfter (Get-Date).AddMonths(-1) | Select-Object -ExpandProperty id | Remove-LMRecentlyDeleted -Confirm:$false
# Export device datapoints to CSV with flattened datapoint rows
Export-LMDeviceData -DeviceId 12345 -StartDate (Get-Date).AddHours(-6) -ExportFormat csv -ExportPath "C:\\Exports"
# Retrieve all integrations
Get-LMIntegration
# Remove an integration by name
Remove-LMIntegration -Name "Slack-Integration"
# Remove an escalation chain by ID
Remove-LMEscalationChain -Id 123
# Trigger a report execution and check its status
$task = Invoke-LMReportExecution -Name "Monthly Availability" -WithAdminId 101 -ReceiveEmails "ops@example.com"
Get-LMReportExecutionTask -ReportName "Monthly Availability" -TaskId $task.taskId
# Use the universal API request cmdlet for endpoints
Invoke-LMAPIRequest -ResourcePath "/setting/integrations" -Method GET -QueryParams @{ size = 500 }
# Create a device with full control
$customData = @{
name = "1.1.1.1"
displayName = "Custom Device"
preferredCollectorId = 76
deviceType = 0
customProperties = @(
@{name="propname";value="value"}
)
}
Invoke-LMAPIRequest -ResourcePath "/device/devices" -Method POST -Data $customData -Version 3
# Import a LogicModule from file with the new endpoint
Import-LMLogicModuleFromFile -FilePath "C:\LogicModules\datasource.json" -Type datasources -Format json
# Import with conflict handling and field preservation
Import-LMLogicModuleFromFile -FilePath "C:\LogicModules\datasource.json" -Type datasources -Format json -HandleConflict FORCE_OVERWRITE -FieldsToPreserve NAME
# Import from file data variable
$fileContent = Get-Content -Path "C:\LogicModules\eventsource.xml" -Raw
Import-LMLogicModuleFromFile -File $fileContent -Type eventsources -Format xmlv7.6.1
7.6.1
New Cmdlets
- Send-LMWebhookMessage: Send a webhook message to LM Logs.
- Get-LMAWSExternalId: Generate an ExternalID for AWS onboarding.
Updated Cmdlets
- Set-LMDeviceGroup: Added -Extra field which takes a PSCustomObject for specifying extra cloud settings for LM Cloud resource groups.
- New-LMDeviceGroup: Added -Extra field which takes a PSCustomObject for specifying extra cloud settings for LM Cloud resource groups.
v7.6.0
7.6
New Cmdlets
- New-LMUptimeDevice: Create LogicMonitor Uptime monitors (web or ping) using the v3 device endpoint.
- New-LMUptimeWebStep: Helper cmdlet to create a properly formated step for use with New-LMUptimedevice
- Get-LMUptimeDevice: Retrieve existing Uptime devices with support for filtering by type or internal/external status.
- Set-LMUptimeDevice: Update Uptime device configuration, including alert thresholds, locations, and scripted steps.
- Remove-LMUptimeDevice: Delete Uptime devices individually.
New Helper Cmdlets
- ConvertTo-LMUptimeDevice Migration cmdlet relies will take a provided set of WebChecks/PingChecks and convert them to LMUptime Resources.
Bug Fixes/Changes
- Added reusable helper functions to normalise global alert condition inputs and location validation for Uptime cmdlets.
Notes
- API calls for LM Uptime will only work on LM portals running v228 or later. These cmdlets are also considered beta, and any issues with them should be reported via an Issue.
- LMUptime resources with show under normal *-LMDevice cmdlets but modification to them should be handled by the new *-LMUptimeDevice cmdlets.
Examples
# Create a new external web uptime check
New-LMUptimeDevice -Name "shop.example.com" -HostGroupIds '123' -Domain 'shop.example.com' -TestLocationAll
# Update an existing uptime device by name
Set-LMUptimeDevice -Name "shop.example.com" -Description "Updated uptime monitor" -GlobalSmAlertCond half
# Remove an uptime device
Remove-LMUptimeDevice -Name "shop.example.com"
# Migrate legacy websites to uptime and disable their alerting
Get-LMWebsite -Type Webcheck | ConvertTo-LMUptimeDevice -TargetHostGroupIds '123' -DisableSourceAlertingv7.5.0
7.5
New Cmdlets
- Get-LMServiceTemplate: Cmdlet to retrieve service template information.
- New-LMServiceTemplate: Cmdlet to create service templates.
- Remove-LMServiceTemplate: Cmdlet to remove service templates.
Note: These cmdlets are currently for internal use/testing only and do not support LMv1 or BearerToken. When a v3 variant is supported they will be updated to support those auth methods.
Bug Fixes/Changes
- Get-LMDeviceProperty: Fix bug with cmdlet that caused cmdlet to continuously loop when no matching property was found.
- New-LMPushMetricDataPoint: Fix bug caused by using users local time when deriving the datapoint timestamps instead of UTC.
- Fixed a few missing cmdlet alias changes and updated the documentation site to reflect all currently active cmdlets.
v7.4.3
7.4.3
Bug Fixes/Changes
- Added -Form support to Invoke-LMRestMethod to support cmdlets that required form data.
- Added missing alias:
Get-LMDeviceGroupGroups→Get-LMDeviceGroupGroup
- Fixed missing private function Get-NestedDeviceGroup
v7.4.2
7.4.2
Cmdlet Naming Update:
-
Plural-to-Singular Standardization:
To align with PowerShell best practices and the rest of the module, the following cmdlets have been renamed from plural nouns to singular nouns:Get-LMAuditLogs→Get-LMAuditLogSet-LMNormalizedProperties→Set-LMNormalizedPropertyRemove-LMNormalizedProperties→Remove-LMNormalizedPropertyNew-LMNormalizedProperties→New-LMNormalizedPropertyImport-LMRepositoryLogicModules→Import-LMRepositoryLogicModuleGet-LMWebsiteGroupAlerts→Get-LMWebsiteGroupAlertGet-LMWebsiteAlerts→Get-LMWebsiteAlertGet-LMUsageMetrics→Get-LMUsageMetricGet-LMRepositoryLogicModules→Get-LMRepositoryLogicModuleGet-LMNormalizedProperties→Get-LMNormalizedPropertyGet-LMNetscanExecutionDevices→Get-LMNetscanExecutionDeviceGet-LMIntegrationLogs→Get-LMIntegrationLogGet-LMDeviceNetflowPorts→Get-LMDeviceNetflowPortGet-LMDeviceNetflowFlows→Get-LMDeviceNetflowFlowGet-LMDeviceNetflowEndpoints→Get-LMDeviceNetflowEndpointGet-LMDeviceGroupDevices→Get-LMDeviceGroupDeviceGet-LMDeviceGroupGroups→Get-LMDeviceGroupGroupGet-LMDeviceGroupAlerts→Get-LMDeviceGroupAlertGet-LMDeviceDatasourceInstanceAlertRecipients→Get-LMDeviceDatasourceInstanceAlertRecipientGet-LMDeviceAlertSettings→Get-LMDeviceAlertSettingGet-LMDatasourceAssociatedDevices→Get-LMDatasourceAssociatedDeviceGet-LMCostOptimizationRecommendations→Get-LMCostOptimizationRecommendationGet-LMCostOptimizationRecommendationCategories→Get-LMCostOptimizationRecommendationCategoryFind-LMDashboardWidgets→Find-LMDashboardWidget
-
Backward Compatibility:
Alias functions for the previous plural-noun cmdlet names have been included for backward compatibility.
Note: These plural-noun alias are considered deprecated and will be removed in a future major release. Please update your scripts to use the new singular-noun cmdlet names.
Bug Fixes:
- This version of Logic.Monitor module addresses some unintended issues introduced in the pervious version of the module. Some cmdlets had been inadvertently updated causing cmdlet is not recognized as a name of a cmdlet, function script file or executable program errors.
Updated Cmdlets:
- New-LMWebsite: If a testLocation parameter is specified the cmdlet will now default to setting the -useDefaultLocationSetting to $false. This was causing some confusion as it was previously always defaulting to $true even when specifying specific locations.
- Get-LMAccountStatus: Added AccessId to the returned LMAuth object.
- New/Set-LMDeviceGroup: Added parameters for setting -DefaultCollectorId, -DefaultAutoBalancedCollectorGroupId and -DefaultCollectorGroupId.
v7.4.1
Change List
7.4.1
Bug Fixes:
- This version of Logic.Monitor module addresses some unintended issues introduced in the pervious version of the module. Some cmdlets had been inadvertently updated causing cmdlet is not recognized as a name of a cmdlet, function script file or executable program errors.
Updated Cmdlets:
- New-LMWebsite: If a testLocation parameter is specified the cmdlet will now default to setting the -useDefaultLocationSetting to $false. This was causing some confusion as it was previously always defaulting to $true even when specifying specific locations.
v7.4
7.4
New Cmdlets:
- Export-LMDashboard: Exports dashboard information from LogicMonitor to a JSON file. This is the same file you would get from performing an export from your LM portal. (requested via @AUrhino)
#Export a dashboard to a JSON file
Export-LMDashboard -Id 123 -FilePath "C:\temp"Minor Changes:
- All payload formating is now done through a centralized Format-LMData function. A bug was reported where trying to refresh properties to clear a resources custom property list would resulting in the empty customProperties payload getting stripped during formating. (reported via @aggie87).
- An issue was discovered where rate limits could be hit without rate limit backoff being applied. As a result of this change we have over hauled the error handling in this version to ensure all cmdlets properly respect any -ErrorAction perferences you have specified.
- While we do not anticipate any issues with these changes, they do touch pretty much every cmdlet in this module, please report any issues you encounter when using this version.
- Increased integration testing coverage to +130 tests accross many of the different cmdlets in the suite.
- This version of the module cleans up a lot of the tech debt aquired over the years and aims to make the module easier to maintain and for the community to contribute to moving forward.