From 33b5b44f857865c5db9b254d05cadf68e9ca0d49 Mon Sep 17 00:00:00 2001 From: Jonathan Colon Date: Wed, 20 Nov 2024 13:33:03 -0400 Subject: [PATCH] v0.5.6 --- .github/workflows/Release.yml | 10 +++ AsBuiltReport.Microsoft.Windows.psd1 | 4 +- CHANGELOG.md | 13 +++ Src/Private/Get-AbrWinApplication.ps1 | 10 +-- Src/Private/Get-AbrWinDHCPInfrastructure.ps1 | 20 ++--- .../Get-AbrWinDHCPv4PerScopeSetting.ps1 | 4 +- Src/Private/Get-AbrWinDHCPv4Scope.ps1 | 22 ++--- .../Get-AbrWinDHCPv4ScopeServerSetting.ps1 | 16 ++-- Src/Private/Get-AbrWinDHCPv4Statistic.ps1 | 14 +-- Src/Private/Get-AbrWinDNSInfrastructure.ps1 | 38 ++++----- Src/Private/Get-AbrWinDNSZone.ps1 | 54 ++++++------ Src/Private/Get-AbrWinFOCluster.ps1 | 4 +- .../Get-AbrWinFOClusterAvailableDisk.ps1 | 2 +- .../Get-AbrWinFOClusterFaultDomain.ps1 | 4 +- Src/Private/Get-AbrWinFOClusterNetwork.ps1 | 2 +- .../Get-AbrWinFOClusterNetworkInterface.ps1 | 2 +- Src/Private/Get-AbrWinFOClusterNode.ps1 | 4 +- Src/Private/Get-AbrWinFOClusterPermission.ps1 | 2 +- Src/Private/Get-AbrWinFOClusterQuorum.ps1 | 2 +- Src/Private/Get-AbrWinFOClusterResource.ps1 | 2 +- .../Get-AbrWinFOClusterSharedVolume.ps1 | 2 +- .../Get-AbrWinFOClusterSharedVolumeState.ps1 | 2 +- Src/Private/Get-AbrWinHostHWSummary.ps1 | 7 +- Src/Private/Get-AbrWinHostStorage.ps1 | 18 ++-- Src/Private/Get-AbrWinHostStorageISCSI.ps1 | 38 ++++----- Src/Private/Get-AbrWinHostStorageMPIO.ps1 | 18 ++-- Src/Private/Get-AbrWinHostStorageVolume.ps1 | 10 +-- Src/Private/Get-AbrWinHyperVHostVM.ps1 | 62 +++++++------- Src/Private/Get-AbrWinHyperVNetworking.ps1 | 46 +++++----- Src/Private/Get-AbrWinHyperVNuma.ps1 | 10 +-- Src/Private/Get-AbrWinHyperVSummary.ps1 | 17 ++-- Src/Private/Get-AbrWinIISSummary.ps1 | 11 ++- Src/Private/Get-AbrWinIISWebAppPool.ps1 | 10 +-- Src/Private/Get-AbrWinIISWebSite.ps1 | 28 +++--- Src/Private/Get-AbrWinLocalAdmin.ps1 | 12 +-- Src/Private/Get-AbrWinLocalGroup.ps1 | 10 +-- Src/Private/Get-AbrWinLocalUser.ps1 | 12 +-- Src/Private/Get-AbrWinNetAdapter.ps1 | 10 +-- Src/Private/Get-AbrWinNetAdapterMTU.ps1 | 10 +-- Src/Private/Get-AbrWinNetDNSClient.ps1 | 14 +-- Src/Private/Get-AbrWinNetDNSServer.ps1 | 10 +-- Src/Private/Get-AbrWinNetFirewall.ps1 | 14 +-- Src/Private/Get-AbrWinNetIPAddress.ps1 | 10 +-- Src/Private/Get-AbrWinNetTeamInterface.ps1 | 10 +-- Src/Private/Get-AbrWinOSConfig.ps1 | 9 +- Src/Private/Get-AbrWinOSDriver.ps1 | 10 +-- Src/Private/Get-AbrWinOSHotfix.ps1 | 12 +-- Src/Private/Get-AbrWinOSRoleFeature.ps1 | 18 ++-- Src/Private/Get-AbrWinOSService.ps1 | 12 +-- Src/Private/Get-AbrWinSMBNetworkInterface.ps1 | 16 ++-- Src/Private/Get-AbrWinSMBShare.ps1 | 20 ++--- Src/Private/Get-AbrWinSMBSummary.ps1 | 23 ++--- Src/Private/Get-AbrWinSQLBackupDevice.ps1 | 4 +- Src/Private/Get-AbrWinSQLBuild.ps1 | 16 ++-- Src/Private/Get-AbrWinSQLDatabase.ps1 | 12 +-- Src/Private/Get-AbrWinSQLLogin.ps1 | 10 +-- Src/Private/Get-AbrWinSQLRole.ps1 | 4 +- Src/Private/SharedUtilsFunctions.ps1 | 85 ++++++++++++------- ...Invoke-AsBuiltReport.Microsoft.Windows.ps1 | 4 +- 59 files changed, 474 insertions(+), 401 deletions(-) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 7faced4..f1c9e70 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -45,3 +45,13 @@ jobs: TWITTER_CONSUMER_API_SECRET: ${{ secrets.TWITTER_CONSUMER_API_SECRET }} TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }} TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }} + bsky-post: + needs: publish-to-gallery + runs-on: ubuntu-latest + steps: + - uses: zentered/bluesky-post-action@v0.1.0 + with: + post: "[New Release] ${{ github.event.repository.name }} ${{ github.event.release.tag_name }}! Check out what's new! ${{ github.event.release.html_url }} #Microsoft #Windows #AsBuiltReport #PowerShell #MVPBuzz" + env: + BSKY_IDENTIFIER: ${{ secrets.BSKY_IDENTIFIER }} + BSKY_PASSWORD: ${{ secrets.BSKY_PASSWORD }} diff --git a/AsBuiltReport.Microsoft.Windows.psd1 b/AsBuiltReport.Microsoft.Windows.psd1 index 73f938f..3c95940 100644 --- a/AsBuiltReport.Microsoft.Windows.psd1 +++ b/AsBuiltReport.Microsoft.Windows.psd1 @@ -12,7 +12,7 @@ RootModule = 'AsBuiltReport.Microsoft.Windows.psm1' # Version number of this module. - ModuleVersion = '0.5.5' + ModuleVersion = '0.5.6' # Supported PSEditions # CompatiblePSEditions = @() @@ -58,7 +58,7 @@ }, @{ ModuleName = 'dbatools'; - ModuleVersion = '2.1.18' + ModuleVersion = '2.1.27' } ) diff --git a/CHANGELOG.md b/CHANGELOG.md index 63a99b1..3ed77a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,19 @@ 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). +## [0.5.6] - 2024-11-20 + +### Changed + +- Increase Dbatools module requirement v2.1.27 +- Improve detection of empty fields in tables +- Improve detection of true/false elements in tables +- Update GitHub release workflow to add post to Bluesky social platform + +### Fixed + +- Fix [#36](https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows/issues/36) + ## [0.5.5] - 2024-07-29 ### Changed diff --git a/Src/Private/Get-AbrWinApplication.ps1 b/Src/Private/Get-AbrWinApplication.ps1 index 3b7e930..e285688 100644 --- a/Src/Private/Get-AbrWinApplication.ps1 +++ b/Src/Private/Get-AbrWinApplication.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinApplication { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.5 + Version: 0.5.6 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -34,10 +34,10 @@ function Get-AbrWinApplication { Section -Style Heading3 'Installed Applications' { Paragraph 'The following settings details applications listed in Add/Remove Programs' BlankLine - [array]$AddRemoveReport = @() + $OutObj = @() ForEach ($App in $AddRemove) { try { - $TempAddRemoveReport = [PSCustomObject]@{ + $inObj = [ordered] @{ 'Application Name' = $App.DisplayName 'Publisher' = $App.Publisher 'Version' = Switch ([string]::IsNullOrEmpty($App.DisplayVersion)) { @@ -51,7 +51,7 @@ function Get-AbrWinApplication { default { 'Unknown' } } } - $AddRemoveReport += $TempAddRemoveReport + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } @@ -64,7 +64,7 @@ function Get-AbrWinApplication { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $AddRemoveReport | Where-Object { $_.'Application Name' -notlike $null } | Sort-Object -Property 'Application Name' | Table @TableParams + $OutObj | Where-Object { $_.'Application Name' -notlike '--' } | Sort-Object -Property 'Application Name' | Table @TableParams } } } catch { diff --git a/Src/Private/Get-AbrWinDHCPInfrastructure.ps1 b/Src/Private/Get-AbrWinDHCPInfrastructure.ps1 index a31d960..ece2d88 100644 --- a/Src/Private/Get-AbrWinDHCPInfrastructure.ps1 +++ b/Src/Private/Get-AbrWinDHCPInfrastructure.ps1 @@ -33,13 +33,13 @@ function Get-AbrWinDHCPInfrastructure { $OutObj = @() try { $inObj = [ordered] @{ - 'Domain Joined' = ConvertTo-TextYN $Settings.IsDomainJoined - 'Authorized' = ConvertTo-TextYN $Settings.IsAuthorized + 'Domain Joined' = $Settings.IsDomainJoined + 'Authorized' = $Settings.IsAuthorized 'Conflict Detection Attempts' = $Settings.ConflictDetectionAttempts - 'Activate Policies' = ConvertTo-TextYN $Settings.ActivatePolicies - 'Dynamic Bootp' = ConvertTo-TextYN $Settings.DynamicBootp - 'Database Path' = ConvertTo-EmptyToFiller $Database.FileName - 'Database Backup Path' = ConvertTo-EmptyToFiller $Database.BackupPath + 'Activate Policies' = $Settings.ActivatePolicies + 'Dynamic Bootp' = $Settings.DynamicBootp + 'Database Path' = $Database.FileName + 'Database Backup Path' = $Database.BackupPath 'Database Backup Interval' = switch ([string]::IsNullOrEmpty($Database.BackupInterval)) { $true { "--" } $false { "$($Database.BackupInterval) min" } @@ -47,13 +47,13 @@ function Get-AbrWinDHCPInfrastructure { } 'Database Logging Enabled' = Switch ([string]::IsNullOrEmpty($Database.LoggingEnabled)) { $true { "--" } - $false { ConvertTo-TextYN $Database.LoggingEnabled } + $false { $Database.LoggingEnabled } default { 'Unknown' } } - 'User Name' = ConvertTo-EmptyToFiller $DNSCredential.UserName - 'Domain Name' = ConvertTo-EmptyToFiller $DNSCredential.DomainName + 'User Name' = $DNSCredential.UserName + 'Domain Name' = $DNSCredential.DomainName } - $OutObj += [pscustomobject]$inobj + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } diff --git a/Src/Private/Get-AbrWinDHCPv4PerScopeSetting.ps1 b/Src/Private/Get-AbrWinDHCPv4PerScopeSetting.ps1 index 0a64279..b62e154 100644 --- a/Src/Private/Get-AbrWinDHCPv4PerScopeSetting.ps1 +++ b/Src/Private/Get-AbrWinDHCPv4PerScopeSetting.ps1 @@ -45,9 +45,9 @@ function Get-AbrWinDHCPv4PerScopeSetting { 'Name' = $Option.Name 'Option Id' = $Option.OptionId 'Value' = $Option.Value - 'Policy Name' = ConvertTo-EmptyToFiller $Option.PolicyName + 'Policy Name' = $Option.PolicyName } - $OutObj += [pscustomobject]$inobj + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning "$($_.Exception.Message) (Scope Options Item)" } diff --git a/Src/Private/Get-AbrWinDHCPv4Scope.ps1 b/Src/Private/Get-AbrWinDHCPv4Scope.ps1 index 307a269..2adcc3a 100644 --- a/Src/Private/Get-AbrWinDHCPv4Scope.ps1 +++ b/Src/Private/Get-AbrWinDHCPv4Scope.ps1 @@ -46,7 +46,7 @@ function Get-AbrWinDHCPv4Scope { } 'State' = $Scope.State } - $OutObj += [pscustomobject]$inobj + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } @@ -76,7 +76,7 @@ function Get-AbrWinDHCPv4Scope { 'Percentage In Use' = [math]::Round($DHCPStatistic.PercentageInUse, 0) 'Reserved IP' = $DHCPStatistic.Reserved } - $OutObj += [pscustomobject]$inobj + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning "$($_.Exception.Message) (IPv4 Scope Statistics Item)" } @@ -111,17 +111,17 @@ function Get-AbrWinDHCPv4Scope { $inObj = [ordered] @{ 'Partner DHCP Server' = $DHCPv4Failover.PartnerServer 'Mode' = $DHCPv4Failover.Mode - 'LoadBalance Percent' = ConvertTo-EmptyToFiller ([math]::Round($DHCPv4Failover.LoadBalancePercent, 0)) - 'Server Role' = ConvertTo-EmptyToFiller $DHCPv4Failover.ServerRole - 'Reserve Percent' = ConvertTo-EmptyToFiller ([math]::Round($DHCPv4Failover.ReservePercent, 0)) - 'Max Client Lead Time' = ConvertTo-EmptyToFiller $DHCPv4Failover.MaxClientLeadTime - 'State Switch Interval' = ConvertTo-EmptyToFiller $DHCPv4Failover.StateSwitchInterval + 'LoadBalance Percent' = ([math]::Round($DHCPv4Failover.LoadBalancePercent, 0)) + 'Server Role' = $DHCPv4Failover.ServerRole + 'Reserve Percent' = ([math]::Round($DHCPv4Failover.ReservePercent, 0)) + 'Max Client Lead Time' = $DHCPv4Failover.MaxClientLeadTime + 'State Switch Interval' = $DHCPv4Failover.StateSwitchInterval 'Scope Ids' = $DHCPv4Failover.ScopeId 'State' = $DHCPv4Failover.State - 'Auto State Transition' = ConvertTo-TextYN $DHCPv4Failover.AutoStateTransition - 'Authetication Enable' = ConvertTo-TextYN $DHCPv4Failover.EnableAuth + 'Auto State Transition' = $DHCPv4Failover.AutoStateTransition + 'Authetication Enable' = $DHCPv4Failover.EnableAuth } - $OutObj = [pscustomobject]$inobj + $OutObj = [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning "$($_.Exception.Message) (IPv4 Scope Failover Item)" } @@ -165,7 +165,7 @@ function Get-AbrWinDHCPv4Scope { default { $DHCPv4Binding.BindingState } } } - $OutObj += [pscustomobject]$inobj + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning "$($_.Exception.Message) (IPv4 Network Interface binding Item)" } diff --git a/Src/Private/Get-AbrWinDHCPv4ScopeServerSetting.ps1 b/Src/Private/Get-AbrWinDHCPv4ScopeServerSetting.ps1 index 5e8857d..6d74f80 100644 --- a/Src/Private/Get-AbrWinDHCPv4ScopeServerSetting.ps1 +++ b/Src/Private/Get-AbrWinDHCPv4ScopeServerSetting.ps1 @@ -38,9 +38,9 @@ function Get-AbrWinDHCPv4ScopeServerSetting { 'Name' = $Option.Name 'Option Id' = $Option.OptionId 'Value' = $Option.Value - 'Policy Name' = ConvertTo-EmptyToFiller $Option.PolicyName + 'Policy Name' = $Option.PolicyName } - $OutObj += [pscustomobject]$inobj + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning "$($_.Exception.Message) (DHCP scopes server opions item)" } @@ -66,13 +66,13 @@ function Get-AbrWinDHCPv4ScopeServerSetting { Write-PScriboMessage "Collecting DHCP Server Scope DNS Setting." $inObj = [ordered] @{ 'Dynamic Updates' = $Option.DynamicUpdates - 'Dns Suffix' = ConvertTo-EmptyToFiller $Option.DnsSuffix - 'Name Protection' = ConvertTo-EmptyToFiller $Option.NameProtection - 'Update Dns RR For Older Clients' = ConvertTo-EmptyToFiller $Option.UpdateDnsRRForOlderClients - 'Disable Dns Ptr RR Update' = ConvertTo-EmptyToFiller $Option.DisableDnsPtrRRUpdate - 'Delete Dns RR On Lease Expiry' = ConvertTo-EmptyToFiller $Option.DeleteDnsRROnLeaseExpiry + 'Dns Suffix' = $Option.DnsSuffix + 'Name Protection' = $Option.NameProtection + 'Update Dns RR For Older Clients' = $Option.UpdateDnsRRForOlderClients + 'Disable Dns Ptr RR Update' = $Option.DisableDnsPtrRRUpdate + 'Delete Dns RR On Lease Expiry' = $Option.DeleteDnsRROnLeaseExpiry } - $OutObj += [pscustomobject]$inobj + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning "$($_.Exception.Message) (Scope DNS Setting Item)" } diff --git a/Src/Private/Get-AbrWinDHCPv4Statistic.ps1 b/Src/Private/Get-AbrWinDHCPv4Statistic.ps1 index 30dd2e7..b00a212 100644 --- a/Src/Private/Get-AbrWinDHCPv4Statistic.ps1 +++ b/Src/Private/Get-AbrWinDHCPv4Statistic.ps1 @@ -31,14 +31,14 @@ function Get-AbrWinDHCPv4Statistic { $OutObj = @() try { $inObj = [ordered] @{ - 'Total Scopes' = ConvertTo-EmptyToFiller $DhcpSv4Statistics.TotalScopes - 'Total Addresses' = ConvertTo-EmptyToFiller $DhcpSv4Statistics.TotalAddresses - 'Addresses In Use' = ConvertTo-EmptyToFiller $DhcpSv4Statistics.AddressesInUse - 'Addresses Available' = ConvertTo-EmptyToFiller $DhcpSv4Statistics.AddressesAvailable - 'Percentage In Use' = ConvertTo-EmptyToFiller ([math]::Round($DhcpSv4Statistics.PercentageInUse, 0)) - 'Percentage Available' = ConvertTo-EmptyToFiller ([math]::Round($DhcpSv4Statistics.PercentageAvailable, 0)) + 'Total Scopes' = $DhcpSv4Statistics.TotalScopes + 'Total Addresses' = $DhcpSv4Statistics.TotalAddresses + 'Addresses In Use' = $DhcpSv4Statistics.AddressesInUse + 'Addresses Available' = $DhcpSv4Statistics.AddressesAvailable + 'Percentage In Use' = ([math]::Round($DhcpSv4Statistics.PercentageInUse, 0)) + 'Percentage Available' = ([math]::Round($DhcpSv4Statistics.PercentageAvailable, 0)) } - $OutObj += [pscustomobject]$inobj + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning "$($_.Exception.Message) (IPv4 Service Statistics Item)" } diff --git a/Src/Private/Get-AbrWinDNSInfrastructure.ps1 b/Src/Private/Get-AbrWinDNSInfrastructure.ps1 index f234a74..ce98850 100644 --- a/Src/Private/Get-AbrWinDNSInfrastructure.ps1 +++ b/Src/Private/Get-AbrWinDNSInfrastructure.ps1 @@ -30,14 +30,14 @@ function Get-AbrWinDNSInfrastructure { $OutObj = @() try { $inObj = [ordered] @{ - 'Build Number' = ConvertTo-EmptyToFiller $DNSSetting.BuildNumber - 'IPv6' = ConvertTo-EmptyToFiller (ConvertTo-TextYN $DNSSetting.EnableIPv6) - 'DnsSec' = ConvertTo-EmptyToFiller (ConvertTo-TextYN $DNSSetting.EnableDnsSec) - 'ReadOnly DC' = ConvertTo-EmptyToFiller (ConvertTo-TextYN $DNSSetting.IsReadOnlyDC) + 'Build Number' = $DNSSetting.BuildNumber + 'IPv6' = ($DNSSetting.EnableIPv6) + 'DnsSec' = ($DNSSetting.EnableDnsSec) + 'ReadOnly DC' = ($DNSSetting.IsReadOnlyDC) 'Listening IP' = $DNSSetting.ListeningIPAddress 'All IPs' = $DNSSetting.AllIPAddress } - $OutObj += [pscustomobject]$inobj + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning " $($_.Exception.Message) (Infrastructure Summary)" } @@ -66,12 +66,12 @@ function Get-AbrWinDNSInfrastructure { try { $inObj = [ordered] @{ 'Interface' = $DNSIPSetting.InterfaceAlias - 'DNS IP 1' = ConvertTo-EmptyToFiller $DNSIPSetting.ServerAddresses[0] - 'DNS IP 2' = ConvertTo-EmptyToFiller $DNSIPSetting.ServerAddresses[1] - 'DNS IP 3' = ConvertTo-EmptyToFiller $DNSIPSetting.ServerAddresses[2] - 'DNS IP 4' = ConvertTo-EmptyToFiller $DNSIPSetting.ServerAddresses[3] + 'DNS IP 1' = $DNSIPSetting.ServerAddresses[0] + 'DNS IP 2' = $DNSIPSetting.ServerAddresses[1] + 'DNS IP 3' = $DNSIPSetting.ServerAddresses[2] + 'DNS IP 4' = $DNSIPSetting.ServerAddresses[3] } - $OutObj = [pscustomobject]$inobj + $OutObj = [pscustomobject](ConvertTo-HashToYN $inObj) if ($HealthCheck.DNS.DP) { $OutObj | Where-Object { $_.'DNS IP 1' -eq "127.0.0.1" } | Set-Style -Style Warning -Property 'DNS IP 1' @@ -109,22 +109,22 @@ function Get-AbrWinDNSInfrastructure { $OutObj = @() try { $inObj = [ordered] @{ - 'NoRefresh Interval' = ConvertTo-EmptyToFiller $DNSSetting.NoRefreshInterval - 'Refresh Interval' = ConvertTo-EmptyToFiller $DNSSetting.RefreshInterval - 'Scavenging Interval' = ConvertTo-EmptyToFiller $DNSSetting.ScavengingInterval + 'NoRefresh Interval' = $DNSSetting.NoRefreshInterval + 'Refresh Interval' = $DNSSetting.RefreshInterval + 'Scavenging Interval' = $DNSSetting.ScavengingInterval 'Last Scavenge Time' = Switch ([string]::IsNullOrEmpty($DNSSetting.LastScavengeTime)) { $true { "--" } - $false { ConvertTo-EmptyToFiller ($DNSSetting.LastScavengeTime.ToString("MM/dd/yyyy")) } + $false { ($DNSSetting.LastScavengeTime.ToString("MM/dd/yyyy")) } default { 'Unknown' } } 'Scavenging State' = Switch ($DNSSetting.ScavengingState) { "True" { "Enabled" } "False" { "Disabled" } - default { ConvertTo-EmptyToFiller $DNSSetting.ScavengingState } + default { $DNSSetting.ScavengingState } } } - $OutObj += [pscustomobject]$inobj + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) $TableParams = @{ Name = "Scavenging - $($System.toUpper().split(".")[0])" List = $false @@ -157,10 +157,10 @@ function Get-AbrWinDNSInfrastructure { $inObj = [ordered] @{ 'IP Address' = $DNSSetting.IPAddress -join "," 'Timeout' = ("$($DNSSetting.Timeout)/s") - 'Use Root Hint' = ConvertTo-EmptyToFiller (ConvertTo-TextYN $DNSSetting.UseRootHint) - 'Use Recursion' = ConvertTo-EmptyToFiller (ConvertTo-TextYN $Recursion.Enable) + 'Use Root Hint' = ($DNSSetting.UseRootHint) + 'Use Recursion' = ($Recursion.Enable) } - $OutObj += [pscustomobject]$inobj + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) $TableParams = @{ Name = "Forwarders - $($System.toUpper().split(".")[0])" List = $false diff --git a/Src/Private/Get-AbrWinDNSZone.ps1 b/Src/Private/Get-AbrWinDNSZone.ps1 index cfaf259..7582c22 100644 --- a/Src/Private/Get-AbrWinDNSZone.ps1 +++ b/Src/Private/Get-AbrWinDNSZone.ps1 @@ -35,15 +35,15 @@ function Get-AbrWinDNSZone { try { Write-PScriboMessage "Collecting Actve Directory DNS Zone: '$($Zones.ZoneName)' on $DC" $inObj = [ordered] @{ - 'Zone Name' = ConvertTo-EmptyToFiller $Zones.ZoneName - 'Zone Type' = ConvertTo-EmptyToFiller $Zones.ZoneType - 'Replication Scope' = ConvertTo-EmptyToFiller $Zones.ReplicationScope - 'Dynamic Update' = ConvertTo-EmptyToFiller $Zones.DynamicUpdate - 'DS Integrated' = ConvertTo-EmptyToFiller (ConvertTo-TextYN $Zones.IsDsIntegrated) - 'Read Only' = ConvertTo-EmptyToFiller (ConvertTo-TextYN $Zones.IsReadOnly) - 'Signed' = ConvertTo-EmptyToFiller (ConvertTo-TextYN $Zones.IsSigned) + 'Zone Name' = $Zones.ZoneName + 'Zone Type' = $Zones.ZoneType + 'Replication Scope' = $Zones.ReplicationScope + 'Dynamic Update' = $Zones.DynamicUpdate + 'DS Integrated' = ($Zones.IsDsIntegrated) + 'Read Only' = ($Zones.IsReadOnly) + 'Signed' = ($Zones.IsSigned) } - $OutObj += [pscustomobject]$inobj + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning "$($_.Exception.Message) (Domain Name System Zone Item)" } @@ -71,8 +71,8 @@ function Get-AbrWinDNSZone { try { $inObj = [ordered] @{ 'Zone Name' = $Zone.PSChildName - 'Secondary Servers' = ConvertTo-EmptyToFiller ($Zone.SecondaryServers -join ", ") - 'Notify Servers' = ConvertTo-EmptyToFiller $Zone.NotifyServers + 'Secondary Servers' = ($Zone.SecondaryServers -join ", ") + 'Notify Servers' = $Zone.NotifyServers 'Secure Secondaries' = Switch ($Zone.SecureSecondaries) { "0" { "Send zone transfers to all secondary servers that request them." } "1" { "Send zone transfers only to name servers that are authoritative for the zone." } @@ -81,7 +81,7 @@ function Get-AbrWinDNSZone { default { $Zone.SecureSecondaries } } } - $OutObj = [pscustomobject]$inobj + $OutObj = [pscustomobject](ConvertTo-HashToYN $inObj) $TableParams = @{ Name = "Zone Transfers - $($Zone.PSChildName.toUpper())" @@ -113,15 +113,15 @@ function Get-AbrWinDNSZone { try { Write-PScriboMessage "Collecting Actve Directory DNS Zone: '$($Zones.ZoneName)'" $inObj = [ordered] @{ - 'Zone Name' = ConvertTo-EmptyToFiller $Zones.ZoneName - 'Zone Type' = ConvertTo-EmptyToFiller $Zones.ZoneType - 'Replication Scope' = ConvertTo-EmptyToFiller $Zones.ReplicationScope - 'Dynamic Update' = ConvertTo-EmptyToFiller $Zones.DynamicUpdate - 'DS Integrated' = ConvertTo-EmptyToFiller (ConvertTo-TextYN $Zones.IsDsIntegrated) - 'Read Only' = ConvertTo-EmptyToFiller (ConvertTo-TextYN $Zones.IsReadOnly) - 'Signed' = ConvertTo-EmptyToFiller (ConvertTo-TextYN $Zones.IsSigned) + 'Zone Name' = $Zones.ZoneName + 'Zone Type' = $Zones.ZoneType + 'Replication Scope' = $Zones.ReplicationScope + 'Dynamic Update' = $Zones.DynamicUpdate + 'DS Integrated' = ($Zones.IsDsIntegrated) + 'Read Only' = ($Zones.IsReadOnly) + 'Signed' = ($Zones.IsSigned) } - $OutObj += [pscustomobject]$inobj + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning "$($_.Exception.Message) (Reverse Lookup Zone Configuration Item)" } @@ -156,9 +156,9 @@ function Get-AbrWinDNSZone { 'Zone Type' = $Zones.ZoneType 'Replication Scope' = $Zones.ReplicationScope 'Master Servers' = $Zones.MasterServers - 'DS Integrated' = ConvertTo-TextYN $Zones.IsDsIntegrated + 'DS Integrated' = $Zones.IsDsIntegrated } - $OutObj += [pscustomobject]$inobj + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning "$($_.Exception.Message) (Conditional Forwarder Item)" } @@ -191,17 +191,17 @@ function Get-AbrWinDNSZone { try { Write-PScriboMessage "Collecting Actve Directory DNS Zone: '$($Settings.ZoneName)'" $inObj = [ordered] @{ - 'Zone Name' = ConvertTo-EmptyToFiller $Settings.ZoneName - 'Aging Enabled' = ConvertTo-EmptyToFiller (ConvertTo-TextYN $Settings.AgingEnabled) - 'Refresh Interval' = ConvertTo-EmptyToFiller $Settings.RefreshInterval - 'NoRefresh Interval' = ConvertTo-EmptyToFiller $Settings.NoRefreshInterval + 'Zone Name' = $Settings.ZoneName + 'Aging Enabled' = ($Settings.AgingEnabled) + 'Refresh Interval' = $Settings.RefreshInterval + 'NoRefresh Interval' = $Settings.NoRefreshInterval 'Available For Scavenge' = Switch ([string]::IsNullOrEmpty($Settings.AvailForScavengeTime)) { $true { "--" } - $false { (ConvertTo-EmptyToFiller ($Settings.AvailForScavengeTime).ToUniversalTime().toString("r")) } + $false { (($Settings.AvailForScavengeTime).ToUniversalTime().toString("r")) } default { 'Unknown' } } } - $OutObj += [pscustomobject]$inobj + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning "$($_.Exception.Message) (Zone Scope Aging Item)" } diff --git a/Src/Private/Get-AbrWinFOCluster.ps1 b/Src/Private/Get-AbrWinFOCluster.ps1 index e462258..200ac10 100644 --- a/Src/Private/Get-AbrWinFOCluster.ps1 +++ b/Src/Private/Get-AbrWinFOCluster.ps1 @@ -35,9 +35,9 @@ function Get-AbrWinFOCluster { 'Domain' = $Settings.Domain 'Shared Volumes Root' = $Settings.SharedVolumesRoot 'Administrative Access Point' = $Settings.AdministrativeAccessPoint - 'Description' = ConvertTo-EmptyToFiller $Settings.Description + 'Description' = $Settings.Description } - $OutObj += [pscustomobject]$inobj + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } diff --git a/Src/Private/Get-AbrWinFOClusterAvailableDisk.ps1 b/Src/Private/Get-AbrWinFOClusterAvailableDisk.ps1 index 45445cc..bd709b4 100644 --- a/Src/Private/Get-AbrWinFOClusterAvailableDisk.ps1 +++ b/Src/Private/Get-AbrWinFOClusterAvailableDisk.ps1 @@ -37,7 +37,7 @@ function Get-AbrWinFOClusterAvailableDisk { 'Number' = $Setting.Number 'Size' = ConvertTo-FileSizeString $Setting.Size } - $OutObj += [pscustomobject]$inobj + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } diff --git a/Src/Private/Get-AbrWinFOClusterFaultDomain.ps1 b/Src/Private/Get-AbrWinFOClusterFaultDomain.ps1 index 9281b3f..a4ec337 100644 --- a/Src/Private/Get-AbrWinFOClusterFaultDomain.ps1 +++ b/Src/Private/Get-AbrWinFOClusterFaultDomain.ps1 @@ -45,9 +45,9 @@ function Get-AbrWinFOClusterFaultDomain { $false { $Setting.ChildrenNames } default { 'Unknown' } } - 'Location' = ConvertTo-EmptyToFiller $Setting.Location + 'Location' = $Setting.Location } - $OutObj += [pscustomobject]$inobj + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } diff --git a/Src/Private/Get-AbrWinFOClusterNetwork.ps1 b/Src/Private/Get-AbrWinFOClusterNetwork.ps1 index 3c802b0..0fcea52 100644 --- a/Src/Private/Get-AbrWinFOClusterNetwork.ps1 +++ b/Src/Private/Get-AbrWinFOClusterNetwork.ps1 @@ -38,7 +38,7 @@ function Get-AbrWinFOClusterNetwork { 'Role' = $Setting.Role 'Address' = "$($Setting.Address)/$($Setting.AddressMask)" } - $OutObj += [pscustomobject]$inobj + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } diff --git a/Src/Private/Get-AbrWinFOClusterNetworkInterface.ps1 b/Src/Private/Get-AbrWinFOClusterNetworkInterface.ps1 index 663197d..8aa0a3e 100644 --- a/Src/Private/Get-AbrWinFOClusterNetworkInterface.ps1 +++ b/Src/Private/Get-AbrWinFOClusterNetworkInterface.ps1 @@ -38,7 +38,7 @@ function Get-AbrWinFOClusterNetworkInterface { 'Network' = $Setting.Network 'State' = $Setting.State } - $OutObj += [pscustomobject]$inobj + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } diff --git a/Src/Private/Get-AbrWinFOClusterNode.ps1 b/Src/Private/Get-AbrWinFOClusterNode.ps1 index 0ec6b75..c63e4dc 100644 --- a/Src/Private/Get-AbrWinFOClusterNode.ps1 +++ b/Src/Private/Get-AbrWinFOClusterNode.ps1 @@ -38,10 +38,10 @@ function Get-AbrWinFOClusterNode { 'Fault Domain' = $Setting.FaultDomain 'Model' = $Setting.Model 'Manufacturer' = $Setting.Manufacturer - 'Description' = ConvertTo-EmptyToFiller $Setting.Description + 'Description' = $Setting.Description } - $OutObj += [PSCustomObject]$InObj + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } if ($HealthCheck.FailOverCluster.Nodes) { diff --git a/Src/Private/Get-AbrWinFOClusterPermission.ps1 b/Src/Private/Get-AbrWinFOClusterPermission.ps1 index 5145e37..9d9bedc 100644 --- a/Src/Private/Get-AbrWinFOClusterPermission.ps1 +++ b/Src/Private/Get-AbrWinFOClusterPermission.ps1 @@ -37,7 +37,7 @@ function Get-AbrWinFOClusterPermission { 'Access Control Type' = $Setting.AccessControlType 'Rights' = $Setting.ClusterRights } - $OutObj += [pscustomobject]$inobj + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } diff --git a/Src/Private/Get-AbrWinFOClusterQuorum.ps1 b/Src/Private/Get-AbrWinFOClusterQuorum.ps1 index 06b2a72..d7c92d3 100644 --- a/Src/Private/Get-AbrWinFOClusterQuorum.ps1 +++ b/Src/Private/Get-AbrWinFOClusterQuorum.ps1 @@ -37,7 +37,7 @@ function Get-AbrWinFOClusterQuorum { 'Quorum Resource' = $Setting.QuorumResource 'Quorum Type' = $Setting.QuorumType } - $OutObj += [pscustomobject]$inobj + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } diff --git a/Src/Private/Get-AbrWinFOClusterResource.ps1 b/Src/Private/Get-AbrWinFOClusterResource.ps1 index 1bfef6d..5031ce8 100644 --- a/Src/Private/Get-AbrWinFOClusterResource.ps1 +++ b/Src/Private/Get-AbrWinFOClusterResource.ps1 @@ -38,7 +38,7 @@ function Get-AbrWinFOClusterResource { 'Resource Type' = $Setting.ResourceType 'State' = $Setting.State } - $OutObj += [pscustomobject]$inobj + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } diff --git a/Src/Private/Get-AbrWinFOClusterSharedVolume.ps1 b/Src/Private/Get-AbrWinFOClusterSharedVolume.ps1 index 0849270..eb565e1 100644 --- a/Src/Private/Get-AbrWinFOClusterSharedVolume.ps1 +++ b/Src/Private/Get-AbrWinFOClusterSharedVolume.ps1 @@ -42,7 +42,7 @@ function Get-AbrWinFOClusterSharedVolume { } 'State' = $Setting.State } - $OutObj += [pscustomobject]$inobj + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } diff --git a/Src/Private/Get-AbrWinFOClusterSharedVolumeState.ps1 b/Src/Private/Get-AbrWinFOClusterSharedVolumeState.ps1 index c24cefb..72062ea 100644 --- a/Src/Private/Get-AbrWinFOClusterSharedVolumeState.ps1 +++ b/Src/Private/Get-AbrWinFOClusterSharedVolumeState.ps1 @@ -39,7 +39,7 @@ function Get-AbrWinFOClusterSharedVolumeState { 'Volume Name' = $Setting.VolumeFriendlyName 'Volume Path' = $Setting.VolumeName } - $OutObj += [pscustomobject]$inobj + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } diff --git a/Src/Private/Get-AbrWinHostHWSummary.ps1 b/Src/Private/Get-AbrWinHostHWSummary.ps1 index 70fdbc8..af721bc 100644 --- a/Src/Private/Get-AbrWinHostHWSummary.ps1 +++ b/Src/Private/Get-AbrWinHostHWSummary.ps1 @@ -30,7 +30,8 @@ function Get-AbrWinHostHWSummary { Section -Style Heading2 'Host Hardware Settings' { Paragraph 'The following section details hardware settings for the host' BlankLine - $HostHardware = [PSCustomObject] @{ + $OutObj = @() + $inObj = [ordered] @{ 'Manufacturer' = $HostComputer.Manufacturer 'Model' = $HostComputer.Model 'Product ID' = $HostComputer.SystemSKUNumbe @@ -42,6 +43,8 @@ function Get-AbrWinHostHWSummary { 'Number of Logical Cores' = ($HostCPU.NumberOfLogicalProcessors | Measure-Object -Sum).Sum 'Physical Memory' = "$([Math]::Round($HostComputer.TotalPhysicalMemory / 1Gb)) GB" } + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) + $TableParams = @{ Name = "Host Hardware Specifications" List = $true @@ -50,7 +53,7 @@ function Get-AbrWinHostHWSummary { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $HostHardware | Table @TableParams + $OutObj | Table @TableParams } } catch { Write-PScriboMessage -IsWarning $_.Exception.Message diff --git a/Src/Private/Get-AbrWinHostStorage.ps1 b/Src/Private/Get-AbrWinHostStorage.ps1 index 77b13dd..e214052 100644 --- a/Src/Private/Get-AbrWinHostStorage.ps1 +++ b/Src/Private/Get-AbrWinHostStorage.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinHostStorage { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.2 + Version: 0.5.6 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -32,17 +32,17 @@ function Get-AbrWinHostStorage { Section -Style Heading3 'Local Disks' { Paragraph 'The following table details physical disks installed in the host' BlankLine - $LocalDiskReport = @() + $OutObj = @() ForEach ($Disk in $HostDisks) { try { - $TempLocalDiskReport = [PSCustomObject]@{ + $inObj = [ordered] @{ 'Disk Number' = $Disk.Number 'Model' = $Disk.Model 'Serial Number' = $Disk.SerialNumber 'Partition Style' = $Disk.PartitionStyle 'Disk Size' = "$([Math]::Round($Disk.Size / 1Gb)) GB" } - $LocalDiskReport += $TempLocalDiskReport + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } @@ -55,7 +55,7 @@ function Get-AbrWinHostStorage { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $LocalDiskReport | Sort-Object -Property 'Disk Number' | Table @TableParams + $OutObj | Sort-Object -Property 'Disk Number' | Table @TableParams } } } catch { @@ -68,17 +68,17 @@ function Get-AbrWinHostStorage { Section -Style Heading3 'SAN Disks' { Paragraph 'The following section details SAN disks connected to the host' BlankLine - $SanDiskReport = @() + $OutObj = @() ForEach ($Disk in $SanDisks) { try { - $TempSanDiskReport = [PSCustomObject]@{ + $inObj = [ordered] @{ 'Disk Number' = $Disk.Number 'Model' = $Disk.Model 'Serial Number' = $Disk.SerialNumber 'Partition Style' = $Disk.PartitionStyle 'Disk Size' = "$([Math]::Round($Disk.Size / 1Gb)) GB" } - $SanDiskReport += $TempSanDiskReport + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } @@ -91,7 +91,7 @@ function Get-AbrWinHostStorage { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $SanDiskReport | Sort-Object -Property 'Disk Number' | Table @TableParams + $OutObj | Sort-Object -Property 'Disk Number' | Table @TableParams } } } catch { diff --git a/Src/Private/Get-AbrWinHostStorageISCSI.ps1 b/Src/Private/Get-AbrWinHostStorageISCSI.ps1 index 3d4581c..f3ac0ea 100644 --- a/Src/Private/Get-AbrWinHostStorageISCSI.ps1 +++ b/Src/Private/Get-AbrWinHostStorageISCSI.ps1 @@ -38,9 +38,9 @@ function Get-AbrWinHostStorageISCSI { Section -Style Heading4 'iSCSI Host Initiator' { Paragraph 'The following table details the hosts iSCSI IQN' BlankLine - $HostInitiatorReport = @() + $OutObj = @() try { - $TempHostInitiator = [PSCustomObject]@{ + $inObj = [ordered] @{ 'Node Address' = $HostInitiator.NodeAddress 'Operational Status' = Switch ($HostInitiator.OperationalStatus) { 1 { 'Unknown' } @@ -57,10 +57,10 @@ function Get-AbrWinHostStorageISCSI { } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } - $HostInitiatorReport += $TempHostInitiator + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) if ($HealthCheck.Storage.BP) { - $HostInitiatorReport | Where-Object { $_.'Operational Status' -ne 'Operational' } | Set-Style -Style Warning -Property 'Operational Status' + $OutObj | Where-Object { $_.'Operational Status' -ne 'Operational' } | Set-Style -Style Warning -Property 'Operational Status' } $TableParams = @{ @@ -71,7 +71,7 @@ function Get-AbrWinHostStorageISCSI { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $HostInitiatorReport | Table @TableParams + $OutObj | Table @TableParams } } @@ -80,14 +80,14 @@ function Get-AbrWinHostStorageISCSI { Section -Style Heading4 'iSCSI Target Server' { Paragraph 'The following table details iSCSI Target Server details' BlankLine - $HostIscsiTargetServerReport = @() + $OutObj = @() ForEach ($HostIscsiTargetServer in $HostIscsiTargetServers) { try { - $TempHostIscsiTargetServerReport = [PSCustomObject]@{ + $inObj = [ordered] @{ 'Target Portal Address' = $HostIscsiTargetServer.TargetPortalAddress 'Target Portal Port Number' = $HostIscsiTargetServer.TargetPortalPortNumber } - $HostIscsiTargetServerReport += $TempHostIscsiTargetServerReport + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } @@ -100,7 +100,7 @@ function Get-AbrWinHostStorageISCSI { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $HostIscsiTargetServerReport | Sort-Object -Property 'Target Portal Address' | Table @TableParams + $OutObj | Sort-Object -Property 'Target Portal Address' | Table @TableParams } } } catch { @@ -112,21 +112,21 @@ function Get-AbrWinHostStorageISCSI { Section -Style Heading4 'iSCIS Target Volumes' { Paragraph 'The following table details iSCSI target volumes' BlankLine - $HostIscsiTargetVolumeReport = @() + $OutObj = @() ForEach ($HostIscsiTargetVolume in $HostIscsiTargetVolumes) { try { - $TempHostIscsiTargetVolumeReport = [PSCustomObject]@{ + $inObj = [ordered] @{ 'Node Address' = $HostIscsiTargetVolume.NodeAddress - 'Node Connected' = ConvertTo-TextYN $HostIscsiTargetVolume.IsConnected + 'Node Connected' = $HostIscsiTargetVolume.IsConnected } - $HostIscsiTargetVolumeReport += $TempHostIscsiTargetVolumeReport + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } } if ($HealthCheck.Storage.BP) { - $HostIscsiTargetVolumeReport | Where-Object { $_.'Node Connected' -ne 'Yes' } | Set-Style -Style Warning -Property 'Node Connected' + $OutObj | Where-Object { $_.'Node Connected' -ne 'Yes' } | Set-Style -Style Warning -Property 'Node Connected' } $TableParams = @{ @@ -137,7 +137,7 @@ function Get-AbrWinHostStorageISCSI { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $HostIscsiTargetVolumeReport | Sort-Object -Property 'Node Address' | Table @TableParams + $OutObj | Sort-Object -Property 'Node Address' | Table @TableParams } } } catch { @@ -149,15 +149,15 @@ function Get-AbrWinHostStorageISCSI { Section -Style Heading4 'iSCSI Connections' { Paragraph 'The following table details iSCSI Connections' BlankLine - $HostIscsiConnectionsReport = @() + $OutObj = @() ForEach ($HostIscsiConnection in $HostIscsiConnections) { try { - $TempHostIscsiConnectionsReport = [PSCustomObject]@{ + $inObj = [ordered] @{ 'Connection Identifier' = $HostIscsiConnection.ConnectionIdentifier 'Initiator Address' = $HostIscsiConnection.InitiatorAddress 'Target Address' = $HostIscsiConnection.TargetAddress } - $HostIscsiConnectionsReport += $TempHostIscsiConnectionsReport + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } @@ -170,7 +170,7 @@ function Get-AbrWinHostStorageISCSI { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $HostIscsiConnectionsReport | Sort-Object -Property 'Connection Identifier' | Table @TableParams + $OutObj | Sort-Object -Property 'Connection Identifier' | Table @TableParams } } } catch { diff --git a/Src/Private/Get-AbrWinHostStorageMPIO.ps1 b/Src/Private/Get-AbrWinHostStorageMPIO.ps1 index 5fbda12..68616b1 100644 --- a/Src/Private/Get-AbrWinHostStorageMPIO.ps1 +++ b/Src/Private/Get-AbrWinHostStorageMPIO.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinHostStorageMPIO { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.2 + Version: 0.5.6 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -41,13 +41,13 @@ function Get-AbrWinHostStorageMPIO { Section -Style Heading4 'Multipath I/O AutoClaim' { Paragraph 'The following table details the BUS types MPIO will automatically claim for' BlankLine - $MpioAutoClaimReport = @() + $OutObj = @() foreach ($key in $MpioAutoClaim) { try { $Temp = "" | Select-Object BusType, State $Temp.BusType = $key $Temp.State = 'Enabled' - $MpioAutoClaimReport += $Temp + $OutObj += $Temp } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } @@ -60,7 +60,7 @@ function Get-AbrWinHostStorageMPIO { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $MpioAutoClaimReport | Sort-Object -Property 'BusType' | Table @TableParams + $OutObj | Sort-Object -Property 'BusType' | Table @TableParams } } try { @@ -69,16 +69,16 @@ function Get-AbrWinHostStorageMPIO { Section -Style Heading4 'MPIO Detected Hardware' { Paragraph 'The following table details the hardware detected and claimed by MPIO' BlankLine - $MpioAvailableHwReport = @() + $OutObj = @() foreach ($MpioAvailableHw in $MpioAvailableHws) { try { - $TempMpioAvailableHwReport = [PSCustomObject]@{ + $inObj = [ordered] @{ 'Vendor' = $MpioAvailableHw.VendorId 'Product' = $MpioAvailableHw.ProductId 'BusType' = $MpioAvailableHw.BusType - 'Multipathed' = ConvertTo-TextYN $MpioAvailableHw.IsMultipathed + 'Multipathed' = $MpioAvailableHw.IsMultipathed } - $MpioAvailableHwReport += $TempMpioAvailableHwReport + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } @@ -91,7 +91,7 @@ function Get-AbrWinHostStorageMPIO { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $MpioAvailableHwReport | Table @TableParams + $OutObj | Table @TableParams } } } catch { diff --git a/Src/Private/Get-AbrWinHostStorageVolume.ps1 b/Src/Private/Get-AbrWinHostStorageVolume.ps1 index 9398b50..47a68cd 100644 --- a/Src/Private/Get-AbrWinHostStorageVolume.ps1 +++ b/Src/Private/Get-AbrWinHostStorageVolume.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinHostStorageVolume { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.5 + Version: 0.5.6 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -32,10 +32,10 @@ function Get-AbrWinHostStorageVolume { Section -Style Heading3 'Host Volumes' { Paragraph 'The following section details local volumes on the host' BlankLine - $HostVolumeReport = @() + $OutObj = @() ForEach ($HostVolume in $HostVolumes) { try { - $TempHostVolumeReport = [PSCustomObject]@{ + $inObj = [ordered] @{ 'Drive Letter' = $HostVolume.DriveLetter 'File System Label' = $HostVolume.FileSystemLabel 'File System' = $HostVolume.FileSystem @@ -43,7 +43,7 @@ function Get-AbrWinHostStorageVolume { 'Free Space' = "$([Math]::Round($HostVolume.SizeRemaining / 1gb)) GB" 'Health Status' = $HostVolume.HealthStatus } - $HostVolumeReport += $TempHostVolumeReport + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } @@ -56,7 +56,7 @@ function Get-AbrWinHostStorageVolume { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $HostVolumeReport | Sort-Object -Property 'Drive Letter' | Table @TableParams + $OutObj | Sort-Object -Property 'Drive Letter' | Table @TableParams } } } catch { diff --git a/Src/Private/Get-AbrWinHyperVHostVM.ps1 b/Src/Private/Get-AbrWinHyperVHostVM.ps1 index e356635..5c6e9b4 100644 --- a/Src/Private/Get-AbrWinHyperVHostVM.ps1 +++ b/Src/Private/Get-AbrWinHyperVHostVM.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinHyperVHostVM { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.2 + Version: 0.5.6 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -33,14 +33,14 @@ function Get-AbrWinHyperVHostVM { Section -Style Heading3 'Hyper-V VMs' { Paragraph 'The following section details the Hyper-V VMs running on this host' BlankLine - $VmSummary = @() + $OutObj = @() foreach ($Vm in $Vms) { try { - $TempVmSummary = [PSCustomObject]@{ + $inObj = [ordered] @{ 'VM Name' = $Vm.Name 'State' = $Vm.State } - $VmSummary += $TempVmSummary + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } @@ -53,7 +53,7 @@ function Get-AbrWinHyperVHostVM { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $VmSummary | Sort-Object 'VM Name' | Table @TableParams + $OutObj | Sort-Object 'VM Name' | Table @TableParams foreach ($Vm in $Vms) { try { Section -Style Heading4 ($Vm.Name) { @@ -61,26 +61,28 @@ function Get-AbrWinHyperVHostVM { BlankLine try { Section -ExcludeFromTOC -Style NOTOCHeading5 'Virtual Machine Configuration' { + $OutObj = @() $DVDDrives = Invoke-Command -Session $TempPssSession -ScriptBlock { Get-VMDvdDrive -VMName ($using:Vm).Name } - $VmConfiguration = [PSCustomObject]@{ + $inObj = [ordered] @{ 'VM id' = $Vm.VMid 'VM Path' = $Vm.Path 'Uptime' = $Vm.Uptime 'vCPU Count' = $Vm.ProcessorCount 'Memory Assigned (GB)' = [Math]::Round($Vm.MemoryAssigned / 1gb) - 'Dynamic Memory Enabled' = ConvertTo-TextYN $Vm.DynamicMemoryEnabled + 'Dynamic Memory Enabled' = $Vm.DynamicMemoryEnabled 'Memory Startup (GB)' = [Math]::Round($Vm.MemoryStartup / 1gb) 'Memory Minimum (GB)' = [Math]::Round($Vm.MemoryMinimum / 1gb) 'Memory Maximum (GB)' = [Math]::Round($Vm.MemoryMaximum / 1gb) - 'Numa Aligned' = ConvertTo-EmptyToFiller $Vm.NumaAligned + 'Numa Aligned' = $Vm.NumaAligned 'Nuber of Numa Nodes' = $Vm.NumaNodesCount 'Number of Numa Sockets' = $Vm.NumaSocketCount 'Check Point Type' = $Vm.CheckpointType - 'Parent Snapshot Id' = ConvertTo-EmptyToFiller $Vm.ParentSnapshotId - 'Parent Snapshot Name' = ConvertTo-EmptyToFiller $Vm.ParentSnapshotName + 'Parent Snapshot Id' = $Vm.ParentSnapshotId + 'Parent Snapshot Name' = $Vm.ParentSnapshotName 'Generation' = $Vm.Generation 'DVD Drives' = $DVDDrives | ForEach-Object { "Controller Type: $($_.ControllerType), Media Type: $($_.DvdMediaType), Path: $($_.Path)" } } + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) $TableParams = @{ Name = "Virtual Machines" List = $true @@ -89,23 +91,23 @@ function Get-AbrWinHyperVHostVM { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $VmConfiguration | Table @TableParams + $OutObj | Table @TableParams } } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } try { Section -ExcludeFromTOC -Style NOTOCHeading5 'Virtual Machine Guest Integration Service' { - $VmIntegrationServiceSummary = @() + $OutObj = @() $VMIntegrationService = Invoke-Command -Session $TempPssSession -ScriptBlock { Get-VMIntegrationService -VMName ($using:Vm).Name } Foreach ($Service in $VMIntegrationService) { try { - $TempVmIntegrationServiceSummary = [PSCustomObject]@{ + $inObj = [ordered] @{ 'Service Name' = $Service.Name - 'Service State' = ConvertTo-TextYN $Service.Enabled - 'Primary Status' = ConvertTo-EmptyToFiller $Service.PrimaryStatusDescription + 'Service State' = $Service.Enabled + 'Primary Status' = $Service.PrimaryStatusDescription } - $VmIntegrationServiceSummary += $TempVmIntegrationServiceSummary + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } @@ -118,7 +120,7 @@ function Get-AbrWinHyperVHostVM { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $VmIntegrationServiceSummary | Table @TableParams + $OutObj | Table @TableParams } } catch { Write-PScriboMessage -IsWarning $_.Exception.Message @@ -128,16 +130,16 @@ function Get-AbrWinHyperVHostVM { $VmNetworkAdapters = Invoke-Command -Session $TempPssSession -ScriptBlock { Get-VMNetworkAdapter -VMName ($using:Vm).Name } if ($VmNetworkAdapters) { Section -ExcludeFromTOC -Style NOTOCHeading5 'VM Network Adapters' { - $VmNetworkAdapterReport = @() + $OutObj = @() ForEach ($Adapter in $VmNetworkAdapters) { try { - $TempVmNetworkAdapter = [PSCustomObject]@{ + $inObj = [ordered] @{ 'Name' = $Adapter.Name 'Mac Address' = $Adapter.MacAddress - 'IP Address' = ConvertTo-EmptyToFiller ($Adapter.IPAddresses) + 'IP Address' = ($Adapter.IPAddresses) 'Switch Name' = $Adapter.SwitchName } - $VmNetworkAdapterReport += $TempVmNetworkAdapter + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } @@ -151,7 +153,7 @@ function Get-AbrWinHyperVHostVM { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $VmNetworkAdapterReport | Sort-Object -Property 'Name' | Table @TableParams + $OutObj | Sort-Object -Property 'Name' | Table @TableParams } } } catch { @@ -162,16 +164,16 @@ function Get-AbrWinHyperVHostVM { $VmAdapterVlan = Invoke-Command -Session $TempPssSession -ScriptBlock { Get-VMNetworkAdapterVlan -VMName ($using:Vm).Name | Select-Object -Property * } if ($VmAdapterVlan) { Section -ExcludeFromTOC -Style NOTOCHeading5 'VM Network Adapter VLANs' { - $VmAdapterVlanReport = @() + $OutObj = @() ForEach ($Adapter in $VmAdapterVlan) { try { - $TempVmAdapterVlanReport = [PSCustomObject]@{ + $inObj = [ordered] @{ 'Adapter Name' = $Adapter.ParentAdapter.Name 'Operation Mode' = $Adapter.OperationMode 'Vlan ID' = $Adapter.AccessVlanId 'Trunk Vlans' = $Adapter.AllowedVlanIdList -Join "," } - $VmAdapterVlanReport += $TempVmAdapterVlanReport + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } @@ -185,7 +187,7 @@ function Get-AbrWinHyperVHostVM { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $VmAdapterVlanReport | Sort-Object -Property 'Adapter Name' | Table @TableParams + $OutObj | Sort-Object -Property 'Adapter Name' | Table @TableParams } } } catch { @@ -196,11 +198,11 @@ function Get-AbrWinHyperVHostVM { $VmHardDisks = Invoke-Command -Session $TempPssSession -ScriptBlock { Get-VMHardDiskDrive -VMName ($using:Vm).Name } if ($VmHardDisks) { Section -ExcludeFromTOC -Style NOTOCHeading5 'VM Hard Disks' { - $VmDiskReport = @() + $OutObj = @() foreach ($VmHardDisk in $VMHardDisks) { try { $VmVhd = Invoke-Command -Session $TempPssSession -ScriptBlock { Get-VHD -Path ($using:VmHardDisk).Path } - $TempVmDiskReport = [PSCustomObject]@{ + $inObj = [ordered] @{ 'Disk Path' = $VmVhd.Path 'Disk Format' = $VmVhd.VhdFormat 'Disk Type' = $VmVhd.VhdType @@ -210,7 +212,7 @@ function Get-AbrWinHyperVHostVM { 'Bus No' = $VmHardDisk.ControllerNumber 'Bus Location' = $VmHardDisk.ControllerLocation } - $VmDiskReport += $TempVmDiskReport + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } @@ -224,7 +226,7 @@ function Get-AbrWinHyperVHostVM { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $VmDiskReport | Sort-Object -Property 'Disk Path' | Table @TableParams + $OutObj | Sort-Object -Property 'Disk Path' | Table @TableParams } } } catch { diff --git a/Src/Private/Get-AbrWinHyperVNetworking.ps1 b/Src/Private/Get-AbrWinHyperVNetworking.ps1 index 3fe3367..691d362 100644 --- a/Src/Private/Get-AbrWinHyperVNetworking.ps1 +++ b/Src/Private/Get-AbrWinHyperVNetworking.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinHyperVNetworking { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.2 + Version: 0.5.6 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -29,7 +29,8 @@ function Get-AbrWinHyperVNetworking { try { try { Section -Style Heading3 "Hyper-V MAC Pool settings" { - $VmHostMacPool = [PSCustomObject]@{ + $OutObj = @() + $inObj = [ordered] @{ 'Mac Address Minimum' = Switch (($VmHost.MacAddressMinimum).Length) { 0 { "--" } 12 { $VmHost.MacAddressMinimum -replace '..(?!$)', '$&:' } @@ -41,6 +42,8 @@ function Get-AbrWinHyperVNetworking { default { $VmHost.MacAddressMinimum } } } + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) + $TableParams = @{ Name = "Host MAC Pool" List = $false @@ -49,7 +52,7 @@ function Get-AbrWinHyperVNetworking { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $VmHostMacPool | Table @TableParams + $OutObj | Table @TableParams } } catch { Write-PScriboMessage -IsWarning $_.Exception.Message @@ -60,19 +63,19 @@ function Get-AbrWinHyperVNetworking { Section -Style Heading3 "Hyper-V Management OS Adapters" { Paragraph 'The following table details the Management OS Virtual Adapters created on Virtual Switches' BlankLine - $VmOsAdapterReport = @() + $OutObj = @() Foreach ($VmOsAdapter in $VmOsAdapters) { try { $AdapterVlan = Invoke-Command -Session $TempPssSession { Get-VMNetworkAdapterVlan -ManagementOS -VMNetworkAdapterName ($using:VmOsAdapter).Name | Select-Object -Property * } - $TempVmOsAdapterReport = [PSCustomObject]@{ + $inObj = [ordered] @{ 'Name' = $VmOsAdapter.Name 'Switch Name' = $VmOsAdapter.SwitchName 'Mac Address' = $VmOsAdapter.MacAddress - 'IPv4 Address' = ConvertTo-EmptyToFiller $VmOsAdapter.IPAddresses + 'IPv4 Address' = $VmOsAdapter.IPAddresses 'Adapter Mode' = $AdapterVlan.OperationMode 'Vlan ID' = $AdapterVlan.AccessVlanId } - $VmOsAdapterReport += $TempVmOsAdapterReport + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } @@ -85,7 +88,7 @@ function Get-AbrWinHyperVNetworking { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $VmOsAdapterReport | Sort-Object -Property 'Name' | Table @TableParams + $OutObj | Sort-Object -Property 'Name' | Table @TableParams } } } catch { @@ -97,16 +100,16 @@ function Get-AbrWinHyperVNetworking { Section -Style Heading3 "Hyper-V vSwitch Settings" { Paragraph 'The following table provide a summary of Hyper-V configured vSwitches' BlankLine - $VmSwitchesReport = @() + $OutObj = @() ForEach ($VmSwitch in $VmSwitches) { try { - $TempVmSwitchesReport = [PSCustomObject]@{ + $inObj = [ordered] @{ 'Switch Name' = $VmSwitch.Name 'Switch Type' = $VmSwitch.SwitchType - 'Embedded Team' = ConvertTo-TextYN $VmSwitch.EmbeddedTeamingEnabled - 'Interface Description' = ConvertTo-EmptyToFiller $VmSwitch.NetAdapterInterfaceDescription + 'Embedded Team' = $VmSwitch.EmbeddedTeamingEnabled + 'Interface Description' = $VmSwitch.NetAdapterInterfaceDescription } - $VmSwitchesReport += $TempVmSwitchesReport + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } @@ -120,24 +123,27 @@ function Get-AbrWinHyperVNetworking { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $VmSwitchesReport | Sort-Object -Property 'Switch Name' | Table @TableParams + $OutObj | Sort-Object -Property 'Switch Name' | Table @TableParams Foreach ($VmSwitch in $VmSwitches) { try { Section -ExcludeFromTOC -Style NOTOCHeading4 ($VmSwitch.Name) { - $VmSwitchReport = [PSCustomObject]@{ + $OutObj = @() + $inObj = [ordered] @{ 'Switch Name' = $VmSwitch.Name 'Switch Type' = $VmSwitch.SwitchType - 'Switch Embedded Teaming Status' = ConvertTo-TextYN $VmSwitch.EmbeddedTeamingEnabled + 'Switch Embedded Teaming Status' = $VmSwitch.EmbeddedTeamingEnabled 'Bandwidth Reservation Mode' = $VmSwitch.BandwidthReservationMode 'Bandwidth Reservation Percentage' = $VmSwitch.Percentage - 'Management OS Allowed' = ConvertTo-TextYN $VmSwitch.AllowManagementOS + 'Management OS Allowed' = $VmSwitch.AllowManagementOS 'Physical Adapters' = $VmSwitch.NetAdapterInterfaceDescriptions -Join "," - 'IOV Support' = ConvertTo-TextYN $VmSwitch.IovSupport + 'IOV Support' = $VmSwitch.IovSupport 'IOV Support Reasons' = $VmSwitch.IovSupportReasons 'Available VM Queues' = $VmSwitch.AvailableVMQueues - 'Packet Direct Enabled' = ConvertTo-TextYN $VmSwitch.PacketDirectinUse + 'Packet Direct Enabled' = $VmSwitch.PacketDirectinUse } + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) + $TableParams = @{ Name = "VM Switch Details" @@ -147,7 +153,7 @@ function Get-AbrWinHyperVNetworking { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $VmSwitchReport | Table @TableParams + $OutObj | Table @TableParams } } catch { Write-PScriboMessage -IsWarning $_.Exception.Message diff --git a/Src/Private/Get-AbrWinHyperVNuma.ps1 b/Src/Private/Get-AbrWinHyperVNuma.ps1 index 9cdadfa..23faac0 100644 --- a/Src/Private/Get-AbrWinHyperVNuma.ps1 +++ b/Src/Private/Get-AbrWinHyperVNuma.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinHyperVNuma { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.2 + Version: 0.5.6 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @jcolonfzenpr @@ -30,15 +30,15 @@ function Get-AbrWinHyperVNuma { $VmHostNumaNodes = Invoke-Command -Session $TempPssSession { Get-VMHostNumaNode } if ($VmHostNumaNodes) { Section -Style Heading3 "Hyper-V NUMA Boundaries" { - [array]$VmHostNumaReport = @() + $OutObj = @() foreach ($Node in $VmHostNumaNodes) { try { - $TempVmHostNumaReport = [PSCustomObject]@{ + $inObj = [ordered] @{ 'Numa Node Id' = $Node.NodeId 'Memory Available' = "$([math]::Round(($Node.MemoryAvailable)/1024,0)) GB" 'Memory Total' = "$([math]::Round(($Node.MemoryTotal)/1024,0)) GB" } - $VmHostNumaReport += $TempVmHostNumaReport + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } @@ -51,7 +51,7 @@ function Get-AbrWinHyperVNuma { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $VmHostNumaReport | Sort-Object -Property 'Numa Node Id' | Table @TableParams + $OutObj | Sort-Object -Property 'Numa Node Id' | Table @TableParams } } } catch { diff --git a/Src/Private/Get-AbrWinHyperVSummary.ps1 b/Src/Private/Get-AbrWinHyperVSummary.ps1 index 211499d..8656bcb 100644 --- a/Src/Private/Get-AbrWinHyperVSummary.ps1 +++ b/Src/Private/Get-AbrWinHyperVSummary.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinHyperVSummary { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.2 + Version: 0.5.6 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -29,20 +29,23 @@ function Get-AbrWinHyperVSummary { try { $script:VmHost = Invoke-Command -Session $TempPssSession { Get-VMHost } if ($VmHost) { - $VmHostReport = [PSCustomObject]@{ + $OutObj = @() + $inObj = [ordered] @{ 'Logical Processor Count' = $VmHost.LogicalProcessorCount 'Memory Capacity' = "$([Math]::Round($VmHost.MemoryCapacity / 1gb)) GB" 'VM Default Path' = $VmHost.VirtualMachinePath 'VM Disk Default Path' = $VmHost.VirtualHardDiskPath 'Supported VM Versions' = $VmHost.SupportedVmVersions -Join "," - 'Numa Spannning Enabled' = ConvertTo-TextYN $VmHost.NumaSpanningEnabled - 'Iov Support' = ConvertTo-TextYN $VmHost.IovSupport - 'VM Migrations Enabled' = ConvertTo-TextYN $VmHost.VirtualMachineMigrationEnabled - 'Allow any network for Migrations' = ConvertTo-TextYN $VmHost.UseAnyNetworkForMigration + 'Numa Spannning Enabled' = $VmHost.NumaSpanningEnabled + 'Iov Support' = $VmHost.IovSupport + 'VM Migrations Enabled' = $VmHost.VirtualMachineMigrationEnabled + 'Allow any network for Migrations' = $VmHost.UseAnyNetworkForMigration 'VM Migration Authentication Type' = $VmHost.VirtualMachineMigrationAuthenticationType 'Max Concurrent Storage Migrations' = $VmHost.MaximumStorageMigrations 'Max Concurrent VM Migrations' = $VmHost.MaximumStorageMigrations } + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) + $TableParams = @{ Name = "Hyper-V Host Settings" List = $true @@ -51,7 +54,7 @@ function Get-AbrWinHyperVSummary { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $VmHostReport | Table @TableParams + $OutObj | Table @TableParams } } catch { Write-PScriboMessage -IsWarning $_.Exception.Message diff --git a/Src/Private/Get-AbrWinIISSummary.ps1 b/Src/Private/Get-AbrWinIISSummary.ps1 index f6a7851..0534dc2 100644 --- a/Src/Private/Get-AbrWinIISSummary.ps1 +++ b/Src/Private/Get-AbrWinIISSummary.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinIISSummary { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.2 + Version: 0.5.6 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -26,16 +26,19 @@ function Get-AbrWinIISSummary { process { if ($InfoLevel.IIS -ge 1) { try { + $OutObj = @() $IISApplicationDefaults = Invoke-Command -Session $TempPssSession { (Get-IISServerManager).ApplicationDefaults } $IISSiteDefaults = Invoke-Command -Session $TempPssSession { (Get-IISServerManager).SiteDefaults | Select-Object ServerAutoStart, @{name = 'Directory'; Expression = { $_.Logfile.Directory } } } if ($IISApplicationDefaults -and $IISSiteDefaults) { try { - $IISServerManagerReport = [PSCustomObject]@{ + $inObj = [ordered] @{ 'Default Application Pool' = ($IISApplicationDefaults).ApplicationPoolName 'Enabled Protocols' = (($IISApplicationDefaults).EnabledProtocols).toUpper() 'Logfile Path' = ($IISSiteDefaults).Directory - 'Server Auto Start' = ConvertTo-TextYN ($IISSiteDefaults).ServerAutoStart + 'Server Auto Start' = ($IISSiteDefaults).ServerAutoStart } + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) + $TableParams = @{ Name = "IIS Host Settings" List = $false @@ -44,7 +47,7 @@ function Get-AbrWinIISSummary { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $IISServerManagerReport | Table @TableParams + $OutObj | Table @TableParams } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } diff --git a/Src/Private/Get-AbrWinIISWebAppPool.ps1 b/Src/Private/Get-AbrWinIISWebAppPool.ps1 index d889108..b04f4d3 100644 --- a/Src/Private/Get-AbrWinIISWebAppPool.ps1 +++ b/Src/Private/Get-AbrWinIISWebAppPool.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinIISWebAppPool { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.2 + Version: 0.5.6 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -31,17 +31,17 @@ function Get-AbrWinIISWebAppPool { Section -Style Heading3 'Application Pools' { Paragraph 'The following table lists IIS Application Pools' BlankLine - $IISWebAppPoolsReport = @() + $OutObj = @() foreach ($IISWebAppPool in $IISWebAppPools) { try { - $TempIISWebAppPoolsReport = [PSCustomObject]@{ + $inObj = [ordered] @{ 'Name' = $IISWebAppPool.Name 'Status' = $IISWebAppPool.State 'CLR Ver' = $IISWebAppPool.ManagedRuntimeVersion 'Pipeline Mode ' = $IISWebAppPool.ManagedPipelineMode 'Start Mode' = $IISWebAppPool.StartMode } - $IISWebAppPoolsReport += $TempIISWebAppPoolsReport + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } @@ -55,7 +55,7 @@ function Get-AbrWinIISWebAppPool { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $IISWebAppPoolsReport | Table @TableParams + $OutObj | Table @TableParams } } } catch { diff --git a/Src/Private/Get-AbrWinIISWebSite.ps1 b/Src/Private/Get-AbrWinIISWebSite.ps1 index f02ccd0..c026125 100644 --- a/Src/Private/Get-AbrWinIISWebSite.ps1 +++ b/Src/Private/Get-AbrWinIISWebSite.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinIISWebSite { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.5 + Version: 0.5.6 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -31,16 +31,16 @@ function Get-AbrWinIISWebSite { Section -Style Heading3 'Sites Summary' { Paragraph 'The following table provide a summary of IIS Web Sites' BlankLine - $IISWebSitesrReport = @() + $OutObj = @() foreach ($IISWebSite in $IISWebSites) { try { - $TempIISWebSitesrReport = [PSCustomObject]@{ + $inObj = [ordered] @{ 'Name' = $IISWebSite.Name 'Status' = $IISWebSite.state 'Binding' = $IISWebSite.bindings.Collection 'Application Pool' = $IISWebSite.applicationPool } - $IISWebSitesrReport += $TempIISWebSitesrReport + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } @@ -54,23 +54,23 @@ function Get-AbrWinIISWebSite { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $IISWebSitesrReport | Table @TableParams + $OutObj | Table @TableParams try { $IISWebSites = Invoke-Command -Session $TempPssSession { Get-Website } if ($IISWebSites) { Section -Style Heading4 'Sites Configuration' { Paragraph 'The following section details IIS Web Sites configuration' BlankLine - $IISWebSitesrReport = @() + $OutObj = @() foreach ($IISWebSite in $IISWebSites) { try { Section -Style Heading5 "$($IISWebSite.Name)" { Paragraph "The following table details $($IISWebSite.Name) settings" BlankLine $SiteURL = Invoke-Command -Session $TempPssSession { Get-WebURL -PSPath "IIS:\Sites\$(($using:IISWebSite).Name)" } - $TempIISWebSitesrReport = [PSCustomObject]@{ + $inObj = [ordered] @{ 'Name' = $IISWebSite.Name - 'Auto Start' = ConvertTo-TextYN $IISWebSite.serverAutoStart + 'Auto Start' = $IISWebSite.serverAutoStart 'Enabled Protocols ' = $IISWebSite.enabledProtocols 'URL' = Switch (($SiteURL.ResponseUri).count) { 0 { "--" } @@ -80,7 +80,7 @@ function Get-AbrWinIISWebSite { 'Log Path' = $IISWebSite.logFile.directory } - $IISWebSitesrReport = $TempIISWebSitesrReport + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) $TableParams = @{ Name = "IIS Web Sites - $($IISWebSite.Name)" @@ -90,22 +90,22 @@ function Get-AbrWinIISWebSite { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $IISWebSitesrReport | Table @TableParams + $OutObj | Table @TableParams try { $IISWebApps = Invoke-Command -Session $TempPssSession { Get-WebApplication -Site $(($using:IISWebSite).Name) } if ($IISWebApps) { Section -Style Heading5 "Web Applications" { Paragraph "The following table details $($IISWebSite.Name) Web Application" BlankLine - $IISWebAppsReport = @() + $OutObj = @() foreach ($IISWebApp in $IISWebApps) { try { - $TempIISWebAppsReport = [PSCustomObject]@{ + $inObj = [ordered] @{ 'Name' = $IISWebApp.Path 'Application pool' = $IISWebApp.Applicationpool 'Physical Path ' = $IISWebApp.PhysicalPath } - $IISWebAppsReport += $TempIISWebAppsReport + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } @@ -119,7 +119,7 @@ function Get-AbrWinIISWebSite { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $IISWebAppsReport | Table @TableParams + $OutObj | Table @TableParams } } } catch { diff --git a/Src/Private/Get-AbrWinLocalAdmin.ps1 b/Src/Private/Get-AbrWinLocalAdmin.ps1 index 2f3be7c..3081c25 100644 --- a/Src/Private/Get-AbrWinLocalAdmin.ps1 +++ b/Src/Private/Get-AbrWinLocalAdmin.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinLocalAdmin { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.2 + Version: 0.5.6 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -29,15 +29,15 @@ function Get-AbrWinLocalAdmin { try { if ($LocalAdmins) { Section -Style Heading3 'Local Administrators' { - $LocalAdminsReport = @() + $OutObj = @() ForEach ($LocalAdmin in $LocalAdmins) { try { - $TempLocalAdminsReport = [PSCustomObject]@{ + $inObj = [ordered] @{ 'Account Name' = $LocalAdmin.Name 'Account Type' = $LocalAdmin.ObjectClass - 'Account Source' = ConvertTo-EmptyToFiller $LocalAdmin.PrincipalSource + 'Account Source' = $LocalAdmin.PrincipalSource } - $LocalAdminsReport += $TempLocalAdminsReport + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } @@ -50,7 +50,7 @@ function Get-AbrWinLocalAdmin { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $LocalAdminsReport | Sort-Object -Property 'Account Name' | Table @TableParams + $OutObj | Sort-Object -Property 'Account Name' | Table @TableParams } } } catch { diff --git a/Src/Private/Get-AbrWinLocalGroup.ps1 b/Src/Private/Get-AbrWinLocalGroup.ps1 index 1115bfe..a7ee5f8 100644 --- a/Src/Private/Get-AbrWinLocalGroup.ps1 +++ b/Src/Private/Get-AbrWinLocalGroup.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinLocalGroup { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.2 + Version: 0.5.6 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -29,10 +29,10 @@ function Get-AbrWinLocalGroup { try { if ($LocalGroups) { Section -Style Heading3 'Local Groups' { - $LocalGroupsReport = @() + $OutObj = @() ForEach ($LocalGroup in $LocalGroups) { try { - $TempLocalGroupsReport = [PSCustomObject]@{ + $inObj = [ordered] @{ 'Group Name' = $LocalGroup.GroupName 'Description' = Switch ([string]::IsNullOrEmpty($LocalGroup.Description)) { $true { "--" } @@ -45,7 +45,7 @@ function Get-AbrWinLocalGroup { default { "Unknown" } } } - $LocalGroupsReport += $TempLocalGroupsReport + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } @@ -58,7 +58,7 @@ function Get-AbrWinLocalGroup { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $LocalGroupsReport | Sort-Object -Property 'Group Name' | Table @TableParams + $OutObj | Sort-Object -Property 'Group Name' | Table @TableParams } } } catch { diff --git a/Src/Private/Get-AbrWinLocalUser.ps1 b/Src/Private/Get-AbrWinLocalUser.ps1 index 2db9294..8a77d8c 100644 --- a/Src/Private/Get-AbrWinLocalUser.ps1 +++ b/Src/Private/Get-AbrWinLocalUser.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinLocalUser { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.2 + Version: 0.5.6 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -29,19 +29,19 @@ function Get-AbrWinLocalUser { try { if ($LocalUsers) { Section -Style Heading3 'Local Users' { - $LocalUsersReport = @() + $OutObj = @() ForEach ($LocalUser in $LocalUsers) { try { - $TempLocalUsersReport = [PSCustomObject]@{ + $inObj = [ordered] @{ 'User Name' = $LocalUser.Name 'Description' = $LocalUser.Description - 'Account Enabled' = ConvertTo-TextYN $LocalUser.Enabled + 'Account Enabled' = $LocalUser.Enabled 'Last Logon Date' = Switch (($LocalUser.LastLogon).count) { 0 { "--" } default { $LocalUser.LastLogon.ToShortDateString() } } } - $LocalUsersReport += $TempLocalUsersReport + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } @@ -54,7 +54,7 @@ function Get-AbrWinLocalUser { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $LocalUsersReport | Sort-Object -Property 'User Name' | Table @TableParams + $OutObj | Sort-Object -Property 'User Name' | Table @TableParams } } } catch { diff --git a/Src/Private/Get-AbrWinNetAdapter.ps1 b/Src/Private/Get-AbrWinNetAdapter.ps1 index 2a572b1..7cb9a52 100644 --- a/Src/Private/Get-AbrWinNetAdapter.ps1 +++ b/Src/Private/Get-AbrWinNetAdapter.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinNetAdapter { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.2 + Version: 0.5.6 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -30,16 +30,16 @@ function Get-AbrWinNetAdapter { $HostAdapters = Invoke-Command -Session $TempPssSession { Get-NetAdapter } if ($HostAdapters) { Section -Style Heading3 'Network Adapters' { - $HostAdaptersReport = @() + $OutObj = @() ForEach ($HostAdapter in $HostAdapters) { try { - $TempHostAdaptersReport = [PSCustomObject]@{ + $inObj = [ordered] @{ 'Adapter Name' = $HostAdapter.Name 'Adapter Description' = $HostAdapter.InterfaceDescription 'Mac Address' = $HostAdapter.MacAddress 'Link Speed' = $HostAdapter.LinkSpeed } - $HostAdaptersReport += $TempHostAdaptersReport + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } @@ -52,7 +52,7 @@ function Get-AbrWinNetAdapter { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $HostAdaptersReport | Sort-Object -Property 'Adapter Name' | Table @TableParams + $OutObj | Sort-Object -Property 'Adapter Name' | Table @TableParams } } } catch { diff --git a/Src/Private/Get-AbrWinNetAdapterMTU.ps1 b/Src/Private/Get-AbrWinNetAdapterMTU.ps1 index 6aef404..7aa3d01 100644 --- a/Src/Private/Get-AbrWinNetAdapterMTU.ps1 +++ b/Src/Private/Get-AbrWinNetAdapterMTU.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinNetAdapterMTU { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.2 + Version: 0.5.6 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -30,14 +30,14 @@ function Get-AbrWinNetAdapterMTU { $NetMtus = Invoke-Command -Session $TempPssSession { Get-NetAdapterAdvancedProperty | Where-Object { $_.DisplayName -eq 'Jumbo Packet' } } if ($NetMtus) { Section -Style Heading3 'Network Adapter MTU' { - $NetMtuReport = @() + $OutObj = @() ForEach ($NetMtu in $NetMtus) { try { - $TempNetMtuReport = [PSCustomObject]@{ + $inObj = [ordered] @{ 'Adapter Name' = $NetMtu.Name 'MTU Size' = $NetMtu.DisplayValue } - $NetMtuReport += $TempNetMtuReport + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } @@ -50,7 +50,7 @@ function Get-AbrWinNetAdapterMTU { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $NetMtuReport | Sort-Object -Property 'Adapter Name' | Table @TableParams + $OutObj | Sort-Object -Property 'Adapter Name' | Table @TableParams } } } catch { diff --git a/Src/Private/Get-AbrWinNetDNSClient.ps1 b/Src/Private/Get-AbrWinNetDNSClient.ps1 index 77827b3..2fb6d75 100644 --- a/Src/Private/Get-AbrWinNetDNSClient.ps1 +++ b/Src/Private/Get-AbrWinNetDNSClient.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinNetDNSClient { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.2 + Version: 0.5.6 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -32,12 +32,16 @@ function Get-AbrWinNetDNSClient { Section -Style Heading3 'DNS Client' { Paragraph 'The following table details the DNS Search Domains' BlankLine - $DnsClientReport = [PSCustomObject]@{ + $OutObj = @() + $inObj = [ordered] @{ 'DNS Suffix' = $DnsClient.SuffixSearchList -Join "," - 'Use Suffix Search List' = ConvertTo-TextYN $DnsClient.UseSuffixSearchList - 'Use Devolution' = ConvertTo-TextYN $DnsClient.UseDevolution + 'Use Suffix Search List' = $DnsClient.UseSuffixSearchList + 'Use Devolution' = $DnsClient.UseDevolution 'Devolution Level' = $DnsClient.DevolutionLevel } + + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) + $TableParams = @{ Name = "DNS Search Domain" List = $false @@ -46,7 +50,7 @@ function Get-AbrWinNetDNSClient { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $DnsClientReport | Sort-Object -Property 'DNS Suffix' | Table @TableParams + $OutObj | Sort-Object -Property 'DNS Suffix' | Table @TableParams } } } catch { diff --git a/Src/Private/Get-AbrWinNetDNSServer.ps1 b/Src/Private/Get-AbrWinNetDNSServer.ps1 index 417cc40..1a890ec 100644 --- a/Src/Private/Get-AbrWinNetDNSServer.ps1 +++ b/Src/Private/Get-AbrWinNetDNSServer.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinNetDNSServer { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.2 + Version: 0.5.6 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -32,14 +32,14 @@ function Get-AbrWinNetDNSServer { Section -Style Heading3 'DNS Servers' { Paragraph 'The following table details the DNS Server Addresses Configured' BlankLine - $DnsServerReport = @() + $OutObj = @() ForEach ($DnsServer in $DnsServers) { try { - $TempDnsServerReport = [PSCustomObject]@{ + $inObj = [ordered] @{ 'Interface' = $DnsServer.InterfaceAlias 'Server Address' = $DnsServer.ServerAddresses -Join "," } - $DnsServerReport += $TempDnsServerReport + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } @@ -52,7 +52,7 @@ function Get-AbrWinNetDNSServer { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $DnsServerReport | Sort-Object -Property 'Interface' | Table @TableParams + $OutObj | Sort-Object -Property 'Interface' | Table @TableParams } } } catch { diff --git a/Src/Private/Get-AbrWinNetFirewall.ps1 b/Src/Private/Get-AbrWinNetFirewall.ps1 index 50a9de3..004c160 100644 --- a/Src/Private/Get-AbrWinNetFirewall.ps1 +++ b/Src/Private/Get-AbrWinNetFirewall.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinNetFirewall { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.2 + Version: 0.5.6 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -30,16 +30,16 @@ function Get-AbrWinNetFirewall { $NetFirewallProfile = Get-NetFirewallProfile -CimSession $TempCimSession if ($NetFirewallProfile) { Section -Style Heading2 'Windows Firewall' { - $NetFirewallProfileReport = @() + $OutObj = @() Foreach ($FirewallProfile in $NetFireWallProfile) { try { - $TempNetFirewallProfileReport = [PSCustomObject]@{ + $inObj = [ordered] @{ 'Profile' = $FirewallProfile.Name - 'Profile Enabled' = ConvertTo-TextYN $FirewallProfile.Enabled + 'Profile Enabled' = $FirewallProfile.Enabled 'Inbound Action' = $FirewallProfile.DefaultInboundAction 'Outbound Action' = $FirewallProfile.DefaultOutboundAction } - $NetFirewallProfileReport += $TempNetFirewallProfileReport + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PscriboMessage -IsWarning $_.Exception.Message @@ -47,7 +47,7 @@ function Get-AbrWinNetFirewall { } if ($HealthCheck.Networking.Firewall) { - $NetFirewallProfileReport | Where-Object { $_.'Profile Enabled' -notlike 'Yes'} | Set-Style -Style Warning -Property 'Profile Enabled' + $OutObj | Where-Object { $_.'Profile Enabled' -notlike 'Yes'} | Set-Style -Style Warning -Property 'Profile Enabled' } $TableParams = @{ @@ -58,7 +58,7 @@ function Get-AbrWinNetFirewall { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $NetFirewallProfileReport | Sort-Object -Property 'Profile' | Table @TableParams + $OutObj | Sort-Object -Property 'Profile' | Table @TableParams } } } diff --git a/Src/Private/Get-AbrWinNetIPAddress.ps1 b/Src/Private/Get-AbrWinNetIPAddress.ps1 index 19efb90..6312976 100644 --- a/Src/Private/Get-AbrWinNetIPAddress.ps1 +++ b/Src/Private/Get-AbrWinNetIPAddress.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinNetIPAddress { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.2 + Version: 0.5.6 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -32,10 +32,10 @@ function Get-AbrWinNetIPAddress { Section -Style Heading3 'IP Addresses' { Paragraph 'The following table details IP Addresses assigned to hosts' BlankLine - $NetIpsReport = @() + $OutObj = @() ForEach ($NetIp in $NetIps) { try { - $TempNetIpsReport = [PSCustomObject]@{ + $inObj = [ordered] @{ 'Interface Name' = $NetIp.InterfaceAlias 'Interface Description' = $NetIp.InterfaceDescription 'IPv4 Addresses' = $NetIp.IPv4Address.IPAddress -Join "," @@ -46,7 +46,7 @@ function Get-AbrWinNetIPAddress { default { "Unknown" } } } - $NetIpsReport += $TempNetIpsReport + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } @@ -59,7 +59,7 @@ function Get-AbrWinNetIPAddress { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $NetIpsReport | Sort-Object -Property 'Interface Name' | Table @TableParams + $OutObj | Sort-Object -Property 'Interface Name' | Table @TableParams } } } catch { diff --git a/Src/Private/Get-AbrWinNetTeamInterface.ps1 b/Src/Private/Get-AbrWinNetTeamInterface.ps1 index aa7d248..ea5415c 100644 --- a/Src/Private/Get-AbrWinNetTeamInterface.ps1 +++ b/Src/Private/Get-AbrWinNetTeamInterface.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinNetTeamInterface { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.2 + Version: 0.5.6 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -33,16 +33,16 @@ function Get-AbrWinNetTeamInterface { Paragraph 'The following table details Network Team Interfaces' BlankLine $NetTeams = Invoke-Command -Session $TempPssSession { Get-NetLbfoTeam } - $NetTeamReport = @() + $OutObj = @() ForEach ($NetTeam in $NetTeams) { try { - $TempNetTeamReport = [PSCustomObject]@{ + $inObj = [ordered] @{ 'Team Name' = $NetTeam.Name 'Team Mode' = $NetTeam.tm 'Load Balancing' = $NetTeam.lba 'Network Adapters' = $NetTeam.Members -Join "," } - $NetTeamReport += $TempNetTeamReport + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } @@ -55,7 +55,7 @@ function Get-AbrWinNetTeamInterface { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $NetTeamReport | Sort-Object -Property 'Team Name' | Table @TableParams + $OutObj | Sort-Object -Property 'Team Name' | Table @TableParams } } } catch { diff --git a/Src/Private/Get-AbrWinOSConfig.ps1 b/Src/Private/Get-AbrWinOSConfig.ps1 index 36f810c..7a5e847 100644 --- a/Src/Private/Get-AbrWinOSConfig.ps1 +++ b/Src/Private/Get-AbrWinOSConfig.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinOSConfig { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.2 + Version: 0.5.6 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -29,7 +29,8 @@ function Get-AbrWinOSConfig { Section -Style Heading3 'OS Configuration' { Paragraph 'The following section details host OS configuration' BlankLine - $HostOSReport = [PSCustomObject] @{ + $OutObj = @() + $inObj = [ordered] @{ 'Windows Product Name' = $HostInfo.WindowsProductName 'Windows Version' = $HostInfo.WindowsCurrentVersion 'Windows Build Number' = $HostInfo.OsVersion @@ -51,6 +52,8 @@ function Get-AbrWinOSConfig { default { "Unknown" } } } + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) + $TableParams = @{ Name = "OS Settings" List = $true @@ -59,7 +62,7 @@ function Get-AbrWinOSConfig { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $HostOSReport | Table @TableParams + $OutObj | Table @TableParams } } } diff --git a/Src/Private/Get-AbrWinOSDriver.ps1 b/Src/Private/Get-AbrWinOSDriver.ps1 index ff513dc..a3f1ea6 100644 --- a/Src/Private/Get-AbrWinOSDriver.ps1 +++ b/Src/Private/Get-AbrWinOSDriver.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinOSDriver { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.2 + Version: 0.5.6 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -31,16 +31,16 @@ function Get-AbrWinOSDriver { if ($HostDriversList) { Section -Style Heading3 'Drivers' { Invoke-Command -Session $TempPssSession { Import-Module DISM } - $HostDriverReport = @() + $OutObj = @() ForEach ($HostDriver in $HostDriversList) { try { - $TempDriver = [PSCustomObject] @{ + $inObj = [ordered] @{ 'Class Description' = $HostDriver.ClassDescription 'Provider Name' = $HostDriver.ProviderName 'Driver Version' = $HostDriver.Version 'Version Date' = $HostDriver.Date.ToShortDateString() } - $HostDriverReport += $TempDriver + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } @@ -53,7 +53,7 @@ function Get-AbrWinOSDriver { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $HostDriverReport | Sort-Object -Property 'Class Description' | Table @TableParams + $OutObj | Sort-Object -Property 'Class Description' | Table @TableParams } } } catch { diff --git a/Src/Private/Get-AbrWinOSHotfix.ps1 b/Src/Private/Get-AbrWinOSHotfix.ps1 index cbfd85e..ddb385d 100644 --- a/Src/Private/Get-AbrWinOSHotfix.ps1 +++ b/Src/Private/Get-AbrWinOSHotfix.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinOSHotfix { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.5 + Version: 0.5.6 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -30,10 +30,10 @@ function Get-AbrWinOSHotfix { $HotFixes = Invoke-Command -Session $TempPssSession -ScriptBlock { Get-HotFix } if ($HotFixes) { Section -Style Heading3 'Installed Hotfixes' { - $HotFixReport = @() + $OutObj = @() Foreach ($HotFix in $HotFixes) { try { - $TempHotFix = [PSCustomObject] @{ + $inObj = [ordered] @{ 'Hotfix ID' = $HotFix.HotFixID 'Description' = $HotFix.Description 'Installation Date' = Switch ([string]::IsNullOrEmpty($HotFix.InstalledOn)) { @@ -42,7 +42,7 @@ function Get-AbrWinOSHotfix { default { 'Unknown' } } } - $HotfixReport += $TempHotFix + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } @@ -55,7 +55,7 @@ function Get-AbrWinOSHotfix { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $HotFixReport | Sort-Object -Property 'Hotfix ID' | Table @TableParams + $OutObj | Sort-Object -Property 'Hotfix ID' | Table @TableParams } } } catch { @@ -72,7 +72,7 @@ function Get-AbrWinOSHotfix { 'KB Article' = "KB$($Update.KBArticleIDs)" 'Name' = $Update.Title } - $OutObj += [pscustomobject]$inobj + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) if ($HealthCheck.OperatingSystem.Updates) { $OutObj | Set-Style -Style Warning diff --git a/Src/Private/Get-AbrWinOSRoleFeature.ps1 b/Src/Private/Get-AbrWinOSRoleFeature.ps1 index 5fd65a9..f3987cc 100644 --- a/Src/Private/Get-AbrWinOSRoleFeature.ps1 +++ b/Src/Private/Get-AbrWinOSRoleFeature.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinOSRoleFeature { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.2 + Version: 0.5.6 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -30,16 +30,16 @@ function Get-AbrWinOSRoleFeature { $HostRolesAndFeatures = Invoke-Command -Session $TempPssSession -ScriptBlock { Get-WindowsFeature | Where-Object { $_.Installed -eq $True } } if ($HostRolesAndFeatures) { Section -Style Heading3 'Roles' { - [array]$HostRolesAndFeaturesReport = @() + $OutObj = @() ForEach ($HostRoleAndFeature in $HostRolesAndFeatures) { if ( $HostRoleAndFeature.FeatureType -eq 'Role') { try { - $TempHostRolesAndFeaturesReport = [PSCustomObject] @{ + $inObj = [ordered] @{ 'Name' = $HostRoleAndFeature.DisplayName 'Type' = $HostRoleAndFeature.FeatureType 'Description' = $HostRoleAndFeature.Description } - $HostRolesAndFeaturesReport += $TempHostRolesAndFeaturesReport + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } @@ -53,21 +53,21 @@ function Get-AbrWinOSRoleFeature { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $HostRolesAndFeaturesReport | Sort-Object -Property 'Name' | Table @TableParams + $OutObj | Sort-Object -Property 'Name' | Table @TableParams if ($InfoLevel.OperatingSystem -ge 2) { try { if ($HostRolesAndFeatures) { Section -Style Heading3 'Features and Role Services' { - [array]$HostRolesAndFeaturesReport = @() + $OutObj = @() ForEach ($HostRoleAndFeature in $HostRolesAndFeatures) { if ( $HostRoleAndFeature.FeatureType -eq 'Role Service' -or $HostRoleAndFeature.FeatureType -eq 'Feature') { try { - $TempHostRolesAndFeaturesReport = [PSCustomObject] @{ + $inObj = [ordered] @{ 'Name' = $HostRoleAndFeature.DisplayName 'Type' = $HostRoleAndFeature.FeatureType 'Description' = $HostRoleAndFeature.Description } - $HostRolesAndFeaturesReport += $TempHostRolesAndFeaturesReport + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } @@ -81,7 +81,7 @@ function Get-AbrWinOSRoleFeature { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $HostRolesAndFeaturesReport | Sort-Object -Property 'Name' | Table @TableParams + $OutObj | Sort-Object -Property 'Name' | Table @TableParams } } } catch { diff --git a/Src/Private/Get-AbrWinOSService.ps1 b/Src/Private/Get-AbrWinOSService.ps1 index 8a70653..72f44f5 100644 --- a/Src/Private/Get-AbrWinOSService.ps1 +++ b/Src/Private/Get-AbrWinOSService.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinOSService { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.2 + Version: 0.5.6 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -33,17 +33,17 @@ function Get-AbrWinOSService { Paragraph 'The following table details status of important services' BlankLine $Services = @('DNS', 'DFS Replication', 'Intersite Messaging', 'Kerberos Key Distribution Center', 'Active Directory Domain Services', 'W32Time', 'ADWS', 'DHCPServer', 'Dnscache', 'gpsvc', 'HvHost', 'vmcompute', 'vmms', 'iphlpsvc', 'MSiSCSI', 'Netlogon', 'RasMan', 'SessionEnv', 'TermService', 'RpcSs', 'RpcEptMapper', 'SamSs', 'LanmanServer', 'Schedule', 'lmhosts', 'UsoSvc', 'mpssvc', 'W3SVC', 'MSSQLSERVER', 'ClusSvc') - $ServicesReport = @() + $OutObj = @() Foreach ($Service in $Services) { try { $Status = Invoke-Command -Session $TempPssSession -ScriptBlock { Get-Service $using:Service -ErrorAction SilentlyContinue | Select-Object DisplayName, Name, Status } if ($Status) { - $TempServicesReport = [PSCustomObject] @{ + $inObj = [ordered] @{ 'Display Name' = $Status.DisplayName 'Short Name' = $Status.Name 'Status' = $Status.Status } - $ServicesReport += $TempServicesReport + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } } catch { Write-PScriboMessage -IsWarning $_.Exception.Message @@ -51,7 +51,7 @@ function Get-AbrWinOSService { } if ($HealthCheck.OperatingSystem.Services) { - $ServicesReport | Where-Object { $_.'Status' -notlike 'Running' } | Set-Style -Style Warning -Property 'Status' + $OutObj | Where-Object { $_.'Status' -notlike 'Running' } | Set-Style -Style Warning -Property 'Status' } $TableParams = @{ @@ -62,7 +62,7 @@ function Get-AbrWinOSService { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $ServicesReport | Sort-Object -Property 'Display Name' | Table @TableParams + $OutObj | Sort-Object -Property 'Display Name' | Table @TableParams } } } catch { diff --git a/Src/Private/Get-AbrWinSMBNetworkInterface.ps1 b/Src/Private/Get-AbrWinSMBNetworkInterface.ps1 index f31fd58..f8db48b 100644 --- a/Src/Private/Get-AbrWinSMBNetworkInterface.ps1 +++ b/Src/Private/Get-AbrWinSMBNetworkInterface.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinSMBNetworkInterface { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.2 + Version: 0.5.6 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -31,19 +31,19 @@ function Get-AbrWinSMBNetworkInterface { Section -Style Heading3 "SMB Network Interface" { Paragraph "The following table provide a summary of the SMB protocol network interface information" BlankLine - $SMBNICReport = @() + $OutObj = @() foreach ($SMBNIC in $SMBNICs) { try { - $TempSMBNicReport = [PSCustomObject]@{ + $inObj = [ordered] @{ 'Name' = Switch (($SMBNIC.InterfaceIndex).count) { 0 { "Unknown" } default { Invoke-Command -Session $TempPssSession { (Get-NetAdapter -InterfaceIndex ($using:SMBNIC).InterfaceIndex).Name } } } - 'RSS Capable' = ConvertTo-TextYN $SMBNIC.RssCapable - 'RDMA Capable' = ConvertTo-TextYN $SMBNIC.RdmaCapable - 'IP Address' = ConvertTo-TextYN $SMBNIC.IpAddress + 'RSS Capable' = $SMBNIC.RssCapable + 'RDMA Capable' = $SMBNIC.RdmaCapable + 'IP Address' = $SMBNIC.IpAddress } - $SMBNICReport += $TempSMBNicReport + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } @@ -57,7 +57,7 @@ function Get-AbrWinSMBNetworkInterface { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $SMBNICReport | Table @TableParams + $OutObj | Table @TableParams } } } catch { diff --git a/Src/Private/Get-AbrWinSMBShare.ps1 b/Src/Private/Get-AbrWinSMBShare.ps1 index e634f83..d880cb8 100644 --- a/Src/Private/Get-AbrWinSMBShare.ps1 +++ b/Src/Private/Get-AbrWinSMBShare.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinSMBShare { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.2 + Version: 0.5.6 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -30,24 +30,24 @@ function Get-AbrWinSMBShare { Section -Style Heading3 'File Shares' { Paragraph 'The following section details network shares' BlankLine - $SMBSharesReport = @() + $OutObj = @() foreach ($SMBShare in $SMBShares) { Section -Style Heading4 "$($SMBShare.Name) Share" { Paragraph "The following table details shares configuration" BlankLine try { $ShareAccess = Invoke-Command -Session $TempPssSession { Get-SmbShareAccess -Name ($using:SMBShare).Name } - $TempSMBSharesReport = [PSCustomObject]@{ + $inObj = [ordered] @{ 'Name' = $SMBShare.Name 'Scope Name' = $SMBShare.ScopeName 'Path' = $SMBShare.Path 'Description' = $SMBShare.Description 'Access Based Enumeration Mode' = $SMBShare.FolderEnumerationMode 'Caching Mode' = $SMBShare.CachingMode - 'Encrypt Data' = ConvertTo-TextYN $SMBShare.EncryptData + 'Encrypt Data' = $SMBShare.EncryptData 'State' = $SMBShare.ShareState } - $SMBSharesReport = $TempSMBSharesReport + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) $TableParams = @{ Name = "File Server Shares - $($SMBShare.Name)" List = $true @@ -56,7 +56,7 @@ function Get-AbrWinSMBShare { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $SMBSharesReport | Table @TableParams + $OutObj | Table @TableParams } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } @@ -66,16 +66,16 @@ function Get-AbrWinSMBShare { Section -Style Heading5 'Permissions' { Paragraph "The following table details $($SMBShare.Name) shares permissions" BlankLine - $ShareAccessReport = @() + $OutObj = @() foreach ($SMBACL in $ShareAccess) { try { - $TempSMBAccessReport = [PSCustomObject]@{ + $inObj = [ordered] @{ 'Scope Name' = $SMBACL.ScopeName 'Account Name' = $SMBACL.AccountName 'Access Control Type' = $SMBACL.AccessControlType 'Access Right' = $SMBACL.AccessRight } - $ShareAccessReport += $TempSMBAccessReport + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning $_.Exception.Message @@ -90,7 +90,7 @@ function Get-AbrWinSMBShare { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $ShareAccessReport | Table @TableParams + $OutObj | Table @TableParams } } } catch { diff --git a/Src/Private/Get-AbrWinSMBSummary.ps1 b/Src/Private/Get-AbrWinSMBSummary.ps1 index 9611161..66dfaba 100644 --- a/Src/Private/Get-AbrWinSMBSummary.ps1 +++ b/Src/Private/Get-AbrWinSMBSummary.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinSMBSummary { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.2 + Version: 0.5.6 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -28,18 +28,21 @@ function Get-AbrWinSMBSummary { try { $SMBSummary = Get-SmbServerConfiguration -CimSession $TempCimSession | Select-Object AutoShareServer, EnableLeasing, EnableMultiChannel, EnableOplocks, KeepAliveTime, EnableSMB1Protocol, EnableSMB2Protocol if ($SMBSummary) { - $SMBSummaryReport = [PSCustomObject]@{ - 'Auto Share Server' = ConvertTo-TextYN $SMBSummary.AutoShareServer - 'Enable Leasing' = ConvertTo-TextYN $SMBSummary.EnableLeasing - 'Enable MultiChannel' = ConvertTo-TextYN $SMBSummary.EnableMultiChannel - 'Enable Oplocks' = ConvertTo-TextYN $SMBSummary.EnableOplocks + $OutObj = @() + $inObj = [ordered] @{ + 'Auto Share Server' = $SMBSummary.AutoShareServer + 'Enable Leasing' = $SMBSummary.EnableLeasing + 'Enable MultiChannel' = $SMBSummary.EnableMultiChannel + 'Enable Oplocks' = $SMBSummary.EnableOplocks 'Keep Alive Time' = $SMBSummary.KeepAliveTime - 'SMB1 Protocol' = ConvertTo-TextYN $SMBSummary.EnableSMB1Protocol - 'SMB2 Protocol' = ConvertTo-TextYN $SMBSummary.EnableSMB2Protocol + 'SMB1 Protocol' = $SMBSummary.EnableSMB1Protocol + 'SMB2 Protocol' = $SMBSummary.EnableSMB2Protocol } + $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) + if ($HealthCheck.SMB.BP) { - $SMBSummaryReport | Where-Object { $_.'SMB1 Protocol' -eq 'Yes' } | Set-Style -Style Warning -Property 'SMB1 Protocol' + $OutObj | Where-Object { $_.'SMB1 Protocol' -eq 'Yes' } | Set-Style -Style Warning -Property 'SMB1 Protocol' } $TableParams = @{ @@ -50,7 +53,7 @@ function Get-AbrWinSMBSummary { if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } - $SMBSummaryReport | Table @TableParams + $OutObj | Table @TableParams } } catch { Write-PScriboMessage -IsWarning $_.Exception.Message diff --git a/Src/Private/Get-AbrWinSQLBackupDevice.ps1 b/Src/Private/Get-AbrWinSQLBackupDevice.ps1 index 2d7472b..adba32a 100644 --- a/Src/Private/Get-AbrWinSQLBackupDevice.ps1 +++ b/Src/Private/Get-AbrWinSQLBackupDevice.ps1 @@ -36,9 +36,9 @@ function Get-AbrWinSQLBackupDevice { 'Name' = $Item.Name 'Backup Device Type' = $Item.BackupDeviceType 'Physical Location' = $Item.PhysicalLocation - 'Skip Tape Label' = ConvertTo-TextYN $Item.SkipTapeLabel + 'Skip Tape Label' = $Item.SkipTapeLabel } - $ItemInfo += [PSCustomObject]$InObj + $ItemInfo += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning "SQL Server System Backup Device Section: $($_.Exception.Message)" } diff --git a/Src/Private/Get-AbrWinSQLBuild.ps1 b/Src/Private/Get-AbrWinSQLBuild.ps1 index c5d066d..c3c2db8 100644 --- a/Src/Private/Get-AbrWinSQLBuild.ps1 +++ b/Src/Private/Get-AbrWinSQLBuild.ps1 @@ -42,13 +42,13 @@ function Get-AbrWinSQLBuild { 'Level' = "Microsoft SQL Server $($Build.NameLevel)" 'Build' = $Properties.VersionString 'Service Pack' = $Properties.ProductLevel - 'Comulative Update' = ConvertTo-EmptyToFiller $Build.CULevel + 'Comulative Update' = $Build.CULevel 'KB Level' = $Build.KBLevel - 'Case Sensitive' = ConvertTo-TextYN $Properties.IsCaseSensitive - 'Full Text Installed' = ConvertTo-TextYN $Properties.IsFullTextInstalled - 'XTP Supported' = ConvertTo-TextYN $Properties.IsXTPSupported - 'Clustered' = ConvertTo-TextYN $Properties.IsClustered - 'Single User' = ConvertTo-TextYN $Properties.IsSingleUser + 'Case Sensitive' = $Properties.IsCaseSensitive + 'Full Text Installed' = $Properties.IsFullTextInstalled + 'XTP Supported' = $Properties.IsXTPSupported + 'Clustered' = $Properties.IsClustered + 'Single User' = $Properties.IsSingleUser 'Language' = $Properties.Language 'Collation' = $Properties.Collation 'Sql CharSet Name' = $Properties.SqlCharSetName @@ -59,8 +59,8 @@ function Get-AbrWinSQLBuild { 'Default File' = $Properties.DefaultFile 'Default Log' = $Properties.DefaultLog 'Login Mode' = $Properties.LoginMode - 'Mail Profile' = ConvertTo-EmptyToFiller $Properties.MailProfile - 'Warning' = ConvertTo-EmptyToFiller $Build.Warning + 'Mail Profile' = $Properties.MailProfile + 'Warning' = $Build.Warning } $SQLServerObjt += $TempSQLServerObjt diff --git a/Src/Private/Get-AbrWinSQLDatabase.ps1 b/Src/Private/Get-AbrWinSQLDatabase.ps1 index 9f9c2c7..070b966 100644 --- a/Src/Private/Get-AbrWinSQLDatabase.ps1 +++ b/Src/Private/Get-AbrWinSQLDatabase.ps1 @@ -51,7 +51,7 @@ function Get-AbrWinSQLDatabase { $InObj = [Ordered]@{ 'Name' = $SQLDB.Name 'Status' = $SQLDB.Status - 'Is Accessible?' = ConvertTo-TextYN $SQLDB.IsAccessible + 'Is Accessible?' = $SQLDB.IsAccessible 'Recovery Model' = $SQLDB.RecoveryModel 'Size' = Switch ([string]::IsNullOrEmpty($SQLDB.SizeMB)) { $true { '--' } @@ -60,7 +60,7 @@ function Get-AbrWinSQLDatabase { } 'Compatibility' = $CompatibilityHash[[string]$SQLDB.Compatibility] 'Collation' = $SQLDB.Collation - 'Encrypted' = ConvertTo-TextYN $SQLDB.Encrypted + 'Encrypted' = $SQLDB.Encrypted 'Last Full Backup' = Switch ($SQLDB.LastFullBackup) { '01/01/0001 00:00:00' { "Never" } $null { '--' } @@ -73,7 +73,7 @@ function Get-AbrWinSQLDatabase { } 'Owner' = $SQLDB.Owner } - $SQLDBInfo += [PSCustomObject]$InObj + $SQLDBInfo += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning "SQL Server System Database table: $($_.Exception.Message)" } @@ -124,7 +124,7 @@ function Get-AbrWinSQLDatabase { $InObj = [Ordered]@{ 'Name' = $SQLDB.Name 'Status' = $SQLDB.Status - 'Is Accessible?' = ConvertTo-TextYN $SQLDB.IsAccessible + 'Is Accessible?' = $SQLDB.IsAccessible 'Recovery Model' = $SQLDB.RecoveryModel 'Size' = Switch ([string]::IsNullOrEmpty($SQLDB.SizeMB)) { $true { '--' } @@ -133,7 +133,7 @@ function Get-AbrWinSQLDatabase { } 'Compatibility' = $CompatibilityHash[[string]$SQLDB.Compatibility] 'Collation' = $SQLDB.Collation - 'Encrypted' = ConvertTo-TextYN $SQLDB.Encrypted + 'Encrypted' = $SQLDB.Encrypted 'Last Full Backup' = Switch ($SQLDB.LastFullBackup) { '01/01/0001 00:00:00' { "Never" } $null { '--' } @@ -146,7 +146,7 @@ function Get-AbrWinSQLDatabase { } 'Owner' = $SQLDB.Owner } - $SQLDBInfo += [PSCustomObject]$InObj + $SQLDBInfo += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning "SQL Server User Database table: $($_.Exception.Message)" } diff --git a/Src/Private/Get-AbrWinSQLLogin.ps1 b/Src/Private/Get-AbrWinSQLLogin.ps1 index 6f17237..c97f97a 100644 --- a/Src/Private/Get-AbrWinSQLLogin.ps1 +++ b/Src/Private/Get-AbrWinSQLLogin.ps1 @@ -47,22 +47,22 @@ function Get-AbrWinSQLLogin { $false { $Item.LastLogin } default { 'Unknown' } } - 'Has Access?' = ConvertTo-TextYN $Item.HasAccess + 'Has Access?' = $Item.HasAccess 'Is Locked?' = Switch ([string]::IsNullOrEmpty($Item.IsLocked)) { $true { 'No' } - $false { ConvertTo-TextYN $Item.IsLocked } + $false { $Item.IsLocked } default { 'Unknown' } } - 'Is Disabled?' = ConvertTo-TextYN $Item.IsDisabled + 'Is Disabled?' = $Item.IsDisabled 'Must Change Password' = Switch ([string]::IsNullOrEmpty($Item.MustChangePassword)) { $true { 'No' } - $false { ConvertTo-TextYN $Item.MustChangePassword } + $false { $Item.MustChangePassword } default { 'Unknown' } } } - $ItemInfo += [PSCustomObject]$InObj + $ItemInfo += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning "SQL Server System Login Section: $($_.Exception.Message)" } diff --git a/Src/Private/Get-AbrWinSQLRole.ps1 b/Src/Private/Get-AbrWinSQLRole.ps1 index e01b6bd..87581d9 100644 --- a/Src/Private/Get-AbrWinSQLRole.ps1 +++ b/Src/Private/Get-AbrWinSQLRole.ps1 @@ -40,10 +40,10 @@ function Get-AbrWinSQLRole { $false { $Item.Login } default { 'Unknown' } } - 'Fixed Role' = ConvertTo-TextYN $Item.IsFixedRole + 'Fixed Role' = $Item.IsFixedRole 'Create Date' = $Item.DateCreated } - $ItemInfo += [PSCustomObject]$InObj + $ItemInfo += [pscustomobject](ConvertTo-HashToYN $inObj) } catch { Write-PScriboMessage -IsWarning "SQL Server System Roles Section: $($_.Exception.Message)" } diff --git a/Src/Private/SharedUtilsFunctions.ps1 b/Src/Private/SharedUtilsFunctions.ps1 index ee98ab1..12d21e8 100644 --- a/Src/Private/SharedUtilsFunctions.ps1 +++ b/Src/Private/SharedUtilsFunctions.ps1 @@ -5,7 +5,7 @@ function ConvertTo-TextYN { .DESCRIPTION .NOTES - Version: 0.4.0 + Version: 0.3.0 Author: LEE DAILEY .EXAMPLE @@ -15,18 +15,17 @@ function ConvertTo-TextYN { #> [CmdletBinding()] [OutputType([String])] - Param - ( + Param ( [Parameter ( Position = 0, Mandatory)] [AllowEmptyString()] - [string] - $TEXT + [string] $TEXT ) switch ($TEXT) { "" { "--"; break } + " " { "--"; break } $Null { "--"; break } "True" { "Yes"; break } "False" { "No"; break } @@ -37,17 +36,13 @@ function ConvertTo-TextYN { function ConvertTo-FileSizeString { <# .SYNOPSIS - Used by As Built Report to convert bytes automatically to GB or TB based on size. + Used by As Built Report to convert bytes automatically to GB or TB based on size. .DESCRIPTION - .NOTES - Version: 0.4.0 - Author: LEE DAILEY - + Version: 0.1.0 + Author: Jonathan Colon .EXAMPLE - .LINK - #> [CmdletBinding()] [OutputType([String])] @@ -60,23 +55,15 @@ function ConvertTo-FileSizeString { $Size ) - switch ($Size) { - { $_ -gt 1TB } - { [string]::Format("{0:0.00} TB", $Size / 1TB); break } - { $_ -gt 1GB } - { [string]::Format("{0:0.00} GB", $Size / 1GB); break } - { $_ -gt 1MB } - { [string]::Format("{0:0.00} MB", $Size / 1MB); break } - { $_ -gt 1KB } - { [string]::Format("{0:0.00} KB", $Size / 1KB); break } - { $_ -gt 0 } - { [string]::Format("{0} B", $Size); break } - { $_ -eq 0 } - { "0 KB"; break } - default - { "0 KB" } + $Unit = Switch ($Size) { + { $Size -gt 1PB } { 'PB' ; Break } + { $Size -gt 1TB } { 'TB' ; Break } + { $Size -gt 1GB } { 'GB' ; Break } + { $Size -gt 1Mb } { 'MB' ; Break } + Default { 'KB' } } -} # end >> function Format-FileSize + return "$([math]::Round(($Size / $("1" + $Unit)), 0)) $Unit" +} # end function ConvertTo-EmptyToFiller { <# @@ -311,7 +298,7 @@ Function Get-LocalGroupMembership { $Script:ObjNT = $ObjNT $Script:Translate = $Translate $Script:NetBIOSDomain = $NetBIOSDomain - Function Get-LocalGroupMember { + Function Get-LocalGroupMemberObj { [cmdletbinding()] Param ( [parameter()] @@ -366,7 +353,7 @@ Function Get-LocalGroupMembership { $host.ui.WriteVerboseLine(("{0}: Getting local group members" -f $Name)) $Groups[$Name] += , 'Local' # Enumerate members of local group. - Get-LocalGroupMember $Member + Get-LocalGroupMemberObj $Member } } Else { If ($Groups[$Name] -notcontains 'Domain') { @@ -448,7 +435,7 @@ Function Get-LocalGroupMembership { $ADSIGroup = [ADSI]"WinNT://$Computer/$Group,group" Write-Verbose ("Checking {0} membership for {1}" -f $Group, $Computer) $Groups[$Group] += , 'Local' - Get-LocalGroupMember -LocalGroup $ADSIGroup + Get-LocalGroupMemberObj -LocalGroup $ADSIGroup # endregion Get Local Group Members } # endregion ScriptBlock @@ -517,3 +504,39 @@ Function Get-LocalGroupMembership { # endregion Cleanup Runspace } } + +function ConvertTo-HashToYN { + <# + .SYNOPSIS + Used by As Built Report to convert array content true or false automatically to Yes or No. + .DESCRIPTION + + .NOTES + Version: 0.1.0 + Author: Jonathan Colon + + .EXAMPLE + + .LINK + + #> + [CmdletBinding()] + [OutputType([Hashtable])] + Param ( + [Parameter (Position = 0, Mandatory)] + [AllowEmptyString()] + [Hashtable] $TEXT + ) + + $result = [ordered] @{} + foreach ($i in $inObj.GetEnumerator()) { + try { + $result.add($i.Key, (ConvertTo-TextYN $i.Value)) + } catch { + $result.add($i.Key, ($i.Value)) + } + } + if ($result) { + return $result + } else { return $TEXT } +} # end \ No newline at end of file diff --git a/Src/Public/Invoke-AsBuiltReport.Microsoft.Windows.ps1 b/Src/Public/Invoke-AsBuiltReport.Microsoft.Windows.ps1 index d49030e..ab1bb34 100644 --- a/Src/Public/Invoke-AsBuiltReport.Microsoft.Windows.ps1 +++ b/Src/Public/Invoke-AsBuiltReport.Microsoft.Windows.ps1 @@ -5,7 +5,7 @@ function Invoke-AsBuiltReport.Microsoft.Windows { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.5 + Version: 0.5.6 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -143,7 +143,7 @@ function Invoke-AsBuiltReport.Microsoft.Windows { Get-AbrWinLocalGroup #Local Administrators Get-AbrWinLocalAdmin - ScriptContent } + } } } catch { Write-PScriboMessage -IsWarning $_.Exception.Message