From 559110f2dd571d410becb2754b355808d7cfc9c6 Mon Sep 17 00:00:00 2001 From: Squillario Date: Tue, 8 Feb 2022 08:31:57 -0700 Subject: [PATCH] Release 2.3.4 --- CHANGELOG.md | 7 ++ DellOpenManage/DellOpenManage.psd1 | 4 +- .../Public/OME/Invoke-OMEReport.ps1 | 8 +-- .../Public/OME/Remove-OMETemplate.ps1 | 72 +++++++++++++++++++ Documentation/CommandReference.md | 1 + Documentation/Functions/New-OMEDiscovery.md | 20 +++++- Documentation/Functions/Remove-OMETemplate.md | 56 +++++++++++++++ Examples/DownloadReport.ps1 | 16 +++++ Tests/Misc.Tests.ps1 | 4 ++ Tests/Template.Tests.ps1 | 11 +++ 10 files changed, 190 insertions(+), 9 deletions(-) create mode 100644 DellOpenManage/Public/OME/Remove-OMETemplate.ps1 create mode 100644 Documentation/Functions/Remove-OMETemplate.md create mode 100644 Examples/DownloadReport.ps1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b6407f..c33a7e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.3.4]() - 2022-02-08 +### Added +- Remove-OMETemplate + +### Fixed +- Fixed output in Invoke-OMEReport to allow saving to a file or variable + ## [2.3.3]() - 2021-09-16 ### Fixed diff --git a/DellOpenManage/DellOpenManage.psd1 b/DellOpenManage/DellOpenManage.psd1 index 47e6857..af482b9 100644 --- a/DellOpenManage/DellOpenManage.psd1 +++ b/DellOpenManage/DellOpenManage.psd1 @@ -3,7 +3,7 @@ # # Generated by: Trevor Squillario # -# Generated on: 9/16/2021 +# Generated on: 2/8/2022 # @{ @@ -12,7 +12,7 @@ RootModule = 'DellOpenManage.psm1' # Version number of this module. -ModuleVersion = '2.3.3' +ModuleVersion = '2.3.4' # Supported PSEditions # CompatiblePSEditions = @() diff --git a/DellOpenManage/Public/OME/Invoke-OMEReport.ps1 b/DellOpenManage/Public/OME/Invoke-OMEReport.ps1 index 22db300..0a1908c 100644 --- a/DellOpenManage/Public/OME/Invoke-OMEReport.ps1 +++ b/DellOpenManage/Public/OME/Invoke-OMEReport.ps1 @@ -46,7 +46,7 @@ } $outputArray += , $tempHash } - $outputArray.Foreach({[PSCustomObject]$_}) | Format-Table -AutoSize + return $outputArray.Foreach({[PSCustomObject]$_}) } else { Write-Warning "No result data retrieved for report ($($ReportId))" @@ -125,16 +125,14 @@ Process { $JobId = $ReportResp.Content $JobStatus = $($JobId | Wait-OnJob) if ($JobStatus -eq 'Completed') { - Format-OutputInfo -IpAddres $IpAddress -Headers $Headers -Type $Type -ReportId $ReportId + return Format-OutputInfo -IpAddres $IpAddress -Headers $Headers -Type $Type -ReportId $ReportId } } else { Write-Error "Unable to retrieve reports from $($IpAddress)" } } Catch { - Write-Error ($_.ErrorDetails) - Write-Error ($_.Exception | Format-List -Force | Out-String) - Write-Error ($_.InvocationInfo | Format-List -Force | Out-String) + Resolve-Error $_ } } diff --git a/DellOpenManage/Public/OME/Remove-OMETemplate.ps1 b/DellOpenManage/Public/OME/Remove-OMETemplate.ps1 new file mode 100644 index 0000000..ef72509 --- /dev/null +++ b/DellOpenManage/Public/OME/Remove-OMETemplate.ps1 @@ -0,0 +1,72 @@ +using module ..\..\Classes\Template.psm1 +function Remove-OMETemplate { +<# +Copyright (c) 2018 Dell EMC Corporation + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +#> + +<# +.SYNOPSIS + Remove template in OpenManage Enterprise +.DESCRIPTION + Remove a configuration or deployment template from OpenManage Enterprise +.PARAMETER Template + Object of type Template returned from Get-OMETemplate function +.INPUTS + [Template]Template +.EXAMPLE + "TestTemplate01" | Get-OMETemplate | Remove-OMETemplate +#> + +[CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline)] + [Template]$Template +) + +Begin { + if(!$SessionAuth.Token){ + Write-Error "Please use Connect-OMEServer first" + Break + Return + } +} +Process { + Try { + if ($SessionAuth.IgnoreCertificateWarning) { Set-CertPolicy } + $BaseUri = "https://$($SessionAuth.Host)" + $Type = "application/json" + $Headers = @{} + $Headers."X-Auth-Token" = $SessionAuth.Token + + $TemplateUrl = $BaseUri + "/api/TemplateService/Templates($($Template.Id))" + + Write-Verbose "Removing template $($Template.Id)..." + $TemplateResponse = Invoke-WebRequest -Uri $TemplateUrl -Method Delete -ContentType $Type -Headers $Headers + if ($TemplateResponse.StatusCode -eq 204) { + Write-Verbose "Remove template successful..." + } + else { + Write-Error "Remove template failed..." + } + } + Catch { + Resolve-Error $_ + } +} + +End {} + +} + diff --git a/Documentation/CommandReference.md b/Documentation/CommandReference.md index f2393ae..27c9c67 100644 --- a/Documentation/CommandReference.md +++ b/Documentation/CommandReference.md @@ -53,6 +53,7 @@ - [New-OMEUser](Functions/New-OMEUser.md) - [Remove-OMEGroup](Functions/Remove-OMEGroup.md) - [Remove-OMESupportAssistGroup](Functions/Remove-OMESupportAssistGroup.md) +- [Remove-OMETemplate](Functions/Remove-OMETemplate.md) - [Set-OMEPowerState](Functions/Set-OMEPowerState.md) - [Update-OMEConfiguration](Functions/Update-OMEConfiguration.md) - [Update-OMEFirmware](Functions/Update-OMEFirmware.md) diff --git a/Documentation/Functions/New-OMEDiscovery.md b/Documentation/Functions/New-OMEDiscovery.md index d890a9e..59f37f3 100644 --- a/Documentation/Functions/New-OMEDiscovery.md +++ b/Documentation/Functions/New-OMEDiscovery.md @@ -14,8 +14,9 @@ Create new device discovery job in OpenManage Enterprise ``` New-OMEDiscovery [[-Name] ] [[-DeviceType] ] [-Hosts] [-DiscoveryUserName] - [-DiscoveryPassword] [[-Email] ] [-SetTrapDestination] [[-Schedule] ] - [[-ScheduleCron] ] [-UseAllProtocols] [-Wait] [[-WaitTime] ] [] + [-DiscoveryPassword] [[-Email] ] [-SetTrapDestination] [-SetCommunityString] + [[-Schedule] ] [[-ScheduleCron] ] [-UseAllProtocols] [-Wait] [[-WaitTime] ] + [] ``` ## DESCRIPTION @@ -178,6 +179,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -SetCommunityString +Set Community String for trap destination from Application Settings \> Incoming Alerts \> SNMP Listener + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Schedule Determines when the discovery job will be executed. (Default="RunNow", "RunLater") diff --git a/Documentation/Functions/Remove-OMETemplate.md b/Documentation/Functions/Remove-OMETemplate.md new file mode 100644 index 0000000..d4657ee --- /dev/null +++ b/Documentation/Functions/Remove-OMETemplate.md @@ -0,0 +1,56 @@ +--- +external help file: DellOpenManage-help.xml +Module Name: DellOpenManage +online version: +schema: 2.0.0 +--- + +# Remove-OMETemplate + +## SYNOPSIS +Remove template in OpenManage Enterprise + +## SYNTAX + +``` +Remove-OMETemplate [-Template]