Skip to content

Commit

Permalink
Release 2.3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
TrevorSquillario committed Mar 11, 2022
1 parent 069770f commit 1b51798
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:

publish:
name: Publish to PowerShell Gallery
needs: tests
needs: build
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ 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.8]() - 2022-03-11
### Added
- Examples/DiscoverAddToStaticGroup.ps1 will run a Discovery, create a static group and add the devices to the group

### Fixed
- Fixed column ordering in Invoke-OMEReport to properly match Report
- Fixed filtering with paged results in Get-OMEDevice. OME does not automatically add the filter parameters to @odata.nextLink

## [2.3.7]() - 2022-02-16
### Added
- Copy-OMETemplate
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: 2/16/2022
# Generated on: 3/11/2022
#

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

# Version number of this module.
ModuleVersion = '2.3.7'
ModuleVersion = '2.3.8'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
16 changes: 9 additions & 7 deletions DellOpenManage/Public/OME/Get-OMEDevice.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,17 @@ Process {
}
else { # Filter Devices directly
$DeviceCountUrl = $BaseUri + "/api/DeviceService/Devices"
$Filter = ""
if ($Value) { # Filter By
if ($FilterBy -eq 'Id' -or $FilterBy -eq 'Type') {
$DeviceCountUrl += "?`$filter=$($FilterExpr) eq $($Value)"
$Filter += "`$filter=$($FilterExpr) eq $($Value)"
}
else {
$DeviceCountUrl += "?`$filter=$($FilterExpr) eq '$($Value)'"
$Filter += "`$filter=$($FilterExpr) eq '$($Value)'"
}
}
$DeviceCountUrl = $DeviceCountUrl + "?" + $Filter
Write-Verbose $DeviceCountUrl
$DeviceResponse = Invoke-WebRequest -Uri $DeviceCountUrl -UseBasicParsing -Method Get -Headers $Headers -ContentType $Type
if ($DeviceResponse.StatusCode -eq 200)
{
Expand All @@ -165,10 +168,11 @@ Process {
}
if($DeviceCountData.'@odata.nextLink')
{
$NextLinkUrl = $BaseUri + $DeviceCountData.'@odata.nextLink'
$NextLinkUrl = $BaseUri + $DeviceCountData.'@odata.nextLink' + "&" + $Filter
}
while($NextLinkUrl)
{
Write-Verbose $NextLinkUrl
$NextLinkResponse = Invoke-WebRequest -Uri $NextLinkUrl -UseBasicParsing -Method Get -Headers $Headers -ContentType $Type
if($NextLinkResponse.StatusCode -eq 200)
{
Expand All @@ -178,7 +182,7 @@ Process {
}
if($NextLinkData.'@odata.nextLink')
{
$NextLinkUrl = $BaseUri + $NextLinkData.'@odata.nextLink'
$NextLinkUrl = $BaseUri + $NextLinkData.'@odata.nextLink' + "&" + $Filter
}
else
{
Expand All @@ -198,9 +202,7 @@ Process {
return $DeviceData
}
Catch {
Write-Error ($_.ErrorDetails)
Write-Error ($_.Exception | Format-List -Force | Out-String)
Write-Error ($_.InvocationInfo | Format-List -Force | Out-String)
Resolve-Error $_
}
}

Expand Down
2 changes: 1 addition & 1 deletion DellOpenManage/Public/OME/Invoke-OMEReport.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
}
foreach ($value in $ReportResultList) {
$resultVals = $value.Values
$tempHash = @{}
$tempHash = [ordered]@{}
for ($i =0; $i -lt $ColumnNames.Count; $i++) {
$tempHash[$ColumnNames[$i]] = $resultVals[$i]
}
Expand Down
15 changes: 15 additions & 0 deletions Examples/DiscoverAddToStaticGroup.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
$GroupName = "TestGroup01"
$Hosts = @("server01-idrac.example.com", "server02-idrac.example.com")

New-OMEDiscovery -Name "TestDiscovery01" -Hosts $Hosts -DiscoveryUserName "root" -DiscoveryPassword $(ConvertTo-SecureString 'calvin' -AsPlainText -Force) -Wait -Verbose
$Group = $($GroupName | Get-OMEGroup)
# Create static group if not found
if (-not $Group) {
New-OMEGroup $GroupName
$Group = $($GroupName | Get-OMEGroup)
}
# Loop through hosts and add to group by iDRAC DNS name
$Hosts | Foreach-Object {
$Hostname = $_
$Group | Edit-OMEGroup -Devices $($Hostname | Get-OMEDevice -FilterBy "Name")
}

0 comments on commit 1b51798

Please sign in to comment.