Skip to content

Commit

Permalink
Fix Excel tab order
Browse files Browse the repository at this point in the history
  • Loading branch information
aguzev committed May 3, 2023
1 parent 9231237 commit 446063a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ RequiredModules = @(
},
@{
ModuleName = 'dbatools'
ModuleVersion = '1.1.146'
ModuleVersion = '1.0.173'
}
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ function Export-Pfa2Excel {
[CmdletBinding()]
param(
[Parameter(ValueFromPipeline)]
[hashtable]$Tables,
[System.Collections.IDictionary]$Tables,
[Parameter(Mandatory)]
[string]$LiteralPath
)
Expand Down Expand Up @@ -568,9 +568,9 @@ function Export-Pfa2Excel {
}

$items = @(foreach($valueItem in $valueArray) {
$ht = @{}
$ht = [ordered]@{}

$( if ($valueItem -is [hashtable]) { $valueItem.GetEnumerator() } else { $valueItem.PSObject.Properties } ) |
$( if ($valueItem -is [System.Collections.IDictionary]) { $valueItem.GetEnumerator() } else { $valueItem.PSObject.Properties } ) |
ForEach-Object {
$value = if(($null -eq $_.Value) -or $dataTypes.ContainsKey($_.Value.GetType())) { $_.Value } else {[string]$_.Value}
$ht.Add($_.Name, $value )
Expand Down Expand Up @@ -3201,10 +3201,10 @@ function New-Pfa2ExcelReport {
$excelFile = Join-Path $OutPath "$($array_details.name)-$date.xlsx"
Write-Host 'Writing data to Excel workbook...' -ForegroundColor green

$report = @{}
$report = [ordered]@{}

# Array Information
$report['Array_Info'] = @( @{
$report['Array_Info'] = @( [ordered]@{
'Array Name' = ($array_details.Name).ToUpper()
'Array ID' = $array_details.Id
'Purity Version' = $array_details.Version
Expand All @@ -3224,7 +3224,7 @@ function New-Pfa2ExcelReport {

## Volume Details
$details = $volumes | ForEach-Object {
@{
[ordered]@{
'Name' = $_.Name
'Size(GB)' = Convert-UnitOfSize $_.provisioned -To 1GB
'Unique Data(GB)' = Convert-UnitOfSize $_.space.Unique -To 1GB
Expand Down Expand Up @@ -3269,7 +3269,7 @@ function New-Pfa2ExcelReport {
## Volume Snapshot details
if ($snapshots) {
$report['Volume Snapshots'] = $snapshots | ForEach-Object {
@{
[ordered]@{
'Name' = $_.Name
'Created' = $_.Created
'Provisioned(GB)' = Convert-UnitOfSize $_.Provisioned -To 1GB
Expand All @@ -3286,7 +3286,7 @@ function New-Pfa2ExcelReport {
# Host Details
if ($host_details) {
$report['Hosts'] = $host_details | ForEach-Object {
@{
[ordered]@{
'Name' = $_.Name
'No. of Volumes' = $_.ConnectionCount
'HostGroup' = $_.HostGroup.Name
Expand All @@ -3302,7 +3302,7 @@ function New-Pfa2ExcelReport {
## HostGroup Details
if ($hostgroup) {
$report['Host Groups'] = $hostgroup | ForEach-Object {
@{
[ordered]@{
'Name' = $_.Name
'HostCount' = $_.HostCount
'No. of Volumes' = $_.ConnectionCount
Expand All @@ -3316,7 +3316,7 @@ function New-Pfa2ExcelReport {
## Protection Group and Protection Group Transfer details
if ($pgd) {
$report['Protection Groups'] = $pgd | ForEach-Object {
@{
[ordered]@{
'Name' = $_.Name
'Snapshot Size(GB)' = Convert-UnitOfSize $_.space.snapshots -To 1GB
'VolumeCount' = $_.VolumeCount
Expand All @@ -3329,7 +3329,7 @@ function New-Pfa2ExcelReport {

if ($pgst) {
$report['PG Snapshot Transfers'] = $pgst | ForEach-Object {
@{
[ordered]@{
'Name' = $_.Name
'Data Transferred(MB)' = Convert-UnitOfSize $_.DataTransferred -To 1MB
'Destroyed' = $_.Destroyed
Expand All @@ -3344,7 +3344,7 @@ function New-Pfa2ExcelReport {
## Pod details
if ($pods) {
$report['Pods'] = $pods | ForEach-Object {
@{
[ordered]@{
'Name' = $_.Name
'ArrayCount' = $_.ArrayCount
'Source' = $_.source.name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -761,15 +761,15 @@ function New-Pfa2HypervClusterVolumeReport() {
}
}

$report = @{}
$report = [ordered]@{}

#Get VMs & VHDs
$nodes = Get-ClusterNode
$vhds = Get-VM -ComputerName $nodes.Name |
ForEach-Object { $_ } -PipelineVariable 'vm' |
ForEach-Object { Get-Vhd -ComputerName $_.ComputerName -VmId $_.VmId } |
ForEach-Object {
[pscustomobject]@{
[pscustomobject][ordered]@{
'VM Name' = $vm.Name
'VM State' = $vm.State
'ComputerName' = $_.ComputerName
Expand All @@ -796,7 +796,7 @@ function New-Pfa2HypervClusterVolumeReport() {
} |
Where-Object DriveType -eq Fixed |
ForEach-Object {
[pscustomobject]@{
[pscustomobject][ordered]@{
'ComputerName' = $node.Name
'Label' = $_.FileSystemLabel
'Name' = if ($_.DriveLetter) { "$($_.DriveLetter):\" } else { $_.Path }
Expand Down Expand Up @@ -844,7 +844,7 @@ function New-Pfa2HypervClusterVolumeReport() {
Where-Object { $sn -contains $_.serial } |
Select-Object 'Name' -ExpandProperty 'Space' |
ForEach-Object {
[pscustomobject]@{
[pscustomobject][ordered]@{
'Array' = $details.Name
'Name' = $_.Name
'Size (GB)' = Convert-UnitOfSize $_.TotalProvisioned -To 1GB
Expand Down

0 comments on commit 446063a

Please sign in to comment.