Skip to content

Commit

Permalink
Release 2.3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
TrevorSquillario committed Feb 8, 2022
1 parent a295b0f commit 559110f
Show file tree
Hide file tree
Showing 10 changed files with 190 additions and 9 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions DellOpenManage/DellOpenManage.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Generated by: Trevor Squillario <[email protected]>
#
# Generated on: 9/16/2021
# Generated on: 2/8/2022
#

@{
Expand All @@ -12,7 +12,7 @@
RootModule = 'DellOpenManage.psm1'

# Version number of this module.
ModuleVersion = '2.3.3'
ModuleVersion = '2.3.4'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
8 changes: 3 additions & 5 deletions DellOpenManage/Public/OME/Invoke-OMEReport.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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))"
Expand Down Expand Up @@ -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 $_
}
}

Expand Down
72 changes: 72 additions & 0 deletions DellOpenManage/Public/OME/Remove-OMETemplate.ps1
Original file line number Diff line number Diff line change
@@ -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 {}

}

1 change: 1 addition & 0 deletions Documentation/CommandReference.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
20 changes: 18 additions & 2 deletions Documentation/Functions/New-OMEDiscovery.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ Create new device discovery job in OpenManage Enterprise

```
New-OMEDiscovery [[-Name] <String>] [[-DeviceType] <String>] [-Hosts] <String[]> [-DiscoveryUserName] <String>
[-DiscoveryPassword] <SecureString> [[-Email] <String>] [-SetTrapDestination] [[-Schedule] <String>]
[[-ScheduleCron] <String>] [-UseAllProtocols] [-Wait] [[-WaitTime] <Int32>] [<CommonParameters>]
[-DiscoveryPassword] <SecureString> [[-Email] <String>] [-SetTrapDestination] [-SetCommunityString]
[[-Schedule] <String>] [[-ScheduleCron] <String>] [-UseAllProtocols] [-Wait] [[-WaitTime] <Int32>]
[<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -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")
Expand Down
56 changes: 56 additions & 0 deletions Documentation/Functions/Remove-OMETemplate.md
Original file line number Diff line number Diff line change
@@ -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] <Template> [<CommonParameters>]
```

## DESCRIPTION
Remove a configuration or deployment template from OpenManage Enterprise

## EXAMPLES

### EXAMPLE 1
```
Get-OMETemplate "TestTemplate01" | Remove-OMETemplate
```

## PARAMETERS

### -Template
Object of type Template returned from Get-OMETemplate function

```yaml
Type: Template
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
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
### [Template]Template
## OUTPUTS
## NOTES
## RELATED LINKS
16 changes: 16 additions & 0 deletions Examples/DownloadReport.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

#Requires -Modules DellOpenManage

Import-Module DellOpenManage

. ".\Examples\ExampleCredentials.ps1"

# Connect to OME
$credentials = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $OMEUsername, $(ConvertTo-SecureString -Force -AsPlainText $OMEPassword)
Connect-OMEServer -Name $OMEServer -Credentials $credentials -IgnoreCertificateWarning

# Generate report and download to CSV file
$ReportId = Get-OMEReport | Where-Object 'Name' -EQ "Warranty Report" | Select-Object -ExpandProperty Id
Invoke-OMEReport -ReportId $ReportId | Export-Csv c:\Temp\report.csv -NoTypeInformation

Disconnect-OMEServer
4 changes: 4 additions & 0 deletions Tests/Misc.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ Describe "Misc Tests" {
It "Should return ALL Reports" {
Get-OMEReport | Measure-Object | Select-Object -ExpandProperty Count | Should -BeGreaterThan 1
}
It "Should return report rows" {
$ReportId = Get-OMEReport | Where-Object 'Name' -EQ "Physical Disk Report" | Select-Object -ExpandProperty Id
Invoke-OMEReport -ReportId $ReportId | Measure-Object | Select-Object -ExpandProperty Count | Should -BeGreaterThan 1
}
}
Context "Network" -Tag "Network" {
It "Should create new Network" {
Expand Down
11 changes: 11 additions & 0 deletions Tests/Template.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ Describe "Template Tests" {
$devices = $Script:DeviceServiceTag1, $Script:DeviceServiceTag2, $Script:DeviceServiceTag3 | Get-OMEDevice
Invoke-OMETemplateDeploy -Template $template -Devices $devices -Wait | Should -BeIn @("Completed", "Warning")
}

It "Should remove deploy template" {
$template = $($Script:DeploymentTemplateNameFromString | Get-OMETemplate)
$template | Remove-OMETemplate
$Script:DeploymentTemplateNameFromString | Get-OMETemplate | Measure-Object | Select-Object -ExpandProperty Count | Should -Be 0
}
}
Context "Configuration" -Tag "Configuration" {
It ("Should create a compliance template from source device and return JobId"){
Expand Down Expand Up @@ -106,6 +112,11 @@ Describe "Template Tests" {
$baseline = $Script:ConfigurationBaselineName | Get-OMEConfigurationBaseline
$baseline | Invoke-OMEConfigurationBaselineRefresh | Should -BeGreaterThan 0
}
It "Should remove configuration template" {
$template = $($Script:ConfigurationTemplateNameFromString | Get-OMETemplate)
$template | Remove-OMETemplate
$Script:ConfigurationTemplateNameFromString | Get-OMETemplate | Measure-Object | Select-Object -ExpandProperty Count | Should -Be 0
}
}
Context "Profile" -Tag "Profile" {
It "Should unassign profile by device" {
Expand Down

0 comments on commit 559110f

Please sign in to comment.