Skip to content

Commit

Permalink
Release 3.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
TrevorSquillario committed Jan 20, 2023
1 parent 456dd4d commit f1b3dec
Show file tree
Hide file tree
Showing 7 changed files with 126 additions and 154 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.3.2]() - 2023-01-20
### Changed
- Changed Invoke-OMEApplianceBackupRestore to Invoke-OMEApplianceBackup only. Restore must be done in OME-M at this time.

## [3.3.1]() - 2023-01-20
### Fixed
- Another fix for column order issue in Invoke-OMEReport ([Issue #7](https://github.com/dell/OpenManage-PowerShell-Modules/issues/7))
Expand Down
2 changes: 1 addition & 1 deletion DellOpenManage/DellOpenManage.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'DellOpenManage.psm1'

# Version number of this module.
ModuleVersion = '3.3.1'
ModuleVersion = '3.3.2'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
using module ..\..\Classes\Domain.psm1

function Get-BackupJobPayload($Name, $Description, $Operation, $Share, $SharePath, $ShareType, $BackupFile, $DeviceId, [SecureString] $EncryptionPassword, $UserName, [SecureString] $Password, $IncludePw, $IncludeCertificates, $ScheduleCron) {
function Get-BackupJobPayload($Name, $Description, $Share, $SharePath, $ShareType, $BackupFile, $DeviceId, [SecureString] $EncryptionPassword, $UserName, [SecureString] $Password, $IncludePw, $IncludeCertificates, $ScheduleCron) {
$Payload = '{
"Id": 0,
"JobName": "Backup Task",
"JobDescription": "Create a Backup of the chassis",
"Schedule": "startnow",
"State": "Enabled",
"Targets": [],
"Params": [
"Params": [
{
"Key": "includePasswords",
"Value": "false"
Expand All @@ -29,14 +29,14 @@ function Get-BackupJobPayload($Name, $Description, $Operation, $Share, $SharePat
"Key": "shareType",
"Value": "CIFS/NFS"
},
{
"Key": "device_id",
"Value": "<Chassis ID>"
},
{
"Key": "shareAddress",
"Value": "<IP Address>"
},
{
"Key": "device_id",
"Value": "<Chassis ID>"
},
{
"Key": "encryption_password",
"Value": "<encryption password>"
Expand All @@ -48,10 +48,14 @@ function Get-BackupJobPayload($Name, $Description, $Operation, $Share, $SharePat
{
"Key": "password",
"Value": "<Share user password>"
}
},
{
"Key": "verifyCert",
"Value": "false"
}
],
"JobType": {
"Id": 21,
"Id": 106,
"Name": "Appliance_Backup_Task",
"Internal": false
}
Expand All @@ -60,73 +64,36 @@ function Get-BackupJobPayload($Name, $Description, $Operation, $Share, $SharePat
$Payload.JobName = $Name
$Payload.JobDescription = $Description
$Payload.Schedule = $ScheduleCron
if ($Operation -eq "BACKUP") {
$Payload.JobType.Id = 106
$Payload.JobType.Name = "Appliance_Backup_Task"
}
if ($Operation -eq "RESTORE") {
$Payload.JobType.Id = 107
$Payload.JobType.Name = "Appliance_Restore_Task"
}
# Update Params
for ($i = 0; $i -le $Payload.'Params'.Length; $i++) {
if ($Payload.'Params'[$i].'Key' -eq 'shareName') {
if ($SharePath) {
$Payload.'Params'[$i].'Value' = $SharePath
}
}
if ($Payload.'Params'[$i].'Key' -eq 'backup_filename') {
if ($BackupFile) {
$Payload.'Params'[$i].'Value' = $BackupFile
}
}
if ($Payload.'Params'[$i].'Key' -eq 'shareType') {
if ($ShareType) {
$Payload.'Params'[$i].'Value' = $ShareType
}
}
if ($Payload.'Params'[$i].'Key' -eq 'device_id') {
if ($DeviceId) {
$Payload.'Params'[$i].'Value' = $DeviceId.ToString()
}
}
if ($Payload.'Params'[$i].'Key' -eq 'shareAddress') {
if ($Share) {
$Payload.'Params'[$i].'Value' = $Share
}
$ParamsHashValMap = @{
"shareName" = $SharePath
"backup_filename" = $BackupFile
"shareType" = $ShareType
"shareAddress" = $Share
"device_id" = $DeviceId.ToString()
"userName" = $UserName
"password" = if ($Password) {
$PasswordText = (New-Object PSCredential "user", $Password).GetNetworkCredential().Password
$PasswordText
}
if ($Payload.'Params'[$i].'Key' -eq 'encryption_password') {
if ($EncryptionPassword) {
$EncryptionPasswordText = (New-Object PSCredential "user", $EncryptionPassword).GetNetworkCredential().Password
$Payload.'Params'[$i].'Value' = $EncryptionPasswordText
}
}
if ($Payload.'Params'[$i].'Key' -eq 'userName') {
if ($UserName) {
$Payload.'Params'[$i].'Value' = $UserName
}
}
if ($Payload.'Params'[$i].'Key' -eq 'password') {
if ($Password) {
$PasswordText = (New-Object PSCredential "user", $Password).GetNetworkCredential().Password
$Payload.'Params'[$i].'Value' = $PasswordText
}
"encryption_password" = if ($EncryptionPassword) {
$EncryptionPasswordText = (New-Object PSCredential "user", $EncryptionPassword).GetNetworkCredential().Password
$EncryptionPasswordText
}
if ($Payload.'Params'[$i].'Key' -eq 'includePasswords') {
if ($IncludePw) {
$Payload.'Params'[$i].'Value' = "true"
}
}
if ($Payload.'Params'[$i].'Key' -eq 'includeCertificates') {
if ($IncludeCertificates) {
$Payload.'Params'[$i].'Value' = "true"
}
"includePasswords" = $(if ($IncludePw) { "true" } else { "false"})
"includeCertificates" = $(if ($IncludeCertificates) { "true" } else { "false"})
}

# Update Params from ParamsHashValMap
for ($i = 0; $i -le $Payload.'Params'.Length; $i++) {
if ($ParamsHashValMap.Keys -Contains ($Payload.'Params'[$i].'Key')) {
$value = $Payload.'Params'[$i].'Key'
$Payload.'Params'[$i].'Value' = $ParamsHashValMap.$value
}
}
return $payload
}
}

function Invoke-OMEApplianceBackupRestore {
function Invoke-OMEApplianceBackup {
<#
Copyright (c) 2018 Dell EMC Corporation
Expand All @@ -145,9 +112,9 @@ limitations under the License.

<#
.SYNOPSIS
Appliance backup/restore to file on network share
Appliance backup to file on network share. Restore must be performed in OME-M at this time.
.DESCRIPTION
Backup or restore appliance to a file on a network share
Backup appliance to a file on a network share
.PARAMETER Name
Name of the job
.PARAMETER Description
Expand All @@ -162,8 +129,6 @@ limitations under the License.
Share directory path
.PARAMETER ShareType
Share type ("NFS", Default="CIFS", "HTTP", "HTTPS")
.PARAMETER Operation
Operation to perform (Default="BACKUP", "RESTORE")
.PARAMETER BackupFile
Backup file name, .bin is automatically appended to file name. Default=BACKUP_$((Get-Date).ToString('yyyyMMddHHmmss'))
.PARAMETER Chassis
Expand All @@ -183,11 +148,11 @@ limitations under the License.
.INPUTS
None
.EXAMPLE
Invoke-OMEApplianceBackupRestore -Chassis @("LEAD" | Get-OMEMXDomain | Select-Object -First 1) -Share "192.168.1.100" -SharePath "/SHARE" -ShareType "CIFS" -UserName "Administrator" -Password $(ConvertTo-SecureString 'calvin' -AsPlainText -Force) -Operation "BACKUP" -BackupFile "BACKUP_$((Get-Date).ToString('yyyyMMddHHmmss'))" -IncludePw -IncludeCertificates -EncryptionPassword $(ConvertTo-SecureString 'nkQ*DTrNK7$b' -AsPlainText -Force) -Wait -Verbose
Invoke-OMEApplianceBackup -Chassis @("LEAD" | Get-OMEMXDomain | Select-Object -First 1) -Share "192.168.1.100" -SharePath "/SHARE" -ShareType "CIFS" -UserName "Administrator" -Password $(ConvertTo-SecureString 'calvin' -AsPlainText -Force) -BackupFile "BACKUP_$((Get-Date).ToString('yyyyMMddHHmmss'))" -IncludePw -IncludeCertificates -EncryptionPassword $(ConvertTo-SecureString 'nkQ*DTrNK7$b' -AsPlainText -Force) -Wait -Verbose
Backup chassis to CIFS share now
.EXAMPLE
Invoke-OMEApplianceBackupRestore -Chassis @("LEAD" | Get-OMEMXDomain | Select-Object -First 1) -Share "192.168.1.100" -SharePath "/mnt/data/backup" -ShareType "NFS" -Operation "BACKUP" -BackupFile "BACKUP_$((Get-Date).ToString('yyyyMMddHHmmss'))" -ScheduleCron '0 0 0 ? * sun *' -IncludePw -IncludeCertificates -EncryptionPassword $(ConvertTo-SecureString 'nkQ*DTrNK7$b' -AsPlainText -Force) -Wait -Verbose
Invoke-OMEApplianceBackup -Chassis @("LEAD" | Get-OMEMXDomain | Select-Object -First 1) -Share "192.168.1.100" -SharePath "/mnt/data/backup" -ShareType "NFS" -BackupFile "BACKUP_$((Get-Date).ToString('yyyyMMddHHmmss'))" -ScheduleCron '0 0 0 ? * sun *' -IncludePw -IncludeCertificates -EncryptionPassword $(ConvertTo-SecureString 'nkQ*DTrNK7$b' -AsPlainText -Force) -Wait -Verbose
Backup chassis to NFS share on schedule
#>
Expand Down Expand Up @@ -216,10 +181,6 @@ param(
[ValidateSet("NFS", "CIFS", "HTTP", "HTTPS")]
[String]$ShareType = "CIFS",

[Parameter(Mandatory=$false)]
[ValidateSet("BACKUP", "RESTORE")]
[String]$Operation = "BACKUP",

[Parameter(Mandatory=$false)]
[String]$BackupFile = "BACKUP_$((Get-Date).ToString('yyyyMMddHHmmss'))",

Expand Down Expand Up @@ -265,7 +226,7 @@ Process {
$DeviceIds = @()
if ($null -ne $Chassis.DeviceId -and $Chassis.DeviceId -ne 0) {
$DeviceIds += $Chassis.DeviceId
$JobPayload = Get-BackupJobPayload -Name $Name -Description $Description -Operation $Operation `
$JobPayload = Get-BackupJobPayload -Name $Name -Description $Description `
-Share $Share -SharePath $SharePath -ShareType $ShareType `
-BackupFile $BackupFile -DeviceId $Chassis.DeviceId -EncryptionPassword $EncryptionPassword `
-UserName $UserName -Password $Password -ScheduleCron $ScheduleCron `
Expand All @@ -279,7 +240,7 @@ Process {
Write-Verbose "Job creation successful..."
$JobInfo = $JobResp.Content | ConvertFrom-Json
$JobId = $JobInfo.Id
Write-Verbose "Created job $($JobId) to create appliance backup..."
Write-Verbose "Created job $($JobId) for application backup..."
if ($Wait) {
$JobStatus = $($JobId | Wait-OnJob -WaitTime $WaitTime)
return $JobStatus
Expand Down
46 changes: 26 additions & 20 deletions Documentation/CommandReference.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
- [Get-OMETemplate](Functions/Get-OMETemplate.md)
- [Get-OMEUser](Functions/Get-OMEUser.md)
- [Get-OMEWarranty](Functions/Get-OMEWarranty.md)
- [Invoke-OMEApplianceBackupRestore](Functions/Invoke-OMEApplianceBackupRestore.md)
- [Invoke-OMEApplianceBackup](Functions/Invoke-OMEApplianceBackup.md)
- [Invoke-OMEConfigurationBaselineRefresh](Functions/Invoke-OMEConfigurationBaselineRefresh.md)
- [Invoke-OMEDirectoryServiceImportGroup](Functions/Invoke-OMEDirectoryServiceImportGroup.md)
- [Invoke-OMEFirmwareBaselineRefresh](Functions/Invoke-OMEFirmwareBaselineRefresh.md)
Expand Down Expand Up @@ -100,21 +100,15 @@
- ServerPort (int ServerPort {get;set;})
- ServerType (string ServerType {get;set;})
## ApplianceInfo
- AttributeGroupMembership (string AttributeGroupMembership {get;set;})
- AttributeUserLogin (string AttributeUserLogin {get;set;})
- BaseDistinguishedName (string BaseDistinguishedName {get;set;})
- BindDN (string BindDN {get;set;})
- CertificateValidation (bool CertificateValidation {get;set;})
- DnsServer (string[] DnsServer {get;set;})
- GroupDomain (string GroupDomain {get;set;})
- Id (int Id {get;set;})
- Branding (string Branding {get;set;})
- BuildDate (string BuildDate {get;set;})
- BuildNumber (string BuildNumber {get;set;})
- Description (string Description {get;set;})
- Guid (string Guid {get;set;})
- Name (string Name {get;set;})
- NetworkTimeOut (int NetworkTimeOut {get;set;})
- SearchFilter (string SearchFilter {get;set;})
- SearchTimeOut (int SearchTimeOut {get;set;})
- ServerName (string[] ServerName {get;set;})
- ServerPort (int ServerPort {get;set;})
- ServerType (string ServerType {get;set;})
- OperationStatus (string OperationStatus {get;set;})
- Vendor (string Vendor {get;set;})
- Version (version Version {get;set;})
## Catalog
- BaseLocation (string BaseLocation {get;set;})
- Filename (string Filename {get;set;})
Expand Down Expand Up @@ -210,11 +204,23 @@
- NetworkAddressDetail (string NetworkAddressDetail {get;set;})
- SubnetMask (string SubnetMask {get;set;})
## Domain
- AddressType (int AddressType {get;set;})
- Disabled (bool Disabled {get;set;})
- Exclude (bool Exclude {get;set;})
- NetworkAddressDetail (string NetworkAddressDetail {get;set;})
- SubnetMask (string SubnetMask {get;set;})
- BackupLead (bool BackupLead {get;set;})
- BackupLeadHealth (int BackupLeadHealth {get;set;})
- Capabilities (string[] Capabilities {get;set;})
- Description (string Description {get;set;})
- DeviceId (int DeviceId {get;set;})
- DomainRoleTypeId (int DomainRoleTypeId {get;set;})
- DomainRoleTypeValue (string DomainRoleTypeValue {get;set;})
- DomainTypeId (int DomainTypeId {get;set;})
- DomainTypeValue (string DomainTypeValue {get;set;})
- GroupId (string GroupId {get;set;})
- GroupName (string GroupName {get;set;})
- Id (int Id {get;set;})
- Identifier (string Identifier {get;set;})
- Local (bool Local {get;set;})
- Name (string Name {get;set;})
- PublicAddress (string[] PublicAddress {get;set;})
- Version (version Version {get;set;})
## FirmwareBaseline
- CatalogId (int CatalogId {get;set;})
- Description (string Description {get;set;})
Expand Down
Loading

0 comments on commit f1b3dec

Please sign in to comment.