├── .github └── workflows │ ├── main.yml │ ├── test-win.yml │ └── test.yml ├── .gitignore ├── Build.ps1 ├── CONTRIBUTOR_GUIDELINES.md ├── Documentation ├── Build-LMFilter.md ├── Connect-LMAccount.md ├── Copy-LMDashboard.md ├── Copy-LMDevice.md ├── Copy-LMReport.md ├── Disconnect-LMAccount.md ├── Export-LMDeviceConfigBackup.md ├── Export-LMDeviceData.md ├── Export-LMLogicModule.md ├── Get-LMAPIToken.md ├── Get-LMAWSAccountId.md ├── Get-LMAccessGroup.md ├── Get-LMAccountStatus.md ├── Get-LMAlert.md ├── Get-LMAlertRule.md ├── Get-LMAppliesToFunction.md ├── Get-LMAuditLogs.md ├── Get-LMCachedAccount.md ├── Get-LMCollector.md ├── Get-LMCollectorDebugResult.md ├── Get-LMCollectorGroup.md ├── Get-LMCollectorInstaller.md ├── Get-LMCollectorVersions.md ├── Get-LMConfigSource.md ├── Get-LMConfigsourceUpdateHistory.md ├── Get-LMCostOptimizationRecommendationCategories.md ├── Get-LMCostOptimizationRecommendations.md ├── Get-LMDashboard.md ├── Get-LMDashboardGroup.md ├── Get-LMDashboardWidget.md ├── Get-LMDatasource.md ├── Get-LMDatasourceAssociatedDevices.md ├── Get-LMDatasourceGraph.md ├── Get-LMDatasourceMetadata.md ├── Get-LMDatasourceOverviewGraph.md ├── Get-LMDatasourceUpdateHistory.md ├── Get-LMDevice.md ├── Get-LMDeviceAlertSettings.md ├── Get-LMDeviceAlerts.md ├── Get-LMDeviceConfigSourceData.md ├── Get-LMDeviceData.md ├── Get-LMDeviceDatasourceInstance.md ├── Get-LMDeviceDatasourceInstanceAlertRecipients.md ├── Get-LMDeviceDatasourceInstanceAlertSetting.md ├── Get-LMDeviceDatasourceInstanceGroup.md ├── Get-LMDeviceDatasourceList.md ├── Get-LMDeviceEventSourceList.md ├── Get-LMDeviceGroup.md ├── Get-LMDeviceGroupAlerts.md ├── Get-LMDeviceGroupDatasourceAlertSetting.md ├── Get-LMDeviceGroupDatasourceList.md ├── Get-LMDeviceGroupDevices.md ├── Get-LMDeviceGroupGroups.md ├── Get-LMDeviceGroupProperty.md ├── Get-LMDeviceGroupSDT.md ├── Get-LMDeviceGroupSDTHistory.md ├── Get-LMDeviceInstanceData.md ├── Get-LMDeviceInstanceList.md ├── Get-LMDeviceNetflowEndpoints.md ├── Get-LMDeviceNetflowFlows.md ├── Get-LMDeviceNetflowPorts.md ├── Get-LMDeviceProperty.md ├── Get-LMDeviceSDT.md ├── Get-LMDeviceSDTHistory.md ├── Get-LMEscalationChain.md ├── Get-LMEventSource.md ├── Get-LMIntegrationLogs.md ├── Get-LMLogMessage.md ├── Get-LMLogPartition.md ├── Get-LMLogPartitionRetention.md ├── Get-LMLogSource.md ├── Get-LMLogicModuleMetadata.md ├── Get-LMNetscan.md ├── Get-LMNetscanExecution.md ├── Get-LMNetscanExecutionDevices.md ├── Get-LMNetscanGroup.md ├── Get-LMNormalizedProperties.md ├── Get-LMOpsNote.md ├── Get-LMPortalInfo.md ├── Get-LMPropertySource.md ├── Get-LMRecipientGroup.md ├── Get-LMReport.md ├── Get-LMReportGroup.md ├── Get-LMRepositoryLogicModules.md ├── Get-LMRole.md ├── Get-LMSDT.md ├── Get-LMService.md ├── Get-LMServiceMember.md ├── Get-LMSysOIDMap.md ├── Get-LMTopologyMap.md ├── Get-LMTopologyMapData.md ├── Get-LMTopologySource.md ├── Get-LMUnmonitoredDevice.md ├── Get-LMUsageMetrics.md ├── Get-LMUser.md ├── Get-LMUserGroup.md ├── Get-LMWebsite.md ├── Get-LMWebsiteAlerts.md ├── Get-LMWebsiteCheckpoint.md ├── Get-LMWebsiteData.md ├── Get-LMWebsiteGroup.md ├── Get-LMWebsiteGroupAlerts.md ├── Get-LMWebsiteGroupSDT.md ├── Get-LMWebsiteGroupSDTHistory.md ├── Get-LMWebsiteProperty.md ├── Get-LMWebsiteSDT.md ├── Get-LMWebsiteSDTHistory.md ├── Import-LMDashboard.md ├── Import-LMExchangeModule.md ├── Import-LMLogicModule.md ├── Import-LMRepositoryLogicModules.md ├── Invoke-LMAWSAccountTest.md ├── Invoke-LMActiveDiscovery.md ├── Invoke-LMAzureAccountTest.md ├── Invoke-LMAzureSubscriptionDiscovery.md ├── Invoke-LMCloudGroupNetScan.md ├── Invoke-LMCollectorDebugCommand.md ├── Invoke-LMDeviceConfigSourceCollection.md ├── Invoke-LMGCPAccountTest.md ├── Invoke-LMNetScan.md ├── Invoke-LMUserLogoff.md ├── New-LMAPIToken.md ├── New-LMAPIUser.md ├── New-LMAccessGroup.md ├── New-LMAccessGroupMapping.md ├── New-LMAlertAck.md ├── New-LMAlertEscalation.md ├── New-LMAlertNote.md ├── New-LMAlertRule.md ├── New-LMAppliesToFunction.md ├── New-LMCachedAccount.md ├── New-LMCollector.md ├── New-LMCollectorGroup.md ├── New-LMDashboardGroup.md ├── New-LMDatasource.md ├── New-LMDatasourceGraph.md ├── New-LMDatasourceOverviewGraph.md ├── New-LMDevice.md ├── New-LMDeviceDatasourceInstance.md ├── New-LMDeviceDatasourceInstanceGroup.md ├── New-LMDeviceDatasourceInstanceSDT.md ├── New-LMDeviceDatasourceSDT.md ├── New-LMDeviceGroup.md ├── New-LMDeviceGroupProperty.md ├── New-LMDeviceGroupSDT.md ├── New-LMDeviceProperty.md ├── New-LMDeviceSDT.md ├── New-LMEnhancedNetScan.md ├── New-LMLogPartition.md ├── New-LMLogicModule.md ├── New-LMNetScan.md ├── New-LMNetscanGroup.md ├── New-LMNormalizedProperties.md ├── New-LMOpsNote.md ├── New-LMPushMetricDataPoint.md ├── New-LMPushMetricInstance.md ├── New-LMRecipient.md ├── New-LMRecipientGroup.md ├── New-LMReportGroup.md ├── New-LMRole.md ├── New-LMUser.md ├── New-LMWebsite.md ├── New-LMWebsiteGroup.md ├── Remove-LMAPIToken.md ├── Remove-LMAccessGroup.md ├── Remove-LMAlertRule.md ├── Remove-LMAppliesToFunction.md ├── Remove-LMCachedAccount.md ├── Remove-LMCollectorGroup.md ├── Remove-LMConfigsource.md ├── Remove-LMDashboard.md ├── Remove-LMDashboardGroup.md ├── Remove-LMDashboardWidget.md ├── Remove-LMDatasource.md ├── Remove-LMDevice.md ├── Remove-LMDeviceDatasourceInstance.md ├── Remove-LMDeviceDatasourceInstanceGroup.md ├── Remove-LMDeviceGroup.md ├── Remove-LMDeviceGroupProperty.md ├── Remove-LMDeviceProperty.md ├── Remove-LMLogPartition.md ├── Remove-LMLogsource.md ├── Remove-LMNetscan.md ├── Remove-LMNetscanGroup.md ├── Remove-LMNormalizedProperties.md ├── Remove-LMOpsNote.md ├── Remove-LMPropertysource.md ├── Remove-LMRecipientGroup.md ├── Remove-LMReport.md ├── Remove-LMReportGroup.md ├── Remove-LMRole.md ├── Remove-LMSDT.md ├── Remove-LMTopologysource.md ├── Remove-LMUnmonitoredDevice.md ├── Remove-LMUser.md ├── Remove-LMWebsite.md ├── Remove-LMWebsiteGroup.md ├── Send-LMLogMessage.md ├── Send-LMPushMetric.md ├── Set-LMAPIToken.md ├── Set-LMAccessGroup.md ├── Set-LMAlertRule.md ├── Set-LMAppliesToFunction.md ├── Set-LMCollector.md ├── Set-LMCollectorConfig.md ├── Set-LMCollectorGroup.md ├── Set-LMConfigsource.md ├── Set-LMDatasource.md ├── Set-LMDevice.md ├── Set-LMDeviceDatasourceInstance.md ├── Set-LMDeviceDatasourceInstanceAlertSetting.md ├── Set-LMDeviceGroup.md ├── Set-LMDeviceGroupDatasourceAlertSetting.md ├── Set-LMDeviceGroupProperty.md ├── Set-LMDeviceProperty.md ├── Set-LMLogPartition.md ├── Set-LMLogPartitionAction.md ├── Set-LMNetScan.md ├── Set-LMNetscanGroup.md ├── Set-LMNewUserMessage.md ├── Set-LMNormalizedProperties.md ├── Set-LMOpsNote.md ├── Set-LMPortalInfo.md ├── Set-LMPropertysource.md ├── Set-LMPushModuleDeviceProperty.md ├── Set-LMPushModuleInstanceProperty.md ├── Set-LMRecipientGroup.md ├── Set-LMReportGroup.md ├── Set-LMRole.md ├── Set-LMSDT.md ├── Set-LMTopologysource.md ├── Set-LMUnmonitoredDevice.md ├── Set-LMUser.md ├── Set-LMUserdata.md ├── Set-LMWebsite.md ├── Set-LMWebsiteGroup.md └── Test-LMAppliesToQuery.md ├── EXAMPLES.md ├── LICENSE ├── Logic.Monitor.Format.ps1xml ├── Logic.Monitor.psd1 ├── Logic.Monitor.psm1 ├── Private ├── Add-ObjectTypeInfo.ps1 ├── Format-LMFilter-v1.ps1 ├── Format-LMFilter.ps1 ├── Get-LMPortalURI.ps1 ├── Get-NestedDeviceGroups.ps1 ├── New-LMHeader.ps1 ├── New-LMRandomCred.ps1 ├── Resolve-LMDebugInfo.ps1 ├── Resolve-LMException.ps1 ├── Test-LMSchedulaSchema.ps1 ├── Test-LookupResult.ps1 └── Update-LogicMonitorModule.ps1 ├── Public ├── Build-LMFilter.ps1 ├── Connect-LMAccount.ps1 ├── Copy-LMDashboard.ps1 ├── Copy-LMDevice.ps1 ├── Copy-LMReport.ps1 ├── Disconnect-LMAccount.ps1 ├── Export-LMDeviceConfigBackup.ps1 ├── Export-LMDeviceData.ps1 ├── Export-LMLogicModule.ps1 ├── Get-LMAPIToken.ps1 ├── Get-LMAWSAccountId.ps1 ├── Get-LMAccessGroup.ps1 ├── Get-LMAccountStatus.ps1 ├── Get-LMAlert.ps1 ├── Get-LMAlertRule.ps1 ├── Get-LMAppliesToFunction.ps1 ├── Get-LMAuditLogs.ps1 ├── Get-LMCachedAccount.ps1 ├── Get-LMCollector.ps1 ├── Get-LMCollectorDebugResult.ps1 ├── Get-LMCollectorGroup.ps1 ├── Get-LMCollectorInstaller.ps1 ├── Get-LMCollectorVersions.ps1 ├── Get-LMConfigSource.ps1 ├── Get-LMConfigsourceUpdateHistory.ps1 ├── Get-LMCostOptimizationRecommendationCategories.ps1 ├── Get-LMCostOptimizationRecommendations.ps1 ├── Get-LMDashboard.ps1 ├── Get-LMDashboardGroup.ps1 ├── Get-LMDashboardWidget.ps1 ├── Get-LMDatasource.ps1 ├── Get-LMDatasourceAssociatedDevices.ps1 ├── Get-LMDatasourceGraph.ps1 ├── Get-LMDatasourceMetadata.ps1 ├── Get-LMDatasourceOverviewGraph.ps1 ├── Get-LMDatasourceUpdateHistory.ps1 ├── Get-LMDevice.ps1 ├── Get-LMDeviceAlertSettings.ps1 ├── Get-LMDeviceAlerts.ps1 ├── Get-LMDeviceConfigSourceData.ps1 ├── Get-LMDeviceData.ps1 ├── Get-LMDeviceDataSourceList.ps1 ├── Get-LMDeviceDatasourceInstance.ps1 ├── Get-LMDeviceDatasourceInstanceAlertRecipients.ps1 ├── Get-LMDeviceDatasourceInstanceAlertSetting.ps1 ├── Get-LMDeviceDatasourceInstanceGroup.ps1 ├── Get-LMDeviceEventSourceList.ps1 ├── Get-LMDeviceGroup.ps1 ├── Get-LMDeviceGroupAlerts.ps1 ├── Get-LMDeviceGroupDatasourceAlertSetting.ps1 ├── Get-LMDeviceGroupDatasourceList.ps1 ├── Get-LMDeviceGroupDevices.ps1 ├── Get-LMDeviceGroupGroups.ps1 ├── Get-LMDeviceGroupProperty.ps1 ├── Get-LMDeviceGroupSDT.ps1 ├── Get-LMDeviceGroupSDTHistory.ps1 ├── Get-LMDeviceInstanceData.ps1 ├── Get-LMDeviceInstanceList.ps1 ├── Get-LMDeviceNetflowEndpoints.ps1 ├── Get-LMDeviceNetflowFlows.ps1 ├── Get-LMDeviceNetflowPorts.ps1 ├── Get-LMDeviceProperty.ps1 ├── Get-LMDeviceSDT.ps1 ├── Get-LMDeviceSDTHistory.ps1 ├── Get-LMEscalationChain.ps1 ├── Get-LMEventSource.ps1 ├── Get-LMIntegrationLogs.ps1 ├── Get-LMLogMessage.ps1 ├── Get-LMLogPartition.ps1 ├── Get-LMLogPartitionRetention.ps1 ├── Get-LMLogSource.ps1 ├── Get-LMLogicModuleMetadata.ps1 ├── Get-LMNetscan.ps1 ├── Get-LMNetscanExecution.ps1 ├── Get-LMNetscanExecutionDevices.ps1 ├── Get-LMNetscanGroup.ps1 ├── Get-LMNormalizedProperties.ps1 ├── Get-LMOpsNote.ps1 ├── Get-LMPortalInfo.ps1 ├── Get-LMPropertySource.ps1 ├── Get-LMRecipientGroup.ps1 ├── Get-LMReport.ps1 ├── Get-LMReportGroup.ps1 ├── Get-LMRepositoryLogicModules.ps1 ├── Get-LMRole.ps1 ├── Get-LMSDT.ps1 ├── Get-LMService.ps1 ├── Get-LMServiceMember.ps1 ├── Get-LMSysOIDMap.ps1 ├── Get-LMTopologyMap.ps1 ├── Get-LMTopologyMapData.ps1 ├── Get-LMTopologySource.ps1 ├── Get-LMUnmonitoredDevice.ps1 ├── Get-LMUsageMetrics.ps1 ├── Get-LMUser.ps1 ├── Get-LMUserGroup.ps1 ├── Get-LMWebsite.ps1 ├── Get-LMWebsiteAlerts.ps1 ├── Get-LMWebsiteCheckpoint.ps1 ├── Get-LMWebsiteData.ps1 ├── Get-LMWebsiteGroup.ps1 ├── Get-LMWebsiteGroupAlerts.ps1 ├── Get-LMWebsiteGroupSDT.ps1 ├── Get-LMWebsiteGroupSDTHistory.ps1 ├── Get-LMWebsiteProperty.ps1 ├── Get-LMWebsiteSDT.ps1 ├── Get-LMWebsiteSDTHistory.ps1 ├── Import-LMDashboard.ps1 ├── Import-LMExchangeModule.ps1 ├── Import-LMLogicModule.ps1 ├── Import-LMRepositoryLogicModules.ps1 ├── Invoke-LMAWSAccountTest.ps1 ├── Invoke-LMActiveDiscovery.ps1 ├── Invoke-LMAzureAccountTest.ps1 ├── Invoke-LMAzureSubscriptionDiscovery.ps1 ├── Invoke-LMCloudGroupNetScan.ps1 ├── Invoke-LMCollectorDebugCommand.ps1 ├── Invoke-LMDeviceConfigSourceCollection.ps1 ├── Invoke-LMGCPAccountTest.ps1 ├── Invoke-LMNetScan.ps1 ├── Invoke-LMUserLogoff.ps1 ├── New-LMAPIToken.ps1 ├── New-LMAPIUser.ps1 ├── New-LMAccessGroup.ps1 ├── New-LMAccessGroupMapping.ps1 ├── New-LMAlertAck.ps1 ├── New-LMAlertEscalation.ps1 ├── New-LMAlertNote.ps1 ├── New-LMAlertRule.ps1 ├── New-LMAppliesToFunction.ps1 ├── New-LMCachedAccount.ps1 ├── New-LMCollector.ps1 ├── New-LMCollectorGroup.ps1 ├── New-LMDashboardGroup.ps1 ├── New-LMDatasource.ps1 ├── New-LMDatasourceGraph.ps1 ├── New-LMDatasourceOverviewGraph.ps1 ├── New-LMDevice.ps1 ├── New-LMDeviceDatasourceInstance.ps1 ├── New-LMDeviceDatasourceInstanceGroup.ps1 ├── New-LMDeviceDatasourceInstanceSDT.ps1 ├── New-LMDeviceDatasourceSDT.ps1 ├── New-LMDeviceGroup.ps1 ├── New-LMDeviceGroupProperty.ps1 ├── New-LMDeviceGroupSDT.ps1 ├── New-LMDeviceProperty.ps1 ├── New-LMDeviceSDT.ps1 ├── New-LMEnhancedNetscan.ps1 ├── New-LMLogPartition.ps1 ├── New-LMLogicModule.ps1 ├── New-LMNetscan.ps1 ├── New-LMNetscanGroup.ps1 ├── New-LMNormalizedProperties.ps1 ├── New-LMOpsNote.ps1 ├── New-LMPushMetricDataPoint.ps1 ├── New-LMPushMetricInstance.ps1 ├── New-LMRecipient.ps1 ├── New-LMRecipientGroup.ps1 ├── New-LMReportGroup.ps1 ├── New-LMRole.ps1 ├── New-LMUser.ps1 ├── New-LMWebsite.ps1 ├── New-LMWebsiteGroup.ps1 ├── Remove-LMAPIToken.ps1 ├── Remove-LMAccessGroup.ps1 ├── Remove-LMAlertRule.ps1 ├── Remove-LMAppliesToFunction.ps1 ├── Remove-LMCachedAccount.ps1 ├── Remove-LMCollectorGroup.ps1 ├── Remove-LMConfigsource.ps1 ├── Remove-LMDashboard.ps1 ├── Remove-LMDashboardGroup.ps1 ├── Remove-LMDashboardWidget.ps1 ├── Remove-LMDatasource.ps1 ├── Remove-LMDevice.ps1 ├── Remove-LMDeviceDatasourceInstance.ps1 ├── Remove-LMDeviceDatasourceInstanceGroup.ps1 ├── Remove-LMDeviceGroup.ps1 ├── Remove-LMDeviceGroupProperty.ps1 ├── Remove-LMDeviceProperty.ps1 ├── Remove-LMLogPartition.ps1 ├── Remove-LMLogsource.ps1 ├── Remove-LMNetscan.ps1 ├── Remove-LMNetscanGroup.ps1 ├── Remove-LMNormalizedProperties.ps1 ├── Remove-LMOpsNote.ps1 ├── Remove-LMPropertysource.ps1 ├── Remove-LMRecipientGroup.ps1 ├── Remove-LMReport.ps1 ├── Remove-LMReportGroup.ps1 ├── Remove-LMRole.ps1 ├── Remove-LMSDT.ps1 ├── Remove-LMTopologysource.ps1 ├── Remove-LMUnmonitoredDevice.ps1 ├── Remove-LMUser.ps1 ├── Remove-LMWebsite.ps1 ├── Remove-LMWebsiteGroup.ps1 ├── Send-LMLogMessage.ps1 ├── Send-LMPushMetric.ps1 ├── Set-LMAPIToken.ps1 ├── Set-LMAccessGroup.ps1 ├── Set-LMAlertRule.ps1 ├── Set-LMAppliesToFunction.ps1 ├── Set-LMCollector.ps1 ├── Set-LMCollectorConfig.ps1 ├── Set-LMCollectorGroup.ps1 ├── Set-LMConfigsource.ps1 ├── Set-LMDatasource.ps1 ├── Set-LMDevice.ps1 ├── Set-LMDeviceDatasourceInstance.ps1 ├── Set-LMDeviceDatasourceInstanceAlertSetting.ps1 ├── Set-LMDeviceGroup.ps1 ├── Set-LMDeviceGroupDatasourceAlertSetting.ps1 ├── Set-LMDeviceGroupProperty.ps1 ├── Set-LMDeviceProperty.ps1 ├── Set-LMLogPartition.ps1 ├── Set-LMLogPartitionAction.ps1 ├── Set-LMNetScan.ps1 ├── Set-LMNetscanGroup.ps1 ├── Set-LMNewUserMessage.ps1 ├── Set-LMNormalizedProperties.ps1 ├── Set-LMOpsNote.ps1 ├── Set-LMPortalInfo.ps1 ├── Set-LMPropertysource.ps1 ├── Set-LMPushModuleDeviceProperty.ps1 ├── Set-LMPushModuleInstanceProperty.ps1 ├── Set-LMRecipientGroup.ps1 ├── Set-LMReportGroup.ps1 ├── Set-LMRole.ps1 ├── Set-LMSDT.ps1 ├── Set-LMTopologysource.ps1 ├── Set-LMUnmonitoredDevice.ps1 ├── Set-LMUser.ps1 ├── Set-LMUserdata.ps1 ├── Set-LMWebsite.ps1 ├── Set-LMWebsiteGroup.ps1 └── Test-LMAppliesToQuery.ps1 ├── README.md ├── RELEASENOTES.md ├── SECURITY.md ├── Tests ├── LMAccessGroup.Tests.ps1 ├── LMAccount.Tests.ps1 ├── LMAppliesToFunction.Tests.ps1 ├── LMAppliesToSearch.Tests.ps1 ├── LMDevice.Tests.ps1 ├── LMDeviceGroup.Tests.ps1 ├── LMNetScanGroup.Tests.ps1 ├── LMOpsNotes.Tests.ps1 ├── LMReportGroup.Tests.ps1 ├── LMSDT.Tests.ps1 ├── LMUser-Role.Tests.ps1 ├── LMWebsite.Tests.ps1 └── LMWebsiteGroup.Tests.ps1 └── en-US └── Logic.Monitor-help.xml /.github/workflows/test-win.yml: -------------------------------------------------------------------------------- 1 | name: Test Current Build on Windows Powershell 5.1 2 | 3 | on: 4 | push: 5 | branches: 6 | - '**' 7 | paths-ignore: 8 | - '**.md' 9 | - '**.yml' 10 | - '**.xml' 11 | 12 | workflow_dispatch: 13 | 14 | jobs: 15 | test-build: 16 | runs-on: windows-latest 17 | environment: test 18 | steps: 19 | - uses: actions/checkout@v4 20 | - name: Build and Test 5.1 21 | # API key generated in PSGallery 22 | env: 23 | LM_ACCESS_ID: ${{ secrets.LM_ACCESS_ID }} 24 | LM_ACCESS_KEY: ${{ secrets.LM_ACCESS_KEY }} 25 | LM_PORTAL: ${{ secrets.LM_PORTAL }} 26 | LM_BEARER_TOKEN: ${{ secrets.LM_BEARER_TOKEN }} 27 | BUILD_VERSION: 9.9.9 28 | shell: powershell 29 | run: | 30 | ./Build.ps1 31 | 32 | $Data = @{ 33 | AccessId="$env:LM_ACCESS_ID" 34 | AccessKey="$env:LM_ACCESS_KEY" 35 | AccountName="$env:LM_PORTAL" 36 | BearerToken="$env:LM_BEARER_TOKEN" 37 | Module="./Logic.Monitor.psd1" 38 | PreferredCollectorId="8" 39 | } 40 | $Version = $PSVersionTable.PSVersion 41 | Write-Host "Powershell version: $Version" 42 | 43 | $Container = New-PesterContainer -Path ./Tests/ -Data $Data 44 | $Result = Invoke-Pester -Container $Container -Output Detailed -PassThru 45 | 46 | #Write OpsNote to test portal indicating test status 47 | Connect-LMAccount -AccessId $env:LM_ACCESS_ID -AccessKey $env:LM_ACCESS_KEY -AccountName $env:LM_PORTAL -DisableConsoleLogging 48 | $TimeNow = Get-Date -UFormat %m%d%Y-%H%M 49 | $OpsNote = New-LMOpsNote -Note "Github test build submitted on $TimeNow - $($Result.Result)" -Tags @("GithubActions","TestPipeline-Win5.1","PSVersion-$Version") 50 | 51 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Test Current Build on PowerShell Core 2 | 3 | on: 4 | push: 5 | branches: 6 | - '**' 7 | paths-ignore: 8 | - '**.md' 9 | - '**.yml' 10 | - '**.xml' 11 | 12 | workflow_dispatch: 13 | 14 | jobs: 15 | test-build: 16 | runs-on: ubuntu-latest 17 | environment: test 18 | steps: 19 | - uses: actions/checkout@v4 20 | - name: Build and Test 21 | env: 22 | LM_ACCESS_ID: ${{ secrets.LM_ACCESS_ID }} 23 | LM_ACCESS_KEY: ${{ secrets.LM_ACCESS_KEY }} 24 | LM_PORTAL: ${{ secrets.LM_PORTAL }} 25 | LM_BEARER_TOKEN: ${{ secrets.LM_BEARER_TOKEN }} 26 | BUILD_VERSION: 9.9.9 27 | shell: pwsh 28 | run: | 29 | ./Build.ps1 30 | 31 | $Data = @{ 32 | AccessId="$env:LM_ACCESS_ID" 33 | AccessKey="$env:LM_ACCESS_KEY" 34 | AccountName="$env:LM_PORTAL" 35 | BearerToken="$env:LM_BEARER_TOKEN" 36 | Module="./Logic.Monitor.psd1" 37 | PreferredCollectorId="8" 38 | } 39 | 40 | $Version = $PSVersionTable.PSVersion 41 | Write-Host "Powershell version: $Version" 42 | 43 | $Container = New-PesterContainer -Path ./Tests/ -Data $Data 44 | $Result = Invoke-Pester -Container $Container -Output Detailed -PassThru 45 | 46 | #Write OpsNote to test portal indicating test status 47 | Connect-LMAccount -AccessId $env:LM_ACCESS_ID -AccessKey $env:LM_ACCESS_KEY -AccountName $env:LM_PORTAL -DisableConsoleLogging 48 | $TimeNow = Get-Date -UFormat %m%d%Y-%H%M 49 | $OpsNote = New-LMOpsNote -Note "Github test build submitted on $TimeNow - $($Result.Result)" -Tags @("GithubActions","TestPipeline-Core","PSVersion-$Version") 50 | 51 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | Dev.Logic.Monitor.psd1 3 | .github/.DS_Store 4 | .DS_Store 5 | 6 | /.vscode 7 | Public/Test-LMDeviceRateLimit.ps1 8 | -------------------------------------------------------------------------------- /Build.ps1: -------------------------------------------------------------------------------- 1 | $Global:ErrorActionPreference = 'Stop' 2 | $Global:VerbosePreference = 'SilentlyContinue' 3 | 4 | $buildVersion = $env:BUILD_VERSION 5 | $manifestPath = "./Logic.Monitor.psd1" 6 | $publicFuncFolderPath = './Public' 7 | 8 | $ps1xmlFiles = Get-ChildItem -Path ./ -Filter *.ps1xml 9 | Foreach ($ps1xml in $ps1xmlFiles) { 10 | [xml]$xml = Get-Content -Path $ps1xml.FullName 11 | $null = $xml.Schemas.Add($null, 'https://raw.githubusercontent.com/PowerShell/PowerShell/master/src/Schemas/Format.xsd') 12 | $null = $xml.Schemas.Add($null, 'https://raw.githubusercontent.com/PowerShell/PowerShell/master/src/Schemas/Types.xsd') 13 | $xml.Validate( { Throw "File '$($ps1xml.Name)' schema error: $($_.Message)" }) 14 | } 15 | 16 | If (!(Get-PackageProvider | Where-Object { $_.Name -eq 'NuGet' })) { 17 | Install-PackageProvider -Name NuGet -Force | Out-Null 18 | } 19 | Import-PackageProvider -Name NuGet -Force | Out-Null 20 | 21 | If ((Get-PSRepository -Name PSGallery).InstallationPolicy -ne 'Trusted') { 22 | Set-PSRepository -Name PSGallery -InstallationPolicy Trusted 23 | } 24 | 25 | If (!(Get-Module Microsoft.PowerShell.SecretManagement -ListAvailable)) { 26 | Install-Module Microsoft.PowerShell.SecretManagement -Force -Confirm:$false 27 | } 28 | If (!(Get-Module Microsoft.PowerShell.SecretStore -ListAvailable)) { 29 | Install-Module Microsoft.PowerShell.SecretStore -Force -Confirm:$false 30 | } 31 | If (!(Get-Module PwshSpectreConsole -ListAvailable)) { 32 | Install-Module PwshSpectreConsole -Force -Confirm:$false 33 | } 34 | 35 | $manifestContent = (Get-Content -Path $manifestPath -Raw) -replace '', $buildVersion 36 | 37 | If ((Test-Path -Path $publicFuncFolderPath) -and ($publicFunctionNames = Get-ChildItem -Path $publicFuncFolderPath -Filter '*.ps1' | Select-Object -ExpandProperty BaseName)) { 38 | $funcStrings = "'$($publicFunctionNames -join "','")'" 39 | } 40 | Else { 41 | $funcStrings = $null 42 | } 43 | 44 | $manifestContent = $manifestContent -replace "''", $funcStrings 45 | $manifestContent | Set-Content -Path $manifestPath 46 | -------------------------------------------------------------------------------- /Documentation/Build-LMFilter.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: Logic.Monitor-help.xml 3 | Module Name: Logic.Monitor 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Build-LMFilter 9 | 10 | ## SYNOPSIS 11 | Builds a filter expression for Logic Monitor API queries. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Build-LMFilter [-PassThru] [-ProgressAction ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | The Build-LMFilter function creates a filter expression by interactively prompting for conditions and operators. 21 | It supports basic filtering for single fields and advanced filtering for property-based queries. 22 | Multiple conditions can be combined using AND/OR operators. 23 | 24 | ## EXAMPLES 25 | 26 | ### EXAMPLE 1 27 | ``` 28 | #Build a basic filter expression 29 | Build-LMFilter 30 | This example launches the interactive filter builder wizard. 31 | ``` 32 | 33 | ### EXAMPLE 2 34 | ``` 35 | #Build a filter and return the expression 36 | Build-LMFilter -PassThru 37 | This example builds a filter and returns the expression as a string. 38 | ``` 39 | 40 | ## PARAMETERS 41 | 42 | ### -PassThru 43 | When specified, returns the filter expression as a string instead of displaying it in a panel. 44 | 45 | ```yaml 46 | Type: SwitchParameter 47 | Parameter Sets: (All) 48 | Aliases: 49 | 50 | Required: False 51 | Position: Named 52 | Default value: False 53 | Accept pipeline input: False 54 | Accept wildcard characters: False 55 | ``` 56 | 57 | ### -ProgressAction 58 | {{ Fill ProgressAction Description }} 59 | 60 | ```yaml 61 | Type: ActionPreference 62 | Parameter Sets: (All) 63 | Aliases: proga 64 | 65 | Required: False 66 | Position: Named 67 | Default value: None 68 | Accept pipeline input: False 69 | Accept wildcard characters: False 70 | ``` 71 | 72 | ### CommonParameters 73 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 74 | 75 | ## INPUTS 76 | 77 | ### None. You cannot pipe objects to this command. 78 | ## OUTPUTS 79 | 80 | ### [String] Returns a PowerShell filter expression when using -PassThru. 81 | ## NOTES 82 | The filter expression is saved to the global $LMFilter variable. 83 | 84 | ## RELATED LINKS 85 | -------------------------------------------------------------------------------- /Documentation/Disconnect-LMAccount.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: Logic.Monitor-help.xml 3 | Module Name: Logic.Monitor 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Disconnect-LMAccount 9 | 10 | ## SYNOPSIS 11 | Disconnects from a previously connected LM portal. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Disconnect-LMAccount [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | The Disconnect-LMAccount function clears stored API credentials for a previously connected LM portal. 21 | It's useful for switching between LM portals or clearing credentials after a script runs. 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | #Disconnect from the current LM portal 28 | Disconnect-LMAccount 29 | ``` 30 | 31 | ## PARAMETERS 32 | 33 | ### CommonParameters 34 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 35 | 36 | ## INPUTS 37 | 38 | ### None. You cannot pipe objects to this command. 39 | ## OUTPUTS 40 | 41 | ### None. This command does not generate any output. 42 | ## NOTES 43 | Once disconnected you will need to reconnect to a portal before you will be allowed to run commands again. 44 | 45 | ## RELATED LINKS 46 | -------------------------------------------------------------------------------- /Documentation/Get-LMAWSAccountId.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: Logic.Monitor-help.xml 3 | Module Name: Logic.Monitor 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-LMAWSAccountId 9 | 10 | ## SYNOPSIS 11 | Retrieves the AWS External Account ID associated with the LogicMonitor account. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-LMAWSAccountId [-ProgressAction ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | The Get-LMAWSAccountId function retrieves the AWS External Account ID that is associated with the current LogicMonitor account. 21 | This ID is used for AWS integration purposes and helps identify the AWS account linked to your LogicMonitor instance. 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | #Retrieve the AWS External Account ID 28 | Get-LMAWSAccountId 29 | ``` 30 | 31 | ## PARAMETERS 32 | 33 | ### -ProgressAction 34 | {{ Fill ProgressAction Description }} 35 | 36 | ```yaml 37 | Type: ActionPreference 38 | Parameter Sets: (All) 39 | Aliases: proga 40 | 41 | Required: False 42 | Position: Named 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### CommonParameters 49 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 50 | 51 | ## INPUTS 52 | 53 | ### None. You cannot pipe objects to this command. 54 | ## OUTPUTS 55 | 56 | ### Returns a string containing the AWS Account ID. 57 | ## NOTES 58 | You must run Connect-LMAccount before running this command. 59 | 60 | ## RELATED LINKS 61 | -------------------------------------------------------------------------------- /Documentation/Get-LMAccountStatus.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: Logic.Monitor-help.xml 3 | Module Name: Logic.Monitor 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-LMAccountStatus 9 | 10 | ## SYNOPSIS 11 | Retrieves the current LogicMonitor account connection status. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-LMAccountStatus [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | The Get-LMAccountStatus function retrieves the current connection status of the LogicMonitor account, including portal information, authentication validity, logging status, and authentication type. 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | #Get the current account status 27 | Get-LMAccountStatus 28 | ``` 29 | 30 | ## PARAMETERS 31 | 32 | ### CommonParameters 33 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 34 | 35 | ## INPUTS 36 | 37 | ### None. You cannot pipe objects to this command. 38 | ## OUTPUTS 39 | 40 | ### Returns a PSCustomObject with the following properties: Portal, Valid, Logging, and Type 41 | ## NOTES 42 | You must run Connect-LMAccount before running this command. 43 | 44 | ## RELATED LINKS 45 | -------------------------------------------------------------------------------- /Documentation/Get-LMCachedAccount.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: Logic.Monitor-help.xml 3 | Module Name: Logic.Monitor 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-LMCachedAccount 9 | 10 | ## SYNOPSIS 11 | Retrieves information about cached LogicMonitor account credentials. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-LMCachedAccount [[-CachedAccountName] ] [-ProgressAction ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | The Get-LMCachedAccount function retrieves information about cached LogicMonitor account credentials stored in the Logic.Monitor vault. 21 | It can return information for a specific cached account or all cached accounts. 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | #Retrieve all cached accounts 28 | Get-LMCachedAccount 29 | ``` 30 | 31 | ### EXAMPLE 2 32 | ``` 33 | #Retrieve a specific cached account 34 | Get-LMCachedAccount -CachedAccountName "MyAccount" 35 | ``` 36 | 37 | ## PARAMETERS 38 | 39 | ### -CachedAccountName 40 | The name of the specific cached account to retrieve information for. 41 | If not specified, returns information for all cached accounts. 42 | 43 | ```yaml 44 | Type: String 45 | Parameter Sets: (All) 46 | Aliases: 47 | 48 | Required: False 49 | Position: 1 50 | Default value: None 51 | Accept pipeline input: False 52 | Accept wildcard characters: False 53 | ``` 54 | 55 | ### -ProgressAction 56 | {{ Fill ProgressAction Description }} 57 | 58 | ```yaml 59 | Type: ActionPreference 60 | Parameter Sets: (All) 61 | Aliases: proga 62 | 63 | Required: False 64 | Position: Named 65 | Default value: None 66 | Accept pipeline input: False 67 | Accept wildcard characters: False 68 | ``` 69 | 70 | ### CommonParameters 71 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 72 | 73 | ## INPUTS 74 | 75 | ### None. You cannot pipe objects to this command. 76 | ## OUTPUTS 77 | 78 | ### Returns an array of custom objects containing cached account information including CachedAccountName, Portal, Id, Modified date, and Type. 79 | ## NOTES 80 | This function requires access to the Logic.Monitor vault where credentials are stored. 81 | 82 | ## RELATED LINKS 83 | 84 | [Get-SecretInfo]() 85 | 86 | -------------------------------------------------------------------------------- /Documentation/Get-LMDeviceDatasourceList.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: Logic.Monitor-help.xml 3 | Module Name: Logic.Monitor 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-LMDeviceDatasourceList 9 | 10 | ## SYNOPSIS 11 | {{ Fill in the Synopsis }} 12 | 13 | ## SYNTAX 14 | 15 | ### Id (Default) 16 | ``` 17 | Get-LMDeviceDatasourceList -Id [-Filter ] [-BatchSize ] 18 | [-ProgressAction ] [] 19 | ``` 20 | 21 | ### Name 22 | ``` 23 | Get-LMDeviceDatasourceList [-Name ] [-Filter ] [-BatchSize ] 24 | [-ProgressAction ] [] 25 | ``` 26 | 27 | ## DESCRIPTION 28 | {{ Fill in the Description }} 29 | 30 | ## EXAMPLES 31 | 32 | ### Example 1 33 | ```powershell 34 | PS C:\> {{ Add example code here }} 35 | ``` 36 | 37 | {{ Add example description here }} 38 | 39 | ## PARAMETERS 40 | 41 | ### -BatchSize 42 | {{ Fill BatchSize Description }} 43 | 44 | ```yaml 45 | Type: Int32 46 | Parameter Sets: (All) 47 | Aliases: 48 | 49 | Required: False 50 | Position: Named 51 | Default value: None 52 | Accept pipeline input: False 53 | Accept wildcard characters: False 54 | ``` 55 | 56 | ### -Filter 57 | {{ Fill Filter Description }} 58 | 59 | ```yaml 60 | Type: Object 61 | Parameter Sets: (All) 62 | Aliases: 63 | 64 | Required: False 65 | Position: Named 66 | Default value: None 67 | Accept pipeline input: False 68 | Accept wildcard characters: False 69 | ``` 70 | 71 | ### -Id 72 | {{ Fill Id Description }} 73 | 74 | ```yaml 75 | Type: Int32 76 | Parameter Sets: Id 77 | Aliases: DeviceId 78 | 79 | Required: True 80 | Position: Named 81 | Default value: None 82 | Accept pipeline input: False 83 | Accept wildcard characters: False 84 | ``` 85 | 86 | ### -Name 87 | {{ Fill Name Description }} 88 | 89 | ```yaml 90 | Type: String 91 | Parameter Sets: Name 92 | Aliases: DeviceName 93 | 94 | Required: False 95 | Position: Named 96 | Default value: None 97 | Accept pipeline input: False 98 | Accept wildcard characters: False 99 | ``` 100 | 101 | ### -ProgressAction 102 | {{ Fill ProgressAction Description }} 103 | 104 | ```yaml 105 | Type: ActionPreference 106 | Parameter Sets: (All) 107 | Aliases: proga 108 | 109 | Required: False 110 | Position: Named 111 | Default value: None 112 | Accept pipeline input: False 113 | Accept wildcard characters: False 114 | ``` 115 | 116 | ### CommonParameters 117 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 118 | 119 | ## INPUTS 120 | 121 | ### None 122 | ## OUTPUTS 123 | 124 | ### System.Object 125 | ## NOTES 126 | 127 | ## RELATED LINKS 128 | -------------------------------------------------------------------------------- /Documentation/Get-LMLogPartitionRetention.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: Logic.Monitor-help.xml 3 | Module Name: Logic.Monitor 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-LMLogPartitionRetention 9 | 10 | ## SYNOPSIS 11 | Retrieves LM Log Partition Retentions from LogicMonitor. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-LMLogPartitionRetention [-ProgressAction ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | The Get-LMLogPartitionRetention function retrieves LM Log Partition Retentions from LogicMonitor. 21 | It can retrieve all log partition retentions available to the account. 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | #Retrieve all log partition retentions 28 | Get-LMLogPartitionRetention 29 | ``` 30 | 31 | ## PARAMETERS 32 | 33 | ### -ProgressAction 34 | {{ Fill ProgressAction Description }} 35 | 36 | ```yaml 37 | Type: ActionPreference 38 | Parameter Sets: (All) 39 | Aliases: proga 40 | 41 | Required: False 42 | Position: Named 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### CommonParameters 49 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 50 | 51 | ## INPUTS 52 | 53 | ### None. You cannot pipe objects to this command. 54 | ## OUTPUTS 55 | 56 | ### Returns LogicMonitor.LogPartitionRetention objects. 57 | ## NOTES 58 | You must run Connect-LMAccount before running this command. 59 | 60 | ## RELATED LINKS 61 | -------------------------------------------------------------------------------- /Documentation/Get-LMNormalizedProperties.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: Logic.Monitor-help.xml 3 | Module Name: Logic.Monitor 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-LMNormalizedProperties 9 | 10 | ## SYNOPSIS 11 | Gets normalized property mappings from LogicMonitor. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-LMNormalizedProperties [-ProgressAction ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | The Get-LMNormalizedProperties function retrieves normalized property mappings that allow standardizing property names across your LogicMonitor environment. 21 | This function only supports the v4 API. 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | #Retrieve all normalized properties 28 | Get-LMNormalizedProperties 29 | ``` 30 | 31 | ## PARAMETERS 32 | 33 | ### -ProgressAction 34 | {{ Fill ProgressAction Description }} 35 | 36 | ```yaml 37 | Type: ActionPreference 38 | Parameter Sets: (All) 39 | Aliases: proga 40 | 41 | Required: False 42 | Position: Named 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### CommonParameters 49 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 50 | 51 | ## INPUTS 52 | 53 | ### None. You cannot pipe objects to this command. 54 | ## OUTPUTS 55 | 56 | ### Returns LogicMonitor.NormalizedProperties objects. 57 | ## NOTES 58 | You must run Connect-LMAccount before running this command. 59 | This command is reserver for internal use only. 60 | 61 | ## RELATED LINKS 62 | -------------------------------------------------------------------------------- /Documentation/Get-LMPortalInfo.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: Logic.Monitor-help.xml 3 | Module Name: Logic.Monitor 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-LMPortalInfo 9 | 10 | ## SYNOPSIS 11 | Retrieves portal information from LogicMonitor. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-LMPortalInfo [-ProgressAction ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | The Get-LMPortalInfo function retrieves company settings and portal information from your LogicMonitor instance. 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | #Retrieve portal information 27 | Get-LMPortalInfo 28 | ``` 29 | 30 | ## PARAMETERS 31 | 32 | ### -ProgressAction 33 | {{ Fill ProgressAction Description }} 34 | 35 | ```yaml 36 | Type: ActionPreference 37 | Parameter Sets: (All) 38 | Aliases: proga 39 | 40 | Required: False 41 | Position: Named 42 | Default value: None 43 | Accept pipeline input: False 44 | Accept wildcard characters: False 45 | ``` 46 | 47 | ### CommonParameters 48 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 49 | 50 | ## INPUTS 51 | 52 | ### None. You cannot pipe objects to this command. 53 | ## OUTPUTS 54 | 55 | ### Returns portal information object containing company settings. 56 | ## NOTES 57 | You must run Connect-LMAccount before running this command. 58 | 59 | ## RELATED LINKS 60 | -------------------------------------------------------------------------------- /Documentation/Get-LMRepositoryLogicModules.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: Logic.Monitor-help.xml 3 | Module Name: Logic.Monitor 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-LMRepositoryLogicModules 9 | 10 | ## SYNOPSIS 11 | Retrieves LogicModules from the LogicMonitor repository. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-LMRepositoryLogicModules [[-Type] ] [-ProgressAction ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | The Get-LMRepositoryLogicModules function retrieves LogicModules from the LogicMonitor repository. 21 | It supports retrieving different types of modules including datasources, property rules, event sources, topology sources, and config sources. 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | #Retrieve all datasource modules 28 | Get-LMRepositoryLogicModules 29 | ``` 30 | 31 | ### EXAMPLE 2 32 | ``` 33 | #Retrieve all event source modules 34 | Get-LMRepositoryLogicModules -Type "eventsource" 35 | ``` 36 | 37 | ## PARAMETERS 38 | 39 | ### -Type 40 | The type of LogicModule to retrieve. 41 | Valid values are "datasource", "propertyrules", "eventsource", "topologysource", "configsource". 42 | Defaults to "datasource". 43 | 44 | ```yaml 45 | Type: String 46 | Parameter Sets: (All) 47 | Aliases: 48 | 49 | Required: False 50 | Position: 1 51 | Default value: Datasource 52 | Accept pipeline input: False 53 | Accept wildcard characters: False 54 | ``` 55 | 56 | ### -ProgressAction 57 | {{ Fill ProgressAction Description }} 58 | 59 | ```yaml 60 | Type: ActionPreference 61 | Parameter Sets: (All) 62 | Aliases: proga 63 | 64 | Required: False 65 | Position: Named 66 | Default value: None 67 | Accept pipeline input: False 68 | Accept wildcard characters: False 69 | ``` 70 | 71 | ### CommonParameters 72 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 73 | 74 | ## INPUTS 75 | 76 | ### None. You cannot pipe objects to this command. 77 | ## OUTPUTS 78 | 79 | ### Returns LogicMonitor.RepositoryLogicModules objects. 80 | ## NOTES 81 | You must run Connect-LMAccount before running this command. 82 | 83 | ## RELATED LINKS 84 | -------------------------------------------------------------------------------- /Documentation/Get-LMTopologyMapData.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: Logic.Monitor-help.xml 3 | Module Name: Logic.Monitor 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-LMTopologyMapData 9 | 10 | ## SYNOPSIS 11 | Retrieves data for a specific topology map from LogicMonitor. 12 | 13 | ## SYNTAX 14 | 15 | ### Id 16 | ``` 17 | Get-LMTopologyMapData -Id [-ProgressAction ] [] 18 | ``` 19 | 20 | ### Name 21 | ``` 22 | Get-LMTopologyMapData -Name [-ProgressAction ] [] 23 | ``` 24 | 25 | ## DESCRIPTION 26 | The Get-LMTopologyMapData function retrieves the vertex and edge data for a specified topology map in LogicMonitor. 27 | The map can be identified by either ID or name. 28 | 29 | ## EXAMPLES 30 | 31 | ### EXAMPLE 1 32 | ``` 33 | #Retrieve topology map data by ID 34 | Get-LMTopologyMapData -Id 123 35 | ``` 36 | 37 | ### EXAMPLE 2 38 | ``` 39 | #Retrieve topology map data by name 40 | Get-LMTopologyMapData -Name "Network-Topology" 41 | ``` 42 | 43 | ## PARAMETERS 44 | 45 | ### -Id 46 | The ID of the topology map to retrieve data from. 47 | Required for Id parameter set. 48 | 49 | ```yaml 50 | Type: Int32 51 | Parameter Sets: Id 52 | Aliases: 53 | 54 | Required: True 55 | Position: Named 56 | Default value: 0 57 | Accept pipeline input: False 58 | Accept wildcard characters: False 59 | ``` 60 | 61 | ### -Name 62 | The name of the topology map to retrieve data from. 63 | Required for Name parameter set. 64 | 65 | ```yaml 66 | Type: String 67 | Parameter Sets: Name 68 | Aliases: 69 | 70 | Required: True 71 | Position: Named 72 | Default value: None 73 | Accept pipeline input: False 74 | Accept wildcard characters: False 75 | ``` 76 | 77 | ### -ProgressAction 78 | {{ Fill ProgressAction Description }} 79 | 80 | ```yaml 81 | Type: ActionPreference 82 | Parameter Sets: (All) 83 | Aliases: proga 84 | 85 | Required: False 86 | Position: Named 87 | Default value: None 88 | Accept pipeline input: False 89 | Accept wildcard characters: False 90 | ``` 91 | 92 | ### CommonParameters 93 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 94 | 95 | ## INPUTS 96 | 97 | ### None. You cannot pipe objects to this command. 98 | ## OUTPUTS 99 | 100 | ### Returns LogicMonitor.TopologyMapData objects. 101 | ## NOTES 102 | You must run Connect-LMAccount before running this command. 103 | 104 | ## RELATED LINKS 105 | -------------------------------------------------------------------------------- /Documentation/Get-LMUnmonitoredDevice.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: Logic.Monitor-help.xml 3 | Module Name: Logic.Monitor 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-LMUnmonitoredDevice 9 | 10 | ## SYNOPSIS 11 | Retrieves unmonitored devices from LogicMonitor. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-LMUnmonitoredDevice [[-Filter] ] [[-BatchSize] ] [-ProgressAction ] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | The Get-LMUnmonitoredDevice function retrieves information about devices that are discovered but not currently being monitored in LogicMonitor. 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | #Retrieve all unmonitored devices 28 | Get-LMUnmonitoredDevice 29 | ``` 30 | 31 | ### EXAMPLE 2 32 | ``` 33 | #Retrieve unmonitored devices using a filter 34 | Get-LMUnmonitoredDevice -Filter $filterObject 35 | ``` 36 | 37 | ## PARAMETERS 38 | 39 | ### -Filter 40 | A filter object to apply when retrieving unmonitored devices. 41 | 42 | ```yaml 43 | Type: Object 44 | Parameter Sets: (All) 45 | Aliases: 46 | 47 | Required: False 48 | Position: 1 49 | Default value: None 50 | Accept pipeline input: False 51 | Accept wildcard characters: False 52 | ``` 53 | 54 | ### -BatchSize 55 | The number of results to return per request. 56 | Must be between 1 and 1000. 57 | Defaults to 1000. 58 | 59 | ```yaml 60 | Type: Int32 61 | Parameter Sets: (All) 62 | Aliases: 63 | 64 | Required: False 65 | Position: 2 66 | Default value: 1000 67 | Accept pipeline input: False 68 | Accept wildcard characters: False 69 | ``` 70 | 71 | ### -ProgressAction 72 | {{ Fill ProgressAction Description }} 73 | 74 | ```yaml 75 | Type: ActionPreference 76 | Parameter Sets: (All) 77 | Aliases: proga 78 | 79 | Required: False 80 | Position: Named 81 | Default value: None 82 | Accept pipeline input: False 83 | Accept wildcard characters: False 84 | ``` 85 | 86 | ### CommonParameters 87 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 88 | 89 | ## INPUTS 90 | 91 | ### None. You cannot pipe objects to this command. 92 | ## OUTPUTS 93 | 94 | ### Returns LogicMonitor.UnmonitoredDevice objects. 95 | ## NOTES 96 | You must run Connect-LMAccount before running this command. 97 | 98 | ## RELATED LINKS 99 | -------------------------------------------------------------------------------- /Documentation/Get-LMUsageMetrics.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: Logic.Monitor-help.xml 3 | Module Name: Logic.Monitor 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-LMUsageMetrics 9 | 10 | ## SYNOPSIS 11 | {{ Fill in the Synopsis }} 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-LMUsageMetrics [-ProgressAction ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | {{ Fill in the Description }} 21 | 22 | ## EXAMPLES 23 | 24 | ### Example 1 25 | ```powershell 26 | PS C:\> {{ Add example code here }} 27 | ``` 28 | 29 | {{ Add example description here }} 30 | 31 | ## PARAMETERS 32 | 33 | ### -ProgressAction 34 | {{ Fill ProgressAction Description }} 35 | 36 | ```yaml 37 | Type: ActionPreference 38 | Parameter Sets: (All) 39 | Aliases: proga 40 | 41 | Required: False 42 | Position: Named 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### CommonParameters 49 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 50 | 51 | ## INPUTS 52 | 53 | ### None 54 | ## OUTPUTS 55 | 56 | ### System.Object 57 | ## NOTES 58 | 59 | ## RELATED LINKS 60 | -------------------------------------------------------------------------------- /Documentation/Get-LMWebsiteCheckpoint.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: Logic.Monitor-help.xml 3 | Module Name: Logic.Monitor 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-LMWebsiteCheckpoint 9 | 10 | ## SYNOPSIS 11 | Retrieves website checkpoints from LogicMonitor. 12 | 13 | ## SYNTAX 14 | 15 | ### All (Default) 16 | ``` 17 | Get-LMWebsiteCheckpoint [-BatchSize ] [-ProgressAction ] [] 18 | ``` 19 | 20 | ### Filter 21 | ``` 22 | Get-LMWebsiteCheckpoint [-Filter ] [-BatchSize ] [-ProgressAction ] 23 | [] 24 | ``` 25 | 26 | ## DESCRIPTION 27 | The Get-LMWebsiteCheckpoint function retrieves checkpoint configurations used for website monitoring in LogicMonitor. 28 | 29 | ## EXAMPLES 30 | 31 | ### EXAMPLE 1 32 | ``` 33 | #Retrieve all website checkpoints 34 | Get-LMWebsiteCheckpoint 35 | ``` 36 | 37 | ### EXAMPLE 2 38 | ``` 39 | #Retrieve checkpoints using a filter 40 | Get-LMWebsiteCheckpoint -Filter $filterObject 41 | ``` 42 | 43 | ## PARAMETERS 44 | 45 | ### -Filter 46 | A filter object to apply when retrieving checkpoints. 47 | 48 | ```yaml 49 | Type: Object 50 | Parameter Sets: Filter 51 | Aliases: 52 | 53 | Required: False 54 | Position: Named 55 | Default value: None 56 | Accept pipeline input: False 57 | Accept wildcard characters: False 58 | ``` 59 | 60 | ### -BatchSize 61 | The number of results to return per request. 62 | Must be between 1 and 1000. 63 | Defaults to 1000. 64 | 65 | ```yaml 66 | Type: Int32 67 | Parameter Sets: (All) 68 | Aliases: 69 | 70 | Required: False 71 | Position: Named 72 | Default value: 1000 73 | Accept pipeline input: False 74 | Accept wildcard characters: False 75 | ``` 76 | 77 | ### -ProgressAction 78 | {{ Fill ProgressAction Description }} 79 | 80 | ```yaml 81 | Type: ActionPreference 82 | Parameter Sets: (All) 83 | Aliases: proga 84 | 85 | Required: False 86 | Position: Named 87 | Default value: None 88 | Accept pipeline input: False 89 | Accept wildcard characters: False 90 | ``` 91 | 92 | ### CommonParameters 93 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 94 | 95 | ## INPUTS 96 | 97 | ### None. You cannot pipe objects to this command. 98 | ## OUTPUTS 99 | 100 | ### Returns website checkpoint objects. 101 | ## NOTES 102 | You must run Connect-LMAccount before running this command. 103 | 104 | ## RELATED LINKS 105 | -------------------------------------------------------------------------------- /Documentation/Import-LMExchangeModule.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: Logic.Monitor-help.xml 3 | Module Name: Logic.Monitor 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Import-LMExchangeModule 9 | 10 | ## SYNOPSIS 11 | Imports an LM Exchange module into LogicMonitor. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Import-LMExchangeModule [-LMExchangeId] [-ProgressAction ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | The Import-LMExchangeModule function imports a specified LM Exchange module into your LogicMonitor portal. 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | #Import an LM Exchange module 27 | Import-LMExchangeModule -LMExchangeId "LM12345" 28 | ``` 29 | 30 | ## PARAMETERS 31 | 32 | ### -LMExchangeId 33 | The ID of the LM Exchange module to import. 34 | This parameter is mandatory. 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: True 42 | Position: 1 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -ProgressAction 49 | {{ Fill ProgressAction Description }} 50 | 51 | ```yaml 52 | Type: ActionPreference 53 | Parameter Sets: (All) 54 | Aliases: proga 55 | 56 | Required: False 57 | Position: Named 58 | Default value: None 59 | Accept pipeline input: False 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### CommonParameters 64 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 65 | 66 | ## INPUTS 67 | 68 | ### None. You cannot pipe objects to this command. 69 | ## OUTPUTS 70 | 71 | ### Returns a success message if the import is successful. 72 | ## NOTES 73 | You must run Connect-LMAccount before running this command. 74 | 75 | ## RELATED LINKS 76 | -------------------------------------------------------------------------------- /Documentation/Import-LMRepositoryLogicModules.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: Logic.Monitor-help.xml 3 | Module Name: Logic.Monitor 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Import-LMRepositoryLogicModules 9 | 10 | ## SYNOPSIS 11 | Imports LogicMonitor repository logic modules. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Import-LMRepositoryLogicModules [-Type] [-LogicModuleNames] 17 | [-ProgressAction ] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | The Import-LMRepositoryLogicModules function imports specified logic modules from the LogicMonitor repository into your portal. 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | #Import specific datasources 28 | Import-LMRepositoryLogicModules -Type "datasources" -LogicModuleNames "DataSource1", "DataSource2" 29 | ``` 30 | 31 | ## PARAMETERS 32 | 33 | ### -Type 34 | The type of logic modules to import. 35 | Valid values are "datasources", "propertyrules", "eventsources", "topologysources", "configsources". 36 | 37 | ```yaml 38 | Type: String 39 | Parameter Sets: (All) 40 | Aliases: 41 | 42 | Required: True 43 | Position: 1 44 | Default value: None 45 | Accept pipeline input: False 46 | Accept wildcard characters: False 47 | ``` 48 | 49 | ### -LogicModuleNames 50 | An array of logic module names to import. 51 | 52 | ```yaml 53 | Type: String[] 54 | Parameter Sets: (All) 55 | Aliases: Name 56 | 57 | Required: True 58 | Position: 2 59 | Default value: None 60 | Accept pipeline input: True (ByPropertyName) 61 | Accept wildcard characters: False 62 | ``` 63 | 64 | ### -ProgressAction 65 | {{ Fill ProgressAction Description }} 66 | 67 | ```yaml 68 | Type: ActionPreference 69 | Parameter Sets: (All) 70 | Aliases: proga 71 | 72 | Required: False 73 | Position: Named 74 | Default value: None 75 | Accept pipeline input: False 76 | Accept wildcard characters: False 77 | ``` 78 | 79 | ### CommonParameters 80 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 81 | 82 | ## INPUTS 83 | 84 | ### None. You cannot pipe objects to this command. 85 | ## OUTPUTS 86 | 87 | ### Returns a success message with the names of imported modules. 88 | ## NOTES 89 | You must run Connect-LMAccount before running this command. 90 | 91 | ## RELATED LINKS 92 | -------------------------------------------------------------------------------- /Documentation/Invoke-LMCloudGroupNetScan.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: Logic.Monitor-help.xml 3 | Module Name: Logic.Monitor 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Invoke-LMCloudGroupNetScan 9 | 10 | ## SYNOPSIS 11 | Invokes a NetScan task for a cloud device group. 12 | 13 | ## SYNTAX 14 | 15 | ### GroupId 16 | ``` 17 | Invoke-LMCloudGroupNetScan -Id [-ProgressAction ] [] 18 | ``` 19 | 20 | ### GroupName 21 | ``` 22 | Invoke-LMCloudGroupNetScan -Name [-ProgressAction ] [] 23 | ``` 24 | 25 | ## DESCRIPTION 26 | The Invoke-LMCloudGroupNetScan function schedules a NetScan task for a specified cloud device group (AWS, Azure, or GCP) in LogicMonitor. 27 | 28 | ## EXAMPLES 29 | 30 | ### EXAMPLE 1 31 | ``` 32 | #Run NetScan on a cloud group by ID 33 | Invoke-LMCloudGroupNetScan -Id "12345" 34 | ``` 35 | 36 | ### EXAMPLE 2 37 | ``` 38 | #Run NetScan on a cloud group by name 39 | Invoke-LMCloudGroupNetScan -Name "AWS-Production" 40 | ``` 41 | 42 | ## PARAMETERS 43 | 44 | ### -Id 45 | The ID of the cloud device group. 46 | Required for GroupId parameter set. 47 | 48 | ```yaml 49 | Type: String 50 | Parameter Sets: GroupId 51 | Aliases: 52 | 53 | Required: True 54 | Position: Named 55 | Default value: None 56 | Accept pipeline input: False 57 | Accept wildcard characters: False 58 | ``` 59 | 60 | ### -Name 61 | The name of the cloud device group. 62 | Required for GroupName parameter set. 63 | 64 | ```yaml 65 | Type: String 66 | Parameter Sets: GroupName 67 | Aliases: 68 | 69 | Required: True 70 | Position: Named 71 | Default value: None 72 | Accept pipeline input: False 73 | Accept wildcard characters: False 74 | ``` 75 | 76 | ### -ProgressAction 77 | {{ Fill ProgressAction Description }} 78 | 79 | ```yaml 80 | Type: ActionPreference 81 | Parameter Sets: (All) 82 | Aliases: proga 83 | 84 | Required: False 85 | Position: Named 86 | Default value: None 87 | Accept pipeline input: False 88 | Accept wildcard characters: False 89 | ``` 90 | 91 | ### CommonParameters 92 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 93 | 94 | ## INPUTS 95 | 96 | ### None. You cannot pipe objects to this command. 97 | ## OUTPUTS 98 | 99 | ### Returns a success message if the task is scheduled successfully. 100 | ## NOTES 101 | You must run Connect-LMAccount before running this command. 102 | The target group must be a cloud group (AWS, Azure, or GCP). 103 | 104 | ## RELATED LINKS 105 | -------------------------------------------------------------------------------- /Documentation/Invoke-LMNetScan.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: Logic.Monitor-help.xml 3 | Module Name: Logic.Monitor 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Invoke-LMNetScan 9 | 10 | ## SYNOPSIS 11 | Invokes a NetScan task in LogicMonitor. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Invoke-LMNetScan [-Id] [-ProgressAction ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | The Invoke-LMNetScan function schedules execution of a specified NetScan task in LogicMonitor. 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | #Execute a NetScan 27 | Invoke-LMNetScan -Id "12345" 28 | ``` 29 | 30 | ## PARAMETERS 31 | 32 | ### -Id 33 | The ID of the NetScan to execute. 34 | 35 | ```yaml 36 | Type: String 37 | Parameter Sets: (All) 38 | Aliases: 39 | 40 | Required: True 41 | Position: 1 42 | Default value: None 43 | Accept pipeline input: False 44 | Accept wildcard characters: False 45 | ``` 46 | 47 | ### -ProgressAction 48 | {{ Fill ProgressAction Description }} 49 | 50 | ```yaml 51 | Type: ActionPreference 52 | Parameter Sets: (All) 53 | Aliases: proga 54 | 55 | Required: False 56 | Position: Named 57 | Default value: None 58 | Accept pipeline input: False 59 | Accept wildcard characters: False 60 | ``` 61 | 62 | ### CommonParameters 63 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 64 | 65 | ## INPUTS 66 | 67 | ### None. You cannot pipe objects to this command. 68 | ## OUTPUTS 69 | 70 | ### Returns a success message if the NetScan is scheduled successfully. 71 | ## NOTES 72 | You must run Connect-LMAccount before running this command. 73 | 74 | ## RELATED LINKS 75 | -------------------------------------------------------------------------------- /Documentation/Invoke-LMUserLogoff.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: Logic.Monitor-help.xml 3 | Module Name: Logic.Monitor 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Invoke-LMUserLogoff 9 | 10 | ## SYNOPSIS 11 | Forces user logoff in LogicMonitor. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Invoke-LMUserLogoff [-Usernames] [-ProgressAction ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | The Invoke-LMUserLogoff function forces one or more users to be logged out of their LogicMonitor sessions. 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | #Log off multiple users 27 | Invoke-LMUserLogoff -Usernames "user1", "user2" 28 | ``` 29 | 30 | ## PARAMETERS 31 | 32 | ### -Usernames 33 | An array of usernames to log off. 34 | 35 | ```yaml 36 | Type: String[] 37 | Parameter Sets: (All) 38 | Aliases: 39 | 40 | Required: True 41 | Position: 1 42 | Default value: None 43 | Accept pipeline input: False 44 | Accept wildcard characters: False 45 | ``` 46 | 47 | ### -ProgressAction 48 | {{ Fill ProgressAction Description }} 49 | 50 | ```yaml 51 | Type: ActionPreference 52 | Parameter Sets: (All) 53 | Aliases: proga 54 | 55 | Required: False 56 | Position: Named 57 | Default value: None 58 | Accept pipeline input: False 59 | Accept wildcard characters: False 60 | ``` 61 | 62 | ### CommonParameters 63 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 64 | 65 | ## INPUTS 66 | 67 | ### None. You cannot pipe objects to this command. 68 | ## OUTPUTS 69 | 70 | ### Returns a success message if the logoff is completed successfully. 71 | ## NOTES 72 | You must run Connect-LMAccount before running this command. 73 | 74 | ## RELATED LINKS 75 | -------------------------------------------------------------------------------- /Documentation/New-LMAccessGroup.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: Logic.Monitor-help.xml 3 | Module Name: Logic.Monitor 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-LMAccessGroup 9 | 10 | ## SYNOPSIS 11 | Creates a new LogicMonitor access group. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-LMAccessGroup [-Name] [[-Description] ] [[-Tenant] ] 17 | [-ProgressAction ] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | The New-LMAccessGroup function creates a new access group in LogicMonitor. 22 | Access groups control user permissions and access rights for managing modules in the LM exchange and module toolbox. 23 | 24 | ## EXAMPLES 25 | 26 | ### EXAMPLE 1 27 | ``` 28 | #Create a new access group 29 | New-LMAccessGroup -Name "Group1" -Description "Access group for administrators" -Tenant "12345" 30 | ``` 31 | 32 | ## PARAMETERS 33 | 34 | ### -Name 35 | The name of the access group. 36 | This parameter is mandatory. 37 | 38 | ```yaml 39 | Type: String 40 | Parameter Sets: (All) 41 | Aliases: 42 | 43 | Required: True 44 | Position: 1 45 | Default value: None 46 | Accept pipeline input: False 47 | Accept wildcard characters: False 48 | ``` 49 | 50 | ### -Description 51 | The description of the access group. 52 | 53 | ```yaml 54 | Type: String 55 | Parameter Sets: (All) 56 | Aliases: 57 | 58 | Required: False 59 | Position: 2 60 | Default value: None 61 | Accept pipeline input: False 62 | Accept wildcard characters: False 63 | ``` 64 | 65 | ### -Tenant 66 | The ID of the tenant to which the access group belongs. 67 | 68 | ```yaml 69 | Type: String 70 | Parameter Sets: (All) 71 | Aliases: 72 | 73 | Required: False 74 | Position: 3 75 | Default value: None 76 | Accept pipeline input: False 77 | Accept wildcard characters: False 78 | ``` 79 | 80 | ### -ProgressAction 81 | {{ Fill ProgressAction Description }} 82 | 83 | ```yaml 84 | Type: ActionPreference 85 | Parameter Sets: (All) 86 | Aliases: proga 87 | 88 | Required: False 89 | Position: Named 90 | Default value: None 91 | Accept pipeline input: False 92 | Accept wildcard characters: False 93 | ``` 94 | 95 | ### CommonParameters 96 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 97 | 98 | ## INPUTS 99 | 100 | ### None. You cannot pipe objects to this command. 101 | ## OUTPUTS 102 | 103 | ### Returns LogicMonitor.AccessGroup object. 104 | ## NOTES 105 | You must run Connect-LMAccount before running this command. 106 | 107 | ## RELATED LINKS 108 | -------------------------------------------------------------------------------- /Documentation/New-LMAccessGroupMapping.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: Logic.Monitor-help.xml 3 | Module Name: Logic.Monitor 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-LMAccessGroupMapping 9 | 10 | ## SYNOPSIS 11 | Creates a new LogicMonitor access group mapping. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-LMAccessGroupMapping [-AccessGroupIds] [-LogicModuleType] [-LogicModuleId] 17 | [-ProgressAction ] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | The New-LMAccessGroupMapping function creates a mapping between an access group and a logic module in LogicMonitor. 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | #Create a new access group mapping 28 | New-LMAccessGroupMapping -AccessGroupIds "12345" -LogicModuleType "DATASOURCE" -LogicModuleId "67890" 29 | ``` 30 | 31 | ## PARAMETERS 32 | 33 | ### -AccessGroupIds 34 | The IDs of the access groups to map. 35 | This parameter is mandatory. 36 | 37 | ```yaml 38 | Type: String[] 39 | Parameter Sets: (All) 40 | Aliases: 41 | 42 | Required: True 43 | Position: 1 44 | Default value: None 45 | Accept pipeline input: False 46 | Accept wildcard characters: False 47 | ``` 48 | 49 | ### -LogicModuleType 50 | The type of logic module. 51 | Valid values are "DATASOURCE", "EVENTSOURCE", "BATCHJOB", "JOBMONITOR", "LOGSOURCE", "TOPOLOGYSOURCE", "PROPERTYSOURCE", "APPLIESTO_FUNCTION", "SNMP_SYSOID_MAP". 52 | 53 | ```yaml 54 | Type: String 55 | Parameter Sets: (All) 56 | Aliases: 57 | 58 | Required: True 59 | Position: 2 60 | Default value: None 61 | Accept pipeline input: False 62 | Accept wildcard characters: False 63 | ``` 64 | 65 | ### -LogicModuleId 66 | The ID of the logic module to map. 67 | This parameter is mandatory. 68 | 69 | ```yaml 70 | Type: Int32 71 | Parameter Sets: (All) 72 | Aliases: 73 | 74 | Required: True 75 | Position: 3 76 | Default value: 0 77 | Accept pipeline input: False 78 | Accept wildcard characters: False 79 | ``` 80 | 81 | ### -ProgressAction 82 | {{ Fill ProgressAction Description }} 83 | 84 | ```yaml 85 | Type: ActionPreference 86 | Parameter Sets: (All) 87 | Aliases: proga 88 | 89 | Required: False 90 | Position: Named 91 | Default value: None 92 | Accept pipeline input: False 93 | Accept wildcard characters: False 94 | ``` 95 | 96 | ### CommonParameters 97 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 98 | 99 | ## INPUTS 100 | 101 | ### None. You cannot pipe objects to this command. 102 | ## OUTPUTS 103 | 104 | ### Returns mapping details object. 105 | ## NOTES 106 | You must run Connect-LMAccount before running this command. 107 | 108 | ## RELATED LINKS 109 | -------------------------------------------------------------------------------- /Documentation/New-LMAlertAck.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: Logic.Monitor-help.xml 3 | Module Name: Logic.Monitor 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-LMAlertAck 9 | 10 | ## SYNOPSIS 11 | Creates a new alert acknowledgment in LogicMonitor. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-LMAlertAck [-Ids] [-Note] [-ProgressAction ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | The New-LMAlertAck function acknowledges one or more alerts in LogicMonitor and adds a note to the acknowledgment. 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | #Acknowledge multiple alerts 27 | New-LMAlertAck -Ids @("12345","67890") -Note "Acknowledging alerts" 28 | ``` 29 | 30 | ## PARAMETERS 31 | 32 | ### -Ids 33 | The alert IDs to be acknowledged. 34 | This parameter is mandatory. 35 | 36 | ```yaml 37 | Type: String[] 38 | Parameter Sets: (All) 39 | Aliases: Id 40 | 41 | Required: True 42 | Position: 1 43 | Default value: None 44 | Accept pipeline input: True (ByPropertyName) 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -Note 49 | The note to be added to the acknowledgment. 50 | This parameter is mandatory. 51 | 52 | ```yaml 53 | Type: String 54 | Parameter Sets: (All) 55 | Aliases: 56 | 57 | Required: True 58 | Position: 2 59 | Default value: None 60 | Accept pipeline input: False 61 | Accept wildcard characters: False 62 | ``` 63 | 64 | ### -ProgressAction 65 | {{ Fill ProgressAction Description }} 66 | 67 | ```yaml 68 | Type: ActionPreference 69 | Parameter Sets: (All) 70 | Aliases: proga 71 | 72 | Required: False 73 | Position: Named 74 | Default value: None 75 | Accept pipeline input: False 76 | Accept wildcard characters: False 77 | ``` 78 | 79 | ### CommonParameters 80 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 81 | 82 | ## INPUTS 83 | 84 | ### None. You cannot pipe objects to this command. 85 | ## OUTPUTS 86 | 87 | ### Returns a success message if the acknowledgment is created successfully. 88 | ## NOTES 89 | You must run Connect-LMAccount before running this command. 90 | 91 | ## RELATED LINKS 92 | -------------------------------------------------------------------------------- /Documentation/New-LMAlertEscalation.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: Logic.Monitor-help.xml 3 | Module Name: Logic.Monitor 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-LMAlertEscalation 9 | 10 | ## SYNOPSIS 11 | Creates a new escalation for a LogicMonitor alert. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-LMAlertEscalation [-Id] [-ProgressAction ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | The New-LMAlertEscalation function creates a new escalation for a specified alert in LogicMonitor. 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | #Escalate an alert 27 | New-LMAlertEscalation -Id "DS12345" 28 | ``` 29 | 30 | ## PARAMETERS 31 | 32 | ### -Id 33 | The ID of the alert to escalate. 34 | This parameter is mandatory. 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: True 42 | Position: 1 43 | Default value: None 44 | Accept pipeline input: True (ByPropertyName) 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -ProgressAction 49 | {{ Fill ProgressAction Description }} 50 | 51 | ```yaml 52 | Type: ActionPreference 53 | Parameter Sets: (All) 54 | Aliases: proga 55 | 56 | Required: False 57 | Position: Named 58 | Default value: None 59 | Accept pipeline input: False 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### CommonParameters 64 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 65 | 66 | ## INPUTS 67 | 68 | ### None. You cannot pipe objects to this command. 69 | ## OUTPUTS 70 | 71 | ### Returns a success message if the escalation is created successfully. 72 | ## NOTES 73 | You must run Connect-LMAccount before running this command. 74 | 75 | ## RELATED LINKS 76 | -------------------------------------------------------------------------------- /Documentation/New-LMAlertNote.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: Logic.Monitor-help.xml 3 | Module Name: Logic.Monitor 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-LMAlertNote 9 | 10 | ## SYNOPSIS 11 | Creates a new note for LogicMonitor alerts. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-LMAlertNote [-Ids] [-Note] [-ProgressAction ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | The New-LMAlertNote function adds a note to one or more alerts in LogicMonitor. 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | #Add a note to multiple alerts 27 | New-LMAlertNote -Ids @("12345","67890") -Note "This is a sample note" 28 | ``` 29 | 30 | ## PARAMETERS 31 | 32 | ### -Ids 33 | The alert IDs to add the note to. 34 | This parameter is mandatory. 35 | 36 | ```yaml 37 | Type: String[] 38 | Parameter Sets: (All) 39 | Aliases: Id 40 | 41 | Required: True 42 | Position: 1 43 | Default value: None 44 | Accept pipeline input: True (ByPropertyName) 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -Note 49 | The content of the note to add. 50 | This parameter is mandatory. 51 | 52 | ```yaml 53 | Type: String 54 | Parameter Sets: (All) 55 | Aliases: 56 | 57 | Required: True 58 | Position: 2 59 | Default value: None 60 | Accept pipeline input: False 61 | Accept wildcard characters: False 62 | ``` 63 | 64 | ### -ProgressAction 65 | {{ Fill ProgressAction Description }} 66 | 67 | ```yaml 68 | Type: ActionPreference 69 | Parameter Sets: (All) 70 | Aliases: proga 71 | 72 | Required: False 73 | Position: Named 74 | Default value: None 75 | Accept pipeline input: False 76 | Accept wildcard characters: False 77 | ``` 78 | 79 | ### CommonParameters 80 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 81 | 82 | ## INPUTS 83 | 84 | ### None. You cannot pipe objects to this command. 85 | ## OUTPUTS 86 | 87 | ### Returns a success message if the note is created successfully. 88 | ## NOTES 89 | You must run Connect-LMAccount before running this command. 90 | 91 | ## RELATED LINKS 92 | -------------------------------------------------------------------------------- /Documentation/New-LMAppliesToFunction.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: Logic.Monitor-help.xml 3 | Module Name: Logic.Monitor 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-LMAppliesToFunction 9 | 10 | ## SYNOPSIS 11 | Creates a new LogicMonitor Applies To function. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-LMAppliesToFunction [-Name] [[-Description] ] [-AppliesTo] 17 | [-ProgressAction ] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | The New-LMAppliesToFunction function creates a new Applies To function that can be used in LogicMonitor for targeting resources. 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | #Create a new Applies To function 28 | New-LMAppliesToFunction -Name "WindowsServers" -AppliesTo "isWindows() && hasCategory('server')" -Description "Targets Windows servers" 29 | ``` 30 | 31 | ## PARAMETERS 32 | 33 | ### -Name 34 | The name of the function. 35 | This parameter is mandatory. 36 | 37 | ```yaml 38 | Type: String 39 | Parameter Sets: (All) 40 | Aliases: 41 | 42 | Required: True 43 | Position: 1 44 | Default value: None 45 | Accept pipeline input: False 46 | Accept wildcard characters: False 47 | ``` 48 | 49 | ### -Description 50 | A description of the function's purpose. 51 | 52 | ```yaml 53 | Type: String 54 | Parameter Sets: (All) 55 | Aliases: 56 | 57 | Required: False 58 | Position: 2 59 | Default value: None 60 | Accept pipeline input: False 61 | Accept wildcard characters: False 62 | ``` 63 | 64 | ### -AppliesTo 65 | The function code that defines the targeting logic. 66 | This parameter is mandatory. 67 | 68 | ```yaml 69 | Type: String 70 | Parameter Sets: (All) 71 | Aliases: 72 | 73 | Required: True 74 | Position: 3 75 | Default value: None 76 | Accept pipeline input: False 77 | Accept wildcard characters: False 78 | ``` 79 | 80 | ### -ProgressAction 81 | {{ Fill ProgressAction Description }} 82 | 83 | ```yaml 84 | Type: ActionPreference 85 | Parameter Sets: (All) 86 | Aliases: proga 87 | 88 | Required: False 89 | Position: Named 90 | Default value: None 91 | Accept pipeline input: False 92 | Accept wildcard characters: False 93 | ``` 94 | 95 | ### CommonParameters 96 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 97 | 98 | ## INPUTS 99 | 100 | ### None. You cannot pipe objects to this command. 101 | ## OUTPUTS 102 | 103 | ### Returns the created function object. 104 | ## NOTES 105 | You must run Connect-LMAccount before running this command. 106 | 107 | ## RELATED LINKS 108 | -------------------------------------------------------------------------------- /Documentation/New-LMDatasource.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: Logic.Monitor-help.xml 3 | Module Name: Logic.Monitor 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-LMDatasource 9 | 10 | ## SYNOPSIS 11 | Creates a new LogicMonitor datasource. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-LMDatasource [-Datasource] [-ProgressAction ] [-WhatIf] [-Confirm] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | The New-LMDatasource function creates a new datasource in LogicMonitor using a provided datasource configuration object. 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | #Create a new datasource 28 | $config = @{ 29 | name = "MyDatasource" 30 | # Additional configuration properties 31 | } 32 | New-LMDatasource -Datasource $config 33 | ``` 34 | 35 | ## PARAMETERS 36 | 37 | ### -Datasource 38 | A PSCustomObject containing the datasource configuration. 39 | Must follow the schema model defined in LogicMonitor's API documentation. 40 | 41 | ```yaml 42 | Type: PSObject 43 | Parameter Sets: (All) 44 | Aliases: 45 | 46 | Required: True 47 | Position: 1 48 | Default value: None 49 | Accept pipeline input: False 50 | Accept wildcard characters: False 51 | ``` 52 | 53 | ### -WhatIf 54 | Shows what would happen if the cmdlet runs. 55 | The cmdlet is not run. 56 | 57 | ```yaml 58 | Type: SwitchParameter 59 | Parameter Sets: (All) 60 | Aliases: wi 61 | 62 | Required: False 63 | Position: Named 64 | Default value: None 65 | Accept pipeline input: False 66 | Accept wildcard characters: False 67 | ``` 68 | 69 | ### -Confirm 70 | Prompts you for confirmation before running the cmdlet. 71 | 72 | ```yaml 73 | Type: SwitchParameter 74 | Parameter Sets: (All) 75 | Aliases: cf 76 | 77 | Required: False 78 | Position: Named 79 | Default value: None 80 | Accept pipeline input: False 81 | Accept wildcard characters: False 82 | ``` 83 | 84 | ### -ProgressAction 85 | {{ Fill ProgressAction Description }} 86 | 87 | ```yaml 88 | Type: ActionPreference 89 | Parameter Sets: (All) 90 | Aliases: proga 91 | 92 | Required: False 93 | Position: Named 94 | Default value: None 95 | Accept pipeline input: False 96 | Accept wildcard characters: False 97 | ``` 98 | 99 | ### CommonParameters 100 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 101 | 102 | ## INPUTS 103 | 104 | ### None. You cannot pipe objects to this command. 105 | ## OUTPUTS 106 | 107 | ### Returns LogicMonitor.Datasource object. 108 | ## NOTES 109 | You must run Connect-LMAccount before running this command. 110 | For datasource schema details, see: https://www.logicmonitor.com/swagger-ui-master/api-v3/dist/#/Datasources/addDatasourceById 111 | 112 | ## RELATED LINKS 113 | -------------------------------------------------------------------------------- /Documentation/New-LMNetscanGroup.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: Logic.Monitor-help.xml 3 | Module Name: Logic.Monitor 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-LMNetscanGroup 9 | 10 | ## SYNOPSIS 11 | Creates a new LogicMonitor Netscan Group. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-LMNetscanGroup [-Name] [[-Description] ] [-ProgressAction ] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | The New-LMNetscanGroup function creates a new Netscan Group in LogicMonitor. 22 | It allows you to specify a name and optional description for the group. 23 | 24 | ## EXAMPLES 25 | 26 | ### EXAMPLE 1 27 | ``` 28 | New-LMNetscanGroup -Name "Group1" -Description "This is a sample group" 29 | Creates a new Netscan Group with the name "Group1" and the description "This is a sample group". 30 | ``` 31 | 32 | ## PARAMETERS 33 | 34 | ### -Name 35 | Specifies the name of the Netscan Group. 36 | This parameter is mandatory. 37 | 38 | ```yaml 39 | Type: String 40 | Parameter Sets: (All) 41 | Aliases: 42 | 43 | Required: True 44 | Position: 1 45 | Default value: None 46 | Accept pipeline input: False 47 | Accept wildcard characters: False 48 | ``` 49 | 50 | ### -Description 51 | Specifies the description for the Netscan Group. 52 | 53 | ```yaml 54 | Type: String 55 | Parameter Sets: (All) 56 | Aliases: 57 | 58 | Required: False 59 | Position: 2 60 | Default value: None 61 | Accept pipeline input: False 62 | Accept wildcard characters: False 63 | ``` 64 | 65 | ### -ProgressAction 66 | {{ Fill ProgressAction Description }} 67 | 68 | ```yaml 69 | Type: ActionPreference 70 | Parameter Sets: (All) 71 | Aliases: proga 72 | 73 | Required: False 74 | Position: Named 75 | Default value: None 76 | Accept pipeline input: False 77 | Accept wildcard characters: False 78 | ``` 79 | 80 | ### CommonParameters 81 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 82 | 83 | ## INPUTS 84 | 85 | ### None. You cannot pipe objects to this command. 86 | ## OUTPUTS 87 | 88 | ### Returns LogicMonitor.NetScanGroup object. 89 | ## NOTES 90 | You must run Connect-LMAccount before running this command. 91 | 92 | ## RELATED LINKS 93 | -------------------------------------------------------------------------------- /Documentation/New-LMNormalizedProperties.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: Logic.Monitor-help.xml 3 | Module Name: Logic.Monitor 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-LMNormalizedProperties 9 | 10 | ## SYNOPSIS 11 | Creates normalized properties in LogicMonitor. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-LMNormalizedProperties [-Alias] [-Properties] [-ProgressAction ] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | The New-LMNormalizedProperties cmdlet creates normalized properties in LogicMonitor. 22 | Normalized properties allow you to map multiple host properties to a single alias that can be used across your environment. 23 | 24 | ## EXAMPLES 25 | 26 | ### EXAMPLE 1 27 | ``` 28 | #Creates a normalized property with alias "location" mapped to multiple source properties. 29 | New-LMNormalizedProperties -Alias "location" -Properties @("location", "snmp.sysLocation", "auto.meraki.location") 30 | ``` 31 | 32 | ## PARAMETERS 33 | 34 | ### -Alias 35 | The alias name for the normalized property. 36 | 37 | ```yaml 38 | Type: String 39 | Parameter Sets: (All) 40 | Aliases: 41 | 42 | Required: True 43 | Position: 1 44 | Default value: None 45 | Accept pipeline input: False 46 | Accept wildcard characters: False 47 | ``` 48 | 49 | ### -Properties 50 | An array of host property names to map to the alias. 51 | 52 | ```yaml 53 | Type: Array 54 | Parameter Sets: (All) 55 | Aliases: 56 | 57 | Required: True 58 | Position: 2 59 | Default value: None 60 | Accept pipeline input: False 61 | Accept wildcard characters: False 62 | ``` 63 | 64 | ### -ProgressAction 65 | {{ Fill ProgressAction Description }} 66 | 67 | ```yaml 68 | Type: ActionPreference 69 | Parameter Sets: (All) 70 | Aliases: proga 71 | 72 | Required: False 73 | Position: Named 74 | Default value: None 75 | Accept pipeline input: False 76 | Accept wildcard characters: False 77 | ``` 78 | 79 | ### CommonParameters 80 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 81 | 82 | ## INPUTS 83 | 84 | ### None. You cannot pipe objects to this command. 85 | ## OUTPUTS 86 | 87 | ### Returns LogicMonitor.NormalizedProperties object. 88 | ## NOTES 89 | You must run Connect-LMAccount before running this command. 90 | Reserved for internal use. 91 | 92 | ## RELATED LINKS 93 | -------------------------------------------------------------------------------- /Documentation/New-LMReportGroup.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: Logic.Monitor-help.xml 3 | Module Name: Logic.Monitor 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-LMReportGroup 9 | 10 | ## SYNOPSIS 11 | Creates a new LogicMonitor report group. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-LMReportGroup [-Name] [[-Description] ] [-ProgressAction ] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | The New-LMReportGroup function creates a new report group in LogicMonitor. 22 | It requires the name of the report group as a mandatory parameter and an optional description. 23 | 24 | ## EXAMPLES 25 | 26 | ### EXAMPLE 1 27 | ``` 28 | New-LMReportGroup -Name "MyReportGroup" -Description "This is a sample report group" 29 | ``` 30 | 31 | This example creates a new report group with the name "MyReportGroup" and the description "This is a sample report group". 32 | 33 | ## PARAMETERS 34 | 35 | ### -Name 36 | The name of the report group. 37 | This parameter is mandatory. 38 | 39 | ```yaml 40 | Type: String 41 | Parameter Sets: (All) 42 | Aliases: 43 | 44 | Required: True 45 | Position: 1 46 | Default value: None 47 | Accept pipeline input: False 48 | Accept wildcard characters: False 49 | ``` 50 | 51 | ### -Description 52 | The description of the report group. 53 | This parameter is optional. 54 | 55 | ```yaml 56 | Type: String 57 | Parameter Sets: (All) 58 | Aliases: 59 | 60 | Required: False 61 | Position: 2 62 | Default value: None 63 | Accept pipeline input: False 64 | Accept wildcard characters: False 65 | ``` 66 | 67 | ### -ProgressAction 68 | {{ Fill ProgressAction Description }} 69 | 70 | ```yaml 71 | Type: ActionPreference 72 | Parameter Sets: (All) 73 | Aliases: proga 74 | 75 | Required: False 76 | Position: Named 77 | Default value: None 78 | Accept pipeline input: False 79 | Accept wildcard characters: False 80 | ``` 81 | 82 | ### CommonParameters 83 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 84 | 85 | ## INPUTS 86 | 87 | ### None. You cannot pipe objects to this command. 88 | ## OUTPUTS 89 | 90 | ### Returns LogicMonitor.ReportGroup object. 91 | ## NOTES 92 | You must run Connect-LMAccount before running this command. 93 | 94 | ## RELATED LINKS 95 | -------------------------------------------------------------------------------- /Documentation/Remove-LMNormalizedProperties.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: Logic.Monitor-help.xml 3 | Module Name: Logic.Monitor 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Remove-LMNormalizedProperties 9 | 10 | ## SYNOPSIS 11 | Removes normalized properties from LogicMonitor. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Remove-LMNormalizedProperties [-Alias] [-ProgressAction ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | The Remove-LMNormalizedProperties cmdlet removes normalized properties from LogicMonitor. 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Remove-LMNormalizedProperties -Alias "location" 27 | Removes the normalized property with alias "location". 28 | ``` 29 | 30 | ## PARAMETERS 31 | 32 | ### -Alias 33 | The alias name of the normalized property to remove. 34 | 35 | ```yaml 36 | Type: String 37 | Parameter Sets: (All) 38 | Aliases: 39 | 40 | Required: True 41 | Position: 1 42 | Default value: None 43 | Accept pipeline input: False 44 | Accept wildcard characters: False 45 | ``` 46 | 47 | ### -ProgressAction 48 | {{ Fill ProgressAction Description }} 49 | 50 | ```yaml 51 | Type: ActionPreference 52 | Parameter Sets: (All) 53 | Aliases: proga 54 | 55 | Required: False 56 | Position: Named 57 | Default value: None 58 | Accept pipeline input: False 59 | Accept wildcard characters: False 60 | ``` 61 | 62 | ### CommonParameters 63 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 64 | 65 | ## INPUTS 66 | 67 | ### None. 68 | ## OUTPUTS 69 | 70 | ### Returns the response from the API after removing the normalized property. 71 | ## NOTES 72 | This function requires valid API credentials to be logged in. 73 | Use Connect-LMAccount to log in before running this command. 74 | 75 | ## RELATED LINKS 76 | -------------------------------------------------------------------------------- /Documentation/Remove-LMOpsNote.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: Logic.Monitor-help.xml 3 | Module Name: Logic.Monitor 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Remove-LMOpsNote 9 | 10 | ## SYNOPSIS 11 | Removes an OpsNote from LogicMonitor. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Remove-LMOpsNote -Id [-ProgressAction ] [-WhatIf] [-Confirm] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | The Remove-LMOpsNote function removes an OpsNote from LogicMonitor. 21 | It requires the user to be logged in and have valid API credentials. 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Remove-LMOpsNote -Id "12345" 28 | Removes the OpsNote with the ID "12345" from LogicMonitor. 29 | ``` 30 | 31 | ## PARAMETERS 32 | 33 | ### -Id 34 | Specifies the ID of the OpsNote to be removed. 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: True 42 | Position: Named 43 | Default value: None 44 | Accept pipeline input: True (ByPropertyName) 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -WhatIf 49 | Shows what would happen if the cmdlet runs. 50 | The cmdlet is not run. 51 | 52 | ```yaml 53 | Type: SwitchParameter 54 | Parameter Sets: (All) 55 | Aliases: wi 56 | 57 | Required: False 58 | Position: Named 59 | Default value: None 60 | Accept pipeline input: False 61 | Accept wildcard characters: False 62 | ``` 63 | 64 | ### -Confirm 65 | Prompts you for confirmation before running the cmdlet. 66 | 67 | ```yaml 68 | Type: SwitchParameter 69 | Parameter Sets: (All) 70 | Aliases: cf 71 | 72 | Required: False 73 | Position: Named 74 | Default value: None 75 | Accept pipeline input: False 76 | Accept wildcard characters: False 77 | ``` 78 | 79 | ### -ProgressAction 80 | {{ Fill ProgressAction Description }} 81 | 82 | ```yaml 83 | Type: ActionPreference 84 | Parameter Sets: (All) 85 | Aliases: proga 86 | 87 | Required: False 88 | Position: Named 89 | Default value: None 90 | Accept pipeline input: False 91 | Accept wildcard characters: False 92 | ``` 93 | 94 | ### CommonParameters 95 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 96 | 97 | ## INPUTS 98 | 99 | ### You can pipe objects to this function. 100 | ## OUTPUTS 101 | 102 | ### Returns a PSCustomObject containing the ID of the removed OpsNote and a message indicating the success of the removal operation. 103 | ## NOTES 104 | 105 | ## RELATED LINKS 106 | -------------------------------------------------------------------------------- /Documentation/Remove-LMSDT.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: Logic.Monitor-help.xml 3 | Module Name: Logic.Monitor 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Remove-LMSDT 9 | 10 | ## SYNOPSIS 11 | Removes a Scheduled Down Time (SDT) entry from LogicMonitor. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Remove-LMSDT -Id [-ProgressAction ] [-WhatIf] [-Confirm] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | The Remove-LMSDT function removes a specified SDT entry from LogicMonitor using its ID. 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Remove-LMSDT -Id "12345" 27 | Removes the SDT entry with ID "12345". 28 | ``` 29 | 30 | ## PARAMETERS 31 | 32 | ### -Id 33 | Specifies the ID of the SDT entry to remove. 34 | This parameter is mandatory. 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: True 42 | Position: Named 43 | Default value: None 44 | Accept pipeline input: True (ByPropertyName) 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -WhatIf 49 | Shows what would happen if the cmdlet runs. 50 | The cmdlet is not run. 51 | 52 | ```yaml 53 | Type: SwitchParameter 54 | Parameter Sets: (All) 55 | Aliases: wi 56 | 57 | Required: False 58 | Position: Named 59 | Default value: None 60 | Accept pipeline input: False 61 | Accept wildcard characters: False 62 | ``` 63 | 64 | ### -Confirm 65 | Prompts you for confirmation before running the cmdlet. 66 | 67 | ```yaml 68 | Type: SwitchParameter 69 | Parameter Sets: (All) 70 | Aliases: cf 71 | 72 | Required: False 73 | Position: Named 74 | Default value: None 75 | Accept pipeline input: False 76 | Accept wildcard characters: False 77 | ``` 78 | 79 | ### -ProgressAction 80 | {{ Fill ProgressAction Description }} 81 | 82 | ```yaml 83 | Type: ActionPreference 84 | Parameter Sets: (All) 85 | Aliases: proga 86 | 87 | Required: False 88 | Position: Named 89 | Default value: None 90 | Accept pipeline input: False 91 | Accept wildcard characters: False 92 | ``` 93 | 94 | ### CommonParameters 95 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 96 | 97 | ## INPUTS 98 | 99 | ### You can pipe objects to this function. 100 | ## OUTPUTS 101 | 102 | ### Returns a PSCustomObject containing the ID of the removed SDT entry and a success message confirming the removal. 103 | ## NOTES 104 | 105 | ## RELATED LINKS 106 | -------------------------------------------------------------------------------- /Documentation/Remove-LMUnmonitoredDevice.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: Logic.Monitor-help.xml 3 | Module Name: Logic.Monitor 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Remove-LMUnmonitoredDevice 9 | 10 | ## SYNOPSIS 11 | Removes unmonitored devices from LogicMonitor. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Remove-LMUnmonitoredDevice -Ids [-ProgressAction ] [-WhatIf] [-Confirm] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | The Remove-LMUnmonitoredDevice function removes one or more unmonitored devices from LogicMonitor using their IDs. 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Remove-LMUnmonitoredDevice -Ids "123","456" 28 | Removes the unmonitored devices with IDs "123" and "456". 29 | ``` 30 | 31 | ## PARAMETERS 32 | 33 | ### -Ids 34 | Specifies an array of IDs for the unmonitored devices to remove. 35 | 36 | ```yaml 37 | Type: String[] 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: True 42 | Position: Named 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -WhatIf 49 | Shows what would happen if the cmdlet runs. 50 | The cmdlet is not run. 51 | 52 | ```yaml 53 | Type: SwitchParameter 54 | Parameter Sets: (All) 55 | Aliases: wi 56 | 57 | Required: False 58 | Position: Named 59 | Default value: None 60 | Accept pipeline input: False 61 | Accept wildcard characters: False 62 | ``` 63 | 64 | ### -Confirm 65 | Prompts you for confirmation before running the cmdlet. 66 | 67 | ```yaml 68 | Type: SwitchParameter 69 | Parameter Sets: (All) 70 | Aliases: cf 71 | 72 | Required: False 73 | Position: Named 74 | Default value: None 75 | Accept pipeline input: False 76 | Accept wildcard characters: False 77 | ``` 78 | 79 | ### -ProgressAction 80 | {{ Fill ProgressAction Description }} 81 | 82 | ```yaml 83 | Type: ActionPreference 84 | Parameter Sets: (All) 85 | Aliases: proga 86 | 87 | Required: False 88 | Position: Named 89 | Default value: None 90 | Accept pipeline input: False 91 | Accept wildcard characters: False 92 | ``` 93 | 94 | ### CommonParameters 95 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 96 | 97 | ## INPUTS 98 | 99 | ### None. 100 | ## OUTPUTS 101 | 102 | ### Returns a LogicMonitor.UnmonitoredDevice object containing information about the removed devices. 103 | ## NOTES 104 | 105 | ## RELATED LINKS 106 | -------------------------------------------------------------------------------- /Documentation/Set-LMLogPartitionAction.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: Logic.Monitor-help.xml 3 | Module Name: Logic.Monitor 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Set-LMLogPartitionAction 9 | 10 | ## SYNOPSIS 11 | Updates a LogicMonitor Log Partition configuration to either pause or resume log ingestion. 12 | 13 | ## SYNTAX 14 | 15 | ### Id 16 | ``` 17 | Set-LMLogPartitionAction [-Id ] -Action [-ProgressAction ] 18 | [] 19 | ``` 20 | 21 | ### Name 22 | ``` 23 | Set-LMLogPartitionAction [-Name ] -Action [-ProgressAction ] 24 | [] 25 | ``` 26 | 27 | ## DESCRIPTION 28 | The Set-LMLogPartitionAction function modifies an existing log partition action in LogicMonitor. 29 | 30 | ## EXAMPLES 31 | 32 | ### EXAMPLE 1 33 | ``` 34 | Set-LMLogPartitionAction -Id 123 -Action "pause" 35 | Updates the log partition with ID 123 to pause log ingestion. 36 | ``` 37 | 38 | ## PARAMETERS 39 | 40 | ### -Id 41 | Specifies the ID of the log partition action to modify. 42 | 43 | ```yaml 44 | Type: Int32 45 | Parameter Sets: Id 46 | Aliases: 47 | 48 | Required: False 49 | Position: Named 50 | Default value: 0 51 | Accept pipeline input: True (ByPropertyName) 52 | Accept wildcard characters: False 53 | ``` 54 | 55 | ### -Name 56 | Specifies the current name of the log partition to modify. 57 | 58 | ```yaml 59 | Type: String 60 | Parameter Sets: Name 61 | Aliases: 62 | 63 | Required: False 64 | Position: Named 65 | Default value: None 66 | Accept pipeline input: False 67 | Accept wildcard characters: False 68 | ``` 69 | 70 | ### -Action 71 | Specifies the new action for the log partition. 72 | Possible values are "pause" or "resume". 73 | 74 | ```yaml 75 | Type: String 76 | Parameter Sets: (All) 77 | Aliases: 78 | 79 | Required: True 80 | Position: Named 81 | Default value: None 82 | Accept pipeline input: False 83 | Accept wildcard characters: False 84 | ``` 85 | 86 | ### -ProgressAction 87 | {{ Fill ProgressAction Description }} 88 | 89 | ```yaml 90 | Type: ActionPreference 91 | Parameter Sets: (All) 92 | Aliases: proga 93 | 94 | Required: False 95 | Position: Named 96 | Default value: None 97 | Accept pipeline input: False 98 | Accept wildcard characters: False 99 | ``` 100 | 101 | ### CommonParameters 102 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 103 | 104 | ## INPUTS 105 | 106 | ### None. 107 | ## OUTPUTS 108 | 109 | ### Returns a LogicMonitor.LogPartition object containing the updated log partition information. 110 | ## NOTES 111 | This function requires a valid LogicMonitor API authentication. 112 | 113 | ## RELATED LINKS 114 | -------------------------------------------------------------------------------- /Documentation/Set-LMNewUserMessage.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: Logic.Monitor-help.xml 3 | Module Name: Logic.Monitor 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Set-LMNewUserMessage 9 | 10 | ## SYNOPSIS 11 | Updates the new user message template in LogicMonitor. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Set-LMNewUserMessage [-MessageBody] [-MessageSubject] [-ProgressAction ] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | The Set-LMNewUserMessage function modifies the message template that is sent to new users in LogicMonitor. 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Set-LMNewUserMessage -MessageBody "Welcome to our monitoring system" -MessageSubject "Welcome to LogicMonitor" 28 | Updates the new user message template with the specified subject and body. 29 | ``` 30 | 31 | ## PARAMETERS 32 | 33 | ### -MessageBody 34 | Specifies the body content of the message template. 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: True 42 | Position: 1 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -MessageSubject 49 | Specifies the subject line of the message template. 50 | 51 | ```yaml 52 | Type: String 53 | Parameter Sets: (All) 54 | Aliases: 55 | 56 | Required: True 57 | Position: 2 58 | Default value: None 59 | Accept pipeline input: False 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### -ProgressAction 64 | {{ Fill ProgressAction Description }} 65 | 66 | ```yaml 67 | Type: ActionPreference 68 | Parameter Sets: (All) 69 | Aliases: proga 70 | 71 | Required: False 72 | Position: Named 73 | Default value: None 74 | Accept pipeline input: False 75 | Accept wildcard characters: False 76 | ``` 77 | 78 | ### CommonParameters 79 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 80 | 81 | ## INPUTS 82 | 83 | ### None. 84 | ## OUTPUTS 85 | 86 | ### Returns the response from the API indicating the success of the update. 87 | ## NOTES 88 | This function requires a valid LogicMonitor API authentication. 89 | 90 | ## RELATED LINKS 91 | -------------------------------------------------------------------------------- /Documentation/Test-LMAppliesToQuery.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: Logic.Monitor-help.xml 3 | Module Name: Logic.Monitor 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Test-LMAppliesToQuery 9 | 10 | ## SYNOPSIS 11 | Tests the applies to query against the LogicMonitor API. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Test-LMAppliesToQuery [-Query] [-ProgressAction ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | The Test-LMAppliesToQuery function is used to test the applies to query against the LogicMonitor API. 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Test-LMAppliesToQuery -Query "system.hostname == 'server01'" 27 | This example tests the applies to query "system.hostname == 'server01'" against the LogicMonitor API and returns a list of matching devices. 28 | ``` 29 | 30 | ## PARAMETERS 31 | 32 | ### -Query 33 | The applies to query to be tested. 34 | 35 | ```yaml 36 | Type: String 37 | Parameter Sets: (All) 38 | Aliases: 39 | 40 | Required: True 41 | Position: 1 42 | Default value: None 43 | Accept pipeline input: False 44 | Accept wildcard characters: False 45 | ``` 46 | 47 | ### -ProgressAction 48 | {{ Fill ProgressAction Description }} 49 | 50 | ```yaml 51 | Type: ActionPreference 52 | Parameter Sets: (All) 53 | Aliases: proga 54 | 55 | Required: False 56 | Position: Named 57 | Default value: None 58 | Accept pipeline input: False 59 | Accept wildcard characters: False 60 | ``` 61 | 62 | ### CommonParameters 63 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 64 | 65 | ## INPUTS 66 | 67 | ### The Query parameter accepts string input that specifies the applies to query to test. 68 | ## OUTPUTS 69 | 70 | ### Returns an array of objects containing the devices that match the specified query criteria. 71 | ## NOTES 72 | This function requires a valid LogicMonitor API authentication. 73 | The query syntax must follow LogicMonitor's applies to query format. 74 | 75 | ## RELATED LINKS 76 | -------------------------------------------------------------------------------- /Logic.Monitor.psm1: -------------------------------------------------------------------------------- 1 | #Get public and private function definition files. 2 | $Public = @( Get-ChildItem -Path $PSScriptRoot\Public\*.ps1 -ErrorAction SilentlyContinue -Recurse) 3 | $Private = @( Get-ChildItem -Path $PSScriptRoot\Private\*.ps1 -ErrorAction SilentlyContinue -Recurse) 4 | 5 | #Dot source the files 6 | Foreach ($import in @($Public + $Private)) { 7 | Try { 8 | . $import.fullname 9 | } 10 | Catch { 11 | Write-Error -Message "Failed to import function $($import.fullname): $_" 12 | } 13 | } 14 | 15 | Export-ModuleMember -Function $Public.Basename -------------------------------------------------------------------------------- /Private/Format-LMFilter-v1.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This function formats a filter for Logic Monitor API calls. 4 | 5 | .DESCRIPTION 6 | The Format-LMFilter-v1 function takes a hashtable of filter properties and an optional array of valid properties. 7 | It checks if the supplied properties are valid, removes any invalid properties, and then formats the remaining properties into a filter string. 8 | 9 | .PARAMETER Filter 10 | A hashtable of filter properties. This is a mandatory parameter. 11 | 12 | .PARAMETER PropList 13 | An array of valid properties. If this parameter is provided, the function checks the properties in the Filter parameter against this list and removes any that are not valid. 14 | 15 | .EXAMPLE 16 | Format-LMFilter-v1 -Filter $Filter -PropList $PropList 17 | 18 | This command formats the filter properties represented by the $Filter hashtable into a filter string, removing any properties that are not in the $PropList array. 19 | 20 | .INPUTS 21 | System.Collections.Hashtable, System.String[]. You can pipe a hashtable of filter properties and an array of valid properties to Format-LMFilter-v1. 22 | 23 | .OUTPUTS 24 | System.String. The function returns a string that represents the formatted filter. 25 | 26 | .NOTES 27 | If a property in the Filter parameter is not in the PropList parameter, it is simply removed from the filter. 28 | #> 29 | Function Format-LMFilter-v1 { 30 | [CmdletBinding()] 31 | Param ( 32 | [Hashtable]$Filter, 33 | 34 | [String[]]$PropList 35 | ) 36 | 37 | #Initalize variable for final filter string 38 | $FilterString = "" 39 | 40 | #Check if supplied properties are valid, if no prop list then just assume valid 41 | If ($PropList) { 42 | Foreach ($Key in $($Filter.keys)) { 43 | If ($Key -notin $PropList) { 44 | #Remove key since its not a valid filter property 45 | $filter.remove($Key) 46 | } 47 | } 48 | } 49 | 50 | #Create filter string from hash table and url encode 51 | Foreach ($Key in $($Filter.keys)) { 52 | $FilterString += $Key + ":" + "`"$($Filter[$Key])`"" + "," 53 | } 54 | $FilterString = $FilterString.trimend(',') 55 | 56 | Return $FilterString 57 | } -------------------------------------------------------------------------------- /Private/Get-LMPortalURI.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Gets the LogicMonitor portal URI based on whether the account is using GovCloud or standard portal. 4 | 5 | .DESCRIPTION 6 | The Get-LMPortalURI function determines the appropriate LogicMonitor portal URI based on the account configuration. 7 | It checks if the account is using GovCloud and returns the appropriate domain suffix. 8 | 9 | .PARAMETER None 10 | This function does not accept any parameters. 11 | 12 | .EXAMPLE 13 | $portalUri = Get-LMPortalURI 14 | Returns "lmgov.us" for GovCloud accounts or "logicmonitor.com" for standard accounts. 15 | 16 | .OUTPUTS 17 | Returns a string containing the appropriate portal URI suffix. 18 | #> 19 | 20 | Function Get-LMPortalURI { 21 | #Check LMAuth for GovCloud 22 | If ($Script:LMAuth.GovCloud) { 23 | Return "lmgov.us/santaba/rest" 24 | } 25 | Else { 26 | Return "logicmonitor.com/santaba/rest" 27 | } 28 | } -------------------------------------------------------------------------------- /Private/Get-NestedDeviceGroups.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Retrieves nested device groups based on the provided group IDs. 4 | 5 | .DESCRIPTION 6 | The Get-NestedDeviceGroups function retrieves nested device groups by recursively querying the child groups of the provided group IDs. It returns an array of group IDs, including the original IDs and all nested child IDs. 7 | 8 | .PARAMETER Ids 9 | Specifies an array of group IDs for which to retrieve nested device groups. 10 | 11 | .PARAMETER PreviousIds 12 | Specifies an optional array of previously processed group IDs. This parameter is used internally for recursive calls and should not be provided when calling the function. 13 | 14 | .EXAMPLE 15 | Get-NestedDeviceGroups -Ids "Group1", "Group2" 16 | Retrieves all nested device groups for "Group1" and "Group2". 17 | 18 | .EXAMPLE 19 | Get-NestedDeviceGroups -Ids "Group1" -PreviousIds "Group3" 20 | Retrieves all nested device groups for "Group1" and includes "Group3" in the list of previously processed group IDs. 21 | 22 | #> 23 | Function Get-NestedDeviceGroups { 24 | Param ( 25 | [String[]]$Ids, 26 | [String[]]$PreviousIds = @() 27 | ) 28 | ##Write-Host "Function Called with Ids: $Ids" 29 | $AdditionalIds = @() 30 | Foreach ($Id in $Ids) { 31 | ##Write-Host "Processing Id: ($Id)" 32 | $temp = @() 33 | $temp += (Get-LMDeviceGroupGroups -Id $Id).Id 34 | If ($temp) { 35 | $AdditionalIds += $temp 36 | } 37 | } 38 | ##Write-Host "Function End with Ids: $AdditionalIds" 39 | ##Write-Host "Function Previous Called Ids: $PreviousIds" 40 | If ($AdditionalIds) { 41 | #PreviousIds and CurrentIds get combined and AdditionalIds get passed forward 42 | Get-NestedDeviceGroups -Ids $AdditionalIds -PreviousIds $($Ids + $PreviousIds) 43 | } 44 | Else { 45 | ##Write-Host "Return Value: " 46 | Return $($PreviousIds + $Ids) 47 | } 48 | } -------------------------------------------------------------------------------- /Private/New-LMRandomCred.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Generates a random password with the specified length. 4 | 5 | .DESCRIPTION 6 | The New-LMRandomCred function generates a random password using a specified length. It uses a set of valid password characters and a cryptographic random number generator to ensure the password is secure. 7 | 8 | .PARAMETER Length 9 | The length of the password to generate. The default value is 25. 10 | 11 | .EXAMPLE 12 | PS> New-LMRandomCred -Length 12 13 | Generates a random password with a length of 12 characters. 14 | 15 | .OUTPUTS 16 | System.String 17 | A randomly generated password. 18 | 19 | #> 20 | Function New-LMRandomCred { 21 | 22 | [CmdletBinding()] 23 | Param ( 24 | [Int]$Length = 25 25 | ) 26 | 27 | # Valid password characters 28 | $SymbolSet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789~!$%^()_-+=}{][@#&\|;:<>.?/".ToCharArray() 29 | 30 | #Generate random bytes 31 | $Random = New-Object System.Security.Cryptography.RNGCryptoServiceProvider 32 | $Bytes = New-Object Byte[]($Length) 33 | 34 | #Generate character set 35 | $Random.GetBytes($Bytes) 36 | $Result = New-Object Char[]($Length) 37 | 38 | #Construct randomized password 39 | For ($i = 0 ; $i -lt $Length ; $i++) { 40 | $Result[$i] = $SymbolSet[$Bytes[$i] % $SymbolSet.Length] 41 | } 42 | 43 | #Return result 44 | Return -Join $Result 45 | 46 | } 47 | -------------------------------------------------------------------------------- /Private/Resolve-LMDebugInfo.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Function to write debug information. 4 | 5 | .DESCRIPTION 6 | The Resolve-LMDebugInfo function is used to write debug information to the console. It displays the invoked command, bound parameters, invoked URL, request payload, and request headers. 7 | 8 | .PARAMETER Url 9 | The URL that was invoked. 10 | 11 | .PARAMETER Headers 12 | The headers used in the request. 13 | 14 | .PARAMETER Command 15 | The command that was invoked. 16 | 17 | .PARAMETER Payload 18 | The payload used in the request. 19 | 20 | .EXAMPLE 21 | Resolve-LMDebugInfo -Url "https://example.com/api" -Headers @{ "Authorization" = "Bearer token" } -Command Get-LMDevice -Payload "{'key': 'value'}" 22 | #> 23 | 24 | Function Resolve-LMDebugInfo { 25 | [CmdletBinding()] 26 | Param ( 27 | $Url, 28 | $Headers, 29 | $Command, 30 | $Payload 31 | ) 32 | 33 | Write-Debug "Invoked Command: $($Command.MyCommand)" 34 | Write-Debug "Bound Parameters: $($Command.BoundParameters.GetEnumerator() | ForEach-Object {"[" + $($_.Key) + ":" + $($_.Value) + "]"})" 35 | Write-Debug "Invoked URL: $Url" 36 | If ($Payload) { Write-Debug "Request Payload: `n$Payload" } 37 | Write-Debug "Request Headers: $($Headers.GetEnumerator() | ForEach-Object {"[" + $($_.Key) + ":" + $(If ($_.Value.length -gt 25) { $_.Value.substring(0, 25) + "...]" } Else { $($_.Value) + "]" })})" 38 | } -------------------------------------------------------------------------------- /Private/Test-LMSchedulaSchema.ps1: -------------------------------------------------------------------------------- 1 | function Test-LMScheduleSchema { 2 | [CmdletBinding()] 3 | param ( 4 | [Parameter(Mandatory)] 5 | [PSCustomObject]$Schedule 6 | ) 7 | 8 | # Required properties 9 | $requiredProps = @('notify', 'type', 'recipients', 'cron', 'timezone') 10 | 11 | # Valid schedule types 12 | $validTypes = @('manual', 'monthly', 'weekly', 'daily', 'hourly') 13 | 14 | # Validate all required properties exist 15 | foreach ($prop in $requiredProps) { 16 | if (-not $Schedule.PSObject.Properties.Name.Contains($prop)) { 17 | throw "Schedule object is missing required property: $prop" 18 | } 19 | } 20 | 21 | # Validate property types 22 | if ($Schedule.notify -isnot [bool]) { 23 | throw "notify must be a boolean value" 24 | } 25 | 26 | if ($Schedule.type -isnot [string] -or $validTypes -notcontains $Schedule.type) { 27 | throw "type must be one of: $($validTypes -join ', ')" 28 | } 29 | 30 | if ($Schedule.recipients -isnot [array]) { 31 | throw "recipients must be an array" 32 | } 33 | 34 | if ($Schedule.cron -isnot [string]) { 35 | throw "cron must be a string" 36 | } 37 | 38 | if ($Schedule.timezone -isnot [string]) { 39 | throw "timezone must be a string" 40 | } 41 | 42 | # If recipients are provided, validate they are email addresses 43 | if ($Schedule.recipients.Count -gt 0) { 44 | $emailRegex = "^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$" 45 | foreach ($recipient in $Schedule.recipients) { 46 | if ($recipient -notmatch $emailRegex) { 47 | throw "Invalid email address format: $recipient" 48 | } 49 | } 50 | } 51 | 52 | # Validate cron format based on type 53 | switch ($Schedule.type) { 54 | 'monthly' { if ($Schedule.cron -notmatch '^\d{2}\s\d{2}\s\*\s\d{1,2}\s\d{1,2}$') { throw "Invalid monthly cron format" } } 55 | 'weekly' { if ($Schedule.cron -notmatch '^\d{2}\s\d{2}\s\*\s\*\s\d{1}$') { throw "Invalid weekly cron format" } } 56 | 'daily' { if ($Schedule.cron -notmatch '^\d{2}\s\d{2}\s\*\s\*\s\*$') { throw "Invalid daily cron format" } } 57 | 'hourly' { if ($Schedule.cron -notmatch '^\d{2}\s\*\s\*\s\*\s\*$') { throw "Invalid hourly cron format" } } 58 | 'manual' { if ($Schedule.cron -ne '') { throw "Cron should be empty for manual type" } } 59 | } 60 | 61 | Write-Information "Supplied schedule, meets schema requirements." 62 | } -------------------------------------------------------------------------------- /Private/Test-LookupResult.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Function to validate output when using -Name param instead of specifying Id, ensures a valid response and only one result returned. 4 | 5 | .DESCRIPTION 6 | The Test-LookupResult function is used to validate the output when using the -Name parameter instead of specifying the Id. It ensures that a valid response is received and only one result is returned. 7 | 8 | .PARAMETER Result 9 | The Result parameter represents the output of the lookup operation. 10 | 11 | .PARAMETER LookupString 12 | The LookupString parameter represents the value used for the lookup operation. 13 | 14 | .EXAMPLE 15 | Test-LookupResult -Result $result -LookupString "example" 16 | #> 17 | 18 | Function Test-LookupResult { 19 | Param ( 20 | $Result, 21 | 22 | $LookupString 23 | ) 24 | #If mutiple resources are returned stop processing 25 | If (($Result | Measure-Object).Count -gt 1) { 26 | [Console]::ForegroundColor = 'red' 27 | [Console]::Error.WriteLine("Mutiple resources returned for the specified name value: $LookupString. Please ensure value is unique and try again") 28 | [Console]::ResetColor() 29 | return $true 30 | } 31 | #If empty stop processing since we have no Id to use 32 | Elseif (!$Result) { 33 | [Console]::ForegroundColor = 'red' 34 | [Console]::Error.WriteLine("Unable to find resource for the specified name value: $LookupString. Please check spelling and try again.") 35 | [Console]::ResetColor() 36 | return $true 37 | } 38 | return $false 39 | } -------------------------------------------------------------------------------- /Public/Copy-LMReport.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Creates a copy of a LogicMonitor report. 4 | 5 | .DESCRIPTION 6 | The Copy-LMReport function creates a new report based on an existing report's configuration. It allows you to specify a new name, description, and parent group while maintaining other settings from the source report. 7 | 8 | .PARAMETER Name 9 | The name for the new report. This parameter is mandatory. 10 | 11 | .PARAMETER Description 12 | An optional description for the new report. 13 | 14 | .PARAMETER ParentGroupId 15 | The ID of the parent group for the new report. 16 | 17 | .PARAMETER ReportObject 18 | The source report object to copy settings from. This parameter is mandatory. 19 | 20 | .EXAMPLE 21 | #Copy a report with basic settings 22 | Copy-LMReport -Name "New Report" -ReportObject $reportObject 23 | 24 | .EXAMPLE 25 | #Copy a report with all optional parameters 26 | Copy-LMReport -Name "New Report" -Description "New report description" -ParentGroupId 12345 -ReportObject $reportObject 27 | 28 | .NOTES 29 | You must run Connect-LMAccount before running this command. 30 | 31 | .INPUTS 32 | None. You cannot pipe objects to this command. 33 | 34 | .OUTPUTS 35 | Returns the newly created report object. 36 | #> 37 | Function Copy-LMReport { 38 | 39 | [CmdletBinding()] 40 | Param ( 41 | [Parameter(Mandatory)] 42 | [String]$Name, 43 | 44 | [String]$Description, 45 | 46 | [String]$ParentGroupId, 47 | 48 | [Parameter(Mandatory)] 49 | $ReportObject 50 | ) 51 | #Check if we are logged in and have valid api creds 52 | If ($Script:LMAuth.Valid) { 53 | 54 | #Replace name and description if present 55 | $ReportObject.name = $Name 56 | If ($Description) { $ReportObject.description = $Description } 57 | If ($ParentGroupId) { $ReportObject.groupId = $ParentGroupId } 58 | 59 | #Build header and uri 60 | $ResourcePath = "/report/reports" 61 | 62 | Try { 63 | $Data = ($ReportObject | ConvertTo-Json) 64 | 65 | $Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath -Data $Data 66 | $Uri = "https://$($Script:LMAuth.Portal).$(Get-LMPortalURI)" + $ResourcePath 67 | 68 | Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Data 69 | 70 | #Issue request 71 | $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data 72 | 73 | Return (Add-ObjectTypeInfo -InputObject $Response -TypeName "LogicMonitor.Report" ) 74 | } 75 | Catch [Exception] { 76 | $Proceed = Resolve-LMException -LMException $PSItem 77 | If (!$Proceed) { 78 | Return 79 | } 80 | } 81 | } 82 | Else { 83 | Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /Public/Disconnect-LMAccount.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Disconnects from a previously connected LM portal. 4 | 5 | .DESCRIPTION 6 | The Disconnect-LMAccount function clears stored API credentials for a previously connected LM portal. It's useful for switching between LM portals or clearing credentials after a script runs. 7 | 8 | .EXAMPLE 9 | #Disconnect from the current LM portal 10 | Disconnect-LMAccount 11 | 12 | .NOTES 13 | Once disconnected you will need to reconnect to a portal before you will be allowed to run commands again. 14 | 15 | .INPUTS 16 | None. You cannot pipe objects to this command. 17 | 18 | .OUTPUTS 19 | None. This command does not generate any output. 20 | 21 | 22 | #> 23 | Function Disconnect-LMAccount { 24 | #Clear credential object from environment 25 | If ($Script:LMAuth) { 26 | Write-Information "[INFO]: Successfully cleared login credentials for LM account." 27 | Remove-Variable -Name LMAuth -Scope Script -ErrorAction SilentlyContinue 28 | Remove-Variable -Name LMUserData -Scope Global -ErrorAction SilentlyContinue 29 | Remove-Variable -Name LMDeltaId -Scope Global -ErrorAction SilentlyContinue 30 | } 31 | Else { 32 | Write-Information "[INFO]: Not currently connected to any LM account." 33 | } 34 | 35 | #Reset information preference 36 | $InformationPreference = 'SilentlyContinue' 37 | } 38 | -------------------------------------------------------------------------------- /Public/Get-LMAWSAccountId.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Retrieves the AWS External Account ID associated with the LogicMonitor account. 4 | 5 | .DESCRIPTION 6 | The Get-LMAWSAccountId function retrieves the AWS External Account ID that is associated with the current LogicMonitor account. This ID is used for AWS integration purposes and helps identify the AWS account linked to your LogicMonitor instance. 7 | 8 | .EXAMPLE 9 | #Retrieve the AWS External Account ID 10 | Get-LMAWSAccountId 11 | 12 | .NOTES 13 | You must run Connect-LMAccount before running this command. 14 | 15 | .INPUTS 16 | None. You cannot pipe objects to this command. 17 | 18 | .OUTPUTS 19 | Returns a string containing the AWS Account ID. 20 | #> 21 | 22 | Function Get-LMAWSAccountId { 23 | [CmdletBinding(DefaultParameterSetName = 'All')] 24 | Param () 25 | 26 | #Check if we are logged in and have valid api creds 27 | If ($Script:LMAuth.Valid) { 28 | 29 | #Build header and uri 30 | $ResourcePath = "/aws/accountId" 31 | 32 | Try { 33 | $Headers = New-LMHeader -Auth $Script:LMAuth -Method "GET" -ResourcePath $ResourcePath 34 | $Uri = "https://$($Script:LMAuth.Portal).$(Get-LMPortalURI)" + $ResourcePath + $QueryParams 35 | 36 | Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation 37 | 38 | #Issue request 39 | $Response = Invoke-RestMethod -Uri $Uri -Method "GET" -Headers $Headers[0] -WebSession $Headers[1] 40 | Return $Response 41 | } 42 | Catch [Exception] { 43 | $Proceed = Resolve-LMException -LMException $PSItem 44 | If (!$Proceed) { 45 | Return 46 | } 47 | } 48 | } 49 | Else { 50 | Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Public/Get-LMAccountStatus.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Retrieves the current LogicMonitor account connection status. 4 | 5 | .DESCRIPTION 6 | The Get-LMAccountStatus function retrieves the current connection status of the LogicMonitor account, including portal information, authentication validity, logging status, and authentication type. 7 | 8 | .EXAMPLE 9 | #Get the current account status 10 | Get-LMAccountStatus 11 | 12 | .NOTES 13 | You must run Connect-LMAccount before running this command. 14 | 15 | .INPUTS 16 | None. You cannot pipe objects to this command. 17 | 18 | .OUTPUTS 19 | Returns a PSCustomObject with the following properties: Portal, Valid, Logging, and Type 20 | #> 21 | 22 | Function Get-LMAccountStatus { 23 | #Clear credential object from environment 24 | If ($Script:LMAuth) { 25 | $Result = [PSCustomObject]@{ 26 | Portal = $Script:LMAuth.Portal 27 | Valid = $Script:LMAuth.Valid 28 | Logging = $Script:LMAuth.Logging 29 | Type = $Script:LMAuth.Type 30 | GovCloud = $Script:LMAuth.GovCloud 31 | } 32 | return $Result 33 | } 34 | Else { 35 | return "Not currently logged into any LogicMonitor portals." 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Public/Get-LMCachedAccount.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Retrieves information about cached LogicMonitor account credentials. 4 | 5 | .DESCRIPTION 6 | The Get-LMCachedAccount function retrieves information about cached LogicMonitor account credentials stored in the Logic.Monitor vault. It can return information for a specific cached account or all cached accounts. 7 | 8 | .PARAMETER CachedAccountName 9 | The name of the specific cached account to retrieve information for. If not specified, returns information for all cached accounts. 10 | 11 | .EXAMPLE 12 | #Retrieve all cached accounts 13 | Get-LMCachedAccount 14 | 15 | .EXAMPLE 16 | #Retrieve a specific cached account 17 | Get-LMCachedAccount -CachedAccountName "MyAccount" 18 | 19 | .NOTES 20 | This function requires access to the Logic.Monitor vault where credentials are stored. 21 | 22 | .INPUTS 23 | None. You cannot pipe objects to this command. 24 | 25 | .OUTPUTS 26 | Returns an array of custom objects containing cached account information including CachedAccountName, Portal, Id, Modified date, and Type. 27 | 28 | .LINK 29 | Get-SecretInfo 30 | 31 | #> 32 | 33 | Function Get-LMCachedAccount { 34 | [CmdletBinding()] 35 | Param ( 36 | [String]$CachedAccountName 37 | ) 38 | If ($CachedAccountName) { 39 | $CachedAccountSecrets = Get-SecretInfo -Vault Logic.Monitor -Name $CachedAccountName 40 | } 41 | Else { 42 | $CachedAccountSecrets = Get-SecretInfo -Vault Logic.Monitor 43 | } 44 | $CachedAccounts = @() 45 | Foreach ($Secret in $CachedAccountSecrets) { 46 | $CachedAccounts += [PSCustomObject]@{ 47 | CachedAccountName = $Secret.Name 48 | Portal = $Secret.Metadata["Portal"] 49 | Id = If (!$Secret.Metadata["Id"]) { "N/A" }Else { $Secret.Metadata["Id"] } 50 | Modified = $Secret.Metadata["Modified"] 51 | Type = If (!$Secret.Metadata["Type"]) { "LMv1" }Else { $Secret.Metadata["Type"] } 52 | } 53 | } 54 | Return $CachedAccounts 55 | 56 | } -------------------------------------------------------------------------------- /Public/Get-LMLogPartitionRetention.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Retrieves LM Log Partition Retentions from LogicMonitor. 4 | 5 | .DESCRIPTION 6 | The Get-LMLogPartitionRetention function retrieves LM Log Partition Retentions from LogicMonitor. It can retrieve all log partition retentions available to the account. 7 | 8 | .EXAMPLE 9 | #Retrieve all log partition retentions 10 | Get-LMLogPartitionRetention 11 | 12 | .NOTES 13 | You must run Connect-LMAccount before running this command. 14 | 15 | .INPUTS 16 | None. You cannot pipe objects to this command. 17 | 18 | .OUTPUTS 19 | Returns LogicMonitor.LogPartitionRetention objects. 20 | #> 21 | 22 | Function Get-LMLogPartitionRetention { 23 | 24 | [CmdletBinding(DefaultParameterSetName = 'All')] 25 | Param () 26 | #Check if we are logged in and have valid api creds 27 | If ($Script:LMAuth.Valid) { 28 | 29 | #Build header and uri 30 | $ResourcePath = "/log/partitions/retentions" 31 | 32 | #Initalize vars 33 | $Count = 0 34 | $Done = $false 35 | $Results = @() 36 | 37 | #Loop through requests 38 | While (!$Done) { 39 | Try { 40 | $Headers = New-LMHeader -Auth $Script:LMAuth -Method "GET" -ResourcePath $ResourcePath 41 | $Uri = "https://$($Script:LMAuth.Portal).$(Get-LMPortalURI)" + $ResourcePath + $QueryParams 42 | 43 | Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation 44 | 45 | #Issue request 46 | $Response = Invoke-RestMethod -Uri $Uri -Method "GET" -Headers $Headers[0] -WebSession $Headers[1] 47 | 48 | #Stop looping if single device, no need to continue 49 | If ($PSCmdlet.ParameterSetName -eq "Id") { 50 | $Done = $true 51 | Return (Add-ObjectTypeInfo -InputObject $Response -TypeName "LogicMonitor.LogPartitionRetention" ) 52 | } 53 | #Check result size and if needed loop again 54 | Else { 55 | [Int]$Total = $Response.Total 56 | [Int]$Count += ($Response.Items | Measure-Object).Count 57 | $Results += $Response.Items 58 | If ($Count -ge $Total) { 59 | $Done = $true 60 | } 61 | } 62 | } 63 | Catch [Exception] { 64 | $Proceed = Resolve-LMException -LMException $PSItem 65 | If (!$Proceed) { 66 | Return 67 | } 68 | } 69 | } 70 | Return (Add-ObjectTypeInfo -InputObject $Results -TypeName "LogicMonitor.LogPartitionRetention" ) 71 | } 72 | Else { 73 | Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /Public/Get-LMPortalInfo.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Retrieves portal information from LogicMonitor. 4 | 5 | .DESCRIPTION 6 | The Get-LMPortalInfo function retrieves company settings and portal information from your LogicMonitor instance. 7 | 8 | .PARAMETER None 9 | This cmdlet has no parameters. 10 | 11 | .EXAMPLE 12 | #Retrieve portal information 13 | Get-LMPortalInfo 14 | 15 | .NOTES 16 | You must run Connect-LMAccount before running this command. 17 | 18 | .INPUTS 19 | None. You cannot pipe objects to this command. 20 | 21 | .OUTPUTS 22 | Returns portal information object containing company settings. 23 | #> 24 | Function Get-LMPortalInfo { 25 | [CmdletBinding()] 26 | Param () 27 | #Check if we are logged in and have valid api creds 28 | If ($Script:LMAuth.Valid) { 29 | 30 | #Build header and uri 31 | $ResourcePath = "/setting/companySetting" 32 | 33 | Try { 34 | $Headers = New-LMHeader -Auth $Script:LMAuth -Method "GET" -ResourcePath $ResourcePath 35 | $Uri = "https://$($Script:LMAuth.Portal).$(Get-LMPortalURI)" + $ResourcePath 36 | 37 | 38 | 39 | Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation 40 | 41 | #Issue request 42 | $Response = Invoke-RestMethod -Uri $Uri -Method "GET" -Headers $Headers[0] -WebSession $Headers[1] 43 | } 44 | Catch [Exception] { 45 | $Proceed = Resolve-LMException -LMException $PSItem 46 | If (!$Proceed) { 47 | Return 48 | } 49 | } 50 | Return $Response 51 | } 52 | Else { 53 | Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Public/Get-LMRepositoryLogicModules.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Retrieves LogicModules from the LogicMonitor repository. 4 | 5 | .DESCRIPTION 6 | The Get-LMRepositoryLogicModules function retrieves LogicModules from the LogicMonitor repository. It supports retrieving different types of modules including datasources, property rules, event sources, topology sources, and config sources. 7 | 8 | .PARAMETER Type 9 | The type of LogicModule to retrieve. Valid values are "datasource", "propertyrules", "eventsource", "topologysource", "configsource". Defaults to "datasource". 10 | 11 | .EXAMPLE 12 | #Retrieve all datasource modules 13 | Get-LMRepositoryLogicModules 14 | 15 | .EXAMPLE 16 | #Retrieve all event source modules 17 | Get-LMRepositoryLogicModules -Type "eventsource" 18 | 19 | .NOTES 20 | You must run Connect-LMAccount before running this command. 21 | 22 | .INPUTS 23 | None. You cannot pipe objects to this command. 24 | 25 | .OUTPUTS 26 | Returns LogicMonitor.RepositoryLogicModules objects. 27 | #> 28 | 29 | Function Get-LMRepositoryLogicModules { 30 | 31 | [CmdletBinding()] 32 | Param ( 33 | [ValidateSet("datasource", "propertyrules", "eventsource", "topologysource", "configsource")] 34 | [String]$Type = "datasource" 35 | 36 | ) 37 | #Check if we are logged in and have valid api creds 38 | If ($Script:LMAuth.Valid) { 39 | 40 | #Build header and uri 41 | $ResourcePath = "/setting/logicmodules/listcore" 42 | 43 | #Initalize vars 44 | $QueryParams = "?type=$Type" 45 | $Results = @() 46 | 47 | $Data = @{ 48 | coreServer = "core.logicmonitor.com" 49 | password = "logicmonitor" 50 | username = "anonymouse" 51 | } 52 | 53 | $Data = ($Data | ConvertTo-Json) 54 | 55 | Try { 56 | $Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath -Data $Data 57 | $Uri = "https://$($Script:LMAuth.Portal).$(Get-LMPortalURI)" + $ResourcePath + $QueryParams 58 | 59 | 60 | 61 | Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation 62 | 63 | #Issue request 64 | $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data 65 | $Results = $Response.Items 66 | } 67 | Catch [Exception] { 68 | $Proceed = Resolve-LMException -LMException $PSItem 69 | If (!$Proceed) { 70 | Return 71 | } 72 | } 73 | Return (Add-ObjectTypeInfo -InputObject $Results -TypeName "LogicMonitor.RepositoryLogicModules" ) 74 | } 75 | Else { 76 | Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /Public/Get-LMTopologyMapData.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Retrieves data for a specific topology map from LogicMonitor. 4 | 5 | .DESCRIPTION 6 | The Get-LMTopologyMapData function retrieves the vertex and edge data for a specified topology map in LogicMonitor. The map can be identified by either ID or name. 7 | 8 | .PARAMETER Id 9 | The ID of the topology map to retrieve data from. Required for Id parameter set. 10 | 11 | .PARAMETER Name 12 | The name of the topology map to retrieve data from. Required for Name parameter set. 13 | 14 | .EXAMPLE 15 | #Retrieve topology map data by ID 16 | Get-LMTopologyMapData -Id 123 17 | 18 | .EXAMPLE 19 | #Retrieve topology map data by name 20 | Get-LMTopologyMapData -Name "Network-Topology" 21 | 22 | .NOTES 23 | You must run Connect-LMAccount before running this command. 24 | 25 | .INPUTS 26 | None. You cannot pipe objects to this command. 27 | 28 | .OUTPUTS 29 | Returns LogicMonitor.TopologyMapData objects. 30 | #> 31 | 32 | Function Get-LMTopologyMapData { 33 | 34 | [CmdletBinding()] 35 | Param ( 36 | [Parameter(Mandatory, ParameterSetName = 'Id')] 37 | [Int]$Id, 38 | 39 | [Parameter(Mandatory, ParameterSetName = 'Name')] 40 | [String]$Name 41 | ) 42 | #Check if we are logged in and have valid api creds 43 | If ($Script:LMAuth.Valid) { 44 | 45 | #Lookup Id if supplying name 46 | If ($Name) { 47 | $LookupResult = (Get-LMTopologyMap -Name $Name).Id 48 | If (Test-LookupResult -Result $LookupResult -LookupString $Name) { 49 | return 50 | } 51 | $Id = $LookupResult 52 | } 53 | 54 | #Build header and uri 55 | $ResourcePath = "/topology/topologies/$Id/data" 56 | 57 | #Loop through requests 58 | Try { 59 | $Headers = New-LMHeader -Auth $Script:LMAuth -Method "GET" -ResourcePath $ResourcePath 60 | $Uri = "https://$($Script:LMAuth.Portal).$(Get-LMPortalURI)" + $ResourcePath + $QueryParams 61 | 62 | 63 | 64 | Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation 65 | 66 | #Issue request 67 | $Response = Invoke-RestMethod -Uri $Uri -Method "GET" -Headers $Headers[0] -WebSession $Headers[1] 68 | 69 | Return (Add-ObjectTypeInfo -InputObject $Response.vertices -TypeName "LogicMonitor.TopologyMapData" ) 70 | } 71 | Catch [Exception] { 72 | $Proceed = Resolve-LMException -LMException $PSItem 73 | If (!$Proceed) { 74 | Return 75 | } 76 | } 77 | } 78 | Else { 79 | Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /Public/Get-LMUsageMetrics.ps1: -------------------------------------------------------------------------------- 1 | Function Get-LMUsageMetrics { 2 | 3 | [CmdletBinding(DefaultParameterSetName = 'All')] 4 | Param () 5 | #Check if we are logged in and have valid api creds 6 | If ($Script:LMAuth.Valid) { 7 | 8 | #Build header and uri 9 | $ResourcePath = "/metrics/usage" 10 | 11 | Try { 12 | $Headers = New-LMHeader -Auth $Script:LMAuth -Method "GET" -ResourcePath $ResourcePath 13 | $Uri = "https://$($Script:LMAuth.Portal).$(Get-LMPortalURI)" + $ResourcePath + $QueryParams 14 | 15 | 16 | 17 | Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation 18 | 19 | #Issue request 20 | $Response = Invoke-RestMethod -Uri $Uri -Method "GET" -Headers $Headers[0] -WebSession $Headers[1] 21 | 22 | Return $Response 23 | } 24 | Catch [Exception] { 25 | $Proceed = Resolve-LMException -LMException $PSItem 26 | If (!$Proceed) { 27 | Return 28 | } 29 | } 30 | } 31 | Else { 32 | Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Public/Import-LMExchangeModule.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Imports an LM Exchange module into LogicMonitor. 4 | 5 | .DESCRIPTION 6 | The Import-LMExchangeModule function imports a specified LM Exchange module into your LogicMonitor portal. 7 | 8 | .PARAMETER LMExchangeId 9 | The ID of the LM Exchange module to import. This parameter is mandatory. 10 | 11 | .EXAMPLE 12 | #Import an LM Exchange module 13 | Import-LMExchangeModule -LMExchangeId "LM12345" 14 | 15 | .NOTES 16 | You must run Connect-LMAccount before running this command. 17 | 18 | .INPUTS 19 | None. You cannot pipe objects to this command. 20 | 21 | .OUTPUTS 22 | Returns a success message if the import is successful. 23 | #> 24 | Function Import-LMExchangeModule { 25 | [CmdletBinding()] 26 | Param ( 27 | [Parameter(Mandatory)] 28 | [String]$LMExchangeId 29 | ) 30 | 31 | #Check if we are logged in and have valid api creds 32 | Begin {} 33 | Process { 34 | If ($Script:LMAuth.Valid) { 35 | 36 | #Build header and uri 37 | $ResourcePath = "/exchange/integrations/import" 38 | 39 | #Construct payload 40 | $Data = @{items = @() } 41 | $Data.items += [PSCustomObject]@{ 42 | id = $LMExchangeId 43 | } 44 | 45 | $Data = ($Data | ConvertTo-Json) 46 | 47 | Try { 48 | 49 | $Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath -Data $Data 50 | $Uri = "https://$($Script:LMAuth.Portal).$(Get-LMPortalURI)" + $ResourcePath 51 | 52 | Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Data 53 | 54 | #Issue request 55 | $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data 56 | 57 | Return "Successfully imported LM Exchange module id: $LMExchangeId" 58 | 59 | } 60 | Catch [Exception] { 61 | $Proceed = Resolve-LMException -LMException $PSItem 62 | If (!$Proceed) { 63 | Return 64 | } 65 | } 66 | } 67 | Else { 68 | Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." 69 | } 70 | } 71 | End {} 72 | } -------------------------------------------------------------------------------- /Public/Import-LMRepositoryLogicModules.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Imports LogicMonitor repository logic modules. 4 | 5 | .DESCRIPTION 6 | The Import-LMRepositoryLogicModules function imports specified logic modules from the LogicMonitor repository into your portal. 7 | 8 | .PARAMETER Type 9 | The type of logic modules to import. Valid values are "datasources", "propertyrules", "eventsources", "topologysources", "configsources". 10 | 11 | .PARAMETER LogicModuleNames 12 | An array of logic module names to import. 13 | 14 | .EXAMPLE 15 | #Import specific datasources 16 | Import-LMRepositoryLogicModules -Type "datasources" -LogicModuleNames "DataSource1", "DataSource2" 17 | 18 | .NOTES 19 | You must run Connect-LMAccount before running this command. 20 | 21 | .INPUTS 22 | None. You cannot pipe objects to this command. 23 | 24 | .OUTPUTS 25 | Returns a success message with the names of imported modules. 26 | #> 27 | 28 | Function Import-LMRepositoryLogicModules { 29 | 30 | [CmdletBinding()] 31 | Param ( 32 | [Parameter(Mandatory)] 33 | [ValidateSet("datasources", "propertyrules", "eventsources", "topologysources", "configsources")] 34 | [String]$Type, 35 | 36 | [Parameter(Mandatory, ValueFromPipelineByPropertyName)] 37 | [Alias('Name')] 38 | [String[]]$LogicModuleNames 39 | 40 | ) 41 | Begin {} 42 | Process { 43 | #Check if we are logged in and have valid api creds 44 | If ($Script:LMAuth.Valid) { 45 | 46 | #Build header and uri 47 | $ResourcePath = "/setting/$Type/importcore" 48 | 49 | #Initalize vars 50 | $Results = @() 51 | 52 | $Data = @{ 53 | importDataSources = $LogicModuleNames 54 | coreserver = "core.logicmonitor.com" 55 | password = "logicmonitor" 56 | username = "anonymouse" 57 | } 58 | 59 | $Data = ($Data | ConvertTo-Json) 60 | 61 | Try { 62 | $Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath -Data $Data 63 | $Uri = "https://$($Script:LMAuth.Portal).$(Get-LMPortalURI)" + $ResourcePath 64 | 65 | Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Data 66 | 67 | #Issue request 68 | $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data 69 | 70 | Return "Modules imported successfully: $LogicModuleNames" 71 | } 72 | Catch [Exception] { 73 | $Proceed = Resolve-LMException -LMException $PSItem 74 | If (!$Proceed) { 75 | Return 76 | } 77 | } 78 | Return 79 | } 80 | Else { 81 | Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." 82 | } 83 | } 84 | End {} 85 | } 86 | -------------------------------------------------------------------------------- /Public/Invoke-LMAzureSubscriptionDiscovery.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Discovers Azure subscriptions for a given tenant. 4 | 5 | .DESCRIPTION 6 | The Invoke-LMAzureSubscriptionDiscovery function discovers available Azure subscriptions for a specified Azure tenant using provided credentials. 7 | 8 | .PARAMETER ClientId 9 | The Azure Active Directory application client ID. 10 | 11 | .PARAMETER SecretKey 12 | The Azure Active Directory application secret key. 13 | 14 | .PARAMETER TenantId 15 | The Azure Active Directory tenant ID. 16 | 17 | .PARAMETER IsChinaAccount 18 | Indicates if this is an Azure China account. Defaults to $false. 19 | 20 | .EXAMPLE 21 | #Discover Azure subscriptions 22 | Invoke-LMAzureSubscriptionDiscovery -ClientId "client-id" -SecretKey "secret-key" -TenantId "tenant-id" 23 | 24 | .NOTES 25 | You must run Connect-LMAccount before running this command. 26 | 27 | .INPUTS 28 | None. You cannot pipe objects to this command. 29 | 30 | .OUTPUTS 31 | Returns a list of discovered Azure subscriptions. 32 | #> 33 | Function Invoke-LMAzureSubscriptionDiscovery { 34 | 35 | [CmdletBinding()] 36 | Param ( 37 | [Parameter(Mandatory)] 38 | [String]$ClientId, 39 | 40 | [Parameter(Mandatory)] 41 | [String]$SecretKey, 42 | 43 | [Parameter(Mandatory)] 44 | [String]$TenantId, 45 | 46 | [String]$IsChinaAccount = $false 47 | 48 | ) 49 | #Check if we are logged in and have valid api creds 50 | If ($Script:LMAuth.Valid) { 51 | 52 | #Build header and uri 53 | $ResourcePath = "/azure/functions/discoverSubscriptions" 54 | 55 | #Loop through requests 56 | $Done = $false 57 | While (!$Done) { 58 | Try { 59 | $Data = @{ 60 | clientId = $ClientId 61 | secretKey = $SecretKey 62 | tenantId = $TenantId 63 | isChinaAccount = $IsChinaAccount 64 | 65 | } 66 | 67 | #Remove empty keys so we dont overwrite them 68 | @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } 69 | 70 | $Data = ($Data | ConvertTo-Json) 71 | 72 | $Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath -Data $Data 73 | $Uri = "https://$($Script:LMAuth.Portal).$(Get-LMPortalURI)" + $ResourcePath 74 | 75 | Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Data 76 | 77 | #Issue request 78 | $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data 79 | 80 | Return $Response.items 81 | } 82 | Catch [Exception] { 83 | $Proceed = Resolve-LMException -LMException $PSItem 84 | If (!$Proceed) { 85 | Return 86 | } 87 | } 88 | } 89 | } 90 | Else { 91 | Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." 92 | } 93 | } -------------------------------------------------------------------------------- /Public/Invoke-LMNetScan.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Invokes a NetScan task in LogicMonitor. 4 | 5 | .DESCRIPTION 6 | The Invoke-LMNetScan function schedules execution of a specified NetScan task in LogicMonitor. 7 | 8 | .PARAMETER Id 9 | The ID of the NetScan to execute. 10 | 11 | .EXAMPLE 12 | #Execute a NetScan 13 | Invoke-LMNetScan -Id "12345" 14 | 15 | .NOTES 16 | You must run Connect-LMAccount before running this command. 17 | 18 | .INPUTS 19 | None. You cannot pipe objects to this command. 20 | 21 | .OUTPUTS 22 | Returns a success message if the NetScan is scheduled successfully. 23 | #> 24 | 25 | Function Invoke-LMNetScan { 26 | 27 | [CmdletBinding()] 28 | Param ( 29 | [Parameter(Mandatory)] 30 | [String]$Id 31 | ) 32 | #Check if we are logged in and have valid api creds 33 | Begin {} 34 | Process { 35 | If ($Script:LMAuth.Valid) { 36 | 37 | #Build header and uri 38 | $ResourcePath = "/setting/netscans/$id/executenow" 39 | 40 | Try { 41 | 42 | $Headers = New-LMHeader -Auth $Script:LMAuth -Method "GET" -ResourcePath $ResourcePath 43 | $Uri = "https://$($Script:LMAuth.Portal).$(Get-LMPortalURI)" + $ResourcePath 44 | 45 | Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation 46 | 47 | #Issue request 48 | $Response = Invoke-RestMethod -Uri $Uri -Method "GET" -Headers $Headers[0] -WebSession $Headers[1] 49 | 50 | Return "Scheduled NetScan task for NetScan id: $Id." 51 | } 52 | Catch [Exception] { 53 | $Proceed = Resolve-LMException -LMException $PSItem 54 | If (!$Proceed) { 55 | Return 56 | } 57 | } 58 | } 59 | Else { 60 | Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." 61 | } 62 | } 63 | End {} 64 | } 65 | -------------------------------------------------------------------------------- /Public/Invoke-LMUserLogoff.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Forces user logoff in LogicMonitor. 4 | 5 | .DESCRIPTION 6 | The Invoke-LMUserLogoff function forces one or more users to be logged out of their LogicMonitor sessions. 7 | 8 | .PARAMETER Usernames 9 | An array of usernames to log off. 10 | 11 | .EXAMPLE 12 | #Log off multiple users 13 | Invoke-LMUserLogoff -Usernames "user1", "user2" 14 | 15 | .NOTES 16 | You must run Connect-LMAccount before running this command. 17 | 18 | .INPUTS 19 | None. You cannot pipe objects to this command. 20 | 21 | .OUTPUTS 22 | Returns a success message if the logoff is completed successfully. 23 | #> 24 | Function Invoke-LMUserLogoff { 25 | 26 | [CmdletBinding()] 27 | Param ( 28 | [Parameter(Mandatory)] 29 | [String[]]$Usernames 30 | ) 31 | #Check if we are logged in and have valid api creds 32 | Begin {} 33 | Process { 34 | If ($Script:LMAuth.Valid) { 35 | 36 | #Build header and uri 37 | $ResourcePath = "/setting/admins/services/logoffUsers" 38 | 39 | $Data = @{ 40 | userNames = $Usernames 41 | } 42 | 43 | $Data = ($Data | ConvertTo-Json) 44 | 45 | Try { 46 | 47 | $Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath -Data $Data 48 | $Uri = "https://$($Script:LMAuth.Portal).$(Get-LMPortalURI)" + $ResourcePath 49 | 50 | Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Data 51 | 52 | #Issue request 53 | $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data 54 | 55 | Return "Invoke session logoff for username(s): $($Usernames -Join ",")." 56 | } 57 | Catch [Exception] { 58 | $Proceed = Resolve-LMException -LMException $PSItem 59 | If (!$Proceed) { 60 | Return 61 | } 62 | } 63 | } 64 | Else { 65 | Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." 66 | } 67 | } 68 | End {} 69 | } 70 | -------------------------------------------------------------------------------- /Public/New-LMAccessGroup.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Creates a new LogicMonitor access group. 4 | 5 | .DESCRIPTION 6 | The New-LMAccessGroup function creates a new access group in LogicMonitor. Access groups control user permissions and access rights for managing modules in the LM exchange and module toolbox. 7 | 8 | .PARAMETER Name 9 | The name of the access group. This parameter is mandatory. 10 | 11 | .PARAMETER Description 12 | The description of the access group. 13 | 14 | .PARAMETER Tenant 15 | The ID of the tenant to which the access group belongs. 16 | 17 | .EXAMPLE 18 | #Create a new access group 19 | New-LMAccessGroup -Name "Group1" -Description "Access group for administrators" -Tenant "12345" 20 | 21 | .NOTES 22 | You must run Connect-LMAccount before running this command. 23 | 24 | .INPUTS 25 | None. You cannot pipe objects to this command. 26 | 27 | .OUTPUTS 28 | Returns LogicMonitor.AccessGroup object. 29 | #> 30 | Function New-LMAccessGroup { 31 | 32 | [CmdletBinding()] 33 | Param ( 34 | 35 | [Parameter(Mandatory)] 36 | [String]$Name, 37 | 38 | [String]$Description, 39 | 40 | [String]$Tenant 41 | 42 | ) 43 | #Check if we are logged in and have valid api creds 44 | Begin {} 45 | Process { 46 | If ($Script:LMAuth.Valid) { 47 | 48 | #Build header and uri 49 | $ResourcePath = "/setting/accessgroup/add" 50 | 51 | Try { 52 | $Data = @{ 53 | description = $Description 54 | name = $Name 55 | tenantId = $Tenant 56 | } 57 | 58 | #Remove empty keys so we dont overwrite them 59 | @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } 60 | 61 | $Data = ($Data | ConvertTo-Json) 62 | $Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath -Data $Data 63 | $Uri = "https://$($Script:LMAuth.Portal).$(Get-LMPortalURI)" + $ResourcePath 64 | 65 | Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Data 66 | 67 | #Issue request 68 | $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data 69 | 70 | Return (Add-ObjectTypeInfo -InputObject $Response -TypeName "LogicMonitor.AccessGroup" ) 71 | } 72 | Catch [Exception] { 73 | $Proceed = Resolve-LMException -LMException $PSItem 74 | If (!$Proceed) { 75 | Return 76 | } 77 | } 78 | } 79 | Else { 80 | Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." 81 | } 82 | } 83 | End {} 84 | } 85 | -------------------------------------------------------------------------------- /Public/New-LMAlertAck.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Creates a new alert acknowledgment in LogicMonitor. 4 | 5 | .DESCRIPTION 6 | The New-LMAlertAck function acknowledges one or more alerts in LogicMonitor and adds a note to the acknowledgment. 7 | 8 | .PARAMETER Ids 9 | The alert IDs to be acknowledged. This parameter is mandatory. 10 | 11 | .PARAMETER Note 12 | The note to be added to the acknowledgment. This parameter is mandatory. 13 | 14 | .EXAMPLE 15 | #Acknowledge multiple alerts 16 | New-LMAlertAck -Ids @("12345","67890") -Note "Acknowledging alerts" 17 | 18 | .NOTES 19 | You must run Connect-LMAccount before running this command. 20 | 21 | .INPUTS 22 | None. You cannot pipe objects to this command. 23 | 24 | .OUTPUTS 25 | Returns a success message if the acknowledgment is created successfully. 26 | #> 27 | Function New-LMAlertAck { 28 | [CmdletBinding()] 29 | Param ( 30 | [Parameter(Mandatory, ValueFromPipelineByPropertyName)] 31 | [Alias("Id")] 32 | [String[]]$Ids, 33 | [Parameter(Mandatory)] 34 | [String]$Note 35 | ) 36 | Begin {} 37 | Process { 38 | #Check if we are logged in and have valid api creds 39 | If ($Script:LMAuth.Valid) { 40 | 41 | #Build header and uri 42 | $ResourcePath = "/alert/alerts/ack" 43 | 44 | Try { 45 | 46 | $Data = @{ 47 | alertIds = $Ids 48 | ackComment = $Note 49 | } 50 | 51 | $Data = ($Data | ConvertTo-Json) 52 | 53 | $Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath -Data $Data 54 | $Uri = "https://$($Script:LMAuth.Portal).$(Get-LMPortalURI)" + $ResourcePath 55 | 56 | Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Data 57 | 58 | #Issue request 59 | $Response = Invoke-WebRequest -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data 60 | 61 | If ($Response.StatusCode -eq 200) { 62 | Return "Successfully acknowledged alert id(s): $Ids" 63 | } 64 | } 65 | Catch [Exception] { 66 | $Proceed = Resolve-LMException -LMException $PSItem 67 | If (!$Proceed) { 68 | Return 69 | } 70 | } 71 | } 72 | Else { 73 | Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." 74 | } 75 | } 76 | End {} 77 | } 78 | -------------------------------------------------------------------------------- /Public/New-LMAlertEscalation.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Creates a new escalation for a LogicMonitor alert. 4 | 5 | .DESCRIPTION 6 | The New-LMAlertEscalation function creates a new escalation for a specified alert in LogicMonitor. 7 | 8 | .PARAMETER Id 9 | The ID of the alert to escalate. This parameter is mandatory. 10 | 11 | .EXAMPLE 12 | #Escalate an alert 13 | New-LMAlertEscalation -Id "DS12345" 14 | 15 | .NOTES 16 | You must run Connect-LMAccount before running this command. 17 | 18 | .INPUTS 19 | None. You cannot pipe objects to this command. 20 | 21 | .OUTPUTS 22 | Returns a success message if the escalation is created successfully. 23 | #> 24 | 25 | Function New-LMAlertEscalation { 26 | [CmdletBinding()] 27 | Param ( 28 | [Parameter(Mandatory, ValueFromPipelineByPropertyName)] 29 | [String]$Id 30 | ) 31 | Begin {} 32 | Process { 33 | #Check if we are logged in and have valid api creds 34 | If ($Script:LMAuth.Valid) { 35 | 36 | #Build header and uri 37 | $ResourcePath = "/alert/alerts/$Id/escalate" 38 | 39 | Try { 40 | 41 | $Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath 42 | $Uri = "https://$($Script:LMAuth.Portal).$(Get-LMPortalURI)" + $ResourcePath 43 | 44 | Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation 45 | 46 | #Issue request 47 | $Response = Invoke-WebRequest -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] 48 | 49 | If ($Response.StatusCode -eq 200) { 50 | Return "Successfully escalated alert id: $Id" 51 | } 52 | } 53 | Catch [Exception] { 54 | $Proceed = Resolve-LMException -LMException $PSItem 55 | If (!$Proceed) { 56 | Return 57 | } 58 | } 59 | } 60 | Else { 61 | Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." 62 | } 63 | } 64 | End {} 65 | } 66 | -------------------------------------------------------------------------------- /Public/New-LMAlertNote.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Creates a new note for LogicMonitor alerts. 4 | 5 | .DESCRIPTION 6 | The New-LMAlertNote function adds a note to one or more alerts in LogicMonitor. 7 | 8 | .PARAMETER Ids 9 | The alert IDs to add the note to. This parameter is mandatory. 10 | 11 | .PARAMETER Note 12 | The content of the note to add. This parameter is mandatory. 13 | 14 | .EXAMPLE 15 | #Add a note to multiple alerts 16 | New-LMAlertNote -Ids @("12345","67890") -Note "This is a sample note" 17 | 18 | .NOTES 19 | You must run Connect-LMAccount before running this command. 20 | 21 | .INPUTS 22 | None. You cannot pipe objects to this command. 23 | 24 | .OUTPUTS 25 | Returns a success message if the note is created successfully. 26 | #> 27 | Function New-LMAlertNote { 28 | 29 | [CmdletBinding()] 30 | Param ( 31 | [Parameter(Mandatory, ValueFromPipelineByPropertyName)] 32 | [Alias("Id")] 33 | [String[]]$Ids, 34 | [Parameter(Mandatory)] 35 | [String]$Note 36 | ) 37 | Begin {} 38 | Process { 39 | #Check if we are logged in and have valid api creds 40 | If ($Script:LMAuth.Valid) { 41 | 42 | #Build header and uri 43 | $ResourcePath = "/alert/alerts/note" 44 | 45 | Try { 46 | 47 | $Data = @{ 48 | alertIds = $Ids 49 | note = $Note 50 | } 51 | 52 | $Data = ($Data | ConvertTo-Json) 53 | 54 | $Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath -Data $Data 55 | $Uri = "https://$($Script:LMAuth.Portal).$(Get-LMPortalURI)" + $ResourcePath 56 | 57 | Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Data 58 | 59 | #Issue request 60 | $Response = Invoke-WebRequest -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data 61 | 62 | If ($Response.StatusCode -eq 200) { 63 | Return "Successfully updated note for alert id(s): $Ids" 64 | } 65 | } 66 | Catch [Exception] { 67 | $Proceed = Resolve-LMException -LMException $PSItem 68 | If (!$Proceed) { 69 | Return 70 | } 71 | } 72 | } 73 | Else { 74 | Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." 75 | } 76 | } 77 | End {} 78 | } 79 | -------------------------------------------------------------------------------- /Public/New-LMAppliesToFunction.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Creates a new LogicMonitor Applies To function. 4 | 5 | .DESCRIPTION 6 | The New-LMAppliesToFunction function creates a new Applies To function that can be used in LogicMonitor for targeting resources. 7 | 8 | .PARAMETER Name 9 | The name of the function. This parameter is mandatory. 10 | 11 | .PARAMETER Description 12 | A description of the function's purpose. 13 | 14 | .PARAMETER AppliesTo 15 | The function code that defines the targeting logic. This parameter is mandatory. 16 | 17 | .EXAMPLE 18 | #Create a new Applies To function 19 | New-LMAppliesToFunction -Name "WindowsServers" -AppliesTo "isWindows() && hasCategory('server')" -Description "Targets Windows servers" 20 | 21 | .NOTES 22 | You must run Connect-LMAccount before running this command. 23 | 24 | .INPUTS 25 | None. You cannot pipe objects to this command. 26 | 27 | .OUTPUTS 28 | Returns the created function object. 29 | #> 30 | Function New-LMAppliesToFunction { 31 | 32 | [CmdletBinding()] 33 | Param ( 34 | [Parameter(Mandatory)] 35 | [String]$Name, 36 | 37 | [String]$Description, 38 | 39 | [Parameter(Mandatory)] 40 | [String]$AppliesTo 41 | 42 | ) 43 | #Check if we are logged in and have valid api creds 44 | If ($Script:LMAuth.Valid) { 45 | 46 | 47 | #Build header and uri 48 | $ResourcePath = "/setting/functions" 49 | 50 | Try { 51 | $Data = @{ 52 | name = $Name 53 | description = $Description 54 | code = $AppliesTo 55 | } 56 | 57 | $Data = ($Data | ConvertTo-Json) 58 | 59 | $Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath -Data $Data 60 | $Uri = "https://$($Script:LMAuth.Portal).$(Get-LMPortalURI)" + $ResourcePath 61 | 62 | Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Data 63 | 64 | #Issue request 65 | $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data 66 | 67 | Return $Response 68 | } 69 | Catch [Exception] { 70 | $Proceed = Resolve-LMException -LMException $PSItem 71 | If (!$Proceed) { 72 | Return 73 | } 74 | } 75 | } 76 | Else { 77 | Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /Public/New-LMDatasource.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Creates a new LogicMonitor datasource. 4 | 5 | .DESCRIPTION 6 | The New-LMDatasource function creates a new datasource in LogicMonitor using a provided datasource configuration object. 7 | 8 | .PARAMETER Datasource 9 | A PSCustomObject containing the datasource configuration. Must follow the schema model defined in LogicMonitor's API documentation. 10 | 11 | .EXAMPLE 12 | #Create a new datasource 13 | $config = @{ 14 | name = "MyDatasource" 15 | # Additional configuration properties 16 | } 17 | New-LMDatasource -Datasource $config 18 | 19 | .NOTES 20 | You must run Connect-LMAccount before running this command. 21 | For datasource schema details, see: https://www.logicmonitor.com/swagger-ui-master/api-v3/dist/#/Datasources/addDatasourceById 22 | 23 | .INPUTS 24 | None. You cannot pipe objects to this command. 25 | 26 | .OUTPUTS 27 | Returns LogicMonitor.Datasource object. 28 | #> 29 | 30 | Function New-LMDatasource { 31 | 32 | [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'None')] 33 | Param ( 34 | [Parameter(Mandatory)] 35 | [PSCustomObject]$Datasource #follow the schema model listed here: https://www.logicmonitor.com/swagger-ui-master/api-v3/dist/#/Datasources/addDatasourceById 36 | ) 37 | #Check if we are logged in and have valid api creds 38 | Begin {} 39 | Process { 40 | If ($Script:LMAuth.Valid) { 41 | 42 | #Build header and uri 43 | $ResourcePath = "/setting/datasources" 44 | 45 | $Message = "LogicModule Name: $($Datasource.name)" 46 | 47 | Try { 48 | $Data = $Datasource 49 | 50 | $Data = ($Data | ConvertTo-Json -Depth 10) 51 | 52 | If ($PSCmdlet.ShouldProcess($Message, "New Datasource")) { 53 | $Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath -Data $Data 54 | $Uri = "https://$($Script:LMAuth.Portal).$(Get-LMPortalURI)" + $ResourcePath 55 | 56 | Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Data 57 | 58 | #Issue request 59 | $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data 60 | 61 | Return (Add-ObjectTypeInfo -InputObject $Response -TypeName "LogicMonitor.Datasource" ) 62 | } 63 | } 64 | Catch [Exception] { 65 | $Proceed = Resolve-LMException -LMException $PSItem 66 | If (!$Proceed) { 67 | Return 68 | } 69 | } 70 | } 71 | Else { 72 | Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." 73 | } 74 | } 75 | End {} 76 | } 77 | -------------------------------------------------------------------------------- /Public/New-LMDatasourceGraph.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Creates a new datasource graph in LogicMonitor. 4 | 5 | .DESCRIPTION 6 | The New-LMDatasourceGraph function creates a new graph for a specified datasource in LogicMonitor. 7 | 8 | .PARAMETER RawObject 9 | The raw object representing the graph configuration. Use Get-LMDatasourceGraph to see the expected format. 10 | 11 | .PARAMETER DatasourceId 12 | The ID of the datasource to which the graph will be added. Required for dsId parameter set. 13 | 14 | .PARAMETER DatasourceName 15 | The name of the datasource to which the graph will be added. Required for dsName parameter set. 16 | 17 | .EXAMPLE 18 | #Create graph using datasource ID 19 | New-LMDatasourceGraph -RawObject $graphConfig -DatasourceId 123 20 | 21 | .EXAMPLE 22 | #Create graph using datasource name 23 | New-LMDatasourceGraph -RawObject $graphConfig -DatasourceName "MyDatasource" 24 | 25 | .NOTES 26 | You must run Connect-LMAccount before running this command. 27 | 28 | .INPUTS 29 | None. You cannot pipe objects to this command. 30 | 31 | .OUTPUTS 32 | Returns LogicMonitor.DatasourceGraph object. 33 | #> 34 | 35 | Function New-LMDatasourceGraph { 36 | 37 | [CmdletBinding()] 38 | Param ( 39 | [Parameter(Mandatory)] 40 | $RawObject, 41 | 42 | [Parameter(Mandatory, ParameterSetName = 'dsId')] 43 | $DatasourceId, 44 | 45 | [Parameter(Mandatory, ParameterSetName = 'dsName')] 46 | $DatasourceName 47 | 48 | ) 49 | #Check if we are logged in and have valid api creds 50 | If ($Script:LMAuth.Valid) { 51 | 52 | If ($DataSourceName) { 53 | $LookupResult = (Get-LMDatasource -Name $DataSourceName).Id 54 | If (Test-LookupResult -Result $LookupResult -LookupString $DataSourceName) { 55 | Return 56 | } 57 | $DatasourceId = $LookupResult 58 | } 59 | 60 | #Build header and uri 61 | $ResourcePath = "/setting/datasources/$DatasourceId/graphs" 62 | 63 | Try { 64 | $Data = ($RawObject | ConvertTo-Json) 65 | 66 | $Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath -Data $Data 67 | $Uri = "https://$($Script:LMAuth.Portal).$(Get-LMPortalURI)" + $ResourcePath 68 | 69 | Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Data 70 | 71 | #Issue request 72 | $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data 73 | 74 | Return (Add-ObjectTypeInfo -InputObject $Response -TypeName "LogicMonitor.DatasourceGraph" ) 75 | } 76 | Catch [Exception] { 77 | $Proceed = Resolve-LMException -LMException $PSItem 78 | If (!$Proceed) { 79 | Return 80 | } 81 | } 82 | } 83 | Else { 84 | Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /Public/New-LMDatasourceOverviewGraph.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Creates a new datasource overview graph in LogicMonitor. 4 | 5 | .DESCRIPTION 6 | The New-LMDatasourceOverviewGraph function creates a new overview graph for a specified datasource in LogicMonitor. 7 | 8 | .PARAMETER RawObject 9 | The raw object representing the graph configuration. Use Get-LMDatasourceOverviewGraph to see the expected format. 10 | 11 | .PARAMETER DatasourceId 12 | The ID of the datasource for which to create the overview graph. Required for dsId parameter set. 13 | 14 | .PARAMETER DatasourceName 15 | The name of the datasource for which to create the overview graph. Required for dsName parameter set. 16 | 17 | .EXAMPLE 18 | #Create overview graph using datasource ID 19 | New-LMDatasourceOverviewGraph -RawObject $graphConfig -DatasourceId 123 20 | 21 | .EXAMPLE 22 | #Create overview graph using datasource name 23 | New-LMDatasourceOverviewGraph -RawObject $graphConfig -DatasourceName "MyDatasource" 24 | 25 | .NOTES 26 | You must run Connect-LMAccount before running this command. 27 | 28 | .INPUTS 29 | None. You cannot pipe objects to this command. 30 | 31 | .OUTPUTS 32 | Returns LogicMonitor.DatasourceGraph object. 33 | #> 34 | Function New-LMDatasourceOverviewGraph { 35 | 36 | [CmdletBinding()] 37 | Param ( 38 | [Parameter(Mandatory)] 39 | $RawObject, 40 | 41 | [Parameter(Mandatory, ParameterSetName = 'dsId')] 42 | $DatasourceId, 43 | 44 | [Parameter(Mandatory, ParameterSetName = 'dsName')] 45 | $DatasourceName 46 | 47 | ) 48 | #Check if we are logged in and have valid api creds 49 | If ($Script:LMAuth.Valid) { 50 | 51 | If ($DataSourceName) { 52 | $LookupResult = (Get-LMDatasource -Name $DataSourceName).Id 53 | If (Test-LookupResult -Result $LookupResult -LookupString $DataSourceName) { 54 | Return 55 | } 56 | $DatasourceId = $LookupResult 57 | } 58 | 59 | #Build header and uri 60 | $ResourcePath = "/setting/datasources/$DatasourceId/ographs" 61 | 62 | Try { 63 | $Data = ($RawObject | ConvertTo-Json) 64 | 65 | $Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath -Data $Data 66 | $Uri = "https://$($Script:LMAuth.Portal).$(Get-LMPortalURI)" + $ResourcePath 67 | 68 | Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Data 69 | 70 | #Issue request 71 | $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data 72 | 73 | Return (Add-ObjectTypeInfo -InputObject $Response -TypeName "LogicMonitor.DatasourceGraph" ) 74 | } 75 | Catch [Exception] { 76 | $Proceed = Resolve-LMException -LMException $PSItem 77 | If (!$Proceed) { 78 | Return 79 | } 80 | } 81 | } 82 | Else { 83 | Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /Public/New-LMNetscanGroup.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Creates a new LogicMonitor Netscan Group. 4 | 5 | .DESCRIPTION 6 | The New-LMNetscanGroup function creates a new Netscan Group in LogicMonitor. It allows you to specify a name and optional description for the group. 7 | 8 | .PARAMETER Name 9 | Specifies the name of the Netscan Group. This parameter is mandatory. 10 | 11 | .PARAMETER Description 12 | Specifies the description for the Netscan Group. 13 | 14 | .EXAMPLE 15 | New-LMNetscanGroup -Name "Group1" -Description "This is a sample group" 16 | Creates a new Netscan Group with the name "Group1" and the description "This is a sample group". 17 | 18 | .NOTES 19 | You must run Connect-LMAccount before running this command. 20 | 21 | .INPUTS 22 | None. You cannot pipe objects to this command. 23 | 24 | .OUTPUTS 25 | Returns LogicMonitor.NetScanGroup object. 26 | #> 27 | Function New-LMNetscanGroup { 28 | 29 | [CmdletBinding()] 30 | Param ( 31 | 32 | [Parameter(Mandatory)] 33 | [String]$Name, 34 | 35 | [String]$Description 36 | 37 | ) 38 | #Check if we are logged in and have valid api creds 39 | Begin {} 40 | Process { 41 | If ($Script:LMAuth.Valid) { 42 | 43 | #Build custom props hashtable 44 | $customProperties = @() 45 | If ($Properties) { 46 | Foreach ($Key in $Properties.Keys) { 47 | $customProperties += @{name = $Key; value = $Properties[$Key] } 48 | } 49 | } 50 | 51 | #Build header and uri 52 | $ResourcePath = "/setting/netscans/groups" 53 | 54 | Try { 55 | $Data = @{ 56 | description = $Description 57 | name = $Name 58 | } 59 | 60 | 61 | #Remove empty keys so we dont overwrite them 62 | @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } 63 | 64 | $Data = ($Data | ConvertTo-Json) 65 | $Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath -Data $Data 66 | $Uri = "https://$($Script:LMAuth.Portal).$(Get-LMPortalURI)" + $ResourcePath 67 | 68 | Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Data 69 | 70 | #Issue request 71 | $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data 72 | 73 | Return (Add-ObjectTypeInfo -InputObject $Response -TypeName "LogicMonitor.NetScanGroup" ) 74 | } 75 | Catch [Exception] { 76 | $Proceed = Resolve-LMException -LMException $PSItem 77 | If (!$Proceed) { 78 | Return 79 | } 80 | } 81 | } 82 | Else { 83 | Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." 84 | } 85 | } 86 | End {} 87 | } 88 | -------------------------------------------------------------------------------- /Public/New-LMPushMetricInstance.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Creates a new instance of a LogicMonitor push metric. 4 | 5 | .DESCRIPTION 6 | The New-LMPushMetricInstance function is used to create a new instance of a LogicMonitor push metric. It adds the instance to the specified instances array and returns the updated array. 7 | 8 | .PARAMETER InstancesArrary 9 | The array of existing instances to which the new instance will be added. 10 | 11 | .PARAMETER InstanceName 12 | The name of the new instance. 13 | 14 | .PARAMETER InstanceDisplayName 15 | The display name of the new instance. If not specified, the InstanceName will be used as the display name. 16 | 17 | .PARAMETER InstanceDescription 18 | The description of the new instance. 19 | 20 | .PARAMETER InstanceProperties 21 | A hashtable containing additional properties for the new instance. 22 | 23 | .PARAMETER Datapoints 24 | The list of datapoints associated with the new instance. Datapoints should be the results of the New-LMPushMetricDataPoint function. 25 | 26 | .EXAMPLE 27 | $instances = New-LMPushMetricInstance -InstancesArrary $instances -InstanceName "Instance1" -InstanceDisplayName "Instance 1" -InstanceDescription "This is instance 1" -InstanceProperties @{Property1 = "Value1"; Property2 = "Value2"} -Datapoints $datapoints 28 | 29 | This example creates a new instance with the specified parameters and adds it to the existing instances array. 30 | 31 | .NOTES 32 | You must run Connect-LMAccount before running this command. 33 | 34 | .INPUTS 35 | None. You cannot pipe objects to this command. 36 | 37 | .OUTPUTS 38 | Returns LogicMonitor.Instance object. 39 | #> 40 | Function New-LMPushMetricInstance { 41 | 42 | [CmdletBinding()] 43 | Param ( 44 | 45 | [System.Collections.Generic.List[object]]$InstancesArrary, 46 | 47 | [Parameter(Mandatory)] 48 | [String]$InstanceName, 49 | 50 | [String]$InstanceDisplayName, 51 | 52 | [String]$InstanceDescription, 53 | 54 | [Hashtable]$InstanceProperties, 55 | 56 | [Parameter(Mandatory)] 57 | [System.Collections.Generic.List[object]]$Datapoints 58 | ) 59 | #Check if we are logged in and have valid api creds 60 | If ($Script:LMAuth.Valid) { 61 | If (!$InstancesArrary) { 62 | $InstancesArrary = [System.Collections.Generic.List[object]]::New() 63 | } 64 | 65 | #Add new instance to new instances array 66 | $InstancesArrary.Add([PSCustomObject]@{ 67 | instanceName = $InstanceName 68 | instanceDisplayName = If ($InstanceDisplayName) { $InstanceDisplayName }Else { $InstanceName } 69 | instanceProperties = $InstanceProperties 70 | instanceDescription = $InstanceDescription 71 | dataPoints = $Datapoints 72 | }) 73 | 74 | Return $InstancesArrary 75 | } 76 | Else { 77 | Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /Public/New-LMRecipient.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Creates a new LogicMonitor recipient object. 4 | 5 | .DESCRIPTION 6 | The New-LMRecipient function creates a new LogicMonitor recipient object that can be used with recipient groups. The recipient can be an admin user, arbitrary email, or another recipient group. 7 | 8 | .PARAMETER Type 9 | The type of recipient. Must be one of: ADMIN, ARBITRARY, or GROUP. 10 | 11 | .PARAMETER Addr 12 | The address of the recipient. For ADMIN/ARBITRARY this is an email address, for GROUP this is the group name. 13 | 14 | .PARAMETER Method 15 | The notification method for ADMIN recipients. Not used for GROUP type. Possible values: email, sms, voice, smsemail or the name of an existing integration 16 | 17 | .PARAMETER Contact 18 | Optional contact information for the recipient. 19 | 20 | .EXAMPLE 21 | New-LMRecipient -Type ADMIN -Addr "admin@company.com" -Method "email" 22 | Creates a new admin recipient that will receive email notifications. 23 | 24 | .EXAMPLE 25 | New-LMRecipient -Type GROUP -Addr "EmergencyContacts" 26 | Creates a new recipient that references an existing recipient group. 27 | 28 | .INPUTS 29 | None. You cannot pipe objects to this command. 30 | 31 | .OUTPUTS 32 | Returns a hashtable containing the recipient configuration. 33 | #> 34 | 35 | Function New-LMRecipient { 36 | param( 37 | [Parameter(Mandatory)] 38 | [ValidateSet('ADMIN','GROUP','ARBITRARY')] 39 | [String]$Type, 40 | 41 | [Parameter(Mandatory)] [string]$Addr, 42 | 43 | [String]$Method, # Only for ADMIN 44 | 45 | [String]$Contact # Optional, for future use 46 | ) 47 | $recipient = @{ 48 | type = $Type 49 | addr = $Addr 50 | } 51 | if ($Type -ne 'GROUP') { 52 | $recipient.method = $Method 53 | } 54 | if ($Contact) { 55 | $recipient.contact = $Contact 56 | } 57 | return [PSCustomObject]$recipient 58 | } 59 | -------------------------------------------------------------------------------- /Public/New-LMReportGroup.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Creates a new LogicMonitor report group. 4 | 5 | .DESCRIPTION 6 | The New-LMReportGroup function creates a new report group in LogicMonitor. It requires the name of the report group as a mandatory parameter and an optional description. 7 | 8 | .PARAMETER Name 9 | The name of the report group. This parameter is mandatory. 10 | 11 | .PARAMETER Description 12 | The description of the report group. This parameter is optional. 13 | 14 | .EXAMPLE 15 | New-LMReportGroup -Name "MyReportGroup" -Description "This is a sample report group" 16 | 17 | This example creates a new report group with the name "MyReportGroup" and the description "This is a sample report group". 18 | 19 | .NOTES 20 | You must run Connect-LMAccount before running this command. 21 | 22 | .INPUTS 23 | None. You cannot pipe objects to this command. 24 | 25 | .OUTPUTS 26 | Returns LogicMonitor.ReportGroup object. 27 | #> 28 | Function New-LMReportGroup { 29 | 30 | [CmdletBinding()] 31 | Param ( 32 | 33 | [Parameter(Mandatory)] 34 | [String]$Name, 35 | 36 | [String]$Description 37 | 38 | ) 39 | #Check if we are logged in and have valid api creds 40 | Begin {} 41 | Process { 42 | If ($Script:LMAuth.Valid) { 43 | 44 | #Build custom props hashtable 45 | $customProperties = @() 46 | If ($Properties) { 47 | Foreach ($Key in $Properties.Keys) { 48 | $customProperties += @{name = $Key; value = $Properties[$Key] } 49 | } 50 | } 51 | 52 | #Build header and uri 53 | $ResourcePath = "/report/groups" 54 | 55 | Try { 56 | $Data = @{ 57 | description = $Description 58 | name = $Name 59 | } 60 | 61 | 62 | #Remove empty keys so we dont overwrite them 63 | @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } 64 | 65 | $Data = ($Data | ConvertTo-Json) 66 | $Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath -Data $Data 67 | $Uri = "https://$($Script:LMAuth.Portal).$(Get-LMPortalURI)" + $ResourcePath 68 | 69 | Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Data 70 | 71 | #Issue request 72 | $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data 73 | 74 | Return (Add-ObjectTypeInfo -InputObject $Response -TypeName "LogicMonitor.NetScanGroup" ) 75 | } 76 | Catch [Exception] { 77 | $Proceed = Resolve-LMException -LMException $PSItem 78 | If (!$Proceed) { 79 | Return 80 | } 81 | } 82 | } 83 | Else { 84 | Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." 85 | } 86 | } 87 | End {} 88 | } 89 | -------------------------------------------------------------------------------- /Public/Remove-LMCachedAccount.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Removes cached account information from the Logic.Monitor vault. 4 | 5 | .DESCRIPTION 6 | The Remove-LMCachedAccount function is used to remove cached account information from the Logic.Monitor vault. It provides two parameter sets: 'Single' and 'All'. When using the 'Single' parameter set, you can specify a single cached account to remove. When using the 'All' parameter set, all cached accounts will be removed. 7 | 8 | .PARAMETER CachedAccountName 9 | Specifies the name of the cached account to remove. This parameter is used with the 'Single' parameter set. 10 | 11 | .PARAMETER RemoveAllEntries 12 | Indicates that all cached accounts should be removed. This parameter is used with the 'All' parameter set. 13 | 14 | .EXAMPLE 15 | Remove-LMCachedAccount -CachedAccountName "JohnDoe" 16 | Removes the cached account with the name "JohnDoe" from the Logic.Monitor vault. 17 | 18 | .EXAMPLE 19 | Remove-LMCachedAccount -RemoveAllEntries 20 | Removes all cached accounts from the Logic.Monitor vault. 21 | 22 | .NOTES 23 | This function operates on the local credential vault and does not require API authentication. 24 | 25 | .INPUTS 26 | You can pipe objects to this function. 27 | 28 | .OUTPUTS 29 | This function does not generate any output. 30 | #> 31 | 32 | Function Remove-LMCachedAccount { 33 | [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')] 34 | Param ( 35 | [Parameter(Mandatory, ParameterSetName = 'Single', ValueFromPipelineByPropertyName)] 36 | [Alias("Portal")] 37 | [String]$CachedAccountName, 38 | 39 | [Parameter(ParameterSetName = 'All')] 40 | [Switch]$RemoveAllEntries 41 | ) 42 | Begin {} 43 | Process { 44 | If ($RemoveAllEntries) { 45 | $CachedAccounts = Get-SecretInfo -Vault Logic.Monitor 46 | If ($PSCmdlet.ShouldProcess("$(($CachedAccounts | Measure-Object).Count) cached account(s)", "Remove All Cached Accounts")) { 47 | Foreach ($Account in $CachedAccounts.Name) { 48 | Try { 49 | Remove-Secret -Name $Account -Vault Logic.Monitor -Confirm:$false -ErrorAction Stop 50 | Write-Information "[INFO]: Removed cached account secret for: $Account" 51 | } 52 | Catch { 53 | Write-Error $_.Exception.Message 54 | } 55 | } 56 | Write-Information "[INFO]: Processed all entries from credential cache" 57 | } 58 | } 59 | Else { 60 | If ($PSCmdlet.ShouldProcess($CachedAccountName, "Remove Cached Account")) { 61 | Try { 62 | Remove-Secret -Name $CachedAccountName -Vault Logic.Monitor -Confirm:$false -ErrorAction Stop 63 | Write-Information "[INFO]: Removed cached account secret for: $CachedAccountName" 64 | } 65 | Catch { 66 | Write-Error $_.Exception.Message 67 | } 68 | } 69 | } 70 | } 71 | End {} 72 | } -------------------------------------------------------------------------------- /Public/Remove-LMNormalizedProperties.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Removes normalized properties from LogicMonitor. 4 | 5 | .DESCRIPTION 6 | The Remove-LMNormalizedProperties cmdlet removes normalized properties from LogicMonitor. 7 | 8 | .PARAMETER Alias 9 | The alias name of the normalized property to remove. 10 | 11 | .EXAMPLE 12 | Remove-LMNormalizedProperties -Alias "location" 13 | Removes the normalized property with alias "location". 14 | 15 | .INPUTS 16 | None. 17 | 18 | .OUTPUTS 19 | Returns the response from the API after removing the normalized property. 20 | 21 | .NOTES 22 | This function requires valid API credentials to be logged in. Use Connect-LMAccount to log in before running this command. 23 | #> 24 | Function Remove-LMNormalizedProperties { 25 | 26 | [CmdletBinding()] 27 | Param ( 28 | [Parameter(Mandatory = $true)] 29 | [String]$Alias 30 | ) 31 | 32 | #Check if we are logged in and have valid api creds 33 | Begin {} 34 | Process { 35 | If ($Script:LMAuth.Valid) { 36 | 37 | #Build header and uri 38 | $ResourcePath = "/normalizedProperties/alias" 39 | 40 | #Loop through each property and build the body 41 | $Body = [PSCustomObject]@{ 42 | data = [PSCustomObject]@{ 43 | items = @() 44 | } 45 | } 46 | 47 | $Body.data.items += [PSCustomObject]@{ 48 | alias = $Alias 49 | model = "normalizedProperties" 50 | } 51 | 52 | $Body = $Body | ConvertTo-Json -Depth 10 53 | 54 | Try { 55 | $Headers = New-LMHeader -Auth $Script:LMAuth -Method "DELETE" -ResourcePath $ResourcePath -Version 4 56 | $Uri = "https://$($Script:LMAuth.Portal).$(Get-LMPortalURI)" + $ResourcePath 57 | 58 | Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation 59 | 60 | #Issue request 61 | $Response = Invoke-RestMethod -Uri $Uri -Method "DELETE" -Headers $Headers[0] -WebSession $Headers[1] -Body $Body 62 | } 63 | Catch [Exception] { 64 | $Proceed = Resolve-LMException -LMException $PSItem 65 | If (!$Proceed) { 66 | Return 67 | } 68 | } 69 | Return $Response 70 | } 71 | Else { 72 | Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." 73 | } 74 | } 75 | End {} 76 | } 77 | -------------------------------------------------------------------------------- /Public/Remove-LMOpsNote.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Removes an OpsNote from LogicMonitor. 4 | 5 | .DESCRIPTION 6 | The Remove-LMOpsNote function removes an OpsNote from LogicMonitor. It requires the user to be logged in and have valid API credentials. 7 | 8 | .PARAMETER Id 9 | Specifies the ID of the OpsNote to be removed. 10 | 11 | .EXAMPLE 12 | Remove-LMOpsNote -Id "12345" 13 | Removes the OpsNote with the ID "12345" from LogicMonitor. 14 | 15 | .INPUTS 16 | You can pipe objects to this function. 17 | 18 | .OUTPUTS 19 | Returns a PSCustomObject containing the ID of the removed OpsNote and a message indicating the success of the removal operation. 20 | #> 21 | Function Remove-LMOpsNote { 22 | 23 | [CmdletBinding(DefaultParameterSetName = 'Id', SupportsShouldProcess, ConfirmImpact = 'High')] 24 | Param ( 25 | [Parameter(Mandatory, ParameterSetName = 'Id', ValueFromPipelineByPropertyName)] 26 | [String]$Id 27 | 28 | ) 29 | Begin {} 30 | Process { 31 | #Check if we are logged in and have valid api creds 32 | If ($Script:LMAuth.Valid) { 33 | 34 | #Build header and uri 35 | $ResourcePath = "/setting/opsnotes/$Id" 36 | 37 | $Message = "Id: $Id" 38 | 39 | #Loop through requests 40 | Try { 41 | If ($PSCmdlet.ShouldProcess($Message, "Remove OpsNote")) { 42 | $Headers = New-LMHeader -Auth $Script:LMAuth -Method "DELETE" -ResourcePath $ResourcePath 43 | $Uri = "https://$($Script:LMAuth.Portal).$(Get-LMPortalURI)" + $ResourcePath 44 | 45 | Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation 46 | 47 | #Issue request 48 | $Response = Invoke-RestMethod -Uri $Uri -Method "DELETE" -Headers $Headers[0] -WebSession $Headers[1] 49 | 50 | $Result = [PSCustomObject]@{ 51 | Id = $Id 52 | Message = "Successfully removed ($Message)" 53 | } 54 | 55 | Return $Result 56 | } 57 | } 58 | Catch [Exception] { 59 | $Proceed = Resolve-LMException -LMException $PSItem 60 | If (!$Proceed) { 61 | Return 62 | } 63 | } 64 | } 65 | Else { 66 | Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." 67 | } 68 | } 69 | End {} 70 | } 71 | -------------------------------------------------------------------------------- /Public/Remove-LMSDT.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Removes a Scheduled Down Time (SDT) entry from LogicMonitor. 4 | 5 | .DESCRIPTION 6 | The Remove-LMSDT function removes a specified SDT entry from LogicMonitor using its ID. 7 | 8 | .PARAMETER Id 9 | Specifies the ID of the SDT entry to remove. This parameter is mandatory. 10 | 11 | .EXAMPLE 12 | Remove-LMSDT -Id "12345" 13 | Removes the SDT entry with ID "12345". 14 | 15 | .INPUTS 16 | You can pipe objects to this function. 17 | 18 | .OUTPUTS 19 | Returns a PSCustomObject containing the ID of the removed SDT entry and a success message confirming the removal. 20 | #> 21 | 22 | Function Remove-LMSDT { 23 | 24 | [CmdletBinding(DefaultParameterSetName = 'Id', SupportsShouldProcess, ConfirmImpact = 'High')] 25 | Param ( 26 | [Parameter(Mandatory, ParameterSetName = 'Id', ValueFromPipelineByPropertyName)] 27 | [String]$Id 28 | 29 | ) 30 | Begin {} 31 | Process { 32 | #Check if we are logged in and have valid api creds 33 | If ($Script:LMAuth.Valid) { 34 | 35 | #Build header and uri 36 | $ResourcePath = "/sdt/sdts/$Id" 37 | 38 | $Message = "Id: $Id" 39 | 40 | #Loop through requests 41 | Try { 42 | If ($PSCmdlet.ShouldProcess($Message, "Remove SDT")) { 43 | $Headers = New-LMHeader -Auth $Script:LMAuth -Method "DELETE" -ResourcePath $ResourcePath 44 | $Uri = "https://$($Script:LMAuth.Portal).$(Get-LMPortalURI)" + $ResourcePath 45 | 46 | Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation 47 | 48 | #Issue request 49 | $Response = Invoke-RestMethod -Uri $Uri -Method "DELETE" -Headers $Headers[0] -WebSession $Headers[1] 50 | 51 | $Result = [PSCustomObject]@{ 52 | Id = $Id 53 | Message = "Successfully removed ($Message)" 54 | } 55 | 56 | Return $Result 57 | } 58 | } 59 | Catch [Exception] { 60 | $Proceed = Resolve-LMException -LMException $PSItem 61 | If (!$Proceed) { 62 | Return 63 | } 64 | } 65 | } 66 | Else { 67 | Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." 68 | } 69 | } 70 | End {} 71 | } 72 | -------------------------------------------------------------------------------- /Public/Remove-LMUnmonitoredDevice.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Removes unmonitored devices from LogicMonitor. 4 | 5 | .DESCRIPTION 6 | The Remove-LMUnmonitoredDevice function removes one or more unmonitored devices from LogicMonitor using their IDs. 7 | 8 | .PARAMETER Ids 9 | Specifies an array of IDs for the unmonitored devices to remove. 10 | 11 | .EXAMPLE 12 | Remove-LMUnmonitoredDevice -Ids "123","456" 13 | Removes the unmonitored devices with IDs "123" and "456". 14 | 15 | .INPUTS 16 | None. 17 | 18 | .OUTPUTS 19 | Returns a LogicMonitor.UnmonitoredDevice object containing information about the removed devices. 20 | #> 21 | 22 | Function Remove-LMUnmonitoredDevice { 23 | 24 | [CmdletBinding(DefaultParameterSetName = 'Id', SupportsShouldProcess, ConfirmImpact = 'High')] 25 | Param ( 26 | [Parameter(Mandatory, ParameterSetName = 'Id')] 27 | [String[]]$Ids 28 | 29 | ) 30 | #Check if we are logged in and have valid api creds 31 | Begin {} 32 | Process { 33 | If ($Script:LMAuth.Valid) { 34 | 35 | #Build header and uri 36 | $ResourcePath = "/device/unmonitoreddevices/batchdelete" 37 | 38 | $Message = "Id(s): $Ids" 39 | 40 | Try { 41 | If ($PSCmdlet.ShouldProcess($Message, "Remove Unmonitored Devices")) { 42 | [String[]]$Data = $Ids 43 | $Data = ($Data | ConvertTo-Json -AsArray) 44 | 45 | $Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath -Data $Data 46 | $Uri = "https://$($Script:LMAuth.Portal).$(Get-LMPortalURI)" + $ResourcePath 47 | 48 | Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation 49 | 50 | #Issue request 51 | $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data 52 | 53 | Return (Add-ObjectTypeInfo -InputObject $Response -TypeName "LogicMonitor.UnmonitoredDevice" ) 54 | } 55 | } 56 | Catch [Exception] { 57 | $Proceed = Resolve-LMException -LMException $PSItem 58 | If (!$Proceed) { 59 | Return 60 | } 61 | } 62 | } 63 | Else { 64 | Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." 65 | } 66 | } 67 | End {} 68 | } -------------------------------------------------------------------------------- /Public/Set-LMLogPartitionAction.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Updates a LogicMonitor Log Partition configuration to either pause or resume log ingestion. 4 | 5 | .DESCRIPTION 6 | The Set-LMLogPartitionAction function modifies an existing log partition action in LogicMonitor. 7 | 8 | .PARAMETER Id 9 | Specifies the ID of the log partition action to modify. 10 | 11 | .PARAMETER Name 12 | Specifies the current name of the log partition to modify. 13 | 14 | .PARAMETER Action 15 | Specifies the new action for the log partition. Possible values are "pause" or "resume". 16 | 17 | .EXAMPLE 18 | Set-LMLogPartitionAction -Id 123 -Action "pause" 19 | Updates the log partition with ID 123 to pause log ingestion. 20 | 21 | .INPUTS 22 | None. 23 | 24 | .OUTPUTS 25 | Returns a LogicMonitor.LogPartition object containing the updated log partition information. 26 | 27 | .NOTES 28 | This function requires a valid LogicMonitor API authentication. 29 | #> 30 | 31 | Function Set-LMLogPartitionAction { 32 | 33 | [CmdletBinding()] 34 | Param ( 35 | 36 | [Parameter(ParameterSetName = 'Id', ValueFromPipelineByPropertyName)] 37 | [Int]$Id, 38 | 39 | [Parameter(ParameterSetName = 'Name')] 40 | [String]$Name, 41 | 42 | [Parameter(Mandatory)] 43 | [ValidateSet("pause", "resume")] 44 | [String]$Action 45 | 46 | ) 47 | #Check if we are logged in and have valid api creds 48 | Begin {} 49 | Process { 50 | If ($Script:LMAuth.Valid) { 51 | #Lookup Log Partition Id 52 | If ($Name) { 53 | $LookupResult = (Get-LMLogPartition -Name $Name).Id 54 | If (Test-LookupResult -Result $LookupResult -LookupString $Name) { 55 | return 56 | } 57 | $Id = $LookupResult 58 | } 59 | 60 | #Build header and uri 61 | $ResourcePath = "/log/partitions/$Id/$Action" 62 | 63 | Try { 64 | 65 | $Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath 66 | $Uri = "https://$($Script:LMAuth.Portal).$(Get-LMPortalURI)" + $ResourcePath 67 | 68 | Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation 69 | 70 | #Issue request 71 | $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] 72 | 73 | Return (Add-ObjectTypeInfo -InputObject $Response -TypeName "LogicMonitor.LogPartition" ) 74 | } 75 | Catch [Exception] { 76 | $Proceed = Resolve-LMException -LMException $PSItem 77 | If (!$Proceed) { 78 | Return 79 | } 80 | } 81 | } 82 | Else { 83 | Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." 84 | } 85 | } 86 | End {} 87 | } 88 | -------------------------------------------------------------------------------- /Public/Set-LMNewUserMessage.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Updates the new user message template in LogicMonitor. 4 | 5 | .DESCRIPTION 6 | The Set-LMNewUserMessage function modifies the message template that is sent to new users in LogicMonitor. 7 | 8 | .PARAMETER MessageBody 9 | Specifies the body content of the message template. 10 | 11 | .PARAMETER MessageSubject 12 | Specifies the subject line of the message template. 13 | 14 | .EXAMPLE 15 | Set-LMNewUserMessage -MessageBody "Welcome to our monitoring system" -MessageSubject "Welcome to LogicMonitor" 16 | Updates the new user message template with the specified subject and body. 17 | 18 | .INPUTS 19 | None. 20 | 21 | .OUTPUTS 22 | Returns the response from the API indicating the success of the update. 23 | 24 | .NOTES 25 | This function requires a valid LogicMonitor API authentication. 26 | #> 27 | 28 | Function Set-LMNewUserMessage { 29 | 30 | [CmdletBinding()] 31 | Param ( 32 | 33 | [Parameter(Mandatory)] 34 | [String]$MessageBody, 35 | 36 | [Parameter(Mandatory)] 37 | [String]$MessageSubject 38 | 39 | ) 40 | #Check if we are logged in and have valid api creds 41 | Begin {} 42 | Process { 43 | If ($Script:LMAuth.Valid) { 44 | 45 | #Build header and uri 46 | $ResourcePath = "/setting/messagetemplate" 47 | 48 | Try { 49 | $Data = @{ 50 | messageBody = $MessageBody 51 | messageSubject = $MessageSubject 52 | } 53 | 54 | #Remove empty keys so we dont overwrite them 55 | @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } 56 | 57 | $Data = ($Data | ConvertTo-Json) 58 | 59 | $Headers = New-LMHeader -Auth $Script:LMAuth -Method "PATCH" -ResourcePath $ResourcePath -Data $Data 60 | $Uri = "https://$($Script:LMAuth.Portal).$(Get-LMPortalURI)" + $ResourcePath 61 | 62 | Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Data 63 | 64 | #Issue request 65 | $Response = Invoke-RestMethod -Uri $Uri -Method "PATCH" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data 66 | 67 | Return $Response 68 | } 69 | Catch [Exception] { 70 | $Proceed = Resolve-LMException -LMException $PSItem 71 | If (!$Proceed) { 72 | Return 73 | } 74 | } 75 | } 76 | Else { 77 | Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." 78 | } 79 | } 80 | End {} 81 | } 82 | -------------------------------------------------------------------------------- /Public/Set-LMUnmonitoredDevice.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Updates unmonitored devices in LogicMonitor. 4 | 5 | .DESCRIPTION 6 | The Set-LMUnmonitoredDevice function modifies unmonitored devices in LogicMonitor by assigning them to a device group. 7 | 8 | .PARAMETER Ids 9 | Specifies an array of unmonitored device IDs to update. 10 | 11 | .PARAMETER DeviceGroupId 12 | Specifies the ID of the device group to assign the devices to. 13 | 14 | .PARAMETER Description 15 | Specifies a description for the devices. 16 | 17 | .PARAMETER CollectorId 18 | Specifies the ID of the collector to assign to the devices. Default is 0. 19 | 20 | .EXAMPLE 21 | #Assigns the specified unmonitored devices to the device group and sets their description. 22 | Set-LMUnmonitoredDevice -Ids @("123", "456") -DeviceGroupId 789 -Description "New devices" 23 | 24 | 25 | .INPUTS 26 | None. 27 | 28 | .OUTPUTS 29 | Returns a LogicMonitor.Device object containing the updated device information. 30 | 31 | .NOTES 32 | This function requires a valid LogicMonitor API authentication. 33 | #> 34 | 35 | Function Set-LMUnmonitoredDevice { 36 | 37 | [CmdletBinding()] 38 | Param ( 39 | [Parameter(Mandatory)] 40 | [String[]]$Ids, 41 | 42 | [Parameter(Mandatory)] 43 | [Int]$DeviceGroupId, 44 | 45 | [String]$Description = "", 46 | 47 | [Int]$CollectorId = 0 48 | 49 | ) 50 | #Check if we are logged in and have valid api creds 51 | Begin {} 52 | Process { 53 | If ($Script:LMAuth.Valid) { 54 | 55 | #Build header and uri 56 | $ResourcePath = "/device/unmonitoreddevices/services/assign" 57 | 58 | Try { 59 | $Data = @{ 60 | collectorId = $CollectorId 61 | description = $Description 62 | deviceGroupId = $DeviceGroupId 63 | missingDeviceIds = $Ids 64 | } 65 | 66 | $Data = ($Data | ConvertTo-Json) 67 | 68 | $Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath -Data $Data 69 | $Uri = "https://$($Script:LMAuth.Portal).$(Get-LMPortalURI)" + $ResourcePath 70 | 71 | Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Data 72 | 73 | #Issue request 74 | $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data 75 | 76 | Return (Add-ObjectTypeInfo -InputObject $Response -TypeName "LogicMonitor.Device" ) 77 | } 78 | Catch [Exception] { 79 | $Proceed = Resolve-LMException -LMException $PSItem 80 | If (!$Proceed) { 81 | Return 82 | } 83 | } 84 | } 85 | Else { 86 | Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." 87 | } 88 | } 89 | End {} 90 | } 91 | -------------------------------------------------------------------------------- /Public/Test-LMAppliesToQuery.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Tests the applies to query against the LogicMonitor API. 4 | 5 | .DESCRIPTION 6 | The Test-LMAppliesToQuery function is used to test the applies to query against the LogicMonitor API. 7 | 8 | .PARAMETER Query 9 | The applies to query to be tested. 10 | 11 | .EXAMPLE 12 | Test-LMAppliesToQuery -Query "system.hostname == 'server01'" 13 | This example tests the applies to query "system.hostname == 'server01'" against the LogicMonitor API and returns a list of matching devices. 14 | 15 | .INPUTS 16 | The Query parameter accepts string input that specifies the applies to query to test. 17 | 18 | .OUTPUTS 19 | Returns an array of objects containing the devices that match the specified query criteria. 20 | 21 | .NOTES 22 | This function requires a valid LogicMonitor API authentication. The query syntax must follow LogicMonitor's applies to query format. 23 | #> 24 | Function Test-LMAppliesToQuery { 25 | 26 | [CmdletBinding()] 27 | Param ( 28 | [Parameter(Mandatory)] 29 | [String]$Query 30 | 31 | ) 32 | #Check if we are logged in and have valid api creds 33 | If ($Script:LMAuth.Valid) { 34 | 35 | 36 | #Build header and uri 37 | $ResourcePath = "/functions" 38 | 39 | Try { 40 | $Data = @{ 41 | currentAppliesTo = $Query 42 | originalAppliesTo = $Query 43 | needInheritProps = $true 44 | type = "testAppliesTo" 45 | } 46 | 47 | $Data = ($Data | ConvertTo-Json) 48 | 49 | $Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath -Data $Data 50 | $Uri = "https://$($Script:LMAuth.Portal).$(Get-LMPortalURI)" + $ResourcePath 51 | 52 | Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Data 53 | 54 | #Issue request 55 | $Response = (Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data).currentMatches 56 | 57 | Return $Response 58 | } 59 | Catch [Exception] { 60 | $Proceed = Resolve-LMException -LMException $PSItem 61 | If (!$Proceed) { 62 | Return 63 | } 64 | } 65 | } 66 | Else { 67 | Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | Customers are strongly encouraged to upgrade to the latest version of the Logic.Monitor module as updates become available. All reported bugs and security issues are thoroughly evaluated and promptly addressed to ensure the highest level of system integrity and reliability. 6 | | Version | Supported | 7 | | ------- | ------------------ | 8 | | Latest Release | :white_check_mark: | 9 | | Previous Releases | :x: | 10 | 11 | ## Reporting a Vulnerability 12 | 13 | We take the security of our software seriously. If you believe you have found a security vulnerability in this PowerShell module, we encourage you to let us know right away. We will investigate all legitimate reports and do our best to quickly fix the problem. 14 | 15 | Please follow these steps to report a vulnerability: 16 | 17 | 1. **Report security vulnerabilities through the public GitHub issues.** 18 | 2. Include the following details: 19 | - Description of the vulnerability. 20 | - Steps to reproduce. This is incredibly important for us to be able to reproduce your findings. 21 | - Impact of the issue, including how you believe it can be exploited. 22 | 3. Please give us a reasonable amount of time to respond to your report before making public any information about the reported issue. 23 | 4. If you'd like, include how you would like to be acknowledged. We are more than happy to give credit where credit is due. 24 | 25 | ## Security Update Policy 26 | 27 | When a vulnerability is discovered and a fix is available, updates will be applied as soon as possible. 28 | 29 | Stay up-to-date by watching this repository and applying updates as they are released. 30 | 31 | ## Contact 32 | 33 | For urgent or sensitive reports, you can also contact the repo admin at [steven.villardi@logicmonitor.com](mailto:steven.villardi@logicmonitor.com). 34 | 35 | Thank you for helping keep Logic.Monitor and its users safe! 36 | -------------------------------------------------------------------------------- /Tests/LMAccessGroup.Tests.ps1: -------------------------------------------------------------------------------- 1 | Describe 'AccessGroup Testing New/Get/Set/Remove' { 2 | BeforeAll { 3 | Import-Module $Module -Force 4 | Connect-LMAccount -AccessId $AccessId -AccessKey $AccessKey -AccountName $AccountName -DisableConsoleLogging -SkipCredValidation 5 | } 6 | 7 | Describe 'New-LMAccessGroup' { 8 | It 'When given mandatory parameters, returns a created access group with matching values' { 9 | $Script:NewAccessGroup = New-LMAccessGroup -Name "AccessGroup.Build.Test" -Description "BuildTest" 10 | $Script:NewAccessGroup | Should -Not -BeNullOrEmpty 11 | $Script:NewAccessGroup.Name | Should -Be "AccessGroup.Build.Test" 12 | $Script:NewAccessGroup.Description | Should -Be "BuildTest" 13 | } 14 | } 15 | 16 | Describe 'Get-LMAccessGroup' { 17 | It 'When given no parameters, returns all access groups' { 18 | $AccessGroup = Get-LMAccessGroup 19 | ($AccessGroup | Measure-Object).Count | Should -BeGreaterThan 0 20 | } 21 | It 'When given an id should return that access group' { 22 | $AccessGroup = Get-LMAccessGroup -Id $Script:NewAccessGroup.Id 23 | ($AccessGroup | Measure-Object).Count | Should -BeExactly 1 24 | } 25 | It 'When given a name should return specified access group matching that name' { 26 | $AccessGroup = Get-LMAccessGroup -Name $Script:NewAccessGroup.Name 27 | ($AccessGroup | Measure-Object).Count | Should -BeExactly 1 28 | } 29 | It 'When given a wildcard name should return all access groups matching that wildcard value' { 30 | $AccessGroup = Get-LMAccessGroup -Name "$(($Script:NewAccessGroup.Name.Split(".")[0]))*" 31 | ($AccessGroup | Measure-Object).Count | Should -BeGreaterThan 0 32 | } 33 | } 34 | 35 | Describe 'Set-LMAccessGroup' { 36 | It 'When given a set of parameters, returns an updated access group with matching values' { 37 | { $AccessGroup = Set-LMAccessGroup -Id $Script:NewAccessGroup.Id -Description "Updated" -NewName "AccessGroup.Build.Test.Updated" -ErrorAction Stop 38 | $AccessGroup.Description | Should -Be "Updated" 39 | $AccessGroup.Name | Should -Be "AccessGroup.Build.Test.Updated" 40 | } | Should -Not -Throw 41 | } 42 | } 43 | 44 | Describe 'Remove-LMAccessGroup' { 45 | It 'When given an id, remove the access group from logic monitor' { 46 | { Remove-LMAccessGroup -Id $Script:NewAccessGroup.Id -ErrorAction Stop -Confirm:$false } | Should -Not -Throw 47 | } 48 | } 49 | 50 | AfterAll { 51 | Disconnect-LMAccount 52 | } 53 | } -------------------------------------------------------------------------------- /Tests/LMAccount.Tests.ps1: -------------------------------------------------------------------------------- 1 | BeforeAll { 2 | Import-Module $Module -Force 3 | } 4 | 5 | Describe 'Connect-LMAccount with LMv1' { 6 | It 'Connects successfully with admin level credentials using LMv1 auth' { 7 | { Connect-LMAccount -AccessId $AccessId -AccessKey $AccessKey -AccountName $AccountName -DisableConsoleLogging -ErrorAction Stop } | Should -Not -Throw 8 | } 9 | } 10 | Describe 'Connect-LMAccount with BearerToken' { 11 | It 'Connects successfully with admin level credentials using BearerToken auth' { 12 | { Connect-LMAccount -BearerToken $BearerToken -AccountName $AccountName -DisableConsoleLogging -ErrorAction Stop } | Should -Not -Throw 13 | } 14 | } 15 | 16 | Describe 'Disconnect-LMAccount' { 17 | It 'Disconnect should remove auth variables from scope without throwing exception' { 18 | { Disconnect-LMAccount -ErrorAction Stop } | Should -Not -Throw 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Tests/LMAppliesToFunction.Tests.ps1: -------------------------------------------------------------------------------- 1 | Describe 'AppliesToFunction Testing New/Get/Set/Remove' { 2 | BeforeAll { 3 | Import-Module $Module -Force 4 | Connect-LMAccount -AccessId $AccessId -AccessKey $AccessKey -AccountName $AccountName -DisableConsoleLogging -SkipCredValidation 5 | } 6 | 7 | Describe 'New-LMAppliesToFunction' { 8 | It 'When given mandatory parameters, returns a created AppliesToFunction with matching values' { 9 | $Script:NewAppliesToFunction = New-LMAppliesToFunction -Name "AppliesToFunction.Build.Test" -Description "Testing123" -AppliesTo "false()" 10 | $Script:NewAppliesToFunction | Should -Not -BeNullOrEmpty 11 | $Script:NewAppliesToFunction.Description | Should -Be "Testing123" 12 | $Script:NewAppliesToFunction.Code | Should -Be "false()" 13 | } 14 | } 15 | 16 | Describe 'Get-LMAppliesToFunction' { 17 | It 'When given no parameters, returns all devices' { 18 | $AppliesToFunction = Get-LMAppliesToFunction 19 | ($AppliesToFunction | Measure-Object).Count | Should -BeGreaterThan 0 20 | } 21 | It 'When given an id should return that device' { 22 | $AppliesToFunction = Get-LMAppliesToFunction -Id $Script:NewAppliesToFunction.Id 23 | ($AppliesToFunction | Measure-Object).Count | Should -BeExactly 1 24 | } 25 | It 'When given a name should return specified device matching that name' { 26 | $AppliesToFunction = Get-LMAppliesToFunction -Name $Script:NewAppliesToFunction.Name 27 | ($AppliesToFunction | Measure-Object).Count | Should -BeExactly 1 28 | } 29 | It 'When given a wildcard name should return all devices matching that wildcard value' { 30 | $AppliesToFunction = Get-LMAppliesToFunction -Name "$(($Script:NewAppliesToFunction.Name.Split(".")[0]))*" 31 | ($AppliesToFunction | Measure-Object).Count | Should -BeGreaterThan 0 32 | } 33 | } 34 | 35 | Describe 'Set-LMAppliesToFunction' { 36 | It 'When given a set of parameters, returns an updated AppliesToFunction with matching values' { 37 | { $AppliesToFunction = Set-LMAppliesToFunction -Id $Script:NewAppliesToFunction.Id -Description "Updated" -NewName "AppliesToFunction.Build.Test.UpdatedName" -ErrorAction Stop 38 | $AppliesToFunction.Description | Should -Be "Updated" 39 | $AppliesToFunction.Name | Should -Be "AppliesToFunction.Build.Test.UpdatedName" 40 | } | Should -Not -Throw 41 | } 42 | } 43 | 44 | Describe 'Remove-LMAppliesToFunction' { 45 | It 'When given an id, remove the AppliesToFunction from logic monitor' { 46 | { Remove-LMAppliesToFunction -Id $Script:NewAppliesToFunction.Id -Confirm:$false -ErrorAction Stop } | Should -Not -Throw 47 | } 48 | } 49 | 50 | AfterAll { 51 | Disconnect-LMAccount 52 | } 53 | } -------------------------------------------------------------------------------- /Tests/LMAppliesToSearch.Tests.ps1: -------------------------------------------------------------------------------- 1 | Describe 'AppliesToQuery Testing' { 2 | BeforeAll { 3 | Import-Module $Module -Force 4 | Connect-LMAccount -AccessId $AccessId -AccessKey $AccessKey -AccountName $AccountName -DisableConsoleLogging -SkipCredValidation 5 | } 6 | 7 | Describe 'Test-LMAppliesToQuery' { 8 | It 'When given a valid query, returns matching devices' { 9 | $Query = 'system.hostname =~ "lm*"' 10 | $Result = Test-LMAppliesToQuery -Query $Query 11 | $Result | Should -Not -BeNullOrEmpty 12 | $Result.Count | Should -BeGreaterThan 0 13 | } 14 | 15 | It 'When given an invalid query, throws an error' { 16 | $Query = 'invalid_property ~= "value"' 17 | { Test-LMAppliesToQuery -Query $Query -ErrorAction Stop } | Should -Throw 18 | } 19 | 20 | It 'When given a query that matches no devices, returns an empty result' { 21 | $Query = 'system.hostname == "non_existent_hostname"' 22 | $Result = Test-LMAppliesToQuery -Query $Query 23 | $Result | Should -BeNullOrEmpty 24 | } 25 | 26 | It 'When given a complex query, returns correct results' { 27 | $Query = 'system.hostname =~ "^lm" && system.displayname =~ "^lm"' 28 | $Result = Test-LMAppliesToQuery -Query $Query 29 | $Result | Should -Not -BeNullOrEmpty 30 | $Result | ForEach-Object { $_.name | Should -BeLike 'lm*' } 31 | } 32 | } 33 | 34 | AfterAll { 35 | Disconnect-LMAccount 36 | } 37 | } -------------------------------------------------------------------------------- /Tests/LMDeviceGroup.Tests.ps1: -------------------------------------------------------------------------------- 1 | Describe 'DeviceGroup Testing New/Get/Set/Remove' { 2 | BeforeAll { 3 | Import-Module $Module -Force 4 | Connect-LMAccount -AccessId $AccessId -AccessKey $AccessKey -AccountName $AccountName -DisableConsoleLogging -SkipCredValidation 5 | } 6 | 7 | Describe 'New-LMDeviceGroup' { 8 | It 'When given mandatory parameters, returns a created group with matching values' { 9 | $Script:NewDeviceGroup = New-LMDeviceGroup -Name "DeviceGroup.Build.Test" -Description "Testing123" -ParentGroupId 1 -Properties @{"testing" = "123" } -DisableAlerting $true -AppliesTo "false()" 10 | $Script:NewDeviceGroup | Should -Not -BeNullOrEmpty 11 | $Script:NewDeviceGroup.Description | Should -Be "Testing123" 12 | $Script:NewDeviceGroup.DisableAlerting | Should -Be $true 13 | $Script:NewDeviceGroup.AppliesTo | Should -Be "false()" 14 | $Script:NewDeviceGroup.CustomProperties.name.IndexOf("testing") | Should -Not -BeExactly -1 15 | } 16 | } 17 | 18 | Describe 'Get-LMDeviceGroup' { 19 | It 'When given no parameters, returns all devices' { 20 | $DeviceGroup = Get-LMDeviceGroup 21 | ($DeviceGroup | Measure-Object).Count | Should -BeGreaterThan 0 22 | } 23 | It 'When given an id should return that device' { 24 | $DeviceGroup = Get-LMDeviceGroup -Id $Script:NewDeviceGroup.Id 25 | ($DeviceGroup | Measure-Object).Count | Should -BeExactly 1 26 | } 27 | It 'When given a name should return specified device matching that name' { 28 | $DeviceGroup = Get-LMDeviceGroup -Name $Script:NewDeviceGroup.Name 29 | ($DeviceGroup | Measure-Object).Count | Should -BeExactly 1 30 | } 31 | It 'When given a wildcard name should return all devices matching that wildcard value' { 32 | $DeviceGroup = Get-LMDeviceGroup -Name "$(($Script:NewDeviceGroup.Name.Split(".")[0]))*" 33 | ($DeviceGroup | Measure-Object).Count | Should -BeGreaterThan 0 34 | } 35 | } 36 | 37 | Describe 'Set-LMDeviceGroup' { 38 | It 'When given a set of parameters, returns an updated group with matching values' { 39 | { $DeviceGroup = Set-LMDeviceGroup -Id $Script:NewDeviceGroup.Id -Description "Updated" -Properties @{"test" = "123"; "test2" = "456" } -ErrorAction Stop 40 | $DeviceGroup.Description | Should -Be "Updated" 41 | $DeviceGroup.CustomProperties.name.IndexOf("test") | Should -Not -BeExactly -1 42 | $DeviceGroup.CustomProperties.name.IndexOf("test2") | Should -Not -BeExactly -1 43 | } | Should -Not -Throw 44 | } 45 | } 46 | 47 | Describe 'Remove-LMDeviceGroup' { 48 | It 'When given an id, remove the group from logic monitor' { 49 | { Remove-LMDeviceGroup -Id $Script:NewDeviceGroup.Id -HardDelete $true -Confirm:$false -ErrorAction Stop } | Should -Not -Throw 50 | } 51 | } 52 | 53 | AfterAll { 54 | Disconnect-LMAccount 55 | } 56 | } -------------------------------------------------------------------------------- /Tests/LMNetScanGroup.Tests.ps1: -------------------------------------------------------------------------------- 1 | Describe 'NetScanGroup Testing New/Get/Set/Remove' { 2 | BeforeAll { 3 | Import-Module $Module -Force 4 | Connect-LMAccount -AccessId $AccessId -AccessKey $AccessKey -AccountName $AccountName -DisableConsoleLogging -SkipCredValidation 5 | } 6 | 7 | Describe 'New-LMNetScanGroup' { 8 | It 'When given mandatory parameters, returns a created NetScan group with matching values' { 9 | $Script:NewNetScanGroup = New-LMNetScanGroup -Name "NetScanGroup.Build.Test" -Description "BuildTest" 10 | $Script:NewNetScanGroup | Should -Not -BeNullOrEmpty 11 | $Script:NewNetScanGroup.Name | Should -Be "NetScanGroup.Build.Test" 12 | $Script:NewNetScanGroup.Description | Should -Be "BuildTest" 13 | } 14 | } 15 | 16 | Describe 'Get-LMNetScanGroup' { 17 | It 'When given no parameters, returns all NetScan groups' { 18 | $NetScanGroup = Get-LMNetScanGroup 19 | ($NetScanGroup | Measure-Object).Count | Should -BeGreaterThan 0 20 | } 21 | It 'When given an id should return that NetScan group' { 22 | $NetScanGroup = Get-LMNetScanGroup -Id $Script:NewNetScanGroup.Id 23 | ($NetScanGroup | Measure-Object).Count | Should -BeExactly 1 24 | } 25 | It 'When given a name should return specified NetScan group matching that name' { 26 | $NetScanGroup = Get-LMNetScanGroup -Name $Script:NewNetScanGroup.Name 27 | ($NetScanGroup | Measure-Object).Count | Should -BeExactly 1 28 | } 29 | It 'When given a wildcard name should return all NetScan groups matching that wildcard value' { 30 | $NetScanGroup = Get-LMNetScanGroup -Name "$(($Script:NewNetScanGroup.Name.Split(".")[0]))*" 31 | ($NetScanGroup | Measure-Object).Count | Should -BeGreaterThan 0 32 | } 33 | It 'When given an invalid id, should throw an error' { 34 | { Get-LMNetScanGroup -Id 0 -ErrorAction Stop } | Should -Throw 35 | } 36 | } 37 | 38 | Describe 'Set-LMNetScanGroup' { 39 | It 'When given a set of parameters, returns an updated NetScan group with matching values' { 40 | { $NetScanGroup = Set-LMNetScanGroup -Id $Script:NewNetScanGroup.Id -Description "Updated" -NewName "NetScanGroup.Build.Test.Updated" -ErrorAction Stop 41 | $NetScanGroup.Description | Should -Be "Updated" 42 | $NetScanGroup.Name | Should -Be "NetScanGroup.Build.Test.Updated" 43 | } | Should -Not -Throw 44 | } 45 | } 46 | 47 | Describe 'Remove-LMNetScanGroup' { 48 | It 'When given an id, remove the NetScan group from logic monitor' { 49 | { Remove-LMNetScanGroup -Id $Script:NewNetScanGroup.Id -ErrorAction Stop -Confirm:$false } | Should -Not -Throw 50 | } 51 | } 52 | 53 | AfterAll { 54 | Disconnect-LMAccount 55 | } 56 | } -------------------------------------------------------------------------------- /Tests/LMOpsNotes.Tests.ps1: -------------------------------------------------------------------------------- 1 | Describe 'OpsNotes Testing New/Get/Set/Remove' { 2 | BeforeAll { 3 | Import-Module $Module -Force 4 | Connect-LMAccount -AccessId $AccessId -AccessKey $AccessKey -AccountName $AccountName -DisableConsoleLogging -SkipCredValidation 5 | } 6 | 7 | Describe 'New-LMOpsNote' { 8 | It 'When given mandatory parameters, returns a created opsnote with matching values' { 9 | $Script:TimeNow = Get-Date -UFormat %m%d%Y-%H%M 10 | $Script:NewOpsNote = New-LMOpsNote -Note "OpsNote.Build.Test: $Script:TimeNow" -Tags "OpsNote.Build.Test-$Script:TimeNow" 11 | $Script:NewOpsNote | Should -Not -BeNullOrEmpty 12 | $Script:NewOpsNote.note | Should -Be "OpsNote.Build.Test: $Script:TimeNow" 13 | $Script:NewOpsNote.tags | Should -Not -BeNullOrEmpty 14 | $Script:NewOpsNote.scopes | Should -BeNullOrEmpty 15 | 16 | } 17 | } 18 | 19 | Describe 'Get-LMOpsNote' { 20 | It 'When given no parameters, returns all opsnotes' { 21 | $OpsNote = Get-LMOpsNote 22 | ($OpsNote | Measure-Object).Count | Should -BeGreaterThan 0 23 | } 24 | It 'When given an id should return that opsnote' { 25 | $Retry = 0 26 | While (!$OpsNote -or $Retry -eq 5) { 27 | $OpsNote = Get-LMOpsNote -Id $Script:NewOpsNote.Id -ErrorAction SilentlyContinue 28 | $Retry++ 29 | } 30 | ($OpsNote | Measure-Object).Count | Should -BeExactly 1 31 | } 32 | It 'When given a tag should return specified opsnote matching that tag value' { 33 | $Retry = 0 34 | While (!$OpsNote -or $Retry -eq 5) { 35 | $OpsNote = Get-LMOpsNote -Tag $Script:NewOpsNote.Tags.name -ErrorAction SilentlyContinue 36 | $Retry++ 37 | } 38 | ($OpsNote | Measure-Object).Count | Should -BeExactly 1 39 | } 40 | It 'When given a wildcard tag should return all opsnotes matching that wildcard value' { 41 | $Retry = 0 42 | While (!$OpsNote -or $Retry -eq 5) { 43 | $OpsNote = Get-LMOpsNote -Tag "$(($Script:NewOpsNote.Tags.name.Split(".")[0]))*" -ErrorAction SilentlyContinue 44 | $Retry++ 45 | } 46 | ($OpsNote | Measure-Object).Count | Should -BeGreaterThan 0 47 | } 48 | } 49 | 50 | Describe 'Set-LMOpsNote' { 51 | It 'When given a set of parameters, returns an updated opsnote with matching values' { 52 | { $OpsNote = Set-LMOpsNote -Id $Script:NewOpsNote.Id -Note "OpsNote.Build.Test: $Script:TimeNow Updated"-ErrorAction Stop 53 | $OpsNote.Note | Should -Be "OpsNote.Build.Test: $Script:TimeNow Updated" 54 | } | Should -Not -Throw 55 | } 56 | } 57 | 58 | Describe 'Remove-LMOpsNote' { 59 | It 'When given an id, remove the opsnote from logic monitor' { 60 | { Remove-LMOpsNote -Id $Script:NewOpsNote.Id -ErrorAction Stop -Confirm:$false } | Should -Not -Throw 61 | } 62 | } 63 | 64 | AfterAll { 65 | Disconnect-LMAccount 66 | } 67 | } -------------------------------------------------------------------------------- /Tests/LMReportGroup.Tests.ps1: -------------------------------------------------------------------------------- 1 | Describe 'ReportGroup Testing New/Get/Set/Remove' { 2 | BeforeAll { 3 | Import-Module $Module -Force 4 | Connect-LMAccount -AccessId $AccessId -AccessKey $AccessKey -AccountName $AccountName -DisableConsoleLogging -SkipCredValidation 5 | } 6 | 7 | Describe 'New-LMReportGroup' { 8 | It 'When given mandatory parameters, returns a created Report group with matching values' { 9 | $Script:NewReportGroup = New-LMReportGroup -Name "ReportGroup.Build.Test" -Description "BuildTest" 10 | $Script:NewReportGroup | Should -Not -BeNullOrEmpty 11 | $Script:NewReportGroup.Name | Should -Be "ReportGroup.Build.Test" 12 | $Script:NewReportGroup.Description | Should -Be "BuildTest" 13 | } 14 | } 15 | 16 | Describe 'Get-LMReportGroup' { 17 | It 'When given no parameters, returns all Report groups' { 18 | $ReportGroup = Get-LMReportGroup 19 | ($ReportGroup | Measure-Object).Count | Should -BeGreaterThan 0 20 | } 21 | It 'When given an id should return that Report group' { 22 | $ReportGroup = Get-LMReportGroup -Id $Script:NewReportGroup.Id 23 | ($ReportGroup | Measure-Object).Count | Should -BeExactly 1 24 | } 25 | It 'When given a name should return specified Report group matching that name' { 26 | $ReportGroup = Get-LMReportGroup -Name $Script:NewReportGroup.Name 27 | ($ReportGroup | Measure-Object).Count | Should -BeExactly 1 28 | } 29 | It 'When given a wildcard name should return all Report groups matching that wildcard value' { 30 | $ReportGroup = Get-LMReportGroup -Name "$(($Script:NewReportGroup.Name.Split(".")[0]))*" 31 | ($ReportGroup | Measure-Object).Count | Should -BeGreaterThan 0 32 | } 33 | It 'When given an invalid id, should throw an error' { 34 | { Get-LMReportGroup -Id -1 -ErrorAction Stop } | Should -Throw 35 | } 36 | } 37 | 38 | Describe 'Set-LMReportGroup' { 39 | It 'When given a set of parameters, returns an updated Report group with matching values' { 40 | { $ReportGroup = Set-LMReportGroup -Id $Script:NewReportGroup.Id -Description "Updated" -NewName "ReportGroup.Build.Test.Updated" -ErrorAction Stop 41 | $ReportGroup.Description | Should -Be "Updated" 42 | $ReportGroup.Name | Should -Be "ReportGroup.Build.Test.Updated" 43 | } | Should -Not -Throw 44 | } 45 | } 46 | 47 | Describe 'Remove-LMReportGroup' { 48 | It 'When given an id, remove the Report group from logic monitor' { 49 | { Remove-LMReportGroup -Id $Script:NewReportGroup.Id -ErrorAction Stop -Confirm:$false } | Should -Not -Throw 50 | } 51 | } 52 | 53 | AfterAll { 54 | Disconnect-LMAccount 55 | } 56 | } -------------------------------------------------------------------------------- /Tests/LMWebsiteGroup.Tests.ps1: -------------------------------------------------------------------------------- 1 | Describe 'WebsiteGroup Testing New/Get/Set/Remove' { 2 | BeforeAll { 3 | Import-Module $Module -Force 4 | Connect-LMAccount -AccessId $AccessId -AccessKey $AccessKey -AccountName $AccountName -DisableConsoleLogging -SkipCredValidation 5 | } 6 | 7 | Describe 'New-LMWebsiteGroup' { 8 | It 'When given mandatory parameters, returns a created group with matching values' { 9 | $Script:NewWebsiteGroup = New-LMWebsiteGroup -Name "WebsiteGroup.Build.Test" -Description "Testing123" -ParentGroupId 1 -Properties @{"testing" = "123" } -DisableAlerting $true 10 | $Script:NewWebsiteGroup | Should -Not -BeNullOrEmpty 11 | $Script:NewWebsiteGroup.Description | Should -Be "Testing123" 12 | $Script:NewWebsiteGroup.DisableAlerting | Should -Be $true 13 | $Script:NewWebsiteGroup.Properties.name.IndexOf("testing") | Should -Not -BeExactly -1 14 | } 15 | } 16 | 17 | Describe 'Get-LMWebsiteGroup' { 18 | It 'When given no parameters, returns all groups' { 19 | $WebsiteGroup = Get-LMWebsiteGroup 20 | ($WebsiteGroup | Measure-Object).Count | Should -BeGreaterThan 0 21 | } 22 | It 'When given an id should return that group' { 23 | $WebsiteGroup = Get-LMWebsiteGroup -Id $Script:NewWebsiteGroup.Id 24 | ($WebsiteGroup | Measure-Object).Count | Should -BeExactly 1 25 | } 26 | It 'When given a name should return specified group matching that name' { 27 | $WebsiteGroup = Get-LMWebsiteGroup -Name $Script:NewWebsiteGroup.Name 28 | ($WebsiteGroup | Measure-Object).Count | Should -BeExactly 1 29 | } 30 | It 'When given a wildcard name should return all groups matching that wildcard value' { 31 | $WebsiteGroup = Get-LMWebsiteGroup -Name "$(($Script:NewWebsiteGroup.Name.Split(".")[0]))*" 32 | ($WebsiteGroup | Measure-Object).Count | Should -BeGreaterThan 0 33 | } 34 | } 35 | 36 | Describe 'Set-LMWebsiteGroup' { 37 | It 'When given a set of parameters, returns an updated group with matching values' { 38 | { $WebsiteGroup = Set-LMWebsiteGroup -Id $Script:NewWebsiteGroup.Id -Description "Updated" -Properties @{"test" = "123"; "test2" = "456" } -ErrorAction Stop 39 | $WebsiteGroup.Description | Should -Be "Updated" 40 | $WebsiteGroup.Properties.name.IndexOf("test") | Should -Not -BeExactly -1 41 | $WebsiteGroup.Properties.name.IndexOf("test2") | Should -Not -BeExactly -1 42 | } | Should -Not -Throw 43 | } 44 | } 45 | 46 | Describe 'Remove-LMWebsiteGroup' { 47 | It 'When given an id, remove the group from logic monitor' { 48 | { Remove-LMWebsiteGroup -Id $Script:NewWebsiteGroup.Id -ErrorAction Stop -Confirm:$false } | Should -Not -Throw 49 | } 50 | } 51 | 52 | AfterAll { 53 | Disconnect-LMAccount 54 | } 55 | } --------------------------------------------------------------------------------