API Token (LMv1)
Most common method using API access credentials.
Connect-LMAccount ` -AccessId "your_access_id" ` -AccessKey "your_access_key" ` -AccountName "your_portal"The Logic.Monitor PowerShell module is available on the PowerShell Gallery and works with PowerShell 5.1+ (some features require PowerShell 6.1+).
# Install from PowerShell GalleryInstall-Module -Name "Logic.Monitor"
# Import the moduleImport-Module Logic.Monitor# Update to the latest versionUpdate-Module -Name "Logic.Monitor"
# Check your current versionGet-Module Logic.Monitor -ListAvailable | Select-Object Version# Install a specific versionInstall-Module -Name "Logic.Monitor" -RequiredVersion 7.7.0
# View available versionsFind-Module Logic.Monitor -AllVersions | Select-Object VersionBefore using any module commands, you need to connect to your LogicMonitor portal.
API Token (LMv1)
Most common method using API access credentials.
Connect-LMAccount ` -AccessId "your_access_id" ` -AccessKey "your_access_key" ` -AccountName "your_portal"Bearer Token
Use OAuth bearer tokens for authentication.
Connect-LMAccount ` -BearerToken "your_bearer_token" ` -AccountName "your_portal"The module includes secure credential caching using Microsoft’s SecretManagement module for managing multiple portal connections.
# First time: Create a cached credentialNew-LMCachedAccount ` -AccessId "your_access_id" ` -AccessKey "your_access_key" ` -AccountName "production-portal"
# Add more portals as neededNew-LMCachedAccount ` -AccessId "staging_id" ` -AccessKey "staging_key" ` -AccountName "staging-portal"# Connect using cached credentialsConnect-LMAccount -UseCachedCredential
# You'll see a selection menu:# Selection Number | Portal Name# 0) production-portal# 1) staging-portal# Enter the number for the cached credential you wish to use:# List cached accountsGet-LMCachedAccount
# Remove a cached accountRemove-LMCachedAccount -AccountName "old-portal"
# Update cached credentialsNew-LMCachedAccount ` -AccessId "new_id" ` -AccessKey "new_key" ` -AccountName "production-portal"Once connected, here are some common operations to get you started:
# List all devicesGet-LMDevice
# Get a specific deviceGet-LMDevice -Name "device.example.com"
# Find devices by patternGet-LMDevice -DisplayName "prod*"
# Filter devices by propertyGet-LMDevice -Filter "hostStatus -eq 'normal'"
# Create a new deviceNew-LMDevice ` -Name "server01.example.com" ` -DisplayName "Production Server 01" ` -PreferredCollectorId 5 ` -Properties @{ environment = "production" location = "us-east" }# Get active alertsGet-LMAlert
# Get critical alertsGet-LMAlert -Filter "severity -eq '4'"
# Get alerts for a specific deviceGet-LMAlert -Filter "deviceDisplayName -eq 'server01'"
# Acknowledge an alertGet-LMAlert -Id 12345 | New-LMAlertAck -Note "Investigating issue"# List all dashboardsGet-LMDashboard
# Get a specific dashboardGet-LMDashboard -Name "Network Overview"
# Clone a dashboardCopy-LMDashboard ` -Id 123 ` -Name "Network Overview - Copy" ` -GroupName "My Dashboards"# Import a LogicModule (new in 7.7.0)Import-LMLogicModuleFromFile ` -FilePath "C:\LogicModules\datasource.json" ` -Type datasources ` -Format json
# List all datasourcesGet-LMDatasource
# Export a datasourceExport-LMDatasource -Id 123 -FilePath "C:\Backup\datasource.json"# List available commandsGet-Command -Module "Logic.Monitor"
# Get help for a specific commandGet-Help Get-LMDevice -Full
# Search for commandsGet-Command -Module "Logic.Monitor" -Name "*Device*"
# Check module versionGet-Module Logic.Monitor | Select-Object Name, Version📚 Command Reference
Browse the complete command reference with detailed parameter documentation and examples.
💡 Examples
Explore practical examples for common automation tasks and workflows.
🔍 Advanced Filtering
Learn how to construct powerful filters to query resources efficiently.
🌐 Custom API Requests
Access any LogicMonitor API endpoint directly with full control.
🐛 Debugging
Master debugging techniques and troubleshooting for your scripts.
⚡ Pipeline Usage
Efficiently chain commands together using PowerShell pipelines.