diff --git a/Build.ps1 b/Build.ps1 index 5a4d32a..76e7185 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -6,34 +6,35 @@ $manifestPath = "./Logic.Monitor.psd1" $publicFuncFolderPath = './Public' $ps1xmlFiles = Get-ChildItem -Path ./ -Filter *.ps1xml -foreach ($ps1xml in $ps1xmlFiles) { - [xml]$xml = Get-Content -Path $ps1xml.FullName - $null = $xml.Schemas.Add($null, 'https://raw.githubusercontent.com/PowerShell/PowerShell/master/src/Schemas/Format.xsd') - $null = $xml.Schemas.Add($null, 'https://raw.githubusercontent.com/PowerShell/PowerShell/master/src/Schemas/Types.xsd') - $xml.Validate( { throw "File '$($ps1xml.Name)' schema error: $($_.Message)" }) +Foreach ($ps1xml in $ps1xmlFiles) { + [xml]$xml = Get-Content -Path $ps1xml.FullName + $null = $xml.Schemas.Add($null, 'https://raw.githubusercontent.com/PowerShell/PowerShell/master/src/Schemas/Format.xsd') + $null = $xml.Schemas.Add($null, 'https://raw.githubusercontent.com/PowerShell/PowerShell/master/src/Schemas/Types.xsd') + $xml.Validate( { Throw "File '$($ps1xml.Name)' schema error: $($_.Message)" }) } -if (!(Get-PackageProvider | Where-Object { $_.Name -eq 'NuGet' })) { - Install-PackageProvider -Name NuGet -force | Out-Null +If (!(Get-PackageProvider | Where-Object { $_.Name -eq 'NuGet' })) { + Install-PackageProvider -Name NuGet -Force | Out-Null } -Import-PackageProvider -Name NuGet -force | Out-Null +Import-PackageProvider -Name NuGet -Force | Out-Null -if ((Get-PSRepository -Name PSGallery).InstallationPolicy -ne 'Trusted') { +If ((Get-PSRepository -Name PSGallery).InstallationPolicy -ne 'Trusted') { Set-PSRepository -Name PSGallery -InstallationPolicy Trusted } -if(!(Get-Module Microsoft.PowerShell.SecretManagement -ListAvailable)){ +If (!(Get-Module Microsoft.PowerShell.SecretManagement -ListAvailable)) { Install-Module Microsoft.PowerShell.SecretManagement -Force -Confirm:$false } -if(!(Get-Module Microsoft.PowerShell.SecretStore -ListAvailable)){ +If (!(Get-Module Microsoft.PowerShell.SecretStore -ListAvailable)) { Install-Module Microsoft.PowerShell.SecretStore -Force -Confirm:$false } $manifestContent = (Get-Content -Path $manifestPath -Raw) -replace '', $buildVersion -if ((Test-Path -Path $publicFuncFolderPath) -and ($publicFunctionNames = Get-ChildItem -Path $publicFuncFolderPath -Filter '*.ps1' | Select-Object -ExpandProperty BaseName)) { +If ((Test-Path -Path $publicFuncFolderPath) -and ($publicFunctionNames = Get-ChildItem -Path $publicFuncFolderPath -Filter '*.ps1' | Select-Object -ExpandProperty BaseName)) { $funcStrings = "'$($publicFunctionNames -join "','")'" -} else { +} +Else { $funcStrings = $null } diff --git a/Documentation/Disconnect-LMAccount.md b/Documentation/Disconnect-LMAccount.md index cdec45e..8d14fa0 100644 --- a/Documentation/Disconnect-LMAccount.md +++ b/Documentation/Disconnect-LMAccount.md @@ -13,7 +13,7 @@ Disconnect from a previously connected LM portal ## SYNTAX ``` -Disconnect-LMAccount +Disconnect-LMAccount [] ``` ## DESCRIPTION @@ -29,6 +29,9 @@ Disconnect-LMAccount ## PARAMETERS +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + ## INPUTS ### None. You cannot pipe objects to this command. diff --git a/Documentation/Get-LMAccessGroup.md b/Documentation/Get-LMAccessGroup.md index 4bf9d3e..fdafe00 100644 --- a/Documentation/Get-LMAccessGroup.md +++ b/Documentation/Get-LMAccessGroup.md @@ -55,7 +55,7 @@ Retrieves the access group with the specified name. ### EXAMPLE 3 ``` -Get-LMAccessGroup -Filter @{ Property = "Value" } +Get-LMAccessGroup -Filter "tenantId -eq 'Value'" Retrieves access groups based on the specified filter criteria. ``` diff --git a/Documentation/Get-LMAccountStatus.md b/Documentation/Get-LMAccountStatus.md index 8947090..06839ec 100644 --- a/Documentation/Get-LMAccountStatus.md +++ b/Documentation/Get-LMAccountStatus.md @@ -13,7 +13,7 @@ Retrieves the status of the LogicMonitor account. ## SYNTAX ``` -Get-LMAccountStatus +Get-LMAccountStatus [] ``` ## DESCRIPTION @@ -31,6 +31,9 @@ This example demonstrates how to use the Get-LMAccountStatus function to retriev ## PARAMETERS +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + ## INPUTS ## OUTPUTS diff --git a/Documentation/Get-LMDeviceDatasourceInstance.md b/Documentation/Get-LMDeviceDatasourceInstance.md index c6c537c..fa5bb44 100644 --- a/Documentation/Get-LMDeviceDatasourceInstance.md +++ b/Documentation/Get-LMDeviceDatasourceInstance.md @@ -8,57 +8,64 @@ schema: 2.0.0 # Get-LMDeviceDatasourceInstance ## SYNOPSIS -{{ Fill in the Synopsis }} +Retrieves instances of a LogicMonitor device datasource. ## SYNTAX ### Name-dsName ``` -Get-LMDeviceDatasourceInstance -DatasourceName -DeviceName [-Filter ] - [-BatchSize ] [-ProgressAction ] [] +Get-LMDeviceDatasourceInstance -DatasourceName -Name [-Filter ] [-BatchSize ] + [-ProgressAction ] [] ``` ### Id-dsName ``` -Get-LMDeviceDatasourceInstance -DatasourceName -DeviceId [-Filter ] - [-BatchSize ] [-ProgressAction ] [] +Get-LMDeviceDatasourceInstance -DatasourceName -Id [-Filter ] [-BatchSize ] + [-ProgressAction ] [] ``` ### Name-dsId ``` -Get-LMDeviceDatasourceInstance -DatasourceId -DeviceName [-Filter ] - [-BatchSize ] [-ProgressAction ] [] +Get-LMDeviceDatasourceInstance -DatasourceId -Name [-Filter ] [-BatchSize ] + [-ProgressAction ] [] ``` ### Id-dsId ``` -Get-LMDeviceDatasourceInstance -DatasourceId -DeviceId [-Filter ] [-BatchSize ] +Get-LMDeviceDatasourceInstance -DatasourceId -Id [-Filter ] [-BatchSize ] [-ProgressAction ] [] ``` ## DESCRIPTION -{{ Fill in the Description }} +The Get-LMDeviceDatasourceInstance function retrieves instances of a LogicMonitor device datasource based on the specified parameters. +It requires a valid API authentication and authorization. ## EXAMPLES -### Example 1 -```powershell -PS C:\> {{ Add example code here }} +### EXAMPLE 1 +``` +Get-LMDeviceDatasourceInstance -DatasourceName "CPU" -Name "Server01" -BatchSize 500 +Retrieves instances of the "CPU" datasource for the device named "Server01" with a batch size of 500. ``` -{{ Add example description here }} +### EXAMPLE 2 +``` +Get-LMDeviceDatasourceInstance -DatasourceId 1234 -Id 5678 +Retrieves instances of the datasource with ID 1234 for the device with ID 5678. +``` ## PARAMETERS -### -BatchSize -{{ Fill BatchSize Description }} +### -DatasourceName +Specifies the name of the datasource. +This parameter is mandatory when using the 'Id-dsName' or 'Name-dsName' parameter sets. ```yaml -Type: Int32 -Parameter Sets: (All) +Type: String +Parameter Sets: Name-dsName, Id-dsName Aliases: -Required: False +Required: True Position: Named Default value: None Accept pipeline input: False @@ -66,7 +73,8 @@ Accept wildcard characters: False ``` ### -DatasourceId -{{ Fill DatasourceId Description }} +Specifies the ID of the datasource. +This parameter is mandatory when using the 'Id-dsId' or 'Name-dsId' parameter sets. ```yaml Type: Int32 @@ -75,33 +83,37 @@ Aliases: Required: True Position: Named -Default value: None +Default value: 0 Accept pipeline input: False Accept wildcard characters: False ``` -### -DatasourceName -{{ Fill DatasourceName Description }} +### -Id +Specifies the ID of the device. +This parameter is mandatory when using the 'Id-dsId' or 'Id-dsName' parameter sets. +It can also be specified using the 'DeviceId' alias. ```yaml -Type: String -Parameter Sets: Name-dsName, Id-dsName -Aliases: +Type: Int32 +Parameter Sets: Id-dsName, Id-dsId +Aliases: DeviceId Required: True Position: Named -Default value: None +Default value: 0 Accept pipeline input: False Accept wildcard characters: False ``` -### -DeviceId -{{ Fill DeviceId Description }} +### -Name +Specifies the name of the device. +This parameter is mandatory when using the 'Name-dsName' or 'Name-dsId' parameter sets. +It can also be specified using the 'DeviceName' alias. ```yaml -Type: Int32 -Parameter Sets: Id-dsName, Id-dsId -Aliases: Id +Type: String +Parameter Sets: Name-dsName, Name-dsId +Aliases: DeviceName Required: True Position: Named @@ -110,32 +122,34 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -DeviceName -{{ Fill DeviceName Description }} +### -Filter +Specifies additional filters to apply to the instances. +This parameter accepts an object representing the filter criteria. ```yaml -Type: String -Parameter Sets: Name-dsName, Name-dsId -Aliases: Name +Type: Object +Parameter Sets: (All) +Aliases: -Required: True +Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` -### -Filter -{{ Fill Filter Description }} +### -BatchSize +Specifies the number of instances to retrieve per batch. +The default value is 1000. ```yaml -Type: Object +Type: Int32 Parameter Sets: (All) Aliases: Required: False Position: Named -Default value: None +Default value: 1000 Accept pipeline input: False Accept wildcard characters: False ``` @@ -160,10 +174,10 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## INPUTS -### None ## OUTPUTS -### System.Object ## NOTES +This function requires a valid API authentication and authorization. +Use Connect-LMAccount to log in before running any commands. ## RELATED LINKS diff --git a/Documentation/Get-LMDeviceDatasourceInstanceAlertRecipients.md b/Documentation/Get-LMDeviceDatasourceInstanceAlertRecipients.md new file mode 100644 index 0000000..84ca7f0 --- /dev/null +++ b/Documentation/Get-LMDeviceDatasourceInstanceAlertRecipients.md @@ -0,0 +1,183 @@ +--- +external help file: Logic.Monitor-help.xml +Module Name: Logic.Monitor +online version: +schema: 2.0.0 +--- + +# Get-LMDeviceDatasourceInstanceAlertRecipients + +## SYNOPSIS +Retrieves the alert recipients for a specific data point in a LogicMonitor device datasource instance. + +## SYNTAX + +### Name-dsName +``` +Get-LMDeviceDatasourceInstanceAlertRecipients -DatasourceName -Name -InstanceName + -DataPointName [-ProgressAction ] [] +``` + +### Id-dsName +``` +Get-LMDeviceDatasourceInstanceAlertRecipients -DatasourceName -Id -InstanceName + -DataPointName [-ProgressAction ] [] +``` + +### Name-dsId +``` +Get-LMDeviceDatasourceInstanceAlertRecipients -DatasourceId -Name -InstanceName + -DataPointName [-ProgressAction ] [] +``` + +### Id-dsId +``` +Get-LMDeviceDatasourceInstanceAlertRecipients -DatasourceId -Id -InstanceName + -DataPointName [-ProgressAction ] [] +``` + +## DESCRIPTION +The Get-LMDeviceDatasourceInstanceAlertRecipients function retrieves the alert recipients for a specific data point in a LogicMonitor device datasource instance. +It requires valid API credentials and a logged-in session. + +## EXAMPLES + +### EXAMPLE 1 +``` +Get-LMDeviceDatasourceInstanceAlertRecipients -DatasourceName "Ping-" -Name "Server01" -InstanceName "Instance01" -DataPointName "PingLossPercent" +``` + +Retrieves the alert recipients for the "PingLossPercent" data point in the "CPU" datasource instance of the "Server01" device. + +### EXAMPLE 2 +``` +Get-LMDeviceDatasourceInstanceAlertRecipients -DatasourceId 123 -Id 456 -InstanceName "Instance01" -DataPointName "PingLossPercent" +``` + +Retrieves the alert recipients for the "PingLossPercent" data point in the datasource instance with ID 123 of the device with ID 456. + +## PARAMETERS + +### -DatasourceName +Specifies the name of the datasource. +This parameter is mandatory when using the 'Id-dsName' or 'Name-dsName' parameter sets. + +```yaml +Type: String +Parameter Sets: Name-dsName, Id-dsName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DatasourceId +Specifies the ID of the datasource. +This parameter is mandatory when using the 'Id-dsId' or 'Name-dsId' parameter sets. + +```yaml +Type: Int32 +Parameter Sets: Name-dsId, Id-dsId +Aliases: + +Required: True +Position: Named +Default value: 0 +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Id +Specifies the ID of the device. +This parameter is mandatory when using the 'Id-dsId' or 'Id-dsName' parameter sets. +It can also be specified using the 'DeviceId' alias. + +```yaml +Type: Int32 +Parameter Sets: Id-dsName, Id-dsId +Aliases: DeviceId + +Required: True +Position: Named +Default value: 0 +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Specifies the name of the device. +This parameter is mandatory when using the 'Name-dsName' or 'Name-dsId' parameter sets. +It can also be specified using the 'DeviceName' alias. + +```yaml +Type: String +Parameter Sets: Name-dsName, Name-dsId +Aliases: DeviceName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InstanceName +Specifies the name of the datasource instance. +This parameter is mandatory. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DataPointName +Specifies the name of the data point. +This parameter is mandatory. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS diff --git a/Documentation/Get-LMDeviceDatasourceInstanceAlertSetting.md b/Documentation/Get-LMDeviceDatasourceInstanceAlertSetting.md index 289cd77..fe9baa1 100644 --- a/Documentation/Get-LMDeviceDatasourceInstanceAlertSetting.md +++ b/Documentation/Get-LMDeviceDatasourceInstanceAlertSetting.md @@ -8,7 +8,7 @@ schema: 2.0.0 # Get-LMDeviceDatasourceInstanceAlertSetting ## SYNOPSIS -{{ Fill in the Synopsis }} +Retrieves the alert settings for a specific LogicMonitor device datasource instance. ## SYNTAX @@ -37,28 +37,37 @@ Get-LMDeviceDatasourceInstanceAlertSetting -DatasourceId -Id -In ``` ## DESCRIPTION -{{ Fill in the Description }} +The Get-LMDeviceDatasourceInstanceAlertSetting function retrieves the alert settings for a specific LogicMonitor device datasource instance. +It requires the device name or ID, datasource name or ID, and instance name as input parameters. +Optionally, you can also provide a filter to narrow down the results. +The function returns an array of alert settings for the specified instance. ## EXAMPLES -### Example 1 -```powershell -PS C:\> {{ Add example code here }} +### EXAMPLE 1 +``` +Get-LMDeviceDatasourceInstanceAlertSetting -Name "MyDevice" -DatasourceName "MyDatasource" -InstanceName "MyInstance" +Retrieves the alert settings for the instance named "MyInstance" of the datasource "MyDatasource" on the device named "MyDevice". ``` -{{ Add example description here }} +### EXAMPLE 2 +``` +Get-LMDeviceDatasourceInstanceAlertSetting -Id 123 -DatasourceId 456 -InstanceName "MyInstance" -Filter "Property -eq 'value'" +Retrieves the alert settings for the instance named "MyInstance" of the datasource with ID 456 on the device with ID 123, applying the specified filter. +``` ## PARAMETERS -### -BatchSize -{{ Fill BatchSize Description }} +### -DatasourceName +Specifies the name of the datasource. +This parameter is mandatory when using the 'Id-dsName' or 'Name-dsName' parameter set. ```yaml -Type: Int32 -Parameter Sets: (All) +Type: String +Parameter Sets: Name-dsName, Id-dsName Aliases: -Required: False +Required: True Position: Named Default value: None Accept pipeline input: False @@ -66,7 +75,8 @@ Accept wildcard characters: False ``` ### -DatasourceId -{{ Fill DatasourceId Description }} +Specifies the ID of the datasource. +This parameter is mandatory when using the 'Id-dsId' or 'Name-dsId' parameter set. ```yaml Type: Int32 @@ -75,47 +85,52 @@ Aliases: Required: True Position: Named -Default value: None +Default value: 0 Accept pipeline input: False Accept wildcard characters: False ``` -### -DatasourceName -{{ Fill DatasourceName Description }} +### -Id +Specifies the ID of the device. +This parameter is mandatory when using the 'Id-dsId' or 'Id-dsName' parameter set. +This parameter can also be specified using the 'DeviceId' alias. ```yaml -Type: String -Parameter Sets: Name-dsName, Id-dsName -Aliases: +Type: Int32 +Parameter Sets: Id-dsName, Id-dsId +Aliases: DeviceId Required: True Position: Named -Default value: None +Default value: 0 Accept pipeline input: False Accept wildcard characters: False ``` -### -Filter -{{ Fill Filter Description }} +### -Name +Specifies the name of the device. +This parameter is mandatory when using the 'Name-dsName' or 'Name-dsId' parameter set. +This parameter can also be specified using the 'DeviceName' alias. ```yaml -Type: Object -Parameter Sets: (All) -Aliases: +Type: String +Parameter Sets: Name-dsName, Name-dsId +Aliases: DeviceName -Required: False +Required: True Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` -### -Id -{{ Fill Id Description }} +### -InstanceName +Specifies the name of the instance for which to retrieve the alert settings. +This parameter is mandatory. ```yaml -Type: Int32 -Parameter Sets: Id-dsName, Id-dsId +Type: String +Parameter Sets: (All) Aliases: Required: True @@ -125,32 +140,35 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -InstanceName -{{ Fill InstanceName Description }} +### -Filter +Specifies a filter to narrow down the results. +This parameter is optional. ```yaml -Type: String +Type: Object Parameter Sets: (All) Aliases: -Required: True +Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` -### -Name -{{ Fill Name Description }} +### -BatchSize +Specifies the number of results to retrieve per batch. +The default value is 1000. +This parameter is optional. ```yaml -Type: String -Parameter Sets: Name-dsName, Name-dsId +Type: Int32 +Parameter Sets: (All) Aliases: -Required: True +Required: False Position: Named -Default value: None +Default value: 1000 Accept pipeline input: False Accept wildcard characters: False ``` @@ -175,10 +193,10 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## INPUTS -### None ## OUTPUTS -### System.Object ## NOTES +This function requires a valid LogicMonitor API authentication. +Make sure you are logged in before running any commands by using the Connect-LMAccount function. ## RELATED LINKS diff --git a/Documentation/Get-LMDeviceDatasourceInstanceGroup.md b/Documentation/Get-LMDeviceDatasourceInstanceGroup.md index 85941a0..423e8cf 100644 --- a/Documentation/Get-LMDeviceDatasourceInstanceGroup.md +++ b/Documentation/Get-LMDeviceDatasourceInstanceGroup.md @@ -143,7 +143,7 @@ Accept wildcard characters: False ```yaml Type: Int32 Parameter Sets: Id-dsName, Id-dsId, Id-HdsId -Aliases: +Aliases: DeviceId Required: True Position: Named @@ -158,7 +158,7 @@ Accept wildcard characters: False ```yaml Type: String Parameter Sets: Name-dsName, Name-dsId, Name-HdsId -Aliases: +Aliases: DeviceName Required: True Position: Named diff --git a/Documentation/Get-LMDeviceDatasourceList.md b/Documentation/Get-LMDeviceDatasourceList.md index cbaefc8..47ef211 100644 --- a/Documentation/Get-LMDeviceDatasourceList.md +++ b/Documentation/Get-LMDeviceDatasourceList.md @@ -74,7 +74,7 @@ Accept wildcard characters: False ```yaml Type: Int32 Parameter Sets: Id -Aliases: +Aliases: DeviceId Required: True Position: Named @@ -89,7 +89,7 @@ Accept wildcard characters: False ```yaml Type: String Parameter Sets: Name -Aliases: +Aliases: DeviceName Required: False Position: Named diff --git a/Documentation/New-LMAccessGroup.md b/Documentation/New-LMAccessGroup.md new file mode 100644 index 0000000..df55514 --- /dev/null +++ b/Documentation/New-LMAccessGroup.md @@ -0,0 +1,107 @@ +--- +external help file: Logic.Monitor-help.xml +Module Name: Logic.Monitor +online version: +schema: 2.0.0 +--- + +# New-LMAccessGroup + +## SYNOPSIS +Creates a new LogicMonitor access group. + +## SYNTAX + +``` +New-LMAccessGroup [-Name] [[-Description] ] [[-Tenant] ] + [-ProgressAction ] [] +``` + +## DESCRIPTION +The New-LMAccessGroup function is used to create a new access group in LogicMonitor. +An access group is a collection of users with similar permissions and access rights for managing modules in the LM exchange and my module toolbox. + +## EXAMPLES + +### EXAMPLE 1 +``` +New-LMAccessGroup -Name "Group1" -Description "Access group for administrators" -Tenant "12345" +``` + +This example creates a new access group named "Group1" with the description "Access group for administrators" and assigns it to the tenant with ID "12345". + +## PARAMETERS + +### -Name +The name of the access group. +This parameter is mandatory. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Description +The description of the access group. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tenant +The ID of the tenant to which the access group belongs. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES +For this function to work, you need to be logged in and have valid API credentials. +Use the Connect-LMAccount function to log in before running any commands. + +## RELATED LINKS diff --git a/Documentation/New-LMDeviceDatasourceInstance.md b/Documentation/New-LMDeviceDatasourceInstance.md index 54a775b..ad29e0a 100644 --- a/Documentation/New-LMDeviceDatasourceInstance.md +++ b/Documentation/New-LMDeviceDatasourceInstance.md @@ -220,7 +220,7 @@ Mandatory when using the 'Id-dsId' or 'Id-dsName' parameter sets. ```yaml Type: Int32 Parameter Sets: Id-dsName, Id-dsId -Aliases: +Aliases: DeviceId Required: True Position: Named @@ -236,7 +236,7 @@ Mandatory when using the 'Name-dsName' or 'Name-dsId' parameter sets. ```yaml Type: String Parameter Sets: Name-dsName, Name-dsId -Aliases: +Aliases: DeviceName Required: True Position: Named diff --git a/Documentation/New-LMDeviceDatasourceInstanceGroup.md b/Documentation/New-LMDeviceDatasourceInstanceGroup.md index 7b5c3fd..78a6976 100644 --- a/Documentation/New-LMDeviceDatasourceInstanceGroup.md +++ b/Documentation/New-LMDeviceDatasourceInstanceGroup.md @@ -126,7 +126,7 @@ This parameter is mandatory when using the 'Id-dsId' or 'Id-dsName' parameter se ```yaml Type: Int32 Parameter Sets: Id-dsName, Id-dsId -Aliases: +Aliases: DeviceId Required: True Position: Named @@ -142,7 +142,7 @@ This parameter is mandatory when using the 'Name-dsName' or 'Name-dsId' paramete ```yaml Type: String Parameter Sets: Name-dsName, Name-dsId -Aliases: +Aliases: DeviceName Required: True Position: Named diff --git a/Documentation/Remove-LMAccessGroup.md b/Documentation/Remove-LMAccessGroup.md new file mode 100644 index 0000000..9d35577 --- /dev/null +++ b/Documentation/Remove-LMAccessGroup.md @@ -0,0 +1,136 @@ +--- +external help file: Logic.Monitor-help.xml +Module Name: Logic.Monitor +online version: +schema: 2.0.0 +--- + +# Remove-LMAccessGroup + +## SYNOPSIS +Removes a LogicMonitor access group. + +## SYNTAX + +### Id (Default) +``` +Remove-LMAccessGroup -Id [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +### Name +``` +Remove-LMAccessGroup -Name [-ProgressAction ] [-WhatIf] [-Confirm] + [] +``` + +## DESCRIPTION +The Remove-LMAccessGroup function removes a LogicMonitor access group based on the specified ID or name. + +## EXAMPLES + +### EXAMPLE 1 +``` +Remove-LMAccessGroup -Id 123 +Removes the access group with the ID 123. +``` + +### EXAMPLE 2 +``` +Remove-LMAccessGroup -Name "MyAccessGroup" +Removes the access group with the name "MyAccessGroup". +``` + +## PARAMETERS + +### -Id +The ID of the access group to remove. +This parameter is mandatory when using the 'Id' parameter set. + +```yaml +Type: Int32 +Parameter Sets: Id +Aliases: + +Required: True +Position: Named +Default value: 0 +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Name +The name of the access group to remove. +This parameter is mandatory when using the 'Name' parameter set. + +```yaml +Type: String +Parameter Sets: Name +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### None. +## OUTPUTS + +### System.Management.Automation.PSCustomObject +## NOTES +This function requires a valid LogicMonitor API authentication. +Make sure to log in using Connect-LMAccount before running this command. + +## RELATED LINKS diff --git a/Documentation/Remove-LMDeviceDatasourceInstance.md b/Documentation/Remove-LMDeviceDatasourceInstance.md index 5b5c9b3..508e8da 100644 --- a/Documentation/Remove-LMDeviceDatasourceInstance.md +++ b/Documentation/Remove-LMDeviceDatasourceInstance.md @@ -15,25 +15,25 @@ Removes a device datasource instance from Logic Monitor. ### Name-dsName ``` Remove-LMDeviceDatasourceInstance -DatasourceName -DeviceName [-WildValue ] - [-ProgressAction ] [-WhatIf] [-Confirm] [] + [-InstanceId ] [-ProgressAction ] [-WhatIf] [-Confirm] [] ``` ### Id-dsName ``` Remove-LMDeviceDatasourceInstance -DatasourceName -DeviceId [-WildValue ] - [-ProgressAction ] [-WhatIf] [-Confirm] [] + [-InstanceId ] [-ProgressAction ] [-WhatIf] [-Confirm] [] ``` ### Name-dsId ``` Remove-LMDeviceDatasourceInstance -DatasourceId -DeviceName [-WildValue ] - [-ProgressAction ] [-WhatIf] [-Confirm] [] + [-InstanceId ] [-ProgressAction ] [-WhatIf] [-Confirm] [] ``` ### Id-dsId ``` Remove-LMDeviceDatasourceInstance -DatasourceId -DeviceId [-WildValue ] - [-ProgressAction ] [-WhatIf] [-Confirm] [] + [-InstanceId ] [-ProgressAction ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -44,13 +44,13 @@ It requires valid API credentials and the user must be logged in before running ### EXAMPLE 1 ``` -Remove-LMDeviceDatasourceInstance -DeviceName "MyDevice" -DatasourceName "MyDatasource" -WildValue "12345" +Remove-LMDeviceDatasourceInstance -Name "MyDevice" -DatasourceName "MyDatasource" -WildValue "12345" Removes the device datasource instance with the specified device name, datasource name, and wildcard value. ``` ### EXAMPLE 2 ``` -Remove-LMDeviceDatasourceInstance -DeviceId 123 -DatasourceId 456 -WildValue "67890" +Remove-LMDeviceDatasourceInstance -Id 123 -DatasourceId 456 -WildValue "67890" Removes the device datasource instance with the specified device ID, datasource ID, and wildcard value. ``` @@ -101,8 +101,7 @@ Accept wildcard characters: False ``` ### -DeviceId -Specifies the ID of the device. -This parameter is mandatory when using the 'Id-dsId' or 'Id-dsName' parameter sets. +{{ Fill DeviceId Description }} ```yaml Type: Int32 @@ -129,8 +128,7 @@ Accept wildcard characters: False ``` ### -DeviceName -Specifies the name of the device. -This parameter is mandatory when using the 'Name-dsName' or 'Name-dsId' parameter sets. +{{ Fill DeviceName Description }} ```yaml Type: String @@ -159,6 +157,21 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` +### -InstanceId +{{ Fill InstanceId Description }} + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: Id + +Required: False +Position: Named +Default value: 0 +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + ### -WhatIf Shows what would happen if the cmdlet runs. The cmdlet is not run. diff --git a/Documentation/Remove-LMDeviceDatasourceInstanceGroup.md b/Documentation/Remove-LMDeviceDatasourceInstanceGroup.md new file mode 100644 index 0000000..ce98f63 --- /dev/null +++ b/Documentation/Remove-LMDeviceDatasourceInstanceGroup.md @@ -0,0 +1,197 @@ +--- +external help file: Logic.Monitor-help.xml +Module Name: Logic.Monitor +online version: +schema: 2.0.0 +--- + +# Remove-LMDeviceDatasourceInstanceGroup + +## SYNOPSIS +Removes a LogicMonitor device datasource instance group. + +## SYNTAX + +### Name-dsName +``` +Remove-LMDeviceDatasourceInstanceGroup -DatasourceName -Name -InstanceGroupName + [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +### Id-dsName +``` +Remove-LMDeviceDatasourceInstanceGroup -DatasourceName -Id -InstanceGroupName + [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +### Name-dsId +``` +Remove-LMDeviceDatasourceInstanceGroup -DatasourceId -Name -InstanceGroupName + [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +### Id-dsId +``` +Remove-LMDeviceDatasourceInstanceGroup -DatasourceId -Id -InstanceGroupName + [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +The Remove-LMDeviceDatasourceInstanceGroup function removes a LogicMonitor device datasource instance group based on the provided parameters. +It requires valid API credentials and a logged-in session. + +## EXAMPLES + +### EXAMPLE 1 +``` +Remove-LMDeviceDatasourceInstanceGroup -DatasourceName "CPU" -Name "Server01" -InstanceGroupName "Group1" +Removes the instance group named "Group1" associated with the "CPU" datasource on the device named "Server01". +``` + +### EXAMPLE 2 +``` +Remove-LMDeviceDatasourceInstanceGroup -DatasourceId 123 -Id 456 -InstanceGroupName "Group2" +Removes the instance group named "Group2" associated with the datasource ID 123 on the device ID 456. +``` + +## PARAMETERS + +### -DatasourceName +Specifies the name of the datasource associated with the instance group. +This parameter is mandatory when using the 'Id-dsName' or 'Name-dsName' parameter sets. + +```yaml +Type: String +Parameter Sets: Name-dsName, Id-dsName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DatasourceId +Specifies the ID of the datasource associated with the instance group. +This parameter is mandatory when using the 'Id-dsId' or 'Name-dsId' parameter sets. + +```yaml +Type: Int32 +Parameter Sets: Name-dsId, Id-dsId +Aliases: + +Required: True +Position: Named +Default value: 0 +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Id +Specifies the ID of the device associated with the instance group. +This parameter is mandatory when using the 'Id-dsId' or 'Id-dsName' parameter sets. +This parameter can also be specified using the 'DeviceId' alias. + +```yaml +Type: Int32 +Parameter Sets: Id-dsName, Id-dsId +Aliases: DeviceId + +Required: True +Position: Named +Default value: 0 +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Specifies the name of the device associated with the instance group. +This parameter is mandatory when using the 'Name-dsName' or 'Name-dsId' parameter sets. +This parameter can also be specified using the 'DeviceName' alias. + +```yaml +Type: String +Parameter Sets: Name-dsName, Name-dsId +Aliases: DeviceName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InstanceGroupName +Specifies the name of the instance group to be removed. +This parameter is mandatory. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### None. You cannot pipe objects to this function. +## OUTPUTS + +## NOTES + +## RELATED LINKS diff --git a/Documentation/Set-LMAccessGroup.md b/Documentation/Set-LMAccessGroup.md new file mode 100644 index 0000000..ddd76bd --- /dev/null +++ b/Documentation/Set-LMAccessGroup.md @@ -0,0 +1,151 @@ +--- +external help file: Logic.Monitor-help.xml +Module Name: Logic.Monitor +online version: +schema: 2.0.0 +--- + +# Set-LMAccessGroup + +## SYNOPSIS +Sets the properties of a LogicMonitor access group. + +## SYNTAX + +### Id +``` +Set-LMAccessGroup [-Id ] [-NewName ] [-Description ] [-Tenant ] + [-ProgressAction ] [] +``` + +### Name +``` +Set-LMAccessGroup [-Name ] [-NewName ] [-Description ] [-Tenant ] + [-ProgressAction ] [] +``` + +## DESCRIPTION +The Set-LMAccessGroup function is used to set the properties of a LogicMonitor access group. +It allows you to specify the access group either by its ID or by its name. +You can set the new name, description, and tenant ID for the access group. + +## EXAMPLES + +### EXAMPLE 1 +``` +Set-LMAccessGroup -Id 123 -NewName "New Access Group" -Description "This is a new access group" -Tenant "abc123" +Sets the properties of the access group with ID 123. The new name is set to "New Access Group", the description is set to "This is a new access group", and the tenant ID is set to "abc123". +``` + +### EXAMPLE 2 +``` +Set-LMAccessGroup -Name "Old Access Group" -NewName "New Access Group" -Description "This is a new access group" -Tenant "abc123" +Sets the properties of the access group with name "Old Access Group". The new name is set to "New Access Group", the description is set to "This is a new access group", and the tenant ID is set to "abc123". +``` + +## PARAMETERS + +### -Id +Specifies the ID of the access group. +This parameter is used when you want to set the properties of the access group by its ID. + +```yaml +Type: Int32 +Parameter Sets: Id +Aliases: + +Required: False +Position: Named +Default value: 0 +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Name +Specifies the name of the access group. +This parameter is used when you want to set the properties of the access group by its name. + +```yaml +Type: String +Parameter Sets: Name +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NewName +Specifies the new name for the access group. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Description +Specifies the new description for the access group. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tenant +Specifies the tenant ID for the access group. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES +This function requires you to be logged in and have valid API credentials. +Use the Connect-LMAccount function to log in before running this command. + +## RELATED LINKS diff --git a/Documentation/Set-LMDeviceDatasourceInstance.md b/Documentation/Set-LMDeviceDatasourceInstance.md index 91cb50d..49fb478 100644 --- a/Documentation/Set-LMDeviceDatasourceInstance.md +++ b/Documentation/Set-LMDeviceDatasourceInstance.md @@ -8,7 +8,7 @@ schema: 2.0.0 # Set-LMDeviceDatasourceInstance ## SYNOPSIS -{{ Fill in the Synopsis }} +Sets the properties of a LogicMonitor device datasource instance. ## SYNTAX @@ -16,7 +16,7 @@ schema: 2.0.0 ``` Set-LMDeviceDatasourceInstance [-DisplayName ] [-WildValue ] [-WildValue2 ] [-Description ] [-Properties ] [-StopMonitoring ] [-DisableAlerting ] - [-InstanceGroupId ] -InstanceId -DatasourceName -DeviceName + [-InstanceGroupId ] -InstanceId -DatasourceName -Name [-ProgressAction ] [-WhatIf] [-Confirm] [] ``` @@ -24,7 +24,7 @@ Set-LMDeviceDatasourceInstance [-DisplayName ] [-WildValue ] [-W ``` Set-LMDeviceDatasourceInstance [-DisplayName ] [-WildValue ] [-WildValue2 ] [-Description ] [-Properties ] [-StopMonitoring ] [-DisableAlerting ] - [-InstanceGroupId ] -InstanceId -DatasourceName -DeviceId + [-InstanceGroupId ] -InstanceId -DatasourceName -Id [-ProgressAction ] [-WhatIf] [-Confirm] [] ``` @@ -32,7 +32,7 @@ Set-LMDeviceDatasourceInstance [-DisplayName ] [-WildValue ] [-W ``` Set-LMDeviceDatasourceInstance [-DisplayName ] [-WildValue ] [-WildValue2 ] [-Description ] [-Properties ] [-StopMonitoring ] [-DisableAlerting ] - [-InstanceGroupId ] -InstanceId -DatasourceId -DeviceName + [-InstanceGroupId ] -InstanceId -DatasourceId -Name [-ProgressAction ] [-WhatIf] [-Confirm] [] ``` @@ -40,31 +40,39 @@ Set-LMDeviceDatasourceInstance [-DisplayName ] [-WildValue ] [-W ``` Set-LMDeviceDatasourceInstance [-DisplayName ] [-WildValue ] [-WildValue2 ] [-Description ] [-Properties ] [-StopMonitoring ] [-DisableAlerting ] - [-InstanceGroupId ] -InstanceId -DatasourceId -DeviceId + [-InstanceGroupId ] -InstanceId -DatasourceId -Id [-ProgressAction ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION -{{ Fill in the Description }} +The Set-LMDeviceDatasourceInstance function is used to set the properties of a LogicMonitor device datasource instance. +It allows you to update the display name, wild values, description, custom properties, monitoring and alerting settings, and instance group ID of the specified instance. ## EXAMPLES -### Example 1 -```powershell -PS C:\> {{ Add example code here }} +### EXAMPLE 1 +``` +Set-LMDeviceDatasourceInstance -InstanceId 12345 -DisplayName "New Instance Name" -Description "Updated instance description" +``` + +This example sets the display name and description of the instance with ID 12345. + +### EXAMPLE 2 +``` +Get-LMDevice -Name "MyDevice" | Set-LMDeviceDatasourceInstance -DatasourceName "MyDatasource" -DisplayName "New Instance Name" ``` -{{ Add example description here }} +This example retrieves the device with the name "MyDevice" and sets the display name of the instance associated with the datasource "MyDatasource". ## PARAMETERS -### -Confirm -Prompts you for confirmation before running the cmdlet. +### -DisplayName +Specifies the new display name for the instance. ```yaml -Type: SwitchParameter +Type: String Parameter Sets: (All) -Aliases: cf +Aliases: Required: False Position: Named @@ -73,53 +81,56 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -DatasourceId -{{ Fill DatasourceId Description }} +### -WildValue +Specifies the first wild value for the instance. ```yaml Type: String -Parameter Sets: Name-dsId +Parameter Sets: (All) Aliases: -Required: True +Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` +### -WildValue2 +Specifies the second wild value for the instance. + ```yaml Type: String -Parameter Sets: Id-dsId +Parameter Sets: (All) Aliases: -Required: True +Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` -### -DatasourceName -{{ Fill DatasourceName Description }} +### -Description +Specifies the description for the instance. ```yaml Type: String -Parameter Sets: Name-dsName, Id-dsName +Parameter Sets: (All) Aliases: -Required: True +Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` -### -Description -{{ Fill Description Description }} +### -Properties +Specifies a hashtable of custom properties for the instance. ```yaml -Type: String +Type: Hashtable Parameter Sets: (All) Aliases: @@ -130,161 +141,167 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -DeviceId -{{ Fill DeviceId Description }} +### -StopMonitoring +Specifies whether to stop monitoring the instance. +This parameter accepts $true or $false. ```yaml -Type: String -Parameter Sets: Id-dsName +Type: Boolean +Parameter Sets: (All) Aliases: -Required: True +Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` +### -DisableAlerting +Specifies whether to disable alerting for the instance. +This parameter accepts $true or $false. + ```yaml -Type: String -Parameter Sets: Id-dsId +Type: Boolean +Parameter Sets: (All) Aliases: -Required: True +Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` -### -DeviceName -{{ Fill DeviceName Description }} +### -InstanceGroupId +Specifies the ID of the instance group to which the instance belongs. ```yaml Type: String -Parameter Sets: Name-dsName, Name-dsId +Parameter Sets: (All) Aliases: -Required: True +Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` -### -DisableAlerting -{{ Fill DisableAlerting Description }} +### -InstanceId +Specifies the ID of the instance to update. +This parameter is mandatory and can be provided via pipeline. ```yaml -Type: Boolean +Type: String Parameter Sets: (All) Aliases: -Required: False +Required: True Position: Named Default value: None -Accept pipeline input: False +Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` -### -DisplayName -{{ Fill DisplayName Description }} +### -DatasourceName +Specifies the name of the datasource associated with the instance. +This parameter is mandatory when using the 'Name-dsName' parameter set. ```yaml Type: String -Parameter Sets: (All) +Parameter Sets: Name-dsName, Id-dsName Aliases: -Required: False +Required: True Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` -### -InstanceGroupId -{{ Fill InstanceGroupId Description }} +### -DatasourceId +Specifies the ID of the datasource associated with the instance. +This parameter is mandatory when using the 'Id-dsId' or 'Name-dsId' parameter set. ```yaml Type: String -Parameter Sets: (All) +Parameter Sets: Name-dsId Aliases: -Required: False +Required: True Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` -### -InstanceId -{{ Fill InstanceId Description }} - ```yaml Type: String -Parameter Sets: (All) -Aliases: Id +Parameter Sets: Id-dsId +Aliases: Required: True Position: Named Default value: None -Accept pipeline input: True (ByPropertyName) +Accept pipeline input: False Accept wildcard characters: False ``` -### -Properties -{{ Fill Properties Description }} +### -Id +Specifies the ID of the device associated with the instance. +This parameter is mandatory when using the 'Id-dsId' or 'Id-dsName' parameter set. +This parameter can also be specified using the 'DeviceId' alias. ```yaml -Type: Hashtable -Parameter Sets: (All) -Aliases: +Type: String +Parameter Sets: Id-dsName +Aliases: DeviceId -Required: False +Required: True Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` -### -StopMonitoring -{{ Fill StopMonitoring Description }} - ```yaml -Type: Boolean -Parameter Sets: (All) -Aliases: +Type: String +Parameter Sets: Id-dsId +Aliases: DeviceId -Required: False +Required: True Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` -### -WhatIf -Shows what would happen if the cmdlet runs. -The cmdlet is not run. +### -Name +Specifies the name of the device associated with the instance. +This parameter is mandatory when using the 'Name-dsName' or 'Name-dsId' parameter set. +This parameter can also be specified using the 'DeviceName' alias. ```yaml -Type: SwitchParameter -Parameter Sets: (All) -Aliases: wi +Type: String +Parameter Sets: Name-dsName, Name-dsId +Aliases: DeviceName -Required: False +Required: True Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` -### -WildValue -{{ Fill WildValue Description }} +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. ```yaml -Type: String +Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: wi Required: False Position: Named @@ -293,13 +310,13 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -WildValue2 -{{ Fill WildValue2 Description }} +### -Confirm +Prompts you for confirmation before running the cmdlet. ```yaml -Type: String +Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: cf Required: False Position: Named @@ -328,10 +345,8 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## INPUTS -### System.String ## OUTPUTS -### System.Object ## NOTES ## RELATED LINKS diff --git a/EXAMPLES.md b/EXAMPLES.md index 43f1e2b..b05eba4 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -192,7 +192,7 @@ Set-LMDevice -Name "192.168.1.1" -DisplayName $deviceProperty #Method Three #Using Get-LMDeviceGroupDevices to retrieve a list of devices and loop through each and set the sysname value to the displayname $devices = Get-LMDeviceGroupDevices -Name "Cambium Wireless" -foreach ($dev in $devices) { +Foreach ($dev in $devices) { $deviceProperty = ($dev.systemProperties[$dev.systemProperties.name.IndexOf("system.sysname")].value) if($deviceProperty -and $dev.systemProperties.name.IndexOf("system.sysname") -ne -1){ Set-LMDevice -Id $dev.id -DisplayName $deviceProperty @@ -209,7 +209,7 @@ $processedDeviceList = @() $devices = Get-LMDeviceGroupDevices -Id "23" #Loop through each device and check for presence of property -foreach ($dev in $devices) { +Foreach ($dev in $devices) { $propName = "test.prop" $propValue = "1234" $currentPropValue = ($dev.customProperties[$dev.customProperties.name.IndexOf($propName)].value) diff --git a/Logic.Monitor.Format.ps1xml b/Logic.Monitor.Format.ps1xml index 99bfdbd..7b1d08f 100644 --- a/Logic.Monitor.Format.ps1xml +++ b/Logic.Monitor.Format.ps1xml @@ -54,6 +54,47 @@ + + + LogicMonitorAccessGroup + + LogicMonitor.AccessGroup + + + + + + + + + + + + + + + + + + + + + id + + + name + + + tenantid + + + description + + + + + + LogicMonitorModuleUpdateHistory diff --git a/Logic.Monitor.psd1 b/Logic.Monitor.psd1 index 6643dbe..9dc8b4a 100644 --- a/Logic.Monitor.psd1 +++ b/Logic.Monitor.psd1 @@ -51,7 +51,7 @@ # ProcessorArchitecture = '' # Modules that must be imported into the global environment prior to importing this module - RequiredModules = @('Microsoft.PowerShell.SecretManagement','Microsoft.PowerShell.SecretStore') + RequiredModules = @('Microsoft.PowerShell.SecretManagement', 'Microsoft.PowerShell.SecretStore') # Assemblies that must be loaded prior to importing this module RequiredAssemblies = @() diff --git a/Private/Add-ObjectTypeInfo.ps1 b/Private/Add-ObjectTypeInfo.ps1 index 72f39da..553433b 100644 --- a/Private/Add-ObjectTypeInfo.ps1 +++ b/Private/Add-ObjectTypeInfo.ps1 @@ -96,7 +96,7 @@ function Add-ObjectTypeInfo { http://blogs.microsoft.co.il/scriptfanatic/2012/04/13/custom-objects-default-display-in-powershell-30/ #> [CmdletBinding()] - param( + Param ( [Parameter( Mandatory = $true, Position = 0, ValueFromPipeline = $true )] @@ -121,17 +121,17 @@ function Add-ObjectTypeInfo { ) Begin { - if ($PSBoundParameters.ContainsKey('DefaultProperties')) { + If ($PSBoundParameters.ContainsKey('DefaultProperties')) { # define a subset of properties $ddps = New-Object System.Management.Automation.PSPropertySet DefaultDisplayPropertySet, $DefaultProperties $PSStandardMembers = [System.Management.Automation.PSMemberInfo[]]$ddps } } Process { - foreach ($Object in $InputObject) { + Foreach ($Object in $InputObject) { switch ($PSBoundParameters.Keys) { 'PropertyToAdd' { - foreach ($Key in $PropertyToAdd.Keys) { + Foreach ($Key in $PropertyToAdd.Keys) { #Add some noteproperties. Slightly faster than Add-Member. $Object.PSObject.Properties.Add( ( New-Object PSNoteProperty($Key, $PropertyToAdd[$Key]) ) ) } @@ -145,7 +145,7 @@ function Add-ObjectTypeInfo { Add-Member -InputObject $Object -MemberType MemberSet -Name PSStandardMembers -Value $PSStandardMembers } } - if ($Passthru) { + If ($Passthru) { $Object } } diff --git a/Private/Format-LMFilter-v1.ps1 b/Private/Format-LMFilter-v1.ps1 index 3ebaa4f..22e0975 100644 --- a/Private/Format-LMFilter-v1.ps1 +++ b/Private/Format-LMFilter-v1.ps1 @@ -24,7 +24,7 @@ System.String. The function returns a string that represents the formatted filter. .NOTES - The function does not throw any errors. If a property in the Filter parameter is not in the PropList parameter, it is simply removed from the filter. + If a property in the Filter parameter is not in the PropList parameter, it is simply removed from the filter. #> Function Format-LMFilter-v1 { [CmdletBinding()] @@ -48,7 +48,7 @@ Function Format-LMFilter-v1 { } #Create filter string from hash table and url encode - foreach ($Key in $($Filter.keys)) { + Foreach ($Key in $($Filter.keys)) { $FilterString += $Key + ":" + "`"$($Filter[$Key])`"" + "," } $FilterString = $FilterString.trimend(',') diff --git a/Private/Format-LMFilter.ps1 b/Private/Format-LMFilter.ps1 index f362f8b..d15f390 100644 --- a/Private/Format-LMFilter.ps1 +++ b/Private/Format-LMFilter.ps1 @@ -35,49 +35,49 @@ Function Format-LMFilter { Param ( [Object]$Filter, - [String[]]$PropList = @("name","id","status","severity","startEpoch","endEpoch","cleared","resourceTemplateName","monitorObjectName","customProperties","systemProperties","autoProperties","displayName") + [String[]]$PropList = @("name", "id", "status", "severity", "startEpoch", "endEpoch", "cleared", "resourceTemplateName", "monitorObjectName", "customProperties", "systemProperties", "autoProperties", "displayName") ) $FormatedFilter = "" #Keep legacy filter method for backwards compatability - If($Filter -is [hashtable]){ + If ($Filter -is [hashtable]) { $FormatedFilter = Format-LMFilter-v1 -Filter $Filter -PropList $PropList Write-Debug "Constructed Filter-v1: $FormatedFilter" Return $FormatedFilter } - Else{ + Else { #Split our filters in an array based on logical operator - $FilterArray = [regex]::Split($Filter,'(\s+-and\s+|\s+-or\s+)') + $FilterArray = [regex]::Split($Filter, '(\s+-and\s+|\s+-or\s+)') - Foreach ($Filter in $FilterArray){ - If($Filter -match '\s+-and\s+'){ + Foreach ($Filter in $FilterArray) { + If ($Filter -match '\s+-and\s+') { $FormatedFilter += "," } - ElseIf($Filter -match '\s+-or\s+'){ + Elseif ($Filter -match '\s+-or\s+') { $FormatedFilter += "||" } - Else{ - $SingleFilterArray = [regex]::Split($Filter,'(\s+-eq\s+|\s+-ne\s+|\s+-gt\s+|\s+-lt\s+|\s+-ge\s+|\s+-le\s+|\s+-contains\s+|\s+-notcontains\s+)') - If(($SingleFilterArray | Measure-Object).Count -gt 1){ - Foreach($SingleFilter in $SingleFilterArray){ - If($SingleFilter -match '(\s+-eq\s+|\s+-ne\s+|\s+-gt\s+|\s+-lt\s+|\s+-ge\s+|\s+-le\s+|\s+-contains\s+|\s+-notcontains\s+)'){ - Switch -Regex ($SingleFilter){ - '\s+-eq\s+' { $FormatedFilter += ":"} - '\s+-ne\s+' { $FormatedFilter += "!:"} - '\s+-gt\s+' { $FormatedFilter += ">"} - '\s+-lt\s+' { $FormatedFilter += "<"} - '\s+-ge\s+' { $FormatedFilter += ">:"} - '\s+-le\s+' { $FormatedFilter += "<:"} - '\s+-contains\s+' { $FormatedFilter += "~"} - '\s+-notcontains\s+' { $FormatedFilter += "!~"} - default {Write-LMHost "[ERROR]: Invalid filter syntax: $Filter" -ForegroundColor Red} + Else { + $SingleFilterArray = [regex]::Split($Filter, '(\s+-eq\s+|\s+-ne\s+|\s+-gt\s+|\s+-lt\s+|\s+-ge\s+|\s+-le\s+|\s+-contains\s+|\s+-notcontains\s+)') + If (($SingleFilterArray | Measure-Object).Count -gt 1) { + Foreach ($SingleFilter in $SingleFilterArray) { + If ($SingleFilter -match '(\s+-eq\s+|\s+-ne\s+|\s+-gt\s+|\s+-lt\s+|\s+-ge\s+|\s+-le\s+|\s+-contains\s+|\s+-notcontains\s+)') { + Switch -Regex ($SingleFilter) { + '\s+-eq\s+' { $FormatedFilter += ":" } + '\s+-ne\s+' { $FormatedFilter += "!:" } + '\s+-gt\s+' { $FormatedFilter += ">" } + '\s+-lt\s+' { $FormatedFilter += "<" } + '\s+-ge\s+' { $FormatedFilter += ">:" } + '\s+-le\s+' { $FormatedFilter += "<:" } + '\s+-contains\s+' { $FormatedFilter += "~" } + '\s+-notcontains\s+' { $FormatedFilter += "!~" } + default { Write-LMHost "[ERROR]: Invalid filter syntax: $Filter" -ForegroundColor Red } } } - Else{ - $FormatedFilter += $SingleFilter.Replace("'","`"") #replace single quotes with double quotes as reqired by LM API + Else { + $FormatedFilter += $SingleFilter.Replace("'", "`"") #replace single quotes with double quotes as reqired by LM API } } } - Else{ + Else { Write-LMHost "[ERROR]: Invalid filter syntax: $SingleFilterArray" -ForegroundColor Red } } diff --git a/Private/New-LMHeader.ps1 b/Private/New-LMHeader.ps1 index 3408b29..9437be1 100644 --- a/Private/New-LMHeader.ps1 +++ b/Private/New-LMHeader.ps1 @@ -62,24 +62,24 @@ Function New-LMHeader { $Header = New-Object "System.Collections.Generic.Dictionary[[String],[String]]" $Session = New-Object Microsoft.PowerShell.Commands.WebRequestSession - If($Auth.Type -eq "Bearer"){ + If ($Auth.Type -eq "Bearer") { $Token = [System.Net.NetworkCredential]::new("", $Auth.BearerToken).Password $Header.Add("Authorization", "Bearer $Token") } - ElseIf($Auth.Type -eq "SessionSync"){ + Elseif ($Auth.Type -eq "SessionSync") { $SessionInfo = Get-LMSession -AccountName $Auth.Portal - If($SessionInfo){ + If ($SessionInfo) { $Header.Add("Cookie", "JSESSIONID=$($SessionInfo.jSessionID)") $Session.Cookies.Add((New-Object System.Net.Cookie("JSESSIONID", $SessionInfo.jSessionID, "/", $SessionInfo.domain))) $Header.Add("X-CSRF-Token", "$($SessionInfo.token)") } - Else{ - throw "Unable to generate header details, ensure you are connected to a portal and try again." + Else { + Throw "Unable to generate header details, ensure you are connected to a portal and try again." } } - Else{ + Else { # Get current time in milliseconds... - $Epoch = [Math]::Round((New-TimeSpan -start (Get-Date -Date "1/1/1970") -end (Get-Date).ToUniversalTime()).TotalMilliseconds) + $Epoch = [Math]::Round((New-TimeSpan -Start (Get-Date -Date "1/1/1970") -End (Get-Date).ToUniversalTime()).TotalMilliseconds) # Concatenate general request details... If ($Method -eq "GET" -or $Method -eq "DELETE") { @@ -105,5 +105,5 @@ Function New-LMHeader { $Header.Add("Content-Type", $ContentType) $Header.Add("X-Version", $Version) - Return @($Header,$Session) + Return @($Header, $Session) } diff --git a/Private/New-LMRandomCred.ps1 b/Private/New-LMRandomCred.ps1 index 31b0b9b..d365a70 100644 --- a/Private/New-LMRandomCred.ps1 +++ b/Private/New-LMRandomCred.ps1 @@ -37,7 +37,7 @@ Function New-LMRandomCred { #Construct randomized password For ($i = 0 ; $i -lt $Length ; $i++) { - $Result[$i] = $SymbolSet[$Bytes[$i]%$SymbolSet.Length] + $Result[$i] = $SymbolSet[$Bytes[$i] % $SymbolSet.Length] } #Return result diff --git a/Private/Resolve-LMDebugInfo.ps1 b/Private/Resolve-LMDebugInfo.ps1 index cd1185c..c848986 100644 --- a/Private/Resolve-LMDebugInfo.ps1 +++ b/Private/Resolve-LMDebugInfo.ps1 @@ -33,6 +33,6 @@ Function Resolve-LMDebugInfo { Write-Debug "Invoked Command: $($Command.MyCommand)" Write-Debug "Bound Parameters: $($Command.BoundParameters.GetEnumerator() | ForEach-Object {"[" + $($_.Key) + ":" + $($_.Value) + "]"})" Write-Debug "Invoked URL: $Url" - If($Payload){Write-Debug "Request Payload: `n$Payload"} - Write-Debug "Request Headers: $($Headers.GetEnumerator() | ForEach-Object {"[" + $($_.Key) + ":" + $(if ($_.Value.length -gt 25) { $_.Value.substring(0, 25) + "...]" } else { $($_.Value) + "]" })})" + If ($Payload) { Write-Debug "Request Payload: `n$Payload" } + Write-Debug "Request Headers: $($Headers.GetEnumerator() | ForEach-Object {"[" + $($_.Key) + ":" + $(If ($_.Value.length -gt 25) { $_.Value.substring(0, 25) + "...]" } Else { $($_.Value) + "]" })})" } \ No newline at end of file diff --git a/Private/Resolve-LMException.ps1 b/Private/Resolve-LMException.ps1 index 79221a3..1055c61 100644 --- a/Private/Resolve-LMException.ps1 +++ b/Private/Resolve-LMException.ps1 @@ -29,13 +29,13 @@ Function Resolve-LMException { ELse { Switch ($LMException.Exception.GetType().FullName) { { "System.Net.WebException" -or "Microsoft.PowerShell.Commands.HttpResponseException" } { - Try{ + Try { $HttpException = ($LMException.ErrorDetails.Message | ConvertFrom-Json -ErrorAction SilentlyContinue).errorMessage If (!$HttpException) { $HttpException = ($LMException.ErrorDetails.Message | ConvertFrom-Json -ErrorAction Stop).message } } - Catch{ + Catch { $HttpException = $LMException.ErrorDetails.Message } $HttpStatusCode = $LMException.Exception.Response.StatusCode.value__ @@ -44,11 +44,10 @@ Function Resolve-LMException { #Write to $Error object but suppress so stack trace is not displayed Write-Error "Failed to execute web request($($HttpStatusCode)): $HttpException" -ErrorAction SilentlyContinue #Pretty print error to console - If($ErrorActionPreference -ne "SilentlyContinue"){ + If ($ErrorActionPreference -ne "SilentlyContinue") { [Console]::ForegroundColor = 'red' [Console]::Error.WriteLine("Failed to execute web request($($HttpStatusCode)): $HttpException") [Console]::ResetColor() - #throw "Failed to execute web request($($HttpStatusCode)): $HttpException" } } default { @@ -58,11 +57,10 @@ Function Resolve-LMException { #Write to $Error object but suppress so stack trace is not displayed Write-Error "Failed to execute web request: $LMError" -ErrorAction SilentlyContinue #Pretty print error to console - If($ErrorActionPreference -ne "SilentlyContinue"){ + If ($ErrorActionPreference -ne "SilentlyContinue") { [Console]::ForegroundColor = 'red' [Console]::Error.WriteLine("Failed to execute web request: $LMError") [Console]::ResetColor() - #throw "Failed to execute web request: $LMError" } } } diff --git a/Private/Test-LookupResult.ps1 b/Private/Test-LookupResult.ps1 index c5ef4f3..0b5a713 100644 --- a/Private/Test-LookupResult.ps1 +++ b/Private/Test-LookupResult.ps1 @@ -29,7 +29,7 @@ Function Test-LookupResult { return $true } #If empty stop processing since we have no Id to use - ElseIf (!$Result) { + Elseif (!$Result) { [Console]::ForegroundColor = 'red' [Console]::Error.WriteLine("Unable to find resource for the specified name value: $LookupString. Please check spelling and try again.") [Console]::ResetColor() diff --git a/Private/Update-LogicMonitorModule.ps1 b/Private/Update-LogicMonitorModule.ps1 index c1c5201..615c73d 100644 --- a/Private/Update-LogicMonitorModule.ps1 +++ b/Private/Update-LogicMonitorModule.ps1 @@ -33,12 +33,12 @@ Function Update-LogicMonitorModule { Param ( - [String[]]$Modules = @('Logic.Monitor','Logic.Monitor.SE'), + [String[]]$Modules = @('Logic.Monitor', 'Logic.Monitor.SE'), [Boolean]$UninstallFirst = $False, [Switch]$CheckOnly ) - Foreach($Module in $Modules){ + Foreach ($Module in $Modules) { # Read the currently installed version $Installed = Get-Module -ListAvailable -Name $Module @@ -46,10 +46,10 @@ Function Update-LogicMonitorModule { If ($Installed -is [Array]) { $InstalledVersion = $Installed[0].Version } - ElseIf($Installed.Version) { + Elseif ($Installed.Version) { $InstalledVersion = $Installed.Version } - Else{ + Else { #Not installed or manually imported return } @@ -62,10 +62,10 @@ Function Update-LogicMonitorModule { If ([System.Version]$OnlineVersion -gt [System.Version]$InstalledVersion) { # Uninstall the old version - If($CheckOnly){ + If ($CheckOnly) { Write-LMHost "[INFO]: You are currently using an outdated version ($InstalledVersion) of $Module, please consider upgrading to the latest version ($OnlineVersion) as soon as possible. Use the -AutoUpdateModule switch next time you connect to auto upgrade to the latest version." -ForegroundColor Yellow } - ElseIf ($UninstallFirst -eq $true) { + Elseif ($UninstallFirst -eq $true) { Write-LMHost "[INFO]: You are currently using an outdated version ($InstalledVersion) of $Module, uninstalling prior Module $Module version $InstalledVersion" -ForegroundColor Yellow Uninstall-Module -Name $Module -Force -Verbose:$False @@ -73,7 +73,7 @@ Function Update-LogicMonitorModule { Install-Module -Name $Module -Force -AllowClobber -Verbose:$False -MinimumVersion $OnlineVersion Update-LogicMonitorModule -CheckOnly -Modules @($Module) } - Else{ + Else { Write-LMHost "[INFO]: You are currently using an outdated version ($InstalledVersion) of $Module. Installing newer Module $Module version $OnlineVersion." -ForegroundColor Yellow Install-Module -Name $Module -Force -AllowClobber -Verbose:$False -MinimumVersion $OnlineVersion Update-LogicMonitorModule -CheckOnly -Modules @($Module) diff --git a/Private/Write-LMHost.ps1 b/Private/Write-LMHost.ps1 index e4146b0..ac50a1f 100644 --- a/Private/Write-LMHost.ps1 +++ b/Private/Write-LMHost.ps1 @@ -29,28 +29,28 @@ Writes the error message "Error: Something went wrong." to the host console with Function Write-LMHost { Param ( - [Object]$Message=$args[0], + [Object]$Message = $args[0], [Nullable[ConsoleColor]]$ForegroundColor, [Nullable[ConsoleColor]]$BackgroundColor ) #Only log message content if switch is set to true during connect lm account - If($Script:LMAuth.Logging){ - If($ForegroundColor -and !$BackgroundColor){ + If ($Script:LMAuth.Logging) { + If ($ForegroundColor -and !$BackgroundColor) { Write-Host $Message -ForegroundColor $ForegroundColor } - ElseIf(!$ForegroundColor -and $BackgroundColor) { + Elseif (!$ForegroundColor -and $BackgroundColor) { Write-Host $Message -BackgroundColor $BackgroundColor } - ElseIf($ForegroundColor -and $BackgroundColor){ + Elseif ($ForegroundColor -and $BackgroundColor) { Write-Host $Message -ForegroundColor $ForegroundColor -BackgroundColor $BackgroundColor } - Else{ + Else { Write-Host $Message } } - Else{ + Else { Write-Host $Message } } \ No newline at end of file diff --git a/Public/Connect-LMAccount.ps1 b/Public/Connect-LMAccount.ps1 index fdc2a6d..0c8aecd 100644 --- a/Public/Connect-LMAccount.ps1 +++ b/Public/Connect-LMAccount.ps1 @@ -52,7 +52,7 @@ PSGallery: https://www.powershellgallery.com/packages/Logic.Monitor #> Function Connect-LMAccount { - [CmdletBinding(DefaultParameterSetName="LMv1")] + [CmdletBinding(DefaultParameterSetName = "LMv1")] Param ( [Parameter(Mandatory, ParameterSetName = 'LMv1')] [String]$AccessId, @@ -87,8 +87,8 @@ Function Connect-LMAccount { ) #Autoload web assembly if on older version of powershell - If((Get-Host).Version.Major -lt 6){ - Add-type -AssemblyName System.Web + If ((Get-Host).Version.Major -lt 6) { + Add-Type -AssemblyName System.Web } If ($UseCachedCredential -or $CachedAccountName) { @@ -98,7 +98,7 @@ Function Connect-LMAccount { Write-Host "[INFO]: Existing vault Logic.Monitor already exists, skipping creation" } Catch { - If($_.Exception.Message -like "*Vault Logic.Monitor does not exist in registry*") { + If ($_.Exception.Message -like "*Vault Logic.Monitor does not exist in registry*") { Write-Host "[INFO]: Credential vault for cached accounts does not currently exist, creating credential vault: Logic.Monitor" Register-SecretVault -Name Logic.Monitor -ModuleName Microsoft.PowerShell.SecretStore Get-SecretStoreConfiguration | Out-Null @@ -112,58 +112,58 @@ Function Connect-LMAccount { Foreach ($Credential in $CredentialFile) { $CurrentDate = Get-Date [Hashtable]$Metadata = @{ - Portal = [String]$Credential.Portal - Id = [String]$Credential.Id - Modified = [DateTime]$CurrentDate + Portal = [String]$Credential.Portal + Id = [String]$Credential.Id + Modified = [DateTime]$CurrentDate } - Try{ + Try { Set-Secret -Name $Credential.Portal -Secret $Credential.Key -Vault Logic.Monitor -Metadata $Metadata -NoClobber Write-Host "[INFO]: Successfully migrated cached account secret for portal: $($Credential.Portal)" } - Catch{ + Catch { Write-Error $_.Exception.Message $MigrationComplete = $false } } - If($MigrationComplete){ + If ($MigrationComplete) { Remove-Item -Path $CredentialPath -Confirm:$false Write-Host "[INFO]: Successfully migrated cached accounts into secret store, your legacy account cache hes been removed." } - Else{ + Else { $NewName = Join-Path -Path $Home -ChildPath "Logic.Monitor-Migrated.json" Rename-Item -Path $CredentialPath -Confirm:$false -NewName $NewName Write-Host "[ERROR]: Unable to fully migrate cached accounts into secret store, your legacy account cache has been archived at: $NewName. No other attemps will be made to migrate any failed accounts." -ForegroundColor Red } } - If($CachedAccountName){ + If ($CachedAccountName) { #If supplied and account name just use that vs showing a list of accounts $CachedAccountSecrets = Get-SecretInfo -Vault Logic.Monitor $CachedAccountIndex = $CachedAccountSecrets.Name.IndexOf($CachedAccountName) - If($CachedAccountIndex -ne -1){ + If ($CachedAccountIndex -ne -1) { $AccountName = $CachedAccountSecrets[$CachedAccountIndex].Metadata["Portal"] $AccessId = $CachedAccountSecrets[$CachedAccountIndex].Metadata["Id"] $Type = $CachedAccountSecrets[$CachedAccountIndex].Metadata["Type"] - If(($Type -eq "LMv1") -or ($null -eq $Type)){ + If (($Type -eq "LMv1") -or ($null -eq $Type)) { [SecureString]$AccessKey = Get-Secret -Vault "Logic.Monitor" -Name $CachedAccountName -AsPlainText | ConvertTo-SecureString } - Else{ + Else { [SecureString]$BearerToken = Get-Secret -Vault "Logic.Monitor" -Name $CachedAccountName -AsPlainText | ConvertTo-SecureString } } - Else{ + Else { Write-Error "Entered CachedAccountName ($CachedAccountName) does not match one of the stored credentials, please check the selected entry and try again" Return } } - Else{ + Else { #List out current portals with saved credentials and let users chose which to use $i = 0 $CachedAccountSecrets = Get-SecretInfo -Vault Logic.Monitor - If($CachedAccountSecrets){ + If ($CachedAccountSecrets) { Write-Host "Selection Number | Portal Name" Foreach ($Credential in $CachedAccountSecrets) { - If($Credential.Name -notlike "*LMSessionSync*"){ + If ($Credential.Name -notlike "*LMSessionSync*") { Write-Host "$i) $($Credential.Name)" } $i++ @@ -174,13 +174,13 @@ Function Connect-LMAccount { $CachedAccountName = $CachedAccountSecrets[$StoredCredentialIndex].Name $AccessId = $CachedAccountSecrets[$StoredCredentialIndex].Metadata["Id"] $Type = $CachedAccountSecrets[$StoredCredentialIndex].Metadata["Type"] - If($Type -eq "LMv1"){ + If ($Type -eq "LMv1") { [SecureString]$AccessKey = Get-Secret -Vault "Logic.Monitor" -Name $CachedAccountName -AsPlainText | ConvertTo-SecureString } - ElseIf($Type -eq "Bearer"){ + Elseif ($Type -eq "Bearer") { [SecureString]$BearerToken = Get-Secret -Vault "Logic.Monitor" -Name $CachedAccountName -AsPlainText | ConvertTo-SecureString } - Else{ + Else { Write-Error "Invalid credential type detected for selection: $Type" Return } @@ -190,72 +190,72 @@ Function Connect-LMAccount { Return } } - Else{ + Else { Write-Error "No entries currently found in secret vault Logic.Monitor" - Return + Return } } } Else { - If($PsCmdlet.ParameterSetName -eq "LMv1"){ + If ($PsCmdlet.ParameterSetName -eq "LMv1") { #Convert to secure string [SecureString]$AccessKey = $AccessKey | ConvertTo-SecureString -AsPlainText -Force $Type = "LMv1" } - ElseIf($PsCmdlet.ParameterSetName -eq "SessionSync"){ + Elseif ($PsCmdlet.ParameterSetName -eq "SessionSync") { $Session = Get-LMSession -AccountName $AccountName - If($Session){ - $AccessId = $Session.jSessionID #Session Id - $AccessKey = $Session.token #CSRF Token + If ($Session) { + $AccessId = $Session.jSessionID #Session Id + $AccessKey = $Session.token #CSRF Token $Type = "SessionSync" } - Else{ - throw "Unable to validate session sync info for: $AccountName" + Else { + Throw "Unable to validate session sync info for: $AccountName" } } - Else{ + Else { #Convert to secure string [SecureString]$BearerToken = $BearerToken | ConvertTo-SecureString -AsPlainText -Force $Type = "Bearer" } } - If(!$Type){ + If (!$Type) { $Type = "LMv1" } #Create Credential Object for reuse in other functions $Script:LMAuth = [PSCustomObject]@{ - Id = $AccessId - Key = $AccessKey - BearerToken = $BearerToken - Portal = $AccountName - Valid = $true - Logging = !$DisableConsoleLogging.IsPresent - Type = $Type + Id = $AccessId + Key = $AccessKey + BearerToken = $BearerToken + Portal = $AccountName + Valid = $true + Logging = !$DisableConsoleLogging.IsPresent + Type = $Type } #Check for newer version of Logic.Monitor module - Try{ - If($AutoUpdateModuleVersion -and !$SkipVersionCheck){ + Try { + If ($AutoUpdateModuleVersion -and !$SkipVersionCheck) { Update-LogicMonitorModule } - ElseIf(!$SkipVersionCheck){ + Elseif (!$SkipVersionCheck) { Update-LogicMonitorModule -CheckOnly } } - Catch{ + Catch { Write-Host "[ERROR]: Unable to check for newer version of Logic.Monitor module: $($_.Exception.Message)" -ForegroundColor Red } - If(!$SkipCredValidation){ + If (!$SkipCredValidation) { Try { #Collect portal info and api username and roles - If($Type -eq "Bearer"){ + If ($Type -eq "Bearer") { $Token = [System.Net.NetworkCredential]::new("", $BearerToken).Password - $ApiInfo = Get-LMAPIToken -Type Bearer -ErrorAction SilentlyContinue | Where-Object {$_.accessKey -like "$($Token.Substring(0,20))*"} + $ApiInfo = Get-LMAPIToken -Type Bearer -ErrorAction SilentlyContinue | Where-Object { $_.accessKey -like "$($Token.Substring(0,20))*" } } - Else{ + Else { $ApiInfo = Get-LMAPIToken -Filter "accessId -eq '$AccessId'" -ErrorAction SilentlyContinue } @@ -265,38 +265,38 @@ Function Connect-LMAccount { Return } Else { - Try{ + Try { $PortalInfo = Get-LMPortalInfo -ErrorAction Stop Write-LMHost "[INFO]: Connected to LM portal $($PortalInfo.companyDisplayName) via $Type Token - ($($PortalInfo.numberOfDevices) devices | $($PortalInfo.numOfWebsites) websites)." -ForegroundColor Green Return } Catch { - throw "Unable to validate API token info" + Throw "Unable to validate API token info" } } } Catch { - Try{ + Try { $DeviceInfo = Get-LMDevice -ErrorAction Stop - If($DeviceInfo){ + If ($DeviceInfo) { Write-LMHost "[INFO]: Connected to LM portal $AccountName via $Type Token with limited permissions, ensure your api token has the necessary rights needed to run desired commands." -ForegroundColor Yellow Return } - Else{ - throw "Unable to verify api token permission levels, ensure api token has rights to view all/select resources or at minimum view access for Account Information" + Else { + Throw "Unable to verify api token permission levels, ensure api token has rights to view all/select resources or at minimum view access for Account Information" } } - Catch{ + Catch { #Clear credential object from environment Remove-Variable LMAuth -Scope Script -ErrorAction SilentlyContinue - throw "Unable to login to account, please ensure your access info and account name are correct: $($_.Exception.Message)" + Throw "Unable to login to account, please ensure your access info and account name are correct: $($_.Exception.Message)" } Return } } - Else{ + Else { Write-LMHost "[INFO]: Skipping validation of credentials, connected to LM portal $AccountName via $Type, ensure your api token has the necessary rights needed to run desired commands." -ForegroundColor Yellow } } diff --git a/Public/Copy-LMDashboard.ps1 b/Public/Copy-LMDashboard.ps1 index 77798d2..738d831 100644 --- a/Public/Copy-LMDashboard.ps1 +++ b/Public/Copy-LMDashboard.ps1 @@ -76,7 +76,7 @@ Function Copy-LMDashboard { } #Lookup Dashboard Id - If($DashboardName) { + If ($DashboardName) { $LookupResult = (Get-LMDashboard -Name $DashboardName).Id If (Test-LookupResult -Result $LookupResult -LookupString $DashboardName) { return @@ -92,13 +92,13 @@ Function Copy-LMDashboard { Try { $Data = @{ - name = $Name - description = $Description - groupId = $ParentGroupId - widgetTokens = $SourceDashboard.widgetTokens - widgetsConfig = $SourceDashboard.widgetsConfig - widgetsOrder = $SourceDashboard.widgetsOrder - sharable = $SourceDashboard.sharable + name = $Name + description = $Description + groupId = $ParentGroupId + widgetTokens = $SourceDashboard.widgetTokens + widgetsConfig = $SourceDashboard.widgetsConfig + widgetsOrder = $SourceDashboard.widgetsOrder + sharable = $SourceDashboard.sharable } $Data = ($Data | ConvertTo-Json) @@ -108,7 +108,7 @@ Function Copy-LMDashboard { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Data - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data Return $Response diff --git a/Public/Copy-LMDevice.ps1 b/Public/Copy-LMDevice.ps1 index 682c8c1..4f59752 100644 --- a/Public/Copy-LMDevice.ps1 +++ b/Public/Copy-LMDevice.ps1 @@ -47,25 +47,25 @@ Function Copy-LMDevice { Process { If ($Script:LMAuth.Valid) { #Strip out dynamic groups - $HostGroupIds = ($DeviceObjec.hostGroupIds -Split "," | Get-LMDeviceGroup | Where-Object {$_.appliesTo -eq ""}).Id -Join "," + $HostGroupIds = ($DeviceObjec.hostGroupIds -Split "," | Get-LMDeviceGroup | Where-Object { $_.appliesTo -eq "" }).Id -Join "," $Data = @{ - name = $Name - displayName = If($DisplayName){$DisplayName}Else{$DeviceObject.displayName} - description = If($Description){$Description}Else{$DeviceObject.description} - disableAlerting = $DeviceObject.disableAlerting - enableNetflow = $DeviceObject.enableNetFlow - customProperties = $DeviceObject.customProperties - deviceType = $DeviceObject.deviceType - preferredCollectorId = $DeviceObject.preferredCollectorId - preferredCollectorGroupId = $DeviceObject.preferredCollectorGroupId + name = $Name + displayName = If ($DisplayName) { $DisplayName }Else { $DeviceObject.displayName } + description = If ($Description) { $Description }Else { $DeviceObject.description } + disableAlerting = $DeviceObject.disableAlerting + enableNetflow = $DeviceObject.enableNetFlow + customProperties = $DeviceObject.customProperties + deviceType = $DeviceObject.deviceType + preferredCollectorId = $DeviceObject.preferredCollectorId + preferredCollectorGroupId = $DeviceObject.preferredCollectorGroupId autoBalancedCollectorGroupId = $DeviceObject.autoBalancedCollectorGroupId - link = $DeviceObject.link - netflowCollectorGroupId = $DeviceObject.netflowCollectorGroupId - netflowCollectorId = $DeviceObject.netflowCollectorId - logCollectorGroupId = $DeviceObject.logCollectorGroupId - logCollectorId = $DeviceObject.logCollectorId - hostGroupIds = If($HostGroupIds){$HostGroupIds}Else{1} + link = $DeviceObject.link + netflowCollectorGroupId = $DeviceObject.netflowCollectorGroupId + netflowCollectorId = $DeviceObject.netflowCollectorId + logCollectorGroupId = $DeviceObject.logCollectorGroupId + logCollectorId = $DeviceObject.logCollectorId + hostGroupIds = If ($HostGroupIds) { $HostGroupIds }Else { 1 } } #Build header and uri diff --git a/Public/Copy-LMReport.ps1 b/Public/Copy-LMReport.ps1 index 09be999..8295901 100644 --- a/Public/Copy-LMReport.ps1 +++ b/Public/Copy-LMReport.ps1 @@ -48,8 +48,8 @@ Function Copy-LMReport { #Replace name and description if present $ReportObject.name = $Name - If($Description){$ReportObject.description = $Description} - If($ParentGroupId){$ReportObject.groupId = $ParentGroupId} + If ($Description) { $ReportObject.description = $Description } + If ($ParentGroupId) { $ReportObject.groupId = $ParentGroupId } #Build header and uri $ResourcePath = "/report/reports" diff --git a/Public/Export-LMDeviceConfigBackup.ps1 b/Public/Export-LMDeviceConfigBackup.ps1 index d846729..4deaaf3 100644 --- a/Public/Export-LMDeviceConfigBackup.ps1 +++ b/Public/Export-LMDeviceConfigBackup.ps1 @@ -39,12 +39,12 @@ PSGallery: https://www.powershellgallery.com/packages/Logic.Monitor Function Export-LMDeviceConfigBackup { - [CmdletBinding(DefaultParameterSetName="Device")] + [CmdletBinding(DefaultParameterSetName = "Device")] Param ( - [Parameter(ParameterSetName="DeviceGroup",Mandatory)] + [Parameter(ParameterSetName = "DeviceGroup", Mandatory)] [Int]$DeviceGroupId, - [Parameter(ParameterSetName="Device",Mandatory)] + [Parameter(ParameterSetName = "Device", Mandatory)] [Int]$DeviceId, [Regex]$InstanceNameFilter = "[rR]unning|[cC]urrent|[pP]aloAlto", @@ -58,7 +58,7 @@ Function Export-LMDeviceConfigBackup { #Check if we are logged in and have valid api creds If ($Script:LMAuth.Valid) { - If($DeviceId){ + If ($DeviceId) { $network_devices = Get-LMDevice -id $DeviceId } Else { @@ -77,9 +77,9 @@ Function Export-LMDeviceConfigBackup { $filtered_config_instance_count = 0 Foreach ($config_source in $device_config_sources) { $running_config_instance = Get-LMDeviceDatasourceInstance -DeviceId $config_source.deviceId -DatasourceId $config_source.dataSourceId - $filtered_config_instance = $running_config_instance | Where-Object { $_.displayName -Match $InstanceNameFilter} + $filtered_config_instance = $running_config_instance | Where-Object { $_.displayName -Match $InstanceNameFilter } If ($filtered_config_instance) { - Foreach($instance in $filtered_config_instance){ + Foreach ($instance in $filtered_config_instance) { $filtered_config_instance_count++ $instance_list += [PSCustomObject]@{ deviceId = $device.id @@ -94,7 +94,7 @@ Function Export-LMDeviceConfigBackup { } } } - Write-LMHost " [INFO]: Found $filtered_config_instance_count configsource instance(s) using match filter ($InstanceNameFilter)." -ForegroundColor Gray + Write-LMHost " [INFO]: Found $filtered_config_instance_count configsource instance(s) using match filter ($InstanceNameFilter)." -ForegroundColor Gray } #Loop through filtered instance list and pull config diff @@ -112,7 +112,7 @@ Function Export-LMDeviceConfigBackup { #Loop through each set and built report Foreach ($device in $config_grouping) { $config = $device.Group | Sort-Object -Property pollTimestamp -Descending | Select-Object -First 1 - Write-LMHost " [INFO]: Found $(($device.Group | Measure-Object).Count) configsource instance version(s) for: $($config.deviceDisplayName), selecting latest config dated: $([datetimeoffset]::FromUnixTimeMilliseconds($config.pollTimestamp).DateTime)UTC" -ForegroundColor Gray + Write-LMHost " [INFO]: Found $(($device.Group | Measure-Object).Count) configsource instance version(s) for: $($config.deviceDisplayName), selecting latest config dated: $([datetimeoffset]::FromUnixTimeMilliseconds($config.pollTimestamp).DateTime)UTC" -ForegroundColor Gray $output_list += [PSCustomObject]@{ deviceDisplayName = $config.deviceDisplayName deviceInstanceName = $config.instanceName @@ -125,14 +125,14 @@ Function Export-LMDeviceConfigBackup { } } - If($output_list){ - If($Path){ + If ($output_list) { + If ($Path) { #Generate CSV Export $output_list | Export-Csv -Path $Path -NoTypeInformation } Return (Add-ObjectTypeInfo -InputObject $output_list -TypeName "LogicMonitor.ConfigBackup" ) } - Else{ + Else { Write-LMHost "[WARN]: Did not find any configs to output based on selected resource(s), check your parameters and try again." -ForegroundColor Yellow } diff --git a/Public/Export-LMDeviceData.ps1 b/Public/Export-LMDeviceData.ps1 index 04ed5b6..07a20c4 100644 --- a/Public/Export-LMDeviceData.ps1 +++ b/Public/Export-LMDeviceData.ps1 @@ -86,7 +86,7 @@ Function Export-LMDeviceData { If ($Script:LMAuth.Valid) { $DeviceList = @() $DataExportList = @() - Switch($PSCmdlet.ParameterSetName){ + Switch ($PSCmdlet.ParameterSetName) { "DeviceId" { $DeviceList = Get-LMDevice -Id $DeviceId } "DeviceName" { $DeviceList = Get-LMDevice -DisplayName $DeviceName } "DeviceHostName" { $DeviceList = Get-LMDevice -Name $DeviceHostName } @@ -94,33 +94,33 @@ Function Export-LMDeviceData { "DeviceGroupName" { $DeviceList = Get-LMDeviceGroupDevices -Name $DeviceGroupName } } - If($DeviceList){ + If ($DeviceList) { Write-LMHost "[INFO]: $(($DeviceList | Measure-Object).count) resource(s) selected for data export" - Foreach($Device in $DeviceList){ + Foreach ($Device in $DeviceList) { $DatasourceList = @() Write-LMHost "[INFO]: Starting data collection for resource: $($Device.displayName)" - $DatasourceList = Get-LMDeviceDatasourceList -Id $Device.id | Where-Object { $_.monitoringInstanceNumber -gt 0 -and $_.dataSourceName -like $DatasourceIncludeFilter -and $_.datasourceName -notlike $DatasourceExcludeFilter} - If($DatasourceList){ + $DatasourceList = Get-LMDeviceDatasourceList -Id $Device.id | Where-Object { $_.monitoringInstanceNumber -gt 0 -and $_.dataSourceName -like $DatasourceIncludeFilter -and $_.datasourceName -notlike $DatasourceExcludeFilter } + If ($DatasourceList) { Write-LMHost "[INFO]: Found ($(($DatasourceList | Measure-Object).count)) datasource(s) with 1 or more active instances for resource: $($Device.displayName) using datasource filter (Include:$DatasourceIncludeFilter | Exclude:$DatasourceExcludeFilter)" - Foreach($Datasource in $DatasourceList){ + Foreach ($Datasource in $DatasourceList) { Write-LMHost "[INFO]: Starting instance discovery for datasource $($Datasource.dataSourceName) for resource: $($Device.displayName)" $InstanceList = @() - $InstanceList = Get-LMDeviceDatasourceInstance -Id $Device.id -DatasourceId $Datasource.dataSourceId | Where-Object { $_.stopMonitoring -eq $false} - If($InstanceList){ + $InstanceList = Get-LMDeviceDatasourceInstance -Id $Device.id -DatasourceId $Datasource.dataSourceId | Where-Object { $_.stopMonitoring -eq $false } + If ($InstanceList) { Write-LMHost "[INFO]: Found ($(($InstanceList | Measure-Object).count)) instance(s) for resource: $($Device.displayName)" - Foreach($Instance in $InstanceList){ + Foreach ($Instance in $InstanceList) { Write-LMHost "[INFO]: Starting datapoint collection for instance $($Instance.name) for resource: $($Device.displayName)" $Datapoints = @() $Datapoints = Get-LMDeviceData -DeviceId $Device.id -DatasourceId $Datasource.dataSourceId -InstanceId $Instance.id -StartDate $StartDate -EndDate $EndDate - If($Datapoints){ + If ($Datapoints) { Write-LMHost "[INFO]: Finished datapoint collection for instance $($Instance.name) for resource: $($Device.displayName)" $DataExportList += [PSCustomObject]@{ - deviceId = $Device.id - deviceName = $Device.displayName + deviceId = $Device.id + deviceName = $Device.displayName datasourceName = $Datasource.dataSourceName - instanceName = $Instance.name - instanceGroup = $Instance.groupName - dataPoints = $Datapoints + instanceName = $Instance.name + instanceGroup = $Instance.groupName + dataPoints = $Datapoints } } } @@ -129,13 +129,13 @@ Function Export-LMDeviceData { } } - Switch($ExportFormat){ + Switch ($ExportFormat) { "json" { $DataExportList | ConvertTo-Json -Depth 3 | Out-File -FilePath "$ExportPath\LMDeviceDataExport.json" ; return } - "csv" { $DataExportList | Export-Csv -NoTypeInformation -Path "$ExportPath\LMDeviceDataExport.csv" ; return } + "csv" { $DataExportList | Export-Csv -NoTypeInformation -Path "$ExportPath\LMDeviceDataExport.csv" ; return } default { return $DataExportList } } } - Else{ + Else { Write-Error "No resources found using supplied parameters, please check you settings and try again." } diff --git a/Public/Export-LMLogicModule.ps1 b/Public/Export-LMLogicModule.ps1 index 3bf032b..92ab99f 100644 --- a/Public/Export-LMLogicModule.ps1 +++ b/Public/Export-LMLogicModule.ps1 @@ -52,10 +52,10 @@ Function Export-LMLogicModule { [String]$DownloadPath = (Get-Location).Path ) - Begin{ + Begin { } - Process{ + Process { #Check if we are logged in and have valid api creds If ($Script:LMAuth.Valid) { @@ -155,5 +155,5 @@ Function Export-LMLogicModule { Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." } } - End{} + End {} } diff --git a/Public/Get-LMAPIToken.ps1 b/Public/Get-LMAPIToken.ps1 index 7767888..cc3629d 100644 --- a/Public/Get-LMAPIToken.ps1 +++ b/Public/Get-LMAPIToken.ps1 @@ -65,7 +65,7 @@ Function Get-LMAPIToken { [ValidateSet("LMv1", "Bearer", "*")] [String]$Type = "*", - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds @@ -80,7 +80,7 @@ Function Get-LMAPIToken { $Done = $false $Results = @() - If($Type -eq "Bearer"){ + If ($Type -eq "Bearer") { $BearerParam = "&type=bearer" } diff --git a/Public/Get-LMAccessGroup.ps1 b/Public/Get-LMAccessGroup.ps1 index 58bbdb0..d7c18f4 100644 --- a/Public/Get-LMAccessGroup.ps1 +++ b/Public/Get-LMAccessGroup.ps1 @@ -26,7 +26,7 @@ Get-LMAccessGroup -Name "MyAccessGroup" Retrieves the access group with the specified name. .EXAMPLE -Get-LMAccessGroup -Filter @{ Property = "Value" } +Get-LMAccessGroup -Filter "tenantId -eq 'Value'" Retrieves access groups based on the specified filter criteria. .NOTES @@ -45,7 +45,7 @@ Function Get-LMAccessGroup { [Parameter(ParameterSetName = 'Filter')] [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds @@ -88,7 +88,7 @@ Function Get-LMAccessGroup { #Stop looping if single device, no need to continue If ($PSCmdlet.ParameterSetName -eq "Id") { $Done = $true - Return (Add-ObjectTypeInfo -InputObject $Response -TypeName "LogicMonitor.Role" ) + Return (Add-ObjectTypeInfo -InputObject $Response -TypeName "LogicMonitor.AccessGroup" ) } #Check result size and if needed loop again Else { @@ -107,7 +107,7 @@ Function Get-LMAccessGroup { } } } - Return (Add-ObjectTypeInfo -InputObject $Results -TypeName "LogicMonitor.Role" ) + Return (Add-ObjectTypeInfo -InputObject $Results -TypeName "LogicMonitor.AccessGroup" ) } Else { Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." diff --git a/Public/Get-LMAccountStatus.ps1 b/Public/Get-LMAccountStatus.ps1 index 315093c..ad530db 100644 --- a/Public/Get-LMAccountStatus.ps1 +++ b/Public/Get-LMAccountStatus.ps1 @@ -26,10 +26,10 @@ Function Get-LMAccountStatus { #Clear credential object from environment If ($Script:LMAuth) { $Result = [PSCustomObject]@{ - Portal = $Script:LMAuth.Portal - Valid = $Script:LMAuth.Valid + Portal = $Script:LMAuth.Portal + Valid = $Script:LMAuth.Valid Logging = $Script:LMAuth.Logging - Type = $Script:LMAuth.Type + Type = $Script:LMAuth.Type } return $Result } diff --git a/Public/Get-LMAlert.ps1 b/Public/Get-LMAlert.ps1 index 27c2381..1567b46 100644 --- a/Public/Get-LMAlert.ps1 +++ b/Public/Get-LMAlert.ps1 @@ -56,13 +56,13 @@ Function Get-LMAlert { [Parameter(ParameterSetName = 'Range')] [Datetime]$EndDate, - [Parameter(Mandatory,ParameterSetName = 'Id')] + [Parameter(Mandatory, ParameterSetName = 'Id')] [String]$Id, [ValidateSet("*", "Warning", "Error", "Critical")] [String]$Severity = "*", - [ValidateSet("*", "websiteAlert", "dataSourceAlert", "eventSourceAlert","logAlert")] + [ValidateSet("*", "websiteAlert", "dataSourceAlert", "eventSourceAlert", "logAlert")] [String]$Type = "*", [Boolean]$ClearedAlerts = $false, @@ -73,7 +73,7 @@ Function Get-LMAlert { [Parameter(ParameterSetName = 'Id')] [String[]]$CustomColumns, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000, [String]$Sort = "resourceId" @@ -116,16 +116,16 @@ Function Get-LMAlert { $resourcePath += "/$Id" #Check if we need to add customColumns - If($CustomColumns){ + If ($CustomColumns) { $FormatedColumns = @() - Foreach($Column in $CustomColumns){ + Foreach ($Column in $CustomColumns) { $FormatedColumns += [System.Web.HTTPUtility]::UrlEncode($Column) } - If($QueryParams){ + If ($QueryParams) { $QueryParams += "&customColumns=$($FormatedColumns -join ",")" } - Else{ + Else { $QueryParams = "?customColumns=$($FormatedColumns -join",")" } } @@ -164,7 +164,7 @@ Function Get-LMAlert { $Done = $true Write-LMHost "[WARN]: Reached $QueryLimit record query limitation for this endpoint" -ForegroundColor Yellow } - ElseIf ($Count -ge $Total -and $Total -ge 0) { + Elseif ($Count -ge $Total -and $Total -ge 0) { $Done = $true } } diff --git a/Public/Get-LMAlertRule.ps1 b/Public/Get-LMAlertRule.ps1 index 9132403..0dcac71 100644 --- a/Public/Get-LMAlertRule.ps1 +++ b/Public/Get-LMAlertRule.ps1 @@ -41,7 +41,7 @@ Function Get-LMAlertRule { [Parameter(ParameterSetName = 'Filter')] [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMAppliesToFunction.ps1 b/Public/Get-LMAppliesToFunction.ps1 index 233ce49..0025770 100644 --- a/Public/Get-LMAppliesToFunction.ps1 +++ b/Public/Get-LMAppliesToFunction.ps1 @@ -49,7 +49,7 @@ Function Get-LMAppliesToFunction { [Parameter(ParameterSetName = 'Filter')] [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMAuditLogs.ps1 b/Public/Get-LMAuditLogs.ps1 index 55e562d..d143c9e 100644 --- a/Public/Get-LMAuditLogs.ps1 +++ b/Public/Get-LMAuditLogs.ps1 @@ -53,7 +53,7 @@ Function Get-LMAuditLogs { [Parameter(ParameterSetName = 'Filter')] [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds @@ -71,7 +71,7 @@ Function Get-LMAuditLogs { #Convert to epoch, if not set use defaults If (!$StartDate) { - If($PSCmdlet.ParameterSetName -ne "Id"){ + If ($PSCmdlet.ParameterSetName -ne "Id") { Write-LMHost "[WARN]: No start date specified, defaulting to last 30 days" -ForegroundColor Yellow } [int]$StartDate = ([DateTimeOffset]$(Get-Date).AddDays(-30)).ToUnixTimeSeconds() @@ -125,7 +125,7 @@ Function Get-LMAuditLogs { $Done = $true Write-LMHost "[WARN]: Reached $QueryLimit record query limitation for this endpoint" -ForegroundColor Yellow } - ElseIf ($Count -ge $Total -and $Total -ge 0) { + Elseif ($Count -ge $Total -and $Total -ge 0) { $Done = $true } } diff --git a/Public/Get-LMCachedAccount.ps1 b/Public/Get-LMCachedAccount.ps1 index 7c2ae5f..9b42b7f 100644 --- a/Public/Get-LMCachedAccount.ps1 +++ b/Public/Get-LMCachedAccount.ps1 @@ -41,20 +41,20 @@ Function Get-LMCachedAccount { Param ( [String]$CachedAccountName ) - If($CachedAccountName){ + If ($CachedAccountName) { $CachedAccountSecrets = Get-SecretInfo -Vault Logic.Monitor -Name $CachedAccountName } - Else{ + Else { $CachedAccountSecrets = Get-SecretInfo -Vault Logic.Monitor } $CachedAccounts = @() - Foreach ($Secret in $CachedAccountSecrets){ + Foreach ($Secret in $CachedAccountSecrets) { $CachedAccounts += [PSCustomObject]@{ - CachedAccountName = $Secret.Name - Portal = $Secret.Metadata["Portal"] - Id = If(!$Secret.Metadata["Id"]){"N/A"}Else{$Secret.Metadata["Id"]} - Modified = $Secret.Metadata["Modified"] - Type = If(!$Secret.Metadata["Type"]){"LMv1"}Else{$Secret.Metadata["Type"]} + CachedAccountName = $Secret.Name + Portal = $Secret.Metadata["Portal"] + Id = If (!$Secret.Metadata["Id"]) { "N/A" }Else { $Secret.Metadata["Id"] } + Modified = $Secret.Metadata["Modified"] + Type = If (!$Secret.Metadata["Type"]) { "LMv1" }Else { $Secret.Metadata["Type"] } } } Return $CachedAccounts diff --git a/Public/Get-LMCollector.ps1 b/Public/Get-LMCollector.ps1 index c71db6f..26b4d52 100644 --- a/Public/Get-LMCollector.ps1 +++ b/Public/Get-LMCollector.ps1 @@ -45,7 +45,7 @@ Function Get-LMCollector { [Parameter(ParameterSetName = 'Filter')] [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMCollectorGroup.ps1 b/Public/Get-LMCollectorGroup.ps1 index caf0425..7e4be3c 100644 --- a/Public/Get-LMCollectorGroup.ps1 +++ b/Public/Get-LMCollectorGroup.ps1 @@ -43,7 +43,7 @@ Function Get-LMCollectorGroup { [Parameter(ParameterSetName = 'Filter')] [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMCollectorInstaller.ps1 b/Public/Get-LMCollectorInstaller.ps1 index 09a57b6..2394dba 100644 --- a/Public/Get-LMCollectorInstaller.ps1 +++ b/Public/Get-LMCollectorInstaller.ps1 @@ -43,7 +43,7 @@ Function Get-LMCollectorInstaller { [Parameter(Mandatory, ParameterSetName = "Name")] [string]$Name, - [ValidateSet("nano", "small", "medium", "large", "extra_large","double_extra_large")] + [ValidateSet("nano", "small", "medium", "large", "extra_large", "double_extra_large")] [string]$Size = "medium", [ValidateSet("Win64", "Linux64")] @@ -84,7 +84,7 @@ Function Get-LMCollectorInstaller { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation - #Issue request + #Issue request Invoke-RestMethod -Uri $Uri -Method "GET" -Headers $Headers[0] -WebSession $Headers[1] -OutFile $DownloadPath Return $DownloadPath diff --git a/Public/Get-LMCollectorVersions.ps1 b/Public/Get-LMCollectorVersions.ps1 index e557eb1..76578b1 100644 --- a/Public/Get-LMCollectorVersions.ps1 +++ b/Public/Get-LMCollectorVersions.ps1 @@ -46,7 +46,7 @@ Function Get-LMCollectorVersions { [Parameter(ParameterSetName = 'Top')] [Switch]$TopVersions, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMConfigSource.ps1 b/Public/Get-LMConfigSource.ps1 index 6599ffc..2aa8380 100644 --- a/Public/Get-LMConfigSource.ps1 +++ b/Public/Get-LMConfigSource.ps1 @@ -45,7 +45,7 @@ Function Get-LMConfigSource { [Parameter(ParameterSetName = 'Filter')] [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMDashboard.ps1 b/Public/Get-LMDashboard.ps1 index d3cf96e..de21952 100644 --- a/Public/Get-LMDashboard.ps1 +++ b/Public/Get-LMDashboard.ps1 @@ -75,7 +75,7 @@ Function Get-LMDashboard { [Parameter(ParameterSetName = 'Filter')] [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) diff --git a/Public/Get-LMDashboardGroup.ps1 b/Public/Get-LMDashboardGroup.ps1 index dbb0315..e21a247 100644 --- a/Public/Get-LMDashboardGroup.ps1 +++ b/Public/Get-LMDashboardGroup.ps1 @@ -17,7 +17,7 @@ Function Get-LMDashboardGroup { [Parameter(ParameterSetName = 'Filter')] [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMDashboardWidget.ps1 b/Public/Get-LMDashboardWidget.ps1 index daf8a4e..513e513 100644 --- a/Public/Get-LMDashboardWidget.ps1 +++ b/Public/Get-LMDashboardWidget.ps1 @@ -17,7 +17,7 @@ Function Get-LMDashboardWidget { [Parameter(ParameterSetName = 'Filter')] [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMDatasource.ps1 b/Public/Get-LMDatasource.ps1 index e95fc26..2fbd66f 100644 --- a/Public/Get-LMDatasource.ps1 +++ b/Public/Get-LMDatasource.ps1 @@ -14,7 +14,7 @@ Function Get-LMDatasource { [Parameter(ParameterSetName = 'Filter')] [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMDatasourceAssociatedDevices.ps1 b/Public/Get-LMDatasourceAssociatedDevices.ps1 index 204d653..09ffa66 100644 --- a/Public/Get-LMDatasourceAssociatedDevices.ps1 +++ b/Public/Get-LMDatasourceAssociatedDevices.ps1 @@ -13,7 +13,7 @@ Function Get-LMDatasourceAssociatedDevices { [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMDatasourceGraph.ps1 b/Public/Get-LMDatasourceGraph.ps1 index 4c5db26..5cd7767 100644 --- a/Public/Get-LMDatasourceGraph.ps1 +++ b/Public/Get-LMDatasourceGraph.ps1 @@ -2,37 +2,37 @@ Function Get-LMDatasourceGraph { [CmdletBinding()] Param ( - [Parameter(Mandatory,ParameterSetName = 'Id-dsId')] - [Parameter(Mandatory,ParameterSetName = 'Id-dsName')] + [Parameter(Mandatory, ParameterSetName = 'Id-dsId')] + [Parameter(Mandatory, ParameterSetName = 'Id-dsName')] [Int]$Id, - [Parameter(Mandatory,ParameterSetName = 'dsName')] - [Parameter(Mandatory,ParameterSetName = 'Id-dsName')] - [Parameter(Mandatory,ParameterSetName = 'Name-dsName')] - [Parameter(Mandatory,ParameterSetName = 'Filter-dsName')] + [Parameter(Mandatory, ParameterSetName = 'dsName')] + [Parameter(Mandatory, ParameterSetName = 'Id-dsName')] + [Parameter(Mandatory, ParameterSetName = 'Name-dsName')] + [Parameter(Mandatory, ParameterSetName = 'Filter-dsName')] [String]$DataSourceName, - [Parameter(Mandatory,ParameterSetName = 'dsId')] - [Parameter(Mandatory,ParameterSetName = 'Id-dsId')] - [Parameter(Mandatory,ParameterSetName = 'Name-dsId')] - [Parameter(Mandatory,ParameterSetName = 'Filter-dsId')] + [Parameter(Mandatory, ParameterSetName = 'dsId')] + [Parameter(Mandatory, ParameterSetName = 'Id-dsId')] + [Parameter(Mandatory, ParameterSetName = 'Name-dsId')] + [Parameter(Mandatory, ParameterSetName = 'Filter-dsId')] [String]$DataSourceId, - [Parameter(Mandatory,ParameterSetName = 'Name-dsId')] - [Parameter(Mandatory,ParameterSetName = 'Name-dsName')] + [Parameter(Mandatory, ParameterSetName = 'Name-dsId')] + [Parameter(Mandatory, ParameterSetName = 'Name-dsName')] [String]$Name, - [Parameter(Mandatory,ParameterSetName = 'Filter-dsId')] - [Parameter(Mandatory,ParameterSetName = 'Filter-dsName')] + [Parameter(Mandatory, ParameterSetName = 'Filter-dsId')] + [Parameter(Mandatory, ParameterSetName = 'Filter-dsName')] [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds If ($Script:LMAuth.Valid) { - If($DataSourceName){ + If ($DataSourceName) { $LookupResult = (Get-LMDatasource -Name $DataSourceName).Id If (Test-LookupResult -Result $LookupResult -LookupString $DataSourceName) { Return diff --git a/Public/Get-LMDatasourceMetadata.ps1 b/Public/Get-LMDatasourceMetadata.ps1 index ad08d70..4dcd91f 100644 --- a/Public/Get-LMDatasourceMetadata.ps1 +++ b/Public/Get-LMDatasourceMetadata.ps1 @@ -11,7 +11,7 @@ Function Get-LMDatasourceMetadata { [Parameter(ParameterSetName = 'DisplayName')] [String]$DisplayName, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds @@ -41,29 +41,29 @@ Function Get-LMDatasourceMetadata { #Initalize vars $QueryParams = "" - #Build query params - $QueryParams = "?size=$BatchSize&offset=$Count&sort=+id" + #Build query params + $QueryParams = "?size=$BatchSize&offset=$Count&sort=+id" - Try { - $Headers = New-LMHeader -Auth $Script:LMAuth -Method "GET" -ResourcePath $ResourcePath - $Uri = "https://$($Script:LMAuth.Portal).logicmonitor.com/santaba/rest" + $ResourcePath + $QueryParams + Try { + $Headers = New-LMHeader -Auth $Script:LMAuth -Method "GET" -ResourcePath $ResourcePath + $Uri = "https://$($Script:LMAuth.Portal).logicmonitor.com/santaba/rest" + $ResourcePath + $QueryParams - Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation + Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation - #Issue request - $Response = Invoke-RestMethod -Uri $Uri -Method "GET" -Headers $Headers[0] -WebSession $Headers[1] + #Issue request + $Response = Invoke-RestMethod -Uri $Uri -Method "GET" -Headers $Headers[0] -WebSession $Headers[1] - Return $Response + Return $Response + } + Catch [Exception] { + $Proceed = Resolve-LMException -LMException $PSItem + If (!$Proceed) { + Return } - Catch [Exception] { - $Proceed = Resolve-LMException -LMException $PSItem - If (!$Proceed) { - Return - } - } + } Return $Results } Else { diff --git a/Public/Get-LMDatasourceOverviewGraph.ps1 b/Public/Get-LMDatasourceOverviewGraph.ps1 index 8cc8703..d23564c 100644 --- a/Public/Get-LMDatasourceOverviewGraph.ps1 +++ b/Public/Get-LMDatasourceOverviewGraph.ps1 @@ -2,37 +2,37 @@ Function Get-LMDatasourceOverviewGraph { [CmdletBinding()] Param ( - [Parameter(Mandatory,ParameterSetName = 'Id-dsId')] - [Parameter(Mandatory,ParameterSetName = 'Id-dsName')] + [Parameter(Mandatory, ParameterSetName = 'Id-dsId')] + [Parameter(Mandatory, ParameterSetName = 'Id-dsName')] [Int]$Id, - [Parameter(Mandatory,ParameterSetName = 'dsName')] - [Parameter(Mandatory,ParameterSetName = 'Id-dsName')] - [Parameter(Mandatory,ParameterSetName = 'Name-dsName')] - [Parameter(Mandatory,ParameterSetName = 'Filter-dsName')] + [Parameter(Mandatory, ParameterSetName = 'dsName')] + [Parameter(Mandatory, ParameterSetName = 'Id-dsName')] + [Parameter(Mandatory, ParameterSetName = 'Name-dsName')] + [Parameter(Mandatory, ParameterSetName = 'Filter-dsName')] [String]$DataSourceName, - [Parameter(Mandatory,ParameterSetName = 'dsId')] - [Parameter(Mandatory,ParameterSetName = 'Id-dsId')] - [Parameter(Mandatory,ParameterSetName = 'Name-dsId')] - [Parameter(Mandatory,ParameterSetName = 'Filter-dsId')] + [Parameter(Mandatory, ParameterSetName = 'dsId')] + [Parameter(Mandatory, ParameterSetName = 'Id-dsId')] + [Parameter(Mandatory, ParameterSetName = 'Name-dsId')] + [Parameter(Mandatory, ParameterSetName = 'Filter-dsId')] [String]$DataSourceId, - [Parameter(Mandatory,ParameterSetName = 'Name-dsId')] - [Parameter(Mandatory,ParameterSetName = 'Name-dsName')] + [Parameter(Mandatory, ParameterSetName = 'Name-dsId')] + [Parameter(Mandatory, ParameterSetName = 'Name-dsName')] [String]$Name, - [Parameter(Mandatory,ParameterSetName = 'Filter-dsId')] - [Parameter(Mandatory,ParameterSetName = 'Filter-dsName')] + [Parameter(Mandatory, ParameterSetName = 'Filter-dsId')] + [Parameter(Mandatory, ParameterSetName = 'Filter-dsName')] [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds If ($Script:LMAuth.Valid) { - If($DataSourceName){ + If ($DataSourceName) { $LookupResult = (Get-LMDatasource -Name $DataSourceName).Id If (Test-LookupResult -Result $LookupResult -LookupString $DataSourceName) { Return diff --git a/Public/Get-LMDatasourceUpdateHistory.ps1 b/Public/Get-LMDatasourceUpdateHistory.ps1 index 572cbf7..8896cbf 100644 --- a/Public/Get-LMDatasourceUpdateHistory.ps1 +++ b/Public/Get-LMDatasourceUpdateHistory.ps1 @@ -48,7 +48,7 @@ Function Get-LMDatasourceUpdateHistory { [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMDevice.ps1 b/Public/Get-LMDevice.ps1 index 96a14f5..ab0e089 100644 --- a/Public/Get-LMDevice.ps1 +++ b/Public/Get-LMDevice.ps1 @@ -73,17 +73,17 @@ Function Get-LMDevice { [Parameter(ParameterSetName = 'Delta')] [String]$DeltaId, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds If ($Script:LMAuth.Valid) { #Build header and uri - If($Delta -or $DeltaId){ + If ($Delta -or $DeltaId) { $ResourcePath = "/device/devices/delta" } - Else{ + Else { $ResourcePath = "/device/devices" } @@ -110,7 +110,7 @@ Function Get-LMDevice { $QueryParams = "?filter=$ValidFilter&size=$BatchSize&offset=$Count&sort=+id" } } - If($Delta -and $DeltaIdResponse){ + If ($Delta -and $DeltaIdResponse) { $QueryParams = $QueryParams + "&deltaId=$DeltaIdResponse" } Try { @@ -125,7 +125,7 @@ Function Get-LMDevice { $Response = Invoke-RestMethod -Uri $Uri -Method "GET" -Headers $Headers[0] -WebSession $Headers[1] #Store delta id if delta switch is present - If($Response.deltaId -and !$DeltaIdResponse){ + If ($Response.deltaId -and !$DeltaIdResponse) { $DeltaIdResponse = $Response.deltaId Write-LMHost "[INFO]: Delta switch detected, for further queries you can use deltaId: $DeltaIdResponse to perform additional delta requests. This variable can be accessed by referencing the `$LMDeltaId " -ForegroundColor Yellow Set-Variable -Name "LMDeltaId" -Value $DeltaIdResponse -Scope global diff --git a/Public/Get-LMDeviceAlertSettings.ps1 b/Public/Get-LMDeviceAlertSettings.ps1 index de37483..bb73acd 100644 --- a/Public/Get-LMDeviceAlertSettings.ps1 +++ b/Public/Get-LMDeviceAlertSettings.ps1 @@ -10,11 +10,11 @@ Function Get-LMDeviceAlertSettings { [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) - Begin{} - Process{ + Begin {} + Process { #Check if we are logged in and have valid api creds If ($Script:LMAuth.Valid) { @@ -86,5 +86,5 @@ Function Get-LMDeviceAlertSettings { Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." } } - End{} + End {} } diff --git a/Public/Get-LMDeviceAlerts.ps1 b/Public/Get-LMDeviceAlerts.ps1 index c660426..2ab282c 100644 --- a/Public/Get-LMDeviceAlerts.ps1 +++ b/Public/Get-LMDeviceAlerts.ps1 @@ -10,7 +10,7 @@ Function Get-LMDeviceAlerts { [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMDeviceConfigSourceData.ps1 b/Public/Get-LMDeviceConfigSourceData.ps1 index 305b437..7369aa8 100644 --- a/Public/Get-LMDeviceConfigSourceData.ps1 +++ b/Public/Get-LMDeviceConfigSourceData.ps1 @@ -35,12 +35,12 @@ Function Get-LMDeviceConfigSourceData { $Done = $false $Results = @() - Switch($ConfigType){ - "Delta" {$ConfigField = "!config"} - "Full" {$ConfigField = "!deltaConfig"} + Switch ($ConfigType) { + "Delta" { $ConfigField = "!config" } + "Full" { $ConfigField = "!deltaConfig" } } - If($LatestConfigOnly){ + If ($LatestConfigOnly) { $BatchSize = 1 $SortParam = "&sort=-pollTimestamp" } @@ -48,11 +48,11 @@ Function Get-LMDeviceConfigSourceData { #Loop through requests While (!$Done) { #Build query params - If($ConfigId){ + If ($ConfigId) { $ResourcePath = $ResourcePath + "/$ConfigId" $QueryParams = "?deviceId=$Id&deviceDataSourceId=$HdsId&instanceId=$HdsInsId&fields=$ConfigField" } - Else{ + Else { $QueryParams = "?size=$BatchSize&offset=$Count&fields=$ConfigField$SortParam" } @@ -72,7 +72,7 @@ Function Get-LMDeviceConfigSourceData { $Done = $true Return $Response } - ElseIf($LatestConfigOnly){ + Elseif ($LatestConfigOnly) { Return $Response.Items } #Check result size and if needed loop again diff --git a/Public/Get-LMDeviceData.ps1 b/Public/Get-LMDeviceData.ps1 index 7d488a0..dbb04a1 100644 --- a/Public/Get-LMDeviceData.ps1 +++ b/Public/Get-LMDeviceData.ps1 @@ -44,7 +44,7 @@ Function Get-LMDeviceData { [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) @@ -84,8 +84,10 @@ Function Get-LMDeviceData { #Lookup InstanceId If ($InstanceName) { + #Replace brakets in instance name + $InstanceName = $InstanceName -replace "[\[\]]", "?" - $LookupResult = (Get-LMDeviceDatasourceInstance -DeviceId $DeviceId -DatasourceId $DatasourceId | Where-Object { $_.displayName -eq $InstanceName -or $_.name -like "*$InstanceName" -or $_.name -eq "$InstanceName"}).Id + $LookupResult = (Get-LMDeviceDatasourceInstance -DeviceId $DeviceId -DatasourceId $DatasourceId | Where-Object { $_.displayName -eq $InstanceName -or $_.name -like "*$InstanceName" -or $_.name -eq "$InstanceName" }).Id If (Test-LookupResult -Result $LookupResult -LookupString $InstanceName) { return } @@ -114,7 +116,7 @@ Function Get-LMDeviceData { } #Add time range filter if provided data ranges - If($StartDate -and $EndDate){ + If ($StartDate -and $EndDate) { $QueryParams = $QueryParams + "&start=$StartDate&end=$EndDate" } @@ -151,22 +153,22 @@ Function Get-LMDeviceData { } } #Convert results into readable format for consumption - If($Response){ + If ($Response) { $DatapointResults = @($null) * ($Response.values | Measure-Object).Count - for ($v = 0 ; $v -lt ($Response.values | Measure-Object).Count ; $v++){ - $DatapointResults[$v] = [PSCustomObject]@{} - $DatapointResults[$v] | Add-Member -MemberType NoteProperty -Name "TimestampEpoch" -Value $Response.time[$v] + for ($v = 0 ; $v -lt ($Response.values | Measure-Object).Count ; $v++) { + $DatapointResults[$v] = [PSCustomObject]@{} + $DatapointResults[$v] | Add-Member -MemberType NoteProperty -Name "TimestampEpoch" -Value $Response.time[$v] - $TimestampConverted = (([System.DateTimeOffset]::FromUnixTimeMilliseconds($Response.time[$v])).DateTime).ToString() - $DatapointResults[$v] | Add-Member -MemberType NoteProperty -Name "TimestampUTC" -Value $TimestampConverted + $TimestampConverted = (([System.DateTimeOffset]::FromUnixTimeMilliseconds($Response.time[$v])).DateTime).ToString() + $DatapointResults[$v] | Add-Member -MemberType NoteProperty -Name "TimestampUTC" -Value $TimestampConverted - for ($dp = 0 ; $dp -lt ($Response.dataPoints | Measure-Object).Count; $dp++){ + for ($dp = 0 ; $dp -lt ($Response.dataPoints | Measure-Object).Count; $dp++) { $DatapointResults[$v] | Add-Member -MemberType NoteProperty -Name $Response.dataPoints[$dp] -Value $Response.values[$v][$dp] } } Return $DatapointResults } - Else{ + Else { Return } diff --git a/Public/Get-LMDeviceDataSourceList.ps1 b/Public/Get-LMDeviceDataSourceList.ps1 index 32451b4..61e013c 100644 --- a/Public/Get-LMDeviceDataSourceList.ps1 +++ b/Public/Get-LMDeviceDataSourceList.ps1 @@ -1,16 +1,69 @@ +<# +.SYNOPSIS +Retrieves a list of device data sources from LogicMonitor. + +.DESCRIPTION +The Get-LMDeviceDatasourceList function retrieves a list of device data sources from LogicMonitor based on the specified parameters. It supports filtering by device ID or device name, and allows customization of the batch size for pagination. + +.PARAMETER Id +Specifies the ID of the device for which to retrieve the data sources. This parameter is mandatory when using the 'Id' parameter set. + +.PARAMETER Name +Specifies the name of the device for which to retrieve the data sources. This parameter is mandatory when using the 'Name' parameter set. + +.PARAMETER Filter +Specifies additional filters to apply to the data sources. This parameter accepts an object representing the filter criteria. + +.PARAMETER BatchSize +Specifies the number of data sources to retrieve per batch. The default value is 1000. + +.EXAMPLE +Get-LMDeviceDatasourceList -Id 1234 +Retrieves the data sources for the device with ID 1234. + +.EXAMPLE +Get-LMDeviceDatasourceList -Name "MyDevice" +Retrieves the data sources for the device with the name "MyDevice". + +.EXAMPLE +Get-LMDeviceDatasourceList -Filter "Property -eq 'Value'" +Retrieves the data sources that match the specified filter criteria. + +#> +Function Get-LMDeviceDatasourceList { + [CmdletBinding(DefaultParameterSetName = 'Id')] + Param ( + [Parameter(Mandatory, ParameterSetName = 'Id')] + [Alias('DeviceId')] + [Int]$Id, + + [Parameter(ParameterSetName = 'Name')] + [Alias('DeviceName')] + [String]$Name, + + [Object]$Filter, + + [ValidateRange(1, 1000)] + [Int]$BatchSize = 1000 + ) + # Rest of the code... +} + Function Get-LMDeviceDatasourceList { [CmdletBinding(DefaultParameterSetName = 'Id')] Param ( [Parameter(Mandatory, ParameterSetName = 'Id')] + [Alias('DeviceId')] [Int]$Id, [Parameter(ParameterSetName = 'Name')] + [Alias('DeviceName')] [String]$Name, [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMDeviceDatasourceInstance.ps1 b/Public/Get-LMDeviceDatasourceInstance.ps1 index cda63e5..de33c7e 100644 --- a/Public/Get-LMDeviceDatasourceInstance.ps1 +++ b/Public/Get-LMDeviceDatasourceInstance.ps1 @@ -1,3 +1,39 @@ +<# +.SYNOPSIS +Retrieves instances of a LogicMonitor device datasource. + +.DESCRIPTION +The Get-LMDeviceDatasourceInstance function retrieves instances of a LogicMonitor device datasource based on the specified parameters. It requires a valid API authentication and authorization. + +.PARAMETER DatasourceName +Specifies the name of the datasource. This parameter is mandatory when using the 'Id-dsName' or 'Name-dsName' parameter sets. + +.PARAMETER DatasourceId +Specifies the ID of the datasource. This parameter is mandatory when using the 'Id-dsId' or 'Name-dsId' parameter sets. + +.PARAMETER Id +Specifies the ID of the device. This parameter is mandatory when using the 'Id-dsId' or 'Id-dsName' parameter sets. It can also be specified using the 'DeviceId' alias. + +.PARAMETER Name +Specifies the name of the device. This parameter is mandatory when using the 'Name-dsName' or 'Name-dsId' parameter sets. It can also be specified using the 'DeviceName' alias. + +.PARAMETER Filter +Specifies additional filters to apply to the instances. This parameter accepts an object representing the filter criteria. + +.PARAMETER BatchSize +Specifies the number of instances to retrieve per batch. The default value is 1000. + +.EXAMPLE +Get-LMDeviceDatasourceInstance -DatasourceName "CPU" -Name "Server01" -BatchSize 500 +Retrieves instances of the "CPU" datasource for the device named "Server01" with a batch size of 500. + +.EXAMPLE +Get-LMDeviceDatasourceInstance -DatasourceId 1234 -Id 5678 +Retrieves instances of the datasource with ID 1234 for the device with ID 5678. + +.NOTES +This function requires a valid API authentication and authorization. Use Connect-LMAccount to log in before running any commands. +#> Function Get-LMDeviceDatasourceInstance { [CmdletBinding()] @@ -12,17 +48,17 @@ Function Get-LMDeviceDatasourceInstance { [Parameter(Mandatory, ParameterSetName = 'Id-dsId')] [Parameter(Mandatory, ParameterSetName = 'Id-dsName')] - [Alias("Id")] - [Int]$DeviceId, + [Alias("DeviceId")] + [Int]$Id, [Parameter(Mandatory, ParameterSetName = 'Name-dsName')] [Parameter(Mandatory, ParameterSetName = 'Name-dsId')] - [Alias("Name")] - [String]$DeviceName, + [Alias("DeviceName")] + [String]$Name, [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) @@ -30,17 +66,17 @@ Function Get-LMDeviceDatasourceInstance { If ($Script:LMAuth.Valid) { #Lookup Device Id - If ($DeviceName) { - $LookupResult = (Get-LMDevice -Name $DeviceName).Id - If (Test-LookupResult -Result $LookupResult -LookupString $DeviceName) { + If ($Name) { + $LookupResult = (Get-LMDevice -Name $Name).Id + If (Test-LookupResult -Result $LookupResult -LookupString $Name) { return } - $DeviceId = $LookupResult + $Id = $LookupResult } #Lookup DatasourceId If ($DatasourceName -or $DatasourceId) { - $LookupResult = (Get-LMDeviceDataSourceList -Id $DeviceId | Where-Object { $_.dataSourceName -eq $DatasourceName -or $_.dataSourceId -eq $DatasourceId }).Id + $LookupResult = (Get-LMDeviceDataSourceList -Id $Id | Where-Object { $_.dataSourceName -eq $DatasourceName -or $_.dataSourceId -eq $DatasourceId }).Id If (Test-LookupResult -Result $LookupResult -LookupString $DatasourceName) { return } @@ -48,7 +84,7 @@ Function Get-LMDeviceDatasourceInstance { } #Build header and uri - $ResourcePath = "/device/devices/$DeviceId/devicedatasources/$HdsId/instances" + $ResourcePath = "/device/devices/$Id/devicedatasources/$HdsId/instances" #Initalize vars $QueryParams = "" diff --git a/Public/Get-LMDeviceDatasourceInstanceAlertRecipients.ps1 b/Public/Get-LMDeviceDatasourceInstanceAlertRecipients.ps1 new file mode 100644 index 0000000..e75ee93 --- /dev/null +++ b/Public/Get-LMDeviceDatasourceInstanceAlertRecipients.ps1 @@ -0,0 +1,138 @@ +<# +.SYNOPSIS +Retrieves the alert recipients for a specific data point in a LogicMonitor device datasource instance. + +.DESCRIPTION +The Get-LMDeviceDatasourceInstanceAlertRecipients function retrieves the alert recipients for a specific data point in a LogicMonitor device datasource instance. It requires valid API credentials and a logged-in session. + +.PARAMETER DatasourceName +Specifies the name of the datasource. This parameter is mandatory when using the 'Id-dsName' or 'Name-dsName' parameter sets. + +.PARAMETER DatasourceId +Specifies the ID of the datasource. This parameter is mandatory when using the 'Id-dsId' or 'Name-dsId' parameter sets. + +.PARAMETER Id +Specifies the ID of the device. This parameter is mandatory when using the 'Id-dsId' or 'Id-dsName' parameter sets. It can also be specified using the 'DeviceId' alias. + +.PARAMETER Name +Specifies the name of the device. This parameter is mandatory when using the 'Name-dsName' or 'Name-dsId' parameter sets. It can also be specified using the 'DeviceName' alias. + +.PARAMETER InstanceName +Specifies the name of the datasource instance. This parameter is mandatory. + +.PARAMETER DataPointName +Specifies the name of the data point. This parameter is mandatory. + +.EXAMPLE +Get-LMDeviceDatasourceInstanceAlertRecipients -DatasourceName "Ping-" -Name "Server01" -InstanceName "Instance01" -DataPointName "PingLossPercent" + +Retrieves the alert recipients for the "PingLossPercent" data point in the "CPU" datasource instance of the "Server01" device. + +.EXAMPLE +Get-LMDeviceDatasourceInstanceAlertRecipients -DatasourceId 123 -Id 456 -InstanceName "Instance01" -DataPointName "PingLossPercent" + +Retrieves the alert recipients for the "PingLossPercent" data point in the datasource instance with ID 123 of the device with ID 456. + +#> +Function Get-LMDeviceDatasourceInstanceAlertRecipients { + [CmdletBinding()] + Param ( + [Parameter(Mandatory, ParameterSetName = 'Id-dsName')] + [Parameter(Mandatory, ParameterSetName = 'Name-dsName')] + [String]$DatasourceName, + + [Parameter(Mandatory, ParameterSetName = 'Id-dsId')] + [Parameter(Mandatory, ParameterSetName = 'Name-dsId')] + [Int]$DatasourceId, + + [Parameter(Mandatory, ParameterSetName = 'Id-dsId')] + [Parameter(Mandatory, ParameterSetName = 'Id-dsName')] + [Alias('DeviceId')] + [Int]$Id, + + [Parameter(Mandatory, ParameterSetName = 'Name-dsName')] + [Parameter(Mandatory, ParameterSetName = 'Name-dsId')] + [Alias('DeviceName')] + [String]$Name, + + [Parameter(Mandatory)] + [String]$InstanceName, + + [Parameter(Mandatory)] + [String]$DataPointName + ) + #Check if we are logged in and have valid api creds + If ($Script:LMAuth.Valid) { + + #Lookup Device Id + If ($Name) { + $LookupResult = (Get-LMDevice -Name $Name).Id + If (Test-LookupResult -Result $LookupResult -LookupString $Name) { + return + } + $Id = $LookupResult + } + + #Lookup Hdsid + If ($DatasourceName -or $DatasourceId) { + $LookupResult = (Get-LMDeviceDataSourceList -Id $Id | Where-Object { $_.dataSourceName -eq $DatasourceName -or $_.dataSourceId -eq $DatasourceId }).Id + If (Test-LookupResult -Result $LookupResult -LookupString $DatasourceName) { + return + } + $HdsId = $LookupResult + } + + #Replace brakets in instance name + $InstanceName = $InstanceName -replace "[\[\]]", "?" + + #Lookup HdsiId + If ($DatasourceName) { + $LookupResult = (Get-LMDeviceDatasourceInstance -DatasourceName $DatasourceName -DeviceId $Id | Where-Object { $_.name -like "*$InstanceName"}).Id + If (Test-LookupResult -Result $LookupResult -LookupString $InstanceName) { + return + } + $HdsiId = $LookupResult + } + Else{ + $LookupResult = (Get-LMDeviceDatasourceInstance -DatasourceId $DatasourceId -DeviceId $Id | Where-Object { $_.name -like "*$InstanceName"}).Id + If (Test-LookupResult -Result $LookupResult -LookupString $InstanceName) { + return + } + $HdsiId = $LookupResult + } + + #Get datapoint id + $LookupResult = (Get-LMDeviceDatasourceInstanceAlertSetting -DatasourceId $DatasourceId -Id $Id -InstanceName $InstanceName | Where-Object { $_.dataPointName -like "*$DataPointName"}).Id + If (Test-LookupResult -Result $LookupResult -LookupString $DataPointName) { + return + } + $DsidpId = $LookupResult + + #Build header and uri + $ResourcePath = "/device/devices/$Id/devicedatasources/$HdsId/instances/$HdsiId/alertsettings/$DsidpId/recipients" + + #Initalize vars + $Results = @() + + Try { + $Headers = New-LMHeader -Auth $Script:LMAuth -Method "GET" -ResourcePath $ResourcePath + $Uri = "https://$($Script:LMAuth.Portal).logicmonitor.com/santaba/rest" + $ResourcePath + + Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation + + #Issue request + $Response = Invoke-RestMethod -Uri $Uri -Method "GET" -Headers $Headers[0] -WebSession $Headers[1] + + } + Catch [Exception] { + $Proceed = Resolve-LMException -LMException $PSItem + If (!$Proceed) { + Return + } + } + Return $Response + } + Else { + Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." + } +} diff --git a/Public/Get-LMDeviceDatasourceInstanceAlertSetting.ps1 b/Public/Get-LMDeviceDatasourceInstanceAlertSetting.ps1 index 79def1c..51b5a95 100644 --- a/Public/Get-LMDeviceDatasourceInstanceAlertSetting.ps1 +++ b/Public/Get-LMDeviceDatasourceInstanceAlertSetting.ps1 @@ -1,3 +1,43 @@ +<# +.SYNOPSIS +Retrieves the alert settings for a specific LogicMonitor device datasource instance. + +.DESCRIPTION +The Get-LMDeviceDatasourceInstanceAlertSetting function retrieves the alert settings for a specific LogicMonitor device datasource instance. It requires the device name or ID, datasource name or ID, and instance name as input parameters. Optionally, you can also provide a filter to narrow down the results. The function returns an array of alert settings for the specified instance. + +.PARAMETER DatasourceName +Specifies the name of the datasource. This parameter is mandatory when using the 'Id-dsName' or 'Name-dsName' parameter set. + +.PARAMETER DatasourceId +Specifies the ID of the datasource. This parameter is mandatory when using the 'Id-dsId' or 'Name-dsId' parameter set. + +.PARAMETER Id +Specifies the ID of the device. This parameter is mandatory when using the 'Id-dsId' or 'Id-dsName' parameter set. This parameter can also be specified using the 'DeviceId' alias. + +.PARAMETER Name +Specifies the name of the device. This parameter is mandatory when using the 'Name-dsName' or 'Name-dsId' parameter set. This parameter can also be specified using the 'DeviceName' alias. + +.PARAMETER InstanceName +Specifies the name of the instance for which to retrieve the alert settings. This parameter is mandatory. + +.PARAMETER Filter +Specifies a filter to narrow down the results. This parameter is optional. + +.PARAMETER BatchSize +Specifies the number of results to retrieve per batch. The default value is 1000. This parameter is optional. + +.EXAMPLE +Get-LMDeviceDatasourceInstanceAlertSetting -Name "MyDevice" -DatasourceName "MyDatasource" -InstanceName "MyInstance" +Retrieves the alert settings for the instance named "MyInstance" of the datasource "MyDatasource" on the device named "MyDevice". + +.EXAMPLE +Get-LMDeviceDatasourceInstanceAlertSetting -Id 123 -DatasourceId 456 -InstanceName "MyInstance" -Filter "Property -eq 'value'" +Retrieves the alert settings for the instance named "MyInstance" of the datasource with ID 456 on the device with ID 123, applying the specified filter. + +.NOTES +This function requires a valid LogicMonitor API authentication. Make sure you are logged in before running any commands by using the Connect-LMAccount function. +#> + Function Get-LMDeviceDatasourceInstanceAlertSetting { [CmdletBinding()] @@ -12,10 +52,12 @@ Function Get-LMDeviceDatasourceInstanceAlertSetting { [Parameter(Mandatory, ParameterSetName = 'Id-dsId')] [Parameter(Mandatory, ParameterSetName = 'Id-dsName')] + [Alias('DeviceId')] [Int]$Id, [Parameter(Mandatory, ParameterSetName = 'Name-dsName')] [Parameter(Mandatory, ParameterSetName = 'Name-dsId')] + [Alias('DeviceName')] [String]$Name, [Parameter(Mandatory)] @@ -23,7 +65,7 @@ Function Get-LMDeviceDatasourceInstanceAlertSetting { [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) @@ -47,16 +89,20 @@ Function Get-LMDeviceDatasourceInstanceAlertSetting { } $HdsId = $LookupResult } + + #Replace brakets in instance name + $InstanceName = $InstanceName -replace "[\[\]]", "?" + #Lookup HdsiId If ($DatasourceName) { - $LookupResult = (Get-LMDeviceDatasourceInstance -DatasourceName $DatasourceName -DeviceId $Id | Where-Object { $_.name -like "*$InstanceName"}).Id + $LookupResult = (Get-LMDeviceDatasourceInstance -DatasourceName $DatasourceName -DeviceId $Id | Where-Object { $_.name -like "*$InstanceName" }).Id If (Test-LookupResult -Result $LookupResult -LookupString $InstanceName) { return } $HdsiId = $LookupResult } - Else{ - $LookupResult = (Get-LMDeviceDatasourceInstance -DatasourceId $DatasourceId -DeviceId $Id | Where-Object { $_.name -like "*$InstanceName"}).Id + Else { + $LookupResult = (Get-LMDeviceDatasourceInstance -DatasourceId $DatasourceId -DeviceId $Id | Where-Object { $_.name -like "*$InstanceName" }).Id If (Test-LookupResult -Result $LookupResult -LookupString $InstanceName) { return } diff --git a/Public/Get-LMDeviceDatasourceInstanceGroup.ps1 b/Public/Get-LMDeviceDatasourceInstanceGroup.ps1 index bc0077b..34ef9fb 100644 --- a/Public/Get-LMDeviceDatasourceInstanceGroup.ps1 +++ b/Public/Get-LMDeviceDatasourceInstanceGroup.ps1 @@ -1,3 +1,45 @@ +<# +.SYNOPSIS +Retrieves the instance groups associated with a LogicMonitor device datasource. + +.DESCRIPTION +The Get-LMDeviceDatasourceInstanceGroup function retrieves the instance groups associated with a LogicMonitor device datasource. It requires valid API credentials and a logged-in session. + +.PARAMETER DatasourceName +Specifies the name of the datasource. This parameter is mandatory when using the 'Id-dsName' or 'Name-dsName' parameter sets. + +.PARAMETER DatasourceId +Specifies the ID of the datasource. This parameter is mandatory when using the 'Id-dsId' or 'Name-dsId' parameter sets. + +.PARAMETER Id +Specifies the ID of the device. This parameter is mandatory when using the 'Id-dsId', 'Id-dsName', or 'Id-HdsId' parameter sets. This parameter is also aliased as 'DeviceId'. + +.PARAMETER Name +Specifies the name of the device. This parameter is mandatory when using the 'Name-dsName', 'Name-dsId', or 'Name-HdsId' parameter sets. This parameter is also aliased as 'DeviceName'. + +.PARAMETER HdsId +Specifies the ID of the device datasource. This parameter is mandatory when using the 'Id-HdsId' or 'Name-HdsId' parameter sets. + +.PARAMETER Filter +Specifies an optional filter to apply to the results. + +.PARAMETER BatchSize +Specifies the number of results to retrieve per batch. The default value is 1000. + +.EXAMPLE +Get-LMDeviceDatasourceInstanceGroup -DatasourceName "CPU" -Name "Server01" +Retrieves the instance groups associated with the "CPU" datasource on the device named "Server01". + +.EXAMPLE +Get-LMDeviceDatasourceInstanceGroup -DatasourceId 123 -Id 456 +Retrieves the instance groups associated with the datasource with ID 123 on the device with ID 456. + +#> + +Function Get-LMDeviceDatasourceInstanceGroup { + ... +} + Function Get-LMDeviceDatasourceInstanceGroup { [CmdletBinding()] @@ -13,11 +55,13 @@ Function Get-LMDeviceDatasourceInstanceGroup { [Parameter(Mandatory, ParameterSetName = 'Id-dsId')] [Parameter(Mandatory, ParameterSetName = 'Id-dsName')] [Parameter(Mandatory, ParameterSetName = 'Id-HdsId')] + [Alias('DeviceId')] [Int]$Id, [Parameter(Mandatory, ParameterSetName = 'Name-dsName')] [Parameter(Mandatory, ParameterSetName = 'Name-dsId')] [Parameter(Mandatory, ParameterSetName = 'Name-HdsId')] + [Alias('DeviceName')] [String]$Name, [Parameter(Mandatory, ParameterSetName = 'Id-HdsId')] @@ -26,7 +70,7 @@ Function Get-LMDeviceDatasourceInstanceGroup { [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) diff --git a/Public/Get-LMDeviceEventSourceList.ps1 b/Public/Get-LMDeviceEventSourceList.ps1 index 0b5a2bc..6fe8d5c 100644 --- a/Public/Get-LMDeviceEventSourceList.ps1 +++ b/Public/Get-LMDeviceEventSourceList.ps1 @@ -10,7 +10,7 @@ Function Get-LMDeviceEventSourceList { [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMDeviceGroup.ps1 b/Public/Get-LMDeviceGroup.ps1 index 9f0ecef..39b14e1 100644 --- a/Public/Get-LMDeviceGroup.ps1 +++ b/Public/Get-LMDeviceGroup.ps1 @@ -41,7 +41,7 @@ Function Get-LMDeviceGroup { [CmdletBinding(DefaultParameterSetName = 'All')] Param ( - [Parameter(ParameterSetName = 'Id',ValueFromPipeline)] + [Parameter(ParameterSetName = 'Id', ValueFromPipeline)] [Int]$Id, [Parameter(ParameterSetName = 'Name')] @@ -50,7 +50,7 @@ Function Get-LMDeviceGroup { [Parameter(ParameterSetName = 'Filter')] [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds @@ -120,5 +120,5 @@ Function Get-LMDeviceGroup { Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." } } - End{} + End {} } diff --git a/Public/Get-LMDeviceGroupAlerts.ps1 b/Public/Get-LMDeviceGroupAlerts.ps1 index b25501a..0634c9e 100644 --- a/Public/Get-LMDeviceGroupAlerts.ps1 +++ b/Public/Get-LMDeviceGroupAlerts.ps1 @@ -10,7 +10,7 @@ Function Get-LMDeviceGroupAlerts { [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMDeviceGroupDatasourceAlertSetting.ps1 b/Public/Get-LMDeviceGroupDatasourceAlertSetting.ps1 index 7a83d55..e1a6a2d 100644 --- a/Public/Get-LMDeviceGroupDatasourceAlertSetting.ps1 +++ b/Public/Get-LMDeviceGroupDatasourceAlertSetting.ps1 @@ -21,7 +21,7 @@ Function Get-LMDeviceGroupDatasourceAlertSetting { [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMDeviceGroupDatasourceList.ps1 b/Public/Get-LMDeviceGroupDatasourceList.ps1 index 09d1704..daba80b 100644 --- a/Public/Get-LMDeviceGroupDatasourceList.ps1 +++ b/Public/Get-LMDeviceGroupDatasourceList.ps1 @@ -11,7 +11,7 @@ Function Get-LMDeviceGroupDatasourceList { [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMDeviceGroupDevices.ps1 b/Public/Get-LMDeviceGroupDevices.ps1 index fd00e8e..d250e80 100644 --- a/Public/Get-LMDeviceGroupDevices.ps1 +++ b/Public/Get-LMDeviceGroupDevices.ps1 @@ -12,7 +12,7 @@ Function Get-LMDeviceGroupDevices { [Boolean]$IncludeSubGroups = $false, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds @@ -65,7 +65,7 @@ Function Get-LMDeviceGroupDevices { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "GET" -Headers $Headers[0] -WebSession $Headers[1] #Stop looping if single device, no need to continue @@ -92,7 +92,7 @@ Function Get-LMDeviceGroupDevices { } #Dedupe results } - If($Results){ + If ($Results) { $Results = ($Results | Sort-Object -Property Id -Unique) } Return (Add-ObjectTypeInfo -InputObject $Results -TypeName "LogicMonitor.Device" ) diff --git a/Public/Get-LMDeviceGroupGroups.ps1 b/Public/Get-LMDeviceGroupGroups.ps1 index 9f1fb76..07f2543 100644 --- a/Public/Get-LMDeviceGroupGroups.ps1 +++ b/Public/Get-LMDeviceGroupGroups.ps1 @@ -10,7 +10,7 @@ Function Get-LMDeviceGroupGroups { [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMDeviceGroupProperty.ps1 b/Public/Get-LMDeviceGroupProperty.ps1 index 8f42cf5..2a29b22 100644 --- a/Public/Get-LMDeviceGroupProperty.ps1 +++ b/Public/Get-LMDeviceGroupProperty.ps1 @@ -10,7 +10,7 @@ Function Get-LMDeviceGroupProperty { [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMDeviceGroupSDT.ps1 b/Public/Get-LMDeviceGroupSDT.ps1 index 47c5074..2a37519 100644 --- a/Public/Get-LMDeviceGroupSDT.ps1 +++ b/Public/Get-LMDeviceGroupSDT.ps1 @@ -10,7 +10,7 @@ Function Get-LMDeviceGroupSDT { [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMDeviceGroupSDTHistory.ps1 b/Public/Get-LMDeviceGroupSDTHistory.ps1 index a5143d8..cfeb464 100644 --- a/Public/Get-LMDeviceGroupSDTHistory.ps1 +++ b/Public/Get-LMDeviceGroupSDTHistory.ps1 @@ -10,7 +10,7 @@ Function Get-LMDeviceGroupSDTHistory { [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMDeviceInstanceData.ps1 b/Public/Get-LMDeviceInstanceData.ps1 index f47a787..8d0d331 100644 --- a/Public/Get-LMDeviceInstanceData.ps1 +++ b/Public/Get-LMDeviceInstanceData.ps1 @@ -56,7 +56,7 @@ Function Get-LMDeviceInstanceData { #Convert to epoch, if not set use defaults If (!$StartDate) { - [int]$StartDate = ([DateTimeOffset]$(Get-Date).AddHours(-24)).ToUnixTimeSeconds() + [int]$StartDate = ([DateTimeOffset]$(Get-Date).AddHours(-24)).ToUnixTimeSeconds() } Else { [int]$StartDate = ([DateTimeOffset]$($StartDate)).ToUnixTimeSeconds() diff --git a/Public/Get-LMDeviceInstanceList.ps1 b/Public/Get-LMDeviceInstanceList.ps1 index b115db7..bdb7893 100644 --- a/Public/Get-LMDeviceInstanceList.ps1 +++ b/Public/Get-LMDeviceInstanceList.ps1 @@ -10,7 +10,7 @@ Function Get-LMDeviceInstanceList { [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000, [Boolean]$CountOnly @@ -63,7 +63,6 @@ Function Get-LMDeviceInstanceList { return $Response.Total } - #Stop looping if single device, no need to continue If (![bool]$Response.psobject.Properties["total"]) { $Done = $true diff --git a/Public/Get-LMDeviceNetflowEndpoints.ps1 b/Public/Get-LMDeviceNetflowEndpoints.ps1 index e13c456..45a99b4 100644 --- a/Public/Get-LMDeviceNetflowEndpoints.ps1 +++ b/Public/Get-LMDeviceNetflowEndpoints.ps1 @@ -14,7 +14,7 @@ Function Get-LMDeviceNetflowEndpoints { [Datetime]$EndDate, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMDeviceNetflowFlows.ps1 b/Public/Get-LMDeviceNetflowFlows.ps1 index 5832743..ecc6f8c 100644 --- a/Public/Get-LMDeviceNetflowFlows.ps1 +++ b/Public/Get-LMDeviceNetflowFlows.ps1 @@ -14,7 +14,7 @@ Function Get-LMDeviceNetflowFlows { [Datetime]$EndDate, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMDeviceNetflowPorts.ps1 b/Public/Get-LMDeviceNetflowPorts.ps1 index ec8579c..7b2a525 100644 --- a/Public/Get-LMDeviceNetflowPorts.ps1 +++ b/Public/Get-LMDeviceNetflowPorts.ps1 @@ -14,7 +14,7 @@ Function Get-LMDeviceNetflowPorts { [Datetime]$EndDate, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMDeviceProperty.ps1 b/Public/Get-LMDeviceProperty.ps1 index ff5f973..d17df5b 100644 --- a/Public/Get-LMDeviceProperty.ps1 +++ b/Public/Get-LMDeviceProperty.ps1 @@ -15,7 +15,7 @@ Function Get-LMDeviceProperty { [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds @@ -42,10 +42,10 @@ Function Get-LMDeviceProperty { } #Build header and uri - If($PropertyName){ + If ($PropertyName) { $ResourcePath = "/device/devices/$Id/properties/$PropertyName" } - Else{ + Else { $ResourcePath = "/device/devices/$Id/properties" } diff --git a/Public/Get-LMDeviceSDT.ps1 b/Public/Get-LMDeviceSDT.ps1 index 6ac6ba5..150cc30 100644 --- a/Public/Get-LMDeviceSDT.ps1 +++ b/Public/Get-LMDeviceSDT.ps1 @@ -10,7 +10,7 @@ Function Get-LMDeviceSDT { [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMDeviceSDTHistory.ps1 b/Public/Get-LMDeviceSDTHistory.ps1 index 49c1efb..f59408d 100644 --- a/Public/Get-LMDeviceSDTHistory.ps1 +++ b/Public/Get-LMDeviceSDTHistory.ps1 @@ -10,7 +10,7 @@ Function Get-LMDeviceSDTHistory { [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMEscalationChain.ps1 b/Public/Get-LMEscalationChain.ps1 index 4cd511d..6daba70 100644 --- a/Public/Get-LMEscalationChain.ps1 +++ b/Public/Get-LMEscalationChain.ps1 @@ -11,7 +11,7 @@ Function Get-LMEscalationChain { [Parameter(ParameterSetName = 'Filter')] [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMEventSource.ps1 b/Public/Get-LMEventSource.ps1 index 5cd3b51..0c9b154 100644 --- a/Public/Get-LMEventSource.ps1 +++ b/Public/Get-LMEventSource.ps1 @@ -11,7 +11,7 @@ Function Get-LMEventSource { [Parameter(ParameterSetName = 'Filter')] [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMIntegrationLogs.ps1 b/Public/Get-LMIntegrationLogs.ps1 index 3848d2e..7a3a30a 100644 --- a/Public/Get-LMIntegrationLogs.ps1 +++ b/Public/Get-LMIntegrationLogs.ps1 @@ -17,7 +17,7 @@ Function Get-LMIntegrationLogs { [Parameter(ParameterSetName = 'Filter')] [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds @@ -35,7 +35,7 @@ Function Get-LMIntegrationLogs { #Convert to epoch, if not set use defaults If (!$StartDate) { - If($PSCmdlet.ParameterSetName -ne "Id"){ + If ($PSCmdlet.ParameterSetName -ne "Id") { Write-LMHost "[WARN]: No start date specified, defaulting to last 30 days" -ForegroundColor Yellow } [int]$StartDate = ([DateTimeOffset]$(Get-Date).AddDays(-30)).ToUnixTimeSeconds() @@ -90,7 +90,7 @@ Function Get-LMIntegrationLogs { $Done = $true Write-LMHost "[WARN]: Reached $QueryLimit record query limitation for this endpoint" -ForegroundColor Yellow } - ElseIf ($Count -ge $Total -and $Total -ge 0) { + Elseif ($Count -ge $Total -and $Total -ge 0) { $Done = $true } } diff --git a/Public/Get-LMNetscan.ps1 b/Public/Get-LMNetscan.ps1 index fd5b24b..50e0884 100644 --- a/Public/Get-LMNetscan.ps1 +++ b/Public/Get-LMNetscan.ps1 @@ -11,7 +11,7 @@ Function Get-LMNetscan { [Parameter(ParameterSetName = 'Filter')] [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMNetscanExecution.ps1 b/Public/Get-LMNetscanExecution.ps1 index 9477f55..ad81645 100644 --- a/Public/Get-LMNetscanExecution.ps1 +++ b/Public/Get-LMNetscanExecution.ps1 @@ -2,15 +2,15 @@ Function Get-LMNetscanExecution { [CmdletBinding(DefaultParameterSetName = 'Id')] Param ( - [Parameter(Mandatory,ParameterSetName = 'Id')] + [Parameter(Mandatory, ParameterSetName = 'Id')] [Int]$Id, - [Parameter(Mandatory,ParameterSetName = 'Name')] + [Parameter(Mandatory, ParameterSetName = 'Name')] [String]$Name, [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMNetscanExecutionDevices.ps1 b/Public/Get-LMNetscanExecutionDevices.ps1 index 08b912d..4939e69 100644 --- a/Public/Get-LMNetscanExecutionDevices.ps1 +++ b/Public/Get-LMNetscanExecutionDevices.ps1 @@ -2,18 +2,18 @@ Function Get-LMNetscanExecutionDevices { [CmdletBinding(DefaultParameterSetName = 'Id')] Param ( - [Parameter(Mandatory,ParameterSetName = 'Id')] + [Parameter(Mandatory, ParameterSetName = 'Id')] [Int]$Id, - [Parameter(Mandatory,ParameterSetName = 'Id')] + [Parameter(Mandatory, ParameterSetName = 'Id')] [String]$NspId, - [Parameter(Mandatory,ParameterSetName = 'Name')] + [Parameter(Mandatory, ParameterSetName = 'Name')] [String]$NspName, [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMNetscanGroup.ps1 b/Public/Get-LMNetscanGroup.ps1 index 264f831..e80b085 100644 --- a/Public/Get-LMNetscanGroup.ps1 +++ b/Public/Get-LMNetscanGroup.ps1 @@ -11,7 +11,7 @@ Function Get-LMNetscanGroup { [Parameter(ParameterSetName = 'Filter')] [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMOpsNote.ps1 b/Public/Get-LMOpsNote.ps1 index 10fa4b9..21044e3 100644 --- a/Public/Get-LMOpsNote.ps1 +++ b/Public/Get-LMOpsNote.ps1 @@ -11,7 +11,7 @@ Function Get-LMOpsNote { [Parameter(ParameterSetName = 'Filter')] [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMPortalInfo.ps1 b/Public/Get-LMPortalInfo.ps1 index c98e066..001f190 100644 --- a/Public/Get-LMPortalInfo.ps1 +++ b/Public/Get-LMPortalInfo.ps1 @@ -15,7 +15,7 @@ Function Get-LMPortalInfo { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "GET" -Headers $Headers[0] -WebSession $Headers[1] } Catch [Exception] { diff --git a/Public/Get-LMPropertySource.ps1 b/Public/Get-LMPropertySource.ps1 index 117a846..110ef98 100644 --- a/Public/Get-LMPropertySource.ps1 +++ b/Public/Get-LMPropertySource.ps1 @@ -11,7 +11,7 @@ Function Get-LMPropertySource { [Parameter(ParameterSetName = 'Filter')] [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMRecipientGroup.ps1 b/Public/Get-LMRecipientGroup.ps1 index 1294de1..ad73fbd 100644 --- a/Public/Get-LMRecipientGroup.ps1 +++ b/Public/Get-LMRecipientGroup.ps1 @@ -11,7 +11,7 @@ Function Get-LMRecipientGroup { [Parameter(ParameterSetName = 'Filter')] [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMReport.ps1 b/Public/Get-LMReport.ps1 index daec870..95fa46b 100644 --- a/Public/Get-LMReport.ps1 +++ b/Public/Get-LMReport.ps1 @@ -11,7 +11,7 @@ Function Get-LMReport { [Parameter(ParameterSetName = 'Filter')] [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMReportGroup.ps1 b/Public/Get-LMReportGroup.ps1 index 47317a6..4cfd037 100644 --- a/Public/Get-LMReportGroup.ps1 +++ b/Public/Get-LMReportGroup.ps1 @@ -11,7 +11,7 @@ Function Get-LMReportGroup { [Parameter(ParameterSetName = 'Filter')] [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMRepositoryLogicModules.ps1 b/Public/Get-LMRepositoryLogicModules.ps1 index 3d80445..e8c3fdd 100644 --- a/Public/Get-LMRepositoryLogicModules.ps1 +++ b/Public/Get-LMRepositoryLogicModules.ps1 @@ -32,7 +32,7 @@ Function Get-LMRepositoryLogicModules { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data $Results = $Response.Items } diff --git a/Public/Get-LMRole.ps1 b/Public/Get-LMRole.ps1 index d93c6b8..94e1631 100644 --- a/Public/Get-LMRole.ps1 +++ b/Public/Get-LMRole.ps1 @@ -11,7 +11,7 @@ Function Get-LMRole { [Parameter(ParameterSetName = 'Filter')] [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMSDT.ps1 b/Public/Get-LMSDT.ps1 index c6111d0..9374754 100644 --- a/Public/Get-LMSDT.ps1 +++ b/Public/Get-LMSDT.ps1 @@ -11,7 +11,7 @@ Function Get-LMSDT { [Parameter(ParameterSetName = 'Filter')] [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMTopologyMap.ps1 b/Public/Get-LMTopologyMap.ps1 index ac59161..0d91af0 100644 --- a/Public/Get-LMTopologyMap.ps1 +++ b/Public/Get-LMTopologyMap.ps1 @@ -11,7 +11,7 @@ Function Get-LMTopologyMap { [Parameter(ParameterSetName = 'Filter')] [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMTopologySource.ps1 b/Public/Get-LMTopologySource.ps1 index 46cc42f..69a0bbc 100644 --- a/Public/Get-LMTopologySource.ps1 +++ b/Public/Get-LMTopologySource.ps1 @@ -11,7 +11,7 @@ Function Get-LMTopologySource { [Parameter(ParameterSetName = 'Filter')] [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMUnmonitoredDevice.ps1 b/Public/Get-LMUnmonitoredDevice.ps1 index b83d932..ba229c4 100644 --- a/Public/Get-LMUnmonitoredDevice.ps1 +++ b/Public/Get-LMUnmonitoredDevice.ps1 @@ -5,7 +5,7 @@ Function Get-LMUnmonitoredDevice { [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMUsageMetrics.ps1 b/Public/Get-LMUsageMetrics.ps1 index dc6cab0..a3372d1 100644 --- a/Public/Get-LMUsageMetrics.ps1 +++ b/Public/Get-LMUsageMetrics.ps1 @@ -16,7 +16,7 @@ Function Get-LMUsageMetrics { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "GET" -Headers $Headers[0] -WebSession $Headers[1] Return $Response diff --git a/Public/Get-LMUser.ps1 b/Public/Get-LMUser.ps1 index 099a64f..e0def4d 100644 --- a/Public/Get-LMUser.ps1 +++ b/Public/Get-LMUser.ps1 @@ -11,7 +11,7 @@ Function Get-LMUser { [Parameter(ParameterSetName = 'Filter')] [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMUserGroup.ps1 b/Public/Get-LMUserGroup.ps1 index 830dd80..a5dccac 100644 --- a/Public/Get-LMUserGroup.ps1 +++ b/Public/Get-LMUserGroup.ps1 @@ -11,7 +11,7 @@ Function Get-LMUserGroup { [Parameter(ParameterSetName = 'Filter')] [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMWebsite.ps1 b/Public/Get-LMWebsite.ps1 index f70b88d..58bcf63 100644 --- a/Public/Get-LMWebsite.ps1 +++ b/Public/Get-LMWebsite.ps1 @@ -57,7 +57,7 @@ Function Get-LMWebsite { [Parameter(ParameterSetName = 'Filter')] [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMWebsiteAlerts.ps1 b/Public/Get-LMWebsiteAlerts.ps1 index d11c8bf..8f261f7 100644 --- a/Public/Get-LMWebsiteAlerts.ps1 +++ b/Public/Get-LMWebsiteAlerts.ps1 @@ -10,7 +10,7 @@ Function Get-LMWebsiteAlerts { [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMWebsiteCheckpoint.ps1 b/Public/Get-LMWebsiteCheckpoint.ps1 index e6f2eed..63d2cb7 100644 --- a/Public/Get-LMWebsiteCheckpoint.ps1 +++ b/Public/Get-LMWebsiteCheckpoint.ps1 @@ -6,7 +6,7 @@ Function Get-LMWebsiteCheckpoint { [Parameter(ParameterSetName = 'Filter')] [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMWebsiteData.ps1 b/Public/Get-LMWebsiteData.ps1 index ef877c3..d92eb7d 100644 --- a/Public/Get-LMWebsiteData.ps1 +++ b/Public/Get-LMWebsiteData.ps1 @@ -61,7 +61,7 @@ Function Get-LMWebsiteData { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "GET" -Headers $Headers[0] -WebSession $Headers[1] Return $Response diff --git a/Public/Get-LMWebsiteGroup.ps1 b/Public/Get-LMWebsiteGroup.ps1 index a918147..89412bf 100644 --- a/Public/Get-LMWebsiteGroup.ps1 +++ b/Public/Get-LMWebsiteGroup.ps1 @@ -11,7 +11,7 @@ Function Get-LMWebsiteGroup { [Parameter(ParameterSetName = 'Filter')] [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMWebsiteGroupAlerts.ps1 b/Public/Get-LMWebsiteGroupAlerts.ps1 index dc48ae6..88462e7 100644 --- a/Public/Get-LMWebsiteGroupAlerts.ps1 +++ b/Public/Get-LMWebsiteGroupAlerts.ps1 @@ -10,7 +10,7 @@ Function Get-LMWebsiteGroupAlerts { [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMWebsiteGroupSDT.ps1 b/Public/Get-LMWebsiteGroupSDT.ps1 index f587ad7..ffd4406 100644 --- a/Public/Get-LMWebsiteGroupSDT.ps1 +++ b/Public/Get-LMWebsiteGroupSDT.ps1 @@ -10,7 +10,7 @@ Function Get-LMWebsiteGroupSDT { [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMWebsiteGroupSDTHistory.ps1 b/Public/Get-LMWebsiteGroupSDTHistory.ps1 index 7ae6480..d0e262f 100644 --- a/Public/Get-LMWebsiteGroupSDTHistory.ps1 +++ b/Public/Get-LMWebsiteGroupSDTHistory.ps1 @@ -10,7 +10,7 @@ Function Get-LMWebsiteGroupSDTHistory { [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMWebsiteProperty.ps1 b/Public/Get-LMWebsiteProperty.ps1 index 830478c..cd6dcae 100644 --- a/Public/Get-LMWebsiteProperty.ps1 +++ b/Public/Get-LMWebsiteProperty.ps1 @@ -10,7 +10,7 @@ Function Get-LMWebsiteProperty { [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMWebsiteSDT.ps1 b/Public/Get-LMWebsiteSDT.ps1 index 9d06dde..b331c02 100644 --- a/Public/Get-LMWebsiteSDT.ps1 +++ b/Public/Get-LMWebsiteSDT.ps1 @@ -10,7 +10,7 @@ Function Get-LMWebsiteSDT { [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Get-LMWebsiteSDTHistory.ps1 b/Public/Get-LMWebsiteSDTHistory.ps1 index 04b4757..2adabde 100644 --- a/Public/Get-LMWebsiteSDTHistory.ps1 +++ b/Public/Get-LMWebsiteSDTHistory.ps1 @@ -10,7 +10,7 @@ Function Get-LMWebsiteSDTHistory { [Object]$Filter, - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [Int]$BatchSize = 1000 ) #Check if we are logged in and have valid api creds diff --git a/Public/Import-LMDashboard.ps1 b/Public/Import-LMDashboard.ps1 index 05bab7a..eb33819 100644 --- a/Public/Import-LMDashboard.ps1 +++ b/Public/Import-LMDashboard.ps1 @@ -83,29 +83,29 @@ Function Import-LMDashboard { $Results = @() $DashboardList = @() - If($ParentGroupName){ + If ($ParentGroupName) { $ParentGroupId = (Get-LMDashboardGroup -Name $ParentGroupName | Select-Object -First 1 ).Id } - If($ParentGroupId){ + If ($ParentGroupId) { $ParentGroupName = (Get-LMDashboardGroup -Id $ParentGroupId | Select-Object -First 1 ).Name } - If($FilePath){ - If((Get-Item $FilePath) -is [System.IO.DirectoryInfo]){ + If ($FilePath) { + If ((Get-Item $FilePath) -is [System.IO.DirectoryInfo]) { $FullPath = (Resolve-Path $FilePath).Path - $Files = Get-ChildItem $FullPath -Recurse | Where-Object {([IO.Path]::GetExtension($_.Name) -eq '.json')} - Foreach($F in $Files){ + $Files = Get-ChildItem $FullPath -Recurse | Where-Object { ([IO.Path]::GetExtension($_.Name) -eq '.json') } + Foreach ($F in $Files) { #Convert from json into object $RawFile = Get-Content $F.FullName -Raw | ConvertFrom-Json $DashboardList += @{ - file = $RawFile - path = $($F.DirectoryName -split $FullPath)[1] - parentid = $ParentGroupId + file = $RawFile + path = $($F.DirectoryName -split $FullPath)[1] + parentid = $ParentGroupId parentname = $ParentGroupName } } } - Else{ + Else { If (!(Test-Path -Path $FilePath) -and (!([IO.Path]::GetExtension($FilePath) -eq '.json'))) { Write-Error "File not found or is not a valid json file, check file path and try again" Return @@ -114,39 +114,39 @@ Function Import-LMDashboard { #Convert from json into object $RawFile = Get-Content $FilePath -Raw | ConvertFrom-Json $DashboardList += @{ - file = $RawFile - path = "" - parentid = $ParentGroupId + file = $RawFile + path = "" + parentid = $ParentGroupId parentname = $ParentGroupName } } } - If($File){ + If ($File) { $DashboardList += @{ - file = $File | ConvertFrom-Json - path = "" - parentid = $ParentGroupId + file = $File | ConvertFrom-Json + path = "" + parentid = $ParentGroupId parentname = $ParentGroupName } } - If($GithubUserRepo){ + If ($GithubUserRepo) { $Headers = @{} - If($GithubAccessToken){ - $Headers = @{"Authorization"="token $GithubAccessToken"} + If ($GithubAccessToken) { + $Headers = @{"Authorization" = "token $GithubAccessToken" } } $Uri = "https://api.github.com/repos/$GithubUserRepo/git/trees/master?recursive=1" - $RepoData = (Invoke-RestMethod -Uri $Uri -Headers $Headers[0] -WebSession $Headers[1]).tree | Where-Object {$_.Path -like "*.json" -and $_.Path -notlike "Packages/LogicMonitor_Dashboards*"} | Select-Object path,url - If($RepoData){ + $RepoData = (Invoke-RestMethod -Uri $Uri -Headers $Headers[0] -WebSession $Headers[1]).tree | Where-Object { $_.Path -like "*.json" -and $_.Path -notlike "Packages/LogicMonitor_Dashboards*" } | Select-Object path, url + If ($RepoData) { $TotalItems = ($RepoData | Measure-Object).Count Write-LMHost "[INFO]: Found $TotalItems JSON files from Github repo ($GithubUserRepo)" - Foreach ($Item in $RepoData){ + Foreach ($Item in $RepoData) { $EncodedDash = (Invoke-RestMethod -Uri $Item.url -Headers $Headers[0] -WebSession $Headers[1]).content $DashboardList += @{ - file = [Text.Encoding]::Utf8.GetString([Convert]::FromBase64String($EncodedDash)) | ConvertFrom-Json - path = [System.IO.Path]::GetDirectoryName($Item.path) - parentid = $ParentGroupId + file = [Text.Encoding]::Utf8.GetString([Convert]::FromBase64String($EncodedDash)) | ConvertFrom-Json + path = [System.IO.Path]::GetDirectoryName($Item.path) + parentid = $ParentGroupId parentname = $ParentGroupName } @@ -155,39 +155,39 @@ Function Import-LMDashboard { } } - If($ReplaceAPITokensOnImport -and !($APIToken)){ + If ($ReplaceAPITokensOnImport -and !($APIToken)) { $DashboardAPIRoleName = "lm-dynamic-dashboards" $DashboardAPIUserName = "lm_dynamic_dashboards" $DashboardAPIRole = Get-LMRole -Name $DashboardAPIRoleName $DashboardAPIUser = Get-LMUser -Name $DashboardAPIUserName - If(!$DashboardAPIRole){ + If (!$DashboardAPIRole) { $DashboardAPIRole = New-LMRole -Name $DashboardAPIRoleName -ResourcePermission view -DashboardsPermission manage -Description "Auto provisioned for use with dynamic dashboards" Write-LMHost "[INFO]: Successfully generated required API role ($DashboardAPIRoleName) for dynamic dashboards" } - If(!$DashboardAPIUser){ + If (!$DashboardAPIUser) { $DashboardAPIUser = New-LMAPIUser -Username "$DashboardAPIUserName" -note "Auto provisioned for use with dynamic dashboards" -RoleNames @($DashboardAPIRoleName) Write-LMHost "[INFO]: Successfully generated required API user ($DashboardAPIUserName) for dynamic dashboards" } - If($DashboardAPIRole -and $DashboardAPIUser){ + If ($DashboardAPIRole -and $DashboardAPIUser) { $APIToken = New-LMAPIToken -Username $DashboardAPIUserName -Note "Auto provisioned for use with dynamic dashboards" - If($APIToken){ + If ($APIToken) { Write-LMHost "[INFO]: Successfully generated required API token for dynamic dashboards for user: $DashboardAPIUserName" } } - Else{ + Else { Write-LMHost "[WARN]: Unable to generate required API token for dynamic dashboards, manually update the required tokens to use dynamic dashboards" -ForegroundColor Yellow } } - Foreach($Dashboard in $DashboardList){ + Foreach ($Dashboard in $DashboardList) { #Swap apiKeys for dynamic dashboards - If($ReplaceAPITokensOnImport){ - If($APIToken){ - If($Dashboard.file.widgetTokens.name -contains "apiKey"){ - $KeyIndex = $Dashboard.file.widgetTokens.name.toLower().IndexOf("apikey") - $Dashboard.file.widgetTokens[$KeyIndex].value = $APIToken.accessKey + If ($ReplaceAPITokensOnImport) { + If ($APIToken) { + If ($Dashboard.file.widgetTokens.name -contains "apiKey") { + $KeyIndex = $Dashboard.file.widgetTokens.name.toLower().IndexOf("apikey") + $Dashboard.file.widgetTokens[$KeyIndex].value = $APIToken.accessKey } - If($Dashboard.file.widgetTokens.name -contains "apiID"){ + If ($Dashboard.file.widgetTokens.name -contains "apiID") { $IdIndex = $Dashboard.file.widgetTokens.name.toLower().IndexOf("apiid") $Dashboard.file.widgetTokens[$IdIndex].value = $APIToken.accessId } @@ -195,32 +195,32 @@ Function Import-LMDashboard { } #Check if a path has been provided and check if folder exists in selected root folder, if not create - If($Dashboard.path){ - [Array]$SubFolders = $Dashboard.path -split "\\|/" | Where-Object {$_} + If ($Dashboard.path) { + [Array]$SubFolders = $Dashboard.path -split "\\|/" | Where-Object { $_ } - For($Index = 0; $Index -lt $($SubFolders | Measure-Object).Count; $Index++){ + For ($Index = 0; $Index -lt $($SubFolders | Measure-Object).Count; $Index++) { - If($Index -eq 0){ - $DashboardGroup = Get-LMDashboardGroup -ParentGroupId $ParentGroupId | Where-Object {$_.Name -eq $SubFolders[$Index]} + If ($Index -eq 0) { + $DashboardGroup = Get-LMDashboardGroup -ParentGroupId $ParentGroupId | Where-Object { $_.Name -eq $SubFolders[$Index] } - If(!$DashboardGroup){ + If (!$DashboardGroup) { Write-LMHost "[INFO]: Existing dashboard group not found for $($Subfolders[$Index]) creating new resource group under root group ($ParentGroupName)" $NewDashboardGroup = New-LMDashboardGroup -Name $SubFolders[$Index] -ParentGroupId $ParentGroupId $Dashboard.parentid = $NewDashboardGroup.id $Dashboard.parentname = $NewDashboardGroup.name } - Else{ + Else { $Dashboard.parentid = $DashboardGroup.id $Dashboard.parentname = $DashboardGroup.name } } - Else{ - $DashboardGroup = Get-LMDashboardGroup -Name $Subfolders[$Index] | Where-Object { $_.fullPath -like "$($Subfolders[0])*$($Subfolders[$Index])"} + Else { + $DashboardGroup = Get-LMDashboardGroup -Name $Subfolders[$Index] | Where-Object { $_.fullPath -like "$($Subfolders[0])*$($Subfolders[$Index])" } - If(!$DashboardGroup){ + If (!$DashboardGroup) { - $NewDashboardParentGroup = Get-LMDashboardGroup -Name $Subfolders[$Index-1] | Where-Object {$_.fullPath -like "$ParentGroupName*" -or $_.fullPath -eq $Subfolders[$Index-1]} + $NewDashboardParentGroup = Get-LMDashboardGroup -Name $Subfolders[$Index - 1] | Where-Object { $_.fullPath -like "$ParentGroupName*" -or $_.fullPath -eq $Subfolders[$Index - 1] } Write-LMHost "[INFO]: Existing dashboard group not found for $($Subfolders[$Index]) creating new resource group under group ($($NewDashboardParentGroup.Name))" $NewDashboardGroup = New-LMDashboardGroup -Name $SubFolders[$Index] -ParentGroupId $NewDashboardParentGroup.id @@ -228,7 +228,7 @@ Function Import-LMDashboard { $Dashboard.parentname = $NewDashboardGroup.name } - Else{ + Else { $Dashboard.parentid = $DashboardGroup.id $Dashboard.parentname = $DashboardGroup.name } @@ -238,14 +238,14 @@ Function Import-LMDashboard { #Construct our object for import $Data = @{ - description = $Dashboard.file.description - groupId = [int]$Dashboard.parentid - groupName = $Dashboard.parentname - name = $Dashboard.file.name - sharable = If($PrivateUserName){$False} Else{$True} - owner = $PrivateUserName - template = $Dashboard.file | Select-Object -ExcludeProperty group - widgetTokens = $Dashboard.file.widgetTokens + description = $Dashboard.file.description + groupId = [int]$Dashboard.parentid + groupName = $Dashboard.parentname + name = $Dashboard.file.name + sharable = If ($PrivateUserName) { $False } Else { $True } + owner = $PrivateUserName + template = $Dashboard.file | Select-Object -ExcludeProperty group + widgetTokens = $Dashboard.file.widgetTokens widgetsConfigVersion = $Dashboard.file.widgetsConfigVersion } @@ -260,7 +260,7 @@ Function Import-LMDashboard { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Data - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data Write-Output "Successfully imported dashboard: $($Dashboard.file.name)" @@ -271,7 +271,7 @@ Function Import-LMDashboard { Write-Output "Failed to import dashboard: $($Dashboard.file.name)" $Proceed = Resolve-LMException -LMException $PSItem If (!$Proceed) { - # Return + # Return } } } diff --git a/Public/Import-LMExchangeModule.ps1 b/Public/Import-LMExchangeModule.ps1 index b6efa7f..e7267f7 100644 --- a/Public/Import-LMExchangeModule.ps1 +++ b/Public/Import-LMExchangeModule.ps1 @@ -28,7 +28,7 @@ Function Import-LMExchangeModule { $ResourcePath = "/exchange/integrations/import" #Construct payload - $Data = @{items = @()} + $Data = @{items = @() } $Data.items += [PSCustomObject]@{ id = $LMExchangeId } diff --git a/Public/Import-LMLogicModule.ps1 b/Public/Import-LMLogicModule.ps1 index f7bcf73..e2b2785 100644 --- a/Public/Import-LMLogicModule.ps1 +++ b/Public/Import-LMLogicModule.ps1 @@ -31,10 +31,10 @@ This function requires PowerShell version 6.1 or higher to run. Function Import-LMLogicModule { [CmdletBinding()] Param ( - [Parameter(Mandatory,ParameterSetName = 'FilePath')] + [Parameter(Mandatory, ParameterSetName = 'FilePath')] [String]$FilePath, - [Parameter(Mandatory,ParameterSetName = 'File')] + [Parameter(Mandatory, ParameterSetName = 'File')] [Object]$File, [ValidateSet("datasource", "propertyrules", "eventsource", "topologysource", "configsource")] @@ -49,7 +49,7 @@ Function Import-LMLogicModule { If ($Script:LMAuth.Valid) { #Get file content from path if not given file data directly - If($FilePath){ + If ($FilePath) { #Check for PS version 6.1 + If (($PSVersionTable.PSVersion.Major -le 5) -or ($PSVersionTable.PSVersion.Major -eq 6 -and $PSVersionTable.PSVersion.Minor -lt 1)) { @@ -76,7 +76,7 @@ Function Import-LMLogicModule { $Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath -Data $File $Uri = "https://$($Script:LMAuth.Portal).logicmonitor.com/santaba/rest" + $ResourcePath + $QueryParams - Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $FilePath + Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $FilePath #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Form @{file = $File } diff --git a/Public/Import-LMRepositoryLogicModules.ps1 b/Public/Import-LMRepositoryLogicModules.ps1 index e3b59f7..ed3d6e8 100644 --- a/Public/Import-LMRepositoryLogicModules.ps1 +++ b/Public/Import-LMRepositoryLogicModules.ps1 @@ -25,13 +25,13 @@ Function Import-LMRepositoryLogicModules { [ValidateSet("datasources", "propertyrules", "eventsources", "topologysources", "configsources")] [String]$Type, - [Parameter(Mandatory,ValueFromPipelineByPropertyName)] + [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [Alias('Name')] [String[]]$LogicModuleNames ) - Begin{} - Process{ + Begin {} + Process { #Check if we are logged in and have valid api creds If ($Script:LMAuth.Valid) { @@ -58,7 +58,7 @@ Function Import-LMRepositoryLogicModules { #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data - + Return "Modules imported successfully: $LogicModuleNames" } Catch [Exception] { @@ -73,5 +73,5 @@ Function Import-LMRepositoryLogicModules { Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." } } - End{} + End {} } diff --git a/Public/Invoke-LMActiveDiscovery.ps1 b/Public/Invoke-LMActiveDiscovery.ps1 index 0d77b36..a25ffbf 100644 --- a/Public/Invoke-LMActiveDiscovery.ps1 +++ b/Public/Invoke-LMActiveDiscovery.ps1 @@ -69,7 +69,7 @@ Function Invoke-LMActiveDiscovery { } $deviceList = $LookupResult } - ElseIf ($Id) { + Elseif ($Id) { $deviceList = $Id } @@ -85,7 +85,7 @@ Function Invoke-LMActiveDiscovery { return } } - ElseIf ($GroupId) { + Elseif ($GroupId) { $deviceList = (Get-LMDeviceGroupDevices -Id $GroupId).Id If (!$deviceList) { Write-Error "Unable to find devices for groupId: $GroupId, please check spelling and try again." @@ -107,7 +107,7 @@ Function Invoke-LMActiveDiscovery { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] Write-Host "Scheduled Active Discovery task for device id: $device." diff --git a/Public/Invoke-LMCloudGroupNetScan.ps1 b/Public/Invoke-LMCloudGroupNetScan.ps1 index 3ea5ac2..e53276a 100644 --- a/Public/Invoke-LMCloudGroupNetScan.ps1 +++ b/Public/Invoke-LMCloudGroupNetScan.ps1 @@ -46,11 +46,11 @@ Function Invoke-LMCloudGroupNetScan { } $Id = $LookupResult } - Else{ + Else { $GroupInfo = Get-LMDeviceGroup -Id $Id } - If($GroupInfo.groupType -notlike "*AWS*" -and $GroupInfo.groupType -notlike "*Azure*" -and $GroupInfo.groupType -notlike "*GCP*"){ + If ($GroupInfo.groupType -notlike "*AWS*" -and $GroupInfo.groupType -notlike "*Azure*" -and $GroupInfo.groupType -notlike "*GCP*") { Write-Error "Specified group: $($GroupInfo.Name) is not of type AWs/Azure/GCP. Please ensure the specified group is a Cloud group and try again." } diff --git a/Public/Invoke-LMCollectorDebugCommand.ps1 b/Public/Invoke-LMCollectorDebugCommand.ps1 index d785a94..7130480 100644 --- a/Public/Invoke-LMCollectorDebugCommand.ps1 +++ b/Public/Invoke-LMCollectorDebugCommand.ps1 @@ -81,13 +81,13 @@ Function Invoke-LMCollectorDebugCommand { Process { If ($Script:LMAuth.Valid) { -#Cannot indent or it breaks here-string format -$DefaultGroovy =@" + #Cannot indent or it breaks here-string format + $DefaultGroovy = @" !groovy import com.santaba.agent.collector3.CollectorDb; def hostProps = [:]; def instanceProps = [:]; -try { +Try { hostProps = CollectorDb.getInstance().getHost("$CommandHostName").getProperties(); instanceProps["wildvalue"] = "$CommandWildValue"; } @@ -98,8 +98,8 @@ catch(Exception e) { $GroovyCommand "@ -#Cannot indent or it breaks here-string format -$DefaultPosh =@" + #Cannot indent or it breaks here-string format + $DefaultPosh = @" !posh $PoshCommand diff --git a/Public/New-LMAPIToken.ps1 b/Public/New-LMAPIToken.ps1 index 35bd69c..ddb4963 100644 --- a/Public/New-LMAPIToken.ps1 +++ b/Public/New-LMAPIToken.ps1 @@ -59,7 +59,7 @@ Function New-LMAPIToken { } #Build header and uri - If($Type -eq "Bearer"){ + If ($Type -eq "Bearer") { $Params = "?type=bearer" } @@ -78,7 +78,7 @@ Function New-LMAPIToken { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Data - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data Return (Add-ObjectTypeInfo -InputObject $Response -TypeName "LogicMonitor.APIToken" ) diff --git a/Public/New-LMAPIUser.ps1 b/Public/New-LMAPIUser.ps1 index d9f17df..d83c41e 100644 --- a/Public/New-LMAPIUser.ps1 +++ b/Public/New-LMAPIUser.ps1 @@ -95,7 +95,7 @@ Function New-LMAPIUser { } #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json) diff --git a/Public/New-LMAccessGroup.ps1 b/Public/New-LMAccessGroup.ps1 new file mode 100644 index 0000000..52e2100 --- /dev/null +++ b/Public/New-LMAccessGroup.ps1 @@ -0,0 +1,79 @@ +<# +.SYNOPSIS +Creates a new LogicMonitor access group. + +.DESCRIPTION +The New-LMAccessGroup function is used to create a new access group in LogicMonitor. An access group is a collection of users with similar permissions and access rights for managing modules in the LM exchange and my module toolbox. + +.PARAMETER Name +The name of the access group. This parameter is mandatory. + +.PARAMETER Description +The description of the access group. + +.PARAMETER Tenant +The ID of the tenant to which the access group belongs. + +.EXAMPLE +New-LMAccessGroup -Name "Group1" -Description "Access group for administrators" -Tenant "12345" + +This example creates a new access group named "Group1" with the description "Access group for administrators" and assigns it to the tenant with ID "12345". + +.NOTES +For this function to work, you need to be logged in and have valid API credentials. Use the Connect-LMAccount function to log in before running any commands. +#> +Function New-LMAccessGroup { + + [CmdletBinding()] + Param ( + + [Parameter(Mandatory)] + [String]$Name, + + [String]$Description, + + [String]$Tenant + + ) + #Check if we are logged in and have valid api creds + Begin {} + Process { + If ($Script:LMAuth.Valid) { + + #Build header and uri + $ResourcePath = "/setting/accessgroup/add" + + Try { + $Data = @{ + description = $Description + name = $Name + tenantId = $Tenant + } + + #Remove empty keys so we dont overwrite them + @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } + + $Data = ($Data | ConvertTo-Json) + $Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath -Data $Data + $Uri = "https://$($Script:LMAuth.Portal).logicmonitor.com/santaba/rest" + $ResourcePath + + Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Data + + #Issue request + $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data + + Return (Add-ObjectTypeInfo -InputObject $Response -TypeName "LogicMonitor.AccessGroup" ) + } + Catch [Exception] { + $Proceed = Resolve-LMException -LMException $PSItem + If (!$Proceed) { + Return + } + } + } + Else { + Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." + } + } + End {} +} diff --git a/Public/New-LMAlertAck.ps1 b/Public/New-LMAlertAck.ps1 index 0f95a96..d49f41c 100644 --- a/Public/New-LMAlertAck.ps1 +++ b/Public/New-LMAlertAck.ps1 @@ -28,8 +28,8 @@ Function New-LMAlertAck { [Parameter(Mandatory)] [String]$Note ) - Begin{} - Process{ + Begin {} + Process { #Check if we are logged in and have valid api creds If ($Script:LMAuth.Valid) { @@ -39,8 +39,8 @@ Function New-LMAlertAck { Try { $Data = @{ - alertIds = $Ids - ackComment = $Note + alertIds = $Ids + ackComment = $Note } $Data = ($Data | ConvertTo-Json) @@ -53,7 +53,7 @@ Function New-LMAlertAck { #Issue request $Response = Invoke-WebRequest -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data - If($Response.StatusCode -eq 200){ + If ($Response.StatusCode -eq 200) { Return "Successfully acknowledged alert id(s): $Ids" } } @@ -68,5 +68,5 @@ Function New-LMAlertAck { Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." } } - End{} + End {} } diff --git a/Public/New-LMAlertEscalation.ps1 b/Public/New-LMAlertEscalation.ps1 index 91d5913..7fb75c2 100644 --- a/Public/New-LMAlertEscalation.ps1 +++ b/Public/New-LMAlertEscalation.ps1 @@ -20,8 +20,8 @@ Function New-LMAlertEscalation { [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [String]$Id ) - Begin{} - Process{ + Begin {} + Process { #Check if we are logged in and have valid api creds If ($Script:LMAuth.Valid) { @@ -38,7 +38,7 @@ Function New-LMAlertEscalation { #Issue request $Response = Invoke-WebRequest -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] - If($Response.StatusCode -eq 200){ + If ($Response.StatusCode -eq 200) { Return "Successfully escalated alert id: $Id" } } @@ -53,5 +53,5 @@ Function New-LMAlertEscalation { Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." } } - End{} + End {} } diff --git a/Public/New-LMAlertNote.ps1 b/Public/New-LMAlertNote.ps1 index 739b643..0f9271e 100644 --- a/Public/New-LMAlertNote.ps1 +++ b/Public/New-LMAlertNote.ps1 @@ -32,8 +32,8 @@ Function New-LMAlertNote { [Parameter(Mandatory)] [String]$Note ) - Begin{} - Process{ + Begin {} + Process { #Check if we are logged in and have valid api creds If ($Script:LMAuth.Valid) { @@ -44,7 +44,7 @@ Function New-LMAlertNote { $Data = @{ alertIds = $Ids - note = $Note + note = $Note } $Data = ($Data | ConvertTo-Json) @@ -57,7 +57,7 @@ Function New-LMAlertNote { #Issue request $Response = Invoke-WebRequest -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data - If($Response.StatusCode -eq 200){ + If ($Response.StatusCode -eq 200) { Return "Successfully updated note for alert id(s): $Ids" } } @@ -72,5 +72,5 @@ Function New-LMAlertNote { Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." } } - End{} + End {} } diff --git a/Public/New-LMAppliesToFunction.ps1 b/Public/New-LMAppliesToFunction.ps1 index 007f38a..e1403c2 100644 --- a/Public/New-LMAppliesToFunction.ps1 +++ b/Public/New-LMAppliesToFunction.ps1 @@ -41,9 +41,9 @@ Function New-LMAppliesToFunction { Try { $Data = @{ - name = $Name - description = $Description - code = $AppliesTo + name = $Name + description = $Description + code = $AppliesTo } $Data = ($Data | ConvertTo-Json) @@ -53,7 +53,7 @@ Function New-LMAppliesToFunction { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Data - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data Return $Response diff --git a/Public/New-LMCachedAccount.ps1 b/Public/New-LMCachedAccount.ps1 index 7887545..e975146 100644 --- a/Public/New-LMCachedAccount.ps1 +++ b/Public/New-LMCachedAccount.ps1 @@ -19,19 +19,19 @@ New-LMCachedAccount -AccessId xxxxxx -AccessKey xxxxxx -AccountName subdomain #> Function New-LMCachedAccount { - [CmdletBinding(DefaultParameterSetName="LMv1")] + [CmdletBinding(DefaultParameterSetName = "LMv1")] Param ( - [Parameter(Mandatory, ParameterSetName="LMv1")] + [Parameter(Mandatory, ParameterSetName = "LMv1")] [String]$AccessId, - [Parameter(Mandatory, ParameterSetName="LMv1")] + [Parameter(Mandatory, ParameterSetName = "LMv1")] [String]$AccessKey, - [Parameter(Mandatory, ParameterSetName="LMv1")] - [Parameter(Mandatory, ParameterSetName="Bearer")] + [Parameter(Mandatory, ParameterSetName = "LMv1")] + [Parameter(Mandatory, ParameterSetName = "Bearer")] [String]$AccountName, - [Parameter(Mandatory, ParameterSetName="Bearer")] + [Parameter(Mandatory, ParameterSetName = "Bearer")] [String]$BearerToken, [String]$CachedAccountName = $AccountName, @@ -44,7 +44,7 @@ Function New-LMCachedAccount { Write-Host "[INFO]: Existing vault Logic.Monitor already exists, skipping creation" } Catch { - If($_.Exception.Message -like "*There are currently no extension vaults registered*") { + If ($_.Exception.Message -like "*There are currently no extension vaults registered*") { Write-Host "[INFO]: Credential vault for cached accounts does not currently exist, creating credential vault: Logic.Monitor" Register-SecretVault -Name Logic.Monitor -ModuleName Microsoft.PowerShell.SecretStore Get-SecretStoreConfiguration | Out-Null @@ -53,29 +53,29 @@ Function New-LMCachedAccount { $CurrentDate = Get-Date #Convert to secure string - If($BearerToken){ + If ($BearerToken) { $Secret = $BearerToken | ConvertTo-SecureString -AsPlainText -Force | ConvertFrom-SecureString [Hashtable]$Metadata = @{ - Portal = [String]$AccountName - Id = "$($BearerToken.Substring(0,20))****" - Modified = [DateTime]$CurrentDate - Type = "Bearer" + Portal = [String]$AccountName + Id = "$($BearerToken.Substring(0,20))****" + Modified = [DateTime]$CurrentDate + Type = "Bearer" } } - Else{ + Else { $Secret = $AccessKey | ConvertTo-SecureString -AsPlainText -Force | ConvertFrom-SecureString [Hashtable]$Metadata = @{ - Portal = [String]$AccountName - Id = [String]$AccessId - Modified = [DateTime]$CurrentDate - Type = "LMv1" + Portal = [String]$AccountName + Id = [String]$AccessId + Modified = [DateTime]$CurrentDate + Type = "LMv1" } } - Try{ + Try { Set-Secret -Name $CachedAccountName -Secret $Secret -Vault Logic.Monitor -Metadata $Metadata -NoClobber:$(!$OverwriteExisting) Write-Host "[INFO]: Successfully created cached account ($CachedAccountName) secret for portal: $AccountName" } - Catch{ + Catch { Write-Error $_.Exception.Message } diff --git a/Public/New-LMCollector.ps1 b/Public/New-LMCollector.ps1 index c5455f6..30749ee 100644 --- a/Public/New-LMCollector.ps1 +++ b/Public/New-LMCollector.ps1 @@ -107,7 +107,7 @@ Function New-LMCollector { #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json) $Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath -Data $Data diff --git a/Public/New-LMCollectorGroup.ps1 b/Public/New-LMCollectorGroup.ps1 index 630a369..c3ce1c7 100644 --- a/Public/New-LMCollectorGroup.ps1 +++ b/Public/New-LMCollectorGroup.ps1 @@ -63,16 +63,16 @@ Function New-LMCollectorGroup { Try { $Data = @{ - description = $Description - name = $Name - autoBalance = $AutoBalance - customProperties = $customProperties - autoBalanceInstanceCountThreshold = $AutoBalanceInstanceCountThreshold + description = $Description + name = $Name + autoBalance = $AutoBalance + customProperties = $customProperties + autoBalanceInstanceCountThreshold = $AutoBalanceInstanceCountThreshold } #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json) $Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath -Data $Data diff --git a/Public/New-LMDashboardGroup.ps1 b/Public/New-LMDashboardGroup.ps1 index e4492ec..c264ca7 100644 --- a/Public/New-LMDashboardGroup.ps1 +++ b/Public/New-LMDashboardGroup.ps1 @@ -79,10 +79,10 @@ Function New-LMDashboardGroup { Try { $Data = @{ - name = $Name - description = $Description - parentId = $ParentGroupId - widgetTokens = $WidgetTokensArray + name = $Name + description = $Description + parentId = $ParentGroupId + widgetTokens = $WidgetTokensArray } $Data = ($Data | ConvertTo-Json) @@ -92,7 +92,7 @@ Function New-LMDashboardGroup { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Data - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data Return $Response diff --git a/Public/New-LMDatasourceGraph.ps1 b/Public/New-LMDatasourceGraph.ps1 index 6d618a0..c3729f1 100644 --- a/Public/New-LMDatasourceGraph.ps1 +++ b/Public/New-LMDatasourceGraph.ps1 @@ -38,7 +38,7 @@ Function New-LMDatasourceGraph { #Check if we are logged in and have valid api creds If ($Script:LMAuth.Valid) { - If($DataSourceName){ + If ($DataSourceName) { $LookupResult = (Get-LMDatasource -Name $DataSourceName).Id If (Test-LookupResult -Result $LookupResult -LookupString $DataSourceName) { Return diff --git a/Public/New-LMDatasourceOverviewGraph.ps1 b/Public/New-LMDatasourceOverviewGraph.ps1 index 82c0961..e82a2ac 100644 --- a/Public/New-LMDatasourceOverviewGraph.ps1 +++ b/Public/New-LMDatasourceOverviewGraph.ps1 @@ -27,17 +27,17 @@ Function New-LMDatasourceOverviewGraph { [Parameter(Mandatory)] $RawObject, - [Parameter(Mandatory,ParameterSetName = 'dsId')] + [Parameter(Mandatory, ParameterSetName = 'dsId')] $DatasourceId, - [Parameter(Mandatory,ParameterSetName = 'dsName')] + [Parameter(Mandatory, ParameterSetName = 'dsName')] $DatasourceName ) #Check if we are logged in and have valid api creds If ($Script:LMAuth.Valid) { - If($DataSourceName){ + If ($DataSourceName) { $LookupResult = (Get-LMDatasource -Name $DataSourceName).Id If (Test-LookupResult -Result $LookupResult -LookupString $DataSourceName) { Return @@ -56,7 +56,7 @@ Function New-LMDatasourceOverviewGraph { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Data - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data Return (Add-ObjectTypeInfo -InputObject $Response -TypeName "LogicMonitor.DatasourceGraph" ) diff --git a/Public/New-LMDevice.ps1 b/Public/New-LMDevice.ps1 index 4c1a2b4..a4edc74 100644 --- a/Public/New-LMDevice.ps1 +++ b/Public/New-LMDevice.ps1 @@ -119,27 +119,27 @@ Function New-LMDevice { Try { $Data = @{ - name = $Name - displayName = $DisplayName - description = $Description - disableAlerting = $DisableAlerting - enableNetflow = $EnableNetFlow - customProperties = $customProperties - deviceType = $DeviceType - preferredCollectorId = $PreferredCollectorId - preferredCollectorGroupId = $PreferredCollectorGroupId + name = $Name + displayName = $DisplayName + description = $Description + disableAlerting = $DisableAlerting + enableNetflow = $EnableNetFlow + customProperties = $customProperties + deviceType = $DeviceType + preferredCollectorId = $PreferredCollectorId + preferredCollectorGroupId = $PreferredCollectorGroupId autoBalancedCollectorGroupId = $AutoBalancedCollectorGroupId - link = $Link - netflowCollectorGroupId = $NetflowCollectorGroupId - netflowCollectorId = $NetflowCollectorId - logCollectorGroupId = $LogCollectorGroupId - logCollectorId = $LogCollectorId - hostGroupIds = $HostGroupIds -join "," + link = $Link + netflowCollectorGroupId = $NetflowCollectorGroupId + netflowCollectorId = $NetflowCollectorId + logCollectorGroupId = $LogCollectorGroupId + logCollectorId = $LogCollectorId + hostGroupIds = $HostGroupIds -join "," } #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json) $Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath -Data $Data diff --git a/Public/New-LMDeviceDatasourceInstance.ps1 b/Public/New-LMDeviceDatasourceInstance.ps1 index 16c219c..77500d7 100644 --- a/Public/New-LMDeviceDatasourceInstance.ps1 +++ b/Public/New-LMDeviceDatasourceInstance.ps1 @@ -81,10 +81,12 @@ Function New-LMDeviceDatasourceInstance { [Parameter(Mandatory, ParameterSetName = 'Id-dsId')] [Parameter(Mandatory, ParameterSetName = 'Id-dsName')] + [Alias('DeviceId')] [Int]$Id, [Parameter(Mandatory, ParameterSetName = 'Name-dsName')] [Parameter(Mandatory, ParameterSetName = 'Name-dsId')] + [Alias('DeviceName')] [String]$Name ) @@ -143,7 +145,7 @@ Function New-LMDeviceDatasourceInstance { } #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json) @@ -152,7 +154,7 @@ Function New-LMDeviceDatasourceInstance { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Data - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data Return $Response diff --git a/Public/New-LMDeviceDatasourceInstanceGroup.ps1 b/Public/New-LMDeviceDatasourceInstanceGroup.ps1 index 3b6a454..3dc4371 100644 --- a/Public/New-LMDeviceDatasourceInstanceGroup.ps1 +++ b/Public/New-LMDeviceDatasourceInstanceGroup.ps1 @@ -51,10 +51,12 @@ Function New-LMDeviceDatasourceInstanceGroup { [Parameter(Mandatory, ParameterSetName = 'Id-dsId')] [Parameter(Mandatory, ParameterSetName = 'Id-dsName')] + [Alias('DeviceId')] [Int]$Id, [Parameter(Mandatory, ParameterSetName = 'Name-dsName')] [Parameter(Mandatory, ParameterSetName = 'Name-dsId')] + [Alias('DeviceName')] [String]$Name ) @@ -97,7 +99,7 @@ Function New-LMDeviceDatasourceInstanceGroup { } #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json) @@ -106,7 +108,7 @@ Function New-LMDeviceDatasourceInstanceGroup { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Data - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data Return $Response diff --git a/Public/New-LMDeviceDatasourceInstanceSDT.ps1 b/Public/New-LMDeviceDatasourceInstanceSDT.ps1 index e15dc7e..3b98f66 100644 --- a/Public/New-LMDeviceDatasourceInstanceSDT.ps1 +++ b/Public/New-LMDeviceDatasourceInstanceSDT.ps1 @@ -87,11 +87,11 @@ Function New-LMDeviceDatasourceInstanceSDT { [Parameter(Mandatory, ParameterSetName = 'Weekly')] [Parameter(Mandatory, ParameterSetName = 'MonthlyByWeek')] - [ValidateSet("Monday", "Tuesday", "Wednesday","Thursday","Friday","Saturday","Sunday")] + [ValidateSet("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday")] [String]$WeekDay, [Parameter(Mandatory, ParameterSetName = 'MonthlyByWeek')] - [ValidateSet("First", "Second", "Third","Fourth","Last")] + [ValidateSet("First", "Second", "Third", "Fourth", "Last")] [String]$WeekOfMonth, [Parameter(Mandatory, ParameterSetName = 'Monthly')] @@ -108,27 +108,27 @@ Function New-LMDeviceDatasourceInstanceSDT { #Build header and uri $ResourcePath = "/sdt/sdts" - Switch -Wildcard ($PSCmdlet.ParameterSetName){ - "OneTime*" {$Occurance = "oneTime"} - "Daily*" {$Occurance = "daily"} - "Monthly*" {$Occurance = "monthly"} - "MonthlyByWeek*" {$Occurance = "monthlyByWeek"} - "Weekly*" {$Occurance = "weekly"} + Switch -Wildcard ($PSCmdlet.ParameterSetName) { + "OneTime*" { $Occurance = "oneTime" } + "Daily*" { $Occurance = "daily" } + "Monthly*" { $Occurance = "monthly" } + "MonthlyByWeek*" { $Occurance = "monthlyByWeek" } + "Weekly*" { $Occurance = "weekly" } } Try { $Data = $null $Data = @{ - comment = $Comment - dataSourceInstanceId = $DeviceDataSourceInstanceId - sdtType = $Occurance + comment = $Comment + dataSourceInstanceId = $DeviceDataSourceInstanceId + sdtType = $Occurance #timezone = $Timezone - type = "DeviceDataSourceInstanceSDT" + type = "DeviceDataSourceInstanceSDT" } - Switch ($Occurance){ - "onetime" { + Switch ($Occurance) { + "onetime" { #Get UTC time based on selected timezone # $TimeZoneID = [System.TimeZoneInfo]::FindSystemTimeZoneById($Timezone) # $StartUTCTime = [System.TimeZoneInfo]::ConvertTimeFromUtc($StartDate.ToUniversalTime(), $TimeZoneID) @@ -139,47 +139,47 @@ Function New-LMDeviceDatasourceInstanceSDT { $StartDateTime = (New-TimeSpan -Start (Get-Date "01/01/1970") -End $StartDate.ToUniversalTime()).TotalMilliseconds $EndDateTime = (New-TimeSpan -Start (Get-Date "01/01/1970") -End $EndDate.ToUniversalTime()).TotalMilliseconds - $Data.Add('endDateTime',[math]::Round($EndDateTime)) - $Data.Add('startDateTime',[math]::Round($StartDateTime)) - } - - "daily" { - $Data.Add('hour',$StartHour) - $Data.Add('minute',$StartMinute) - $Data.Add('endHour',$EndHour) - $Data.Add('endMinute',$EndMinute) - } + $Data.Add('endDateTime', [math]::Round($EndDateTime)) + $Data.Add('startDateTime', [math]::Round($StartDateTime)) + } + + "daily" { + $Data.Add('hour', $StartHour) + $Data.Add('minute', $StartMinute) + $Data.Add('endHour', $EndHour) + $Data.Add('endMinute', $EndMinute) + } - "weekly" { - $Data.Add('hour',$StartHour) - $Data.Add('minute',$StartMinute) - $Data.Add('endHour',$EndHour) - $Data.Add('endMinute',$EndMinute) - $Data.Add('weekDay',$WeekDay) - } + "weekly" { + $Data.Add('hour', $StartHour) + $Data.Add('minute', $StartMinute) + $Data.Add('endHour', $EndHour) + $Data.Add('endMinute', $EndMinute) + $Data.Add('weekDay', $WeekDay) + } - "monthly" { - $Data.Add('hour',$StartHour) - $Data.Add('minute',$StartMinute) - $Data.Add('endHour',$EndHour) - $Data.Add('endMinute',$EndMinute) - $Data.Add('monthDay',$DayOfMonth) - } + "monthly" { + $Data.Add('hour', $StartHour) + $Data.Add('minute', $StartMinute) + $Data.Add('endHour', $EndHour) + $Data.Add('endMinute', $EndMinute) + $Data.Add('monthDay', $DayOfMonth) + } - "monthlyByWeek" { - $Data.Add('hour',$StartHour) - $Data.Add('minute',$StartMinute) - $Data.Add('endHour',$EndHour) - $Data.Add('endMinute',$EndMinute) - $Data.Add('weekDay',$WeekDay) - $Data.Add('weekOfMonth',$WeekOfMonth) - } - - default {} + "monthlyByWeek" { + $Data.Add('hour', $StartHour) + $Data.Add('minute', $StartMinute) + $Data.Add('endHour', $EndHour) + $Data.Add('endMinute', $EndMinute) + $Data.Add('weekDay', $WeekDay) + $Data.Add('weekOfMonth', $WeekOfMonth) + } + + default {} } #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json) @@ -188,7 +188,7 @@ Function New-LMDeviceDatasourceInstanceSDT { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Data - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data Return $Response diff --git a/Public/New-LMDeviceDatasourceSDT.ps1 b/Public/New-LMDeviceDatasourceSDT.ps1 index ecbdb23..da41b8e 100644 --- a/Public/New-LMDeviceDatasourceSDT.ps1 +++ b/Public/New-LMDeviceDatasourceSDT.ps1 @@ -82,11 +82,11 @@ Function New-LMDeviceDatasourceSDT { [Parameter(Mandatory, ParameterSetName = 'Weekly')] [Parameter(Mandatory, ParameterSetName = 'MonthlyByWeek')] - [ValidateSet("Monday", "Tuesday", "Wednesday","Thursday","Friday","Saturday","Sunday")] + [ValidateSet("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday")] [String]$WeekDay, [Parameter(Mandatory, ParameterSetName = 'MonthlyByWeek')] - [ValidateSet("First", "Second", "Third","Fourth","Last")] + [ValidateSet("First", "Second", "Third", "Fourth", "Last")] [String]$WeekOfMonth, [Parameter(Mandatory, ParameterSetName = 'Monthly')] @@ -103,27 +103,27 @@ Function New-LMDeviceDatasourceSDT { #Build header and uri $ResourcePath = "/sdt/sdts" - Switch -Wildcard ($PSCmdlet.ParameterSetName){ - "OneTime*" {$Occurance = "oneTime"} - "Daily*" {$Occurance = "daily"} - "Monthly*" {$Occurance = "monthly"} - "MonthlyByWeek*" {$Occurance = "monthlyByWeek"} - "Weekly*" {$Occurance = "weekly"} + Switch -Wildcard ($PSCmdlet.ParameterSetName) { + "OneTime*" { $Occurance = "oneTime" } + "Daily*" { $Occurance = "daily" } + "Monthly*" { $Occurance = "monthly" } + "MonthlyByWeek*" { $Occurance = "monthlyByWeek" } + "Weekly*" { $Occurance = "weekly" } } Try { $Data = $null $Data = @{ - comment = $Comment - deviceDataSourceId = $deviceDataSourceId - sdtType = $Occurance + comment = $Comment + deviceDataSourceId = $deviceDataSourceId + sdtType = $Occurance #timezone = $Timezone - type = "DeviceDataSourceSDT" + type = "DeviceDataSourceSDT" } - Switch ($Occurance){ - "onetime" { + Switch ($Occurance) { + "onetime" { #Get UTC time based on selected timezone # $TimeZoneID = [System.TimeZoneInfo]::FindSystemTimeZoneById($Timezone) # $StartUTCTime = [System.TimeZoneInfo]::ConvertTimeFromUtc($StartDate.ToUniversalTime(), $TimeZoneID) @@ -134,47 +134,47 @@ Function New-LMDeviceDatasourceSDT { $StartDateTime = (New-TimeSpan -Start (Get-Date "01/01/1970") -End $StartDate.ToUniversalTime()).TotalMilliseconds $EndDateTime = (New-TimeSpan -Start (Get-Date "01/01/1970") -End $EndDate.ToUniversalTime()).TotalMilliseconds - $Data.Add('endDateTime',[math]::Round($EndDateTime)) - $Data.Add('startDateTime',[math]::Round($StartDateTime)) - } - - "daily" { - $Data.Add('hour',$StartHour) - $Data.Add('minute',$StartMinute) - $Data.Add('endHour',$EndHour) - $Data.Add('endMinute',$EndMinute) - } + $Data.Add('endDateTime', [math]::Round($EndDateTime)) + $Data.Add('startDateTime', [math]::Round($StartDateTime)) + } + + "daily" { + $Data.Add('hour', $StartHour) + $Data.Add('minute', $StartMinute) + $Data.Add('endHour', $EndHour) + $Data.Add('endMinute', $EndMinute) + } - "weekly" { - $Data.Add('hour',$StartHour) - $Data.Add('minute',$StartMinute) - $Data.Add('endHour',$EndHour) - $Data.Add('endMinute',$EndMinute) - $Data.Add('weekDay',$WeekDay) - } + "weekly" { + $Data.Add('hour', $StartHour) + $Data.Add('minute', $StartMinute) + $Data.Add('endHour', $EndHour) + $Data.Add('endMinute', $EndMinute) + $Data.Add('weekDay', $WeekDay) + } - "monthly" { - $Data.Add('hour',$StartHour) - $Data.Add('minute',$StartMinute) - $Data.Add('endHour',$EndHour) - $Data.Add('endMinute',$EndMinute) - $Data.Add('monthDay',$DayOfMonth) - } + "monthly" { + $Data.Add('hour', $StartHour) + $Data.Add('minute', $StartMinute) + $Data.Add('endHour', $EndHour) + $Data.Add('endMinute', $EndMinute) + $Data.Add('monthDay', $DayOfMonth) + } - "monthlyByWeek" { - $Data.Add('hour',$StartHour) - $Data.Add('minute',$StartMinute) - $Data.Add('endHour',$EndHour) - $Data.Add('endMinute',$EndMinute) - $Data.Add('weekDay',$WeekDay) - $Data.Add('weekOfMonth',$WeekOfMonth) - } - - default {} + "monthlyByWeek" { + $Data.Add('hour', $StartHour) + $Data.Add('minute', $StartMinute) + $Data.Add('endHour', $EndHour) + $Data.Add('endMinute', $EndMinute) + $Data.Add('weekDay', $WeekDay) + $Data.Add('weekOfMonth', $WeekOfMonth) + } + + default {} } #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json) @@ -183,7 +183,7 @@ Function New-LMDeviceDatasourceSDT { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Data - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data Return $Response diff --git a/Public/New-LMDeviceGroup.ps1 b/Public/New-LMDeviceGroup.ps1 index 4a107d2..d2cc599 100644 --- a/Public/New-LMDeviceGroup.ps1 +++ b/Public/New-LMDeviceGroup.ps1 @@ -113,7 +113,7 @@ Function New-LMDeviceGroup { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Data - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data Return (Add-ObjectTypeInfo -InputObject $Response -TypeName "LogicMonitor.DeviceGroup" ) diff --git a/Public/New-LMDeviceGroupSDT.ps1 b/Public/New-LMDeviceGroupSDT.ps1 index be1094c..f677ad0 100644 --- a/Public/New-LMDeviceGroupSDT.ps1 +++ b/Public/New-LMDeviceGroupSDT.ps1 @@ -102,12 +102,12 @@ Function New-LMDeviceGroupSDT { [Parameter(Mandatory, ParameterSetName = 'Weekly-DeviceGroupName')] [Parameter(Mandatory, ParameterSetName = 'MonthlyByWeek-DeviceGroupId')] [Parameter(Mandatory, ParameterSetName = 'MonthlyByWeek-DeviceGroupName')] - [ValidateSet("Monday", "Tuesday", "Wednesday","Thursday","Friday","Saturday","Sunday")] + [ValidateSet("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday")] [String]$WeekDay, [Parameter(Mandatory, ParameterSetName = 'MonthlyByWeek-DeviceGroupId')] [Parameter(Mandatory, ParameterSetName = 'MonthlyByWeek-DeviceGroupName')] - [ValidateSet("First", "Second", "Third","Fourth","Last")] + [ValidateSet("First", "Second", "Third", "Fourth", "Last")] [String]$WeekOfMonth, [Parameter(Mandatory, ParameterSetName = 'Monthly-DeviceGroupId')] @@ -146,12 +146,12 @@ Function New-LMDeviceGroupSDT { $DeviceGroupId = $LookupResult } - Switch -Wildcard ($PSCmdlet.ParameterSetName){ - "OneTime-Device*" {$Occurance = "oneTime"} - "Daily-Device*" {$Occurance = "daily"} - "Monthly-Device*" {$Occurance = "monthly"} - "MonthlyByWeek-Device*" {$Occurance = "monthlyByWeek"} - "Weekly-Device*" {$Occurance = "weekly"} + Switch -Wildcard ($PSCmdlet.ParameterSetName) { + "OneTime-Device*" { $Occurance = "oneTime" } + "Daily-Device*" { $Occurance = "daily" } + "Monthly-Device*" { $Occurance = "monthly" } + "MonthlyByWeek-Device*" { $Occurance = "monthlyByWeek" } + "Weekly-Device*" { $Occurance = "weekly" } } #Build header and uri @@ -161,15 +161,15 @@ Function New-LMDeviceGroupSDT { $Data = $null $Data = @{ - comment = $Comment - deviceGroupId = $DeviceGroupId - sdtType = $Occurance + comment = $Comment + deviceGroupId = $DeviceGroupId + sdtType = $Occurance #timezone = $Timezone - type = "ResourceGroupSDT" + type = "ResourceGroupSDT" } - Switch ($Occurance){ - "onetime" { + Switch ($Occurance) { + "onetime" { #Get UTC time based on selected timezone # $TimeZoneID = [System.TimeZoneInfo]::FindSystemTimeZoneById($Timezone) # $StartUTCTime = [System.TimeZoneInfo]::ConvertTimeFromUtc($StartDate.ToUniversalTime(), $TimeZoneID) @@ -180,47 +180,47 @@ Function New-LMDeviceGroupSDT { $StartDateTime = (New-TimeSpan -Start (Get-Date "01/01/1970") -End $StartDate.ToUniversalTime()).TotalMilliseconds $EndDateTime = (New-TimeSpan -Start (Get-Date "01/01/1970") -End $EndDate.ToUniversalTime()).TotalMilliseconds - $Data.Add('endDateTime',[math]::Round($EndDateTime)) - $Data.Add('startDateTime',[math]::Round($StartDateTime)) - } - - "daily" { - $Data.Add('hour',$StartHour) - $Data.Add('minute',$StartMinute) - $Data.Add('endHour',$EndHour) - $Data.Add('endMinute',$EndMinute) - } + $Data.Add('endDateTime', [math]::Round($EndDateTime)) + $Data.Add('startDateTime', [math]::Round($StartDateTime)) + } + + "daily" { + $Data.Add('hour', $StartHour) + $Data.Add('minute', $StartMinute) + $Data.Add('endHour', $EndHour) + $Data.Add('endMinute', $EndMinute) + } - "weekly" { - $Data.Add('hour',$StartHour) - $Data.Add('minute',$StartMinute) - $Data.Add('endHour',$EndHour) - $Data.Add('endMinute',$EndMinute) - $Data.Add('weekDay',$WeekDay) - } + "weekly" { + $Data.Add('hour', $StartHour) + $Data.Add('minute', $StartMinute) + $Data.Add('endHour', $EndHour) + $Data.Add('endMinute', $EndMinute) + $Data.Add('weekDay', $WeekDay) + } - "monthly" { - $Data.Add('hour',$StartHour) - $Data.Add('minute',$StartMinute) - $Data.Add('endHour',$EndHour) - $Data.Add('endMinute',$EndMinute) - $Data.Add('monthDay',$DayOfMonth) - } + "monthly" { + $Data.Add('hour', $StartHour) + $Data.Add('minute', $StartMinute) + $Data.Add('endHour', $EndHour) + $Data.Add('endMinute', $EndMinute) + $Data.Add('monthDay', $DayOfMonth) + } - "monthlyByWeek" { - $Data.Add('hour',$StartHour) - $Data.Add('minute',$StartMinute) - $Data.Add('endHour',$EndHour) - $Data.Add('endMinute',$EndMinute) - $Data.Add('weekDay',$WeekDay) - $Data.Add('weekOfMonth',$WeekOfMonth) - } - - default {} + "monthlyByWeek" { + $Data.Add('hour', $StartHour) + $Data.Add('minute', $StartMinute) + $Data.Add('endHour', $EndHour) + $Data.Add('endMinute', $EndMinute) + $Data.Add('weekDay', $WeekDay) + $Data.Add('weekOfMonth', $WeekOfMonth) + } + + default {} } #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json) @@ -229,7 +229,7 @@ Function New-LMDeviceGroupSDT { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Data - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data Return $Response diff --git a/Public/New-LMDeviceProperty.ps1 b/Public/New-LMDeviceProperty.ps1 index 483f23e..719e2cd 100644 --- a/Public/New-LMDeviceProperty.ps1 +++ b/Public/New-LMDeviceProperty.ps1 @@ -79,7 +79,7 @@ Function New-LMDeviceProperty { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Data - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data Return $Response diff --git a/Public/New-LMDeviceSDT.ps1 b/Public/New-LMDeviceSDT.ps1 index 02f63fe..6d7bfe7 100644 --- a/Public/New-LMDeviceSDT.ps1 +++ b/Public/New-LMDeviceSDT.ps1 @@ -110,12 +110,12 @@ Function New-LMDeviceSDT { [Parameter(Mandatory, ParameterSetName = 'Weekly-DeviceName')] [Parameter(Mandatory, ParameterSetName = 'MonthlyByWeek-DeviceId')] [Parameter(Mandatory, ParameterSetName = 'MonthlyByWeek-DeviceName')] - [ValidateSet("Monday", "Tuesday", "Wednesday","Thursday","Friday","Saturday","Sunday")] + [ValidateSet("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday")] [String]$WeekDay, [Parameter(Mandatory, ParameterSetName = 'MonthlyByWeek-DeviceId')] [Parameter(Mandatory, ParameterSetName = 'MonthlyByWeek-DeviceName')] - [ValidateSet("First", "Second", "Third","Fourth","Last")] + [ValidateSet("First", "Second", "Third", "Fourth", "Last")] [String]$WeekOfMonth, [Parameter(Mandatory, ParameterSetName = 'Monthly-DeviceId')] @@ -136,12 +136,12 @@ Function New-LMDeviceSDT { $DeviceId = $LookupResult } - Switch -Wildcard ($PSCmdlet.ParameterSetName){ - "OneTime-Device*" {$Occurance = "oneTime"} - "Daily-Device*" {$Occurance = "daily"} - "Monthly-Device*" {$Occurance = "monthly"} - "MonthlyByWeek-Device*" {$Occurance = "monthlyByWeek"} - "Weekly-Device*" {$Occurance = "weekly"} + Switch -Wildcard ($PSCmdlet.ParameterSetName) { + "OneTime-Device*" { $Occurance = "oneTime" } + "Daily-Device*" { $Occurance = "daily" } + "Monthly-Device*" { $Occurance = "monthly" } + "MonthlyByWeek-Device*" { $Occurance = "monthlyByWeek" } + "Weekly-Device*" { $Occurance = "weekly" } } #Build header and uri @@ -151,15 +151,15 @@ Function New-LMDeviceSDT { $Data = $null $Data = @{ - comment = $Comment - deviceId = $DeviceId - sdtType = $Occurance + comment = $Comment + deviceId = $DeviceId + sdtType = $Occurance #timezone = $Timezone - type = "ResourceSDT" + type = "ResourceSDT" } - Switch ($Occurance){ - "onetime" { + Switch ($Occurance) { + "onetime" { #Get UTC time based on selected timezone # $TimeZoneID = [System.TimeZoneInfo]::FindSystemTimeZoneById($Timezone) # $StartUTCTime = [System.TimeZoneInfo]::ConvertTimeFromUtc((Get-Date $StartDate).ToUniversalTime(), $TimeZoneID) @@ -171,47 +171,47 @@ Function New-LMDeviceSDT { $StartDateTime = (New-TimeSpan -Start (Get-Date "01/01/1970") -End $StartDate.ToUniversalTime()).TotalMilliseconds $EndDateTime = (New-TimeSpan -Start (Get-Date "01/01/1970") -End $EndDate.ToUniversalTime()).TotalMilliseconds - $Data.Add('endDateTime',[math]::Round($EndDateTime)) - $Data.Add('startDateTime',[math]::Round($StartDateTime)) - } - - "daily" { - $Data.Add('hour',$StartHour) - $Data.Add('minute',$StartMinute) - $Data.Add('endHour',$EndHour) - $Data.Add('endMinute',$EndMinute) - } + $Data.Add('endDateTime', [math]::Round($EndDateTime)) + $Data.Add('startDateTime', [math]::Round($StartDateTime)) + } + + "daily" { + $Data.Add('hour', $StartHour) + $Data.Add('minute', $StartMinute) + $Data.Add('endHour', $EndHour) + $Data.Add('endMinute', $EndMinute) + } - "weekly" { - $Data.Add('hour',$StartHour) - $Data.Add('minute',$StartMinute) - $Data.Add('endHour',$EndHour) - $Data.Add('endMinute',$EndMinute) - $Data.Add('weekDay',$WeekDay) - } + "weekly" { + $Data.Add('hour', $StartHour) + $Data.Add('minute', $StartMinute) + $Data.Add('endHour', $EndHour) + $Data.Add('endMinute', $EndMinute) + $Data.Add('weekDay', $WeekDay) + } - "monthly" { - $Data.Add('hour',$StartHour) - $Data.Add('minute',$StartMinute) - $Data.Add('endHour',$EndHour) - $Data.Add('endMinute',$EndMinute) - $Data.Add('monthDay',$DayOfMonth) - } + "monthly" { + $Data.Add('hour', $StartHour) + $Data.Add('minute', $StartMinute) + $Data.Add('endHour', $EndHour) + $Data.Add('endMinute', $EndMinute) + $Data.Add('monthDay', $DayOfMonth) + } - "monthlyByWeek" { - $Data.Add('hour',$StartHour) - $Data.Add('minute',$StartMinute) - $Data.Add('endHour',$EndHour) - $Data.Add('endMinute',$EndMinute) - $Data.Add('weekDay',$WeekDay) - $Data.Add('weekOfMonth',$WeekOfMonth) - } - - default {} + "monthlyByWeek" { + $Data.Add('hour', $StartHour) + $Data.Add('minute', $StartMinute) + $Data.Add('endHour', $EndHour) + $Data.Add('endMinute', $EndMinute) + $Data.Add('weekDay', $WeekDay) + $Data.Add('weekOfMonth', $WeekOfMonth) + } + + default {} } #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json) @@ -220,7 +220,7 @@ Function New-LMDeviceSDT { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Data - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data Return $Response diff --git a/Public/New-LMEnhancedNetscan.ps1 b/Public/New-LMEnhancedNetscan.ps1 index 734786f..40151e4 100644 --- a/Public/New-LMEnhancedNetscan.ps1 +++ b/Public/New-LMEnhancedNetscan.ps1 @@ -95,10 +95,10 @@ Function New-LMEnhancedNetScan { $ResourcePath = "/setting/netscans" #Get Netscan GroupID - If($NetScanGroupName){ + If ($NetScanGroupName) { $NetScanGroupId = (Get-LMNetScanGroup -Name $NetScanGroupName).Id } - Else{ + Else { $NetScanGroupId = 1 } @@ -134,24 +134,24 @@ Function New-LMEnhancedNetScan { Try { $Data = @{ - name = $Name - collector = $CollectorId - description = $Description - duplicate = $Duplicates - method = $Method - nextStart = $NextStart - groovyScript = $GroovyScript - nextStartEpoch = $NextStartEpoch - nsgId = $NetScanGroupId - credentials = $Creds - filters = $Filters - schedule = $Schedule - scriptType = "embeded" + name = $Name + collector = $CollectorId + description = $Description + duplicate = $Duplicates + method = $Method + nextStart = $NextStart + groovyScript = $GroovyScript + nextStartEpoch = $NextStartEpoch + nsgId = $NetScanGroupId + credentials = $Creds + filters = $Filters + schedule = $Schedule + scriptType = "embeded" } #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json -Depth 10) $Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath -Data $Data $Uri = "https://$($Script:LMAuth.Portal).logicmonitor.com/santaba/rest" + $ResourcePath diff --git a/Public/New-LMNetscan.ps1 b/Public/New-LMNetscan.ps1 index cef3746..f96e80c 100644 --- a/Public/New-LMNetscan.ps1 +++ b/Public/New-LMNetscan.ps1 @@ -151,7 +151,7 @@ Function New-LMNetScan { #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json) $Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath -Data $Data diff --git a/Public/New-LMNetscanGroup.ps1 b/Public/New-LMNetscanGroup.ps1 index 4ada040..d976084 100644 --- a/Public/New-LMNetscanGroup.ps1 +++ b/Public/New-LMNetscanGroup.ps1 @@ -45,13 +45,13 @@ Function New-LMNetscanGroup { Try { $Data = @{ - description = $Description - name = $Name + description = $Description + name = $Name } #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json) $Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath -Data $Data diff --git a/Public/New-LMOpsNote.ps1 b/Public/New-LMOpsNote.ps1 index b59c445..84ca494 100644 --- a/Public/New-LMOpsNote.ps1 +++ b/Public/New-LMOpsNote.ps1 @@ -51,41 +51,41 @@ Function New-LMOpsNote { #Check if we are logged in and have valid api creds If ($Script:LMAuth.Valid) { - If(!$NoteDate){ + If (!$NoteDate) { [int64]$NoteDate = [DateTimeOffset]::Now.ToUnixTimeSeconds() } - Else{ + Else { $Epoch = Get-Date -Date "01/01/1970" [int64]$NoteDate = (New-TimeSpan -Start $Epoch -End $NoteDate.ToUniversalTime()).TotalSeconds } $Scope = @() - If($ResourceIds -or $WebsiteIds -or $DeviceGroupIds){ - Foreach($id in $DeviceIds){ + If ($ResourceIds -or $WebsiteIds -or $DeviceGroupIds) { + Foreach ($id in $DeviceIds) { $Scope += [PSCustomObject]@{ - type = "device" - groupId = "0" + type = "device" + groupId = "0" deviceId = $id } } - Foreach($id in $WebsiteIds){ + Foreach ($id in $WebsiteIds) { $Scope += [PSCustomObject]@{ - type = "website" - groupId = "0" + type = "website" + groupId = "0" websiteId = $id } } - Foreach($id in $DeviceGroupIds){ + Foreach ($id in $DeviceGroupIds) { $Scope += @{ - type = "deviceGroup" + type = "deviceGroup" groupId = $id } } } $TagList = @() - Foreach($tag in $Tags){ - $TagList += @{name = $tag} + Foreach ($tag in $Tags) { + $TagList += @{name = $tag } } @@ -101,7 +101,7 @@ Function New-LMOpsNote { } #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json) @@ -110,7 +110,7 @@ Function New-LMOpsNote { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Data - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data Return $Response diff --git a/Public/New-LMPushMetricDataPoint.ps1 b/Public/New-LMPushMetricDataPoint.ps1 index ddcd936..40911ea 100644 --- a/Public/New-LMPushMetricDataPoint.ps1 +++ b/Public/New-LMPushMetricDataPoint.ps1 @@ -47,27 +47,27 @@ Function New-LMPushMetricDataPoint { [System.Collections.Generic.List[object]]$DataPoints, # object with datapoint name and value [ValidateSet("counter", "derive", "gauge")] [String]$DataPointType = "gauge", - [ValidateSet("min", "max", "avg","sum","none","percentile")] + [ValidateSet("min", "max", "avg", "sum", "none", "percentile")] [String]$DataPointAggregationType = "none", [ValidateRange(0, 100)] [Int]$PercentileValue ) #Check if we are logged in and have valid api creds If ($Script:LMAuth.Valid) { - If(!$DataPointsArray){ + If (!$DataPointsArray) { $DataPointsArray = [System.Collections.Generic.List[object]]::New() } #Add each datapoint to new datapoint array - Foreach($Datapoint in $DataPoints){ + Foreach ($Datapoint in $DataPoints) { $DataPointsArray.Add([PSCustomObject]@{ - dataPointName = $Datapoint.Name - dataPointType = $DataPointType - dataPointDescription = ($Datapoint.Description -replace '“|”','') - dataPointAggregationType = $DataPointAggregationType - percentileValue = $PercentileValue - values = @{$((Get-Date -UFormat %s).Split(".")[0])=$Datapoint.Value} - }) + dataPointName = $Datapoint.Name + dataPointType = $DataPointType + dataPointDescription = ($Datapoint.Description -replace '“|”', '') + dataPointAggregationType = $DataPointAggregationType + percentileValue = $PercentileValue + values = @{$((Get-Date -UFormat %s).Split(".")[0]) = $Datapoint.Value } + }) } Return $DataPointsArray diff --git a/Public/New-LMPushMetricInstance.ps1 b/Public/New-LMPushMetricInstance.ps1 index b0a1a0c..1e228ce 100644 --- a/Public/New-LMPushMetricInstance.ps1 +++ b/Public/New-LMPushMetricInstance.ps1 @@ -36,7 +36,7 @@ Function New-LMPushMetricInstance { [CmdletBinding()] Param ( - [System.Collections.Generic.List[object]]$InstancesArrary, + [System.Collections.Generic.List[object]]$InstancesArrary, [Parameter(Mandatory)] [String]$InstanceName, @@ -52,18 +52,18 @@ Function New-LMPushMetricInstance { ) #Check if we are logged in and have valid api creds If ($Script:LMAuth.Valid) { - If(!$InstancesArrary){ + If (!$InstancesArrary) { $InstancesArrary = [System.Collections.Generic.List[object]]::New() } #Add new instance to new instances array $InstancesArrary.Add([PSCustomObject]@{ - instanceName = $InstanceName - instanceDisplayName = If($InstanceDisplayName){$InstanceDisplayName}Else{$InstanceName} - instanceProperties = $InstanceProperties - instanceDescription = $InstanceDescription - dataPoints = $Datapoints - }) + instanceName = $InstanceName + instanceDisplayName = If ($InstanceDisplayName) { $InstanceDisplayName }Else { $InstanceName } + instanceProperties = $InstanceProperties + instanceDescription = $InstanceDescription + dataPoints = $Datapoints + }) Return $InstancesArrary } diff --git a/Public/New-LMReportGroup.ps1 b/Public/New-LMReportGroup.ps1 index 501fd5e..25b5fc6 100644 --- a/Public/New-LMReportGroup.ps1 +++ b/Public/New-LMReportGroup.ps1 @@ -49,13 +49,13 @@ Function New-LMReportGroup { Try { $Data = @{ - description = $Description - name = $Name + description = $Description + name = $Name } #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json) $Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath -Data $Data diff --git a/Public/New-LMRole.ps1 b/Public/New-LMRole.ps1 index dadaae2..f3d0632 100644 --- a/Public/New-LMRole.ps1 +++ b/Public/New-LMRole.ps1 @@ -90,8 +90,8 @@ Function New-LMRole { [CmdletBinding(DefaultParameterSetName = 'Default')] Param ( - [Parameter(Mandatory,ParameterSetName = 'Custom')] - [Parameter(Mandatory,ParameterSetName = 'Default')] + [Parameter(Mandatory, ParameterSetName = 'Custom')] + [Parameter(Mandatory, ParameterSetName = 'Default')] [String]$Name, [Parameter(ParameterSetName = 'Default')] @@ -119,39 +119,39 @@ Function New-LMRole { [String]$RoleGroupId = 1, [Parameter(ParameterSetName = 'Default')] - [ValidateSet("view", "manage","none")] + [ValidateSet("view", "manage", "none")] [String]$DashboardsPermission = "none", [Parameter(ParameterSetName = 'Default')] - [ValidateSet("view", "manage","none")] + [ValidateSet("view", "manage", "none")] [String]$ResourcePermission = "none", [Parameter(ParameterSetName = 'Default')] - [ValidateSet("view", "manage","none")] + [ValidateSet("view", "manage", "none")] [String]$LogsPermission = "none", [Parameter(ParameterSetName = 'Default')] - [ValidateSet("view", "manage","none")] + [ValidateSet("view", "manage", "none")] [String]$WebsitesPermission = "none", [Parameter(ParameterSetName = 'Default')] - [ValidateSet("view", "manage","none")] + [ValidateSet("view", "manage", "none")] [String]$SavedMapsPermission = "none", [Parameter(ParameterSetName = 'Default')] - [ValidateSet("view", "manage","none")] + [ValidateSet("view", "manage", "none")] [String]$ReportsPermission = "none", [Parameter(ParameterSetName = 'Default')] - [ValidateSet("view","manage","commit","publish","none")] + [ValidateSet("view", "manage", "commit", "publish", "none")] [String]$LMXToolBoxPermission = "none", [Parameter(ParameterSetName = 'Default')] - [ValidateSet("view","install","none")] + [ValidateSet("view", "install", "none")] [String]$LMXPermission = "none", [Parameter(ParameterSetName = 'Default')] - [ValidateSet("view", "manage","none","manage-collectors","view-collectors")] + [ValidateSet("view", "manage", "none", "manage-collectors", "view-collectors")] [String]$SettingsPermission = "none", [Parameter(ParameterSetName = 'Default')] @@ -178,7 +178,7 @@ Function New-LMRole { [Parameter(ParameterSetName = 'Default')] [Switch]$EnableRemoteSessionForResources, - [Parameter(Mandatory,ParameterSetName = 'Custom')] + [Parameter(Mandatory, ParameterSetName = 'Custom')] [PSCustomObject]$CustomPrivilegesObject ) @@ -190,202 +190,202 @@ Function New-LMRole { $ResourcePath = "/setting/roles" $Privileges = @() - If(!$CustomPrivilegesObject){ + If (!$CustomPrivilegesObject) { - If($ViewTraces){ + If ($ViewTraces) { $Privileges += [PSCustomObject]@{ - objectId = "*" - objectName = "*" - objectType = "tracesManageTab" - operation = "read" + objectId = "*" + objectName = "*" + objectType = "tracesManageTab" + operation = "read" subOperation = "" } } - If($EnableRemoteSessionForResources){ + If ($EnableRemoteSessionForResources) { $Privileges += [PSCustomObject]@{ - objectId = "*" - objectName = "*" - objectType = "remoteSession" - operation = "write" + objectId = "*" + objectName = "*" + objectType = "remoteSession" + operation = "write" subOperation = "" } } - If($AllowedToViewMapsTab){ + If ($AllowedToViewMapsTab) { $Privileges += [PSCustomObject]@{ - objectId = "*" - objectName = "*" - objectType = "resourceMapTab" - operation = "read" + objectId = "*" + objectName = "*" + objectType = "resourceMapTab" + operation = "read" subOperation = "" } } - If($AllowWidgetSharing){ + If ($AllowWidgetSharing) { $Privileges += [PSCustomObject]@{ - objectId = "sharingwidget" - objectName = "sharingwidget" - objectType = "dashboard_group" - operation = "write" + objectId = "sharingwidget" + objectName = "sharingwidget" + objectType = "dashboard_group" + operation = "write" subOperation = "" } } - If($CreatePrivateDashboards){ + If ($CreatePrivateDashboards) { $Privileges += [PSCustomObject]@{ - objectId = "private" - objectName = "private" - objectType = "dashboard_group" - operation = "write" + objectId = "private" + objectName = "private" + objectType = "dashboard_group" + operation = "write" subOperation = "" } } - If($LMXToolBoxPermission){ + If ($LMXToolBoxPermission) { $Privileges += [PSCustomObject]@{ - objectId = "allinstalledmodules" + objectId = "allinstalledmodules" objectName = "All installed modules" objectType = "module" - operation = $LMXToolBoxPermission + operation = $LMXToolBoxPermission } } - If($LMXPermission){ + If ($LMXPermission) { $Privileges += [PSCustomObject]@{ - objectId = "All exchange modules" + objectId = "All exchange modules" objectName = "private" objectType = "module" - operation = $LMXPermission + operation = $LMXPermission } } - If($ViewSupport){ + If ($ViewSupport) { $Privileges += [PSCustomObject]@{ - objectId = "chat" - objectName = "help" - objectType = "help" - operation = "write" + objectId = "chat" + objectName = "help" + objectType = "help" + operation = "write" subOperation = "" } $Privileges += [PSCustomObject]@{ - objectId = "*" - objectName = "help" - objectType = "help" - operation = "read" + objectId = "*" + objectName = "help" + objectType = "help" + operation = "read" subOperation = "" } } - Else{ + Else { $Privileges += [PSCustomObject]@{ - objectId = "chat" - objectName = "help" - objectType = "help" - operation = "read" + objectId = "chat" + objectName = "help" + objectType = "help" + operation = "read" subOperation = "" } } $Privileges += [PSCustomObject]@{ - objectId = "" - objectName = "configNeedDeviceManagePermission" - objectType = "configNeedDeviceManagePermission" - operation = If($ConfigTabRequiresManagePermission){"write"}Else{"read"} + objectId = "" + objectName = "configNeedDeviceManagePermission" + objectType = "configNeedDeviceManagePermission" + operation = If ($ConfigTabRequiresManagePermission) { "write" }Else { "read" } subOperation = "" } $Privileges += [PSCustomObject]@{ - objectId = "" - objectName = "deviceDashboard" - objectType = "deviceDashboard" - operation = If($AllowedToManageResourceDashboards){"write"}Else{"read"} + objectId = "" + objectName = "deviceDashboard" + objectType = "deviceDashboard" + operation = If ($AllowedToManageResourceDashboards) { "write" }Else { "read" } subOperation = "" } - If($DashboardsPermission -ne "none"){ + If ($DashboardsPermission -ne "none") { $Privileges += [PSCustomObject]@{ - objectId = "*" - objectName = "*" - objectType = "dashboard_group" - operation = If($DashboardsPermission -eq "manage"){"write"}Else{"read"} + objectId = "*" + objectName = "*" + objectType = "dashboard_group" + operation = If ($DashboardsPermission -eq "manage") { "write" }Else { "read" } subOperation = "" } } - If($ResourcePermission -ne "none"){ + If ($ResourcePermission -ne "none") { $Privileges += [PSCustomObject]@{ - objectId = "*" - objectName = "*" - objectType = "host_group" - operation = If($ResourcePermission -eq "manage"){"write"}Else{"read"} + objectId = "*" + objectName = "*" + objectType = "host_group" + operation = If ($ResourcePermission -eq "manage") { "write" }Else { "read" } subOperation = "" } } - If($LogsPermission -ne "none"){ + If ($LogsPermission -ne "none") { $Privileges += [PSCustomObject]@{ - objectId = "*" - objectName = "*" - objectType = "logs" - operation = If($LogsPermission -eq "manage"){"write"}Else{"read"} + objectId = "*" + objectName = "*" + objectType = "logs" + operation = If ($LogsPermission -eq "manage") { "write" }Else { "read" } subOperation = "" } } - If($WebsitesPermission -ne "none"){ + If ($WebsitesPermission -ne "none") { $Privileges += [PSCustomObject]@{ - objectId = "*" - objectName = "*" - objectType = "website_group" - operation = If($WebsitesPermission -eq "manage"){"write"}Else{"read"} + objectId = "*" + objectName = "*" + objectType = "website_group" + operation = If ($WebsitesPermission -eq "manage") { "write" }Else { "read" } subOperation = "" } } - If($SavedMapsPermission -ne "none"){ + If ($SavedMapsPermission -ne "none") { $Privileges += [PSCustomObject]@{ - objectId = "*" - objectName = "*" - objectType = "map" - operation = If($SavedMapsPermission -eq "manage"){"write"}Else{"read"} + objectId = "*" + objectName = "*" + objectType = "map" + operation = If ($SavedMapsPermission -eq "manage") { "write" }Else { "read" } subOperation = "" } } - If($ReportsPermission -ne "none"){ + If ($ReportsPermission -ne "none") { $Privileges += [PSCustomObject]@{ - objectId = "*" - objectName = "*" - objectType = "report_group" - operation = If($ReportsPermission -eq "manage"){"write"}Else{"read"} + objectId = "*" + objectName = "*" + objectType = "report_group" + operation = If ($ReportsPermission -eq "manage") { "write" }Else { "read" } subOperation = "" } } - If($SettingsPermission -ne "none"){ - If($SettingsPermission -ne "manage-collectors" -and $SettingsPermission -ne "view-collectors"){ + If ($SettingsPermission -ne "none") { + If ($SettingsPermission -ne "manage-collectors" -and $SettingsPermission -ne "view-collectors") { $Privileges += [PSCustomObject]@{ - objectId = "*" - objectName = "*" - objectType = "setting" - operation = If($SettingsPermission -eq "manage"){"write"}Else{"read"} + objectId = "*" + objectName = "*" + objectType = "setting" + operation = If ($SettingsPermission -eq "manage") { "write" }Else { "read" } subOperation = "" } $Privileges += [PSCustomObject]@{ - objectId = "useraccess.*" - objectName = "useraccess.*" - objectType = "setting" - operation = If($ResourcePermission -eq "manage"){"write"}Else{"read"} + objectId = "useraccess.*" + objectName = "useraccess.*" + objectType = "setting" + operation = If ($ResourcePermission -eq "manage") { "write" }Else { "read" } subOperation = "" } } - Else{ + Else { $Privileges += [PSCustomObject]@{ - objectId = "collectorgroup.*" + objectId = "collectorgroup.*" objectName = "Collectors" objectType = "setting" - operation = If($SettingsPermission -eq "manage-collectors"){"write"}Else{"read"} + operation = If ($SettingsPermission -eq "manage-collectors") { "write" }Else { "read" } } } } @@ -398,14 +398,14 @@ Function New-LMRole { customHelpURL = $CustomHelpURL description = $Description name = $Name - requireEULA = $RequireEULA.IsPresent + requireEULA = $RequireEULA.IsPresent roleGroupId = $RoleGroupId twoFARequired = $TwoFARequired - privileges = If($CustomPrivilegesObject){$CustomPrivilegesObject}Else{$Privileges} + privileges = If ($CustomPrivilegesObject) { $CustomPrivilegesObject }Else { $Privileges } } #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json) @@ -414,7 +414,7 @@ Function New-LMRole { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Data - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data Return (Add-ObjectTypeInfo -InputObject $Response -TypeName "LogicMonitor.Role" ) diff --git a/Public/New-LMUser.ps1 b/Public/New-LMUser.ps1 index 2f66e0d..503b10e 100644 --- a/Public/New-LMUser.ps1 +++ b/Public/New-LMUser.ps1 @@ -159,14 +159,14 @@ Function New-LMUser { } break } - ElseIf ($ViewPermission.ContainsKey($View)) { + Elseif ($ViewPermission.ContainsKey($View)) { $ViewPermission[$View] = $true } } #Auto generate password if not provided $AutoGeneratePassword = $False - If(!$Password){ + If (!$Password) { $Password = New-LMRandomCred $AutoGeneratePassword = $True } @@ -197,7 +197,7 @@ Function New-LMUser { } #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json) @@ -206,16 +206,16 @@ Function New-LMUser { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Data - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data - If($AutoGeneratePassword){ - If(!$global:LMUserData){ + If ($AutoGeneratePassword) { + If (!$global:LMUserData) { $UserData = New-Object System.Collections.ArrayList - $UserData.Add([PSCustomObject]@{"Username"=$Username;"Temp_Password"=$Password}) | Out-Null + $UserData.Add([PSCustomObject]@{"Username" = $Username; "Temp_Password" = $Password }) | Out-Null New-Variable -Name LMUserData -Scope global -Value $UserData } - Else{ - $global:LMUserData.Add([PSCustomObject]@{"Username"=$Username;"Temp_Password"=$Password}) | Out-Null + Else { + $global:LMUserData.Add([PSCustomObject]@{"Username" = $Username; "Temp_Password" = $Password }) | Out-Null } Write-LMHost "[INFO]: Auto generated password assigned to $Username`: $Password" -ForegroundColor Yellow diff --git a/Public/New-LMWebsite.ps1 b/Public/New-LMWebsite.ps1 index 543551f..6ea34e9 100644 --- a/Public/New-LMWebsite.ps1 +++ b/Public/New-LMWebsite.ps1 @@ -107,10 +107,10 @@ Function New-LMWebsite { [CmdletBinding()] Param ( - [Parameter(Mandatory,ParameterSetName="Website")] + [Parameter(Mandatory, ParameterSetName = "Website")] [Switch]$WebCheck, - [Parameter(Mandatory,ParameterSetName="Ping")] + [Parameter(Mandatory, ParameterSetName = "Ping")] [Switch]$PingCheck, [Parameter(Mandatory)] @@ -128,41 +128,41 @@ Function New-LMWebsite { [Nullable[boolean]]$UseDefaultLocationSetting = $true, - [Parameter(ParameterSetName="Website")] + [Parameter(ParameterSetName = "Website")] [Nullable[boolean]]$TriggerSSLStatusAlert, - [Parameter(ParameterSetName="Website")] + [Parameter(ParameterSetName = "Website")] [Nullable[boolean]]$TriggerSSLExpirationAlert, [String]$GroupId, - [Parameter(Mandatory,ParameterSetName="Ping")] + [Parameter(Mandatory, ParameterSetName = "Ping")] [String]$PingAddress, - [Parameter(Mandatory,ParameterSetName="Website")] + [Parameter(Mandatory, ParameterSetName = "Website")] [String]$WebsiteDomain, - [Parameter(ParameterSetName="Website")] + [Parameter(ParameterSetName = "Website")] [ValidateSet("http", "https")] [String]$HttpType = "https", - [Parameter(ParameterSetName="Website")] + [Parameter(ParameterSetName = "Website")] [String[]]$SSLAlertThresholds, - [Parameter(ParameterSetName="Ping")] + [Parameter(ParameterSetName = "Ping")] [ValidateSet(5, 10, 15, 20, 30, 60)] [Nullable[Int]]$PingCount, - [Parameter(ParameterSetName="Ping")] + [Parameter(ParameterSetName = "Ping")] [Nullable[Int]]$PingTimeout, - [Parameter(ParameterSetName="Website")] + [Parameter(ParameterSetName = "Website")] [Nullable[Int]]$PageLoadAlertTimeInMS, - [Parameter(ParameterSetName="Website")] + [Parameter(ParameterSetName = "Website")] [Nullable[boolean]]$IgnoreSSL, - [Parameter(ParameterSetName="Ping")] + [Parameter(ParameterSetName = "Ping")] [ValidateSet(10, 20, 30, 40, 50, 60, 70, 80, 90, 100)] [Nullable[Int]]$PingPercentNotReceived, @@ -183,29 +183,29 @@ Function New-LMWebsite { [ValidateSet(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)] [Nullable[Int]]$PollingInterval, - [Parameter(ParameterSetName="Website")] + [Parameter(ParameterSetName = "Website")] [Object[]]$WebsiteSteps, - [Parameter(ParameterSetName="Website")] + [Parameter(ParameterSetName = "Website")] [Object[]]$CheckPoints ) #Check if we are logged in and have valid api creds If ($Script:LMAuth.Valid) { - If($Webcheck){ + If ($Webcheck) { $Type = "webcheck" } - Else{ + Else { $Type = "pingcheck" } $Steps = @() If ($Type -eq "webcheck") { - If($WebsiteSteps){ + If ($WebsiteSteps) { $Steps = $WebsiteSteps } - Else{ + Else { $Steps += [PSCustomObject]@{ useDefaultRoot = $true url = "" @@ -279,18 +279,18 @@ Function New-LMWebsite { steps = $Steps } - If($CheckPoints){ + If ($CheckPoints) { $TestLocations = [PSCustomObject]@{ - all = $true - smgIds = @() - collectorIds = @($CheckPoints.smgId.GetEnumerator() | Foreach-Object {If($_ -ne 0){[Int]$_}}) + all = $true + smgIds = @() + collectorIds = @($CheckPoints.smgId.GetEnumerator() | ForEach-Object { If ($_ -ne 0) { [Int]$_ } }) } - $Data.checkpoints = $CheckPoints + $Data.checkpoints = $CheckPoints $Data.testLocation = $TestLocations } #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_]) -and $_ -ne "testLocation" -and $_ -ne "steps" -and $_ -ne "checkpoints") { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_]) -and $_ -ne "testLocation" -and $_ -ne "steps" -and $_ -ne "checkpoints") { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json -Depth 5) $Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath -Data $Data diff --git a/Public/New-LMWebsiteGroup.ps1 b/Public/New-LMWebsiteGroup.ps1 index d7f00ff..98091d3 100644 --- a/Public/New-LMWebsiteGroup.ps1 +++ b/Public/New-LMWebsiteGroup.ps1 @@ -102,7 +102,7 @@ Function New-LMWebsiteGroup { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Data - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data Return (Add-ObjectTypeInfo -InputObject $Response -TypeName "LogicMonitor.WebsiteGroup" ) diff --git a/Public/Remove-LMAPIToken.ps1 b/Public/Remove-LMAPIToken.ps1 index 98ef4b1..5c5d159 100644 --- a/Public/Remove-LMAPIToken.ps1 +++ b/Public/Remove-LMAPIToken.ps1 @@ -42,7 +42,7 @@ This function requires a valid API authentication. Make sure to log in using Con #> Function Remove-LMAPIToken { - [CmdletBinding(DefaultParameterSetName = 'Id',SupportsShouldProcess,ConfirmImpact='High')] + [CmdletBinding(DefaultParameterSetName = 'Id', SupportsShouldProcess, ConfirmImpact = 'High')] Param ( [Parameter(Mandatory, ParameterSetName = 'Id')] [Int]$UserId, @@ -58,8 +58,8 @@ Function Remove-LMAPIToken { [Int]$APITokenId ) - Begin{} - Process{ + Begin {} + Process { #Check if we are logged in and have valid api creds If ($Script:LMAuth.Valid) { @@ -72,7 +72,7 @@ Function Remove-LMAPIToken { $UserId = $LookupResult } - If($AccessId){ + If ($AccessId) { $LookupResult = (Get-LMAPIToken -AccessId $AccessId) If (Test-LookupResult -Result $LookupResult -LookupString $AccessId) { return @@ -84,25 +84,25 @@ Function Remove-LMAPIToken { #Build header and uri $ResourcePath = "/setting/admins/$UserId/apitokens/$APITokenId" - If($PSItem){ + If ($PSItem) { $Message = "Id: $APITokenId | AccessId: $($PSItem.accessId)| AdminName:$($PSItem.adminName)" } - Else{ + Else { $Message = "Id: $APITokenId" } Try { - if ($PSCmdlet.ShouldProcess($Message, "Remove API Token")) { + If ($PSCmdlet.ShouldProcess($Message, "Remove API Token")) { $Headers = New-LMHeader -Auth $Script:LMAuth -Method "DELETE" -ResourcePath $ResourcePath $Uri = "https://$($Script:LMAuth.Portal).logicmonitor.com/santaba/rest" + $ResourcePath Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "DELETE" -Headers $Headers[0] -WebSession $Headers[1] $Result = [PSCustomObject]@{ - Id = $APITokenId + Id = $APITokenId Message = "Successfully removed ($Message)" } @@ -120,5 +120,5 @@ Function Remove-LMAPIToken { Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." } } - End{} + End {} } diff --git a/Public/Remove-LMAccessGroup.ps1 b/Public/Remove-LMAccessGroup.ps1 new file mode 100644 index 0000000..c6de606 --- /dev/null +++ b/Public/Remove-LMAccessGroup.ps1 @@ -0,0 +1,98 @@ +<# +.SYNOPSIS +Removes a LogicMonitor access group. + +.DESCRIPTION +The Remove-LMAccessGroup function removes a LogicMonitor access group based on the specified ID or name. + +.PARAMETER Id +The ID of the access group to remove. This parameter is mandatory when using the 'Id' parameter set. + +.PARAMETER Name +The name of the access group to remove. This parameter is mandatory when using the 'Name' parameter set. + +.EXAMPLE +Remove-LMAccessGroup -Id 123 +Removes the access group with the ID 123. + +.EXAMPLE +Remove-LMAccessGroup -Name "MyAccessGroup" +Removes the access group with the name "MyAccessGroup". + +.INPUTS +None. + +.OUTPUTS +System.Management.Automation.PSCustomObject + +.NOTES +This function requires a valid LogicMonitor API authentication. Make sure to log in using Connect-LMAccount before running this command. +#> +Function Remove-LMAccessGroup { + + [CmdletBinding(DefaultParameterSetName = 'Id',SupportsShouldProcess,ConfirmImpact='High')] + Param ( + [Parameter(Mandatory, ParameterSetName = 'Id', ValueFromPipelineByPropertyName)] + [Int]$Id, + + [Parameter(Mandatory, ParameterSetName = 'Name')] + [String]$Name + ) + Begin {} + Process { + #Check if we are logged in and have valid api creds + If ($Script:LMAuth.Valid) { + + #Lookup Id if supplying username + If ($Name) { + $LookupResult = (Get-LMAccessGroup -Name $Name).Id + If (Test-LookupResult -Result $LookupResult -LookupString $Name) { + return + } + $Id = $LookupResult + } + + If($PSItem){ + $Message = "Id: $Id | Name: $($PSItem.name)" + } + ElseIf($Name){ + $Message = "Id: $Id | Name: $Name" + } + Else{ + $Message = "Id: $Id" + } + + #Build header and uri + $ResourcePath = "/setting/accessgroup/$Id" + + Try { + If ($PSCmdlet.ShouldProcess($Message, "Remove AccessGroup")) { + $Headers = New-LMHeader -Auth $Script:LMAuth -Method "DELETE" -ResourcePath $ResourcePath + $Uri = "https://$($Script:LMAuth.Portal).logicmonitor.com/santaba/rest" + $ResourcePath + + Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation + + #Issue request + $Response = Invoke-RestMethod -Uri $Uri -Method "DELETE" -Headers $Headers[0] -WebSession $Headers[1] + + $Result = [PSCustomObject]@{ + Id = $Id + Message = "Successfully removed ($Message)" + } + + Return $Result + } + } + Catch [Exception] { + $Proceed = Resolve-LMException -LMException $PSItem + If (!$Proceed) { + Return + } + } + } + Else { + Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." + } + } + End {} +} diff --git a/Public/Remove-LMAppliesToFunction.ps1 b/Public/Remove-LMAppliesToFunction.ps1 index 1ac2381..8a6752f 100644 --- a/Public/Remove-LMAppliesToFunction.ps1 +++ b/Public/Remove-LMAppliesToFunction.ps1 @@ -30,12 +30,12 @@ System.Management.Automation.PSCustomObject. The function returns an object with #> Function Remove-LMAppliesToFunction { - [CmdletBinding(SupportsShouldProcess,ConfirmImpact='High')] + [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')] Param ( [Parameter(Mandatory, ParameterSetName = 'Name')] [String]$Name, - [Parameter(Mandatory, ParameterSetName = 'Id',ValueFromPipelineByPropertyName)] + [Parameter(Mandatory, ParameterSetName = 'Id', ValueFromPipelineByPropertyName)] [Int]$Id ) @@ -56,13 +56,13 @@ Function Remove-LMAppliesToFunction { #Build header and uri $ResourcePath = "/setting/functions/$Id" - If($PSItem){ + If ($PSItem) { $Message = "Id: $Id | Name:$($PSItem.name)" } - ElseIf ($Name) { + Elseif ($Name) { $Message = "Id: $Id | Name: $Name" } - Else{ + Else { $Message = "Id: $Id" } @@ -73,11 +73,11 @@ Function Remove-LMAppliesToFunction { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "DELETE" -Headers $Headers[0] -WebSession $Headers[1] $Result = [PSCustomObject]@{ - Id = $Id + Id = $Id Message = "Successfully removed ($Message)" } diff --git a/Public/Remove-LMCachedAccount.ps1 b/Public/Remove-LMCachedAccount.ps1 index 952ab36..261fb1a 100644 --- a/Public/Remove-LMCachedAccount.ps1 +++ b/Public/Remove-LMCachedAccount.ps1 @@ -24,7 +24,7 @@ Removes all cached accounts from the Logic.Monitor vault. #> Function Remove-LMCachedAccount { - [CmdletBinding(SupportsShouldProcess,ConfirmImpact='High')] + [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')] Param ( [Parameter(Mandatory, ParameterSetName = 'Single', ValueFromPipelineByPropertyName)] [Alias("Portal")] @@ -33,34 +33,34 @@ Function Remove-LMCachedAccount { [Parameter(ParameterSetName = 'All')] [Switch]$RemoveAllEntries ) - Begin{} - Process{ - If($RemoveAllEntries){ + Begin {} + Process { + If ($RemoveAllEntries) { $CachedAccounts = Get-SecretInfo -Vault Logic.Monitor - if ($PSCmdlet.ShouldProcess("$(($CachedAccounts | Measure-Object).Count) cached account(s)", "Remove All Cached Accounts")) { - Foreach ($Account in $CachedAccounts.Name){ - Try{ + If ($PSCmdlet.ShouldProcess("$(($CachedAccounts | Measure-Object).Count) cached account(s)", "Remove All Cached Accounts")) { + Foreach ($Account in $CachedAccounts.Name) { + Try { Remove-Secret -Name $Account -Vault Logic.Monitor -Confirm:$false -ErrorAction Stop Write-Host "[INFO]: Removed cached account secret for: $Account" } - Catch{ + Catch { Write-Error $_.Exception.Message } } Write-Host "[INFO]: Processed all entries from credential cache" } } - Else{ + Else { If ($PSCmdlet.ShouldProcess($CachedAccountName, "Remove Cached Account")) { - Try{ + Try { Remove-Secret -Name $CachedAccountName -Vault Logic.Monitor -Confirm:$false -ErrorAction Stop Write-Host "[INFO]: Removed cached account secret for: $CachedAccountName" } - Catch{ + Catch { Write-Error $_.Exception.Message } } } } - End{} + End {} } \ No newline at end of file diff --git a/Public/Remove-LMCollectorGroup.ps1 b/Public/Remove-LMCollectorGroup.ps1 index 344dc32..e58437f 100644 --- a/Public/Remove-LMCollectorGroup.ps1 +++ b/Public/Remove-LMCollectorGroup.ps1 @@ -30,7 +30,7 @@ This function requires valid API credentials to be logged in. Use Connect-LMAcco #> Function Remove-LMCollectorGroup { - [CmdletBinding(DefaultParameterSetName = 'Id',SupportsShouldProcess,ConfirmImpact='High')] + [CmdletBinding(DefaultParameterSetName = 'Id', SupportsShouldProcess, ConfirmImpact = 'High')] Param ( [Parameter(Mandatory, ParameterSetName = 'Id', ValueFromPipelineByPropertyName)] [Int]$Id, @@ -53,13 +53,13 @@ Function Remove-LMCollectorGroup { $Id = $LookupResult } - If($PSItem){ + If ($PSItem) { $Message = "Id: $($PSItem.id) | Name: $($PSItem.name)" } - ElseIf ($Name) { + Elseif ($Name) { $Message = "Id: $Id | Name: $Name" } - Else{ + Else { $Message = "Id: $Id" } @@ -73,11 +73,11 @@ Function Remove-LMCollectorGroup { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "DELETE" -Headers $Headers[0] -WebSession $Headers[1] $Result = [PSCustomObject]@{ - Id = $Id + Id = $Id Message = "Successfully removed ($Message)" } diff --git a/Public/Remove-LMConfigsource.ps1 b/Public/Remove-LMConfigsource.ps1 index 49aa15d..ca10441 100644 --- a/Public/Remove-LMConfigsource.ps1 +++ b/Public/Remove-LMConfigsource.ps1 @@ -33,7 +33,7 @@ Please ensure you are logged in before running any commands. Use Connect-LMAccou #> Function Remove-LMConfigsource { - [CmdletBinding(DefaultParameterSetName = 'Id',SupportsShouldProcess,ConfirmImpact='High')] + [CmdletBinding(DefaultParameterSetName = 'Id', SupportsShouldProcess, ConfirmImpact = 'High')] Param ( [Parameter(Mandatory, ParameterSetName = 'Id', ValueFromPipelineByPropertyName)] [Int]$Id, @@ -43,8 +43,8 @@ Function Remove-LMConfigsource { ) - Begin{} - Process{ + Begin {} + Process { #Check if we are logged in and have valid api creds If ($Script:LMAuth.Valid) { @@ -61,13 +61,13 @@ Function Remove-LMConfigsource { #Build header and uri $ResourcePath = "/setting/configsources/$Id" - If($PSItem){ + If ($PSItem) { $Message = "Id: $Id | Name: $($PSItem.name)" } - ElseIf($Name){ + Elseif ($Name) { $Message = "Id: $Id | Name: $Name" } - Else{ + Else { $Message = "Id: $Id" } @@ -78,11 +78,11 @@ Function Remove-LMConfigsource { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "DELETE" -Headers $Headers[0] -WebSession $Headers[1] $Result = [PSCustomObject]@{ - Id = $Id + Id = $Id Message = "Successfully removed ($Message)" } @@ -100,5 +100,5 @@ Function Remove-LMConfigsource { Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." } } - End{} + End {} } diff --git a/Public/Remove-LMDashboard.ps1 b/Public/Remove-LMDashboard.ps1 index c86e357..f39670a 100644 --- a/Public/Remove-LMDashboard.ps1 +++ b/Public/Remove-LMDashboard.ps1 @@ -32,7 +32,7 @@ System.Management.Automation.PSCustomObject. The function returns an object with #> Function Remove-LMDashboard { - [CmdletBinding(DefaultParameterSetName = 'Id',SupportsShouldProcess,ConfirmImpact='High')] + [CmdletBinding(DefaultParameterSetName = 'Id', SupportsShouldProcess, ConfirmImpact = 'High')] Param ( [Parameter(Mandatory, ParameterSetName = 'Id', ValueFromPipelineByPropertyName)] [Int]$Id, @@ -41,8 +41,8 @@ Function Remove-LMDashboard { [String]$Name ) - Begin{} - Process{ + Begin {} + Process { #Check if we are logged in and have valid api creds If ($Script:LMAuth.Valid) { @@ -58,13 +58,13 @@ Function Remove-LMDashboard { #Build header and uri $ResourcePath = "/dashboard/dashboards/$Id" - If($PSItem){ + If ($PSItem) { $Message = "Id: $Id | Name: $($PSItem.name)" } - ElseIf($Name){ + Elseif ($Name) { $Message = "Id: $Id | Name: $Name" } - Else{ + Else { $Message = "Id: $Id" } @@ -75,11 +75,11 @@ Function Remove-LMDashboard { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "DELETE" -Headers $Headers[0] -WebSession $Headers[1] $Result = [PSCustomObject]@{ - Id = $Id + Id = $Id Message = "Successfully removed ($Message)" } @@ -97,5 +97,5 @@ Function Remove-LMDashboard { Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." } } - End{} + End {} } diff --git a/Public/Remove-LMDashboardGroup.ps1 b/Public/Remove-LMDashboardGroup.ps1 index b6b79f7..cc64e96 100644 --- a/Public/Remove-LMDashboardGroup.ps1 +++ b/Public/Remove-LMDashboardGroup.ps1 @@ -24,7 +24,7 @@ None. #> Function Remove-LMDashboardGroup { - [CmdletBinding(DefaultParameterSetName = 'Id',SupportsShouldProcess,ConfirmImpact='High')] + [CmdletBinding(DefaultParameterSetName = 'Id', SupportsShouldProcess, ConfirmImpact = 'High')] Param ( [Parameter(Mandatory, ParameterSetName = 'Id', ValueFromPipelineByPropertyName)] [Int]$Id, @@ -33,8 +33,8 @@ Function Remove-LMDashboardGroup { [String]$Name ) - Begin{} - Process{ + Begin {} + Process { #Check if we are logged in and have valid api creds If ($Script:LMAuth.Valid) { @@ -50,13 +50,13 @@ Function Remove-LMDashboardGroup { #Build header and uri $ResourcePath = "/dashboard/groups/$Id" - If($PSItem){ + If ($PSItem) { $Message = "Id: $Id | Name: $($PSItem.name)" } - ElseIf($Name){ + Elseif ($Name) { $Message = "Id: $Id | Name: $Name" } - Else{ + Else { $Message = "Id: $Id" } @@ -67,11 +67,11 @@ Function Remove-LMDashboardGroup { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "DELETE" -Headers $Headers[0] -WebSession $Headers[1] $Result = [PSCustomObject]@{ - Id = $Id + Id = $Id Message = "Successfully removed ($Message)" } @@ -89,5 +89,5 @@ Function Remove-LMDashboardGroup { Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." } } - End{} + End {} } diff --git a/Public/Remove-LMDashboardWidget.ps1 b/Public/Remove-LMDashboardWidget.ps1 index 222222a..5d3dbbc 100644 --- a/Public/Remove-LMDashboardWidget.ps1 +++ b/Public/Remove-LMDashboardWidget.ps1 @@ -33,7 +33,7 @@ This function requires a valid API authentication to Logic Monitor. Make sure to #> Function Remove-LMDashboardWidget { - [CmdletBinding(DefaultParameterSetName = 'Id',SupportsShouldProcess,ConfirmImpact='High')] + [CmdletBinding(DefaultParameterSetName = 'Id', SupportsShouldProcess, ConfirmImpact = 'High')] Param ( [Parameter(Mandatory, ParameterSetName = 'Id', ValueFromPipelineByPropertyName)] [Int]$Id, @@ -43,8 +43,8 @@ Function Remove-LMDashboardWidget { ) - Begin{} - Process{ + Begin {} + Process { #Check if we are logged in and have valid api creds If ($Script:LMAuth.Valid) { @@ -60,13 +60,13 @@ Function Remove-LMDashboardWidget { #Build header and uri $ResourcePath = "/dashboard/widgets/$Id" - If($PSItem){ + If ($PSItem) { $Message = "Id: $Id | Name: $($PSItem.name)" } - ElseIf($Name){ + Elseif ($Name) { $Message = "Id: $Id | Name: $Name" } - Else{ + Else { $Message = "Id: $Id" } @@ -77,11 +77,11 @@ Function Remove-LMDashboardWidget { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "DELETE" -Headers $Headers[0] -WebSession $Headers[1] $Result = [PSCustomObject]@{ - Id = $Id + Id = $Id Message = "Successfully removed ($Message)" } @@ -99,5 +99,5 @@ Function Remove-LMDashboardWidget { Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." } } - End{} + End {} } diff --git a/Public/Remove-LMDatasource.ps1 b/Public/Remove-LMDatasource.ps1 index 2b5535f..efac969 100644 --- a/Public/Remove-LMDatasource.ps1 +++ b/Public/Remove-LMDatasource.ps1 @@ -34,7 +34,7 @@ System.Management.Automation.PSCustomObject #> Function Remove-LMDatasource { - [CmdletBinding(DefaultParameterSetName = 'Id',SupportsShouldProcess,ConfirmImpact='High')] + [CmdletBinding(DefaultParameterSetName = 'Id', SupportsShouldProcess, ConfirmImpact = 'High')] Param ( [Parameter(Mandatory, ParameterSetName = 'Id', ValueFromPipelineByPropertyName)] [Int]$Id, @@ -47,8 +47,8 @@ Function Remove-LMDatasource { ) - Begin{} - Process{ + Begin {} + Process { #Check if we are logged in and have valid api creds If ($Script:LMAuth.Valid) { @@ -73,10 +73,10 @@ Function Remove-LMDatasource { #Build header and uri $ResourcePath = "/setting/datasources/$Id" - If($PSItem){ + If ($PSItem) { $Message = "Id: $Id | Name: $($PSItem.name) | DisplayName: $($PSItem.displayName)" } - Else{ + Else { $Message = "Id: $Id" } @@ -87,11 +87,11 @@ Function Remove-LMDatasource { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "DELETE" -Headers $Headers[0] -WebSession $Headers[1] $Result = [PSCustomObject]@{ - Id = $Id + Id = $Id Message = "Successfully removed ($Message)" } @@ -109,5 +109,5 @@ Function Remove-LMDatasource { Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." } } - End{} + End {} } diff --git a/Public/Remove-LMDevice.ps1 b/Public/Remove-LMDevice.ps1 index 5f13929..7ea218d 100644 --- a/Public/Remove-LMDevice.ps1 +++ b/Public/Remove-LMDevice.ps1 @@ -37,7 +37,7 @@ Permanently deletes the LogicMonitor device with the name "MyDevice". #> Function Remove-LMDevice { - [CmdletBinding(DefaultParameterSetName = 'Id',SupportsShouldProcess,ConfirmImpact='High')] + [CmdletBinding(DefaultParameterSetName = 'Id', SupportsShouldProcess, ConfirmImpact = 'High')] Param ( [Parameter(Mandatory, ParameterSetName = 'Id', ValueFromPipelineByPropertyName)] [Int]$Id, @@ -62,13 +62,13 @@ Function Remove-LMDevice { $Id = $LookupResult } - If($PSItem){ + If ($PSItem) { $Message = "Id: $Id | Name: $($PSItem.name)" } - ElseIf($Name){ + Elseif ($Name) { $Message = "Id: $Id | Name: $Name" } - Else{ + Else { $Message = "Id: $Id" } @@ -84,11 +84,11 @@ Function Remove-LMDevice { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "DELETE" -Headers $Headers[0] -WebSession $Headers[1] $Result = [PSCustomObject]@{ - Id = $Id + Id = $Id Message = "Successfully removed ($Message)" } diff --git a/Public/Remove-LMDeviceDatasourceInstance.ps1 b/Public/Remove-LMDeviceDatasourceInstance.ps1 index fc75586..fddec8c 100644 --- a/Public/Remove-LMDeviceDatasourceInstance.ps1 +++ b/Public/Remove-LMDeviceDatasourceInstance.ps1 @@ -11,21 +11,21 @@ Specifies the name of the datasource. This parameter is mandatory when using the .PARAMETER DatasourceId Specifies the ID of the datasource. This parameter is mandatory when using the 'Id-dsId' or 'Name-dsId' parameter sets. -.PARAMETER DeviceId +.PARAMETER Id Specifies the ID of the device. This parameter is mandatory when using the 'Id-dsId' or 'Id-dsName' parameter sets. -.PARAMETER DeviceName +.PARAMETER Name Specifies the name of the device. This parameter is mandatory when using the 'Name-dsName' or 'Name-dsId' parameter sets. .PARAMETER WildValue Specifies the wildcard value associated with the datasource instance. .EXAMPLE -Remove-LMDeviceDatasourceInstance -DeviceName "MyDevice" -DatasourceName "MyDatasource" -WildValue "12345" +Remove-LMDeviceDatasourceInstance -Name "MyDevice" -DatasourceName "MyDatasource" -WildValue "12345" Removes the device datasource instance with the specified device name, datasource name, and wildcard value. .EXAMPLE -Remove-LMDeviceDatasourceInstance -DeviceId 123 -DatasourceId 456 -WildValue "67890" +Remove-LMDeviceDatasourceInstance -Id 123 -DatasourceId 456 -WildValue "67890" Removes the device datasource instance with the specified device ID, datasource ID, and wildcard value. .INPUTS @@ -37,7 +37,7 @@ A custom object with the following properties: - Message: A message indicating the success of the removal. #> Function Remove-LMDeviceDatasourceInstance { - [CmdletBinding(SupportsShouldProcess,ConfirmImpact='High')] + [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')] Param ( [Parameter(Mandatory, ParameterSetName = 'Id-dsName')] [Parameter(Mandatory, ParameterSetName = 'Name-dsName')] @@ -56,12 +56,16 @@ Function Remove-LMDeviceDatasourceInstance { [String]$DeviceName, [Parameter(ValueFromPipelineByPropertyName)] - [String]$WildValue = $null + [String]$WildValue, + + [Parameter(ValueFromPipelineByPropertyName)] + [Alias("Id")] + [Int]$InstanceId ) - Begin{} - Process{ + Begin {} + Process { #Check if we are logged in and have valid api creds If ($Script:LMAuth.Valid) { @@ -84,23 +88,27 @@ Function Remove-LMDeviceDatasourceInstance { } #Lookup Wildcard Id - $InstanceId = (Get-LMDeviceDataSourceInstance -DeviceId $DeviceId -DatasourceId $DatasourceId | Where-Object { $_.wildValue -eq $WildValue } | Select-Object -First 1).Id - If (!$InstanceId) { - Write-Error "Unable to find assocaited datasource instance with wildcard value: $WildValue, please check spelling and try again. Datasource must have an applicable appliesTo associating the datasource to the device" - return + If(!$InstanceId -and $WildValue) { + $InstanceId = (Get-LMDeviceDataSourceInstance -Id $DeviceId -DatasourceId $DatasourceId | Where-Object { $_.wildValue -eq $WildValue }).Id + If (Test-LookupResult -Result $LookupResult -LookupString $InstanceId) { + return + } + } + Else{ + Write-Error "Please provide a valid instance ID or wildvalue to remove a device datasource instance." } #Build header and uri $ResourcePath = "/device/devices/$DeviceId/devicedatasources/$HdsId/instances/$InstanceId" - If($PSItem){ + If ($PSItem) { $Message = "DeviceDisplayName: $($PSItem.deviceDisplayName) | DatasourceName: $($PSItem.name) | WildValue: $($PSItem.wildValue)" } - ElseIf($DatasourceName -and $DeviceName){ - $Message = "DeviceName: $DeviceName | DatasourceName: $DatasourceName | WildValue: $WildValue" + Elseif ($DatasourceName -and $DeviceName) { + $Message = "Name: $DeviceName | DatasourceName: $DatasourceName | WildValue: $WildValue" } - Else{ - $Message = "DeviceId: $DeviceId | DatasourceId: $DatasourceId | WildValue: $WildValue" + Else { + $Message = "Id: $DeviceId | DatasourceId: $DatasourceId | WildValue: $WildValue" } Try { @@ -110,12 +118,12 @@ Function Remove-LMDeviceDatasourceInstance { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "DELETE" -Headers $Headers[0] -WebSession $Headers[1] $Result = [PSCustomObject]@{ InstanceId = $InstanceId - Message = "Successfully removed ($Message)" + Message = "Successfully removed ($Message)" } Return $Result @@ -132,5 +140,5 @@ Function Remove-LMDeviceDatasourceInstance { Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." } } - End{} + End {} } diff --git a/Public/Remove-LMDeviceDatasourceInstanceGroup.ps1 b/Public/Remove-LMDeviceDatasourceInstanceGroup.ps1 new file mode 100644 index 0000000..e930c2c --- /dev/null +++ b/Public/Remove-LMDeviceDatasourceInstanceGroup.ps1 @@ -0,0 +1,128 @@ +<# +.SYNOPSIS +Removes a LogicMonitor device datasource instance group. + +.DESCRIPTION +The Remove-LMDeviceDatasourceInstanceGroup function removes a LogicMonitor device datasource instance group based on the provided parameters. It requires valid API credentials and a logged-in session. + +.PARAMETER DatasourceName +Specifies the name of the datasource associated with the instance group. This parameter is mandatory when using the 'Id-dsName' or 'Name-dsName' parameter sets. + +.PARAMETER DatasourceId +Specifies the ID of the datasource associated with the instance group. This parameter is mandatory when using the 'Id-dsId' or 'Name-dsId' parameter sets. + +.PARAMETER Id +Specifies the ID of the device associated with the instance group. This parameter is mandatory when using the 'Id-dsId' or 'Id-dsName' parameter sets. This parameter can also be specified using the 'DeviceId' alias. + +.PARAMETER Name +Specifies the name of the device associated with the instance group. This parameter is mandatory when using the 'Name-dsName' or 'Name-dsId' parameter sets. This parameter can also be specified using the 'DeviceName' alias. + +.PARAMETER InstanceGroupName +Specifies the name of the instance group to be removed. This parameter is mandatory. + +.EXAMPLE +Remove-LMDeviceDatasourceInstanceGroup -DatasourceName "CPU" -Name "Server01" -InstanceGroupName "Group1" +Removes the instance group named "Group1" associated with the "CPU" datasource on the device named "Server01". + +.EXAMPLE +Remove-LMDeviceDatasourceInstanceGroup -DatasourceId 123 -Id 456 -InstanceGroupName "Group2" +Removes the instance group named "Group2" associated with the datasource ID 123 on the device ID 456. + +.INPUTS +None. You cannot pipe objects to this function. +#> + +Function Remove-LMDeviceDatasourceInstanceGroup { + [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')] + Param ( + [Parameter(Mandatory, ParameterSetName = 'Id-dsName')] + [Parameter(Mandatory, ParameterSetName = 'Name-dsName')] + [String]$DatasourceName, + + [Parameter(Mandatory, ParameterSetName = 'Id-dsId')] + [Parameter(Mandatory, ParameterSetName = 'Name-dsId')] + [Int]$DatasourceId, + + [Parameter(Mandatory, ParameterSetName = 'Id-dsId')] + [Parameter(Mandatory, ParameterSetName = 'Id-dsName')] + [Alias('DeviceId')] + [Int]$Id, + + [Parameter(Mandatory, ParameterSetName = 'Name-dsName')] + [Parameter(Mandatory, ParameterSetName = 'Name-dsId')] + [Alias('DeviceName')] + [String]$Name, + + [Parameter(Mandatory)] + [String]$InstanceGroupName + ) + #Check if we are logged in and have valid api creds + If ($Script:LMAuth.Valid) { + + #Lookup Device Id + If ($Name) { + $LookupResult = (Get-LMDevice -Name $Name).Id + If (Test-LookupResult -Result $LookupResult -LookupString $Name) { + return + } + $Id = $LookupResult + } + + #Lookup DatasourceId + If ($DatasourceName -or $DatasourceId) { + $LookupResult = (Get-LMDeviceDataSourceList -Id $Id | Where-Object { $_.dataSourceName -eq $DatasourceName -or $_.dataSourceId -eq $DatasourceId }).Id + If (Test-LookupResult -Result $LookupResult -LookupString $DatasourceName) { + return + } + $HdsId = $LookupResult + } + + #Lookup InstanceGroupId + $LookupResult = (Get-LMDeviceDatasourceInstanceGroup -Id $Id -HdsId $HdsId -Filter "name -eq '$InstanceGroupName'").Id + If (Test-LookupResult -Result $LookupResult -LookupString $InstanceGroupName) { + return + } + $InstanceGroupId = $LookupResult + + #Build header and uri + $ResourcePath = "/device/devices/$Id/devicedatasources/$HdsId/groups/$InstanceGroupId" + + If ($PSItem) { + $Message = "DeviceDisplayName: $($PSItem.deviceDisplayName) | DatasourceName: $($PSItem.name) | InstanceGroupName: $($PSItem.InstanceGroupName)" + } + Elseif ($DatasourceName -and $DeviceName) { + $Message = "DeviceName: $DeviceName | DatasourceName: $DatasourceName | InstanceGroupName: $InstanceGroupName" + } + Else { + $Message = "DeviceId: $DeviceId | DatasourceId: $DatasourceId | InstanceGroupName: $InstanceGroupName" + } + + Try { + If ($PSCmdlet.ShouldProcess($Message, "Remove Device Datasource Instance Group")) { + $Headers = New-LMHeader -Auth $Script:LMAuth -Method "DELETE" -ResourcePath $ResourcePath + $Uri = "https://$($Script:LMAuth.Portal).logicmonitor.com/santaba/rest" + $ResourcePath + + Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation + + #Issue request + $Response = Invoke-RestMethod -Uri $Uri -Method "DELETE" -Headers $Headers[0] -WebSession $Headers[1] + + $Result = [PSCustomObject]@{ + InstanceId = $InstanceId + Message = "Successfully removed ($Message)" + } + + Return $Result + } + } + Catch [Exception] { + $Proceed = Resolve-LMException -LMException $PSItem + If (!$Proceed) { + Return + } + } + } + Else { + Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." + } +} diff --git a/Public/Remove-LMDeviceGroup.ps1 b/Public/Remove-LMDeviceGroup.ps1 index 355a5a3..0401640 100644 --- a/Public/Remove-LMDeviceGroup.ps1 +++ b/Public/Remove-LMDeviceGroup.ps1 @@ -61,13 +61,13 @@ Function Remove-LMDeviceGroup { $QueryParams = "?deleteChildren=$DeleteHostsandChildren&deleteHard=$HardDelete" - If($PSItem){ + If ($PSItem) { $Message = "Id: $Id | Name: $($PSItem.name)" } - ElseIf($Name){ + Elseif ($Name) { $Message = "Id: $Id | Name: $Name" } - Else{ + Else { $Message = "Id: $Id" } @@ -78,11 +78,11 @@ Function Remove-LMDeviceGroup { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "DELETE" -Headers $Headers[0] -WebSession $Headers[1] $Result = [PSCustomObject]@{ - Id = $Id + Id = $Id Message = "Successfully removed ($Message)" } diff --git a/Public/Remove-LMDeviceProperty.ps1 b/Public/Remove-LMDeviceProperty.ps1 index c761634..9c108f2 100644 --- a/Public/Remove-LMDeviceProperty.ps1 +++ b/Public/Remove-LMDeviceProperty.ps1 @@ -36,7 +36,7 @@ System.Management.Automation.PSCustomObject. The output object contains the foll #> Function Remove-LMDeviceProperty { - [CmdletBinding(DefaultParameterSetName = 'Id',SupportsShouldProcess,ConfirmImpact='High')] + [CmdletBinding(DefaultParameterSetName = 'Id', SupportsShouldProcess, ConfirmImpact = 'High')] Param ( [Parameter(Mandatory, ParameterSetName = 'Id')] [Int]$Id, @@ -65,10 +65,10 @@ Function Remove-LMDeviceProperty { #Build header and uri $ResourcePath = "/device/devices/$Id/properties/$PropertyName" - If($Name){ + If ($Name) { $Message = "Id: $Id | Name: $Name | Property: $PropertyName" } - Else{ + Else { $Message = "Id: $Id | Property: $PropertyName" } @@ -79,11 +79,11 @@ Function Remove-LMDeviceProperty { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "DELETE" -Headers $Headers[0] -WebSession $Headers[1] $Result = [PSCustomObject]@{ - Id = $Id + Id = $Id Message = "Successfully removed ($Message)" } @@ -101,5 +101,5 @@ Function Remove-LMDeviceProperty { Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." } } - End{} + End {} } diff --git a/Public/Remove-LMNetscan.ps1 b/Public/Remove-LMNetscan.ps1 index 80e7de9..af023aa 100644 --- a/Public/Remove-LMNetscan.ps1 +++ b/Public/Remove-LMNetscan.ps1 @@ -29,7 +29,7 @@ System.Management.Automation.PSCustomObject. The function returns an object with #> Function Remove-LMNetscan { - [CmdletBinding(DefaultParameterSetName = 'Id',SupportsShouldProcess,ConfirmImpact='High')] + [CmdletBinding(DefaultParameterSetName = 'Id', SupportsShouldProcess, ConfirmImpact = 'High')] Param ( [Parameter(Mandatory, ParameterSetName = 'Id', ValueFromPipelineByPropertyName)] [Int]$Id, @@ -39,8 +39,8 @@ Function Remove-LMNetscan { ) - Begin{} - Process{ + Begin {} + Process { #Check if we are logged in and have valid api creds If ($Script:LMAuth.Valid) { @@ -56,13 +56,13 @@ Function Remove-LMNetscan { #Build header and uri $ResourcePath = "/setting/netscans/$Id" - If($PSItem){ + If ($PSItem) { $Message = "Id: $Id | Name: $($PSItem.name)" } - ElseIf($Name){ + Elseif ($Name) { $Message = "Id: $Id | Name: $Name" } - Else{ + Else { $Message = "Id: $Id" } @@ -74,11 +74,11 @@ Function Remove-LMNetscan { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "DELETE" -Headers $Headers[0] -WebSession $Headers[1] $Result = [PSCustomObject]@{ - Id = $Id + Id = $Id Message = "Successfully removed ($Message)" } @@ -96,5 +96,5 @@ Function Remove-LMNetscan { Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." } } - End{} + End {} } diff --git a/Public/Remove-LMNetscanGroup.ps1 b/Public/Remove-LMNetscanGroup.ps1 index b30a027..b032f11 100644 --- a/Public/Remove-LMNetscanGroup.ps1 +++ b/Public/Remove-LMNetscanGroup.ps1 @@ -33,7 +33,7 @@ This function requires valid API credentials to be logged in. Use the Connect-LM #> Function Remove-LMNetscanGroup { - [CmdletBinding(DefaultParameterSetName = 'Id',SupportsShouldProcess,ConfirmImpact='High')] + [CmdletBinding(DefaultParameterSetName = 'Id', SupportsShouldProcess, ConfirmImpact = 'High')] Param ( [Parameter(Mandatory, ParameterSetName = 'Id', ValueFromPipelineByPropertyName)] [Int]$Id, @@ -56,13 +56,13 @@ Function Remove-LMNetscanGroup { $Id = $LookupResult } - If($PSItem){ + If ($PSItem) { $Message = "Id: $Id | Name: $($PSItem.name)" } - ElseIf($Name){ + Elseif ($Name) { $Message = "Id: $Id | Name: $Name" } - Else{ + Else { $Message = "Id: $Id" } @@ -76,11 +76,11 @@ Function Remove-LMNetscanGroup { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "DELETE" -Headers $Headers[0] -WebSession $Headers[1] $Result = [PSCustomObject]@{ - Id = $Id + Id = $Id Message = "Successfully removed ($Message)" } diff --git a/Public/Remove-LMOpsNote.ps1 b/Public/Remove-LMOpsNote.ps1 index 475a1c2..e737a5a 100644 --- a/Public/Remove-LMOpsNote.ps1 +++ b/Public/Remove-LMOpsNote.ps1 @@ -21,7 +21,7 @@ Returns an object with the ID and a success message if the OpsNote is successful #> Function Remove-LMOpsNote { - [CmdletBinding(DefaultParameterSetName = 'Id',SupportsShouldProcess,ConfirmImpact='High')] + [CmdletBinding(DefaultParameterSetName = 'Id', SupportsShouldProcess, ConfirmImpact = 'High')] Param ( [Parameter(Mandatory, ParameterSetName = 'Id', ValueFromPipelineByPropertyName)] [String]$Id @@ -45,11 +45,11 @@ Function Remove-LMOpsNote { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "DELETE" -Headers $Headers[0] -WebSession $Headers[1] $Result = [PSCustomObject]@{ - Id = $Id + Id = $Id Message = "Successfully removed ($Message)" } diff --git a/Public/Remove-LMPropertysource.ps1 b/Public/Remove-LMPropertysource.ps1 index e23164c..d533233 100644 --- a/Public/Remove-LMPropertysource.ps1 +++ b/Public/Remove-LMPropertysource.ps1 @@ -29,7 +29,7 @@ System.Management.Automation.PSCustomObject. The function returns an object with #> Function Remove-LMPropertysource { - [CmdletBinding(DefaultParameterSetName = 'Id',SupportsShouldProcess,ConfirmImpact='High')] + [CmdletBinding(DefaultParameterSetName = 'Id', SupportsShouldProcess, ConfirmImpact = 'High')] Param ( [Parameter(Mandatory, ParameterSetName = 'Id', ValueFromPipelineByPropertyName)] [Int]$Id, @@ -39,8 +39,8 @@ Function Remove-LMPropertysource { ) - Begin{} - Process{ + Begin {} + Process { #Check if we are logged in and have valid api creds If ($Script:LMAuth.Valid) { @@ -57,13 +57,13 @@ Function Remove-LMPropertysource { #Build header and uri $ResourcePath = "/setting/propertyrules/$Id" - If($PSItem){ + If ($PSItem) { $Message = "Id: $Id | Name: $($PSItem.name)" } - ElseIf($Name){ + Elseif ($Name) { $Message = "Id: $Id | Name: $Name" } - Else{ + Else { $Message = "Id: $Id" } @@ -74,11 +74,11 @@ Function Remove-LMPropertysource { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "DELETE" -Headers $Headers[0] -WebSession $Headers[1] $Result = [PSCustomObject]@{ - Id = $Id + Id = $Id Message = "Successfully removed ($Message)" } @@ -96,5 +96,5 @@ Function Remove-LMPropertysource { Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." } } - End{} + End {} } diff --git a/Public/Remove-LMReport.ps1 b/Public/Remove-LMReport.ps1 index 06f9411..223d992 100644 --- a/Public/Remove-LMReport.ps1 +++ b/Public/Remove-LMReport.ps1 @@ -30,7 +30,7 @@ This function requires a valid API authentication and authorization. Use Connect #> Function Remove-LMReport { - [CmdletBinding(DefaultParameterSetName = 'Id',SupportsShouldProcess,ConfirmImpact='High')] + [CmdletBinding(DefaultParameterSetName = 'Id', SupportsShouldProcess, ConfirmImpact = 'High')] Param ( [Parameter(Mandatory, ParameterSetName = 'Id', ValueFromPipelineByPropertyName)] [Int]$Id, @@ -53,13 +53,13 @@ Function Remove-LMReport { $Id = $LookupResult } - If($PSItem){ + If ($PSItem) { $Message = "Id: $Id | Name: $($PSItem.name)" } - ElseIf($Name){ + Elseif ($Name) { $Message = "Id: $Id | Name: $Name" } - Else{ + Else { $Message = "Id: $Id" } @@ -73,11 +73,11 @@ Function Remove-LMReport { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "DELETE" -Headers $Headers[0] -WebSession $Headers[1] $Result = [PSCustomObject]@{ - Id = $Id + Id = $Id Message = "Successfully removed ($Message)" } diff --git a/Public/Remove-LMReportGroup.ps1 b/Public/Remove-LMReportGroup.ps1 index 4772225..2ed1423 100644 --- a/Public/Remove-LMReportGroup.ps1 +++ b/Public/Remove-LMReportGroup.ps1 @@ -27,7 +27,7 @@ System.Management.Automation.PSCustomObject. Returns an object with the removed #> Function Remove-LMReportGroup { - [CmdletBinding(DefaultParameterSetName = 'Id',SupportsShouldProcess,ConfirmImpact='High')] + [CmdletBinding(DefaultParameterSetName = 'Id', SupportsShouldProcess, ConfirmImpact = 'High')] Param ( [Parameter(Mandatory, ParameterSetName = 'Id', ValueFromPipelineByPropertyName)] [Int]$Id, @@ -50,13 +50,13 @@ Function Remove-LMReportGroup { $Id = $LookupResult } - If($PSItem){ + If ($PSItem) { $Message = "Id: $Id | Name: $($PSItem.name)" } - ElseIf($Name){ + Elseif ($Name) { $Message = "Id: $Id | Name: $Name" } - Else{ + Else { $Message = "Id: $Id" } @@ -70,11 +70,11 @@ Function Remove-LMReportGroup { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "DELETE" -Headers $Headers[0] -WebSession $Headers[1] $Result = [PSCustomObject]@{ - Id = $Id + Id = $Id Message = "Successfully removed ($Message)" } diff --git a/Public/Remove-LMRole.ps1 b/Public/Remove-LMRole.ps1 index 732981d..6f736bd 100644 --- a/Public/Remove-LMRole.ps1 +++ b/Public/Remove-LMRole.ps1 @@ -30,7 +30,7 @@ This function requires a valid API authentication and authorization. Use Connect #> Function Remove-LMRole { - [CmdletBinding(DefaultParameterSetName = 'Id',SupportsShouldProcess,ConfirmImpact='High')] + [CmdletBinding(DefaultParameterSetName = 'Id', SupportsShouldProcess, ConfirmImpact = 'High')] Param ( [Parameter(Mandatory, ParameterSetName = 'Id', ValueFromPipelineByPropertyName)] [Int]$Id, @@ -56,13 +56,13 @@ Function Remove-LMRole { #Build header and uri $ResourcePath = "/setting/roles/$Id" - If($PSItem){ + If ($PSItem) { $Message = "Id: $Id | Name: $($PSItem.name)" } - ElseIf($Name){ + Elseif ($Name) { $Message = "Id: $Id | Name: $Name" } - Else{ + Else { $Message = "Id: $Id" } @@ -74,11 +74,11 @@ Function Remove-LMRole { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "DELETE" -Headers $Headers[0] -WebSession $Headers[1] $Result = [PSCustomObject]@{ - Id = $Id + Id = $Id Message = "Successfully removed ($Message)" } diff --git a/Public/Remove-LMSDT.ps1 b/Public/Remove-LMSDT.ps1 index a2422c5..4ba9160 100644 --- a/Public/Remove-LMSDT.ps1 +++ b/Public/Remove-LMSDT.ps1 @@ -1,6 +1,6 @@ Function Remove-LMSDT { - [CmdletBinding(DefaultParameterSetName = 'Id',SupportsShouldProcess,ConfirmImpact='High')] + [CmdletBinding(DefaultParameterSetName = 'Id', SupportsShouldProcess, ConfirmImpact = 'High')] Param ( [Parameter(Mandatory, ParameterSetName = 'Id', ValueFromPipelineByPropertyName)] [String]$Id @@ -24,11 +24,11 @@ Function Remove-LMSDT { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "DELETE" -Headers $Headers[0] -WebSession $Headers[1] $Result = [PSCustomObject]@{ - Id = $Id + Id = $Id Message = "Successfully removed ($Message)" } diff --git a/Public/Remove-LMTopologysource.ps1 b/Public/Remove-LMTopologysource.ps1 index 3677d04..89f404d 100644 --- a/Public/Remove-LMTopologysource.ps1 +++ b/Public/Remove-LMTopologysource.ps1 @@ -1,6 +1,6 @@ Function Remove-LMTopologysource { - [CmdletBinding(DefaultParameterSetName = 'Id',SupportsShouldProcess,ConfirmImpact='High')] + [CmdletBinding(DefaultParameterSetName = 'Id', SupportsShouldProcess, ConfirmImpact = 'High')] Param ( [Parameter(Mandatory, ParameterSetName = 'Id', ValueFromPipelineByPropertyName)] [Int]$Id, @@ -10,8 +10,8 @@ Function Remove-LMTopologysource { ) - Begin{} - Process{ + Begin {} + Process { #Check if we are logged in and have valid api creds If ($Script:LMAuth.Valid) { @@ -28,13 +28,13 @@ Function Remove-LMTopologysource { #Build header and uri $ResourcePath = "/setting/topologysources/$Id" - If($PSItem){ + If ($PSItem) { $Message = "Id: $Id | Name: $($PSItem.name)" } - ElseIf($Name){ + Elseif ($Name) { $Message = "Id: $Id | Name: $Name" } - Else{ + Else { $Message = "Id: $Id" } @@ -45,11 +45,11 @@ Function Remove-LMTopologysource { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "DELETE" -Headers $Headers[0] -WebSession $Headers[1] $Result = [PSCustomObject]@{ - Id = $Id + Id = $Id Message = "Successfully removed ($Message)" } @@ -67,5 +67,5 @@ Function Remove-LMTopologysource { Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." } } - End{} + End {} } diff --git a/Public/Remove-LMUnmonitoredDevice.ps1 b/Public/Remove-LMUnmonitoredDevice.ps1 index c8c675d..8177aca 100644 --- a/Public/Remove-LMUnmonitoredDevice.ps1 +++ b/Public/Remove-LMUnmonitoredDevice.ps1 @@ -1,6 +1,6 @@ Function Remove-LMUnmonitoredDevice { - [CmdletBinding(DefaultParameterSetName = 'Id',SupportsShouldProcess,ConfirmImpact='High')] + [CmdletBinding(DefaultParameterSetName = 'Id', SupportsShouldProcess, ConfirmImpact = 'High')] Param ( [Parameter(Mandatory, ParameterSetName = 'Id')] [String[]]$Ids @@ -17,7 +17,7 @@ Function Remove-LMUnmonitoredDevice { $Message = "Id(s): $Ids" Try { - if ($PSCmdlet.ShouldProcess($Message, "Remove Unmonitored Devices")) { + If ($PSCmdlet.ShouldProcess($Message, "Remove Unmonitored Devices")) { [String[]]$Data = $Ids $Data = ($Data | ConvertTo-Json -AsArray) @@ -26,7 +26,7 @@ Function Remove-LMUnmonitoredDevice { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data Return (Add-ObjectTypeInfo -InputObject $Response -TypeName "LogicMonitor.UnmonitoredDevice" ) diff --git a/Public/Remove-LMUser.ps1 b/Public/Remove-LMUser.ps1 index af1ddc4..37ef3c5 100644 --- a/Public/Remove-LMUser.ps1 +++ b/Public/Remove-LMUser.ps1 @@ -1,6 +1,6 @@ Function Remove-LMUser { - [CmdletBinding(DefaultParameterSetName = 'Id',SupportsShouldProcess,ConfirmImpact='High')] + [CmdletBinding(DefaultParameterSetName = 'Id', SupportsShouldProcess, ConfirmImpact = 'High')] Param ( [Parameter(Mandatory, ParameterSetName = 'Id', ValueFromPipelineByPropertyName)] [Int]$Id, @@ -26,13 +26,13 @@ Function Remove-LMUser { #Build header and uri $ResourcePath = "/setting/admins/$Id" - If($PSItem){ + If ($PSItem) { $Message = "Id: $Id | Name: $($PSItem.username)" } - ElseIf($Name){ + Elseif ($Name) { $Message = "Id: $Id | Name: $Name" } - Else{ + Else { $Message = "Id: $Id" } @@ -44,11 +44,11 @@ Function Remove-LMUser { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "DELETE" -Headers $Headers[0] -WebSession $Headers[1] $Result = [PSCustomObject]@{ - Id = $Id + Id = $Id Message = "Successfully removed ($Message)" } diff --git a/Public/Remove-LMWebsite.ps1 b/Public/Remove-LMWebsite.ps1 index 7d49d06..5859fcc 100644 --- a/Public/Remove-LMWebsite.ps1 +++ b/Public/Remove-LMWebsite.ps1 @@ -1,6 +1,6 @@ Function Remove-LMWebsite { - [CmdletBinding(DefaultParameterSetName = 'Id',SupportsShouldProcess,ConfirmImpact='High')] + [CmdletBinding(DefaultParameterSetName = 'Id', SupportsShouldProcess, ConfirmImpact = 'High')] Param ( [Parameter(Mandatory, ParameterSetName = 'Id', ValueFromPipelineByPropertyName)] [Int]$Id, @@ -10,8 +10,8 @@ Function Remove-LMWebsite { ) - Begin{} - Process{ + Begin {} + Process { #Check if we are logged in and have valid api creds If ($Script:LMAuth.Valid) { @@ -27,13 +27,13 @@ Function Remove-LMWebsite { #Build header and uri $ResourcePath = "/website/websites/$Id" - If($PSItem){ + If ($PSItem) { $Message = "Id: $Id | Name: $($PSItem.name)" } - ElseIf($Name){ + Elseif ($Name) { $Message = "Id: $Id | Name: $Name" } - Else{ + Else { $Message = "Id: $Id" } @@ -44,11 +44,11 @@ Function Remove-LMWebsite { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "DELETE" -Headers $Headers[0] -WebSession $Headers[1] $Result = [PSCustomObject]@{ - Id = $Id + Id = $Id Message = "Successfully removed ($Message)" } @@ -66,5 +66,5 @@ Function Remove-LMWebsite { Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." } } - End{} + End {} } diff --git a/Public/Remove-LMWebsiteGroup.ps1 b/Public/Remove-LMWebsiteGroup.ps1 index f77fae7..12826ce 100644 --- a/Public/Remove-LMWebsiteGroup.ps1 +++ b/Public/Remove-LMWebsiteGroup.ps1 @@ -1,6 +1,6 @@ Function Remove-LMWebsiteGroup { - [CmdletBinding(DefaultParameterSetName = 'Id',SupportsShouldProcess,ConfirmImpact='High')] + [CmdletBinding(DefaultParameterSetName = 'Id', SupportsShouldProcess, ConfirmImpact = 'High')] Param ( [Parameter(Mandatory, ParameterSetName = 'Id', ValueFromPipelineByPropertyName)] [Int]$Id, @@ -32,13 +32,13 @@ Function Remove-LMWebsiteGroup { $ResourcePath = "/website/groups/$Id" $QueryParams = "?deleteChildren=$deleteChildren" - If($PSItem){ + If ($PSItem) { $Message = "Id: $Id | Name: $($PSItem.name)" } - ElseIf($Name){ + Elseif ($Name) { $Message = "Id: $Id | Name: $Name" } - Else{ + Else { $Message = "Id: $Id" } @@ -49,11 +49,11 @@ Function Remove-LMWebsiteGroup { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "DELETE" -Headers $Headers[0] -WebSession $Headers[1] $Result = [PSCustomObject]@{ - Id = $Id + Id = $Id Message = "Successfully removed ($Message)" } diff --git a/Public/Send-LMLogMessage.ps1 b/Public/Send-LMLogMessage.ps1 index ec0dfd3..17f6713 100644 --- a/Public/Send-LMLogMessage.ps1 +++ b/Public/Send-LMLogMessage.ps1 @@ -80,7 +80,7 @@ Function Send-LMLogMessage { } #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } } $Entries += $Data $Entries = ConvertTo-Json -InputObject $Entries } diff --git a/Public/Send-LMPushMetric.ps1 b/Public/Send-LMPushMetric.ps1 index e2c541f..05bef63 100644 --- a/Public/Send-LMPushMetric.ps1 +++ b/Public/Send-LMPushMetric.ps1 @@ -78,7 +78,7 @@ Function Send-LMPushMetric { If ($Script:LMAuth.Valid) { $QueryParams = $null - If($NewResourceHostName){ + If ($NewResourceHostName) { $QueryParams = "?create=true" } @@ -88,20 +88,20 @@ Function Send-LMPushMetric { Try { $Data = @{ - resourceName = $NewResourceHostName - resourceDescription = $NewResourceDescription - resourceIds = $ResourceIds - resourceProperties = $ResourceProperties - dataSourceId = $DatasourceId - dataSource = ($DatasourceName -replace '[#\\;=]', '_') - dataSourceDisplayName = ($DatasourceDisplayName -replace '[#\\;=]', '_') - dataSourceGroup = $DatasourceGroup - instances = $Instances + resourceName = $NewResourceHostName + resourceDescription = $NewResourceDescription + resourceIds = $ResourceIds + resourceProperties = $ResourceProperties + dataSourceId = $DatasourceId + dataSource = ($DatasourceName -replace '[#\\;=]', '_') + dataSourceDisplayName = ($DatasourceDisplayName -replace '[#\\;=]', '_') + dataSourceGroup = $DatasourceGroup + instances = $Instances } #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_]) -and $_ -ne "instances") { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_]) -and $_ -ne "instances") { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json -Depth 10) $Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath -Data $Data diff --git a/Public/Set-LMAPIToken.ps1 b/Public/Set-LMAPIToken.ps1 index 7ac413a..b1010b8 100644 --- a/Public/Set-LMAPIToken.ps1 +++ b/Public/Set-LMAPIToken.ps1 @@ -1,6 +1,6 @@ Function Set-LMAPIToken { - [CmdletBinding(DefaultParameterSetName = 'Id',SupportsShouldProcess,ConfirmImpact='None')] + [CmdletBinding(DefaultParameterSetName = 'Id', SupportsShouldProcess, ConfirmImpact = 'None')] Param ( [Parameter(Mandatory, ParameterSetName = 'Id', ValueFromPipelineByPropertyName)] [Int]$AdminId, @@ -18,8 +18,8 @@ Function Set-LMAPIToken { ) - Begin{} - Process{ + Begin {} + Process { #Check if we are logged in and have valid api creds If ($Script:LMAuth.Valid) { @@ -35,10 +35,10 @@ Function Set-LMAPIToken { #Build header and uri $ResourcePath = "/setting/admins/$AdminId/apitokens/$Id" - If($PSItem){ + If ($PSItem) { $Message = "Id: $Id | AccessId: $($PSItem.accessId)| AdminName:$($PSItem.adminName)" } - Else{ + Else { $Message = "Id: $Id" } @@ -49,7 +49,7 @@ Function Set-LMAPIToken { } #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } If ($Status) { $Data.status = $(If ($Status -eq "active") { 2 }Else { 1 }) @@ -80,5 +80,5 @@ Function Set-LMAPIToken { Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." } } - End{} + End {} } diff --git a/Public/Set-LMAccessGroup.ps1 b/Public/Set-LMAccessGroup.ps1 new file mode 100644 index 0000000..277748c --- /dev/null +++ b/Public/Set-LMAccessGroup.ps1 @@ -0,0 +1,114 @@ +<# +.SYNOPSIS +Sets the properties of a LogicMonitor access group. + +.DESCRIPTION +The Set-LMAccessGroup function is used to set the properties of a LogicMonitor access group. It allows you to specify the access group either by its ID or by its name. You can set the new name, description, and tenant ID for the access group. + +.PARAMETER Id +Specifies the ID of the access group. This parameter is used when you want to set the properties of the access group by its ID. + +.PARAMETER Name +Specifies the name of the access group. This parameter is used when you want to set the properties of the access group by its name. + +.PARAMETER NewName +Specifies the new name for the access group. + +.PARAMETER Description +Specifies the new description for the access group. + +.PARAMETER Tenant +Specifies the tenant ID for the access group. + +.EXAMPLE +Set-LMAccessGroup -Id 123 -NewName "New Access Group" -Description "This is a new access group" -Tenant "abc123" +Sets the properties of the access group with ID 123. The new name is set to "New Access Group", the description is set to "This is a new access group", and the tenant ID is set to "abc123". + +.EXAMPLE +Set-LMAccessGroup -Name "Old Access Group" -NewName "New Access Group" -Description "This is a new access group" -Tenant "abc123" +Sets the properties of the access group with name "Old Access Group". The new name is set to "New Access Group", the description is set to "This is a new access group", and the tenant ID is set to "abc123". + +.NOTES +This function requires you to be logged in and have valid API credentials. Use the Connect-LMAccount function to log in before running this command. +#> +Function Set-LMAccessGroup { + + [CmdletBinding()] + Param ( + + [Parameter(ParameterSetName = 'Id', ValueFromPipelineByPropertyName)] + [Int]$Id, + + [Parameter(ParameterSetName = 'Name')] + [String]$Name, + + [String]$NewName, + + [String]$Description, + + [String]$Tenant + + ) + #Check if we are logged in and have valid api creds + Begin {} + Process { + If ($Script:LMAuth.Valid) { + #Lookup Group Id + If ($Name) { + $LookupResult = (Get-LMAccessGroup -Name $Name).Id + If (Test-LookupResult -Result $LookupResult -LookupString $Name) { + return + } + $Id = $LookupResult + } + + If($PSItem){ + $Message = "Id: $Id | Name: $($PSItem.name) | Description: $($PSItem.description)" + } + ElseIf($Name){ + $Message = "Id: $Id | Name: $Name)" + } + Else{ + $Message = "Id: $Id" + } + + #Build header and uri + $ResourcePath = "/setting/accessgroup/$Id" + + Try { + $Data = @{ + description = $Description + name = $NewName + tenantId = $Tenant + } + + #Remove empty keys so we dont overwrite them + @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } + + $Data = ($Data | ConvertTo-Json) + + If ($PSCmdlet.ShouldProcess($Message, "Set AccessGroup")) { + $Headers = New-LMHeader -Auth $Script:LMAuth -Method "PATCH" -ResourcePath $ResourcePath -Data $Data + $Uri = "https://$($Script:LMAuth.Portal).logicmonitor.com/santaba/rest" + $ResourcePath + + Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Data + + #Issue request + $Response = Invoke-RestMethod -Uri $Uri -Method "PATCH" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data + + Return (Add-ObjectTypeInfo -InputObject $Response -TypeName "LogicMonitor.AccessGroup" ) + } + } + Catch [Exception] { + $Proceed = Resolve-LMException -LMException $PSItem + If (!$Proceed) { + Return + } + } + } + Else { + Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." + } + } + End {} +} diff --git a/Public/Set-LMAppliesToFunction.ps1 b/Public/Set-LMAppliesToFunction.ps1 index 74d6494..1d4a668 100644 --- a/Public/Set-LMAppliesToFunction.ps1 +++ b/Public/Set-LMAppliesToFunction.ps1 @@ -1,13 +1,13 @@ Function Set-LMAppliesToFunction { - [CmdletBinding(DefaultParameterSetName = 'Id',SupportsShouldProcess,ConfirmImpact='None')] + [CmdletBinding(DefaultParameterSetName = 'Id', SupportsShouldProcess, ConfirmImpact = 'None')] Param ( [Parameter(Mandatory, ParameterSetName = 'Name')] [String]$Name, [String]$NewName, - [Parameter(Mandatory, ParameterSetName = 'Id',ValueFromPipelineByPropertyName)] + [Parameter(Mandatory, ParameterSetName = 'Id', ValueFromPipelineByPropertyName)] [String]$Id, [String]$Description, @@ -31,22 +31,22 @@ Function Set-LMAppliesToFunction { #Build header and uri $ResourcePath = "/setting/functions/$Id" - If($PSItem){ + If ($PSItem) { $Message = "Id: $Id | Name: $($PSItem.name)" } - Else{ + Else { $Message = "Id: $Id" } Try { $Data = @{ - name = $NewName - description = $Description - code = $AppliesTo + name = $NewName + description = $Description + code = $AppliesTo } #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json) @@ -56,7 +56,7 @@ Function Set-LMAppliesToFunction { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Data - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "PATCH" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data Return (Add-ObjectTypeInfo -InputObject $Response -TypeName "LogicMonitor.AppliesToFunction" ) diff --git a/Public/Set-LMCollector.ps1 b/Public/Set-LMCollector.ps1 index f79bc61..6bc1e1b 100644 --- a/Public/Set-LMCollector.ps1 +++ b/Public/Set-LMCollector.ps1 @@ -1,6 +1,6 @@ Function Set-LMCollector { - [CmdletBinding(DefaultParameterSetName = 'Id',SupportsShouldProcess,ConfirmImpact='None')] + [CmdletBinding(DefaultParameterSetName = 'Id', SupportsShouldProcess, ConfirmImpact = 'None')] Param ( [Parameter(Mandatory, ParameterSetName = 'Id', ValueFromPipelineByPropertyName)] @@ -54,13 +54,13 @@ Function Set-LMCollector { #Build header and uri $ResourcePath = "/setting/collector/collectors/$Id" - If($PSItem){ + If ($PSItem) { $Message = "Id: $Id | Name: $($PSItem.hostname) | Description: $($PSItem.description)" } - ElseIf($Name){ + Elseif ($Name) { $Message = "Id: $Id | Name: $Name)" } - Else{ + Else { $Message = "Id: $Id" } @@ -82,7 +82,7 @@ Function Set-LMCollector { #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json) diff --git a/Public/Set-LMCollectorConfig.ps1 b/Public/Set-LMCollectorConfig.ps1 index 1a5c9e1..c703de4 100644 --- a/Public/Set-LMCollectorConfig.ps1 +++ b/Public/Set-LMCollectorConfig.ps1 @@ -1,6 +1,6 @@ Function Set-LMCollectorConfig { - [CmdletBinding(SupportsShouldProcess,ConfirmImpact='None')] + [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'None')] Param ( [Parameter(ParameterSetName = 'Id-Conf', ValueFromPipelineByPropertyName)] @@ -13,7 +13,7 @@ Function Set-LMCollectorConfig { [Parameter(ParameterSetName = 'Id-Conf')] [Parameter(ParameterSetName = 'Name-Conf')] - [ValidateSet("nano","small", "medium", "large", "extra_large", "double_extra_large")] + [ValidateSet("nano", "small", "medium", "large", "extra_large", "double_extra_large")] [String]$CollectorSize, [Parameter(ParameterSetName = 'Id-Conf')] @@ -95,7 +95,7 @@ Function Set-LMCollectorConfig { Begin {} Process { Function Process-CollectorConfig { - Param( + Param ( $Config, $ConfLine, $Value @@ -104,16 +104,16 @@ Function Set-LMCollectorConfig { $Value = $Value.toString().toLower() $ConfigArray = $Config.Split([Environment]::NewLine) - [int[]]$Index = [Linq.Enumerable]::Range(0, $ConfigArray.Count).Where({ param($i) $ConfigArray[$i] -match $ConfLine }) - If(($Index | Measure-Object).Count -eq 1){ + [int[]]$Index = [Linq.Enumerable]::Range(0, $ConfigArray.Count).Where({ Param($i) $ConfigArray[$i] -match $ConfLine }) + If (($Index | Measure-Object).Count -eq 1) { Write-LMHost "[INFO]: Updating config parameter $ConfLine to value $Value." - $ConfigArray[$Index[0]]="$ConfLine=$Value" + $ConfigArray[$Index[0]] = "$ConfLine=$Value" } - Else{ - Write-LMHost "[WARN]: Multiple matches found for config parameter $ConfLine, skipping processing." -ForegroundColor Yellow + Else { + Write-LMHost "[WARN]: Multiple matches found for config parameter $ConfLine, skipping processing." -ForegroundColor Yellow } - Return ([string]::Join([Environment]::NewLine,$ConfigArray)) + Return ([string]::Join([Environment]::NewLine, $ConfigArray)) } If ($Script:LMAuth.Valid) { @@ -127,77 +127,77 @@ Function Set-LMCollectorConfig { $Id = $LookupResult } - If($PSCmdlet.ParameterSetName -like "*Snippet*"){ + If ($PSCmdlet.ParameterSetName -like "*Snippet*") { $CollectorConfData = (Get-LMCollector -Id $Id).collectorConf - If($CollectorConfData){ + If ($CollectorConfData) { $SnippetArray = [System.Collections.ArrayList]@() $cmdName = $MyInvocation.InvocationName $paramList = (Get-Command -Name $cmdName).Parameters - foreach ( $key in $paramList.Keys ) { + Foreach ( $key in $paramList.Keys ) { $value = (Get-Variable $key -ErrorAction SilentlyContinue).Value - if ( ($value -or $value -eq 0) -and ($key -ne "Id" -and $key -ne "Name" -and $key -ne "WaitForRestart") ) { - $SnippetArray.Add(@{$key = $value}) | Out-Null + If ( ($value -or $value -eq 0) -and ($key -ne "Id" -and $key -ne "Name" -and $key -ne "WaitForRestart") ) { + $SnippetArray.Add(@{$key = $value }) | Out-Null } } - Foreach ($Key in $SnippetArray.Keys){ - $CollectorConfData = Switch($Key){ - "SnmpThreadPool" { Process-CollectorConfig -Config $CollectorConfData -ConfLine "collector.snmp.threadpool" -Value $SnippetArray.$Key} - "SnmpPduTimeout" { Process-CollectorConfig -Config $CollectorConfData -ConfLine "snmp.pdu.timeout" -Value $SnippetArray.$Key} - "ScriptThreadPool" { Process-CollectorConfig -Config $CollectorConfData -ConfLine "collector.script.threadpool" -Value $SnippetArray.$Key} - "ScriptTimeout" { Process-CollectorConfig -Config $CollectorConfData -ConfLine "collector.script.timeout" -Value $SnippetArray.$Key} - "BatchScriptThreadPool" { Process-CollectorConfig -Config $CollectorConfData -ConfLine "collector.batchscript.threadpool" -Value $SnippetArray.$Key} - "BatchScriptTimeout" { Process-CollectorConfig -Config $CollectorConfData -ConfLine "collector.batchscript.timeout" -Value $SnippetArray.$Key} - "PowerShellSPSEProcessCountMin" { Process-CollectorConfig -Config $CollectorConfData -ConfLine "powershell.spse.process.count.min" -Value $SnippetArray.$Key} - "PowerShellSPSEProcessCountMax" { Process-CollectorConfig -Config $CollectorConfData -ConfLine "powershell.spse.process.count.max" -Value $SnippetArray.$Key} - "NetflowEnable" { Process-CollectorConfig -Config $CollectorConfData -ConfLine "netflow.enable" -Value $SnippetArray.$Key} - "NbarEnable" { Process-CollectorConfig -Config $CollectorConfData -ConfLine "netflow.nbar.enabled" -Value $SnippetArray.$Key} - "NetflowPorts" { Process-CollectorConfig -Config $CollectorConfData -ConfLine "netflow.ports" -Value $SnippetArray.$Key} - "SflowPorts" { Process-CollectorConfig -Config $CollectorConfData -ConfLine "netflow.sflow.ports" -Value $SnippetArray.$Key} - "LMLogsSyslogEnable" { Process-CollectorConfig -Config $CollectorConfData -ConfLine "lmlogs.syslog.enabled" -Value $SnippetArray.$Key} - "LMLogsSyslogHostnameFormat" { Process-CollectorConfig -Config $CollectorConfData -ConfLine "lmlogs.syslog.hostname.format" -Value $SnippetArray.$Key} - "LMLogsSyslogPropertyName" { Process-CollectorConfig -Config $CollectorConfData -ConfLine "lmlogs.syslog.property.name" -Value $SnippetArray.$Key} - default {$CollectorConfData} + Foreach ($Key in $SnippetArray.Keys) { + $CollectorConfData = Switch ($Key) { + "SnmpThreadPool" { Process-CollectorConfig -Config $CollectorConfData -ConfLine "collector.snmp.threadpool" -Value $SnippetArray.$Key } + "SnmpPduTimeout" { Process-CollectorConfig -Config $CollectorConfData -ConfLine "snmp.pdu.timeout" -Value $SnippetArray.$Key } + "ScriptThreadPool" { Process-CollectorConfig -Config $CollectorConfData -ConfLine "collector.script.threadpool" -Value $SnippetArray.$Key } + "ScriptTimeout" { Process-CollectorConfig -Config $CollectorConfData -ConfLine "collector.script.timeout" -Value $SnippetArray.$Key } + "BatchScriptThreadPool" { Process-CollectorConfig -Config $CollectorConfData -ConfLine "collector.batchscript.threadpool" -Value $SnippetArray.$Key } + "BatchScriptTimeout" { Process-CollectorConfig -Config $CollectorConfData -ConfLine "collector.batchscript.timeout" -Value $SnippetArray.$Key } + "PowerShellSPSEProcessCountMin" { Process-CollectorConfig -Config $CollectorConfData -ConfLine "powershell.spse.process.count.min" -Value $SnippetArray.$Key } + "PowerShellSPSEProcessCountMax" { Process-CollectorConfig -Config $CollectorConfData -ConfLine "powershell.spse.process.count.max" -Value $SnippetArray.$Key } + "NetflowEnable" { Process-CollectorConfig -Config $CollectorConfData -ConfLine "netflow.enable" -Value $SnippetArray.$Key } + "NbarEnable" { Process-CollectorConfig -Config $CollectorConfData -ConfLine "netflow.nbar.enabled" -Value $SnippetArray.$Key } + "NetflowPorts" { Process-CollectorConfig -Config $CollectorConfData -ConfLine "netflow.ports" -Value $SnippetArray.$Key } + "SflowPorts" { Process-CollectorConfig -Config $CollectorConfData -ConfLine "netflow.sflow.ports" -Value $SnippetArray.$Key } + "LMLogsSyslogEnable" { Process-CollectorConfig -Config $CollectorConfData -ConfLine "lmlogs.syslog.enabled" -Value $SnippetArray.$Key } + "LMLogsSyslogHostnameFormat" { Process-CollectorConfig -Config $CollectorConfData -ConfLine "lmlogs.syslog.hostname.format" -Value $SnippetArray.$Key } + "LMLogsSyslogPropertyName" { Process-CollectorConfig -Config $CollectorConfData -ConfLine "lmlogs.syslog.property.name" -Value $SnippetArray.$Key } + default { $CollectorConfData } } } } } - Else{ + Else { $CollectorConfData = $CollectorConf } #Build header and uri $ResourcePath = "/setting/collector/collectors/$Id/services/restart" - If($PSItem){ + If ($PSItem) { $Message = "Id: $Id | Name: $($PSItem.hostname) | Description: $($PSItem.description)" } - ElseIf($Name){ + Elseif ($Name) { $Message = "Id: $Id | Name: $Name)" } - Else{ + Else { $Message = "Id: $Id" } Try { $Data = @{ - collectorSize = $CollectorSize - collectorConf = $CollectorConfData - sbproxyConf = $SbproxyConf - watchdogConf = $WatchdogConf - websiteConf = $WebsiteConf - wrapperConf = $WrapperConf + collectorSize = $CollectorSize + collectorConf = $CollectorConfData + sbproxyConf = $SbproxyConf + watchdogConf = $WatchdogConf + websiteConf = $WebsiteConf + wrapperConf = $WrapperConf } #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json) If ($PSCmdlet.ShouldProcess($Message, "Set Collector Config ")) { - Write-LMHost "[WARN]: This command will restart the targeted collector on update of the configuration" -ForegroundColor Yellow + Write-LMHost "[WARN]: This command will restart the targeted collector on update of the configuration" -ForegroundColor Yellow $Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath -Data $Data $Uri = "https://$($Script:LMAuth.Portal).logicmonitor.com/santaba/rest" + $ResourcePath @@ -206,28 +206,28 @@ Function Set-LMCollectorConfig { #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data - If($WaitForRestart){ + If ($WaitForRestart) { $JobStarted = $false $Tries = 0 - While(!$JobStarted -or $Tries -eq 5){ + While (!$JobStarted -or $Tries -eq 5) { #Build header and uri $ResourcePath = "/setting/collector/collectors/$Id/services/restart/$Response" $Headers = New-LMHeader -Auth $Script:LMAuth -Method "GET" -ResourcePath $ResourcePath $Uri = "https://$($Script:LMAuth.Portal).logicmonitor.com/santaba/rest" + $ResourcePath $SubmitResponse = Invoke-RestMethod -Uri $Uri -Method "GET" -Headers $Headers[0] -WebSession $Headers[1] - If($SubmitResponse.errorMessage -eq "The task is still running"){ + If ($SubmitResponse.errorMessage -eq "The task is still running") { Write-LMHost "[INFO]: The task is still running..." Start-Sleep -Seconds 2 $Tries++ } - Else{ + Else { $JobStarted = $true } } Return "Job status code: $($SubmitResponse.jobStatus), Job message: $($SubmitResponse.jobErrmsg)" } - Else{ + Else { Return "Successfully submitted restart request(jobID:$Response) with updated configurations. Collector will restart once the request has been picked up." } } diff --git a/Public/Set-LMCollectorGroup.ps1 b/Public/Set-LMCollectorGroup.ps1 index 146a4c4..1697b44 100644 --- a/Public/Set-LMCollectorGroup.ps1 +++ b/Public/Set-LMCollectorGroup.ps1 @@ -1,6 +1,6 @@ Function Set-LMCollectorGroup { - [CmdletBinding(SupportsShouldProcess,ConfirmImpact='None')] + [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'None')] Param ( [Parameter(ParameterSetName = 'Id', ValueFromPipelineByPropertyName)] @@ -44,29 +44,29 @@ Function Set-LMCollectorGroup { #Build header and uri $ResourcePath = "/setting/collector/groups/$Id" - If($PSItem){ + If ($PSItem) { $Message = "Id: $Id | Name: $($PSItem.name) | Description: $($PSItem.description)" } - ElseIf($Name){ + Elseif ($Name) { $Message = "Id: $Id | Name: $Name)" } - Else{ + Else { $Message = "Id: $Id" } Try { $Data = @{ - description = $Description - name = $NewName - collectorGroupId = $CollectorGroupId - customProperties = $customProperties - autoBalance = $AutoBalance - autoBalanceInstanceCountThreshold = $AutoBalanceInstanceCountThreshold + description = $Description + name = $NewName + collectorGroupId = $CollectorGroupId + customProperties = $customProperties + autoBalance = $AutoBalance + autoBalanceInstanceCountThreshold = $AutoBalanceInstanceCountThreshold } #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json) diff --git a/Public/Set-LMConfigsource.ps1 b/Public/Set-LMConfigsource.ps1 index 0c16291..509c352 100644 --- a/Public/Set-LMConfigsource.ps1 +++ b/Public/Set-LMConfigsource.ps1 @@ -1,6 +1,6 @@ Function Set-LMConfigsource { - [CmdletBinding(SupportsShouldProcess,ConfirmImpact='None')] + [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'None')] Param ( [Parameter(Mandatory, ParameterSetName = 'Id', ValueFromPipelineByPropertyName)] [String]$Id, @@ -18,7 +18,7 @@ Function Set-LMConfigsource { [String]$TechNotes, - [ValidateSet("3600","14400","28800","86400")] + [ValidateSet("3600", "14400", "28800", "86400")] [String]$PollingIntervalInSeconds, #In Seconds [PSCustomObject]$ConfigChecks #Should be the full datapoints object from the output of Get-LMDatasource @@ -41,29 +41,29 @@ Function Set-LMConfigsource { #Build header and uri $ResourcePath = "/setting/configsources/$Id" - If($PSItem){ + If ($PSItem) { $Message = "Id: $Id | Name: $($PSItem.name) | DisplayName: $($PSItem.displayName)" } - ElseIf($Name){ + Elseif ($Name) { $Message = "Id: $Id | Name: $Name" } - Else{ + Else { $Message = "Id: $Id" } Try { $Data = @{ - name = $NewName - displayName = $DisplayName - description = $Description - appliesTo = $appliesTo - technology = $TechNotes - collectInterval = $PollingIntervalInSeconds - configChecks = $ConfigChecks + name = $NewName + displayName = $DisplayName + description = $Description + appliesTo = $appliesTo + technology = $TechNotes + collectInterval = $PollingIntervalInSeconds + configChecks = $ConfigChecks } #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json) diff --git a/Public/Set-LMDatasource.ps1 b/Public/Set-LMDatasource.ps1 index 6ff87ce..1066a2b 100644 --- a/Public/Set-LMDatasource.ps1 +++ b/Public/Set-LMDatasource.ps1 @@ -1,6 +1,6 @@ Function Set-LMDatasource { - [CmdletBinding(SupportsShouldProcess,ConfirmImpact='None')] + [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'None')] Param ( [Parameter(Mandatory, ParameterSetName = 'Id', ValueFromPipelineByPropertyName)] [String]$Id, @@ -40,29 +40,29 @@ Function Set-LMDatasource { #Build header and uri $ResourcePath = "/setting/datasources/$Id" - If($PSItem){ + If ($PSItem) { $Message = "Id: $Id | Name: $($PSItem.name) | DisplayName: $($PSItem.displayName)" } - ElseIf($Name){ + Elseif ($Name) { $Message = "Id: $Id | Name: $Name" } - Else{ + Else { $Message = "Id: $Id" } Try { $Data = @{ - name = $NewName - displayName = $DisplayName - description = $Description - appliesTo = $appliesTo - technology = $TechNotes - collectInterval = $PollingIntervalInSeconds - dataPoints = $Datapoints + name = $NewName + displayName = $DisplayName + description = $Description + appliesTo = $appliesTo + technology = $TechNotes + collectInterval = $PollingIntervalInSeconds + dataPoints = $Datapoints } #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json) diff --git a/Public/Set-LMDevice.ps1 b/Public/Set-LMDevice.ps1 index 1753c98..ba01e8b 100644 --- a/Public/Set-LMDevice.ps1 +++ b/Public/Set-LMDevice.ps1 @@ -1,6 +1,6 @@ Function Set-LMDevice { - [CmdletBinding(SupportsShouldProcess,ConfirmImpact='None')] + [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'None')] Param ( [Parameter(Mandatory, ParameterSetName = 'Id', ValueFromPipelineByPropertyName)] [String]$Id, @@ -66,13 +66,13 @@ Function Set-LMDevice { #Build header and uri $ResourcePath = "/device/devices/$Id" - If($PSItem){ + If ($PSItem) { $Message = "Id: $Id | Name: $($PSItem.name) | DisplayName: $($PSItem.displayName)" } - ElseIf($Name){ + Elseif ($Name) { $Message = "Id: $Id | Name: $Name" } - Else{ + Else { $Message = "Id: $Id" } @@ -97,7 +97,7 @@ Function Set-LMDevice { #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json) diff --git a/Public/Set-LMDeviceDatasourceInstance.ps1 b/Public/Set-LMDeviceDatasourceInstance.ps1 index 03dd662..ca858e5 100644 --- a/Public/Set-LMDeviceDatasourceInstance.ps1 +++ b/Public/Set-LMDeviceDatasourceInstance.ps1 @@ -1,6 +1,64 @@ +<# +.SYNOPSIS +Sets the properties of a LogicMonitor device datasource instance. + +.DESCRIPTION +The Set-LMDeviceDatasourceInstance function is used to set the properties of a LogicMonitor device datasource instance. It allows you to update the display name, wild values, description, custom properties, monitoring and alerting settings, and instance group ID of the specified instance. + +.PARAMETER DisplayName +Specifies the new display name for the instance. + +.PARAMETER WildValue +Specifies the first wild value for the instance. + +.PARAMETER WildValue2 +Specifies the second wild value for the instance. + +.PARAMETER Description +Specifies the description for the instance. + +.PARAMETER Properties +Specifies a hashtable of custom properties for the instance. + +.PARAMETER StopMonitoring +Specifies whether to stop monitoring the instance. This parameter accepts $true or $false. + +.PARAMETER DisableAlerting +Specifies whether to disable alerting for the instance. This parameter accepts $true or $false. + +.PARAMETER InstanceGroupId +Specifies the ID of the instance group to which the instance belongs. + +.PARAMETER InstanceId +Specifies the ID of the instance to update. This parameter is mandatory and can be provided via pipeline. + +.PARAMETER DatasourceName +Specifies the name of the datasource associated with the instance. This parameter is mandatory when using the 'Name-dsName' parameter set. + +.PARAMETER DatasourceId +Specifies the ID of the datasource associated with the instance. This parameter is mandatory when using the 'Id-dsId' or 'Name-dsId' parameter set. + +.PARAMETER Id +Specifies the ID of the device associated with the instance. This parameter is mandatory when using the 'Id-dsId' or 'Id-dsName' parameter set. This parameter can also be specified using the 'DeviceId' alias. + +.PARAMETER Name +Specifies the name of the device associated with the instance. This parameter is mandatory when using the 'Name-dsName' or 'Name-dsId' parameter set. This parameter can also be specified using the 'DeviceName' alias. + +.EXAMPLE +Set-LMDeviceDatasourceInstance -InstanceId 12345 -DisplayName "New Instance Name" -Description "Updated instance description" + +This example sets the display name and description of the instance with ID 12345. + +.EXAMPLE +Get-LMDevice -Name "MyDevice" | Set-LMDeviceDatasourceInstance -DatasourceName "MyDatasource" -DisplayName "New Instance Name" + +This example retrieves the device with the name "MyDevice" and sets the display name of the instance associated with the datasource "MyDatasource". + +#> + Function Set-LMDeviceDatasourceInstance { - [CmdletBinding(SupportsShouldProcess,ConfirmImpact='None')] + [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'None')] Param ( [String]$DisplayName, @@ -19,7 +77,6 @@ Function Set-LMDeviceDatasourceInstance { [String]$InstanceGroupId, [Parameter(Mandatory, ValueFromPipelineByPropertyName)] - [Alias("Id")] [String]$InstanceId, [Parameter(Mandatory, ParameterSetName = 'Id-dsName')] @@ -32,31 +89,33 @@ Function Set-LMDeviceDatasourceInstance { [Parameter(Mandatory, ParameterSetName = 'Id-dsId', ValueFromPipelineByPropertyName)] [Parameter(Mandatory, ParameterSetName = 'Id-dsName')] - [String]$DeviceId, + [Alias('DeviceId')] + [String]$Id, [Parameter(Mandatory, ParameterSetName = 'Name-dsName')] [Parameter(Mandatory, ParameterSetName = 'Name-dsId')] - [String]$DeviceName + [Alias('DeviceName')] + [String]$Name ) - Begin{} - Process{ + Begin {} + Process { #Check if we are logged in and have valid api creds If ($Script:LMAuth.Valid) { #Lookup Device Id - If ($DeviceName) { - $LookupResult = (Get-LMDevice -Name $DeviceName).Id - If (Test-LookupResult -Result $LookupResult -LookupString $DeviceName) { + If ($Name) { + $LookupResult = (Get-LMDevice -Name $Name).Id + If (Test-LookupResult -Result $LookupResult -LookupString $Name) { return } - $DeviceId = $LookupResult + $Id = $LookupResult } #Lookup DatasourceId If ($DatasourceName -or $DatasourceId) { - $LookupResult = (Get-LMDeviceDataSourceList -Id $DeviceId | Where-Object { $_.dataSourceName -eq $DatasourceName -or $_.dataSourceId -eq $DatasourceId }).Id + $LookupResult = (Get-LMDeviceDataSourceList -Id $Id | Where-Object { $_.dataSourceName -eq $DatasourceName -or $_.dataSourceId -eq $DatasourceId }).Id If (Test-LookupResult -Result $LookupResult -LookupString $DatasourceName) { return } @@ -72,16 +131,16 @@ Function Set-LMDeviceDatasourceInstance { } #Build header and uri - $ResourcePath = "/device/devices/$DeviceId/devicedatasources/$HdsId/instances/$instanceId" + $ResourcePath = "/device/devices/$Id/devicedatasources/$HdsId/instances/$instanceId" - If($PSItem){ + If ($PSItem) { $Message = "deviceDisplayName: $($PSItem.deviceDisplayName) | instanceId: $($PSItem.id) | instanceName: $($PSItem.name)" } - ElseIf($DeviceName){ - $Message = "deviceDisplayName: $DeviceName | instanceId: $InstanceId" + Elseif ($Name) { + $Message = "deviceDisplayName: $Name | instanceId: $InstanceId" } - Else{ - $Message = "instanceId: $InstanceId | deviceId: $DeviceId" + Else { + $Message = "instanceId: $InstanceId | Id: $Id" } Try { @@ -97,7 +156,7 @@ Function Set-LMDeviceDatasourceInstance { } #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json) @@ -124,5 +183,5 @@ Function Set-LMDeviceDatasourceInstance { Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." } } - End{} + End {} } diff --git a/Public/Set-LMDeviceDatasourceInstanceAlertSetting.ps1 b/Public/Set-LMDeviceDatasourceInstanceAlertSetting.ps1 index dd5431f..72639f3 100644 --- a/Public/Set-LMDeviceDatasourceInstanceAlertSetting.ps1 +++ b/Public/Set-LMDeviceDatasourceInstanceAlertSetting.ps1 @@ -1,6 +1,6 @@ Function Set-LMDeviceDatasourceInstanceAlertSetting { - [CmdletBinding(SupportsShouldProcess,ConfirmImpact='None')] + [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'None')] Param ( [Parameter(Mandatory, ParameterSetName = 'Id-dsName')] [Parameter(Mandatory, ParameterSetName = 'Name-dsName')] @@ -47,8 +47,8 @@ Function Set-LMDeviceDatasourceInstanceAlertSetting { [Int]$AlertForNoData ) - Begin{} - Process{ + Begin {} + Process { #Check if we are logged in and have valid api creds If ($Script:LMAuth.Valid) { @@ -70,16 +70,19 @@ Function Set-LMDeviceDatasourceInstanceAlertSetting { $HdsId = $LookupResult } + #Replace brakets in instance name + $InstanceName = $InstanceName -replace "[\[\]]", "?" + #Lookup HdsiId If ($DatasourceName) { - $LookupResult = (Get-LMDeviceDatasourceInstance -DatasourceName $DatasourceName -DeviceId $Id | Where-Object { $_.name -like "*$InstanceName"}).Id + $LookupResult = (Get-LMDeviceDatasourceInstance -DatasourceName $DatasourceName -DeviceId $Id | Where-Object { $_.name -like "*$InstanceName" }).Id If (Test-LookupResult -Result $LookupResult -LookupString $InstanceName) { return } $HdsiId = $LookupResult } - Else{ - $LookupResult = (Get-LMDeviceDatasourceInstance -DatasourceId $DatasourceId -DeviceId $Id | Where-Object { $_.name -like "*$InstanceName"}).Id + Else { + $LookupResult = (Get-LMDeviceDatasourceInstance -DatasourceId $DatasourceId -DeviceId $Id | Where-Object { $_.name -like "*$InstanceName" }).Id If (Test-LookupResult -Result $LookupResult -LookupString $InstanceName) { return } @@ -88,14 +91,14 @@ Function Set-LMDeviceDatasourceInstanceAlertSetting { #Lookup HdsiId If ($DatapointName) { - $LookupResult = (Get-LMDeviceDatasourceInstanceAlertSetting -DatasourceName $DatasourceName -Id $Id -InstanceName $InstanceName | Where-Object { $_.dataPointName -eq $DatapointName}).Id + $LookupResult = (Get-LMDeviceDatasourceInstanceAlertSetting -DatasourceName $DatasourceName -Id $Id -InstanceName $InstanceName | Where-Object { $_.dataPointName -eq $DatapointName }).Id If (Test-LookupResult -Result $LookupResult -LookupString $InstanceName) { return } $DatapointId = $LookupResult } - Else{ - $LookupResult = (Get-LMDeviceDatasourceInstance -DatasourceId $DatasourceId -Id $Id -InstanceName $InstanceName | Where-Object { $_.dataPointName -eq $DatapointName}).Id + Else { + $LookupResult = (Get-LMDeviceDatasourceInstance -DatasourceId $DatasourceId -Id $Id -InstanceName $InstanceName | Where-Object { $_.dataPointName -eq $DatapointName }).Id If (Test-LookupResult -Result $LookupResult -LookupString $InstanceName) { return } @@ -109,17 +112,17 @@ Function Set-LMDeviceDatasourceInstanceAlertSetting { Try { $Data = @{ - disableAlerting = $DisableAlerting - alertExprNote = $AlertExpressionNote - alertExpr = $AlertExpression - alertClearTransitionInterval = $AlertClearTransitionInterval - alertClearInterval = $AlertClearTransitionInterval - alertTransitionInterval = $AlertTransitionInterval - alertForNoData = $AlertForNoData + disableAlerting = $DisableAlerting + alertExprNote = $AlertExpressionNote + alertExpr = $AlertExpression + alertClearTransitionInterval = $AlertClearTransitionInterval + alertClearInterval = $AlertClearTransitionInterval + alertTransitionInterval = $AlertTransitionInterval + alertForNoData = $AlertForNoData } #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_]) -and $_ -ne "alertExpr" -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_]) -and $_ -ne "alertExpr" -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json) If ($PSCmdlet.ShouldProcess($Message, "Set Device Datasource Instance Alert Setting")) { @@ -145,5 +148,5 @@ Function Set-LMDeviceDatasourceInstanceAlertSetting { Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." } } - End{} + End {} } diff --git a/Public/Set-LMDeviceGroup.ps1 b/Public/Set-LMDeviceGroup.ps1 index 50003d2..5d7ddcb 100644 --- a/Public/Set-LMDeviceGroup.ps1 +++ b/Public/Set-LMDeviceGroup.ps1 @@ -1,6 +1,6 @@ Function Set-LMDeviceGroup { - [CmdletBinding(DefaultParameterSetName = "Id-ParentGroupId",SupportsShouldProcess,ConfirmImpact='None')] + [CmdletBinding(DefaultParameterSetName = "Id-ParentGroupId", SupportsShouldProcess, ConfirmImpact = 'None')] Param ( [Parameter(Mandatory, ParameterSetName = 'Id-ParentGroupId', ValueFromPipelineByPropertyName)] [Parameter(Mandatory, ParameterSetName = 'Id-ParentGroupName')] @@ -67,13 +67,13 @@ Function Set-LMDeviceGroup { #Build header and uri $ResourcePath = "/device/groups/$Id" - If($PSItem){ + If ($PSItem) { $Message = "Id: $Id | Name: $($PSItem.name) | Path: $($PSItem.fullPath)" } - ElseIf($Name){ + Elseif ($Name) { $Message = "Id: $Id | Name: $Name)" } - Else{ + Else { $Message = "Id: $Id" } @@ -89,7 +89,7 @@ Function Set-LMDeviceGroup { } #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json) diff --git a/Public/Set-LMDeviceGroupDatasourceAlertSetting.ps1 b/Public/Set-LMDeviceGroupDatasourceAlertSetting.ps1 index f6ee721..d9fb038 100644 --- a/Public/Set-LMDeviceGroupDatasourceAlertSetting.ps1 +++ b/Public/Set-LMDeviceGroupDatasourceAlertSetting.ps1 @@ -43,8 +43,8 @@ Function Set-LMDeviceGroupDatasourceAlertSetting { ) - Begin{} - Process{ + Begin {} + Process { #Check if we are logged in and have valid api creds If ($Script:LMAuth.Valid) { @@ -68,7 +68,7 @@ Function Set-LMDeviceGroupDatasourceAlertSetting { #Lookup DatapointId If ($DatapointName) { - $LookupResult = (Get-LMDeviceGroupDatasourceAlertSetting -Id $Id -DatasourceId $DatasourceId | Where-Object {$_.dataPointName -eq $DatapointName}).dataPointId + $LookupResult = (Get-LMDeviceGroupDatasourceAlertSetting -Id $Id -DatasourceId $DatasourceId | Where-Object { $_.dataPointName -eq $DatapointName }).dataPointId If (Test-LookupResult -Result $LookupResult -LookupString $DatapointName) { return } @@ -80,19 +80,19 @@ Function Set-LMDeviceGroupDatasourceAlertSetting { Try { $dpConfig = @{ - disableAlerting = $DisableAlerting - dataPointId = $DatapointId - dataPointName = $DatapointName - alertExprNote = $AlertExpressionNote - alertExpr = $AlertExpression - alertClearTransitionInterval = $AlertClearTransitionInterval - alertTransitionInterval = $AlertTransitionInterval - alertForNoData = $AlertForNoData + disableAlerting = $DisableAlerting + dataPointId = $DatapointId + dataPointName = $DatapointName + alertExprNote = $AlertExpressionNote + alertExpr = $AlertExpression + alertClearTransitionInterval = $AlertClearTransitionInterval + alertTransitionInterval = $AlertTransitionInterval + alertForNoData = $AlertForNoData } #Remove empty keys so we dont overwrite them - @($dpConfig.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($dpConfig[$_]) -and $_ -ne "alertExpr" -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $dpConfig.Remove($_) } } + @($dpConfig.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($dpConfig[$_]) -and $_ -ne "alertExpr" -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $dpConfig.Remove($_) } } $Data = @{ dpConfig = @($dpConfig) @@ -120,5 +120,5 @@ Function Set-LMDeviceGroupDatasourceAlertSetting { Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." } } - End{} + End {} } diff --git a/Public/Set-LMDeviceProperty.ps1 b/Public/Set-LMDeviceProperty.ps1 index 0fc5035..6d94c9f 100644 --- a/Public/Set-LMDeviceProperty.ps1 +++ b/Public/Set-LMDeviceProperty.ps1 @@ -15,8 +15,8 @@ Function Set-LMDeviceProperty { [String]$PropertyValue ) - Begin{} - Process{ + Begin {} + Process { #Check if we are logged in and have valid api creds If ($Script:LMAuth.Valid) { @@ -59,5 +59,5 @@ Function Set-LMDeviceProperty { Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." } } - End{} + End {} } diff --git a/Public/Set-LMNetScan.ps1 b/Public/Set-LMNetScan.ps1 index 434d9c4..e15daef 100644 --- a/Public/Set-LMNetScan.ps1 +++ b/Public/Set-LMNetScan.ps1 @@ -109,7 +109,7 @@ Function Set-LMNetscan { #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json) $Headers = New-LMHeader -Auth $Script:LMAuth -Method "PATCH" -ResourcePath $ResourcePath -Data $Data diff --git a/Public/Set-LMNetscanGroup.ps1 b/Public/Set-LMNetscanGroup.ps1 index 06eb514..2257956 100644 --- a/Public/Set-LMNetscanGroup.ps1 +++ b/Public/Set-LMNetscanGroup.ps1 @@ -33,13 +33,13 @@ Function Set-LMNetscanGroup { Try { $Data = @{ - description = $Description - name = $NewName + description = $Description + name = $NewName } #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json) diff --git a/Public/Set-LMNewUserMessage.ps1 b/Public/Set-LMNewUserMessage.ps1 index 89da343..478bc6a 100644 --- a/Public/Set-LMNewUserMessage.ps1 +++ b/Public/Set-LMNewUserMessage.ps1 @@ -20,12 +20,12 @@ Function Set-LMNewUserMessage { Try { $Data = @{ - messageBody = $MessageBody - messageSubject = $MessageSubject + messageBody = $MessageBody + messageSubject = $MessageSubject } #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json) diff --git a/Public/Set-LMOpsNote.ps1 b/Public/Set-LMOpsNote.ps1 index 4031a2f..d29f8c2 100644 --- a/Public/Set-LMOpsNote.ps1 +++ b/Public/Set-LMOpsNote.ps1 @@ -20,43 +20,43 @@ Function Set-LMOpsNote { [String[]]$DeviceIds ) - Begin{} - Process{ + Begin {} + Process { #Check if we are logged in and have valid api creds If ($Script:LMAuth.Valid) { - If($NoteDate){ + If ($NoteDate) { $Epoch = Get-Date -Date "01/01/1970" [int64]$NoteDate = (New-TimeSpan -Start $Epoch -End $NoteDate.ToUniversalTime()).TotalSeconds } $Scope = @() - If($ResourceIds -or $WebsiteIds -or $DeviceGroupIds){ - Foreach($deviceId in $DeviceIds){ + If ($ResourceIds -or $WebsiteIds -or $DeviceGroupIds) { + Foreach ($deviceId in $DeviceIds) { $Scope += [PSCustomObject]@{ - type = "device" - groupId = "0" + type = "device" + groupId = "0" deviceId = $deviceId } } - Foreach($websiteId in $WebsiteIds){ + Foreach ($websiteId in $WebsiteIds) { $Scope += [PSCustomObject]@{ - type = "website" - groupId = "0" + type = "website" + groupId = "0" websiteId = $websiteId } } - Foreach($groupId in $DeviceGroupIds){ + Foreach ($groupId in $DeviceGroupIds) { $Scope += @{ - type = "deviceGroup" + type = "deviceGroup" groupId = $groupId } } } $TagList = @() - Foreach($tag in $Tags){ - $TagList += @{name = $tag} + Foreach ($tag in $Tags) { + $TagList += @{name = $tag } } @@ -72,9 +72,9 @@ Function Set-LMOpsNote { } #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } - If($ClearTags){ + If ($ClearTags) { $Data.tags = @() } @@ -101,5 +101,5 @@ Function Set-LMOpsNote { Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." } } - End{} + End {} } diff --git a/Public/Set-LMPortalInfo.ps1 b/Public/Set-LMPortalInfo.ps1 index 395dce4..3a1dcaf 100644 --- a/Public/Set-LMPortalInfo.ps1 +++ b/Public/Set-LMPortalInfo.ps1 @@ -16,13 +16,13 @@ Function Set-LMPortalInfo { [String]$CompanyDisplayName, - [ValidateSet(30,60,120,240,480,1440,10080,43200)] + [ValidateSet(30, 60, 120, 240, 480, 1440, 10080, 43200)] [Nullable[Int]]$UserSessionTimeoutInMin ) - Begin{} - Process{ + Begin {} + Process { #Check if we are logged in and have valid api creds If ($Script:LMAuth.Valid) { @@ -30,19 +30,19 @@ Function Set-LMPortalInfo { $ResourcePath = "/setting/companySetting" $Data = @{ - whiteList = $Whitelist - sessionTimeoutInSeconds = $UserSessionTimeoutInMin * 60 - requireTwoFA = $RequireTwoFA - alertTotalIncludeInAck = $IncludeACKinAlertTotals - alertTotalIncludeInSdt = $IncludeSDTinAlertTotals - companyDisplayName = $CompanyDisplayName - enableRemoteSession = $EnableRemoteSession + whiteList = $Whitelist + sessionTimeoutInSeconds = $UserSessionTimeoutInMin * 60 + requireTwoFA = $RequireTwoFA + alertTotalIncludeInAck = $IncludeACKinAlertTotals + alertTotalIncludeInSdt = $IncludeSDTinAlertTotals + companyDisplayName = $CompanyDisplayName + enableRemoteSession = $EnableRemoteSession } #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } - If($ClearWhitelist){ + If ($ClearWhitelist) { $Data.whitelist = "" } @@ -70,5 +70,5 @@ Function Set-LMPortalInfo { Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." } } - End{} + End {} } diff --git a/Public/Set-LMPropertysource.ps1 b/Public/Set-LMPropertysource.ps1 index 8dcc031..a6aaaaf 100644 --- a/Public/Set-LMPropertysource.ps1 +++ b/Public/Set-LMPropertysource.ps1 @@ -43,17 +43,17 @@ Function Set-LMPropertysource { Try { $Data = @{ - name = $NewName - description = $Description - appliesTo = $appliesTo - technology = $TechNotes - group = $Group - groovyScript = $Script - scriptType = $ScriptType + name = $NewName + description = $Description + appliesTo = $appliesTo + technology = $TechNotes + group = $Group + groovyScript = $Script + scriptType = $ScriptType } #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json) diff --git a/Public/Set-LMPushModuleDeviceProperty.ps1 b/Public/Set-LMPushModuleDeviceProperty.ps1 index c8ab07e..047a838 100644 --- a/Public/Set-LMPushModuleDeviceProperty.ps1 +++ b/Public/Set-LMPushModuleDeviceProperty.ps1 @@ -15,8 +15,8 @@ Function Set-LMPushModuleDeviceProperty { [String]$PropertyValue ) - Begin{} - Process{ + Begin {} + Process { #Check if we are logged in and have valid api creds If ($Script:LMAuth.Valid) { @@ -33,8 +33,8 @@ Function Set-LMPushModuleDeviceProperty { Try { $Data = @{ - resourceIds = @{"system.deviceid"=$Id} - resourceProperties = @{$PropertyName=$PropertyValue} + resourceIds = @{"system.deviceid" = $Id } + resourceProperties = @{$PropertyName = $PropertyValue } } $Data = ($Data | ConvertTo-Json) @@ -60,5 +60,5 @@ Function Set-LMPushModuleDeviceProperty { Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." } } - End{} + End {} } diff --git a/Public/Set-LMPushModuleInstanceProperty.ps1 b/Public/Set-LMPushModuleInstanceProperty.ps1 index 13580c1..29a45c4 100644 --- a/Public/Set-LMPushModuleInstanceProperty.ps1 +++ b/Public/Set-LMPushModuleInstanceProperty.ps1 @@ -21,8 +21,8 @@ Function Set-LMPushModuleInstanceProperty { [String]$PropertyValue ) - Begin{} - Process{ + Begin {} + Process { #Check if we are logged in and have valid api creds If ($Script:LMAuth.Valid) { @@ -39,10 +39,10 @@ Function Set-LMPushModuleInstanceProperty { Try { $Data = @{ - resourceIds = @{"system.deviceid"=$DeviceId} - instanceName = $InstanceName - dataSource = $DataSourceName - instanceProperties = @{$PropertyName=$PropertyValue} + resourceIds = @{"system.deviceid" = $DeviceId } + instanceName = $InstanceName + dataSource = $DataSourceName + instanceProperties = @{$PropertyName = $PropertyValue } } $Data = ($Data | ConvertTo-Json) @@ -68,5 +68,5 @@ Function Set-LMPushModuleInstanceProperty { Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." } } - End{} + End {} } diff --git a/Public/Set-LMReportGroup.ps1 b/Public/Set-LMReportGroup.ps1 index bbf44e9..10337df 100644 --- a/Public/Set-LMReportGroup.ps1 +++ b/Public/Set-LMReportGroup.ps1 @@ -32,13 +32,13 @@ Function Set-LMReportGroup { Try { $Data = @{ - description = $Description - name = $NewName + description = $Description + name = $NewName } #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json) diff --git a/Public/Set-LMRole.ps1 b/Public/Set-LMRole.ps1 index 938a480..87db6aa 100644 --- a/Public/Set-LMRole.ps1 +++ b/Public/Set-LMRole.ps1 @@ -2,12 +2,12 @@ Function Set-LMRole { [CmdletBinding(DefaultParameterSetName = 'Default')] Param ( - [Parameter(Mandatory,ParameterSetName = 'Id-Custom', ValueFromPipelineByPropertyName)] - [Parameter(Mandatory,ParameterSetName = 'Id-Default', ValueFromPipelineByPropertyName)] + [Parameter(Mandatory, ParameterSetName = 'Id-Custom', ValueFromPipelineByPropertyName)] + [Parameter(Mandatory, ParameterSetName = 'Id-Default', ValueFromPipelineByPropertyName)] [String]$Id, - [Parameter(Mandatory,ParameterSetName = 'Name-Custom')] - [Parameter(Mandatory,ParameterSetName = 'Name-Default')] + [Parameter(Mandatory, ParameterSetName = 'Name-Custom')] + [Parameter(Mandatory, ParameterSetName = 'Name-Default')] [String]$Name, [Parameter(ParameterSetName = 'Id-Custom')] @@ -54,47 +54,47 @@ Function Set-LMRole { [Parameter(ParameterSetName = 'Name-Default')] [Parameter(ParameterSetName = 'Id-Default')] - [ValidateSet("view", "manage","none")] + [ValidateSet("view", "manage", "none")] [String]$DashboardsPermission = "none", [Parameter(ParameterSetName = 'Name-Default')] [Parameter(ParameterSetName = 'Id-Default')] - [ValidateSet("view", "manage","none")] + [ValidateSet("view", "manage", "none")] [String]$ResourcePermission = "none", [Parameter(ParameterSetName = 'Name-Default')] [Parameter(ParameterSetName = 'Id-Default')] - [ValidateSet("view","manage","commit","publish","none")] + [ValidateSet("view", "manage", "commit", "publish", "none")] [String]$LMXToolBoxPermission = "none", [Parameter(ParameterSetName = 'Name-Default')] [Parameter(ParameterSetName = 'Id-Default')] - [ValidateSet("view","install","none")] + [ValidateSet("view", "install", "none")] [String]$LMXPermission = "none", [Parameter(ParameterSetName = 'Name-Default')] [Parameter(ParameterSetName = 'Id-Default')] - [ValidateSet("view", "manage","none")] + [ValidateSet("view", "manage", "none")] [String]$LogsPermission = "none", [Parameter(ParameterSetName = 'Name-Default')] [Parameter(ParameterSetName = 'Id-Default')] - [ValidateSet("view", "manage","none")] + [ValidateSet("view", "manage", "none")] [String]$WebsitesPermission = "none", [Parameter(ParameterSetName = 'Name-Default')] [Parameter(ParameterSetName = 'Id-Default')] - [ValidateSet("view", "manage","none")] + [ValidateSet("view", "manage", "none")] [String]$SavedMapsPermission = "none", [Parameter(ParameterSetName = 'Name-Default')] [Parameter(ParameterSetName = 'Id-Default')] - [ValidateSet("view", "manage","none")] + [ValidateSet("view", "manage", "none")] [String]$ReportsPermission = "none", [Parameter(ParameterSetName = 'Name-Default')] [Parameter(ParameterSetName = 'Id-Default')] - [ValidateSet("view", "manage","none","manage-collectors","view-collectors")] + [ValidateSet("view", "manage", "none", "manage-collectors", "view-collectors")] [String]$SettingsPermission = "none", [Parameter(ParameterSetName = 'Name-Default')] @@ -129,8 +129,8 @@ Function Set-LMRole { [Parameter(ParameterSetName = 'Id-Default')] [Switch]$EnableRemoteSessionForResources, - [Parameter(Mandatory,ParameterSetName = 'Name-Custom')] - [Parameter(Mandatory,ParameterSetName = 'Id-Custom')] + [Parameter(Mandatory, ParameterSetName = 'Name-Custom')] + [Parameter(Mandatory, ParameterSetName = 'Id-Custom')] [PSCustomObject]$CustomPrivilegesObject ) @@ -150,197 +150,197 @@ Function Set-LMRole { $ResourcePath = "/setting/roles/$Id" $Privileges = @() - If(!$CustomPrivilegesObject){ + If (!$CustomPrivilegesObject) { - If($ViewTraces){ + If ($ViewTraces) { $Privileges += [PSCustomObject]@{ - objectId = "*" - objectName = "*" - objectType = "tracesManageTab" - operation = "read" + objectId = "*" + objectName = "*" + objectType = "tracesManageTab" + operation = "read" subOperation = "" } } - If($EnableRemoteSessionForResources){ + If ($EnableRemoteSessionForResources) { $Privileges += [PSCustomObject]@{ - objectId = "*" - objectName = "*" - objectType = "remoteSession" - operation = "write" + objectId = "*" + objectName = "*" + objectType = "remoteSession" + operation = "write" subOperation = "" } } - If($AllowedToViewMapsTab){ + If ($AllowedToViewMapsTab) { $Privileges += [PSCustomObject]@{ - objectId = "*" - objectName = "*" - objectType = "resourceMapTab" - operation = "read" + objectId = "*" + objectName = "*" + objectType = "resourceMapTab" + operation = "read" subOperation = "" } } - If($AllowWidgetSharing){ + If ($AllowWidgetSharing) { $Privileges += [PSCustomObject]@{ - objectId = "sharingwidget" - objectName = "sharingwidget" - objectType = "dashboard_group" - operation = "write" + objectId = "sharingwidget" + objectName = "sharingwidget" + objectType = "dashboard_group" + operation = "write" subOperation = "" } } - If($CreatePrivateDashboards){ + If ($CreatePrivateDashboards) { $Privileges += [PSCustomObject]@{ - objectId = "private" - objectName = "private" - objectType = "dashboard_group" - operation = "write" + objectId = "private" + objectName = "private" + objectType = "dashboard_group" + operation = "write" subOperation = "" } } - If($LMXToolBoxPermission){ + If ($LMXToolBoxPermission) { $Privileges += [PSCustomObject]@{ - objectId = "allinstalledmodules" + objectId = "allinstalledmodules" objectName = "All installed modules" objectType = "module" - operation = $LMXToolBoxPermission + operation = $LMXToolBoxPermission } } - If($LMXPermission){ + If ($LMXPermission) { $Privileges += [PSCustomObject]@{ - objectId = "All exchange modules" + objectId = "All exchange modules" objectName = "private" objectType = "module" - operation = $LMXPermission + operation = $LMXPermission } } - If($ViewSupport){ + If ($ViewSupport) { $Privileges += [PSCustomObject]@{ - objectId = "chat" - objectName = "help" - objectType = "help" - operation = "write" + objectId = "chat" + objectName = "help" + objectType = "help" + operation = "write" subOperation = "" } $Privileges += [PSCustomObject]@{ - objectId = "*" - objectName = "help" - objectType = "help" - operation = "read" + objectId = "*" + objectName = "help" + objectType = "help" + operation = "read" subOperation = "" } } - If($ConfigTabRequiresManagePermission){ + If ($ConfigTabRequiresManagePermission) { $Privileges += [PSCustomObject]@{ - objectId = "" - objectName = "configNeedDeviceManagePermission" - objectType = "configNeedDeviceManagePermission" - operation = "write" + objectId = "" + objectName = "configNeedDeviceManagePermission" + objectType = "configNeedDeviceManagePermission" + operation = "write" subOperation = "" } } - If($AllowedToManageResourceDashboards){ + If ($AllowedToManageResourceDashboards) { $Privileges += [PSCustomObject]@{ - objectId = "" - objectName = "deviceDashboard" - objectType = "deviceDashboard" - operation = "write" + objectId = "" + objectName = "deviceDashboard" + objectType = "deviceDashboard" + operation = "write" subOperation = "" } } - If($DashboardsPermission -ne "none"){ + If ($DashboardsPermission -ne "none") { $Privileges += [PSCustomObject]@{ - objectId = "*" - objectName = "*" - objectType = "dashboard_group" - operation = If($DashboardsPermission -eq "manage"){"write"}Else{"read"} + objectId = "*" + objectName = "*" + objectType = "dashboard_group" + operation = If ($DashboardsPermission -eq "manage") { "write" }Else { "read" } subOperation = "" } } - If($ResourcePermission -ne "none"){ + If ($ResourcePermission -ne "none") { $Privileges += [PSCustomObject]@{ - objectId = "*" - objectName = "*" - objectType = "host_group" - operation = If($ResourcePermission -eq "manage"){"write"}Else{"read"} + objectId = "*" + objectName = "*" + objectType = "host_group" + operation = If ($ResourcePermission -eq "manage") { "write" }Else { "read" } subOperation = "" } } - If($LogsPermission -ne "none"){ + If ($LogsPermission -ne "none") { $Privileges += [PSCustomObject]@{ - objectId = "*" - objectName = "*" - objectType = "logs" - operation = If($LogsPermission -eq "manage"){"write"}Else{"read"} + objectId = "*" + objectName = "*" + objectType = "logs" + operation = If ($LogsPermission -eq "manage") { "write" }Else { "read" } subOperation = "" } } - If($WebsitesPermission -ne "none"){ + If ($WebsitesPermission -ne "none") { $Privileges += [PSCustomObject]@{ - objectId = "*" - objectName = "*" - objectType = "website_group" - operation = If($WebsitesPermission -eq "manage"){"write"}Else{"read"} + objectId = "*" + objectName = "*" + objectType = "website_group" + operation = If ($WebsitesPermission -eq "manage") { "write" }Else { "read" } subOperation = "" } } - If($SavedMapsPermission -ne "none"){ + If ($SavedMapsPermission -ne "none") { $Privileges += [PSCustomObject]@{ - objectId = "*" - objectName = "*" - objectType = "map" - operation = If($SavedMapsPermission -eq "manage"){"write"}Else{"read"} + objectId = "*" + objectName = "*" + objectType = "map" + operation = If ($SavedMapsPermission -eq "manage") { "write" }Else { "read" } subOperation = "" } } - If($ReportsPermission -ne "none"){ + If ($ReportsPermission -ne "none") { $Privileges += [PSCustomObject]@{ - objectId = "*" - objectName = "*" - objectType = "report_group" - operation = If($ReportsPermission -eq "manage"){"write"}Else{"read"} + objectId = "*" + objectName = "*" + objectType = "report_group" + operation = If ($ReportsPermission -eq "manage") { "write" }Else { "read" } subOperation = "" } } - If($SettingsPermission -ne "none"){ - If($SettingsPermission -ne "manage-collectors" -and $SettingsPermission -ne "view-collectors"){ + If ($SettingsPermission -ne "none") { + If ($SettingsPermission -ne "manage-collectors" -and $SettingsPermission -ne "view-collectors") { $Privileges += [PSCustomObject]@{ - objectId = "*" - objectName = "*" - objectType = "setting" - operation = If($SettingsPermission -eq "manage"){"write"}Else{"read"} + objectId = "*" + objectName = "*" + objectType = "setting" + operation = If ($SettingsPermission -eq "manage") { "write" }Else { "read" } subOperation = "" } $Privileges += [PSCustomObject]@{ - objectId = "useraccess.*" - objectName = "useraccess.*" - objectType = "setting" - operation = If($ResourcePermission -eq "manage"){"write"}Else{"read"} + objectId = "useraccess.*" + objectName = "useraccess.*" + objectType = "setting" + operation = If ($ResourcePermission -eq "manage") { "write" }Else { "read" } subOperation = "" } } - Else{ + Else { $Privileges += [PSCustomObject]@{ - objectId = "collectorgroup.*" + objectId = "collectorgroup.*" objectName = "Collectors" objectType = "setting" - operation = If($SettingsPermission -eq "manage-collectors"){"write"}Else{"read"} + operation = If ($SettingsPermission -eq "manage-collectors") { "write" }Else { "read" } } } } @@ -352,14 +352,14 @@ Function Set-LMRole { customHelpURL = $CustomHelpURL description = $Description name = $NewName - requireEULA = If($RequireEULA.IsPresent){"true"}Else{""} + requireEULA = If ($RequireEULA.IsPresent) { "true" }Else { "" } roleGroupId = $RoleGroupId - twoFARequired = If($TwoFARequired.IsPresent){"true"}Else{""} - privileges = If($CustomPrivilegesObject){$CustomPrivilegesObject}Else{$Privileges} + twoFARequired = If ($TwoFARequired.IsPresent) { "true" }Else { "" } + privileges = If ($CustomPrivilegesObject) { $CustomPrivilegesObject }Else { $Privileges } } #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json) $Headers = New-LMHeader -Auth $Script:LMAuth -Method "PATCH" -ResourcePath $ResourcePath -Data $Data @@ -367,7 +367,7 @@ Function Set-LMRole { Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Data - #Issue request + #Issue request $Response = Invoke-RestMethod -Uri $Uri -Method "PATCH" -Headers $Headers[0] -WebSession $Headers[1] -Body $Data Return (Add-ObjectTypeInfo -InputObject $Response -TypeName "LogicMonitor.Role" ) diff --git a/Public/Set-LMSDT.ps1 b/Public/Set-LMSDT.ps1 index 2ec3b94..4ffe7b3 100644 --- a/Public/Set-LMSDT.ps1 +++ b/Public/Set-LMSDT.ps1 @@ -1,6 +1,6 @@ Function Set-LMSDT { - [CmdletBinding(DefaultParameterSetName="OneTime")] + [CmdletBinding(DefaultParameterSetName = "OneTime")] Param ( [Parameter(Mandatory)] [String]$Id, @@ -34,11 +34,11 @@ Function Set-LMSDT { [Nullable[Int]]$EndMinute, [Parameter(ParameterSetName = 'Recurring')] - [ValidateSet("Monday", "Tuesday", "Wednesday","Thursday","Friday","Saturday","Sunday")] + [ValidateSet("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday")] [String]$WeekDay, [Parameter(ParameterSetName = 'Recurring')] - [ValidateSet("First", "Second", "Third","Fourth","Last")] + [ValidateSet("First", "Second", "Third", "Fourth", "Last")] [String]$WeekOfMonth, [Parameter(ParameterSetName = 'Recurring')] @@ -54,26 +54,26 @@ Function Set-LMSDT { Try { $Data = @{} - $Data.Add('comment',$Comment) - $Data.Add('hour',$StartHour) - $Data.Add('minute',$StartMinute) - $Data.Add('endHour',$EndHour) - $Data.Add('endMinute',$EndMinute) - $Data.Add('weekDay',$WeekDay) - $Data.Add('monthDay',$DayOfMonth) - $Data.Add('weekOfMonth',$WeekOfMonth) - - If($StartDate){ + $Data.Add('comment', $Comment) + $Data.Add('hour', $StartHour) + $Data.Add('minute', $StartMinute) + $Data.Add('endHour', $EndHour) + $Data.Add('endMinute', $EndMinute) + $Data.Add('weekDay', $WeekDay) + $Data.Add('monthDay', $DayOfMonth) + $Data.Add('weekOfMonth', $WeekOfMonth) + + If ($StartDate) { $StartDateTime = (New-TimeSpan -Start (Get-Date "01/01/1970") -End $StartDate.ToUniversalTime()).TotalMilliseconds - $Data.Add('startDateTime',[math]::Round($StartDateTime)) + $Data.Add('startDateTime', [math]::Round($StartDateTime)) } - If($EndDate){ + If ($EndDate) { $EndDateTime = (New-TimeSpan -Start (Get-Date "01/01/1970") -End $EndDate.ToUniversalTime()).TotalMilliseconds - $Data.Add('endDateTime',[math]::Round($EndDateTime)) + $Data.Add('endDateTime', [math]::Round($EndDateTime)) } #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json) diff --git a/Public/Set-LMTopologysource.ps1 b/Public/Set-LMTopologysource.ps1 index 9d837a4..8b6757c 100644 --- a/Public/Set-LMTopologysource.ps1 +++ b/Public/Set-LMTopologysource.ps1 @@ -16,7 +16,7 @@ Function Set-LMTopologysource { [String]$TechNotes, - [ValidateSet("1800","3600","7200","21600")] + [ValidateSet("1800", "3600", "7200", "21600")] [Nullable[Int]]$PollingIntervalInSeconds, [String]$Group, @@ -45,29 +45,29 @@ Function Set-LMTopologysource { $ResourcePath = "/setting/topologysources/$Id" $collectorAttribute = $null - If($ScriptType -or $Script){ + If ($ScriptType -or $Script) { $collectorAttribute = @{ groovyScript = $Script scriptType = $ScriptType name = "script" } #Remove empty keys so we dont overwrite them - @($collectorAttribute.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($collectorAttribute[$_])) { $collectorAttribute.Remove($_) } } + @($collectorAttribute.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($collectorAttribute[$_])) { $collectorAttribute.Remove($_) } } } Try { $Data = @{ - name = $NewName - description = $Description - appliesTo = $appliesTo - technology = $TechNotes - group = $Group - collectInterval = $PollingIntervalInSeconds - collectorAttribute = $collectorAttribute + name = $NewName + description = $Description + appliesTo = $appliesTo + technology = $TechNotes + group = $Group + collectInterval = $PollingIntervalInSeconds + collectorAttribute = $collectorAttribute } #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json) diff --git a/Public/Set-LMUnmonitoredDevice.ps1 b/Public/Set-LMUnmonitoredDevice.ps1 index 331261e..c51e0ce 100644 --- a/Public/Set-LMUnmonitoredDevice.ps1 +++ b/Public/Set-LMUnmonitoredDevice.ps1 @@ -24,9 +24,9 @@ Function Set-LMUnmonitoredDevice { Try { $Data = @{ collectorId = $CollectorId - description = $Description - deviceGroupId = $DeviceGroupId - missingDeviceIds = $Ids + description = $Description + deviceGroupId = $DeviceGroupId + missingDeviceIds = $Ids } $Data = ($Data | ConvertTo-Json) diff --git a/Public/Set-LMUser.ps1 b/Public/Set-LMUser.ps1 index 28485f7..315892a 100644 --- a/Public/Set-LMUser.ps1 +++ b/Public/Set-LMUser.ps1 @@ -114,7 +114,7 @@ Function Set-LMUser { } break } - ElseIf ($ViewPermission.ContainsKey($View)) { + Elseif ($ViewPermission.ContainsKey($View)) { $ViewPermission[$View] = $true } } @@ -146,7 +146,7 @@ Function Set-LMUser { } #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json) diff --git a/Public/Set-LMWebsite.ps1 b/Public/Set-LMWebsite.ps1 index ebf1779..ed467f4 100644 --- a/Public/Set-LMWebsite.ps1 +++ b/Public/Set-LMWebsite.ps1 @@ -1,6 +1,6 @@ Function Set-LMWebsite { - [CmdletBinding(DefaultParameterSetName="Website")] + [CmdletBinding(DefaultParameterSetName = "Website")] Param ( [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [String]$Id, @@ -19,38 +19,38 @@ Function Set-LMWebsite { [Nullable[boolean]]$UseDefaultLocationSetting, - [Parameter(ParameterSetName="Website")] + [Parameter(ParameterSetName = "Website")] [Nullable[boolean]]$TriggerSSLStatusAlert, - [Parameter(ParameterSetName="Website")] + [Parameter(ParameterSetName = "Website")] [Nullable[boolean]]$TriggerSSLExpirationAlert, [String]$GroupId, - [Parameter(ParameterSetName="Ping")] + [Parameter(ParameterSetName = "Ping")] [String]$PingAddress, - [Parameter(ParameterSetName="Website")] + [Parameter(ParameterSetName = "Website")] [String]$WebsiteDomain, [ValidateSet("http", "https")] - [Parameter(ParameterSetName="Website")] + [Parameter(ParameterSetName = "Website")] [String]$HttpType, - [Parameter(ParameterSetName="Website")] + [Parameter(ParameterSetName = "Website")] [String[]]$SSLAlertThresholds, - [Parameter(ParameterSetName="Ping")] + [Parameter(ParameterSetName = "Ping")] [ValidateSet(5, 10, 15, 20, 30, 60)] [Nullable[Int]]$PingCount, - [Parameter(ParameterSetName="Ping")] + [Parameter(ParameterSetName = "Ping")] [Nullable[Int]]$PingTimeout, - [Parameter(ParameterSetName="Website")] + [Parameter(ParameterSetName = "Website")] [Nullable[Int]]$PageLoadAlertTimeInMS, - [Parameter(ParameterSetName="Ping")] + [Parameter(ParameterSetName = "Ping")] [ValidateSet(10, 20, 30, 40, 50, 60, 70, 80, 90, 100)] [Nullable[Int]]$PingPercentNotReceived, @@ -71,12 +71,12 @@ Function Set-LMWebsite { [ValidateSet(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)] [Nullable[Int]]$PollingInterval, - [Parameter(ParameterSetName="Website")] + [Parameter(ParameterSetName = "Website")] [String[]]$WebsiteSteps ) - Begin{} - Process{ + Begin {} + Process { #Check if we are logged in and have valid api creds If ($Script:LMAuth.Valid) { @@ -136,7 +136,7 @@ Function Set-LMWebsite { #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json) @@ -161,5 +161,5 @@ Function Set-LMWebsite { Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again." } } - End{} + End {} } diff --git a/Public/Set-LMWebsiteGroup.ps1 b/Public/Set-LMWebsiteGroup.ps1 index 5343da8..e4bc0a5 100644 --- a/Public/Set-LMWebsiteGroup.ps1 +++ b/Public/Set-LMWebsiteGroup.ps1 @@ -82,7 +82,7 @@ Function Set-LMWebsiteGroup { } #Remove empty keys so we dont overwrite them - @($Data.keys) | ForEach-Object { if ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } + @($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_]) -and ($_ -notin @($MyInvocation.BoundParameters.Keys))) { $Data.Remove($_) } } $Data = ($Data | ConvertTo-Json) diff --git a/README.md b/README.md index 351f211..e8b2496 100644 --- a/README.md +++ b/README.md @@ -411,28 +411,24 @@ We appreciate your continued support and enthusiasm for the Logic.Monitor PowerS ## 6.2 ### New Cmdlets: - - **Get-LMAWSAccountId**: This cmdlet is used to retrieve the AWS Account ID associated with the LogicMonitor account. - - **Get-LMConfigsourceUpdateHistory**: This cmdlet retrieves the update history for a LogicMonitor configuration source. It can be used to get information about the updates made to a configuration source, such as the update reasons and the modules that were updated.. - - **Invoke-LMAWSAccountTest**: This cmdlet will test for required permissions needed to add an AWS account to LogicMonitor. - ``` - Invoke-LMAWSAccountTest -ExternalId "123456" -AccountId "987654" -AccessId "AKI123" -AccessKey "abc123" -AssumedRoleARN "arn:aws:iam::123456789012:role/MyRole" -CheckedServices "EC2,S3,RDS" -GroupId 123 - ``` -- **Invoke-LMAzureAccountTest**: This cmdlet will test for required permissions needed to add an Azure account to LogicMonitor. - ``` - Invoke-LMAzureAccountTest -ClientId "xxxxxxxx" -SecretKey "xxxxxxxx" -SubscriptionIds "xxxxxxxx" - ``` -- **Invoke-LMAzureSubscriptionDiscovery**: This cmdlet invokes the Azure subscription discovery process to return subscriptions for a specified client Id. - ``` - Invoke-LMAzureSubscriptionDiscovery -ClientId "xxxxxxxx" -SecretKey "xxxxxxxx" -TenantId "xxxxxxxx" - ``` -- **Invoke-LMGCPAccountTest**: This cmdlet will test for required permissions needed to add an GCP project to LogicMonitor. - ``` - Invoke-LMGCPAccountTest -ServiceAccountKey "service-account-key" -ProjectId "project-id" - ``` + - **Get-LMAccessGroup**: This cmdlet will retrieve data for specified LogicMonitor access groups. You can retrieve all access groups or limit the results using *-Id*, *-Name* or *-Filter* parameters. + - **New-LMAccessGroup**: This cmdlet creates a new LogicMonitor access group. + - **Set-LMAccessGroup**: This cmdlet updates an existing LogicMonitor access group. + - **Remove-LMAccessGroup**: This cmdlet removes a new LogicMonitor access group. + - **Get-LMDeviceDatasourceInstanceAlertRecipients**: Retrieves the alert recipients for a specific data point in a LogicMonitor device datasource instance. + - **Remove-LMDeviceDatasourceInstanceGroup**: Removes a LogicMonitor device datasource instance group. + - **Set-LMDeviceDatasourceInstance**: Updates a LogicMonitor device datasource instance. + + **Note**: Access Groups are not available in all portals and needs to be enabled before any access group commands can be utilized. + ### Updated Cmdlets: - - **Get-LMDatasourceUpdateHistory**: Added custom object return type *LogicMonitor.ModuleUpdateHistory*. - - **Set-LMDevice**: Added additional parameter `-AutoBalancedCollectorGroupId` to specify an auto balanced collector group. + - **Get-LMDeviceDatasourceList**: Added aliases *-DeviceId* and *-DeviceName* to the *-Id* and *-Name* parameters to make them inline with other cmdlets. + - **Get-LMDeviceDatasourceInstance**: Added aliases *-DeviceId* and *-DeviceName* to the *-Id* and *-Name* parameters to make them inline with other cmdlets. + - **Get-LMDeviceDatasourceInstanceAlertSetting**: Added aliases *-DeviceId* and *-DeviceName* to the *-Id* and *-Name* parameters to make them inline with other cmdlets. Also fixed bug causing an issue when trying to retrieve instances with special characters in the name. + - **Get-LMDeviceDatasourceInstanceGroup**: Added aliases *-DeviceId* and *-DeviceName* to the *-Id* and *-Name* parameters to make them inline with other cmdlets. + - **Remove-LMDeviceDatasourceInstance**: Fixed bug that would prevent a datasource instance from being delete due to missing instance id. + [Previous Release Notes](RELEASENOTES.md) diff --git a/Tests/LMDevice.Tests.ps1 b/Tests/LMDevice.Tests.ps1 index 3749aed..877f962 100644 --- a/Tests/LMDevice.Tests.ps1 +++ b/Tests/LMDevice.Tests.ps1 @@ -64,7 +64,7 @@ Describe 'Device Testing New/Get/Set/Remove' { Describe 'Set-LMDevice' { It 'When given a set of parameters, returns an updated resource with matching values' { - { $Device = Set-LMDevice -Id $Script:NewDevice.Id -Description "Updated" -Properties @{"test"="123";"test2"="456"} -ErrorAction Stop + { $Device = Set-LMDevice -Id $Script:NewDevice.Id -Description "Updated" -Properties @{"test" = "123"; "test2" = "456" } -ErrorAction Stop $Device.Description | Should -Be "Updated" $Device.CustomProperties.name.IndexOf("test") | Should -Not -BeExactly -1 $Device.CustomProperties.name.IndexOf("test2") | Should -Not -BeExactly -1 @@ -74,7 +74,7 @@ Describe 'Device Testing New/Get/Set/Remove' { Describe 'Remove-LMDevice' { It 'When given an id, remove the device from logic monitor' { - { Remove-LMDevice -Id $Script:NewDevice.Id -HardDelete $true -Confirm:$false -ErrorAction Stop} | Should -Not -Throw + { Remove-LMDevice -Id $Script:NewDevice.Id -HardDelete $true -Confirm:$false -ErrorAction Stop } | Should -Not -Throw } } diff --git a/Tests/LMDeviceGroup.Tests.ps1 b/Tests/LMDeviceGroup.Tests.ps1 index ecfdeae..60ea492 100644 --- a/Tests/LMDeviceGroup.Tests.ps1 +++ b/Tests/LMDeviceGroup.Tests.ps1 @@ -6,7 +6,7 @@ Describe 'DeviceGroup Testing New/Get/Set/Remove' { Describe 'New-LMDeviceGroup' { It 'When given mandatory parameters, returns a created group with matching values' { - $Script:NewDeviceGroup = New-LMDeviceGroup -Name "DeviceGroup.Build.Test" -Description "Testing123" -ParentGroupId 1 -Properties @{"testing"="123"} -DisableAlerting $true -AppliesTo "false()" + $Script:NewDeviceGroup = New-LMDeviceGroup -Name "DeviceGroup.Build.Test" -Description "Testing123" -ParentGroupId 1 -Properties @{"testing" = "123" } -DisableAlerting $true -AppliesTo "false()" $Script:NewDeviceGroup | Should -Not -BeNullOrEmpty $Script:NewDeviceGroup.Description | Should -Be "Testing123" $Script:NewDeviceGroup.DisableAlerting | Should -Be $true @@ -36,7 +36,7 @@ Describe 'DeviceGroup Testing New/Get/Set/Remove' { Describe 'Set-LMDeviceGroup' { It 'When given a set of parameters, returns an updated group with matching values' { - { $DeviceGroup = Set-LMDeviceGroup -Id $Script:NewDeviceGroup.Id -Description "Updated" -Properties @{"test"="123";"test2"="456"} -ErrorAction Stop + { $DeviceGroup = Set-LMDeviceGroup -Id $Script:NewDeviceGroup.Id -Description "Updated" -Properties @{"test" = "123"; "test2" = "456" } -ErrorAction Stop $DeviceGroup.Description | Should -Be "Updated" $DeviceGroup.CustomProperties.name.IndexOf("test") | Should -Not -BeExactly -1 $DeviceGroup.CustomProperties.name.IndexOf("test2") | Should -Not -BeExactly -1 diff --git a/Tests/LMOpsNotes.Tests.ps1 b/Tests/LMOpsNotes.Tests.ps1 index 9c26235..6be19ab 100644 --- a/Tests/LMOpsNotes.Tests.ps1 +++ b/Tests/LMOpsNotes.Tests.ps1 @@ -23,7 +23,7 @@ Describe 'OpsNotes Testing New/Get/Set/Remove' { } It 'When given an id should return that opsnote' { $Retry = 0 - While(!$OpsNote -or $Retry -eq 5){ + While (!$OpsNote -or $Retry -eq 5) { $OpsNote = Get-LMOpsNote -Id $Script:NewOpsNote.Id -ErrorAction SilentlyContinue $Retry++ } @@ -31,7 +31,7 @@ Describe 'OpsNotes Testing New/Get/Set/Remove' { } It 'When given a tag should return specified opsnote matching that tag value' { $Retry = 0 - While(!$OpsNote -or $Retry -eq 5){ + While (!$OpsNote -or $Retry -eq 5) { $OpsNote = Get-LMOpsNote -Tag $Script:NewOpsNote.Tags.name -ErrorAction SilentlyContinue $Retry++ } @@ -39,8 +39,8 @@ Describe 'OpsNotes Testing New/Get/Set/Remove' { } It 'When given a wildcard tag should return all opsnotes matching that wildcard value' { $Retry = 0 - While(!$OpsNote -or $Retry -eq 5){ - $OpsNote = Get-LMOpsNote -Tag "$(($Script:NewOpsNote.Tags.name.Split(".")[0]))*" -ErrorAction SilentlyContinue + While (!$OpsNote -or $Retry -eq 5) { + $OpsNote = Get-LMOpsNote -Tag "$(($Script:NewOpsNote.Tags.name.Split(".")[0]))*" -ErrorAction SilentlyContinue $Retry++ } ($OpsNote | Measure-Object).Count | Should -BeGreaterThan 0 diff --git a/Tests/LMUser-Role.Tests.ps1 b/Tests/LMUser-Role.Tests.ps1 index 6faa456..5c2a983 100644 --- a/Tests/LMUser-Role.Tests.ps1 +++ b/Tests/LMUser-Role.Tests.ps1 @@ -88,7 +88,7 @@ Describe 'User & Role Testing New/Get/Set/Remove' { Describe 'Remove-LMRole' { It 'When given an id, remove the role from logic monitor' { - { Remove-LMRole -Id $Script:NewRole.Id -ErrorAction Stop -Confirm:$false } | Should -Not -Throw + { Remove-LMRole -Id $Script:NewRole.Id -ErrorAction Stop -Confirm:$false } | Should -Not -Throw } } diff --git a/Tests/LMWebsite.Tests.ps1 b/Tests/LMWebsite.Tests.ps1 index a14728b..0170e1a 100644 --- a/Tests/LMWebsite.Tests.ps1 +++ b/Tests/LMWebsite.Tests.ps1 @@ -6,7 +6,7 @@ Describe 'Website Testing New/Get/Set/Remove' { Describe 'New-LMWebsite' { It 'When given mandatory parameters, returns a created website with matching values' { - $Script:NewWebsite = New-LMWebsite -Name "Website.Build.Test" -Webcheck -WebsiteDomain "example.com" -Description "BuildTest" -Properties @{"testprop"="BuildTest"} + $Script:NewWebsite = New-LMWebsite -Name "Website.Build.Test" -Webcheck -WebsiteDomain "example.com" -Description "BuildTest" -Properties @{"testprop" = "BuildTest" } $Script:NewWebsite | Should -Not -BeNullOrEmpty $Script:NewWebsite.Description | Should -BeExactly "BuildTest" $Script:NewWebsite.properties.name.IndexOf("testprop") | Should -Not -BeExactly -1 @@ -15,7 +15,7 @@ Describe 'Website Testing New/Get/Set/Remove' { Describe 'Get-LMWebsiteProperty' { It 'When given mandatory parameters, returns a specified property' { - $WebsiteProp = Get-LMWebsiteProperty -Id $Script:NewWebsite.Id | Where-Object {$_.name -eq "testprop"} + $WebsiteProp = Get-LMWebsiteProperty -Id $Script:NewWebsite.Id | Where-Object { $_.name -eq "testprop" } $WebsiteProp | Should -Not -BeNullOrEmpty } } @@ -45,7 +45,7 @@ Describe 'Website Testing New/Get/Set/Remove' { Describe 'Set-LMWebsite' { It 'When given a set of parameters, returns an updated website with matching values' { - { $Device = Set-LMWebsite -Id $Script:NewWebsite.Id -Description "Updated" -Properties @{"test"="123";"test2"="456"} -ErrorAction Stop + { $Device = Set-LMWebsite -Id $Script:NewWebsite.Id -Description "Updated" -Properties @{"test" = "123"; "test2" = "456" } -ErrorAction Stop $Device.Description | Should -Be "Updated" $Device.Properties.name.IndexOf("test") | Should -Not -BeExactly -1 $Device.Properties.name.IndexOf("test2") | Should -Not -BeExactly -1 diff --git a/Tests/LMWebsiteGroup.Tests.ps1 b/Tests/LMWebsiteGroup.Tests.ps1 index ab1ea9e..8b171ee 100644 --- a/Tests/LMWebsiteGroup.Tests.ps1 +++ b/Tests/LMWebsiteGroup.Tests.ps1 @@ -6,7 +6,7 @@ Describe 'WebsiteGroup Testing New/Get/Set/Remove' { Describe 'New-LMWebsiteGroup' { It 'When given mandatory parameters, returns a created group with matching values' { - $Script:NewWebsiteGroup = New-LMWebsiteGroup -Name "WebsiteGroup.Build.Test" -Description "Testing123" -ParentGroupId 1 -Properties @{"testing"="123"} -DisableAlerting $true + $Script:NewWebsiteGroup = New-LMWebsiteGroup -Name "WebsiteGroup.Build.Test" -Description "Testing123" -ParentGroupId 1 -Properties @{"testing" = "123" } -DisableAlerting $true $Script:NewWebsiteGroup | Should -Not -BeNullOrEmpty $Script:NewWebsiteGroup.Description | Should -Be "Testing123" $Script:NewWebsiteGroup.DisableAlerting | Should -Be $true @@ -35,7 +35,7 @@ Describe 'WebsiteGroup Testing New/Get/Set/Remove' { Describe 'Set-LMWebsiteGroup' { It 'When given a set of parameters, returns an updated group with matching values' { - { $WebsiteGroup = Set-LMWebsiteGroup -Id $Script:NewWebsiteGroup.Id -Description "Updated" -Properties @{"test"="123";"test2"="456"} -ErrorAction Stop + { $WebsiteGroup = Set-LMWebsiteGroup -Id $Script:NewWebsiteGroup.Id -Description "Updated" -Properties @{"test" = "123"; "test2" = "456" } -ErrorAction Stop $WebsiteGroup.Description | Should -Be "Updated" $WebsiteGroup.Properties.name.IndexOf("test") | Should -Not -BeExactly -1 $WebsiteGroup.Properties.name.IndexOf("test2") | Should -Not -BeExactly -1 diff --git a/en-US/Logic.Monitor-help.xml b/en-US/Logic.Monitor-help.xml index 1e391b0..1522f2e 100644 --- a/en-US/Logic.Monitor-help.xml +++ b/en-US/Logic.Monitor-help.xml @@ -4369,6 +4369,73 @@ Retrieves audit logs that contain the search string "login" and occurred within -------------------------- EXAMPLE 1 -------------------------- Get-LMAWSAccountId +Retrieves the AWS Account ID associated with the LogicMonitor account. + + + + + + + + Online Version: + https://www.logicmonitor.com/support/rest-api-developers-guide/ + + + + + + Get-LMAWSAccountId + Get + LMAWSAccountId + + Retrieves the AWS Account ID associated with the LogicMonitor account. + + + + The Get-LMAWSAccountId function is used to retrieve the AWS Account ID associated with the LogicMonitor account. It checks if the user is logged in and has valid API credentials. If the user is logged in, it builds the necessary headers and URI, and then sends a GET request to the LogicMonitor API to retrieve the AWS Account ID. The function returns the response containing the AWS Account ID. + + + + Get-LMAWSAccountId + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + + + + + + + + + -------------------------- EXAMPLE 1 -------------------------- + Get-LMAWSAccountId Retrieves the AWS Account ID associated with the LogicMonitor account. @@ -6152,23 +6219,23 @@ Retrieves the update history for the configuration source with the display name - Get-LMDashboard + Get-LMConfigsourceUpdateHistory Get - LMDashboard + LMConfigsourceUpdateHistory - Retrieves LogicMonitor dashboards based on specified parameters. + Retrieves the update history for a LogicMonitor configuration source. - The Get-LMDashboard function retrieves LogicMonitor dashboards based on the specified parameters. It supports filtering by ID, name, group ID, group name, subgroups, and custom filters. The function uses the LogicMonitor REST API to make the requests. + The Get-LMConfigsourceUpdateHistory function retrieves the update history for a LogicMonitor configuration source. It can be used to get information about the updates made to a configuration source, such as the update reasons and the modules that were updated. - Get-LMDashboard - + Get-LMConfigsourceUpdateHistory + Id - Specifies the ID of the dashboard to retrieve. + The ID of the configuration source. This parameter is mandatory when using the 'Id' parameter set. Int32 @@ -6177,10 +6244,22 @@ Retrieves the update history for the configuration source with the display name 0 + + Filter + + A filter object that specifies additional filtering criteria for the update history. This parameter is optional. + + Object + + Object + + + None + BatchSize - Specifies the number of dashboards to retrieve in each request. The default value is 1000. + The number of results to retrieve per request. The default value is 1000. This parameter is optional. Int32 @@ -6203,11 +6282,11 @@ Retrieves the update history for the configuration source with the display name - Get-LMDashboard + Get-LMConfigsourceUpdateHistory Name - Specifies the name of the dashboard to retrieve. + The name of the configuration source. This parameter is used to look up the ID of the configuration source. This parameter is used when using the 'Name' parameter set. String @@ -6216,10 +6295,22 @@ Retrieves the update history for the configuration source with the display name None + + Filter + + A filter object that specifies additional filtering criteria for the update history. This parameter is optional. + + Object + + Object + + + None + BatchSize - Specifies the number of dashboards to retrieve in each request. The default value is 1000. + The number of results to retrieve per request. The default value is 1000. This parameter is optional. Int32 @@ -6242,11 +6333,11 @@ Retrieves the update history for the configuration source with the display name - Get-LMDashboard + Get-LMConfigsourceUpdateHistory - GroupId + DisplayName - Specifies the ID of the group to filter the dashboards by. + The display name of the configuration source. This parameter is used to look up the ID of the configuration source. This parameter is used when using the 'DisplayName' parameter set. String @@ -6255,10 +6346,22 @@ Retrieves the update history for the configuration source with the display name None + + Filter + + A filter object that specifies additional filtering criteria for the update history. This parameter is optional. + + Object + + Object + + + None + BatchSize - Specifies the number of dashboards to retrieve in each request. The default value is 1000. + The number of results to retrieve per request. The default value is 1000. This parameter is optional. Int32 @@ -6280,19 +6383,259 @@ Retrieves the update history for the configuration source with the display name None + + + + Id + + The ID of the configuration source. This parameter is mandatory when using the 'Id' parameter set. + + Int32 + + Int32 + + + 0 + + + Name + + The name of the configuration source. This parameter is used to look up the ID of the configuration source. This parameter is used when using the 'Name' parameter set. + + String + + String + + + None + + + DisplayName + + The display name of the configuration source. This parameter is used to look up the ID of the configuration source. This parameter is used when using the 'DisplayName' parameter set. + + String + + String + + + None + + + Filter + + A filter object that specifies additional filtering criteria for the update history. This parameter is optional. + + Object + + Object + + + None + + + BatchSize + + The number of results to retrieve per request. The default value is 1000. This parameter is optional. + + Int32 + + Int32 + + + 1000 + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + + + + + + + + + -------------------------- EXAMPLE 1 -------------------------- + Get-LMConfigsourceUpdateHistory -Id 1234 +Retrieves the update history for the configuration source with the ID 1234. + + + + + + -------------------------- EXAMPLE 2 -------------------------- + Get-LMConfigsourceUpdateHistory -Name "MyConfigSource" +Retrieves the update history for the configuration source with the name "MyConfigSource". + + + + + + -------------------------- EXAMPLE 3 -------------------------- + Get-LMConfigsourceUpdateHistory -DisplayName "My Config Source" +Retrieves the update history for the configuration source with the display name "My Config Source". + + + + + + + + + + Get-LMDashboard + Get + LMDashboard + + Retrieves LogicMonitor dashboards based on specified parameters. + + + + The Get-LMDashboard function retrieves LogicMonitor dashboards based on the specified parameters. It supports filtering by ID, name, group ID, group name, subgroups, and custom filters. The function uses the LogicMonitor REST API to make the requests. + + Get-LMDashboard - GroupName + Id - Specifies the name of the group to filter the dashboards by. + Specifies the ID of the dashboard to retrieve. - String + Int32 - String + Int32 - None + 0 + + + BatchSize + + Specifies the number of dashboards to retrieve in each request. The default value is 1000. + + Int32 + + Int32 + + + 1000 + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + Get-LMDashboard + + Name + + Specifies the name of the dashboard to retrieve. + + String + + String + + + None + + + BatchSize + + Specifies the number of dashboards to retrieve in each request. The default value is 1000. + + Int32 + + Int32 + + + 1000 + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + Get-LMDashboard + + GroupId + + Specifies the ID of the group to filter the dashboards by. + + String + + String + + + None + + + BatchSize + + Specifies the number of dashboards to retrieve in each request. The default value is 1000. + + Int32 + + Int32 + + + 1000 + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + Get-LMDashboard + + GroupName + + Specifies the name of the group to filter the dashboards by. + + String + + String + + + None BatchSize @@ -9058,10 +9401,13 @@ Retrieves the dashboards that match the specified custom filter. Get-LMDatasourceUpdateHistory + + Id Id The ID of the datasource. This parameter is mandatory when using the 'Id' parameter set. + {{ Fill Id Description }} Int32 @@ -9071,24 +9417,32 @@ Retrieves the dashboards that match the specified custom filter. 0 + Filter Filter A filter object that can be used to filter the results. The filter object should contain properties that match the properties of the datasource. Only datasources that match the filter will be included in the results. + {{ Fill Filter Description }} Object + Object + Object Object None + BatchSize BatchSize The number of results to retrieve in each batch. The default value is 1000. + {{ Fill BatchSize Description }} Int32 + Int32 + Int32 Int32 @@ -9110,12 +9464,16 @@ Retrieves the dashboards that match the specified custom filter. Get-LMDatasourceUpdateHistory + Name Name The name of the datasource. This parameter is used to look up the ID of the datasource. If the name is provided, the function will automatically retrieve the ID of the datasource. This parameter is used in the 'Name' parameter set. + {{ Fill Name Description }} String + String + String String @@ -9133,10 +9491,13 @@ Retrieves the dashboards that match the specified custom filter. None + + BatchSize BatchSize The number of results to retrieve in each batch. The default value is 1000. + {{ Fill BatchSize Description }} Int32 @@ -9161,12 +9522,16 @@ Retrieves the dashboards that match the specified custom filter. Get-LMDatasourceUpdateHistory + DisplayName DisplayName The display name of the datasource. This parameter is used to look up the ID of the datasource. If the display name is provided, the function will automatically retrieve the ID of the datasource. This parameter is used in the 'DisplayName' parameter set. + {{ Fill DisplayName Description }} String + String + String String @@ -9185,12 +9550,16 @@ Retrieves the dashboards that match the specified custom filter. None + BatchSize BatchSize The number of results to retrieve in each batch. The default value is 1000. + {{ Fill BatchSize Description }} Int32 + Int32 + Int32 Int32 @@ -9211,10 +9580,13 @@ Retrieves the dashboards that match the specified custom filter. + + Id Id The ID of the datasource. This parameter is mandatory when using the 'Id' parameter set. + {{ Fill Id Description }} Int32 @@ -9223,6 +9595,18 @@ Retrieves the dashboards that match the specified custom filter. 0 + + Name + + {{ Fill Name Description }} + + String + + String + + + None + Name @@ -9249,8 +9633,11 @@ Retrieves the dashboards that match the specified custom filter. Filter + + BatchSize A filter object that can be used to filter the results. The filter object should contain properties that match the properties of the datasource. Only datasources that match the filter will be included in the results. + {{ Fill BatchSize Description }} Object @@ -11407,43 +11794,31 @@ Retrieves the update history of the datasource with the display name "My Datasou Get LMDeviceDatasourceInstance - {{ Fill in the Synopsis }} + Retrieves instances of a LogicMonitor device datasource. - {{ Fill in the Description }} + The Get-LMDeviceDatasourceInstance function retrieves instances of a LogicMonitor device datasource based on the specified parameters. It requires a valid API authentication and authorization. Get-LMDeviceDatasourceInstance - - BatchSize - - {{ Fill BatchSize Description }} - - Int32 - - Int32 - - - None - - DatasourceId + DatasourceName - {{ Fill DatasourceId Description }} + Specifies the name of the datasource. This parameter is mandatory when using the 'Id-dsName' or 'Name-dsName' parameter sets. - Int32 + String - Int32 + String None - - DeviceName + + Name - {{ Fill DeviceName Description }} + Specifies the name of the device. This parameter is mandatory when using the 'Name-dsName' or 'Name-dsId' parameter sets. It can also be specified using the 'DeviceName' alias. String @@ -11455,7 +11830,7 @@ Retrieves the update history of the datasource with the display name "My Datasou Filter - {{ Fill Filter Description }} + Specifies additional filters to apply to the instances. This parameter accepts an object representing the filter criteria. Object @@ -11464,6 +11839,18 @@ Retrieves the update history of the datasource with the display name "My Datasou None + + BatchSize + + Specifies the number of instances to retrieve per batch. The default value is 1000. + + Int32 + + Int32 + + + 1000 + ProgressAction @@ -11479,53 +11866,53 @@ Retrieves the update history of the datasource with the display name "My Datasou Get-LMDeviceDatasourceInstance - - BatchSize + + DatasourceName - {{ Fill BatchSize Description }} + Specifies the name of the datasource. This parameter is mandatory when using the 'Id-dsName' or 'Name-dsName' parameter sets. - Int32 + String - Int32 + String None - - DatasourceId + + Id - {{ Fill DatasourceId Description }} + Specifies the ID of the device. This parameter is mandatory when using the 'Id-dsId' or 'Id-dsName' parameter sets. It can also be specified using the 'DeviceId' alias. Int32 Int32 - None + 0 - - DeviceId + + Filter - {{ Fill DeviceId Description }} + Specifies additional filters to apply to the instances. This parameter accepts an object representing the filter criteria. - Int32 + Object - Int32 + Object None - Filter + BatchSize - {{ Fill Filter Description }} + Specifies the number of instances to retrieve per batch. The default value is 1000. - Object + Int32 - Object + Int32 - None + 1000 ProgressAction @@ -11542,22 +11929,22 @@ Retrieves the update history of the datasource with the display name "My Datasou Get-LMDeviceDatasourceInstance - - BatchSize + + DatasourceId - {{ Fill BatchSize Description }} + Specifies the ID of the datasource. This parameter is mandatory when using the 'Id-dsId' or 'Name-dsId' parameter sets. Int32 Int32 - None + 0 - - DatasourceName + + Name - {{ Fill DatasourceName Description }} + Specifies the name of the device. This parameter is mandatory when using the 'Name-dsName' or 'Name-dsId' parameter sets. It can also be specified using the 'DeviceName' alias. String @@ -11566,29 +11953,29 @@ Retrieves the update history of the datasource with the display name "My Datasou None - - DeviceName + + Filter - {{ Fill DeviceName Description }} + Specifies additional filters to apply to the instances. This parameter accepts an object representing the filter criteria. - String + Object - String + Object None - Filter + BatchSize - {{ Fill Filter Description }} + Specifies the number of instances to retrieve per batch. The default value is 1000. - Object + Int32 - Object + Int32 - None + 1000 ProgressAction @@ -11605,53 +11992,53 @@ Retrieves the update history of the datasource with the display name "My Datasou Get-LMDeviceDatasourceInstance - - BatchSize + + DatasourceId - {{ Fill BatchSize Description }} + Specifies the ID of the datasource. This parameter is mandatory when using the 'Id-dsId' or 'Name-dsId' parameter sets. Int32 Int32 - None + 0 - - DatasourceName + + Id - {{ Fill DatasourceName Description }} + Specifies the ID of the device. This parameter is mandatory when using the 'Id-dsId' or 'Id-dsName' parameter sets. It can also be specified using the 'DeviceId' alias. - String + Int32 - String + Int32 - None + 0 - - DeviceId + + Filter - {{ Fill DeviceId Description }} + Specifies additional filters to apply to the instances. This parameter accepts an object representing the filter criteria. - Int32 + Object - Int32 + Object None - Filter + BatchSize - {{ Fill Filter Description }} + Specifies the number of instances to retrieve per batch. The default value is 1000. - Object + Int32 - Object + Int32 - None + 1000 ProgressAction @@ -11668,14 +12055,14 @@ Retrieves the update history of the datasource with the display name "My Datasou - - BatchSize + + DatasourceName - {{ Fill BatchSize Description }} + Specifies the name of the datasource. This parameter is mandatory when using the 'Id-dsName' or 'Name-dsName' parameter sets. - Int32 + String - Int32 + String None @@ -11683,43 +12070,31 @@ Retrieves the update history of the datasource with the display name "My Datasou DatasourceId - {{ Fill DatasourceId Description }} + Specifies the ID of the datasource. This parameter is mandatory when using the 'Id-dsId' or 'Name-dsId' parameter sets. Int32 Int32 - None - - - DatasourceName - - {{ Fill DatasourceName Description }} - - String - - String - - - None + 0 - - DeviceId + + Id - {{ Fill DeviceId Description }} + Specifies the ID of the device. This parameter is mandatory when using the 'Id-dsId' or 'Id-dsName' parameter sets. It can also be specified using the 'DeviceId' alias. Int32 Int32 - None + 0 - - DeviceName + + Name - {{ Fill DeviceName Description }} + Specifies the name of the device. This parameter is mandatory when using the 'Name-dsName' or 'Name-dsId' parameter sets. It can also be specified using the 'DeviceName' alias. String @@ -11731,7 +12106,7 @@ Retrieves the update history of the datasource with the display name "My Datasou Filter - {{ Fill Filter Description }} + Specifies additional filters to apply to the instances. This parameter accepts an object representing the filter criteria. Object @@ -11740,6 +12115,18 @@ Retrieves the update history of the datasource with the display name "My Datasou None + + BatchSize + + Specifies the number of instances to retrieve per batch. The default value is 1000. + + Int32 + + Int32 + + + 1000 + ProgressAction @@ -11753,37 +12140,28 @@ Retrieves the update history of the datasource with the display name "My Datasou None - - - - None - - - - - - - - - - System.Object - - - - - - + + - + This function requires a valid API authentication and authorization. Use Connect-LMAccount to log in before running any commands. - -------------------------- Example 1 -------------------------- - PS C:\> {{ Add example code here }} + -------------------------- EXAMPLE 1 -------------------------- + Get-LMDeviceDatasourceInstance -DatasourceName "CPU" -Name "Server01" -BatchSize 500 +Retrieves instances of the "CPU" datasource for the device named "Server01" with a batch size of 500. - {{ Add example description here }} + + + + + -------------------------- EXAMPLE 2 -------------------------- + Get-LMDeviceDatasourceInstance -DatasourceId 1234 -Id 5678 +Retrieves instances of the datasource with ID 1234 for the device with ID 5678. + + @@ -11791,9 +12169,9 @@ Retrieves the update history of the datasource with the display name "My Datasou - Get-LMDeviceDatasourceInstanceAlertSetting + Get-LMDeviceDatasourceInstanceAlertRecipients Get - LMDeviceDatasourceInstanceAlertSetting + LMDeviceDatasourceInstanceAlertRecipients {{ Fill in the Synopsis }} @@ -11803,15 +12181,15 @@ Retrieves the update history of the datasource with the display name "My Datasou - Get-LMDeviceDatasourceInstanceAlertSetting - - BatchSize + Get-LMDeviceDatasourceInstanceAlertRecipients + + DataPointName - {{ Fill BatchSize Description }} + {{ Fill DataPointName Description }} - Int32 + String - Int32 + String None @@ -11828,18 +12206,6 @@ Retrieves the update history of the datasource with the display name "My Datasou None - - Filter - - {{ Fill Filter Description }} - - Object - - Object - - - None - InstanceName @@ -11878,15 +12244,15 @@ Retrieves the update history of the datasource with the display name "My Datasou - Get-LMDeviceDatasourceInstanceAlertSetting - - BatchSize + Get-LMDeviceDatasourceInstanceAlertRecipients + + DataPointName - {{ Fill BatchSize Description }} + {{ Fill DataPointName Description }} - Int32 + String - Int32 + String None @@ -11903,18 +12269,6 @@ Retrieves the update history of the datasource with the display name "My Datasou None - - Filter - - {{ Fill Filter Description }} - - Object - - Object - - - None - Id @@ -11953,15 +12307,15 @@ Retrieves the update history of the datasource with the display name "My Datasou - Get-LMDeviceDatasourceInstanceAlertSetting - - BatchSize + Get-LMDeviceDatasourceInstanceAlertRecipients + + DataPointName - {{ Fill BatchSize Description }} + {{ Fill DataPointName Description }} - Int32 + String - Int32 + String None @@ -11978,18 +12332,6 @@ Retrieves the update history of the datasource with the display name "My Datasou None - - Filter - - {{ Fill Filter Description }} - - Object - - Object - - - None - InstanceName @@ -12028,15 +12370,15 @@ Retrieves the update history of the datasource with the display name "My Datasou - Get-LMDeviceDatasourceInstanceAlertSetting - - BatchSize + Get-LMDeviceDatasourceInstanceAlertRecipients + + DataPointName - {{ Fill BatchSize Description }} + {{ Fill DataPointName Description }} - Int32 + String - Int32 + String None @@ -12053,18 +12395,6 @@ Retrieves the update history of the datasource with the display name "My Datasou None - - Filter - - {{ Fill Filter Description }} - - Object - - Object - - - None - Id @@ -12104,14 +12434,14 @@ Retrieves the update history of the datasource with the display name "My Datasou - - BatchSize + + DataPointName - {{ Fill BatchSize Description }} + {{ Fill DataPointName Description }} - Int32 + String - Int32 + String None @@ -12140,18 +12470,6 @@ Retrieves the update history of the datasource with the display name "My Datasou None - - Filter - - {{ Fill Filter Description }} - - Object - - Object - - - None - Id @@ -12239,59 +12557,35 @@ Retrieves the update history of the datasource with the display name "My Datasou - Get-LMDeviceDatasourceInstanceGroup + Get-LMDeviceDatasourceInstanceAlertRecipients Get - LMDeviceDatasourceInstanceGroup + LMDeviceDatasourceInstanceAlertRecipients - {{ Fill in the Synopsis }} + Retrieves the alert recipients for a specific data point in a LogicMonitor device datasource instance. - {{ Fill in the Description }} + The Get-LMDeviceDatasourceInstanceAlertRecipients function retrieves the alert recipients for a specific data point in a LogicMonitor device datasource instance. It requires valid API credentials and a logged-in session. - Get-LMDeviceDatasourceInstanceGroup - - BatchSize - - {{ Fill BatchSize Description }} - - Int32 - - Int32 - - - None - + Get-LMDeviceDatasourceInstanceAlertRecipients - DatasourceId - - {{ Fill DatasourceId Description }} - - Int32 - - Int32 - - - None - - - Filter + DatasourceName - {{ Fill Filter Description }} + Specifies the name of the datasource. This parameter is mandatory when using the 'Id-dsName' or 'Name-dsName' parameter sets. - Object + String - Object + String None - + Name - {{ Fill Name Description }} + Specifies the name of the device. This parameter is mandatory when using the 'Name-dsName' or 'Name-dsId' parameter sets. It can also be specified using the 'DeviceName' alias. String @@ -12300,65 +12594,26 @@ Retrieves the update history of the datasource with the display name "My Datasou None - - ProgressAction - - {{ Fill ProgressAction Description }} - - ActionPreference - - ActionPreference - - - None - - - - Get-LMDeviceDatasourceInstanceGroup - - BatchSize - - {{ Fill BatchSize Description }} - - Int32 - - Int32 - - - None - - DatasourceId - - {{ Fill DatasourceId Description }} - - Int32 - - Int32 - - - None - - - Filter + InstanceName - {{ Fill Filter Description }} + Specifies the name of the datasource instance. This parameter is mandatory. - Object + String - Object + String None - Id + DataPointName - {{ Fill Id Description }} + Specifies the name of the data point. This parameter is mandatory. - Int32 + String - Int32 + String None @@ -12377,47 +12632,11 @@ Retrieves the update history of the datasource with the display name "My Datasou - Get-LMDeviceDatasourceInstanceGroup - - BatchSize - - {{ Fill BatchSize Description }} - - Int32 - - Int32 - - - None - + Get-LMDeviceDatasourceInstanceAlertRecipients DatasourceName - {{ Fill DatasourceName Description }} - - String - - String - - - None - - - Filter - - {{ Fill Filter Description }} - - Object - - Object - - - None - - - Name - - {{ Fill Name Description }} + Specifies the name of the datasource. This parameter is mandatory when using the 'Id-dsName' or 'Name-dsName' parameter sets. String @@ -12426,37 +12645,22 @@ Retrieves the update history of the datasource with the display name "My Datasou None - - ProgressAction - - {{ Fill ProgressAction Description }} - - ActionPreference - - ActionPreference - - - None - - - - Get-LMDeviceDatasourceInstanceGroup - - BatchSize + + Id - {{ Fill BatchSize Description }} + Specifies the ID of the device. This parameter is mandatory when using the 'Id-dsId' or 'Id-dsName' parameter sets. It can also be specified using the 'DeviceId' alias. Int32 Int32 - None + 0 - DatasourceName + InstanceName - {{ Fill DatasourceName Description }} + Specifies the name of the datasource instance. This parameter is mandatory. String @@ -12465,26 +12669,14 @@ Retrieves the update history of the datasource with the display name "My Datasou None - - Filter - - {{ Fill Filter Description }} - - Object - - Object - - - None - - Id + DataPointName - {{ Fill Id Description }} + Specifies the name of the data point. This parameter is mandatory. - Int32 + String - Int32 + String None @@ -12503,35 +12695,35 @@ Retrieves the update history of the datasource with the display name "My Datasou - Get-LMDeviceDatasourceInstanceGroup - - BatchSize + Get-LMDeviceDatasourceInstanceAlertRecipients + + DatasourceId - {{ Fill BatchSize Description }} + Specifies the ID of the datasource. This parameter is mandatory when using the 'Id-dsId' or 'Name-dsId' parameter sets. Int32 Int32 - None + 0 - - Filter + + Name - {{ Fill Filter Description }} + Specifies the name of the device. This parameter is mandatory when using the 'Name-dsName' or 'Name-dsId' parameter sets. It can also be specified using the 'DeviceName' alias. - Object + String - Object + String None - HdsId + InstanceName - {{ Fill HdsId Description }} + Specifies the name of the datasource instance. This parameter is mandatory. String @@ -12541,13 +12733,13 @@ Retrieves the update history of the datasource with the display name "My Datasou None - Id + DataPointName - {{ Fill Id Description }} + Specifies the name of the data point. This parameter is mandatory. - Int32 + String - Int32 + String None @@ -12566,35 +12758,35 @@ Retrieves the update history of the datasource with the display name "My Datasou - Get-LMDeviceDatasourceInstanceGroup - - BatchSize + Get-LMDeviceDatasourceInstanceAlertRecipients + + DatasourceId - {{ Fill BatchSize Description }} + Specifies the ID of the datasource. This parameter is mandatory when using the 'Id-dsId' or 'Name-dsId' parameter sets. Int32 Int32 - None + 0 - - Filter + + Id - {{ Fill Filter Description }} + Specifies the ID of the device. This parameter is mandatory when using the 'Id-dsId' or 'Id-dsName' parameter sets. It can also be specified using the 'DeviceId' alias. - Object + Int32 - Object + Int32 - None + 0 - HdsId + InstanceName - {{ Fill HdsId Description }} + Specifies the name of the datasource instance. This parameter is mandatory. String @@ -12604,9 +12796,9 @@ Retrieves the update history of the datasource with the display name "My Datasou None - Name + DataPointName - {{ Fill Name Description }} + Specifies the name of the data point. This parameter is mandatory. String @@ -12630,14 +12822,14 @@ Retrieves the update history of the datasource with the display name "My Datasou - - BatchSize + + DatasourceName - {{ Fill BatchSize Description }} + Specifies the name of the datasource. This parameter is mandatory when using the 'Id-dsName' or 'Name-dsName' parameter sets. - Int32 + String - Int32 + String None @@ -12645,43 +12837,31 @@ Retrieves the update history of the datasource with the display name "My Datasou DatasourceId - {{ Fill DatasourceId Description }} + Specifies the ID of the datasource. This parameter is mandatory when using the 'Id-dsId' or 'Name-dsId' parameter sets. Int32 Int32 - None - - - DatasourceName - - {{ Fill DatasourceName Description }} - - String - - String - - - None + 0 - - Filter + + Id - {{ Fill Filter Description }} + Specifies the ID of the device. This parameter is mandatory when using the 'Id-dsId' or 'Id-dsName' parameter sets. It can also be specified using the 'DeviceId' alias. - Object + Int32 - Object + Int32 - None + 0 - - HdsId + + Name - {{ Fill HdsId Description }} + Specifies the name of the device. This parameter is mandatory when using the 'Name-dsName' or 'Name-dsId' parameter sets. It can also be specified using the 'DeviceName' alias. String @@ -12691,21 +12871,21 @@ Retrieves the update history of the datasource with the display name "My Datasou None - Id + InstanceName - {{ Fill Id Description }} + Specifies the name of the datasource instance. This parameter is mandatory. - Int32 + String - Int32 + String None - Name + DataPointName - {{ Fill Name Description }} + Specifies the name of the data point. This parameter is mandatory. String @@ -12727,26 +12907,8 @@ Retrieves the update history of the datasource with the display name "My Datasou None - - - - None - - - - - - - - - - System.Object - - - - - - + + @@ -12754,10 +12916,17 @@ Retrieves the update history of the datasource with the display name "My Datasou - -------------------------- Example 1 -------------------------- - PS C:\> {{ Add example code here }} + -------------------------- EXAMPLE 1 -------------------------- + Get-LMDeviceDatasourceInstanceAlertRecipients -DatasourceName "Ping-" -Name "Server01" -InstanceName "Instance01" -DataPointName "PingLossPercent" - {{ Add example description here }} + Retrieves the alert recipients for the "PingLossPercent" data point in the "CPU" datasource instance of the "Server01" device. + + + + -------------------------- EXAMPLE 2 -------------------------- + Get-LMDeviceDatasourceInstanceAlertRecipients -DatasourceId 123 -Id 456 -InstanceName "Instance01" -DataPointName "PingLossPercent" + + Retrieves the alert recipients for the "PingLossPercent" data point in the datasource instance with ID 123 of the device with ID 456. @@ -12765,27 +12934,51 @@ Retrieves the update history of the datasource with the display name "My Datasou - Get-LMDeviceDatasourceList + Get-LMDeviceDatasourceInstanceAlertSetting Get - LMDeviceDatasourceList + LMDeviceDatasourceInstanceAlertSetting - {{ Fill in the Synopsis }} + Retrieves the alert settings for a specific LogicMonitor device datasource instance. - {{ Fill in the Description }} + The Get-LMDeviceDatasourceInstanceAlertSetting function retrieves the alert settings for a specific LogicMonitor device datasource instance. It requires the device name or ID, datasource name or ID, and instance name as input parameters. Optionally, you can also provide a filter to narrow down the results. The function returns an array of alert settings for the specified instance. - Get-LMDeviceDatasourceList - - BatchSize + Get-LMDeviceDatasourceInstanceAlertSetting + + DatasourceName - {{ Fill BatchSize Description }} + Specifies the name of the datasource. This parameter is mandatory when using the 'Id-dsName' or 'Name-dsName' parameter set. - Int32 + String - Int32 + String + + + None + + + Name + + Specifies the name of the device. This parameter is mandatory when using the 'Name-dsName' or 'Name-dsId' parameter set. This parameter can also be specified using the 'DeviceName' alias. + + String + + String + + + None + + + InstanceName + + Specifies the name of the instance for which to retrieve the alert settings. This parameter is mandatory. + + String + + String None @@ -12793,7 +12986,7 @@ Retrieves the update history of the datasource with the display name "My Datasou Filter - {{ Fill Filter Description }} + Specifies a filter to narrow down the results. This parameter is optional. Object @@ -12802,17 +12995,17 @@ Retrieves the update history of the datasource with the display name "My Datasou None - - Id + + BatchSize - {{ Fill Id Description }} + Specifies the number of results to retrieve per batch. The default value is 1000. This parameter is optional. Int32 Int32 - None + 1000 ProgressAction @@ -12828,23 +13021,47 @@ Retrieves the update history of the datasource with the display name "My Datasou - Get-LMDeviceDatasourceList - - BatchSize + Get-LMDeviceDatasourceInstanceAlertSetting + + DatasourceName - {{ Fill BatchSize Description }} + Specifies the name of the datasource. This parameter is mandatory when using the 'Id-dsName' or 'Name-dsName' parameter set. + + String + + String + + + None + + + Id + + Specifies the ID of the device. This parameter is mandatory when using the 'Id-dsId' or 'Id-dsName' parameter set. This parameter can also be specified using the 'DeviceId' alias. Int32 Int32 + 0 + + + InstanceName + + Specifies the name of the instance for which to retrieve the alert settings. This parameter is mandatory. + + String + + String + + None Filter - {{ Fill Filter Description }} + Specifies a filter to narrow down the results. This parameter is optional. Object @@ -12854,16 +13071,16 @@ Retrieves the update history of the datasource with the display name "My Datasou None - Name + BatchSize - {{ Fill Name Description }} + Specifies the number of results to retrieve per batch. The default value is 1000. This parameter is optional. - String + Int32 - String + Int32 - None + 1000 ProgressAction @@ -12878,136 +13095,48 @@ Retrieves the update history of the datasource with the display name "My Datasou None - - - - BatchSize - - {{ Fill BatchSize Description }} - - Int32 - - Int32 - - - None - - - Filter - - {{ Fill Filter Description }} - - Object - - Object - - - None - - - Id - - {{ Fill Id Description }} - - Int32 - - Int32 - - - None - - - Name - - {{ Fill Name Description }} - - String - - String - - - None - - - ProgressAction - - {{ Fill ProgressAction Description }} - - ActionPreference - - ActionPreference - - - None - - - - - - None - - - - - - - - - - System.Object - - - - - - - - - - - - - - -------------------------- Example 1 -------------------------- - PS C:\> {{ Add example code here }} - - {{ Add example description here }} - - - - - - - - Get-LMDeviceEventSourceList - Get - LMDeviceEventSourceList - - {{ Fill in the Synopsis }} - - - - {{ Fill in the Description }} - - - Get-LMDeviceEventSourceList - - BatchSize + Get-LMDeviceDatasourceInstanceAlertSetting + + DatasourceId - {{ Fill BatchSize Description }} + Specifies the ID of the datasource. This parameter is mandatory when using the 'Id-dsId' or 'Name-dsId' parameter set. Int32 Int32 + 0 + + + Name + + Specifies the name of the device. This parameter is mandatory when using the 'Name-dsName' or 'Name-dsId' parameter set. This parameter can also be specified using the 'DeviceName' alias. + + String + + String + + + None + + + InstanceName + + Specifies the name of the instance for which to retrieve the alert settings. This parameter is mandatory. + + String + + String + + None Filter - {{ Fill Filter Description }} + Specifies a filter to narrow down the results. This parameter is optional. Object @@ -13016,17 +13145,17 @@ Retrieves the update history of the datasource with the display name "My Datasou None - - Id + + BatchSize - {{ Fill Id Description }} + Specifies the number of results to retrieve per batch. The default value is 1000. This parameter is optional. Int32 Int32 - None + 1000 ProgressAction @@ -13042,23 +13171,47 @@ Retrieves the update history of the datasource with the display name "My Datasou - Get-LMDeviceEventSourceList - - BatchSize + Get-LMDeviceDatasourceInstanceAlertSetting + + DatasourceId - {{ Fill BatchSize Description }} + Specifies the ID of the datasource. This parameter is mandatory when using the 'Id-dsId' or 'Name-dsId' parameter set. + + Int32 + + Int32 + + + 0 + + + Id + + Specifies the ID of the device. This parameter is mandatory when using the 'Id-dsId' or 'Id-dsName' parameter set. This parameter can also be specified using the 'DeviceId' alias. Int32 Int32 + 0 + + + InstanceName + + Specifies the name of the instance for which to retrieve the alert settings. This parameter is mandatory. + + String + + String + + None Filter - {{ Fill Filter Description }} + Specifies a filter to narrow down the results. This parameter is optional. Object @@ -13068,16 +13221,16 @@ Retrieves the update history of the datasource with the display name "My Datasou None - Name + BatchSize - {{ Fill Name Description }} + Specifies the number of results to retrieve per batch. The default value is 1000. This parameter is optional. - String + Int32 - String + Int32 - None + 1000 ProgressAction @@ -13094,46 +13247,46 @@ Retrieves the update history of the datasource with the display name "My Datasou - - BatchSize + + DatasourceName - {{ Fill BatchSize Description }} + Specifies the name of the datasource. This parameter is mandatory when using the 'Id-dsName' or 'Name-dsName' parameter set. - Int32 + String - Int32 + String None - - Filter + + DatasourceId - {{ Fill Filter Description }} + Specifies the ID of the datasource. This parameter is mandatory when using the 'Id-dsId' or 'Name-dsId' parameter set. - Object + Int32 - Object + Int32 - None + 0 - + Id - {{ Fill Id Description }} + Specifies the ID of the device. This parameter is mandatory when using the 'Id-dsId' or 'Id-dsName' parameter set. This parameter can also be specified using the 'DeviceId' alias. Int32 Int32 - None + 0 - + Name - {{ Fill Name Description }} + Specifies the name of the device. This parameter is mandatory when using the 'Name-dsName' or 'Name-dsId' parameter set. This parameter can also be specified using the 'DeviceName' alias. String @@ -13142,50 +13295,77 @@ Retrieves the update history of the datasource with the display name "My Datasou None - - ProgressAction + + InstanceName - {{ Fill ProgressAction Description }} + Specifies the name of the instance for which to retrieve the alert settings. This parameter is mandatory. - ActionPreference + String - ActionPreference + String None - - - + + Filter + + Specifies a filter to narrow down the results. This parameter is optional. + + Object - None + Object + + None + + + BatchSize - + Specifies the number of results to retrieve per batch. The default value is 1000. This parameter is optional. - - - - + Int32 - System.Object + Int32 + + 1000 + + + ProgressAction - + {{ Fill ProgressAction Description }} - - + ActionPreference + + ActionPreference + + + None + + + + - + This function requires a valid LogicMonitor API authentication. Make sure you are logged in before running any commands by using the Connect-LMAccount function. - -------------------------- Example 1 -------------------------- - PS C:\> {{ Add example code here }} + -------------------------- EXAMPLE 1 -------------------------- + Get-LMDeviceDatasourceInstanceAlertSetting -Name "MyDevice" -DatasourceName "MyDatasource" -InstanceName "MyInstance" +Retrieves the alert settings for the instance named "MyInstance" of the datasource "MyDatasource" on the device named "MyDevice". - {{ Add example description here }} + + + + + -------------------------- EXAMPLE 2 -------------------------- + Get-LMDeviceDatasourceInstanceAlertSetting -Id 123 -DatasourceId 456 -InstanceName "MyInstance" -Filter "Property -eq 'value'" +Retrieves the alert settings for the instance named "MyInstance" of the datasource with ID 456 on the device with ID 123, applying the specified filter. + + @@ -13193,42 +13373,66 @@ Retrieves the update history of the datasource with the display name "My Datasou - Get-LMDeviceGroup + Get-LMDeviceDatasourceInstanceGroup Get - LMDeviceGroup + LMDeviceDatasourceInstanceGroup - Get device group info from a connected LM portal + {{ Fill in the Synopsis }} - Get device group info from a connected LM portal + {{ Fill in the Description }} - Get-LMDeviceGroup - - Id + Get-LMDeviceDatasourceInstanceGroup + + BatchSize - The device group id for a device group in LM. + {{ Fill BatchSize Description }} Int32 Int32 - 0 + None - - BatchSize + + DatasourceId - The return size for each request, this value if not specified defaults to 1000. If a result would return 1001 and items, two requests would be made to return the full set. + {{ Fill DatasourceId Description }} Int32 Int32 - 1000 + None + + + Filter + + {{ Fill Filter Description }} + + Object + + Object + + + None + + + Name + + {{ Fill Name Description }} + + String + + String + + + None ProgressAction @@ -13244,30 +13448,54 @@ Retrieves the update history of the datasource with the display name "My Datasou - Get-LMDeviceGroup + Get-LMDeviceDatasourceInstanceGroup - Name + BatchSize - The name value for a device group in LM. This value accepts wildcard input such as "* - Servers" + {{ Fill BatchSize Description }} - String + Int32 - String + Int32 + + + None + + + DatasourceId + + {{ Fill DatasourceId Description }} + + Int32 + + Int32 None - BatchSize + Filter - The return size for each request, this value if not specified defaults to 1000. If a result would return 1001 and items, two requests would be made to return the full set. + {{ Fill Filter Description }} + + Object + + Object + + + None + + + Id + + {{ Fill Id Description }} Int32 Int32 - 1000 + None ProgressAction @@ -13283,12 +13511,35 @@ Retrieves the update history of the datasource with the display name "My Datasou - Get-LMDeviceGroup + Get-LMDeviceDatasourceInstanceGroup + + BatchSize + + {{ Fill BatchSize Description }} + + Int32 + + Int32 + + + None + + + DatasourceName + + {{ Fill DatasourceName Description }} + + String + + String + + + None + Filter - A hashtable of additional filter properties to include with request. All properties are treated as if using the equals ":" operator. When using multiple filters they are combined as AND conditions. - An example Filter to get devices with alerting enabled and where the parent group id equals 1: @{parentId=1;disableAlerting=$false} + {{ Fill Filter Description }} Object @@ -13297,17 +13548,17 @@ Retrieves the update history of the datasource with the display name "My Datasou None - - BatchSize + + Name - The return size for each request, this value if not specified defaults to 1000. If a result would return 1001 and items, two requests would be made to return the full set. + {{ Fill Name Description }} - Int32 + String - Int32 + String - 1000 + None ProgressAction @@ -13322,106 +13573,8 @@ Retrieves the update history of the datasource with the display name "My Datasou None - - - - Id - - The device group id for a device group in LM. - - Int32 - - Int32 - - - 0 - - - Name - - The name value for a device group in LM. This value accepts wildcard input such as "* - Servers" - - String - - String - - - None - - - Filter - - A hashtable of additional filter properties to include with request. All properties are treated as if using the equals ":" operator. When using multiple filters they are combined as AND conditions. - An example Filter to get devices with alerting enabled and where the parent group id equals 1: @{parentId=1;disableAlerting=$false} - - Object - - Object - - - None - - - BatchSize - - The return size for each request, this value if not specified defaults to 1000. If a result would return 1001 and items, two requests would be made to return the full set. - - Int32 - - Int32 - - - 1000 - - - ProgressAction - - {{ Fill ProgressAction Description }} - - ActionPreference - - ActionPreference - - - None - - - - - - - Consult the LM API docs for a list of allowed fields when using filter parameter as all fields are not available for use with filtering. - - - - - -------------------------- EXAMPLE 1 -------------------------- - Get all device groups: - Get-LMDeviceGroup - - Get specific device group: Get-LMDeviceGroup -Id 1 Get-LMDeviceGroup -Name "Locations" - Get multiple device groups using wildcards: Get-LMDeviceGroup -Name "* - Servers" - Get device groups using a custom filter: Get-LMDeviceGroup -Filter "parentId -eq '1' -and disableAlerting -eq '$false'" - - - - - - - - Get-LMDeviceGroupAlerts - Get - LMDeviceGroupAlerts - - {{ Fill in the Synopsis }} - - - - {{ Fill in the Description }} - - - Get-LMDeviceGroupAlerts + Get-LMDeviceDatasourceInstanceGroup BatchSize @@ -13434,6 +13587,18 @@ Retrieves the update history of the datasource with the display name "My Datasou None + + DatasourceName + + {{ Fill DatasourceName Description }} + + String + + String + + + None + Filter @@ -13446,7 +13611,7 @@ Retrieves the update history of the datasource with the display name "My Datasou None - + Id {{ Fill Id Description }} @@ -13472,7 +13637,7 @@ Retrieves the update history of the datasource with the display name "My Datasou - Get-LMDeviceGroupAlerts + Get-LMDeviceDatasourceInstanceGroup BatchSize @@ -13497,10 +13662,10 @@ Retrieves the update history of the datasource with the display name "My Datasou None - - Name + + HdsId - {{ Fill Name Description }} + {{ Fill HdsId Description }} String @@ -13509,6 +13674,18 @@ Retrieves the update history of the datasource with the display name "My Datasou None + + Id + + {{ Fill Id Description }} + + Int32 + + Int32 + + + None + ProgressAction @@ -13522,9 +13699,72 @@ Retrieves the update history of the datasource with the display name "My Datasou None - - - + + Get-LMDeviceDatasourceInstanceGroup + + BatchSize + + {{ Fill BatchSize Description }} + + Int32 + + Int32 + + + None + + + Filter + + {{ Fill Filter Description }} + + Object + + Object + + + None + + + HdsId + + {{ Fill HdsId Description }} + + String + + String + + + None + + + Name + + {{ Fill Name Description }} + + String + + String + + + None + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + + BatchSize {{ Fill BatchSize Description }} @@ -13536,6 +13776,30 @@ Retrieves the update history of the datasource with the display name "My Datasou None + + DatasourceId + + {{ Fill DatasourceId Description }} + + Int32 + + Int32 + + + None + + + DatasourceName + + {{ Fill DatasourceName Description }} + + String + + String + + + None + Filter @@ -13548,7 +13812,19 @@ Retrieves the update history of the datasource with the display name "My Datasou None - + + HdsId + + {{ Fill HdsId Description }} + + String + + String + + + None + + Id {{ Fill Id Description }} @@ -13560,7 +13836,7 @@ Retrieves the update history of the datasource with the display name "My Datasou None - + Name {{ Fill Name Description }} @@ -13588,7 +13864,7 @@ Retrieves the update history of the datasource with the display name "My Datasou - System.Int32 + None @@ -13623,9 +13899,9 @@ Retrieves the update history of the datasource with the display name "My Datasou - Get-LMDeviceGroupDatasourceAlertSetting + Get-LMDeviceDatasourceList Get - LMDeviceGroupDatasourceAlertSetting + LMDeviceDatasourceList {{ Fill in the Synopsis }} @@ -13635,70 +13911,7 @@ Retrieves the update history of the datasource with the display name "My Datasou - Get-LMDeviceGroupDatasourceAlertSetting - - BatchSize - - {{ Fill BatchSize Description }} - - Int32 - - Int32 - - - None - - - DatasourceId - - {{ Fill DatasourceId Description }} - - Int32 - - Int32 - - - None - - - Filter - - {{ Fill Filter Description }} - - Object - - Object - - - None - - - Name - - {{ Fill Name Description }} - - String - - String - - - None - - - ProgressAction - - {{ Fill ProgressAction Description }} - - ActionPreference - - ActionPreference - - - None - - - - Get-LMDeviceGroupDatasourceAlertSetting + Get-LMDeviceDatasourceList BatchSize @@ -13711,18 +13924,6 @@ Retrieves the update history of the datasource with the display name "My Datasou None - - DatasourceId - - {{ Fill DatasourceId Description }} - - Int32 - - Int32 - - - None - Filter @@ -13735,7 +13936,7 @@ Retrieves the update history of the datasource with the display name "My Datasou None - + Id {{ Fill Id Description }} @@ -13761,7 +13962,7 @@ Retrieves the update history of the datasource with the display name "My Datasou - Get-LMDeviceGroupDatasourceAlertSetting + Get-LMDeviceDatasourceList BatchSize @@ -13774,18 +13975,6 @@ Retrieves the update history of the datasource with the display name "My Datasou None - - DatasourceName - - {{ Fill DatasourceName Description }} - - String - - String - - - None - Filter @@ -13798,7 +13987,7 @@ Retrieves the update history of the datasource with the display name "My Datasou None - + Name {{ Fill Name Description }} @@ -13823,69 +14012,6 @@ Retrieves the update history of the datasource with the display name "My Datasou None - - Get-LMDeviceGroupDatasourceAlertSetting - - BatchSize - - {{ Fill BatchSize Description }} - - Int32 - - Int32 - - - None - - - DatasourceName - - {{ Fill DatasourceName Description }} - - String - - String - - - None - - - Filter - - {{ Fill Filter Description }} - - Object - - Object - - - None - - - Id - - {{ Fill Id Description }} - - Int32 - - Int32 - - - None - - - ProgressAction - - {{ Fill ProgressAction Description }} - - ActionPreference - - ActionPreference - - - None - - @@ -13900,30 +14026,6 @@ Retrieves the update history of the datasource with the display name "My Datasou None - - DatasourceId - - {{ Fill DatasourceId Description }} - - Int32 - - Int32 - - - None - - - DatasourceName - - {{ Fill DatasourceName Description }} - - String - - String - - - None - Filter @@ -13936,7 +14038,7 @@ Retrieves the update history of the datasource with the display name "My Datasou None - + Id {{ Fill Id Description }} @@ -13948,7 +14050,7 @@ Retrieves the update history of the datasource with the display name "My Datasou None - + Name {{ Fill Name Description }} @@ -14011,9 +14113,9 @@ Retrieves the update history of the datasource with the display name "My Datasou - Get-LMDeviceGroupDatasourceList + Get-LMDeviceEventSourceList Get - LMDeviceGroupDatasourceList + LMDeviceEventSourceList {{ Fill in the Synopsis }} @@ -14023,7 +14125,7 @@ Retrieves the update history of the datasource with the display name "My Datasou - Get-LMDeviceGroupDatasourceList + Get-LMDeviceEventSourceList BatchSize @@ -14074,7 +14176,7 @@ Retrieves the update history of the datasource with the display name "My Datasou - Get-LMDeviceGroupDatasourceList + Get-LMDeviceEventSourceList BatchSize @@ -14099,7 +14201,7 @@ Retrieves the update history of the datasource with the display name "My Datasou None - + Name {{ Fill Name Description }} @@ -14162,7 +14264,7 @@ Retrieves the update history of the datasource with the display name "My Datasou None - + Name {{ Fill Name Description }} @@ -14225,66 +14327,42 @@ Retrieves the update history of the datasource with the display name "My Datasou - Get-LMDeviceGroupDevices + Get-LMDeviceGroup Get - LMDeviceGroupDevices + LMDeviceGroup - {{ Fill in the Synopsis }} + Get device group info from a connected LM portal - {{ Fill in the Description }} + Get device group info from a connected LM portal - Get-LMDeviceGroupDevices - - BatchSize + Get-LMDeviceGroup + + Id - {{ Fill BatchSize Description }} + The device group id for a device group in LM. Int32 Int32 - None + 0 - Filter - - {{ Fill Filter Description }} - - Object - - Object - - - None - - - Id + BatchSize - {{ Fill Id Description }} + The return size for each request, this value if not specified defaults to 1000. If a result would return 1001 and items, two requests would be made to return the full set. Int32 Int32 - None - - - IncludeSubGroups - - {{ Fill IncludeSubGroups Description }} - - Boolean - - Boolean - - - None + 1000 ProgressAction @@ -14300,54 +14378,70 @@ Retrieves the update history of the datasource with the display name "My Datasou - Get-LMDeviceGroupDevices + Get-LMDeviceGroup + + Name + + The name value for a device group in LM. This value accepts wildcard input such as "* - Servers" + + String + + String + + + None + BatchSize - {{ Fill BatchSize Description }} + The return size for each request, this value if not specified defaults to 1000. If a result would return 1001 and items, two requests would be made to return the full set. Int32 Int32 - None + 1000 - - Filter + + ProgressAction - {{ Fill Filter Description }} + {{ Fill ProgressAction Description }} - Object + ActionPreference - Object + ActionPreference None + + + Get-LMDeviceGroup - IncludeSubGroups + Filter - {{ Fill IncludeSubGroups Description }} + A hashtable of additional filter properties to include with request. All properties are treated as if using the equals ":" operator. When using multiple filters they are combined as AND conditions. + An example Filter to get devices with alerting enabled and where the parent group id equals 1: @{parentId=1;disableAlerting=$false} - Boolean + Object - Boolean + Object None - Name + BatchSize - {{ Fill Name Description }} + The return size for each request, this value if not specified defaults to 1000. If a result would return 1001 and items, two requests would be made to return the full set. - String + Int32 - String + Int32 - None + 1000 ProgressAction @@ -14364,65 +14458,54 @@ Retrieves the update history of the datasource with the display name "My Datasou - - BatchSize + + Id - {{ Fill BatchSize Description }} + The device group id for a device group in LM. Int32 Int32 - None + 0 - Filter - - {{ Fill Filter Description }} - - Object - - Object - - - None - - - Id + Name - {{ Fill Id Description }} + The name value for a device group in LM. This value accepts wildcard input such as "* - Servers" - Int32 + String - Int32 + String None - IncludeSubGroups + Filter - {{ Fill IncludeSubGroups Description }} + A hashtable of additional filter properties to include with request. All properties are treated as if using the equals ":" operator. When using multiple filters they are combined as AND conditions. + An example Filter to get devices with alerting enabled and where the parent group id equals 1: @{parentId=1;disableAlerting=$false} - Boolean + Object - Boolean + Object None - Name + BatchSize - {{ Fill Name Description }} + The return size for each request, this value if not specified defaults to 1000. If a result would return 1001 and items, two requests would be made to return the full set. - String + Int32 - String + Int32 - None + 1000 ProgressAction @@ -14437,37 +14520,22 @@ Retrieves the update history of the datasource with the display name "My Datasou None - - - - None - - - - - - - - - - System.Object - - - - - - + + - + Consult the LM API docs for a list of allowed fields when using filter parameter as all fields are not available for use with filtering. - -------------------------- Example 1 -------------------------- - PS C:\> {{ Add example code here }} + -------------------------- EXAMPLE 1 -------------------------- + Get all device groups: + Get-LMDeviceGroup - {{ Add example description here }} + Get specific device group: Get-LMDeviceGroup -Id 1 Get-LMDeviceGroup -Name "Locations" + Get multiple device groups using wildcards: Get-LMDeviceGroup -Name "* - Servers" + Get device groups using a custom filter: Get-LMDeviceGroup -Filter "parentId -eq '1' -and disableAlerting -eq '$false'" @@ -14475,9 +14543,9 @@ Retrieves the update history of the datasource with the display name "My Datasou - Get-LMDeviceGroupGroups + Get-LMDeviceGroupAlerts Get - LMDeviceGroupGroups + LMDeviceGroupAlerts {{ Fill in the Synopsis }} @@ -14487,7 +14555,7 @@ Retrieves the update history of the datasource with the display name "My Datasou - Get-LMDeviceGroupGroups + Get-LMDeviceGroupAlerts BatchSize @@ -14512,7 +14580,7 @@ Retrieves the update history of the datasource with the display name "My Datasou None - + Id {{ Fill Id Description }} @@ -14538,7 +14606,7 @@ Retrieves the update history of the datasource with the display name "My Datasou - Get-LMDeviceGroupGroups + Get-LMDeviceGroupAlerts BatchSize @@ -14614,7 +14682,7 @@ Retrieves the update history of the datasource with the display name "My Datasou None - + Id {{ Fill Id Description }} @@ -14654,7 +14722,7 @@ Retrieves the update history of the datasource with the display name "My Datasou - None + System.Int32 @@ -14689,9 +14757,9 @@ Retrieves the update history of the datasource with the display name "My Datasou - Get-LMDeviceGroupProperty + Get-LMDeviceGroupDatasourceAlertSetting Get - LMDeviceGroupProperty + LMDeviceGroupDatasourceAlertSetting {{ Fill in the Synopsis }} @@ -14701,7 +14769,7 @@ Retrieves the update history of the datasource with the display name "My Datasou - Get-LMDeviceGroupProperty + Get-LMDeviceGroupDatasourceAlertSetting BatchSize @@ -14714,6 +14782,81 @@ Retrieves the update history of the datasource with the display name "My Datasou None + + DatasourceId + + {{ Fill DatasourceId Description }} + + Int32 + + Int32 + + + None + + + Filter + + {{ Fill Filter Description }} + + Object + + Object + + + None + + + Name + + {{ Fill Name Description }} + + String + + String + + + None + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + Get-LMDeviceGroupDatasourceAlertSetting + + BatchSize + + {{ Fill BatchSize Description }} + + Int32 + + Int32 + + + None + + + DatasourceId + + {{ Fill DatasourceId Description }} + + Int32 + + Int32 + + + None + Filter @@ -14752,7 +14895,7 @@ Retrieves the update history of the datasource with the display name "My Datasou - Get-LMDeviceGroupProperty + Get-LMDeviceGroupDatasourceAlertSetting BatchSize @@ -14765,6 +14908,18 @@ Retrieves the update history of the datasource with the display name "My Datasou None + + DatasourceName + + {{ Fill DatasourceName Description }} + + String + + String + + + None + Filter @@ -14777,7 +14932,7 @@ Retrieves the update history of the datasource with the display name "My Datasou None - + Name {{ Fill Name Description }} @@ -14802,6 +14957,69 @@ Retrieves the update history of the datasource with the display name "My Datasou None + + Get-LMDeviceGroupDatasourceAlertSetting + + BatchSize + + {{ Fill BatchSize Description }} + + Int32 + + Int32 + + + None + + + DatasourceName + + {{ Fill DatasourceName Description }} + + String + + String + + + None + + + Filter + + {{ Fill Filter Description }} + + Object + + Object + + + None + + + Id + + {{ Fill Id Description }} + + Int32 + + Int32 + + + None + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + @@ -14816,6 +15034,30 @@ Retrieves the update history of the datasource with the display name "My Datasou None + + DatasourceId + + {{ Fill DatasourceId Description }} + + Int32 + + Int32 + + + None + + + DatasourceName + + {{ Fill DatasourceName Description }} + + String + + String + + + None + Filter @@ -14840,7 +15082,7 @@ Retrieves the update history of the datasource with the display name "My Datasou None - + Name {{ Fill Name Description }} @@ -14903,9 +15145,9 @@ Retrieves the update history of the datasource with the display name "My Datasou - Get-LMDeviceGroupSDT + Get-LMDeviceGroupDatasourceList Get - LMDeviceGroupSDT + LMDeviceGroupDatasourceList {{ Fill in the Synopsis }} @@ -14915,7 +15157,7 @@ Retrieves the update history of the datasource with the display name "My Datasou - Get-LMDeviceGroupSDT + Get-LMDeviceGroupDatasourceList BatchSize @@ -14966,7 +15208,7 @@ Retrieves the update history of the datasource with the display name "My Datasou - Get-LMDeviceGroupSDT + Get-LMDeviceGroupDatasourceList BatchSize @@ -14991,7 +15233,7 @@ Retrieves the update history of the datasource with the display name "My Datasou None - + Name {{ Fill Name Description }} @@ -15054,7 +15296,7 @@ Retrieves the update history of the datasource with the display name "My Datasou None - + Name {{ Fill Name Description }} @@ -15117,9 +15359,9 @@ Retrieves the update history of the datasource with the display name "My Datasou - Get-LMDeviceGroupSDTHistory + Get-LMDeviceGroupDevices Get - LMDeviceGroupSDTHistory + LMDeviceGroupDevices {{ Fill in the Synopsis }} @@ -15129,7 +15371,7 @@ Retrieves the update history of the datasource with the display name "My Datasou - Get-LMDeviceGroupSDTHistory + Get-LMDeviceGroupDevices BatchSize @@ -15166,6 +15408,18 @@ Retrieves the update history of the datasource with the display name "My Datasou None + + IncludeSubGroups + + {{ Fill IncludeSubGroups Description }} + + Boolean + + Boolean + + + None + ProgressAction @@ -15180,7 +15434,7 @@ Retrieves the update history of the datasource with the display name "My Datasou - Get-LMDeviceGroupSDTHistory + Get-LMDeviceGroupDevices BatchSize @@ -15205,6 +15459,18 @@ Retrieves the update history of the datasource with the display name "My Datasou None + + IncludeSubGroups + + {{ Fill IncludeSubGroups Description }} + + Boolean + + Boolean + + + None + Name @@ -15268,6 +15534,18 @@ Retrieves the update history of the datasource with the display name "My Datasou None + + IncludeSubGroups + + {{ Fill IncludeSubGroups Description }} + + Boolean + + Boolean + + + None + Name @@ -15331,78 +15609,105 @@ Retrieves the update history of the datasource with the display name "My Datasou - Get-LMDeviceInstanceData + Get-LMDeviceGroupGroups Get - LMDeviceInstanceData + LMDeviceGroupGroups - Retrieves data for LogicMonitor device instances. + {{ Fill in the Synopsis }} - The Get-LMDeviceInstanceData function retrieves data for LogicMonitor device instances based on the specified parameters. + {{ Fill in the Description }} - Get-LMDeviceInstanceData - - StartDate + Get-LMDeviceGroupGroups + + BatchSize - The start date for the data retrieval. If not specified, the function uses the default value of 24 hours ago which is the max timeframe for this endpoint. + {{ Fill BatchSize Description }} - DateTime + Int32 - DateTime + Int32 None - - EndDate + + Filter - The end date for the data retrieval. If not specified, the function uses the current date and time. + {{ Fill Filter Description }} - DateTime + Object - DateTime + Object None - - Ids + + Id - The array of device instance IDs for which to retrieve data. This parameter is mandatory. + {{ Fill Id Description }} - String[] + Int32 - String[] + Int32 None - - AggregationType + + ProgressAction - The type of aggregation to apply to the retrieved data. Valid values are "first", "last", "min", "max", "sum", "average", and "none". The default value is "none". + {{ Fill ProgressAction Description }} - String + ActionPreference - String + ActionPreference None - - Period + + + Get-LMDeviceGroupGroups + + BatchSize - The period for the data retrieval. The default value is 1. + {{ Fill BatchSize Description }} - Double + Int32 - Double + Int32 - 1 + None + + + Filter + + {{ Fill Filter Description }} + + Object + + Object + + + None + + + Name + + {{ Fill Name Description }} + + String + + String + + + None ProgressAction @@ -15419,46 +15724,46 @@ Retrieves the update history of the datasource with the display name "My Datasou - - StartDate + + BatchSize - The start date for the data retrieval. If not specified, the function uses the default value of 24 hours ago which is the max timeframe for this endpoint. + {{ Fill BatchSize Description }} - DateTime + Int32 - DateTime + Int32 None - - EndDate + + Filter - The end date for the data retrieval. If not specified, the function uses the current date and time. + {{ Fill Filter Description }} - DateTime + Object - DateTime + Object None - - Ids + + Id - The array of device instance IDs for which to retrieve data. This parameter is mandatory. + {{ Fill Id Description }} - String[] + Int32 - String[] + Int32 None - - AggregationType + + Name - The type of aggregation to apply to the retrieved data. Valid values are "first", "last", "min", "max", "sum", "average", and "none". The default value is "none". + {{ Fill Name Description }} String @@ -15467,18 +15772,6 @@ Retrieves the update history of the datasource with the display name "My Datasou None - - Period - - The period for the data retrieval. The default value is 1. - - Double - - Double - - - 1 - ProgressAction @@ -15492,20 +15785,37 @@ Retrieves the update history of the datasource with the display name "My Datasou None - - + + + + None + + + + + + + + + + System.Object + + + + + + - This function requires a valid LogicMonitor API authentication. Make sure to log in using Connect-LMAccount before running this command. + - -------------------------- EXAMPLE 1 -------------------------- - Get-LMDeviceInstanceData -StartDate (Get-Date).AddHours(-7) -EndDate (Get-Date) -Ids "12345", "67890" -AggregationType "average" -Period 1 -Retrieves data for the device instances with IDs "12345" and "67890" for the past 7 hours, using an average aggregation and a period of 1 day. + -------------------------- Example 1 -------------------------- + PS C:\> {{ Add example code here }} - + {{ Add example description here }} @@ -15513,9 +15823,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMDeviceInstanceList + Get-LMDeviceGroupProperty Get - LMDeviceInstanceList + LMDeviceGroupProperty {{ Fill in the Synopsis }} @@ -15525,7 +15835,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMDeviceInstanceList + Get-LMDeviceGroupProperty BatchSize @@ -15538,18 +15848,6 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - CountOnly - - {{ Fill CountOnly Description }} - - Boolean - - Boolean - - - None - Filter @@ -15588,7 +15886,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMDeviceInstanceList + Get-LMDeviceGroupProperty BatchSize @@ -15601,18 +15899,6 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - CountOnly - - {{ Fill CountOnly Description }} - - Boolean - - Boolean - - - None - Filter @@ -15664,18 +15950,6 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - CountOnly - - {{ Fill CountOnly Description }} - - Boolean - - Boolean - - - None - Filter @@ -15763,9 +16037,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMDeviceNetflowEndpoints + Get-LMDeviceGroupSDT Get - LMDeviceNetflowEndpoints + LMDeviceGroupSDT {{ Fill in the Synopsis }} @@ -15775,7 +16049,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMDeviceNetflowEndpoints + Get-LMDeviceGroupSDT BatchSize @@ -15788,18 +16062,6 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - EndDate - - {{ Fill EndDate Description }} - - DateTime - - DateTime - - - None - Filter @@ -15824,18 +16086,6 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - StartDate - - {{ Fill StartDate Description }} - - DateTime - - DateTime - - - None - ProgressAction @@ -15850,7 +16100,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMDeviceNetflowEndpoints + Get-LMDeviceGroupSDT BatchSize @@ -15863,18 +16113,6 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - EndDate - - {{ Fill EndDate Description }} - - DateTime - - DateTime - - - None - Filter @@ -15899,18 +16137,6 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - StartDate - - {{ Fill StartDate Description }} - - DateTime - - DateTime - - - None - ProgressAction @@ -15938,18 +16164,6 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - EndDate - - {{ Fill EndDate Description }} - - DateTime - - DateTime - - - None - Filter @@ -15986,18 +16200,6 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - StartDate - - {{ Fill StartDate Description }} - - DateTime - - DateTime - - - None - ProgressAction @@ -16049,9 +16251,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMDeviceNetflowFlows + Get-LMDeviceGroupSDTHistory Get - LMDeviceNetflowFlows + LMDeviceGroupSDTHistory {{ Fill in the Synopsis }} @@ -16061,7 +16263,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMDeviceNetflowFlows + Get-LMDeviceGroupSDTHistory BatchSize @@ -16074,18 +16276,6 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - EndDate - - {{ Fill EndDate Description }} - - DateTime - - DateTime - - - None - Filter @@ -16110,18 +16300,6 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - StartDate - - {{ Fill StartDate Description }} - - DateTime - - DateTime - - - None - ProgressAction @@ -16136,7 +16314,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMDeviceNetflowFlows + Get-LMDeviceGroupSDTHistory BatchSize @@ -16149,18 +16327,6 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - EndDate - - {{ Fill EndDate Description }} - - DateTime - - DateTime - - - None - Filter @@ -16185,18 +16351,6 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - StartDate - - {{ Fill StartDate Description }} - - DateTime - - DateTime - - - None - ProgressAction @@ -16224,18 +16378,6 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - EndDate - - {{ Fill EndDate Description }} - - DateTime - - DateTime - - - None - Filter @@ -16272,18 +16414,6 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - StartDate - - {{ Fill StartDate Description }} - - DateTime - - DateTime - - - None - ProgressAction @@ -16335,35 +16465,35 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMDeviceNetflowPorts + Get-LMDeviceInstanceData Get - LMDeviceNetflowPorts + LMDeviceInstanceData - {{ Fill in the Synopsis }} + Retrieves data for LogicMonitor device instances. - {{ Fill in the Description }} + The Get-LMDeviceInstanceData function retrieves data for LogicMonitor device instances based on the specified parameters. - Get-LMDeviceNetflowPorts - - BatchSize + Get-LMDeviceInstanceData + + StartDate - {{ Fill BatchSize Description }} + The start date for the data retrieval. If not specified, the function uses the default value of 24 hours ago which is the max timeframe for this endpoint. - Int32 + DateTime - Int32 + DateTime None - + EndDate - {{ Fill EndDate Description }} + The end date for the data retrieval. If not specified, the function uses the current date and time. DateTime @@ -16372,41 +16502,41 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - Filter + + Ids - {{ Fill Filter Description }} + The array of device instance IDs for which to retrieve data. This parameter is mandatory. - Object + String[] - Object + String[] None - - Id + + AggregationType - {{ Fill Id Description }} + The type of aggregation to apply to the retrieved data. Valid values are "first", "last", "min", "max", "sum", "average", and "none". The default value is "none". - Int32 + String - Int32 + String None - - StartDate + + Period - {{ Fill StartDate Description }} + The period for the data retrieval. The default value is 1. - DateTime + Double - DateTime + Double - None + 1 ProgressAction @@ -16421,24 +16551,131 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None + + + + StartDate + + The start date for the data retrieval. If not specified, the function uses the default value of 24 hours ago which is the max timeframe for this endpoint. + + DateTime + + DateTime + + + None + + + EndDate + + The end date for the data retrieval. If not specified, the function uses the current date and time. + + DateTime + + DateTime + + + None + + + Ids + + The array of device instance IDs for which to retrieve data. This parameter is mandatory. + + String[] + + String[] + + + None + + + AggregationType + + The type of aggregation to apply to the retrieved data. Valid values are "first", "last", "min", "max", "sum", "average", and "none". The default value is "none". + + String + + String + + + None + + + Period + + The period for the data retrieval. The default value is 1. + + Double + + Double + + + 1 + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + + + + This function requires a valid LogicMonitor API authentication. Make sure to log in using Connect-LMAccount before running this command. + + + + + -------------------------- EXAMPLE 1 -------------------------- + Get-LMDeviceInstanceData -StartDate (Get-Date).AddHours(-7) -EndDate (Get-Date) -Ids "12345", "67890" -AggregationType "average" -Period 1 +Retrieves data for the device instances with IDs "12345" and "67890" for the past 7 hours, using an average aggregation and a period of 1 day. + + + + + + + + + + Get-LMDeviceInstanceData + Get + LMDeviceInstanceData + + Retrieves data for LogicMonitor device instances. + + + + The Get-LMDeviceInstanceData function retrieves data for LogicMonitor device instances based on the specified parameters. + + - Get-LMDeviceNetflowPorts - - BatchSize + Get-LMDeviceInstanceData + + StartDate - {{ Fill BatchSize Description }} + The start date for the data retrieval. If not specified, the function uses the default value of 24 hours ago which is the max timeframe for this endpoint. - Int32 + DateTime - Int32 + DateTime None - + EndDate - {{ Fill EndDate Description }} + The end date for the data retrieval. If not specified, the function uses the current date and time. DateTime @@ -16447,22 +16684,22 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - Filter + + Ids - {{ Fill Filter Description }} + The array of device instance IDs for which to retrieve data. This parameter is mandatory. - Object + String[] - Object + String[] None - - Name + + AggregationType - {{ Fill Name Description }} + The type of aggregation to apply to the retrieved data. Valid values are "first", "last", "min", "max", "sum", "average", and "none". The default value is "none". String @@ -16471,17 +16708,17 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - StartDate + + Period - {{ Fill StartDate Description }} + The period for the data retrieval. The default value is 1. - DateTime + Double - DateTime + Double - None + 1 ProgressAction @@ -16498,22 +16735,22 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - - BatchSize + + StartDate - {{ Fill BatchSize Description }} + The start date for the data retrieval. If not specified, the function uses the default value of 24 hours ago which is the max timeframe for this endpoint. - Int32 + DateTime - Int32 + DateTime None - + EndDate - {{ Fill EndDate Description }} + The end date for the data retrieval. If not specified, the function uses the current date and time. DateTime @@ -16522,34 +16759,22 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - Filter - - {{ Fill Filter Description }} - - Object - - Object - - - None - - - Id + + Ids - {{ Fill Id Description }} + The array of device instance IDs for which to retrieve data. This parameter is mandatory. - Int32 + String[] - Int32 + String[] None - - Name + + AggregationType - {{ Fill Name Description }} + The type of aggregation to apply to the retrieved data. Valid values are "first", "last", "min", "max", "sum", "average", and "none". The default value is "none". String @@ -16558,17 +16783,17 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - StartDate + + Period - {{ Fill StartDate Description }} + The period for the data retrieval. The default value is 1. - DateTime + Double - DateTime + Double - None + 1 ProgressAction @@ -16583,37 +16808,20 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - - - None - - - - - - - - - - System.Object - - - - - - + + - + This function requires a valid LogicMonitor API authentication. Make sure to log in using Connect-LMAccount before running this command. - -------------------------- Example 1 -------------------------- - PS C:\> {{ Add example code here }} + -------------------------- EXAMPLE 1 -------------------------- + Get-LMDeviceInstanceData -StartDate (Get-Date).AddHours(-7) -EndDate (Get-Date) -Ids "12345", "67890" -AggregationType "average" -Period 1 +Retrieves data for the device instances with IDs "12345" and "67890" for the past 7 hours, using an average aggregation and a period of 1 day. - {{ Add example description here }} + @@ -16621,9 +16829,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMDeviceProperty + Get-LMDeviceInstanceList Get - LMDeviceProperty + LMDeviceInstanceList {{ Fill in the Synopsis }} @@ -16633,7 +16841,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMDeviceProperty + Get-LMDeviceInstanceList BatchSize @@ -16647,13 +16855,13 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - DisplayName + CountOnly - {{ Fill DisplayName Description }} + {{ Fill CountOnly Description }} - String + Boolean - String + Boolean None @@ -16670,14 +16878,14 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - PropertyName + + Id - {{ Fill PropertyName Description }} + {{ Fill Id Description }} - String + Int32 - String + Int32 None @@ -16696,7 +16904,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMDeviceProperty + Get-LMDeviceInstanceList BatchSize @@ -16710,96 +16918,33 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - Filter + CountOnly - {{ Fill Filter Description }} + {{ Fill CountOnly Description }} - Object + Boolean - Object + Boolean None - - Id + + Filter - {{ Fill Id Description }} + {{ Fill Filter Description }} - Int32 + Object - Int32 + Object None - PropertyName + Name - {{ Fill PropertyName Description }} - - String - - String - - - None - - - ProgressAction - - {{ Fill ProgressAction Description }} - - ActionPreference - - ActionPreference - - - None - - - - Get-LMDeviceProperty - - BatchSize - - {{ Fill BatchSize Description }} - - Int32 - - Int32 - - - None - - - Filter - - {{ Fill Filter Description }} - - Object - - Object - - - None - - - Name - - {{ Fill Name Description }} - - String - - String - - - None - - - PropertyName - - {{ Fill PropertyName Description }} + {{ Fill Name Description }} String @@ -16836,13 +16981,13 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - DisplayName + CountOnly - {{ Fill DisplayName Description }} + {{ Fill CountOnly Description }} - String + Boolean - String + Boolean None @@ -16883,18 +17028,6 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - PropertyName - - {{ Fill PropertyName Description }} - - String - - String - - - None - ProgressAction @@ -16946,9 +17079,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMDeviceSDT + Get-LMDeviceNetflowEndpoints Get - LMDeviceSDT + LMDeviceNetflowEndpoints {{ Fill in the Synopsis }} @@ -16958,7 +17091,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMDeviceSDT + Get-LMDeviceNetflowEndpoints BatchSize @@ -16971,6 +17104,18 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None + + EndDate + + {{ Fill EndDate Description }} + + DateTime + + DateTime + + + None + Filter @@ -16995,6 +17140,18 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None + + StartDate + + {{ Fill StartDate Description }} + + DateTime + + DateTime + + + None + ProgressAction @@ -17009,7 +17166,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMDeviceSDT + Get-LMDeviceNetflowEndpoints BatchSize @@ -17022,6 +17179,18 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None + + EndDate + + {{ Fill EndDate Description }} + + DateTime + + DateTime + + + None + Filter @@ -17046,6 +17215,18 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None + + StartDate + + {{ Fill StartDate Description }} + + DateTime + + DateTime + + + None + ProgressAction @@ -17073,6 +17254,18 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None + + EndDate + + {{ Fill EndDate Description }} + + DateTime + + DateTime + + + None + Filter @@ -17109,6 +17302,18 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None + + StartDate + + {{ Fill StartDate Description }} + + DateTime + + DateTime + + + None + ProgressAction @@ -17160,9 +17365,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMDeviceSDTHistory + Get-LMDeviceNetflowFlows Get - LMDeviceSDTHistory + LMDeviceNetflowFlows {{ Fill in the Synopsis }} @@ -17172,7 +17377,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMDeviceSDTHistory + Get-LMDeviceNetflowFlows BatchSize @@ -17185,6 +17390,18 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None + + EndDate + + {{ Fill EndDate Description }} + + DateTime + + DateTime + + + None + Filter @@ -17209,6 +17426,18 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None + + StartDate + + {{ Fill StartDate Description }} + + DateTime + + DateTime + + + None + ProgressAction @@ -17223,7 +17452,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMDeviceSDTHistory + Get-LMDeviceNetflowFlows BatchSize @@ -17236,6 +17465,18 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None + + EndDate + + {{ Fill EndDate Description }} + + DateTime + + DateTime + + + None + Filter @@ -17260,6 +17501,18 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None + + StartDate + + {{ Fill StartDate Description }} + + DateTime + + DateTime + + + None + ProgressAction @@ -17287,6 +17540,18 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None + + EndDate + + {{ Fill EndDate Description }} + + DateTime + + DateTime + + + None + Filter @@ -17323,6 +17588,18 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None + + StartDate + + {{ Fill StartDate Description }} + + DateTime + + DateTime + + + None + ProgressAction @@ -17374,9 +17651,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMEscalationChain + Get-LMDeviceNetflowPorts Get - LMEscalationChain + LMDeviceNetflowPorts {{ Fill in the Synopsis }} @@ -17386,7 +17663,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMEscalationChain + Get-LMDeviceNetflowPorts BatchSize @@ -17400,36 +17677,33 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - Filter + EndDate - {{ Fill Filter Description }} + {{ Fill EndDate Description }} - Object + DateTime - Object + DateTime None - - ProgressAction + + Filter - {{ Fill ProgressAction Description }} + {{ Fill Filter Description }} - ActionPreference + Object - ActionPreference + Object None - - - Get-LMEscalationChain - - BatchSize + + Id - {{ Fill BatchSize Description }} + {{ Fill Id Description }} Int32 @@ -17439,13 +17713,13 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - Id + StartDate - {{ Fill Id Description }} + {{ Fill StartDate Description }} - Int32 + DateTime - Int32 + DateTime None @@ -17464,7 +17738,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMEscalationChain + Get-LMDeviceNetflowPorts BatchSize @@ -17477,6 +17751,30 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None + + EndDate + + {{ Fill EndDate Description }} + + DateTime + + DateTime + + + None + + + Filter + + {{ Fill Filter Description }} + + Object + + Object + + + None + Name @@ -17489,6 +17787,18 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None + + StartDate + + {{ Fill StartDate Description }} + + DateTime + + DateTime + + + None + ProgressAction @@ -17516,6 +17826,18 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None + + EndDate + + {{ Fill EndDate Description }} + + DateTime + + DateTime + + + None + Filter @@ -17528,7 +17850,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - + Id {{ Fill Id Description }} @@ -17552,6 +17874,18 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None + + StartDate + + {{ Fill StartDate Description }} + + DateTime + + DateTime + + + None + ProgressAction @@ -17603,9 +17937,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMEventSource + Get-LMDeviceProperty Get - LMEventSource + LMDeviceProperty {{ Fill in the Synopsis }} @@ -17615,7 +17949,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMEventSource + Get-LMDeviceProperty BatchSize @@ -17628,6 +17962,18 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None + + DisplayName + + {{ Fill DisplayName Description }} + + String + + String + + + None + Filter @@ -17640,6 +17986,18 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None + + PropertyName + + {{ Fill PropertyName Description }} + + String + + String + + + None + ProgressAction @@ -17654,7 +18012,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMEventSource + Get-LMDeviceProperty BatchSize @@ -17668,6 +18026,18 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None + Filter + + {{ Fill Filter Description }} + + Object + + Object + + + None + + Id {{ Fill Id Description }} @@ -17679,6 +18049,18 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None + + PropertyName + + {{ Fill PropertyName Description }} + + String + + String + + + None + ProgressAction @@ -17693,7 +18075,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMEventSource + Get-LMDeviceProperty BatchSize @@ -17706,6 +18088,18 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None + + Filter + + {{ Fill Filter Description }} + + Object + + Object + + + None + Name @@ -17718,6 +18112,18 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None + + PropertyName + + {{ Fill PropertyName Description }} + + String + + String + + + None + ProgressAction @@ -17745,6 +18151,18 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None + + DisplayName + + {{ Fill DisplayName Description }} + + String + + String + + + None + Filter @@ -17757,7 +18175,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - + Id {{ Fill Id Description }} @@ -17781,6 +18199,18 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None + + PropertyName + + {{ Fill PropertyName Description }} + + String + + String + + + None + ProgressAction @@ -17832,9 +18262,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMIntegrationLogs + Get-LMDeviceSDT Get - LMIntegrationLogs + LMDeviceSDT {{ Fill in the Synopsis }} @@ -17844,7 +18274,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMIntegrationLogs + Get-LMDeviceSDT BatchSize @@ -17858,37 +18288,25 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - EndDate - - {{ Fill EndDate Description }} - - DateTime - - DateTime - - - None - - - SearchString + Filter - {{ Fill SearchString Description }} + {{ Fill Filter Description }} - String + Object - String + Object None - - StartDate + + Id - {{ Fill StartDate Description }} + {{ Fill Id Description }} - DateTime + Int32 - DateTime + Int32 None @@ -17907,7 +18325,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMIntegrationLogs + Get-LMDeviceSDT BatchSize @@ -17932,37 +18350,10 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - ProgressAction - - {{ Fill ProgressAction Description }} - - ActionPreference - - ActionPreference - - - None - - - - Get-LMIntegrationLogs - - BatchSize - - {{ Fill BatchSize Description }} - - Int32 - - Int32 - - - None - - Id + Name - {{ Fill Id Description }} + {{ Fill Name Description }} String @@ -17998,18 +18389,6 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - EndDate - - {{ Fill EndDate Description }} - - DateTime - - DateTime - - - None - Filter @@ -18022,22 +18401,22 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - + Id {{ Fill Id Description }} - String + Int32 - String + Int32 None - SearchString + Name - {{ Fill SearchString Description }} + {{ Fill Name Description }} String @@ -18046,18 +18425,6 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - StartDate - - {{ Fill StartDate Description }} - - DateTime - - DateTime - - - None - ProgressAction @@ -18109,9 +18476,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMNetscan + Get-LMDeviceSDTHistory Get - LMNetscan + LMDeviceSDTHistory {{ Fill in the Synopsis }} @@ -18121,7 +18488,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMNetscan + Get-LMDeviceSDTHistory BatchSize @@ -18146,34 +18513,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - ProgressAction - - {{ Fill ProgressAction Description }} - - ActionPreference - - ActionPreference - - - None - - - - Get-LMNetscan - - BatchSize - - {{ Fill BatchSize Description }} - - Int32 - - Int32 - - - None - - + Id {{ Fill Id Description }} @@ -18199,7 +18539,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMNetscan + Get-LMDeviceSDTHistory BatchSize @@ -18212,6 +18552,18 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None + + Filter + + {{ Fill Filter Description }} + + Object + + Object + + + None + Name @@ -18263,7 +18615,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - + Id {{ Fill Id Description }} @@ -18338,9 +18690,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMNetscanExecution + Get-LMEscalationChain Get - LMNetscanExecution + LMEscalationChain {{ Fill in the Synopsis }} @@ -18350,7 +18702,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMNetscanExecution + Get-LMEscalationChain BatchSize @@ -18375,18 +18727,6 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - Id - - {{ Fill Id Description }} - - Int32 - - Int32 - - - None - ProgressAction @@ -18401,170 +18741,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMNetscanExecution - - BatchSize - - {{ Fill BatchSize Description }} - - Int32 - - Int32 - - - None - - - Filter - - {{ Fill Filter Description }} - - Object - - Object - - - None - - - Name - - {{ Fill Name Description }} - - String - - String - - - None - - - ProgressAction - - {{ Fill ProgressAction Description }} - - ActionPreference - - ActionPreference - - - None - - - - - - BatchSize - - {{ Fill BatchSize Description }} - - Int32 - - Int32 - - - None - - - Filter - - {{ Fill Filter Description }} - - Object - - Object - - - None - - - Id - - {{ Fill Id Description }} - - Int32 - - Int32 - - - None - - - Name - - {{ Fill Name Description }} - - String - - String - - - None - - - ProgressAction - - {{ Fill ProgressAction Description }} - - ActionPreference - - ActionPreference - - - None - - - - - - None - - - - - - - - - - System.Object - - - - - - - - - - - - - - -------------------------- Example 1 -------------------------- - PS C:\> {{ Add example code here }} - - {{ Add example description here }} - - - - - - - - Get-LMNetscanExecutionDevices - Get - LMNetscanExecutionDevices - - {{ Fill in the Synopsis }} - - - - {{ Fill in the Description }} - - - - Get-LMNetscanExecutionDevices + Get-LMEscalationChain BatchSize @@ -18578,18 +18755,6 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - Filter - - {{ Fill Filter Description }} - - Object - - Object - - - None - - Id {{ Fill Id Description }} @@ -18601,18 +18766,6 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - NspId - - {{ Fill NspId Description }} - - String - - String - - - None - ProgressAction @@ -18627,7 +18780,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMNetscanExecutionDevices + Get-LMEscalationChain BatchSize @@ -18641,21 +18794,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - Filter - - {{ Fill Filter Description }} - - Object - - Object - - - None - - - NspName + Name - {{ Fill NspName Description }} + {{ Fill Name Description }} String @@ -18703,7 +18844,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - + Id {{ Fill Id Description }} @@ -18715,22 +18856,10 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - NspId - - {{ Fill NspId Description }} - - String - - String - - - None - - - NspName + + Name - {{ Fill NspName Description }} + {{ Fill Name Description }} String @@ -18790,9 +18919,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMNetscanGroup + Get-LMEventSource Get - LMNetscanGroup + LMEventSource {{ Fill in the Synopsis }} @@ -18802,7 +18931,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMNetscanGroup + Get-LMEventSource BatchSize @@ -18841,7 +18970,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMNetscanGroup + Get-LMEventSource BatchSize @@ -18880,7 +19009,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMNetscanGroup + Get-LMEventSource BatchSize @@ -19019,9 +19148,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMOpsNote + Get-LMIntegrationLogs Get - LMOpsNote + LMIntegrationLogs {{ Fill in the Synopsis }} @@ -19031,7 +19160,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMOpsNote + Get-LMIntegrationLogs BatchSize @@ -19045,13 +19174,37 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - Filter + EndDate - {{ Fill Filter Description }} + {{ Fill EndDate Description }} - Object + DateTime - Object + DateTime + + + None + + + SearchString + + {{ Fill SearchString Description }} + + String + + String + + + None + + + StartDate + + {{ Fill StartDate Description }} + + DateTime + + DateTime None @@ -19070,7 +19223,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMOpsNote + Get-LMIntegrationLogs BatchSize @@ -19084,13 +19237,13 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - Id + Filter - {{ Fill Id Description }} + {{ Fill Filter Description }} - String + Object - String + Object None @@ -19109,7 +19262,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMOpsNote + Get-LMIntegrationLogs BatchSize @@ -19123,9 +19276,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - Tag + Id - {{ Fill Tag Description }} + {{ Fill Id Description }} String @@ -19161,6 +19314,18 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None + + EndDate + + {{ Fill EndDate Description }} + + DateTime + + DateTime + + + None + Filter @@ -19186,9 +19351,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - Tag + SearchString - {{ Fill Tag Description }} + {{ Fill SearchString Description }} String @@ -19197,85 +19362,18 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - ProgressAction + + StartDate - {{ Fill ProgressAction Description }} + {{ Fill StartDate Description }} - ActionPreference + DateTime - ActionPreference + DateTime None - - - - - None - - - - - - - - - - System.Object - - - - - - - - - - - - - - -------------------------- Example 1 -------------------------- - PS C:\> {{ Add example code here }} - - {{ Add example description here }} - - - - - - - - Get-LMPortalInfo - Get - LMPortalInfo - - {{ Fill in the Synopsis }} - - - - {{ Fill in the Description }} - - - - Get-LMPortalInfo - - ProgressAction - - {{ Fill ProgressAction Description }} - - ActionPreference - - ActionPreference - - - None - - - - ProgressAction @@ -19327,9 +19425,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMPropertySource + Get-LMNetscan Get - LMPropertySource + LMNetscan {{ Fill in the Synopsis }} @@ -19339,7 +19437,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMPropertySource + Get-LMNetscan BatchSize @@ -19378,7 +19476,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMPropertySource + Get-LMNetscan BatchSize @@ -19417,7 +19515,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMPropertySource + Get-LMNetscan BatchSize @@ -19556,9 +19654,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMRecipientGroup + Get-LMNetscanExecution Get - LMRecipientGroup + LMNetscanExecution {{ Fill in the Synopsis }} @@ -19568,7 +19666,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMRecipientGroup + Get-LMNetscanExecution BatchSize @@ -19593,34 +19691,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - ProgressAction - - {{ Fill ProgressAction Description }} - - ActionPreference - - ActionPreference - - - None - - - - Get-LMRecipientGroup - - BatchSize - - {{ Fill BatchSize Description }} - - Int32 - - Int32 - - - None - - + Id {{ Fill Id Description }} @@ -19646,7 +19717,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMRecipientGroup + Get-LMNetscanExecution BatchSize @@ -19660,6 +19731,18 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None + Filter + + {{ Fill Filter Description }} + + Object + + Object + + + None + + Name {{ Fill Name Description }} @@ -19710,7 +19793,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - + Id {{ Fill Id Description }} @@ -19722,7 +19805,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - + Name {{ Fill Name Description }} @@ -19785,9 +19868,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMReport + Get-LMNetscanExecutionDevices Get - LMReport + LMNetscanExecutionDevices {{ Fill in the Synopsis }} @@ -19797,7 +19880,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMReport + Get-LMNetscanExecutionDevices BatchSize @@ -19822,25 +19905,10 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - ProgressAction - - {{ Fill ProgressAction Description }} - - ActionPreference - - ActionPreference - - - None - - - - Get-LMReport - - BatchSize + + Id - {{ Fill BatchSize Description }} + {{ Fill Id Description }} Int32 @@ -19849,14 +19917,14 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - Id + + NspId - {{ Fill Id Description }} + {{ Fill NspId Description }} - Int32 + String - Int32 + String None @@ -19875,7 +19943,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMReport + Get-LMNetscanExecutionDevices BatchSize @@ -19889,9 +19957,21 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - Name + Filter - {{ Fill Name Description }} + {{ Fill Filter Description }} + + Object + + Object + + + None + + + NspName + + {{ Fill NspName Description }} String @@ -19939,7 +20019,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - + Id {{ Fill Id Description }} @@ -19951,10 +20031,22 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - Name + + NspId - {{ Fill Name Description }} + {{ Fill NspId Description }} + + String + + String + + + None + + + NspName + + {{ Fill NspName Description }} String @@ -20014,9 +20106,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMReportGroup + Get-LMNetscanGroup Get - LMReportGroup + LMNetscanGroup {{ Fill in the Synopsis }} @@ -20026,7 +20118,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMReportGroup + Get-LMNetscanGroup BatchSize @@ -20065,7 +20157,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMReportGroup + Get-LMNetscanGroup BatchSize @@ -20104,7 +20196,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMReportGroup + Get-LMNetscanGroup BatchSize @@ -20243,119 +20335,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMRepositoryLogicModules - Get - LMRepositoryLogicModules - - {{ Fill in the Synopsis }} - - - - {{ Fill in the Description }} - - - - Get-LMRepositoryLogicModules - - Type - - {{ Fill Type Description }} - - - datasource - propertyrules - eventsource - topologysource - configsource - - String - - String - - - None - - - ProgressAction - - {{ Fill ProgressAction Description }} - - ActionPreference - - ActionPreference - - - None - - - - - - Type - - {{ Fill Type Description }} - - String - - String - - - None - - - ProgressAction - - {{ Fill ProgressAction Description }} - - ActionPreference - - ActionPreference - - - None - - - - - - None - - - - - - - - - - System.Object - - - - - - - - - - - - - - -------------------------- Example 1 -------------------------- - PS C:\> {{ Add example code here }} - - {{ Add example description here }} - - - - - - - - Get-LMRole + Get-LMOpsNote Get - LMRole + LMOpsNote {{ Fill in the Synopsis }} @@ -20365,7 +20347,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMRole + Get-LMOpsNote BatchSize @@ -20404,7 +20386,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMRole + Get-LMOpsNote BatchSize @@ -20422,9 +20404,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas {{ Fill Id Description }} - Int32 + String - Int32 + String None @@ -20443,7 +20425,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMRole + Get-LMOpsNote BatchSize @@ -20457,9 +20439,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - Name + Tag - {{ Fill Name Description }} + {{ Fill Tag Description }} String @@ -20512,17 +20494,17 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas {{ Fill Id Description }} - Int32 + String - Int32 + String None - Name + Tag - {{ Fill Name Description }} + {{ Fill Tag Description }} String @@ -20582,9 +20564,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMSDT + Get-LMPortalInfo Get - LMSDT + LMPortalInfo {{ Fill in the Synopsis }} @@ -20594,7 +20576,86 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMSDT + Get-LMPortalInfo + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + + + None + + + + + + + + + + System.Object + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + PS C:\> {{ Add example code here }} + + {{ Add example description here }} + + + + + + + + Get-LMPropertySource + Get + LMPropertySource + + {{ Fill in the Synopsis }} + + + + {{ Fill in the Description }} + + + + Get-LMPropertySource BatchSize @@ -20633,7 +20694,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMSDT + Get-LMPropertySource BatchSize @@ -20651,9 +20712,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas {{ Fill Id Description }} - String + Int32 - String + Int32 None @@ -20672,7 +20733,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMSDT + Get-LMPropertySource BatchSize @@ -20741,9 +20802,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas {{ Fill Id Description }} - String + Int32 - String + Int32 None @@ -20811,9 +20872,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMTopologyMap + Get-LMRecipientGroup Get - LMTopologyMap + LMRecipientGroup {{ Fill in the Synopsis }} @@ -20823,7 +20884,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMTopologyMap + Get-LMRecipientGroup BatchSize @@ -20862,7 +20923,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMTopologyMap + Get-LMRecipientGroup BatchSize @@ -20901,7 +20962,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMTopologyMap + Get-LMRecipientGroup BatchSize @@ -21040,9 +21101,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMTopologyMapData + Get-LMReport Get - LMTopologyMapData + LMReport {{ Fill in the Synopsis }} @@ -21052,8 +21113,59 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMTopologyMapData - + Get-LMReport + + BatchSize + + {{ Fill BatchSize Description }} + + Int32 + + Int32 + + + None + + + Filter + + {{ Fill Filter Description }} + + Object + + Object + + + None + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + Get-LMReport + + BatchSize + + {{ Fill BatchSize Description }} + + Int32 + + Int32 + + + None + + Id {{ Fill Id Description }} @@ -21079,8 +21191,20 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMTopologyMapData - + Get-LMReport + + BatchSize + + {{ Fill BatchSize Description }} + + Int32 + + Int32 + + + None + + Name {{ Fill Name Description }} @@ -21107,7 +21231,31 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - + + BatchSize + + {{ Fill BatchSize Description }} + + Int32 + + Int32 + + + None + + + Filter + + {{ Fill Filter Description }} + + Object + + Object + + + None + + Id {{ Fill Id Description }} @@ -21119,7 +21267,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - + Name {{ Fill Name Description }} @@ -21182,9 +21330,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMTopologySource + Get-LMReportGroup Get - LMTopologySource + LMReportGroup {{ Fill in the Synopsis }} @@ -21194,7 +21342,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMTopologySource + Get-LMReportGroup BatchSize @@ -21233,7 +21381,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMTopologySource + Get-LMReportGroup BatchSize @@ -21272,7 +21420,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMTopologySource + Get-LMReportGroup BatchSize @@ -21411,9 +21559,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMUnmonitoredDevice + Get-LMRepositoryLogicModules Get - LMUnmonitoredDevice + LMRepositoryLogicModules {{ Fill in the Synopsis }} @@ -21423,27 +21571,22 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMUnmonitoredDevice + Get-LMRepositoryLogicModules - Filter - - {{ Fill Filter Description }} - - Object - - Object - - - None - - - BatchSize + Type - {{ Fill BatchSize Description }} + {{ Fill Type Description }} - Int32 + + datasource + propertyrules + eventsource + topologysource + configsource + + String - Int32 + String None @@ -21463,109 +21606,18 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - - BatchSize - - {{ Fill BatchSize Description }} - - Int32 - - Int32 - - - None - - Filter - - {{ Fill Filter Description }} - - Object - - Object - - - None - - - ProgressAction + Type - {{ Fill ProgressAction Description }} + {{ Fill Type Description }} - ActionPreference + String - ActionPreference + String None - - - - - None - - - - - - - - - - System.Object - - - - - - - - - - - - - - -------------------------- Example 1 -------------------------- - PS C:\> {{ Add example code here }} - - {{ Add example description here }} - - - - - - - - Get-LMUsageMetrics - Get - LMUsageMetrics - - {{ Fill in the Synopsis }} - - - - {{ Fill in the Description }} - - - - Get-LMUsageMetrics - - ProgressAction - - {{ Fill ProgressAction Description }} - - ActionPreference - - ActionPreference - - - None - - - - ProgressAction @@ -21617,9 +21669,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMUser + Get-LMRole Get - LMUser + LMRole {{ Fill in the Synopsis }} @@ -21629,7 +21681,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMUser + Get-LMRole BatchSize @@ -21668,7 +21720,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMUser + Get-LMRole BatchSize @@ -21707,7 +21759,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMUser + Get-LMRole BatchSize @@ -21846,9 +21898,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMUserGroup + Get-LMSDT Get - LMUserGroup + LMSDT {{ Fill in the Synopsis }} @@ -21858,7 +21910,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMUserGroup + Get-LMSDT BatchSize @@ -21897,7 +21949,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMUserGroup + Get-LMSDT BatchSize @@ -21915,9 +21967,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas {{ Fill Id Description }} - Int32 + String - Int32 + String None @@ -21936,7 +21988,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMUserGroup + Get-LMSDT BatchSize @@ -22005,9 +22057,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas {{ Fill Id Description }} - Int32 + String - Int32 + String None @@ -22075,42 +22127,42 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMWebsite + Get-LMTopologyMap Get - LMWebsite + LMTopologyMap - Get website info from a connected LM portal + {{ Fill in the Synopsis }} - Get website info from a connected LM portal + {{ Fill in the Description }} - Get-LMWebsite + Get-LMTopologyMap - Id + BatchSize - The website id for a website in LM. + {{ Fill BatchSize Description }} Int32 Int32 - 0 + None - BatchSize + Filter - The return size for each request, this value if not specified defaults to 1000. If a result would return 1001 and items, two requests would be made to return the full set. + {{ Fill Filter Description }} - Int32 + Object - Int32 + Object - 1000 + None ProgressAction @@ -22126,30 +22178,30 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMWebsite + Get-LMTopologyMap - Name + BatchSize - The name value for a website in LM. This value accepts wildcard input such as "ServiceNow - *" + {{ Fill BatchSize Description }} - String + Int32 - String + Int32 None - BatchSize + Id - The return size for each request, this value if not specified defaults to 1000. If a result would return 1001 and items, two requests would be made to return the full set. + {{ Fill Id Description }} Int32 Int32 - 1000 + None ProgressAction @@ -22165,71 +22217,31 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMWebsite - - Type - - The type of websites to return. Possible values are: Webcheck or PingCheck - - String - - String - - - None - + Get-LMTopologyMap BatchSize - The return size for each request, this value if not specified defaults to 1000. If a result would return 1001 and items, two requests would be made to return the full set. + {{ Fill BatchSize Description }} Int32 Int32 - 1000 - - - ProgressAction - - {{ Fill ProgressAction Description }} - - ActionPreference - - ActionPreference - - None - - - Get-LMWebsite - Filter + Name - A hashtable of additional filter properties to include with request. All properties are treated as if using the equals ":" operator. When using multiple filters they are combined as AND conditions. - An example Filter to get websites with type Webcheck that are internal: @{type="webcheck";isInternal=$true} + {{ Fill Name Description }} - Object + String - Object + String None - - BatchSize - - The return size for each request, this value if not specified defaults to 1000. If a result would return 1001 and items, two requests would be made to return the full set. - - Int32 - - Int32 - - - 1000 - ProgressAction @@ -22246,65 +22258,52 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Id + BatchSize - The website id for a website in LM. + {{ Fill BatchSize Description }} Int32 Int32 - 0 - - - Name - - The name value for a website in LM. This value accepts wildcard input such as "ServiceNow - *" - - String - - String - - None - Type + Filter - The type of websites to return. Possible values are: Webcheck or PingCheck + {{ Fill Filter Description }} - String + Object - String + Object None - Filter + Id - A hashtable of additional filter properties to include with request. All properties are treated as if using the equals ":" operator. When using multiple filters they are combined as AND conditions. - An example Filter to get websites with type Webcheck that are internal: @{type="webcheck";isInternal=$true} + {{ Fill Id Description }} - Object + Int32 - Object + Int32 None - BatchSize + Name - The return size for each request, this value if not specified defaults to 1000. If a result would return 1001 and items, two requests would be made to return the full set. + {{ Fill Name Description }} - Int32 + String - Int32 + String - 1000 + None ProgressAction @@ -22319,22 +22318,37 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - + + + + None + + + + + + + + + + System.Object + + + + + + - Consult the LM API docs for a list of allowed fields when using filter parameter as all fields are not available for use with filtering. + - -------------------------- EXAMPLE 1 -------------------------- - Get all websites: - Get-LMWebsite + -------------------------- Example 1 -------------------------- + PS C:\> {{ Add example code here }} - Get specific website: Get-LMWebsite -Id 1 Get-LMWebsite -Name "LogicMonitor" - Get multiple websites using wildcards: Get-LMWebsite -Name "ServiceNow - *" - Get websites using a custom filter: Get-LMWebsite -Filter @{type="webcheck";isInternal=$true} + {{ Add example description here }} @@ -22342,9 +22356,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMWebsiteAlerts + Get-LMTopologyMapData Get - LMWebsiteAlerts + LMTopologyMapData {{ Fill in the Synopsis }} @@ -22354,31 +22368,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMWebsiteAlerts - - BatchSize - - {{ Fill BatchSize Description }} - - Int32 - - Int32 - - - None - - - Filter - - {{ Fill Filter Description }} - - Object - - Object - - - None - + Get-LMTopologyMapData Id @@ -22405,32 +22395,8 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMWebsiteAlerts - - BatchSize - - {{ Fill BatchSize Description }} - - Int32 - - Int32 - - - None - - - Filter - - {{ Fill Filter Description }} - - Object - - Object - - - None - - + Get-LMTopologyMapData + Name {{ Fill Name Description }} @@ -22457,30 +22423,6 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - - BatchSize - - {{ Fill BatchSize Description }} - - Int32 - - Int32 - - - None - - - Filter - - {{ Fill Filter Description }} - - Object - - Object - - - None - Id @@ -22493,7 +22435,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - + Name {{ Fill Name Description }} @@ -22556,9 +22498,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMWebsiteCheckpoint + Get-LMTopologySource Get - LMWebsiteCheckpoint + LMTopologySource {{ Fill in the Synopsis }} @@ -22568,7 +22510,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMWebsiteCheckpoint + Get-LMTopologySource BatchSize @@ -22606,6 +22548,84 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None + + Get-LMTopologySource + + BatchSize + + {{ Fill BatchSize Description }} + + Int32 + + Int32 + + + None + + + Id + + {{ Fill Id Description }} + + Int32 + + Int32 + + + None + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + Get-LMTopologySource + + BatchSize + + {{ Fill BatchSize Description }} + + Int32 + + Int32 + + + None + + + Name + + {{ Fill Name Description }} + + String + + String + + + None + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + @@ -22632,6 +22652,30 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None + + Id + + {{ Fill Id Description }} + + Int32 + + Int32 + + + None + + + Name + + {{ Fill Name Description }} + + String + + String + + + None + ProgressAction @@ -22683,9 +22727,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMWebsiteData + Get-LMUnmonitoredDevice Get - LMWebsiteData + LMUnmonitoredDevice {{ Fill in the Synopsis }} @@ -22695,35 +22739,23 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMWebsiteData - - CheckpointId - - {{ Fill CheckpointId Description }} - - String - - String - - - None - - - EndDate + Get-LMUnmonitoredDevice + + Filter - {{ Fill EndDate Description }} + {{ Fill Filter Description }} - DateTime + Object - DateTime + Object None - - Id + + BatchSize - {{ Fill Id Description }} + {{ Fill BatchSize Description }} Int32 @@ -22732,81 +22764,6 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - StartDate - - {{ Fill StartDate Description }} - - DateTime - - DateTime - - - None - - - ProgressAction - - {{ Fill ProgressAction Description }} - - ActionPreference - - ActionPreference - - - None - - - - Get-LMWebsiteData - - CheckpointId - - {{ Fill CheckpointId Description }} - - String - - String - - - None - - - EndDate - - {{ Fill EndDate Description }} - - DateTime - - DateTime - - - None - - - Name - - {{ Fill Name Description }} - - String - - String - - - None - - - StartDate - - {{ Fill StartDate Description }} - - DateTime - - DateTime - - - None - ProgressAction @@ -22822,66 +22779,109 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - - CheckpointId + + BatchSize - {{ Fill CheckpointId Description }} + {{ Fill BatchSize Description }} - String + Int32 - String + Int32 None - - EndDate + + Filter - {{ Fill EndDate Description }} + {{ Fill Filter Description }} - DateTime + Object - DateTime + Object None - - Id + + ProgressAction - {{ Fill Id Description }} + {{ Fill ProgressAction Description }} - Int32 + ActionPreference - Int32 + ActionPreference None - - Name - - {{ Fill Name Description }} - - String + + + - String - + None - None - - - StartDate - {{ Fill StartDate Description }} + - DateTime + + + + - DateTime - + System.Object - None - + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + PS C:\> {{ Add example code here }} + + {{ Add example description here }} + + + + + + + + Get-LMUsageMetrics + Get + LMUsageMetrics + + {{ Fill in the Synopsis }} + + + + {{ Fill in the Description }} + + + + Get-LMUsageMetrics + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + ProgressAction @@ -22933,9 +22933,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMWebsiteGroup + Get-LMUser Get - LMWebsiteGroup + LMUser {{ Fill in the Synopsis }} @@ -22945,7 +22945,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMWebsiteGroup + Get-LMUser BatchSize @@ -22984,7 +22984,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMWebsiteGroup + Get-LMUser BatchSize @@ -23023,7 +23023,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMWebsiteGroup + Get-LMUser BatchSize @@ -23162,9 +23162,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMWebsiteGroupAlerts + Get-LMUserGroup Get - LMWebsiteGroupAlerts + LMUserGroup {{ Fill in the Synopsis }} @@ -23174,7 +23174,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMWebsiteGroupAlerts + Get-LMUserGroup BatchSize @@ -23199,7 +23199,34 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + Get-LMUserGroup + + BatchSize + + {{ Fill BatchSize Description }} + + Int32 + + Int32 + + + None + + Id {{ Fill Id Description }} @@ -23225,7 +23252,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMWebsiteGroupAlerts + Get-LMUserGroup BatchSize @@ -23238,18 +23265,6 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - Filter - - {{ Fill Filter Description }} - - Object - - Object - - - None - Name @@ -23301,7 +23316,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - + Id {{ Fill Id Description }} @@ -23376,54 +23391,81 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMWebsiteGroupSDT + Get-LMWebsite Get - LMWebsiteGroupSDT + LMWebsite - {{ Fill in the Synopsis }} + Get website info from a connected LM portal - {{ Fill in the Description }} + Get website info from a connected LM portal - Get-LMWebsiteGroupSDT + Get-LMWebsite + + Id + + The website id for a website in LM. + + Int32 + + Int32 + + + 0 + BatchSize - {{ Fill BatchSize Description }} + The return size for each request, this value if not specified defaults to 1000. If a result would return 1001 and items, two requests would be made to return the full set. Int32 Int32 + 1000 + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + None + + + Get-LMWebsite - Filter + Name - {{ Fill Filter Description }} + The name value for a website in LM. This value accepts wildcard input such as "ServiceNow - *" - Object + String - Object + String None - - Id + + BatchSize - {{ Fill Id Description }} + The return size for each request, this value if not specified defaults to 1000. If a result would return 1001 and items, two requests would be made to return the full set. Int32 Int32 - None + 1000 ProgressAction @@ -23439,23 +23481,51 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMWebsiteGroupSDT + Get-LMWebsite + + Type + + The type of websites to return. Possible values are: Webcheck or PingCheck + + String + + String + + + None + BatchSize - {{ Fill BatchSize Description }} + The return size for each request, this value if not specified defaults to 1000. If a result would return 1001 and items, two requests would be made to return the full set. Int32 Int32 + 1000 + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + None + + + Get-LMWebsite Filter - {{ Fill Filter Description }} + A hashtable of additional filter properties to include with request. All properties are treated as if using the equals ":" operator. When using multiple filters they are combined as AND conditions. + An example Filter to get websites with type Webcheck that are internal: @{type="webcheck";isInternal=$true} Object @@ -23465,16 +23535,16 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - Name + BatchSize - {{ Fill Name Description }} + The return size for each request, this value if not specified defaults to 1000. If a result would return 1001 and items, two requests would be made to return the full set. - String + Int32 - String + Int32 - None + 1000 ProgressAction @@ -23492,53 +23562,66 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - BatchSize + Id - {{ Fill BatchSize Description }} + The website id for a website in LM. Int32 Int32 - None + 0 - Filter + Name - {{ Fill Filter Description }} + The name value for a website in LM. This value accepts wildcard input such as "ServiceNow - *" - Object + String - Object + String None - - Id + + Type - {{ Fill Id Description }} + The type of websites to return. Possible values are: Webcheck or PingCheck - Int32 + String - Int32 + String None - Name + Filter - {{ Fill Name Description }} + A hashtable of additional filter properties to include with request. All properties are treated as if using the equals ":" operator. When using multiple filters they are combined as AND conditions. + An example Filter to get websites with type Webcheck that are internal: @{type="webcheck";isInternal=$true} - String + Object - String + Object None + + BatchSize + + The return size for each request, this value if not specified defaults to 1000. If a result would return 1001 and items, two requests would be made to return the full set. + + Int32 + + Int32 + + + 1000 + ProgressAction @@ -23552,37 +23635,22 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - - - None - - - - - - - - - - System.Object - - - - - - + + - + Consult the LM API docs for a list of allowed fields when using filter parameter as all fields are not available for use with filtering. - -------------------------- Example 1 -------------------------- - PS C:\> {{ Add example code here }} + -------------------------- EXAMPLE 1 -------------------------- + Get all websites: + Get-LMWebsite - {{ Add example description here }} + Get specific website: Get-LMWebsite -Id 1 Get-LMWebsite -Name "LogicMonitor" + Get multiple websites using wildcards: Get-LMWebsite -Name "ServiceNow - *" + Get websites using a custom filter: Get-LMWebsite -Filter @{type="webcheck";isInternal=$true} @@ -23590,9 +23658,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMWebsiteGroupSDTHistory + Get-LMWebsiteAlerts Get - LMWebsiteGroupSDTHistory + LMWebsiteAlerts {{ Fill in the Synopsis }} @@ -23602,7 +23670,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMWebsiteGroupSDTHistory + Get-LMWebsiteAlerts BatchSize @@ -23653,7 +23721,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMWebsiteGroupSDTHistory + Get-LMWebsiteAlerts BatchSize @@ -23804,9 +23872,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMWebsiteProperty + Get-LMWebsiteCheckpoint Get - LMWebsiteProperty + LMWebsiteCheckpoint {{ Fill in the Synopsis }} @@ -23816,58 +23884,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMWebsiteProperty - - BatchSize - - {{ Fill BatchSize Description }} - - Int32 - - Int32 - - - None - - - Filter - - {{ Fill Filter Description }} - - Object - - Object - - - None - - - Id - - {{ Fill Id Description }} - - Int32 - - Int32 - - - None - - - ProgressAction - - {{ Fill ProgressAction Description }} - - ActionPreference - - ActionPreference - - - None - - - - Get-LMWebsiteProperty + Get-LMWebsiteCheckpoint BatchSize @@ -23892,18 +23909,6 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - Name - - {{ Fill Name Description }} - - String - - String - - - None - ProgressAction @@ -23943,30 +23948,6 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - Id - - {{ Fill Id Description }} - - Int32 - - Int32 - - - None - - - Name - - {{ Fill Name Description }} - - String - - String - - - None - ProgressAction @@ -24018,9 +23999,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMWebsiteSDT + Get-LMWebsiteData Get - LMWebsiteSDT + LMWebsiteData {{ Fill in the Synopsis }} @@ -24030,27 +24011,27 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMWebsiteSDT + Get-LMWebsiteData - BatchSize + CheckpointId - {{ Fill BatchSize Description }} + {{ Fill CheckpointId Description }} - Int32 + String - Int32 + String None - Filter + EndDate - {{ Fill Filter Description }} + {{ Fill EndDate Description }} - Object + DateTime - Object + DateTime None @@ -24067,6 +24048,18 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None + + StartDate + + {{ Fill StartDate Description }} + + DateTime + + DateTime + + + None + ProgressAction @@ -24081,32 +24074,32 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMWebsiteSDT + Get-LMWebsiteData - BatchSize + CheckpointId - {{ Fill BatchSize Description }} + {{ Fill CheckpointId Description }} - Int32 + String - Int32 + String None - Filter + EndDate - {{ Fill Filter Description }} + {{ Fill EndDate Description }} - Object + DateTime - Object + DateTime None - + Name {{ Fill Name Description }} @@ -24118,6 +24111,18 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None + + StartDate + + {{ Fill StartDate Description }} + + DateTime + + DateTime + + + None + ProgressAction @@ -24134,25 +24139,25 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - BatchSize + CheckpointId - {{ Fill BatchSize Description }} + {{ Fill CheckpointId Description }} - Int32 + String - Int32 + String None - Filter + EndDate - {{ Fill Filter Description }} + {{ Fill EndDate Description }} - Object + DateTime - Object + DateTime None @@ -24169,7 +24174,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - + Name {{ Fill Name Description }} @@ -24181,6 +24186,18 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None + + StartDate + + {{ Fill StartDate Description }} + + DateTime + + DateTime + + + None + ProgressAction @@ -24232,9 +24249,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMWebsiteSDTHistory + Get-LMWebsiteGroup Get - LMWebsiteSDTHistory + LMWebsiteGroup {{ Fill in the Synopsis }} @@ -24244,7 +24261,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMWebsiteSDTHistory + Get-LMWebsiteGroup BatchSize @@ -24269,7 +24286,34 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + Get-LMWebsiteGroup + + BatchSize + + {{ Fill BatchSize Description }} + + Int32 + + Int32 + + + None + + Id {{ Fill Id Description }} @@ -24295,7 +24339,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Get-LMWebsiteSDTHistory + Get-LMWebsiteGroup BatchSize @@ -24308,18 +24352,6 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - Filter - - {{ Fill Filter Description }} - - Object - - Object - - - None - Name @@ -24371,7 +24403,7 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - + Id {{ Fill Id Description }} @@ -24446,58 +24478,35 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Import-LMDashboard - Import - LMDashboard + Get-LMWebsiteGroupAlerts + Get + LMWebsiteGroupAlerts - Imports LogicMonitor dashboards from various sources. + {{ Fill in the Synopsis }} - The `Import-LMDashboard` function allows you to import LogicMonitor dashboards from different sources, such as local files, GitHub repositories, or LogicMonitor dashboard groups. It supports importing dashboards in JSON format. + {{ Fill in the Description }} - Import-LMDashboard - - FilePath - - Specifies the path to a local file or directory containing the JSON dashboard files to import. If a directory is specified, all JSON files within the directory (and its subdirectories) will be imported. - - String - - String - - - None - - - ParentGroupName - - Specifies the name of the parent dashboard group under which the imported dashboards will be placed. This parameter is mandatory when importing from a file or GitHub repository. - - String - - String - - - None - + Get-LMWebsiteGroupAlerts - ReplaceAPITokensOnImport + BatchSize - Indicates whether to replace API tokens in the imported dashboards with a dynamically generated API token. This is useful for managing API access to the dashboards. + {{ Fill BatchSize Description }} + Int32 - SwitchParameter + Int32 - False + None - APIToken + Filter - Specifies the API token to use for replacing API tokens in the imported dashboards. This parameter is required when `ReplaceAPITokensOnImport` is set to `$true`. + {{ Fill Filter Description }} Object @@ -24506,14 +24515,14 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - PrivateUserName + + Id - Specifies the username of dashboard owner when creating dashboard as private. + {{ Fill Id Description }} - String + Int32 - String + Int32 None @@ -24532,46 +24541,23 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Import-LMDashboard - - FilePath - - Specifies the path to a local file or directory containing the JSON dashboard files to import. If a directory is specified, all JSON files within the directory (and its subdirectories) will be imported. - - String - - String - - - None - - - ParentGroupId - - Specifies the ID of the parent dashboard group under which the imported dashboards will be placed. This parameter is mandatory when importing from a file or GitHub repository. - - String - - String - - - None - + Get-LMWebsiteGroupAlerts - ReplaceAPITokensOnImport + BatchSize - Indicates whether to replace API tokens in the imported dashboards with a dynamically generated API token. This is useful for managing API access to the dashboards. + {{ Fill BatchSize Description }} + Int32 - SwitchParameter + Int32 - False + None - APIToken + Filter - Specifies the API token to use for replacing API tokens in the imported dashboards. This parameter is required when `ReplaceAPITokensOnImport` is set to `$true`. + {{ Fill Filter Description }} Object @@ -24581,9 +24567,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - PrivateUserName + Name - Specifies the username of dashboard owner when creating dashboard as private. + {{ Fill Name Description }} String @@ -24605,47 +24591,136 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None + + + + BatchSize + + {{ Fill BatchSize Description }} + + Int32 + + Int32 + + + None + + + Filter + + {{ Fill Filter Description }} + + Object + + Object + + + None + + + Id + + {{ Fill Id Description }} + + Int32 + + Int32 + + + None + + + Name + + {{ Fill Name Description }} + + String + + String + + + None + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + + + None + + + + + + + + + + System.Object + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + PS C:\> {{ Add example code here }} + + {{ Add example description here }} + + + + + + + + Get-LMWebsiteGroupSDT + Get + LMWebsiteGroupSDT + + {{ Fill in the Synopsis }} + + + + {{ Fill in the Description }} + + - Import-LMDashboard - - File - - Specifies a single JSON dashboard file to import. - - String - - String - - - None - - - ParentGroupName - - Specifies the name of the parent dashboard group under which the imported dashboards will be placed. This parameter is mandatory when importing from a file or GitHub repository. - - String - - String - - - None - + Get-LMWebsiteGroupSDT - ReplaceAPITokensOnImport + BatchSize - Indicates whether to replace API tokens in the imported dashboards with a dynamically generated API token. This is useful for managing API access to the dashboards. + {{ Fill BatchSize Description }} + Int32 - SwitchParameter + Int32 - False + None - APIToken + Filter - Specifies the API token to use for replacing API tokens in the imported dashboards. This parameter is required when `ReplaceAPITokensOnImport` is set to `$true`. + {{ Fill Filter Description }} Object @@ -24654,14 +24729,14 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - PrivateUserName + + Id - Specifies the username of dashboard owner when creating dashboard as private. + {{ Fill Id Description }} - String + Int32 - String + Int32 None @@ -24680,46 +24755,23 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Import-LMDashboard - - File - - Specifies a single JSON dashboard file to import. - - String - - String - - - None - - - ParentGroupId - - Specifies the ID of the parent dashboard group under which the imported dashboards will be placed. This parameter is mandatory when importing from a file or GitHub repository. - - String - - String - - - None - + Get-LMWebsiteGroupSDT - ReplaceAPITokensOnImport + BatchSize - Indicates whether to replace API tokens in the imported dashboards with a dynamically generated API token. This is useful for managing API access to the dashboards. + {{ Fill BatchSize Description }} + Int32 - SwitchParameter + Int32 - False + None - APIToken + Filter - Specifies the API token to use for replacing API tokens in the imported dashboards. This parameter is required when `ReplaceAPITokensOnImport` is set to `$true`. + {{ Fill Filter Description }} Object @@ -24729,9 +24781,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - PrivateUserName + Name - Specifies the username of dashboard owner when creating dashboard as private. + {{ Fill Name Description }} String @@ -24753,79 +24805,2020 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - Import-LMDashboard - - GithubUserRepo - - Specifies the GitHub repository (in the format "username/repo") from which to import JSON dashboard files. - - String - - String - - - None - - - GithubAccessToken - - Specifies the GitHub access token to use for authenticated requests. This is required for large repositories, as the GitHub API has rate limits for unauthenticated requests. - - String - - String - - - None - - - ParentGroupName - - Specifies the name of the parent dashboard group under which the imported dashboards will be placed. This parameter is mandatory when importing from a file or GitHub repository. - - String - - String - - - None - - - ReplaceAPITokensOnImport - - Indicates whether to replace API tokens in the imported dashboards with a dynamically generated API token. This is useful for managing API access to the dashboards. - - - SwitchParameter - - - False - - - APIToken - - Specifies the API token to use for replacing API tokens in the imported dashboards. This parameter is required when `ReplaceAPITokensOnImport` is set to `$true`. - - Object - - Object - - + + + + BatchSize + + {{ Fill BatchSize Description }} + + Int32 + + Int32 + + + None + + + Filter + + {{ Fill Filter Description }} + + Object + + Object + + + None + + + Id + + {{ Fill Id Description }} + + Int32 + + Int32 + + + None + + + Name + + {{ Fill Name Description }} + + String + + String + + + None + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + + + None + + + + + + + + + + System.Object + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + PS C:\> {{ Add example code here }} + + {{ Add example description here }} + + + + + + + + Get-LMWebsiteGroupSDTHistory + Get + LMWebsiteGroupSDTHistory + + {{ Fill in the Synopsis }} + + + + {{ Fill in the Description }} + + + + Get-LMWebsiteGroupSDTHistory + + BatchSize + + {{ Fill BatchSize Description }} + + Int32 + + Int32 + + + None + + + Filter + + {{ Fill Filter Description }} + + Object + + Object + + + None + + + Id + + {{ Fill Id Description }} + + Int32 + + Int32 + + + None + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + Get-LMWebsiteGroupSDTHistory + + BatchSize + + {{ Fill BatchSize Description }} + + Int32 + + Int32 + + + None + + + Filter + + {{ Fill Filter Description }} + + Object + + Object + + + None + + + Name + + {{ Fill Name Description }} + + String + + String + + + None + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + + + BatchSize + + {{ Fill BatchSize Description }} + + Int32 + + Int32 + + + None + + + Filter + + {{ Fill Filter Description }} + + Object + + Object + + + None + + + Id + + {{ Fill Id Description }} + + Int32 + + Int32 + + + None + + + Name + + {{ Fill Name Description }} + + String + + String + + + None + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + + + None + + + + + + + + + + System.Object + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + PS C:\> {{ Add example code here }} + + {{ Add example description here }} + + + + + + + + Get-LMWebsiteProperty + Get + LMWebsiteProperty + + {{ Fill in the Synopsis }} + + + + {{ Fill in the Description }} + + + + Get-LMWebsiteProperty + + BatchSize + + {{ Fill BatchSize Description }} + + Int32 + + Int32 + + + None + + + Filter + + {{ Fill Filter Description }} + + Object + + Object + + + None + + + Id + + {{ Fill Id Description }} + + Int32 + + Int32 + + + None + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + Get-LMWebsiteProperty + + BatchSize + + {{ Fill BatchSize Description }} + + Int32 + + Int32 + + + None + + + Filter + + {{ Fill Filter Description }} + + Object + + Object + + + None + + + Name + + {{ Fill Name Description }} + + String + + String + + + None + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + + + BatchSize + + {{ Fill BatchSize Description }} + + Int32 + + Int32 + + + None + + + Filter + + {{ Fill Filter Description }} + + Object + + Object + + + None + + + Id + + {{ Fill Id Description }} + + Int32 + + Int32 + + + None + + + Name + + {{ Fill Name Description }} + + String + + String + + + None + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + + + None + + + + + + + + + + System.Object + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + PS C:\> {{ Add example code here }} + + {{ Add example description here }} + + + + + + + + Get-LMWebsiteSDT + Get + LMWebsiteSDT + + {{ Fill in the Synopsis }} + + + + {{ Fill in the Description }} + + + + Get-LMWebsiteSDT + + BatchSize + + {{ Fill BatchSize Description }} + + Int32 + + Int32 + + + None + + + Filter + + {{ Fill Filter Description }} + + Object + + Object + + + None + + + Id + + {{ Fill Id Description }} + + Int32 + + Int32 + + + None + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + Get-LMWebsiteSDT + + BatchSize + + {{ Fill BatchSize Description }} + + Int32 + + Int32 + + + None + + + Filter + + {{ Fill Filter Description }} + + Object + + Object + + + None + + + Name + + {{ Fill Name Description }} + + String + + String + + + None + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + + + BatchSize + + {{ Fill BatchSize Description }} + + Int32 + + Int32 + + + None + + + Filter + + {{ Fill Filter Description }} + + Object + + Object + + + None + + + Id + + {{ Fill Id Description }} + + Int32 + + Int32 + + + None + + + Name + + {{ Fill Name Description }} + + String + + String + + + None + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + + + None + + + + + + + + + + System.Object + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + PS C:\> {{ Add example code here }} + + {{ Add example description here }} + + + + + + + + Get-LMWebsiteSDTHistory + Get + LMWebsiteSDTHistory + + {{ Fill in the Synopsis }} + + + + {{ Fill in the Description }} + + + + Get-LMWebsiteSDTHistory + + BatchSize + + {{ Fill BatchSize Description }} + + Int32 + + Int32 + + + None + + + Filter + + {{ Fill Filter Description }} + + Object + + Object + + + None + + + Id + + {{ Fill Id Description }} + + Int32 + + Int32 + + + None + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + Get-LMWebsiteSDTHistory + + BatchSize + + {{ Fill BatchSize Description }} + + Int32 + + Int32 + + + None + + + Filter + + {{ Fill Filter Description }} + + Object + + Object + + + None + + + Name + + {{ Fill Name Description }} + + String + + String + + + None + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + + + BatchSize + + {{ Fill BatchSize Description }} + + Int32 + + Int32 + + + None + + + Filter + + {{ Fill Filter Description }} + + Object + + Object + + + None + + + Id + + {{ Fill Id Description }} + + Int32 + + Int32 + + + None + + + Name + + {{ Fill Name Description }} + + String + + String + + + None + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + + + None + + + + + + + + + + System.Object + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + PS C:\> {{ Add example code here }} + + {{ Add example description here }} + + + + + + + + Import-LMDashboard + Import + LMDashboard + + Imports LogicMonitor dashboards from various sources. + + + + The `Import-LMDashboard` function allows you to import LogicMonitor dashboards from different sources, such as local files, GitHub repositories, or LogicMonitor dashboard groups. It supports importing dashboards in JSON format. + + + + Import-LMDashboard + + FilePath + + Specifies the path to a local file or directory containing the JSON dashboard files to import. If a directory is specified, all JSON files within the directory (and its subdirectories) will be imported. + + String + + String + + + None + + + ParentGroupName + + Specifies the name of the parent dashboard group under which the imported dashboards will be placed. This parameter is mandatory when importing from a file or GitHub repository. + + String + + String + + + None + + + ReplaceAPITokensOnImport + + Indicates whether to replace API tokens in the imported dashboards with a dynamically generated API token. This is useful for managing API access to the dashboards. + + + SwitchParameter + + + False + + + APIToken + + Specifies the API token to use for replacing API tokens in the imported dashboards. This parameter is required when `ReplaceAPITokensOnImport` is set to `$true`. + + Object + + Object + + + None + + + PrivateUserName + + Specifies the username of dashboard owner when creating dashboard as private. + + String + + String + + + None + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + Import-LMDashboard + + FilePath + + Specifies the path to a local file or directory containing the JSON dashboard files to import. If a directory is specified, all JSON files within the directory (and its subdirectories) will be imported. + + String + + String + + + None + + + ParentGroupId + + Specifies the ID of the parent dashboard group under which the imported dashboards will be placed. This parameter is mandatory when importing from a file or GitHub repository. + + String + + String + + + None + + + ReplaceAPITokensOnImport + + Indicates whether to replace API tokens in the imported dashboards with a dynamically generated API token. This is useful for managing API access to the dashboards. + + + SwitchParameter + + + False + + + APIToken + + Specifies the API token to use for replacing API tokens in the imported dashboards. This parameter is required when `ReplaceAPITokensOnImport` is set to `$true`. + + Object + + Object + + + None + + + PrivateUserName + + Specifies the username of dashboard owner when creating dashboard as private. + + String + + String + + + None + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + Import-LMDashboard + + File + + Specifies a single JSON dashboard file to import. + + String + + String + + + None + + + ParentGroupName + + Specifies the name of the parent dashboard group under which the imported dashboards will be placed. This parameter is mandatory when importing from a file or GitHub repository. + + String + + String + + + None + + + ReplaceAPITokensOnImport + + Indicates whether to replace API tokens in the imported dashboards with a dynamically generated API token. This is useful for managing API access to the dashboards. + + + SwitchParameter + + + False + + + APIToken + + Specifies the API token to use for replacing API tokens in the imported dashboards. This parameter is required when `ReplaceAPITokensOnImport` is set to `$true`. + + Object + + Object + + + None + + + PrivateUserName + + Specifies the username of dashboard owner when creating dashboard as private. + + String + + String + + + None + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + Import-LMDashboard + + File + + Specifies a single JSON dashboard file to import. + + String + + String + + + None + + + ParentGroupId + + Specifies the ID of the parent dashboard group under which the imported dashboards will be placed. This parameter is mandatory when importing from a file or GitHub repository. + + String + + String + + + None + + + ReplaceAPITokensOnImport + + Indicates whether to replace API tokens in the imported dashboards with a dynamically generated API token. This is useful for managing API access to the dashboards. + + + SwitchParameter + + + False + + + APIToken + + Specifies the API token to use for replacing API tokens in the imported dashboards. This parameter is required when `ReplaceAPITokensOnImport` is set to `$true`. + + Object + + Object + + + None + + + PrivateUserName + + Specifies the username of dashboard owner when creating dashboard as private. + + String + + String + + + None + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + Import-LMDashboard + + GithubUserRepo + + Specifies the GitHub repository (in the format "username/repo") from which to import JSON dashboard files. + + String + + String + + + None + + + GithubAccessToken + + Specifies the GitHub access token to use for authenticated requests. This is required for large repositories, as the GitHub API has rate limits for unauthenticated requests. + + String + + String + + + None + + + ParentGroupName + + Specifies the name of the parent dashboard group under which the imported dashboards will be placed. This parameter is mandatory when importing from a file or GitHub repository. + + String + + String + + + None + + + ReplaceAPITokensOnImport + + Indicates whether to replace API tokens in the imported dashboards with a dynamically generated API token. This is useful for managing API access to the dashboards. + + + SwitchParameter + + + False + + + APIToken + + Specifies the API token to use for replacing API tokens in the imported dashboards. This parameter is required when `ReplaceAPITokensOnImport` is set to `$true`. + + Object + + Object + + + None + + + PrivateUserName + + Specifies the username of dashboard owner when creating dashboard as private. + + String + + String + + + None + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + Import-LMDashboard + + GithubUserRepo + + Specifies the GitHub repository (in the format "username/repo") from which to import JSON dashboard files. + + String + + String + + + None + + + GithubAccessToken + + Specifies the GitHub access token to use for authenticated requests. This is required for large repositories, as the GitHub API has rate limits for unauthenticated requests. + + String + + String + + + None + + + ParentGroupId + + Specifies the ID of the parent dashboard group under which the imported dashboards will be placed. This parameter is mandatory when importing from a file or GitHub repository. + + String + + String + + + None + + + ReplaceAPITokensOnImport + + Indicates whether to replace API tokens in the imported dashboards with a dynamically generated API token. This is useful for managing API access to the dashboards. + + + SwitchParameter + + + False + + + APIToken + + Specifies the API token to use for replacing API tokens in the imported dashboards. This parameter is required when `ReplaceAPITokensOnImport` is set to `$true`. + + Object + + Object + + + None + + + PrivateUserName + + Specifies the username of dashboard owner when creating dashboard as private. + + String + + String + + + None + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + + + FilePath + + Specifies the path to a local file or directory containing the JSON dashboard files to import. If a directory is specified, all JSON files within the directory (and its subdirectories) will be imported. + + String + + String + + + None + + + File + + Specifies a single JSON dashboard file to import. + + String + + String + + + None + + + GithubUserRepo + + Specifies the GitHub repository (in the format "username/repo") from which to import JSON dashboard files. + + String + + String + + + None + + + GithubAccessToken + + Specifies the GitHub access token to use for authenticated requests. This is required for large repositories, as the GitHub API has rate limits for unauthenticated requests. + + String + + String + + + None + + + ParentGroupId + + Specifies the ID of the parent dashboard group under which the imported dashboards will be placed. This parameter is mandatory when importing from a file or GitHub repository. + + String + + String + + + None + + + ParentGroupName + + Specifies the name of the parent dashboard group under which the imported dashboards will be placed. This parameter is mandatory when importing from a file or GitHub repository. + + String + + String + + + None + + + ReplaceAPITokensOnImport + + Indicates whether to replace API tokens in the imported dashboards with a dynamically generated API token. This is useful for managing API access to the dashboards. + + SwitchParameter + + SwitchParameter + + + False + + + APIToken + + Specifies the API token to use for replacing API tokens in the imported dashboards. This parameter is required when `ReplaceAPITokensOnImport` is set to `$true`. + + Object + + Object + + + None + + + PrivateUserName + + Specifies the username of dashboard owner when creating dashboard as private. + + String + + String + + + None + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + + + + + + + + + -------------------------- EXAMPLE 1 -------------------------- + Import-LMDashboard -FilePath "C:\Dashboards" -ParentGroupId 12345 -ReplaceAPITokensOnImport -APIToken $apiToken +Imports all JSON dashboard files from the "C:\Dashboards" directory and its subdirectories. The imported dashboards will be placed under the dashboard group with ID 12345. API tokens in the imported dashboards will be replaced with the specified API token. + + + + + + -------------------------- EXAMPLE 2 -------------------------- + Import-LMDashboard -GithubUserRepo "username/repo" -ParentGroupName "MyDashboards" -ReplaceAPITokensOnImport -APIToken $apiToken +Imports JSON dashboard files from the specified GitHub repository. The imported dashboards will be placed under the dashboard group with the name "MyDashboards". API tokens in the imported dashboards will be replaced with the specified API token. + + + + + + + + + + Import-LMExchangeModule + Import + LMExchangeModule + + Imports an LM Exchange module. + + + + The Import-LMExchangeModule function is used to import an LM Exchange module into LogicMonitor. + + + + Import-LMExchangeModule + + LMExchangeId + + The LM Exchange module ID to import. This parameter is mandatory. + + String + + String + + + None + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + + + LMExchangeId + + The LM Exchange module ID to import. This parameter is mandatory. + + String + + String + + + None + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + + + + + + + + + -------------------------- EXAMPLE 1 -------------------------- + Import-LMExchangeModule -LMExchangeId "LM12345" +Imports the LM Exchange module with the ID "LM12345" into LogicMonitor. + + + + + + + + + + Import-LMLogicModule + Import + LMLogicModule + + Imports a LogicModule into LogicMonitor. + + + + The Import-LMLogicModule function imports a LogicModule into LogicMonitor. It can import the LogicModule from a file path or directly from file data. The LogicModule can be of different types such as datasource, propertyrules, eventsource, topologysource, or configsource. + + + + Import-LMLogicModule + + FilePath + + Specifies the path of the file containing the LogicModule to import. This parameter is mandatory when using the 'FilePath' parameter set. + + String + + String + + None - PrivateUserName + Type - Specifies the username of dashboard owner when creating dashboard as private. + Specifies the type of the LogicModule to import. The valid values are 'datasource', 'propertyrules', 'eventsource', 'topologysource', or 'configsource'. The default value is 'datasource'. + + String + + String + + + Datasource + + + ForceOverwrite + + Indicates whether to overwrite an existing LogicModule with the same name. If set to $true, the existing LogicModule will be overwritten. If set to $false, an error will be thrown if a LogicModule with the same name already exists. The default value is $false. + + Boolean + + Boolean + + + False + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + Import-LMLogicModule + + File + + Specifies the file data of the LogicModule to import. This parameter is mandatory when using the 'File' parameter set. + + Object + + Object + + + None + + + Type + + Specifies the type of the LogicModule to import. The valid values are 'datasource', 'propertyrules', 'eventsource', 'topologysource', or 'configsource'. The default value is 'datasource'. String String + Datasource + + + ForceOverwrite + + Indicates whether to overwrite an existing LogicModule with the same name. If set to $true, the existing LogicModule will be overwritten. If set to $false, an error will be thrown if a LogicModule with the same name already exists. The default value is $false. + + Boolean + + Boolean + + + False + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + + + FilePath + + Specifies the path of the file containing the LogicModule to import. This parameter is mandatory when using the 'FilePath' parameter set. + + String + + String + + + None + + + File + + Specifies the file data of the LogicModule to import. This parameter is mandatory when using the 'File' parameter set. + + Object + + Object + + + None + + + Type + + Specifies the type of the LogicModule to import. The valid values are 'datasource', 'propertyrules', 'eventsource', 'topologysource', or 'configsource'. The default value is 'datasource'. + + String + + String + + + Datasource + + + ForceOverwrite + + Indicates whether to overwrite an existing LogicModule with the same name. If set to $true, the existing LogicModule will be overwritten. If set to $false, an error will be thrown if a LogicModule with the same name already exists. The default value is $false. + + Boolean + + Boolean + + + False + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + + + + This function requires PowerShell version 6.1 or higher to run. + + + + + -------------------------- EXAMPLE 1 -------------------------- + Import-LMLogicModule -FilePath "C:\LogicModules\datasource.xml" -Type "datasource" -ForceOverwrite $true +Imports a datasource LogicModule from the file 'datasource.xml' located in the 'C:\LogicModules' directory. If a LogicModule with the same name already exists, it will be overwritten. + + + + + + -------------------------- EXAMPLE 2 -------------------------- + Import-LMLogicModule -File $fileData -Type "propertyrules" +Imports a propertyrules LogicModule using the file data provided in the $fileData variable. If a LogicModule with the same name already exists, an error will be thrown. + + + + + + + + + + Import-LMRepositoryLogicModules + Import + LMRepositoryLogicModules + + Imports LogicMonitor repository logic modules. + + + + The Import-LMRepositoryLogicModules function imports logic modules from the LogicMonitor repository. It requires the user to be logged in and have valid API credentials. + + + + Import-LMRepositoryLogicModules + + Type + + Specifies the type of logic modules to import. Valid values are "datasources", "propertyrules", "eventsources", "topologysources", and "configsources". + + String + + String + + + None + + + LogicModuleNames + + Specifies the names of the logic modules to import. This parameter accepts an array of strings. + + String[] + + String[] + + + None + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + None + + + + + Type + + Specifies the type of logic modules to import. Valid values are "datasources", "propertyrules", "eventsources", "topologysources", and "configsources". + + String + + String + + + None + + + LogicModuleNames + + Specifies the names of the logic modules to import. This parameter accepts an array of strings. + + String[] + + String[] + + + None + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + + + + + + + + + -------------------------- EXAMPLE 1 -------------------------- + Import-LMRepositoryLogicModules -Type "datasources" -LogicModuleNames "DataSource1", "DataSource2" +Imports the logic modules with the names "DataSource1" and "DataSource2" from the LogicMonitor repository. + + + + + + + + + + Invoke-LMActiveDiscovery + Invoke + LMActiveDiscovery + + Invokes an active discovery task for LogicMonitor devices. + + + + The Invoke-LMActiveDiscovery function is used to schedule an active discovery task for LogicMonitor devices. It accepts parameters to specify the devices for which the active discovery task should be scheduled. + + + + Invoke-LMActiveDiscovery + + Id + + Specifies the ID of the device for which the active discovery task should be scheduled. This parameter is mutually exclusive with the Name parameter. + + Int32 + + Int32 + + + 0 + ProgressAction @@ -24840,11 +26833,11 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - Import-LMDashboard + Invoke-LMActiveDiscovery - GithubUserRepo + Name - Specifies the GitHub repository (in the format "username/repo") from which to import JSON dashboard files. + Specifies the name of the device for which the active discovery task should be scheduled. This parameter is mutually exclusive with the Id parameter. String @@ -24853,22 +26846,25 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - GithubAccessToken + + ProgressAction - Specifies the GitHub access token to use for authenticated requests. This is required for large repositories, as the GitHub API has rate limits for unauthenticated requests. + {{ Fill ProgressAction Description }} - String + ActionPreference - String + ActionPreference None + + + Invoke-LMActiveDiscovery - ParentGroupId + GroupId - Specifies the ID of the parent dashboard group under which the imported dashboards will be placed. This parameter is mandatory when importing from a file or GitHub repository. + Specifies the ID of the device group for which the active discovery task should be scheduled. This parameter is mutually exclusive with the GroupName parameter. String @@ -24877,33 +26873,25 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - - ReplaceAPITokensOnImport - - Indicates whether to replace API tokens in the imported dashboards with a dynamically generated API token. This is useful for managing API access to the dashboards. - - - SwitchParameter - - - False - - - APIToken + + ProgressAction - Specifies the API token to use for replacing API tokens in the imported dashboards. This parameter is required when `ReplaceAPITokensOnImport` is set to `$true`. + {{ Fill ProgressAction Description }} - Object + ActionPreference - Object + ActionPreference None - - PrivateUserName + + + Invoke-LMActiveDiscovery + + GroupName - Specifies the username of dashboard owner when creating dashboard as private. + Specifies the name of the device group for which the active discovery task should be scheduled. This parameter is mutually exclusive with the GroupId parameter. String @@ -24927,46 +26915,22 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - - FilePath - - Specifies the path to a local file or directory containing the JSON dashboard files to import. If a directory is specified, all JSON files within the directory (and its subdirectories) will be imported. - - String - - String - - - None - - - File + + Id - Specifies a single JSON dashboard file to import. + Specifies the ID of the device for which the active discovery task should be scheduled. This parameter is mutually exclusive with the Name parameter. - String + Int32 - String + Int32 - None + 0 - GithubUserRepo - - Specifies the GitHub repository (in the format "username/repo") from which to import JSON dashboard files. - - String - - String - - - None - - - GithubAccessToken + Name - Specifies the GitHub access token to use for authenticated requests. This is required for large repositories, as the GitHub API has rate limits for unauthenticated requests. + Specifies the name of the device for which the active discovery task should be scheduled. This parameter is mutually exclusive with the Id parameter. String @@ -24976,9 +26940,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - ParentGroupId + GroupId - Specifies the ID of the parent dashboard group under which the imported dashboards will be placed. This parameter is mandatory when importing from a file or GitHub repository. + Specifies the ID of the device group for which the active discovery task should be scheduled. This parameter is mutually exclusive with the GroupName parameter. String @@ -24988,45 +26952,9 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas None - ParentGroupName - - Specifies the name of the parent dashboard group under which the imported dashboards will be placed. This parameter is mandatory when importing from a file or GitHub repository. - - String - - String - - - None - - - ReplaceAPITokensOnImport - - Indicates whether to replace API tokens in the imported dashboards with a dynamically generated API token. This is useful for managing API access to the dashboards. - - SwitchParameter - - SwitchParameter - - - False - - - APIToken - - Specifies the API token to use for replacing API tokens in the imported dashboards. This parameter is required when `ReplaceAPITokensOnImport` is set to `$true`. - - Object - - Object - - - None - - - PrivateUserName + GroupName - Specifies the username of dashboard owner when creating dashboard as private. + Specifies the name of the device group for which the active discovery task should be scheduled. This parameter is mutually exclusive with the GroupId parameter. String @@ -25052,22 +26980,39 @@ Retrieves data for the device instances with IDs "12345" and "67890" for the pas - + - This function requires a valid API authentication. Make sure you are logged in before running any commands. + - Use the Connect-LMAccount function to log in and obtain valid API credentials. -------------------------- EXAMPLE 1 -------------------------- - Import-LMDashboard -FilePath "C:\Dashboards" -ParentGroupId 12345 -ReplaceAPITokensOnImport -APIToken $apiToken -Imports all JSON dashboard files from the "C:\Dashboards" directory and its subdirectories. The imported dashboards will be placed under the dashboard group with ID 12345. API tokens in the imported dashboards will be replaced with the specified API token. + Invoke-LMActiveDiscovery -Id 12345 +Invokes an active discovery task for the device with ID 12345. -------------------------- EXAMPLE 2 -------------------------- - Import-LMDashboard -GithubUserRepo "username/repo" -ParentGroupName "MyDashboards" -ReplaceAPITokensOnImport -APIToken $apiToken -Imports JSON dashboard files from the specified GitHub repository. The imported dashboards will be placed under the dashboard group with the name "MyDashboards". API tokens in the imported dashboards will be replaced with the specified API token. + Invoke-LMActiveDiscovery -Name "MyDevice" +Invokes an active discovery task for the device with the name "MyDevice". + + + + + + -------------------------- EXAMPLE 3 -------------------------- + Invoke-LMActiveDiscovery -GroupId "123" +Invokes an active discovery task for all devices in the device group with ID "123". + + + + + + -------------------------- EXAMPLE 4 -------------------------- + Invoke-LMActiveDiscovery -GroupName "Group2" +Invokes an active discovery task for all devices in the device group with the name "Group2". @@ -25077,23 +27022,47 @@ Imports JSON dashboard files from the specified GitHub repository. The imported - Import-LMExchangeModule - Import - LMExchangeModule + Invoke-LMAWSAccountTest + Invoke + LMAWSAccountTest - Imports an LM Exchange module. + Invokes a test for an AWS account in LogicMonitor. - The Import-LMExchangeModule function is used to import an LM Exchange module into LogicMonitor. + The Invoke-LMAWSAccountTest function is used to invoke a test for an AWS account in LogicMonitor. It checks if the user is logged in and has valid API credentials. If the user is logged in, it builds the necessary headers and URI, prepares the data, and sends a POST request to the LogicMonitor API to perform the test. The function returns the response from the API. - Import-LMExchangeModule + Invoke-LMAWSAccountTest - LMExchangeId + ExternalId - The LM Exchange module ID to import. This parameter is mandatory. + The external ID of the AWS account. + + String + + String + + + None + + + AccountId + + The account ID of the AWS account. + + String + + String + + + None + + + AssumedRoleARN + + The assumed role ARN of the AWS account. String @@ -25102,6 +27071,30 @@ Imports JSON dashboard files from the specified GitHub repository. The imported None + + CheckedServices + + The list of services to be checked during the test. Default value is a comma-separated string of service names supported by LogicMonitor. + + String + + String + + + DYNAMODB,EBS,EC2,AUTOSCALING,BACKUP,BACKUPPROTECTEDRESOURCE,TRANSFER,ELASTICACHE,ELB,RDS,REDSHIFT,S3,SNS,SQS,EMR,KINESIS,ROUTE53,ROUTE53HOSTEDZONE,CLOUDSEARCH,LAMBDA,ECR,ECS,ELASTICSEARCH,EFS,SWFWORKFLOW,SWFACTIVITY,APPLICATIONELB,CLOUDFRONT,APIGATEWAY,APIGATEWAYV2,SES,VPN,FIREHOSE,KINESISVIDEO,WORKSPACE,NETWORKELB,NATGATEWAY,DIRECTCONNECT,DIRECTCONNECT_VIRTUALINTERFACE,WORKSPACEDIRECTORY,ELASTICBEANSTALK,DMSREPLICATION,MSKCLUSTER,MSKBROKER,FSX,TRANSITGATEWAY,GLUE,APPSTREAM,MQ,ATHENA,DBCLUSTER,DOCDB,STEPFUNCTIONS,OPSWORKS,CODEBUILD,SAGEMAKER,ROUTE53RESOLVER,DMSREPLICATIONTASKS,EVENTBRIDGE,MEDIACONNECT,MEDIAPACKAGELIVE,MEDIASTORE,MEDIAPACKAGEVOD,MEDIATAILOR,MEDIACONVERT,ELASTICTRANSCODER,COGNITO,TRANSITGATEWAYATTACHMENT,QUICKSIGHT_DASHBOARDS,QUICKSIGHT_DATASETS,PRIVATELINK_ENDPOINTS,PRIVATELINK_SERVICES,GLOBAL_NETWORKS + + + GroupId + + The device group ID to which the AWS account belongs. Default value is -1 for no group. + + String + + String + + + -1 + ProgressAction @@ -25118,9 +27111,21 @@ Imports JSON dashboard files from the specified GitHub repository. The imported - LMExchangeId + ExternalId - The LM Exchange module ID to import. This parameter is mandatory. + The external ID of the AWS account. + + String + + String + + + None + + + AccountId + + The account ID of the AWS account. String @@ -25129,6 +27134,42 @@ Imports JSON dashboard files from the specified GitHub repository. The imported None + + AssumedRoleARN + + The assumed role ARN of the AWS account. + + String + + String + + + None + + + CheckedServices + + The list of services to be checked during the test. Default value is a comma-separated string of service names supported by LogicMonitor. + + String + + String + + + DYNAMODB,EBS,EC2,AUTOSCALING,BACKUP,BACKUPPROTECTEDRESOURCE,TRANSFER,ELASTICACHE,ELB,RDS,REDSHIFT,S3,SNS,SQS,EMR,KINESIS,ROUTE53,ROUTE53HOSTEDZONE,CLOUDSEARCH,LAMBDA,ECR,ECS,ELASTICSEARCH,EFS,SWFWORKFLOW,SWFACTIVITY,APPLICATIONELB,CLOUDFRONT,APIGATEWAY,APIGATEWAYV2,SES,VPN,FIREHOSE,KINESISVIDEO,WORKSPACE,NETWORKELB,NATGATEWAY,DIRECTCONNECT,DIRECTCONNECT_VIRTUALINTERFACE,WORKSPACEDIRECTORY,ELASTICBEANSTALK,DMSREPLICATION,MSKCLUSTER,MSKBROKER,FSX,TRANSITGATEWAY,GLUE,APPSTREAM,MQ,ATHENA,DBCLUSTER,DOCDB,STEPFUNCTIONS,OPSWORKS,CODEBUILD,SAGEMAKER,ROUTE53RESOLVER,DMSREPLICATIONTASKS,EVENTBRIDGE,MEDIACONNECT,MEDIAPACKAGELIVE,MEDIASTORE,MEDIAPACKAGEVOD,MEDIATAILOR,MEDIACONVERT,ELASTICTRANSCODER,COGNITO,TRANSITGATEWAYATTACHMENT,QUICKSIGHT_DASHBOARDS,QUICKSIGHT_DATASETS,PRIVATELINK_ENDPOINTS,PRIVATELINK_SERVICES,GLOBAL_NETWORKS + + + GroupId + + The device group ID to which the AWS account belongs. Default value is -1 for no group. + + String + + String + + + -1 + ProgressAction @@ -25146,16 +27187,15 @@ Imports JSON dashboard files from the specified GitHub repository. The imported - + This function requires the user to be logged in before running any commands. Use the Connect-LMAccount function to log in before invoking this function. -------------------------- EXAMPLE 1 -------------------------- - Import-LMExchangeModule -LMExchangeId "LM12345" -Imports the LM Exchange module with the ID "LM12345" into LogicMonitor. + Invoke-LMAWSAccountTest -ExternalId "123456" -AccountId "987654" -AccessId "AKI123" -AccessKey "abc123" -AssumedRoleARN "arn:aws:iam::123456789012:role/MyRole" -CheckedServices "EC2,S3,RDS" -GroupId 123 - + This example invokes a test for an AWS account with the specified parameters. @@ -25163,23 +27203,23 @@ Imports the LM Exchange module with the ID "LM12345" into LogicMonitor. - Import-LMLogicModule - Import - LMLogicModule + Invoke-LMAzureAccountTest + Invoke + LMAzureAccountTest - Imports a LogicModule into LogicMonitor. + Invokes a test on an Azure account. - The Import-LMLogicModule function imports a LogicModule into LogicMonitor. It can import the LogicModule from a file path or directly from file data. The LogicModule can be of different types such as datasource, propertyrules, eventsource, topologysource, or configsource. + The Invoke-LMAzureAccountTest function is used to invoke a test on an Azure account. It checks if the user is logged in and has valid API credentials. If the user is logged in, it builds the necessary headers and URI, and then sends a POST request to the specified endpoint. The function returns the response from the API. - Import-LMLogicModule - - FilePath + Invoke-LMAzureAccountTest + + ClientId - Specifies the path of the file containing the LogicModule to import. This parameter is mandatory when using the 'FilePath' parameter set. + The client ID of the Azure account. String @@ -25188,77 +27228,74 @@ Imports the LM Exchange module with the ID "LM12345" into LogicMonitor. None - - Type + + SecretKey - Specifies the type of the LogicModule to import. The valid values are 'datasource', 'propertyrules', 'eventsource', 'topologysource', or 'configsource'. The default value is 'datasource'. + The secret key of the Azure account. String String - Datasource + None - - ForceOverwrite + + CheckedServices - Indicates whether to overwrite an existing LogicModule with the same name. If set to $true, the existing LogicModule will be overwritten. If set to $false, an error will be thrown if a LogicModule with the same name already exists. The default value is $false. + The list of services to be checked. Default value is a list of commonly used Azure services. - Boolean + String - Boolean + String - False + VIRTUALMACHINE,SQLDATABASE,APPSERVICE,EVENTHUB,REDISCACHE,REDISCACHEENTERPRISE,VIRTUALMACHINESCALESET,VIRTUALMACHINESCALESETVM,APPLICATIONGATEWAY,IOTHUB,FUNCTION,SERVICEBUS,MARIADB,MYSQL,MYSQLFLEXIBLE,POSTGRESQL,POSTGRESQLFLEXIBLE,POSTGRESQLCITUS,ANALYSISSERVICE,TABLESTORAGE,BLOBSTORAGE,FILESTORAGE,QUEUESTORAGE,STORAGEACCOUNT,APIMANAGEMENT,COSMOSDB,APPSERVICEPLAN,VIRTUALNETWORKGATEWAY,AUTOMATIONACCOUNT,EXPRESSROUTECIRCUIT,DATALAKEANALYTICS,DATALAKESTORE,APPLICATIONINSIGHTS,FIREWALL,SQLELASTICPOOL,SQLMANAGEDINSTANCE,HDINSIGHT,RECOVERYSERVICES,BACKUPPROTECTEDITEMS,RECOVERYPROTECTEDITEMS,NETWORKINTERFACE,BATCHACCOUNT,LOGICAPPS,DATAFACTORY,PUBLICIP,STREAMANALYTICS,EVENTGRID,LOADBALANCERS,SERVICEFABRICMESH,COGNITIVESEARCH,COGNITIVESERVICES,MLWORKSPACES,FRONTDOORS,KEYVAULT,RELAYNAMESPACES,NOTIFICATIONHUBS,APPSERVICEENVIRONMENT,TRAFFICMANAGER,SIGNALR,VIRTUALDESKTOP,SYNAPSEWORKSPACES,NETAPPPOOLS,DATABRICKS,LOGANALYTICSWORKSPACES,VIRTUALHUBS,VPNGATEWAYS,CDNPROFILE,POWERBIEMBEDDED,CONTAINERREGISTRY,NATGATEWAYS,BOTSERVICES,VIRTUALNETWORKS - - ProgressAction + + SubscriptionIds - {{ Fill ProgressAction Description }} + The subscription IDs associated with the Azure account. - ActionPreference + String - ActionPreference + String None - - - Import-LMLogicModule - - File + + GroupId - Specifies the file data of the LogicModule to import. This parameter is mandatory when using the 'File' parameter set. + The group ID. Default value is -1. - Object + String - Object + String - None + -1 - - Type + + TenantId - Specifies the type of the LogicModule to import. The valid values are 'datasource', 'propertyrules', 'eventsource', 'topologysource', or 'configsource'. The default value is 'datasource'. + The tenant ID of the Azure account. String String - Datasource + None - - ForceOverwrite + + IsChinaAccount - Indicates whether to overwrite an existing LogicModule with the same name. If set to $true, the existing LogicModule will be overwritten. If set to $false, an error will be thrown if a LogicModule with the same name already exists. The default value is $false. + Specifies whether the Azure account is a China account. Default value is $false. - Boolean + String - Boolean + String False @@ -25278,10 +27315,10 @@ Imports the LM Exchange module with the ID "LM12345" into LogicMonitor. - - FilePath + + ClientId - Specifies the path of the file containing the LogicModule to import. This parameter is mandatory when using the 'FilePath' parameter set. + The client ID of the Azure account. String @@ -25290,140 +27327,58 @@ Imports the LM Exchange module with the ID "LM12345" into LogicMonitor. None - - File + + SecretKey - Specifies the file data of the LogicModule to import. This parameter is mandatory when using the 'File' parameter set. + The secret key of the Azure account. - Object + String - Object + String None - - Type + + CheckedServices - Specifies the type of the LogicModule to import. The valid values are 'datasource', 'propertyrules', 'eventsource', 'topologysource', or 'configsource'. The default value is 'datasource'. + The list of services to be checked. Default value is a list of commonly used Azure services. String String - Datasource + VIRTUALMACHINE,SQLDATABASE,APPSERVICE,EVENTHUB,REDISCACHE,REDISCACHEENTERPRISE,VIRTUALMACHINESCALESET,VIRTUALMACHINESCALESETVM,APPLICATIONGATEWAY,IOTHUB,FUNCTION,SERVICEBUS,MARIADB,MYSQL,MYSQLFLEXIBLE,POSTGRESQL,POSTGRESQLFLEXIBLE,POSTGRESQLCITUS,ANALYSISSERVICE,TABLESTORAGE,BLOBSTORAGE,FILESTORAGE,QUEUESTORAGE,STORAGEACCOUNT,APIMANAGEMENT,COSMOSDB,APPSERVICEPLAN,VIRTUALNETWORKGATEWAY,AUTOMATIONACCOUNT,EXPRESSROUTECIRCUIT,DATALAKEANALYTICS,DATALAKESTORE,APPLICATIONINSIGHTS,FIREWALL,SQLELASTICPOOL,SQLMANAGEDINSTANCE,HDINSIGHT,RECOVERYSERVICES,BACKUPPROTECTEDITEMS,RECOVERYPROTECTEDITEMS,NETWORKINTERFACE,BATCHACCOUNT,LOGICAPPS,DATAFACTORY,PUBLICIP,STREAMANALYTICS,EVENTGRID,LOADBALANCERS,SERVICEFABRICMESH,COGNITIVESEARCH,COGNITIVESERVICES,MLWORKSPACES,FRONTDOORS,KEYVAULT,RELAYNAMESPACES,NOTIFICATIONHUBS,APPSERVICEENVIRONMENT,TRAFFICMANAGER,SIGNALR,VIRTUALDESKTOP,SYNAPSEWORKSPACES,NETAPPPOOLS,DATABRICKS,LOGANALYTICSWORKSPACES,VIRTUALHUBS,VPNGATEWAYS,CDNPROFILE,POWERBIEMBEDDED,CONTAINERREGISTRY,NATGATEWAYS,BOTSERVICES,VIRTUALNETWORKS - - ForceOverwrite + + SubscriptionIds - Indicates whether to overwrite an existing LogicModule with the same name. If set to $true, the existing LogicModule will be overwritten. If set to $false, an error will be thrown if a LogicModule with the same name already exists. The default value is $false. + The subscription IDs associated with the Azure account. - Boolean + String - Boolean + String - False + None - - ProgressAction + + GroupId - {{ Fill ProgressAction Description }} + The group ID. Default value is -1. - ActionPreference + String - ActionPreference + String - None + -1 - - - - - - This function requires PowerShell version 6.1 or higher to run. - - - - - -------------------------- EXAMPLE 1 -------------------------- - Import-LMLogicModule -FilePath "C:\LogicModules\datasource.xml" -Type "datasource" -ForceOverwrite $true -Imports a datasource LogicModule from the file 'datasource.xml' located in the 'C:\LogicModules' directory. If a LogicModule with the same name already exists, it will be overwritten. - - - - - - -------------------------- EXAMPLE 2 -------------------------- - Import-LMLogicModule -File $fileData -Type "propertyrules" -Imports a propertyrules LogicModule using the file data provided in the $fileData variable. If a LogicModule with the same name already exists, an error will be thrown. - - - - - - - - - - Import-LMRepositoryLogicModules - Import - LMRepositoryLogicModules - - Imports LogicMonitor repository logic modules. - - - - The Import-LMRepositoryLogicModules function imports logic modules from the LogicMonitor repository. It requires the user to be logged in and have valid API credentials. - - - - Import-LMRepositoryLogicModules - - Type - - Specifies the type of logic modules to import. Valid values are "datasources", "propertyrules", "eventsources", "topologysources", and "configsources". - - String - - String - - - None - - - LogicModuleNames - - Specifies the names of the logic modules to import. This parameter accepts an array of strings. - - String[] - - String[] - - - None - - - ProgressAction - - {{ Fill ProgressAction Description }} - - ActionPreference - - ActionPreference - - - None - - - - - - Type + + TenantId - Specifies the type of logic modules to import. Valid values are "datasources", "propertyrules", "eventsources", "topologysources", and "configsources". + The tenant ID of the Azure account. String @@ -25432,17 +27387,17 @@ Imports a propertyrules LogicModule using the file data provided in the $fileDat None - - LogicModuleNames + + IsChinaAccount - Specifies the names of the logic modules to import. This parameter accepts an array of strings. + Specifies whether the Azure account is a China account. Default value is $false. - String[] + String - String[] + String - None + False ProgressAction @@ -25467,10 +27422,9 @@ Imports a propertyrules LogicModule using the file data provided in the $fileDat -------------------------- EXAMPLE 1 -------------------------- - Import-LMRepositoryLogicModules -Type "datasources" -LogicModuleNames "DataSource1", "DataSource2" -Imports the logic modules with the names "DataSource1" and "DataSource2" from the LogicMonitor repository. + Invoke-LMAzureAccountTest -ClientId "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -SecretKey "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -SubscriptionIds "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" - + This example invokes a test on an Azure account using the specified client ID, secret key, and subscription IDs. @@ -25478,50 +27432,23 @@ Imports the logic modules with the names "DataSource1" and "DataSource2" from th - Invoke-LMActiveDiscovery + Invoke-LMAzureSubscriptionDiscovery Invoke - LMActiveDiscovery + LMAzureSubscriptionDiscovery - Invokes an active discovery task for LogicMonitor devices. + Invokes the Azure subscription discovery process to return subscriptions for a specified client Id. - The Invoke-LMActiveDiscovery function is used to schedule an active discovery task for LogicMonitor devices. It accepts parameters to specify the devices for which the active discovery task should be scheduled. + The Invoke-LMAzureSubscriptionDiscovery function is used to discover Azure subscriptions by making API requests to the LogicMonitor platform. - Invoke-LMActiveDiscovery - - Id - - Specifies the ID of the device for which the active discovery task should be scheduled. This parameter is mutually exclusive with the Name parameter. - - Int32 - - Int32 - - - 0 - - - ProgressAction - - {{ Fill ProgressAction Description }} - - ActionPreference - - ActionPreference - - - None - - - - Invoke-LMActiveDiscovery - - Name + Invoke-LMAzureSubscriptionDiscovery + + ClientId - Specifies the name of the device for which the active discovery task should be scheduled. This parameter is mutually exclusive with the Id parameter. + The client ID of the Azure Active Directory application. String @@ -25530,25 +27457,10 @@ Imports the logic modules with the names "DataSource1" and "DataSource2" from th None - - ProgressAction - - {{ Fill ProgressAction Description }} - - ActionPreference - - ActionPreference - - - None - - - - Invoke-LMActiveDiscovery - - GroupId + + SecretKey - Specifies the ID of the device group for which the active discovery task should be scheduled. This parameter is mutually exclusive with the GroupName parameter. + The secret key of the Azure Active Directory application. String @@ -25557,32 +27469,29 @@ Imports the logic modules with the names "DataSource1" and "DataSource2" from th None - - ProgressAction + + TenantId - {{ Fill ProgressAction Description }} + The tenant ID of the Azure Active Directory application. - ActionPreference + String - ActionPreference + String None - - - Invoke-LMActiveDiscovery - - GroupName + + IsChinaAccount - Specifies the name of the device group for which the active discovery task should be scheduled. This parameter is mutually exclusive with the GroupId parameter. + Specifies whether the Azure account is a China account. Default value is $false. String String - None + False ProgressAction @@ -25599,22 +27508,22 @@ Imports the logic modules with the names "DataSource1" and "DataSource2" from th - - Id + + ClientId - Specifies the ID of the device for which the active discovery task should be scheduled. This parameter is mutually exclusive with the Name parameter. + The client ID of the Azure Active Directory application. - Int32 + String - Int32 + String - 0 + None - - Name + + SecretKey - Specifies the name of the device for which the active discovery task should be scheduled. This parameter is mutually exclusive with the Id parameter. + The secret key of the Azure Active Directory application. String @@ -25623,10 +27532,10 @@ Imports the logic modules with the names "DataSource1" and "DataSource2" from th None - - GroupId + + TenantId - Specifies the ID of the device group for which the active discovery task should be scheduled. This parameter is mutually exclusive with the GroupName parameter. + The tenant ID of the Azure Active Directory application. String @@ -25635,17 +27544,17 @@ Imports the logic modules with the names "DataSource1" and "DataSource2" from th None - - GroupName + + IsChinaAccount - Specifies the name of the device group for which the active discovery task should be scheduled. This parameter is mutually exclusive with the GroupId parameter. + Specifies whether the Azure account is a China account. Default value is $false. String String - None + False ProgressAction @@ -25664,39 +27573,13 @@ Imports the logic modules with the names "DataSource1" and "DataSource2" from th - - This function requires a valid API authentication. Make sure you are logged in before running any commands. - - Use the Connect-LMAccount function to log in and obtain valid API credentials. + -------------------------- EXAMPLE 1 -------------------------- - Invoke-LMActiveDiscovery -Id 12345 -Invokes an active discovery task for the device with ID 12345. - - - - - - -------------------------- EXAMPLE 2 -------------------------- - Invoke-LMActiveDiscovery -Name "MyDevice" -Invokes an active discovery task for the device with the name "MyDevice". - - - - - - -------------------------- EXAMPLE 3 -------------------------- - Invoke-LMActiveDiscovery -GroupId "123" -Invokes an active discovery task for all devices in the device group with ID "123". - - - - - - -------------------------- EXAMPLE 4 -------------------------- - Invoke-LMActiveDiscovery -GroupName "Group2" -Invokes an active discovery task for all devices in the device group with the name "Group2". + Invoke-LMAzureSubscriptionDiscovery -ClientId "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -SecretKey "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -TenantId "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" @@ -27597,6 +29480,163 @@ Schedules a configuration collection task for the device with the ID 123, the da + + + Invoke-LMGCPAccountTest + Invoke + LMGCPAccountTest + + Invokes a test for a GCP (Google Cloud Platform) account. + + + + The Invoke-LMGCPAccountTest function is used to invoke a test for a GCP account. It checks if the user is logged in and has valid API credentials. If the user is logged in, it builds the necessary headers and URI, prepares the data, and sends a POST request to the LogicMonitor API to perform the test. The function returns the response from the API. + + + + Invoke-LMGCPAccountTest + + ServiceAccountKey + + The service account key for the GCP account. + + String + + String + + + None + + + ProjectId + + The ID of the GCP project. + + String + + String + + + None + + + CheckedServices + + (Optional) A comma-separated list of GCP services to be checked. The default value is a list of all LM supported GCP services. + + String + + String + + + CLOUDRUN,CLOUDDNS,REGIONALHTTPSLOADBALANCER,COMPUTEENGINEAUTOSCALER,COMPUTEENGINE,CLOUDIOT,CLOUDROUTER,CLOUDTASKS,VPNGATEWAY,CLOUDREDIS,CLOUDCOMPOSER,INTERCONNECTATTACHMENT,CLOUDFUNCTION,CLOUDBIGTABLE,CLOUDFILESTORE,CLOUDPUBSUB,CLOUDTRACE,CLOUDSTORAGE,CLOUDDATAPROC,CLOUDINTERCONNECT,CLOUDAIPLATFORM,CLOUDSQL,MANAGEDSERVICEFORMICROSOFTAD,CLOUDFIRESTORE,CLOUDDATAFLOW,CLOUDTPU,CLOUDDLP,APPENGINE,HTTPSLOADBALANCER,CLOUDSPANNER + + + GroupId + + (Optional) The ID of the group to which the GCP account belongs. The default value is -1, indicating no group. + + String + + String + + + -1 + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + + + ServiceAccountKey + + The service account key for the GCP account. + + String + + String + + + None + + + ProjectId + + The ID of the GCP project. + + String + + String + + + None + + + CheckedServices + + (Optional) A comma-separated list of GCP services to be checked. The default value is a list of all LM supported GCP services. + + String + + String + + + CLOUDRUN,CLOUDDNS,REGIONALHTTPSLOADBALANCER,COMPUTEENGINEAUTOSCALER,COMPUTEENGINE,CLOUDIOT,CLOUDROUTER,CLOUDTASKS,VPNGATEWAY,CLOUDREDIS,CLOUDCOMPOSER,INTERCONNECTATTACHMENT,CLOUDFUNCTION,CLOUDBIGTABLE,CLOUDFILESTORE,CLOUDPUBSUB,CLOUDTRACE,CLOUDSTORAGE,CLOUDDATAPROC,CLOUDINTERCONNECT,CLOUDAIPLATFORM,CLOUDSQL,MANAGEDSERVICEFORMICROSOFTAD,CLOUDFIRESTORE,CLOUDDATAFLOW,CLOUDTPU,CLOUDDLP,APPENGINE,HTTPSLOADBALANCER,CLOUDSPANNER + + + GroupId + + (Optional) The ID of the group to which the GCP account belongs. The default value is -1, indicating no group. + + String + + String + + + -1 + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + + + + This function requires the user to be logged in before running any commands. Use the Connect-LMAccount function to log in before invoking this function. + + + + + -------------------------- EXAMPLE 1 -------------------------- + Invoke-LMGCPAccountTest -ServiceAccountKey "service-account-key" -ProjectId "project-id" + + This example invokes a test for a GCP account using the specified service account key and project ID. + + + + + Invoke-LMNetScan @@ -27674,8 +29714,94 @@ Schedules a configuration collection task for the device with the ID 123, the da -------------------------- EXAMPLE 1 -------------------------- - Invoke-LMNetScan -Id "12345" -Schedules the NetScan task with ID "12345" in LogicMonitor. + Invoke-LMNetScan -Id "12345" +Schedules the NetScan task with ID "12345" in LogicMonitor. + + + + + + + + + + Invoke-LMUserLogoff + Invoke + LMUserLogoff + + Invokes a session logoff for one or more users in Logic Monitor. + + + + The Invoke-LMUserLogoff function is used to log off one or more users from a Logic Monitor session. It checks if the user is logged in and has valid API credentials before making the logoff request. If the user is not logged in, an error message is displayed. + + + + Invoke-LMUserLogoff + + Usernames + + Specifies an array of usernames for which the session logoff needs to be invoked. + + String[] + + String[] + + + None + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + + + Usernames + + Specifies an array of usernames for which the session logoff needs to be invoked. + + String[] + + String[] + + + None + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + + + + + + + + + -------------------------- EXAMPLE 1 -------------------------- + Invoke-LMUserLogoff -Usernames "user1", "user2" +Invokes a session logoff for the users "user1" and "user2" in Logic Monitor. @@ -27685,27 +29811,51 @@ Schedules the NetScan task with ID "12345" in LogicMonitor. - Invoke-LMUserLogoff - Invoke - LMUserLogoff + New-LMAccessGroup + New + LMAccessGroup - Invokes a session logoff for one or more users in Logic Monitor. + {{ Fill in the Synopsis }} - The Invoke-LMUserLogoff function is used to log off one or more users from a Logic Monitor session. It checks if the user is logged in and has valid API credentials before making the logoff request. If the user is not logged in, an error message is displayed. + {{ Fill in the Description }} - Invoke-LMUserLogoff - - Usernames + New-LMAccessGroup + + Name - Specifies an array of usernames for which the session logoff needs to be invoked. + {{ Fill Name Description }} - String[] + String - String[] + String + + + None + + + Description + + {{ Fill Description Description }} + + String + + String + + + None + + + Tenant + + {{ Fill Tenant Description }} + + String + + String None @@ -27725,14 +29875,38 @@ Schedules the NetScan task with ID "12345" in LogicMonitor. - - Usernames + + Description - Specifies an array of usernames for which the session logoff needs to be invoked. + {{ Fill Description Description }} - String[] + String - String[] + String + + + None + + + Name + + {{ Fill Name Description }} + + String + + String + + + None + + + Tenant + + {{ Fill Tenant Description }} + + String + + String None @@ -27750,8 +29924,26 @@ Schedules the NetScan task with ID "12345" in LogicMonitor. None - - + + + + None + + + + + + + + + + System.Object + + + + + + @@ -27759,11 +29951,10 @@ Schedules the NetScan task with ID "12345" in LogicMonitor. - -------------------------- EXAMPLE 1 -------------------------- - Invoke-LMUserLogoff -Usernames "user1", "user2" -Invokes a session logoff for the users "user1" and "user2" in Logic Monitor. + -------------------------- Example 1 -------------------------- + PS C:\> {{ Add example code here }} - + {{ Add example description here }} @@ -27956,6 +30147,92 @@ Invokes a session logoff for the users "user1" and "user2" in Logic Monitor. -------------------------- EXAMPLE 1 -------------------------- New-LMAlertEscalation -Id "DS12345" +Creates a new escalation for the alert with ID "12345". + + + + + + + + + + New-LMAlertEscalation + New + LMAlertEscalation + + Creates a new escalation for a LogicMonitor alert. + + + + The New-LMAlertEscalation function creates a new escalation for a LogicMonitor alert. It checks if the user is logged in and has valid API credentials before making the API request to create the escalation. + + + + New-LMAlertEscalation + + Id + + The ID of the alert for which the escalation needs to be created. + + String + + String + + + None + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + + + Id + + The ID of the alert for which the escalation needs to be created. + + String + + String + + + None + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + + + + + + + + + -------------------------- EXAMPLE 1 -------------------------- + New-LMAlertEscalation -Id "DS12345" Creates a new escalation for the alert with ID "12345". @@ -30545,7 +32822,7 @@ Creates a new escalation for the alert with ID "12345". None - + Name The name of the host device associated with the new instance. Mandatory when using the 'Name-dsName' or 'Name-dsId' parameter sets. @@ -30680,7 +32957,7 @@ Creates a new escalation for the alert with ID "12345". None - + Id The ID of the host device associated with the new instance. Mandatory when using the 'Id-dsId' or 'Id-dsName' parameter sets. @@ -30815,7 +33092,7 @@ Creates a new escalation for the alert with ID "12345". None - + Name The name of the host device associated with the new instance. Mandatory when using the 'Name-dsName' or 'Name-dsId' parameter sets. @@ -30950,7 +33227,7 @@ Creates a new escalation for the alert with ID "12345". None - + Id The ID of the host device associated with the new instance. Mandatory when using the 'Id-dsId' or 'Id-dsName' parameter sets. @@ -31097,7 +33374,7 @@ Creates a new escalation for the alert with ID "12345". None - + Id The ID of the host device associated with the new instance. Mandatory when using the 'Id-dsId' or 'Id-dsName' parameter sets. @@ -31109,7 +33386,7 @@ Creates a new escalation for the alert with ID "12345". 0 - + Name The name of the host device associated with the new instance. Mandatory when using the 'Name-dsName' or 'Name-dsId' parameter sets. @@ -31203,7 +33480,7 @@ Creates a new escalation for the alert with ID "12345". None - + Name The name of the device associated with the instance group. This parameter is mandatory when using the 'Name-dsName' or 'Name-dsId' parameter sets. @@ -31266,7 +33543,7 @@ Creates a new escalation for the alert with ID "12345". None - + Id The ID of the device associated with the instance group. This parameter is mandatory when using the 'Id-dsId' or 'Id-dsName' parameter sets. @@ -31329,70 +33606,70 @@ Creates a new escalation for the alert with ID "12345". 0 + + Name + + The name of the device associated with the instance group. This parameter is mandatory when using the 'Name-dsName' or 'Name-dsId' parameter sets. + + String + + String + + + None + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + New-LMDeviceDatasourceInstanceGroup - Name - - The name of the device associated with the instance group. This parameter is mandatory when using the 'Name-dsName' or 'Name-dsId' parameter sets. - - String - - String - - - None - - - ProgressAction - - {{ Fill ProgressAction Description }} - - ActionPreference - - ActionPreference - - - None - - - - New-LMDeviceDatasourceInstanceGroup - - InstanceGroupName - - The name of the instance group to create. This parameter is mandatory. - - String - - String - - - None - - - Description - - The description of the instance group. - - String - - String - - - None - - - DatasourceId - - The ID of the datasource associated with the instance group. This parameter is mandatory when using the 'Id-dsId' or 'Name-dsId' parameter sets. - - Int32 - - Int32 - - - 0 - - + InstanceGroupName + + The name of the instance group to create. This parameter is mandatory. + + String + + String + + + None + + + Description + + The description of the instance group. + + String + + String + + + None + + + DatasourceId + + The ID of the datasource associated with the instance group. This parameter is mandatory when using the 'Id-dsId' or 'Name-dsId' parameter sets. + + Int32 + + Int32 + + + 0 + + Id The ID of the device associated with the instance group. This parameter is mandatory when using the 'Id-dsId' or 'Id-dsName' parameter sets. @@ -31467,7 +33744,7 @@ Creates a new escalation for the alert with ID "12345". 0 - + Id The ID of the device associated with the instance group. This parameter is mandatory when using the 'Id-dsId' or 'Id-dsName' parameter sets. @@ -31479,7 +33756,7 @@ Creates a new escalation for the alert with ID "12345". 0 - + Name The name of the device associated with the instance group. This parameter is mandatory when using the 'Name-dsName' or 'Name-dsId' parameter sets. @@ -39954,6 +42231,216 @@ Creates a new network scan with the specified collector ID, name, and subnet ran + + + Remove-LMAccessGroup + Remove + LMAccessGroup + + {{ Fill in the Synopsis }} + + + + {{ Fill in the Description }} + + + + Remove-LMAccessGroup + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + SwitchParameter + + + False + + + Id + + {{ Fill Id Description }} + + Int32 + + Int32 + + + None + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + SwitchParameter + + + False + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + Remove-LMAccessGroup + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + SwitchParameter + + + False + + + Name + + {{ Fill Name Description }} + + String + + String + + + None + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + SwitchParameter + + + False + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + SwitchParameter + + SwitchParameter + + + False + + + Id + + {{ Fill Id Description }} + + Int32 + + Int32 + + + None + + + Name + + {{ Fill Name Description }} + + String + + String + + + None + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + SwitchParameter + + SwitchParameter + + + False + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + + + System.Int32 + + + + + + + + + + System.Object + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + PS C:\> {{ Add example code here }} + + {{ Add example description here }} + + + + + Remove-LMAPIToken @@ -42243,11 +44730,411 @@ Removes the datasource with the display name "My Datasource". - Remove-LMDevice + Remove-LMDevice + + Name + + Specifies the name of the device to be removed. This parameter is mandatory when using the 'Name' parameter set. + + String + + String + + + None + + + HardDelete + + Indicates whether the device should be hard deleted. If set to $true, the device will be permanently deleted. If set to $false (default), the device will be moved to the Recycle Bin. + + Boolean + + Boolean + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + SwitchParameter + + + False + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + SwitchParameter + + + False + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + + + Id + + Specifies the ID of the device to be removed. This parameter is mandatory when using the 'Id' parameter set. + + Int32 + + Int32 + + + 0 + + + Name + + Specifies the name of the device to be removed. This parameter is mandatory when using the 'Name' parameter set. + + String + + String + + + None + + + HardDelete + + Indicates whether the device should be hard deleted. If set to $true, the device will be permanently deleted. If set to $false (default), the device will be moved to the Recycle Bin. + + Boolean + + Boolean + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + SwitchParameter + + SwitchParameter + + + False + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + SwitchParameter + + SwitchParameter + + + False + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + + + You can pipe input to this function. + + + + + + + + + + System.Management.Automation.PSCustomObject. The output object contains the following properties: + + + + + + + + - Id: The ID of the removed device. + + + + + + + + - Message: A message indicating the success of the removal operation. + + + + + + + + + + + + + + -------------------------- EXAMPLE 1 -------------------------- + Remove-LMDevice -Id 12345 +Removes the LogicMonitor device with ID 12345. + + + + + + -------------------------- EXAMPLE 2 -------------------------- + Remove-LMDevice -Name "MyDevice" +Removes the LogicMonitor device with the name "MyDevice". + + + + + + -------------------------- EXAMPLE 3 -------------------------- + Remove-LMDevice -Name "MyDevice" -HardDelete $true +Permanently deletes the LogicMonitor device with the name "MyDevice". + + + + + + + + + + Remove-LMDeviceDatasourceInstance + Remove + LMDeviceDatasourceInstance + + Removes a device datasource instance from Logic Monitor. + + + + The Remove-LMDeviceDatasourceInstance function removes a device datasource instance from Logic Monitor. It requires valid API credentials and the user must be logged in before running this command. + + + + Remove-LMDeviceDatasourceInstance + + DatasourceName + + Specifies the name of the datasource. This parameter is mandatory when using the 'Id-dsName' or 'Name-dsName' parameter sets. + + String + + String + + + None + + + DeviceName + + {{ Fill DeviceName Description }} + + String + + String + + + None + + + WildValue + + Specifies the wildcard value associated with the datasource instance. + + String + + String + + + None + + + InstanceId + + {{ Fill InstanceId Description }} + + Int32 + + Int32 + + + 0 + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + SwitchParameter + + + False + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + SwitchParameter + + + False + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + Remove-LMDeviceDatasourceInstance + + DatasourceName + + Specifies the name of the datasource. This parameter is mandatory when using the 'Id-dsName' or 'Name-dsName' parameter sets. + + String + + String + + + None + + + DeviceId + + {{ Fill DeviceId Description }} + + Int32 + + Int32 + + + 0 + + + WildValue + + Specifies the wildcard value associated with the datasource instance. + + String + + String + + + None + + + InstanceId + + {{ Fill InstanceId Description }} + + Int32 + + Int32 + + + 0 + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + SwitchParameter + + + False + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + SwitchParameter + + + False + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + Remove-LMDeviceDatasourceInstance - Name + DatasourceId - Specifies the name of the device to be removed. This parameter is mandatory when using the 'Name' parameter set. + Specifies the ID of the datasource. This parameter is mandatory when using the 'Id-dsId' or 'Name-dsId' parameter sets. + + Int32 + + Int32 + + + 0 + + + DeviceName + + {{ Fill DeviceName Description }} String @@ -42256,18 +45143,115 @@ Removes the datasource with the display name "My Datasource". None - - HardDelete + + WildValue - Indicates whether the device should be hard deleted. If set to $true, the device will be permanently deleted. If set to $false (default), the device will be moved to the Recycle Bin. + Specifies the wildcard value associated with the datasource instance. - Boolean + String - Boolean + String + + + None + + + InstanceId + + {{ Fill InstanceId Description }} + + Int32 + + Int32 + + + 0 + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + SwitchParameter False + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + SwitchParameter + + + False + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + Remove-LMDeviceDatasourceInstance + + DatasourceId + + Specifies the ID of the datasource. This parameter is mandatory when using the 'Id-dsId' or 'Name-dsId' parameter sets. + + Int32 + + Int32 + + + 0 + + + DeviceId + + {{ Fill DeviceId Description }} + + Int32 + + Int32 + + + 0 + + + WildValue + + Specifies the wildcard value associated with the datasource instance. + + String + + String + + + None + + + InstanceId + + {{ Fill InstanceId Description }} + + Int32 + + Int32 + + + 0 + WhatIf @@ -42305,10 +45289,22 @@ Removes the datasource with the display name "My Datasource". - - Id + + DatasourceName - Specifies the ID of the device to be removed. This parameter is mandatory when using the 'Id' parameter set. + Specifies the name of the datasource. This parameter is mandatory when using the 'Id-dsName' or 'Name-dsName' parameter sets. + + String + + String + + + None + + + DatasourceId + + Specifies the ID of the datasource. This parameter is mandatory when using the 'Id-dsId' or 'Name-dsId' parameter sets. Int32 @@ -42318,9 +45314,21 @@ Removes the datasource with the display name "My Datasource". 0 - Name + DeviceId - Specifies the name of the device to be removed. This parameter is mandatory when using the 'Name' parameter set. + {{ Fill DeviceId Description }} + + Int32 + + Int32 + + + 0 + + + DeviceName + + {{ Fill DeviceName Description }} String @@ -42329,17 +45337,29 @@ Removes the datasource with the display name "My Datasource". None - - HardDelete + + WildValue - Indicates whether the device should be hard deleted. If set to $true, the device will be permanently deleted. If set to $false (default), the device will be moved to the Recycle Bin. + Specifies the wildcard value associated with the datasource instance. - Boolean + String - Boolean + String - False + None + + + InstanceId + + {{ Fill InstanceId Description }} + + Int32 + + Int32 + + + 0 WhatIf @@ -42381,7 +45401,7 @@ Removes the datasource with the display name "My Datasource". - You can pipe input to this function. + None. @@ -42391,7 +45411,7 @@ Removes the datasource with the display name "My Datasource". - System.Management.Automation.PSCustomObject. The output object contains the following properties: + A custom object with the following properties: @@ -42399,7 +45419,7 @@ Removes the datasource with the display name "My Datasource". - - Id: The ID of the removed device. + - InstanceId: The ID of the removed instance. @@ -42407,7 +45427,7 @@ Removes the datasource with the display name "My Datasource". - - Message: A message indicating the success of the removal operation. + - Message: A message indicating the success of the removal. @@ -42422,24 +45442,16 @@ Removes the datasource with the display name "My Datasource". -------------------------- EXAMPLE 1 -------------------------- - Remove-LMDevice -Id 12345 -Removes the LogicMonitor device with ID 12345. + Remove-LMDeviceDatasourceInstance -Name "MyDevice" -DatasourceName "MyDatasource" -WildValue "12345" +Removes the device datasource instance with the specified device name, datasource name, and wildcard value. -------------------------- EXAMPLE 2 -------------------------- - Remove-LMDevice -Name "MyDevice" -Removes the LogicMonitor device with the name "MyDevice". - - - - - - -------------------------- EXAMPLE 3 -------------------------- - Remove-LMDevice -Name "MyDevice" -HardDelete $true -Permanently deletes the LogicMonitor device with the name "MyDevice". + Remove-LMDeviceDatasourceInstance -Id 123 -DatasourceId 456 -WildValue "67890" +Removes the device datasource instance with the specified device ID, datasource ID, and wildcard value. @@ -42449,23 +45461,23 @@ Permanently deletes the LogicMonitor device with the name "MyDevice". - Remove-LMDeviceDatasourceInstance + Remove-LMDeviceDatasourceInstanceGroup Remove - LMDeviceDatasourceInstance + LMDeviceDatasourceInstanceGroup - Removes a device datasource instance from Logic Monitor. + Removes a LogicMonitor device datasource instance group. - The Remove-LMDeviceDatasourceInstance function removes a device datasource instance from Logic Monitor. It requires valid API credentials and the user must be logged in before running this command. + The Remove-LMDeviceDatasourceInstanceGroup function removes a LogicMonitor device datasource instance group based on the provided parameters. It requires valid API credentials and a logged-in session. - Remove-LMDeviceDatasourceInstance + Remove-LMDeviceDatasourceInstanceGroup DatasourceName - Specifies the name of the datasource. This parameter is mandatory when using the 'Id-dsName' or 'Name-dsName' parameter sets. + Specifies the name of the datasource associated with the instance group. This parameter is mandatory when using the 'Id-dsName' or 'Name-dsName' parameter sets. String @@ -42474,10 +45486,10 @@ Permanently deletes the LogicMonitor device with the name "MyDevice". None - - DeviceName + + Name - Specifies the name of the device. This parameter is mandatory when using the 'Name-dsName' or 'Name-dsId' parameter sets. + Specifies the name of the device associated with the instance group. This parameter is mandatory when using the 'Name-dsName' or 'Name-dsId' parameter sets. This parameter can also be specified using the 'DeviceName' alias. String @@ -42486,10 +45498,10 @@ Permanently deletes the LogicMonitor device with the name "MyDevice". None - - WildValue + + InstanceGroupName - Specifies the wildcard value associated with the datasource instance. + Specifies the name of the instance group to be removed. This parameter is mandatory. String @@ -42534,11 +45546,11 @@ Permanently deletes the LogicMonitor device with the name "MyDevice". - Remove-LMDeviceDatasourceInstance + Remove-LMDeviceDatasourceInstanceGroup DatasourceName - Specifies the name of the datasource. This parameter is mandatory when using the 'Id-dsName' or 'Name-dsName' parameter sets. + Specifies the name of the datasource associated with the instance group. This parameter is mandatory when using the 'Id-dsName' or 'Name-dsName' parameter sets. String @@ -42547,10 +45559,10 @@ Permanently deletes the LogicMonitor device with the name "MyDevice". None - - DeviceId + + Id - Specifies the ID of the device. This parameter is mandatory when using the 'Id-dsId' or 'Id-dsName' parameter sets. + Specifies the ID of the device associated with the instance group. This parameter is mandatory when using the 'Id-dsId' or 'Id-dsName' parameter sets. This parameter can also be specified using the 'DeviceId' alias. Int32 @@ -42559,10 +45571,10 @@ Permanently deletes the LogicMonitor device with the name "MyDevice". 0 - - WildValue + + InstanceGroupName - Specifies the wildcard value associated with the datasource instance. + Specifies the name of the instance group to be removed. This parameter is mandatory. String @@ -42607,11 +45619,11 @@ Permanently deletes the LogicMonitor device with the name "MyDevice". - Remove-LMDeviceDatasourceInstance + Remove-LMDeviceDatasourceInstanceGroup DatasourceId - Specifies the ID of the datasource. This parameter is mandatory when using the 'Id-dsId' or 'Name-dsId' parameter sets. + Specifies the ID of the datasource associated with the instance group. This parameter is mandatory when using the 'Id-dsId' or 'Name-dsId' parameter sets. Int32 @@ -42620,10 +45632,10 @@ Permanently deletes the LogicMonitor device with the name "MyDevice". 0 - - DeviceName + + Name - Specifies the name of the device. This parameter is mandatory when using the 'Name-dsName' or 'Name-dsId' parameter sets. + Specifies the name of the device associated with the instance group. This parameter is mandatory when using the 'Name-dsName' or 'Name-dsId' parameter sets. This parameter can also be specified using the 'DeviceName' alias. String @@ -42632,10 +45644,10 @@ Permanently deletes the LogicMonitor device with the name "MyDevice". None - - WildValue + + InstanceGroupName - Specifies the wildcard value associated with the datasource instance. + Specifies the name of the instance group to be removed. This parameter is mandatory. String @@ -42680,11 +45692,11 @@ Permanently deletes the LogicMonitor device with the name "MyDevice". - Remove-LMDeviceDatasourceInstance + Remove-LMDeviceDatasourceInstanceGroup DatasourceId - Specifies the ID of the datasource. This parameter is mandatory when using the 'Id-dsId' or 'Name-dsId' parameter sets. + Specifies the ID of the datasource associated with the instance group. This parameter is mandatory when using the 'Id-dsId' or 'Name-dsId' parameter sets. Int32 @@ -42693,10 +45705,10 @@ Permanently deletes the LogicMonitor device with the name "MyDevice". 0 - - DeviceId + + Id - Specifies the ID of the device. This parameter is mandatory when using the 'Id-dsId' or 'Id-dsName' parameter sets. + Specifies the ID of the device associated with the instance group. This parameter is mandatory when using the 'Id-dsId' or 'Id-dsName' parameter sets. This parameter can also be specified using the 'DeviceId' alias. Int32 @@ -42705,10 +45717,10 @@ Permanently deletes the LogicMonitor device with the name "MyDevice". 0 - - WildValue + + InstanceGroupName - Specifies the wildcard value associated with the datasource instance. + Specifies the name of the instance group to be removed. This parameter is mandatory. String @@ -42757,7 +45769,7 @@ Permanently deletes the LogicMonitor device with the name "MyDevice". DatasourceName - Specifies the name of the datasource. This parameter is mandatory when using the 'Id-dsName' or 'Name-dsName' parameter sets. + Specifies the name of the datasource associated with the instance group. This parameter is mandatory when using the 'Id-dsName' or 'Name-dsName' parameter sets. String @@ -42769,7 +45781,7 @@ Permanently deletes the LogicMonitor device with the name "MyDevice". DatasourceId - Specifies the ID of the datasource. This parameter is mandatory when using the 'Id-dsId' or 'Name-dsId' parameter sets. + Specifies the ID of the datasource associated with the instance group. This parameter is mandatory when using the 'Id-dsId' or 'Name-dsId' parameter sets. Int32 @@ -42778,10 +45790,10 @@ Permanently deletes the LogicMonitor device with the name "MyDevice". 0 - - DeviceId + + Id - Specifies the ID of the device. This parameter is mandatory when using the 'Id-dsId' or 'Id-dsName' parameter sets. + Specifies the ID of the device associated with the instance group. This parameter is mandatory when using the 'Id-dsId' or 'Id-dsName' parameter sets. This parameter can also be specified using the 'DeviceId' alias. Int32 @@ -42790,10 +45802,10 @@ Permanently deletes the LogicMonitor device with the name "MyDevice". 0 - - DeviceName + + Name - Specifies the name of the device. This parameter is mandatory when using the 'Name-dsName' or 'Name-dsId' parameter sets. + Specifies the name of the device associated with the instance group. This parameter is mandatory when using the 'Name-dsName' or 'Name-dsId' parameter sets. This parameter can also be specified using the 'DeviceName' alias. String @@ -42802,10 +45814,10 @@ Permanently deletes the LogicMonitor device with the name "MyDevice". None - - WildValue + + InstanceGroupName - Specifies the wildcard value associated with the datasource instance. + Specifies the name of the instance group to be removed. This parameter is mandatory. String @@ -42854,39 +45866,14 @@ Permanently deletes the LogicMonitor device with the name "MyDevice". - None. + None. You cannot pipe objects to this function. - - - - A custom object with the following properties: - - - - - - - - - InstanceId: The ID of the removed instance. - - - - - - - - - Message: A message indicating the success of the removal. - - - - - - + @@ -42895,16 +45882,16 @@ Permanently deletes the LogicMonitor device with the name "MyDevice". -------------------------- EXAMPLE 1 -------------------------- - Remove-LMDeviceDatasourceInstance -DeviceName "MyDevice" -DatasourceName "MyDatasource" -WildValue "12345" -Removes the device datasource instance with the specified device name, datasource name, and wildcard value. + Remove-LMDeviceDatasourceInstanceGroup -DatasourceName "CPU" -Name "Server01" -InstanceGroupName "Group1" +Removes the instance group named "Group1" associated with the "CPU" datasource on the device named "Server01". -------------------------- EXAMPLE 2 -------------------------- - Remove-LMDeviceDatasourceInstance -DeviceId 123 -DatasourceId 456 -WildValue "67890" -Removes the device datasource instance with the specified device ID, datasource ID, and wildcard value. + Remove-LMDeviceDatasourceInstanceGroup -DatasourceId 123 -Id 456 -InstanceGroupName "Group2" +Removes the instance group named "Group2" associated with the datasource ID 123 on the device ID 456. @@ -46738,6 +49725,256 @@ Removes the LogicMonitor role with the Name "Admin". + + + Set-LMAccessGroup + Set + LMAccessGroup + + {{ Fill in the Synopsis }} + + + + {{ Fill in the Description }} + + + + Set-LMAccessGroup + + Description + + {{ Fill Description Description }} + + String + + String + + + None + + + Id + + {{ Fill Id Description }} + + Int32 + + Int32 + + + None + + + NewName + + {{ Fill NewName Description }} + + String + + String + + + None + + + Tenant + + {{ Fill Tenant Description }} + + String + + String + + + None + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + Set-LMAccessGroup + + Description + + {{ Fill Description Description }} + + String + + String + + + None + + + Name + + {{ Fill Name Description }} + + String + + String + + + None + + + NewName + + {{ Fill NewName Description }} + + String + + String + + + None + + + Tenant + + {{ Fill Tenant Description }} + + String + + String + + + None + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + + + Description + + {{ Fill Description Description }} + + String + + String + + + None + + + Id + + {{ Fill Id Description }} + + Int32 + + Int32 + + + None + + + Name + + {{ Fill Name Description }} + + String + + String + + + None + + + NewName + + {{ Fill NewName Description }} + + String + + String + + + None + + + Tenant + + {{ Fill Tenant Description }} + + String + + String + + + None + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + + + System.Int32 + + + + + + + + + + System.Object + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + PS C:\> {{ Add example code here }} + + {{ Add example description here }} + + + + + Set-LMAPIToken @@ -50451,6 +53688,18 @@ Removes the LogicMonitor role with the Name "Admin". None + + AutoBalancedCollectorGroupId + + {{ Fill AutoBalancedCollectorGroupId Description }} + + Int32 + + Int32 + + + None + Confirm @@ -50697,6 +53946,18 @@ Removes the LogicMonitor role with the Name "Admin". None + + AutoBalancedCollectorGroupId + + {{ Fill AutoBalancedCollectorGroupId Description }} + + Int32 + + Int32 + + + None + Confirm @@ -50931,6 +54192,18 @@ Removes the LogicMonitor role with the Name "Admin". + + AutoBalancedCollectorGroupId + + {{ Fill AutoBalancedCollectorGroupId Description }} + + Int32 + + Int32 + + + None + AutoBalancedCollectorGroupId @@ -51226,30 +54499,31 @@ Removes the LogicMonitor role with the Name "Admin". Set LMDeviceDatasourceInstance - {{ Fill in the Synopsis }} + Sets the properties of a LogicMonitor device datasource instance. - {{ Fill in the Description }} + The Set-LMDeviceDatasourceInstance function is used to set the properties of a LogicMonitor device datasource instance. It allows you to update the display name, wild values, description, custom properties, monitoring and alerting settings, and instance group ID of the specified instance. Set-LMDeviceDatasourceInstance - - Confirm + + DisplayName - Prompts you for confirmation before running the cmdlet. + Specifies the new display name for the instance. + String - SwitchParameter + String - False + None - - DatasourceId + + WildValue - {{ Fill DatasourceId Description }} + Specifies the first wild value for the instance. String @@ -51259,9 +54533,9 @@ Removes the LogicMonitor role with the Name "Admin". None - Description + WildValue2 - {{ Fill Description Description }} + Specifies the second wild value for the instance. String @@ -51270,10 +54544,10 @@ Removes the LogicMonitor role with the Name "Admin". None - - DeviceName + + Description - {{ Fill DeviceName Description }} + Specifies the description for the instance. String @@ -51283,9 +54557,21 @@ Removes the LogicMonitor role with the Name "Admin". None - DisableAlerting + Properties - {{ Fill DisableAlerting Description }} + Specifies a hashtable of custom properties for the instance. + + Hashtable + + Hashtable + + + None + + + StopMonitoring + + Specifies whether to stop monitoring the instance. This parameter accepts $true or $false. Boolean @@ -51295,13 +54581,13 @@ Removes the LogicMonitor role with the Name "Admin". None - DisplayName + DisableAlerting - {{ Fill DisplayName Description }} + Specifies whether to disable alerting for the instance. This parameter accepts $true or $false. - String + Boolean - String + Boolean None @@ -51309,7 +54595,7 @@ Removes the LogicMonitor role with the Name "Admin". InstanceGroupId - {{ Fill InstanceGroupId Description }} + Specifies the ID of the instance group to which the instance belongs. String @@ -51318,10 +54604,10 @@ Removes the LogicMonitor role with the Name "Admin". None - + InstanceId - {{ Fill InstanceId Description }} + Specifies the ID of the instance to update. This parameter is mandatory and can be provided via pipeline. String @@ -51330,26 +54616,26 @@ Removes the LogicMonitor role with the Name "Admin". None - - Properties + + DatasourceName - {{ Fill Properties Description }} + Specifies the name of the datasource associated with the instance. This parameter is mandatory when using the 'Name-dsName' parameter set. - Hashtable + String - Hashtable + String None - - StopMonitoring + + Name - {{ Fill StopMonitoring Description }} + Specifies the name of the device associated with the instance. This parameter is mandatory when using the 'Name-dsName' or 'Name-dsId' parameter set. This parameter can also be specified using the 'DeviceName' alias. - Boolean + String - Boolean + String None @@ -51365,29 +54651,16 @@ Removes the LogicMonitor role with the Name "Admin". False - - WildValue - - {{ Fill WildValue Description }} - - String - - String - - - None - - - WildValue2 + + Confirm - {{ Fill WildValue2 Description }} + Prompts you for confirmation before running the cmdlet. - String - String + SwitchParameter - None + False ProgressAction @@ -51404,21 +54677,22 @@ Removes the LogicMonitor role with the Name "Admin". Set-LMDeviceDatasourceInstance - - Confirm + + DisplayName - Prompts you for confirmation before running the cmdlet. + Specifies the new display name for the instance. + String - SwitchParameter + String - False + None - - DatasourceId + + WildValue - {{ Fill DatasourceId Description }} + Specifies the first wild value for the instance. String @@ -51428,9 +54702,9 @@ Removes the LogicMonitor role with the Name "Admin". None - Description + WildValue2 - {{ Fill Description Description }} + Specifies the second wild value for the instance. String @@ -51439,10 +54713,10 @@ Removes the LogicMonitor role with the Name "Admin". None - - DeviceId + + Description - {{ Fill DeviceId Description }} + Specifies the description for the instance. String @@ -51452,9 +54726,21 @@ Removes the LogicMonitor role with the Name "Admin". None - DisableAlerting + Properties - {{ Fill DisableAlerting Description }} + Specifies a hashtable of custom properties for the instance. + + Hashtable + + Hashtable + + + None + + + StopMonitoring + + Specifies whether to stop monitoring the instance. This parameter accepts $true or $false. Boolean @@ -51464,13 +54750,13 @@ Removes the LogicMonitor role with the Name "Admin". None - DisplayName + DisableAlerting - {{ Fill DisplayName Description }} + Specifies whether to disable alerting for the instance. This parameter accepts $true or $false. - String + Boolean - String + Boolean None @@ -51478,7 +54764,7 @@ Removes the LogicMonitor role with the Name "Admin". InstanceGroupId - {{ Fill InstanceGroupId Description }} + Specifies the ID of the instance group to which the instance belongs. String @@ -51487,10 +54773,10 @@ Removes the LogicMonitor role with the Name "Admin". None - + InstanceId - {{ Fill InstanceId Description }} + Specifies the ID of the instance to update. This parameter is mandatory and can be provided via pipeline. String @@ -51499,26 +54785,26 @@ Removes the LogicMonitor role with the Name "Admin". None - - Properties + + DatasourceName - {{ Fill Properties Description }} + Specifies the name of the datasource associated with the instance. This parameter is mandatory when using the 'Name-dsName' parameter set. - Hashtable + String - Hashtable + String None - - StopMonitoring + + Id - {{ Fill StopMonitoring Description }} + Specifies the ID of the device associated with the instance. This parameter is mandatory when using the 'Id-dsId' or 'Id-dsName' parameter set. This parameter can also be specified using the 'DeviceId' alias. - Boolean + String - Boolean + String None @@ -51534,29 +54820,16 @@ Removes the LogicMonitor role with the Name "Admin". False - - WildValue - - {{ Fill WildValue Description }} - - String - - String - - - None - - - WildValue2 + + Confirm - {{ Fill WildValue2 Description }} + Prompts you for confirmation before running the cmdlet. - String - String + SwitchParameter - None + False ProgressAction @@ -51573,21 +54846,22 @@ Removes the LogicMonitor role with the Name "Admin". Set-LMDeviceDatasourceInstance - - Confirm + + DisplayName - Prompts you for confirmation before running the cmdlet. + Specifies the new display name for the instance. + String - SwitchParameter + String - False + None - - DatasourceName + + WildValue - {{ Fill DatasourceName Description }} + Specifies the first wild value for the instance. String @@ -51597,9 +54871,9 @@ Removes the LogicMonitor role with the Name "Admin". None - Description + WildValue2 - {{ Fill Description Description }} + Specifies the second wild value for the instance. String @@ -51608,10 +54882,10 @@ Removes the LogicMonitor role with the Name "Admin". None - - DeviceName + + Description - {{ Fill DeviceName Description }} + Specifies the description for the instance. String @@ -51621,9 +54895,21 @@ Removes the LogicMonitor role with the Name "Admin". None - DisableAlerting + Properties - {{ Fill DisableAlerting Description }} + Specifies a hashtable of custom properties for the instance. + + Hashtable + + Hashtable + + + None + + + StopMonitoring + + Specifies whether to stop monitoring the instance. This parameter accepts $true or $false. Boolean @@ -51633,13 +54919,13 @@ Removes the LogicMonitor role with the Name "Admin". None - DisplayName + DisableAlerting - {{ Fill DisplayName Description }} + Specifies whether to disable alerting for the instance. This parameter accepts $true or $false. - String + Boolean - String + Boolean None @@ -51647,7 +54933,7 @@ Removes the LogicMonitor role with the Name "Admin". InstanceGroupId - {{ Fill InstanceGroupId Description }} + Specifies the ID of the instance group to which the instance belongs. String @@ -51656,10 +54942,10 @@ Removes the LogicMonitor role with the Name "Admin". None - + InstanceId - {{ Fill InstanceId Description }} + Specifies the ID of the instance to update. This parameter is mandatory and can be provided via pipeline. String @@ -51668,26 +54954,26 @@ Removes the LogicMonitor role with the Name "Admin". None - - Properties + + DatasourceId - {{ Fill Properties Description }} + Specifies the ID of the datasource associated with the instance. This parameter is mandatory when using the 'Id-dsId' or 'Name-dsId' parameter set. - Hashtable + String - Hashtable + String None - - StopMonitoring + + Name - {{ Fill StopMonitoring Description }} + Specifies the name of the device associated with the instance. This parameter is mandatory when using the 'Name-dsName' or 'Name-dsId' parameter set. This parameter can also be specified using the 'DeviceName' alias. - Boolean + String - Boolean + String None @@ -51703,29 +54989,16 @@ Removes the LogicMonitor role with the Name "Admin". False - - WildValue - - {{ Fill WildValue Description }} - - String - - String - - - None - - - WildValue2 + + Confirm - {{ Fill WildValue2 Description }} + Prompts you for confirmation before running the cmdlet. - String - String + SwitchParameter - None + False ProgressAction @@ -51742,21 +55015,22 @@ Removes the LogicMonitor role with the Name "Admin". Set-LMDeviceDatasourceInstance - - Confirm + + DisplayName - Prompts you for confirmation before running the cmdlet. + Specifies the new display name for the instance. + String - SwitchParameter + String - False + None - - DatasourceName + + WildValue - {{ Fill DatasourceName Description }} + Specifies the first wild value for the instance. String @@ -51766,9 +55040,9 @@ Removes the LogicMonitor role with the Name "Admin". None - Description + WildValue2 - {{ Fill Description Description }} + Specifies the second wild value for the instance. String @@ -51777,10 +55051,10 @@ Removes the LogicMonitor role with the Name "Admin". None - - DeviceId + + Description - {{ Fill DeviceId Description }} + Specifies the description for the instance. String @@ -51790,9 +55064,21 @@ Removes the LogicMonitor role with the Name "Admin". None - DisableAlerting + Properties - {{ Fill DisableAlerting Description }} + Specifies a hashtable of custom properties for the instance. + + Hashtable + + Hashtable + + + None + + + StopMonitoring + + Specifies whether to stop monitoring the instance. This parameter accepts $true or $false. Boolean @@ -51802,13 +55088,13 @@ Removes the LogicMonitor role with the Name "Admin". None - DisplayName + DisableAlerting - {{ Fill DisplayName Description }} + Specifies whether to disable alerting for the instance. This parameter accepts $true or $false. - String + Boolean - String + Boolean None @@ -51816,7 +55102,7 @@ Removes the LogicMonitor role with the Name "Admin". InstanceGroupId - {{ Fill InstanceGroupId Description }} + Specifies the ID of the instance group to which the instance belongs. String @@ -51825,10 +55111,10 @@ Removes the LogicMonitor role with the Name "Admin". None - + InstanceId - {{ Fill InstanceId Description }} + Specifies the ID of the instance to update. This parameter is mandatory and can be provided via pipeline. String @@ -51837,26 +55123,26 @@ Removes the LogicMonitor role with the Name "Admin". None - - Properties + + DatasourceId - {{ Fill Properties Description }} + Specifies the ID of the datasource associated with the instance. This parameter is mandatory when using the 'Id-dsId' or 'Name-dsId' parameter set. - Hashtable + String - Hashtable + String None - - StopMonitoring + + Id - {{ Fill StopMonitoring Description }} + Specifies the ID of the device associated with the instance. This parameter is mandatory when using the 'Id-dsId' or 'Id-dsName' parameter set. This parameter can also be specified using the 'DeviceId' alias. - Boolean + String - Boolean + String None @@ -51872,29 +55158,16 @@ Removes the LogicMonitor role with the Name "Admin". False - - WildValue - - {{ Fill WildValue Description }} - - String - - String - - - None - - - WildValue2 + + Confirm - {{ Fill WildValue2 Description }} + Prompts you for confirmation before running the cmdlet. - String - String + SwitchParameter - None + False ProgressAction @@ -51911,22 +55184,22 @@ Removes the LogicMonitor role with the Name "Admin". - - Confirm + + DisplayName - Prompts you for confirmation before running the cmdlet. + Specifies the new display name for the instance. - SwitchParameter + String - SwitchParameter + String - False + None - - DatasourceId + + WildValue - {{ Fill DatasourceId Description }} + Specifies the first wild value for the instance. String @@ -51935,10 +55208,10 @@ Removes the LogicMonitor role with the Name "Admin". None - - DatasourceName + + WildValue2 - {{ Fill DatasourceName Description }} + Specifies the second wild value for the instance. String @@ -51950,7 +55223,7 @@ Removes the LogicMonitor role with the Name "Admin". Description - {{ Fill Description Description }} + Specifies the description for the instance. String @@ -51959,26 +55232,26 @@ Removes the LogicMonitor role with the Name "Admin". None - - DeviceId + + Properties - {{ Fill DeviceId Description }} + Specifies a hashtable of custom properties for the instance. - String + Hashtable - String + Hashtable None - - DeviceName + + StopMonitoring - {{ Fill DeviceName Description }} + Specifies whether to stop monitoring the instance. This parameter accepts $true or $false. - String + Boolean - String + Boolean None @@ -51986,7 +55259,7 @@ Removes the LogicMonitor role with the Name "Admin". DisableAlerting - {{ Fill DisableAlerting Description }} + Specifies whether to disable alerting for the instance. This parameter accepts $true or $false. Boolean @@ -51996,9 +55269,9 @@ Removes the LogicMonitor role with the Name "Admin". None - DisplayName + InstanceGroupId - {{ Fill DisplayName Description }} + Specifies the ID of the instance group to which the instance belongs. String @@ -52007,10 +55280,10 @@ Removes the LogicMonitor role with the Name "Admin". None - - InstanceGroupId + + InstanceId - {{ Fill InstanceGroupId Description }} + Specifies the ID of the instance to update. This parameter is mandatory and can be provided via pipeline. String @@ -52019,10 +55292,10 @@ Removes the LogicMonitor role with the Name "Admin". None - - InstanceId + + DatasourceName - {{ Fill InstanceId Description }} + Specifies the name of the datasource associated with the instance. This parameter is mandatory when using the 'Name-dsName' parameter set. String @@ -52031,65 +55304,65 @@ Removes the LogicMonitor role with the Name "Admin". None - - Properties + + DatasourceId - {{ Fill Properties Description }} + Specifies the ID of the datasource associated with the instance. This parameter is mandatory when using the 'Id-dsId' or 'Name-dsId' parameter set. - Hashtable + String - Hashtable + String None - - StopMonitoring + + Id - {{ Fill StopMonitoring Description }} + Specifies the ID of the device associated with the instance. This parameter is mandatory when using the 'Id-dsId' or 'Id-dsName' parameter set. This parameter can also be specified using the 'DeviceId' alias. - Boolean + String - Boolean + String None - - WhatIf + + Name - Shows what would happen if the cmdlet runs. The cmdlet is not run. + Specifies the name of the device associated with the instance. This parameter is mandatory when using the 'Name-dsName' or 'Name-dsId' parameter set. This parameter can also be specified using the 'DeviceName' alias. - SwitchParameter + String - SwitchParameter + String - False + None - - WildValue + + WhatIf - {{ Fill WildValue Description }} + Shows what would happen if the cmdlet runs. The cmdlet is not run. - String + SwitchParameter - String + SwitchParameter - None + False - - WildValue2 + + Confirm - {{ Fill WildValue2 Description }} + Prompts you for confirmation before running the cmdlet. - String + SwitchParameter - String + SwitchParameter - None + False ProgressAction @@ -52104,26 +55377,8 @@ Removes the LogicMonitor role with the Name "Admin". None - - - - System.String - - - - - - - - - - System.Object - - - - - - + + @@ -52131,10 +55386,17 @@ Removes the LogicMonitor role with the Name "Admin". - -------------------------- Example 1 -------------------------- - PS C:\> {{ Add example code here }} + -------------------------- EXAMPLE 1 -------------------------- + Set-LMDeviceDatasourceInstance -InstanceId 12345 -DisplayName "New Instance Name" -Description "Updated instance description" - {{ Add example description here }} + This example sets the display name and description of the instance with ID 12345. + + + + -------------------------- EXAMPLE 2 -------------------------- + Get-LMDevice -Name "MyDevice" | Set-LMDeviceDatasourceInstance -DatasourceName "MyDatasource" -DisplayName "New Instance Name" + + This example retrieves the device with the name "MyDevice" and sets the display name of the instance associated with the datasource "MyDatasource". @@ -61428,6 +64690,269 @@ Sets the user data for the user with Id "12345" for the dashboard with Id "67890 -------------------------- EXAMPLE 2 -------------------------- Set-LMUserdata -Name "JohnDoe" -DashboardId "67890" +Sets the user data for the user with Name "JohnDoe" for the dashboard with Id "67890". + + + + + + + + + + Set-LMUserdata + Set + LMUserdata + + Sets userdata for a LogicMonitor user. Currently only setting the default dashboard is supported. + + + + The Set-LMUserdata function is used to set the user data for a LogicMonitor user. It allows you to specify the user by either their Id or Name, and the dashboard Id for which the user data should be set. + + + + Set-LMUserdata + + Id + + Specifies the Id of the user. This parameter is mandatory when using the 'Id' parameter set. + + String + + String + + + None + + + DashboardId + + Specifies the Id of the dashboard for which the user data should be set. This parameter is mandatory. + + String + + String + + + None + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + SwitchParameter + + + False + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + SwitchParameter + + + False + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + Set-LMUserdata + + Name + + Specifies the Name of the user. This parameter is mandatory when using the 'Name' parameter set. + + String + + String + + + None + + + DashboardId + + Specifies the Id of the dashboard for which the user data should be set. This parameter is mandatory. + + String + + String + + + None + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + SwitchParameter + + + False + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + SwitchParameter + + + False + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + + + Id + + Specifies the Id of the user. This parameter is mandatory when using the 'Id' parameter set. + + String + + String + + + None + + + Name + + Specifies the Name of the user. This parameter is mandatory when using the 'Name' parameter set. + + String + + String + + + None + + + DashboardId + + Specifies the Id of the dashboard for which the user data should be set. This parameter is mandatory. + + String + + String + + + None + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + SwitchParameter + + SwitchParameter + + + False + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + SwitchParameter + + SwitchParameter + + + False + + + ProgressAction + + {{ Fill ProgressAction Description }} + + ActionPreference + + ActionPreference + + + None + + + + + + None. + + + + + + + + + + System.Object + + + + + + + + Returns the response from the LogicMonitor API. + + + + + + + + + This function requires a valid API authentication. Make sure you are logged in before running any commands using Connect-LMAccount. + + + + + -------------------------- EXAMPLE 1 -------------------------- + Set-LMUserdata -Id "12345" -DashboardId "67890" +Sets the user data for the user with Id "12345" for the dashboard with Id "67890". + + + + + + -------------------------- EXAMPLE 2 -------------------------- + Set-LMUserdata -Name "JohnDoe" -DashboardId "67890" Sets the user data for the user with Name "JohnDoe" for the dashboard with Id "67890".