Skip to content

Commit

Permalink
Release 3.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
U-AMERICAS\Trevor_Squillario authored and U-AMERICAS\Trevor_Squillario committed Jul 11, 2023
1 parent 8e031e3 commit cdd42bb
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ 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).

## [3.6.1]() - 2023-07-11
### Fixed
- Issue with Get-OMEJob not listing all execution histories when using the -Detail parameter

## [3.6.0]() - 2023-04-26
### Added
- New-OMEAlertPolicy
Expand Down
2 changes: 2 additions & 0 deletions DellOpenManage/Classes/Job.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Class Job {
[Boolean]$UserGenerated
[Int]$LastRunStatusId
[String]$LastRunStatus
[Int]$JobTypeId
[String]$JobType
[PSCustomObject[]]$Targets
[JobDetail[]]$JobDetail
}
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 <Trevor.Squillario@Dell.com>
#
# Generated on: 5/8/2023
# Generated on: 7/11/2023
#

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

# Version number of this module.
ModuleVersion = '3.6.0'
ModuleVersion = '3.6.1'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
2 changes: 2 additions & 0 deletions DellOpenManage/Private/New-JobFromJson.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ function New-JobFromJson {
UserGenerated = $Job.UserGenerated
LastRunStatusId = $Job.LastRunStatus.Id
LastRunStatus = $Job.LastRunStatus.Name
JobTypeId = $Job.JobType.Id
JobType = $Job.JobType.Name
Targets = $Job.Targets
}
if ($JobDetails) {
Expand Down
24 changes: 13 additions & 11 deletions DellOpenManage/Public/OME/Get-OMEJob.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@
$HistoryDetails = @()
if ($ExecResp.StatusCode -eq 200) {
$ExecRespInfo = $ExecResp.Content | ConvertFrom-Json
$HistoryId = $ExecRespInfo.value[0].Id
$ExecHistoryUrl = "$($JobExecUrl)($($HistoryId))/ExecutionHistoryDetails"
$HistoryResp = Invoke-WebRequest -UseBasicParsing -Uri $ExecHistoryUrl -Method Get -Headers $Headers -ContentType $Type
if ($HistoryResp.StatusCode -eq 200) {
$HistoryData = $HistoryResp.Content | ConvertFrom-Json
foreach ($HistoryDetail in $HistoryData.value) {
$HistoryDetails += $HistoryDetail
foreach ($ExecRespValue in $ExecRespInfo.value) {
$HistoryId = $ExecRespValue.Id
$ExecHistoryUrl = "$($JobExecUrl)($($HistoryId))/ExecutionHistoryDetails"
$HistoryResp = Invoke-WebRequest -UseBasicParsing -Uri $ExecHistoryUrl -Method Get -Headers $Headers -ContentType $Type
if ($HistoryResp.StatusCode -eq 200) {
$HistoryData = $HistoryResp.Content | ConvertFrom-Json
foreach ($HistoryDetail in $HistoryData.value) {
$HistoryDetails += $HistoryDetail
}
}
else {
Write-Warning "Unable to get job execution history details"
}
return $HistoryDetails
}
else {
Write-Warning "Unable to get job execution history details"
}
return $HistoryDetails
}
else {
Write-Warning "Unable to get job execution history info"
Expand Down
11 changes: 11 additions & 0 deletions Examples/AddToStaticGroupFromTextFile.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
$AllDevices = Get-OMEDevice # Get all devices and store in variable
$HostIPs = Get-Content "C:\Temp\hosts.txt" # Get context of text file
$NewDevices = @() # Variable to hold devices found by IP
foreach ($ip in $HostIPs) { # Loop through text file contents
$IPMatch = $AllDevices | Where-Object {$_.NetworkAddress -EQ $ip} # Look for device with matching IP
if ($IPMatch.Count -gt 0) { # Match found
$DeviceMatch = $IPMatch.Identifier | Get-OMEDevice -FilterBy "ServiceTag" # Get Device object by Service Tag
$NewDevices += $DeviceMatch # Add Device to array
}
}
Get-OMEGroup "Test Group 01" | Edit-OMEGroup -Devices $NewDevices # Edit group and add devices from the array we created
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,15 @@ Get job by state
```
"Enabled" | Get-OMEJob -FilterBy "State" | Format-Table
```
Export job details to CSV by Id
```
10085 | Get-OMEJob -FilterBy "Id" -Detail | Select-Object @{Name='JobId'; Expression='Id'}, JobName, JobTypeId, JobType, JobDescription, LastRun -ExpandProperty JobDetail
| Export-Csv -Path "C:\Temp\OMEJobDetail.csv" -NoTypeInformation
```
Get jobs filter by multiple properties
```
2070 | Get-OMEJob -FilterBy "LastRunStatus" | Where-Object JobTypeId -EQ 101
```
Run job
```
28991 | Invoke-OMEJobRun -Wait -Verbose
Expand Down

0 comments on commit cdd42bb

Please sign in to comment.