diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 76cb579..030bad6 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -91,7 +91,7 @@ body: required: true - label: >- I have read [the documentation](https://www.asbuiltreport.com/user-guide/new-asbuiltconfig), - and referred to the [known issues](https://www.asbuiltreport.com/user-guide/known-issues/) before submitting this bug report. + and referred to the [known issues](https://www.asbuiltreport.com/support/known-issues/) before submitting this bug report. required: true - label: >- I have checked for previously opened & closed [issues](https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows/issues) before submitting this bug report. diff --git a/.github/workflows/PSScriptAnalyzer.yml b/.github/workflows/PSScriptAnalyzer.yml index fe69d8f..57b2ea4 100644 --- a/.github/workflows/PSScriptAnalyzer.yml +++ b/.github/workflows/PSScriptAnalyzer.yml @@ -5,7 +5,7 @@ jobs: name: Run PSScriptAnalyzer runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: lint uses: devblackops/github-action-psscriptanalyzer@master with: diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 3dac772..fa7a814 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -8,7 +8,7 @@ jobs: publish-to-gallery: runs-on: windows-2019 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set PSRepository to Trusted for PowerShell Gallery shell: pwsh run: | diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..25480fd --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,49 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# +# https://github.com/microsoft/action-psscriptanalyzer +# For more information on PSScriptAnalyzer in general, see +# https://github.com/PowerShell/PSScriptAnalyzer + +name: CodeQL + +on: + push: + branches: [ "dev" ] + pull_request: + branches: [ "dev" ] + schedule: + - cron: '20 14 * * 1' + +permissions: + contents: read + +jobs: + build: + permissions: + contents: read # for actions/checkout to fetch code + security-events: write # for github/codeql-action/upload-sarif to upload SARIF results + actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status + name: PSScriptAnalyzer + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Run PSScriptAnalyzer + uses: microsoft/psscriptanalyzer-action@v1.1 + with: + # Check https://github.com/microsoft/action-psscriptanalyzer for more info about the options. + # The below set up runs PSScriptAnalyzer to your entire repository and runs some basic security rules. + path: .\ + recurse: true + # Include your own basic security rules. Removing this option will run all the rules + excludeRule: '"PSAvoidUsingPlainTextForPassword", "PSAvoidUsingUsernameAndPasswordParams", "PSAvoidUsingConvertToSecureStringWithPlainText"' + output: results.sarif + + # Upload the SARIF file generated in the previous step + - name: Upload SARIF results file + uses: github/codeql-action/upload-sarif@v3 + with: + sarif_file: results.sarif diff --git a/.vscode/settings.json b/.vscode/settings.json index c133455..0d298f1 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,19 +1,19 @@ { "powershell.codeFormatting.preset": "Custom", - "powershell.codeFormatting.useCorrectCasing": true, - "powershell.codeFormatting.autoCorrectAliases": true, + "powershell.codeFormatting.useCorrectCasing": true, + "powershell.codeFormatting.autoCorrectAliases": true, "powershell.codeFormatting.whitespaceBeforeOpenBrace": true, "powershell.codeFormatting.whitespaceBeforeOpenParen": true, "powershell.codeFormatting.whitespaceAroundOperator": true, "powershell.codeFormatting.whitespaceAfterSeparator": true, - "powershell.codeFormatting.addWhitespaceAroundPipe": true, + "powershell.codeFormatting.addWhitespaceAroundPipe": true, "powershell.codeFormatting.ignoreOneLineBlock": true, "powershell.codeFormatting.newLineAfterCloseBrace": false, "powershell.codeFormatting.newLineAfterOpenBrace": true, "powershell.codeFormatting.openBraceOnSameLine": true, - "powershell.codeFormatting.alignPropertyValuePairs": false, + "powershell.codeFormatting.alignPropertyValuePairs": false, "powershell.codeFolding.enable": true, - "powershell.scriptAnalysis.enable": true, + "powershell.scriptAnalysis.enable": true, "powershell.scriptAnalysis.settingsPath": ".github/workflows/PSScriptAnalyzerSettings.psd1", "editor.tabSize": 4, "editor.insertSpaces": true, diff --git a/AsBuiltReport.Microsoft.Windows.json b/AsBuiltReport.Microsoft.Windows.json index f0a6b93..6cc7837 100644 --- a/AsBuiltReport.Microsoft.Windows.json +++ b/AsBuiltReport.Microsoft.Windows.json @@ -8,11 +8,9 @@ "ShowHeaderFooter": true, "ShowTableCaptions": true }, - "Options": { - - }, + "Options": {}, "InfoLevel": { - "_comment_": "Please refer to the AsBuiltReport project contributing guide for information about how to define InfoLevels.", + "_comment_": "Please refer to the AsBuiltReport project contributing guide for information about how to define InfoLevels.", "_comment_": "0 = Disabled, 1 = Enabled, 2 = Adv Summary, 3 = Detailed, 4 = Adv Detailed, 5 = Comprehensive", "Hardware": 1, "OperatingSystem": 1, @@ -24,9 +22,8 @@ "SMB": 1, "DHCP": 1, "DNS": 1, - "FailOverCluster": 1, + "FailOverCluster": 1 "SQLServer": 1 - }, "HealthCheck": { "Networking": { @@ -51,8 +48,14 @@ "Network": true, "ClusterSharedVolume": true }, + "Storage": { + "BP": true + }, + "SMB": { + "BP": true + }, "SQLServer": { "Firewall": true } } -} +} \ No newline at end of file diff --git a/AsBuiltReport.Microsoft.Windows.psd1 b/AsBuiltReport.Microsoft.Windows.psd1 index e092f14..6676149 100644 --- a/AsBuiltReport.Microsoft.Windows.psd1 +++ b/AsBuiltReport.Microsoft.Windows.psd1 @@ -8,50 +8,50 @@ @{ -# Script module or binary module file associated with this manifest. -RootModule = 'AsBuiltReport.Microsoft.Windows.psm1' + # Script module or binary module file associated with this manifest. + RootModule = 'AsBuiltReport.Microsoft.Windows.psm1' -# Version number of this module. -ModuleVersion = '0.5.1' + # Version number of this module. + ModuleVersion = '0.5.2' -# Supported PSEditions -# CompatiblePSEditions = @() + # Supported PSEditions + # CompatiblePSEditions = @() -# ID used to uniquely identify this module -GUID = '29c96c3d-bce4-4a9f-a429-5ba40a63d8ed' + # ID used to uniquely identify this module + GUID = '29c96c3d-bce4-4a9f-a429-5ba40a63d8ed' -# Author of this module -Author = 'Andrew Ramsay' + # Author of this module + Author = 'Andrew Ramsay' -# Company or vendor of this module -# CompanyName = 'Unknown' + # Company or vendor of this module + # CompanyName = 'Unknown' -# Copyright statement for this module -Copyright = '(c) 2023 Andrew Ramsay. All rights reserved.' + # Copyright statement for this module + Copyright = '(c) 2024 Andrew Ramsay. All rights reserved.' -# Description of the functionality provided by this module -Description = 'A PowerShell module to generate an as built report on the configuration of Microsoft Windows.' + # Description of the functionality provided by this module + Description = 'A PowerShell module to generate an as built report on the configuration of Microsoft Windows.' -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '5.1' + # Minimum version of the Windows PowerShell engine required by this module + PowerShellVersion = '5.1' -# Name of the Windows PowerShell host required by this module -# PowerShellHostName = '' + # Name of the Windows PowerShell host required by this module + # PowerShellHostName = '' -# Minimum version of the Windows PowerShell host required by this module -# PowerShellHostVersion = '' + # Minimum version of the Windows PowerShell host required by this module + # PowerShellHostVersion = '' -# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only. -# DotNetFrameworkVersion = '' + # Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only. + # DotNetFrameworkVersion = '' -# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only. -# CLRVersion = '' + # Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only. + # CLRVersion = '' -# Processor architecture (None, X86, Amd64) required by this module -# ProcessorArchitecture = '' + # Processor architecture (None, X86, Amd64) required by this module + # ProcessorArchitecture = '' -# Modules that must be imported into the global environment prior to importing this module -RequiredModules = @( + # Modules that must be imported into the global environment prior to importing this module + RequiredModules = @( @{ ModuleName = 'AsBuiltReport.Core'; ModuleVersion = '1.3.0' @@ -62,79 +62,79 @@ RequiredModules = @( } ) -# Assemblies that must be loaded prior to importing this module -# RequiredAssemblies = @() + # Assemblies that must be loaded prior to importing this module + # RequiredAssemblies = @() -# Script files (.ps1) that are run in the caller's environment prior to importing this module. -# ScriptsToProcess = @() + # Script files (.ps1) that are run in the caller's environment prior to importing this module. + # ScriptsToProcess = @() -# Type files (.ps1xml) to be loaded when importing this module -# TypesToProcess = @() + # Type files (.ps1xml) to be loaded when importing this module + # TypesToProcess = @() -# Format files (.ps1xml) to be loaded when importing this module -# FormatsToProcess = @() + # Format files (.ps1xml) to be loaded when importing this module + # FormatsToProcess = @() -# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess -# NestedModules = @() + # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess + # NestedModules = @() -# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. -FunctionsToExport = @('Invoke-AsBuiltReport.Microsoft.Windows') + # Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. + FunctionsToExport = @('Invoke-AsBuiltReport.Microsoft.Windows') -# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. -# CmdletsToExport = '*' + # Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. + # CmdletsToExport = '*' -# Variables to export from this module -# VariablesToExport = '*' + # Variables to export from this module + # VariablesToExport = '*' -# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. -# AliasesToExport = '*' + # Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. + # AliasesToExport = '*' -# DSC resources to export from this module -# DscResourcesToExport = @() + # DSC resources to export from this module + # DscResourcesToExport = @() -# List of all modules packaged with this module -# ModuleList = @() + # List of all modules packaged with this module + # ModuleList = @() -# List of all files packaged with this module -# FileList = @() + # List of all files packaged with this module + # FileList = @() -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ + # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. + PrivateData = @{ - PSData = @{ - # Tags applied to this module. These help with module discovery in online galleries. - Tags = 'AsBuiltReport', 'Report', 'Microsoft', 'Documentation', 'PScribo', 'PSEdition_Desktop', 'Windows' + PSData = @{ + # Tags applied to this module. These help with module discovery in online galleries. + Tags = 'AsBuiltReport', 'Report', 'Microsoft', 'Documentation', 'PScribo', 'PSEdition_Desktop', 'Windows' - # A URL to the license for this module. - LicenseUri = 'https://raw.githubusercontent.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows/master/LICENSE' + # A URL to the license for this module. + LicenseUri = 'https://raw.githubusercontent.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows/master/LICENSE' - # A URL to the main website for this project. - ProjectUri = 'https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows' + # A URL to the main website for this project. + ProjectUri = 'https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows' - # A URL to an icon representing this module. - IconUri = 'https://github.com/AsBuiltReport.png' + # A URL to an icon representing this module. + IconUri = 'https://github.com/AsBuiltReport.png' - # ReleaseNotes of this module - ReleaseNotes = 'https://raw.githubusercontent.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows/master/CHANGELOG.md' + # ReleaseNotes of this module + ReleaseNotes = 'https://raw.githubusercontent.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows/master/CHANGELOG.md' - # Prerelease string of this module - # Prerelease = '' + # Prerelease string of this module + # Prerelease = '' - # Flag to indicate whether the module requires explicit user acceptance for install/update/save - # RequireLicenseAcceptance = $false + # Flag to indicate whether the module requires explicit user acceptance for install/update/save + # RequireLicenseAcceptance = $false - # External dependent modules of this module - # ExternalModuleDependencies = @() + # External dependent modules of this module + # ExternalModuleDependencies = @() - } # End of PSData hashtable + } # End of PSData hashtable -} # End of PrivateData hashtable + } # End of PrivateData hashtable -# HelpInfo URI of this module -# HelpInfoURI = '' + # HelpInfo URI of this module + # HelpInfoURI = '' -# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. -# DefaultCommandPrefix = '' + # Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. + # DefaultCommandPrefix = '' } diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e7f415..c79c564 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,27 @@ # :arrows_counterclockwise: Microsoft Windows As Built Report Changelog -## [0.5.2] - 2023-09-?? +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.2] - 2024-02-18 ### Added -- Added Local Windows Group Members information @flynngw - +- Add Local Windows Group Members information @flynngw +- Add more HealthCheck conditions + +### Changed + +- Improve report readability + +### Fixed + +- Fix CodeQL security alerts +- Fix FailOver Cluster section +- Fix issue in Get-AbrWinOSHotfix install date logic + ## [0.5.1] - 2023-05-16 ### Added diff --git a/LICENSE b/LICENSE index 93592ec..9f885b7 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 AsBuiltReport +Copyright (c) 2024 AsBuiltReport Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index e34cce4..e053da5 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Microsoft Windows As Built Report is a PowerShell module which works in conjunction with [AsBuiltReport.Core](https://github.com/AsBuiltReport/AsBuiltReport.Core). -[AsBuiltReport](https://github.com/AsBuiltReport/AsBuiltReport) is an open-sourced community project which utilises PowerShell to produce as-built documentation in multiple document formats for multiple vendors and technologies. +[AsBuiltReport](https://github.com/AsBuiltReport/AsBuiltReport) is an open-sourced community project which utilizes PowerShell to produce as-built documentation in multiple document formats for multiple vendors and technologies. Please refer to the AsBuiltReport [website](https://www.asbuiltreport.com) for more detailed information about this project. @@ -57,9 +57,9 @@ The Microsoft Windows As Built Report supports the following Windows Server vers This report is compatible with the following PowerShell versions; -| Windows PowerShell 5.1 | PowerShell 7 | -|:----------------------:|:--------------------:| -| :white_check_mark: | :x: | +| Windows PowerShell 5.1 | PowerShell 7 | +| :--------------------: | :----------: | +| :white_check_mark: | :x: | ## :wrench: System Requirements @@ -153,7 +153,7 @@ _Note: You are not limited to installing the module to those example paths, you ## :pencil2: Configuration -The Microsoft Windows As Built Report utilises a JSON file to allow configuration of report information, options, detail and healthchecks. +The Microsoft Windows As Built Report utilizes a JSON file to allow configuration of report information, options, detail and healthchecks. A Microsoft Windows report configuration file can be generated by executing the following command; @@ -171,15 +171,15 @@ The following provides information of how to configure each schema within the re The **Report** schema provides configuration of the Microsoft Windows report information. -| Sub-Schema | Setting | Default | Description | -|---------------------|--------------|--------------------------------|--------------------------------------------------------------| +| Sub-Schema | Setting | Default | Description | +| ------------------- | ------------ | --------------------------------- | ------------------------------------------------------------ | | Name | User defined | Microsoft Windows As Built Report | The name of the As Built Report | -| Version | User defined | 1.0 | The report version | -| Status | User defined | Released | The report release status | -| ShowCoverPageImage | true / false | true | Toggle to enable/disable the display of the cover page image | -| ShowTableOfContents | true / false | true | Toggle to enable/disable table of contents | -| ShowHeaderFooter | true / false | true | Toggle to enable/disable document headers & footers | -| ShowTableCaptions | true / false | true | Toggle to enable/disable table captions/numbering | +| Version | User defined | 1.0 | The report version | +| Status | User defined | Released | The report release status | +| ShowCoverPageImage | true / false | true | Toggle to enable/disable the display of the cover page image | +| ShowTableOfContents | true / false | true | Toggle to enable/disable table of contents | +| ShowHeaderFooter | true / false | true | Toggle to enable/disable document headers & footers | +| ShowTableCaptions | true / false | true | Toggle to enable/disable table captions/numbering | ### Options @@ -191,25 +191,25 @@ The **InfoLevel** schema allows configuration of each section of the report at a There are 3 levels (0-2) of detail granularity for each section as follows; -| Setting | InfoLevel | Description | -|:-------:|-------------------|--------------------------------------------------------------------------------------------------------------------------------------------| -| 0 | Disabled | Does not collect or display any information | -| 1 | Enabled | Provides summarised information for a collection of objects | -| 2 | Adv Summary | Provides condensed, detailed information for a collection of objects | +| Setting | InfoLevel | Description | +| :-----: | ----------- | -------------------------------------------------------------------- | +| 0 | Disabled | Does not collect or display any information | +| 1 | Enabled | Provides summarized information for a collection of objects | +| 2 | Adv Summary | Provides condensed, detailed information for a collection of objects | The table below outlines the default and maximum **InfoLevel** settings for each section. -| Sub-Schema | Default Setting | Maximum Setting | -|--------------|:---------------:|:---------------:| -| Hardware | 1 | 1 | -| OperatingSystem | 1 | 2 | -| Storage | 1 | 1 | -| Networking | 1 | 1 | -| IIS | 1 | 1 | -| HyperV | 1 | 1 | -| DHCP | 1 | 2 | -| DNS | 1 | 2 | -| FailOverCluster | 1 | 2 | +| Sub-Schema | Default Setting | Maximum Setting | +| --------------- | :-------------: | :-------------: | +| Hardware | 1 | 1 | +| OperatingSystem | 1 | 2 | +| Storage | 1 | 1 | +| Networking | 1 | 1 | +| IIS | 1 | 1 | +| HyperV | 1 | 1 | +| DHCP | 1 | 2 | +| DNS | 1 | 2 | +| FailOverCluster | 1 | 2 | ### Healthcheck diff --git a/Src/Private/Get-AbrWinApplication.ps1 b/Src/Private/Get-AbrWinApplication.ps1 index aff7276..9f57723 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.2.0 + Version: 0.5.2 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -21,7 +21,7 @@ function Get-AbrWinApplication { begin { Write-PScriboMessage "Operating System InfoLevel set at $($InfoLevel.OperatingSystem)." - Write-PscriboMessage "Collecting Application Inventory information." + Write-PScriboMessage "Collecting Application Inventory information." } process { @@ -33,23 +33,26 @@ function Get-AbrWinApplication { if ($AddRemove) { Section -Style Heading3 'Installed Applications' { Paragraph 'The following settings details applications listed in Add/Remove Programs' - Blankline + BlankLine [array]$AddRemoveReport = @() ForEach ($App in $AddRemove) { - try { + try { $TempAddRemoveReport = [PSCustomObject]@{ 'Application Name' = $App.DisplayName 'Publisher' = $App.Publisher - 'Version' = $App.Version + 'Version' = Switch ([string]::IsNullOrEmpty($App.Version)) { + $true { "--" } + $false { $App.Version } + default { "Unknown" } + } 'Install Date' = Switch (($App.InstallDate).count) { - 0 {"-"} - default {$App.InstallDate} + 0 { "--" } + default { $App.InstallDate } } } $AddRemoveReport += $TempAddRemoveReport - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } $TableParams = @{ @@ -63,9 +66,8 @@ function Get-AbrWinApplication { $AddRemoveReport | Where-Object { $_.'Application Name' -notlike $null } | Sort-Object -Property 'Application Name' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } diff --git a/Src/Private/Get-AbrWinDHCPInfrastructure.ps1 b/Src/Private/Get-AbrWinDHCPInfrastructure.ps1 index f42715f..24f0d0e 100644 --- a/Src/Private/Get-AbrWinDHCPInfrastructure.ps1 +++ b/Src/Private/Get-AbrWinDHCPInfrastructure.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinDHCPInfrastructure { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.3.0 + Version: 0.5.2 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,7 +21,7 @@ function Get-AbrWinDHCPInfrastructure { begin { Write-PScriboMessage "DHCP InfoLevel set at $($InfoLevel.DHCP)." - Write-PscriboMessage "Collecting Host DHCP Server information." + Write-PScriboMessage "Collecting Host DHCP Server information." } process { @@ -38,31 +38,30 @@ function Get-AbrWinDHCPInfrastructure { 'Conflict Detection Attempts' = $Settings.ConflictDetectionAttempts 'Activate Policies' = ConvertTo-TextYN $Settings.ActivatePolicies 'Dynamic Bootp' = ConvertTo-TextYN $Settings.DynamicBootp - 'Database Path' = ConvertTo-EmptyToFiller $Database.FileName + 'Database Path' = ConvertTo-EmptyToFiller $Database.FileName 'Database Backup Path' = ConvertTo-EmptyToFiller $Database.BackupPath 'Database Backup Interval' = switch ($Database.BackupInterval) { - "" {"-"; break} - $NULL {"-"; break} - default {"$($Database.BackupInterval) min"} + "" { "--"; break } + $NULL { "--"; break } + default { "$($Database.BackupInterval) min" } } - 'Database Logging Enabled' = Switch ($Database.LoggingEnabled) { - "" {"-"; break} - $Null {"-"; break} - default {ConvertTo-TextYN $Database.LoggingEnabled} + 'Database Logging Enabled' = Switch ($Database.LoggingEnabled) { + "" { "--"; break } + $Null { "--"; break } + default { ConvertTo-TextYN $Database.LoggingEnabled } } - 'User Name' = ConvertTo-EmptyToFiller $DNSCredential.UserName + 'User Name' = ConvertTo-EmptyToFiller $DNSCredential.UserName 'Domain Name' = ConvertTo-EmptyToFiller $DNSCredential.DomainName } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } if ($HealthCheck.DHCP.BP) { - $OutObj | Where-Object { $_.'Conflict Detection Attempts' -eq 0} | Set-Style -Style Warning -Property 'Conflict Detection Attempts' - $OutObj | Where-Object { $_.'Authorized' -like 'No'} | Set-Style -Style Warning -Property 'Authorized' - $OutObj | Where-Object { $_.'User Name' -like "-"} | Set-Style -Style Warning -Property 'User Name','Domain Name' + $OutObj | Where-Object { $_.'Conflict Detection Attempts' -eq 0 } | Set-Style -Style Warning -Property 'Conflict Detection Attempts' + $OutObj | Where-Object { $_.'Authorized' -like 'No' } | Set-Style -Style Warning -Property 'Authorized' + $OutObj | Where-Object { $_.'User Name' -like "--" } | Set-Style -Style Warning -Property 'User Name', 'Domain Name' } @@ -76,9 +75,8 @@ function Get-AbrWinDHCPInfrastructure { } $OutObj | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } diff --git a/Src/Private/Get-AbrWinDHCPv4PerScopeSetting.ps1 b/Src/Private/Get-AbrWinDHCPv4PerScopeSetting.ps1 index 7265d58..0a64279 100644 --- a/Src/Private/Get-AbrWinDHCPv4PerScopeSetting.ps1 +++ b/Src/Private/Get-AbrWinDHCPv4PerScopeSetting.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinDHCPv4PerScopeSetting { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.3.0 + Version: 0.5.2 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -20,7 +20,7 @@ function Get-AbrWinDHCPv4PerScopeSetting { begin { Write-PScriboMessage "DHCP InfoLevel set at $($InfoLevel.DHCP)." - Write-PscriboMessage "Collecting Host DHCP Server Scope information." + Write-PScriboMessage "Collecting Host DHCP Server Scope information." } process { @@ -40,7 +40,7 @@ function Get-AbrWinDHCPv4PerScopeSetting { $OutObj = @() foreach ($Option in $DHCPScopeOptions) { try { - Write-PscriboMessage "Collecting DHCP Server Scope Server Option value $($Option.OptionId)" + Write-PScriboMessage "Collecting DHCP Server Scope Server Option value $($Option.OptionId)" $inObj = [ordered] @{ 'Name' = $Option.Name 'Option Id' = $Option.OptionId @@ -48,9 +48,8 @@ function Get-AbrWinDHCPv4PerScopeSetting { 'Policy Name' = ConvertTo-EmptyToFiller $Option.PolicyName } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "$($_.Exception.Message) (Scope Options Item)" + } catch { + Write-PScriboMessage -IsWarning "$($_.Exception.Message) (Scope Options Item)" } } @@ -65,16 +64,14 @@ function Get-AbrWinDHCPv4PerScopeSetting { $OutObj | Sort-Object -Property 'Option Id' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "$($_.Exception.Message) (Scope Options Section)" + } catch { + Write-PScriboMessage -IsWarning "$($_.Exception.Message) (Scope Options Section)" } } } } - } - catch { - Write-PscriboMessage -IsWarning "$($_.Exception.Message) (Scope Options Section)" + } catch { + Write-PScriboMessage -IsWarning "$($_.Exception.Message) (Scope Options Section)" } } diff --git a/Src/Private/Get-AbrWinDHCPv4Scope.ps1 b/Src/Private/Get-AbrWinDHCPv4Scope.ps1 index a851562..307a269 100644 --- a/Src/Private/Get-AbrWinDHCPv4Scope.ps1 +++ b/Src/Private/Get-AbrWinDHCPv4Scope.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinDHCPv4Scope { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.3.0 + Version: 0.5.2 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -20,7 +20,7 @@ function Get-AbrWinDHCPv4Scope { begin { Write-PScriboMessage "DHCP InfoLevel set at $($InfoLevel.DHCP)." - Write-PscriboMessage "Collecting Host DHCP Server information." + Write-PScriboMessage "Collecting Host DHCP Server information." } process { @@ -34,22 +34,21 @@ function Get-AbrWinDHCPv4Scope { $OutObj = @() foreach ($Scope in $DHCPScopes) { try { - Write-PscriboMessage "Collecting DHCP Server $($Scope.ScopeId) Scope" + Write-PScriboMessage "Collecting DHCP Server $($Scope.ScopeId) Scope" $SubnetMask = Convert-IpAddressToMaskLength $Scope.SubnetMask $inObj = [ordered] @{ 'Scope Id' = "$($Scope.ScopeId)/$($SubnetMask)" 'Scope Name' = $Scope.Name 'Scope Range' = "$($Scope.StartRange) - $($Scope.EndRange)" 'Lease Duration' = Switch ($Scope.LeaseDuration) { - "10675199.02:48:05.4775807" {"Unlimited"} - default {$Scope.LeaseDuration} + "10675199.02:48:05.4775807" { "Unlimited" } + default { $Scope.LeaseDuration } } 'State' = $Scope.State } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } @@ -69,7 +68,7 @@ function Get-AbrWinDHCPv4Scope { $OutObj = @() foreach ($DHCPStatistic in $DHCPStatistics) { try { - Write-PscriboMessage "Collecting DHCP Server $($DHCPStatistic.ScopeId) scope statistics" + Write-PScriboMessage "Collecting DHCP Server $($DHCPStatistic.ScopeId) scope statistics" $inObj = [ordered] @{ 'Scope Id' = $DHCPStatistic.ScopeId 'Free IP' = $DHCPStatistic.Free @@ -78,14 +77,13 @@ function Get-AbrWinDHCPv4Scope { 'Reserved IP' = $DHCPStatistic.Reserved } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "$($_.Exception.Message) (IPv4 Scope Statistics Item)" + } catch { + Write-PScriboMessage -IsWarning "$($_.Exception.Message) (IPv4 Scope Statistics Item)" } } if ($HealthCheck.DHCP.Statistics) { - $OutObj | Where-Object { $_.'Percentage In Use' -gt '95'} | Set-Style -Style Warning -Property 'Percentage In Use' + $OutObj | Where-Object { $_.'Percentage In Use' -gt '95' } | Set-Style -Style Warning -Property 'Percentage In Use' } $TableParams = @{ @@ -99,9 +97,8 @@ function Get-AbrWinDHCPv4Scope { $OutObj | Sort-Object -Property 'Scope Id' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "$($_.Exception.Message) (IPv4 Scope Statistics Table)" + } catch { + Write-PScriboMessage -IsWarning "$($_.Exception.Message) (IPv4 Scope Statistics Table)" } try { $DHCPv4Failovers = Get-DhcpServerv4Failover -CimSession $TempCIMSession @@ -110,7 +107,7 @@ function Get-AbrWinDHCPv4Scope { $OutObj = @() foreach ($DHCPv4Failover in $DHCPv4Failovers) { try { - Write-PscriboMessage "Collecting DHCP Server $($DHCPv4Failover.ScopeId) scope failover setting" + Write-PScriboMessage "Collecting DHCP Server $($DHCPv4Failover.ScopeId) scope failover setting" $inObj = [ordered] @{ 'Partner DHCP Server' = $DHCPv4Failover.PartnerServer 'Mode' = $DHCPv4Failover.Mode @@ -125,13 +122,12 @@ function Get-AbrWinDHCPv4Scope { 'Authetication Enable' = ConvertTo-TextYN $DHCPv4Failover.EnableAuth } $OutObj = [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "$($_.Exception.Message) (IPv4 Scope Failover Item)" + } catch { + Write-PScriboMessage -IsWarning "$($_.Exception.Message) (IPv4 Scope Failover Item)" } if ($HealthCheck.DHCP.BP) { - $OutObj | Where-Object { $_.'Authetication Enable' -eq 'No'} | Set-Style -Style Warning -Property 'Authetication Enable' - $OutObj | Where-Object { $_.'State' -ne 'Normal'} | Set-Style -Style Warning -Property 'State' + $OutObj | Where-Object { $_.'Authetication Enable' -eq 'No' } | Set-Style -Style Warning -Property 'Authetication Enable' + $OutObj | Where-Object { $_.'State' -ne 'Normal' } | Set-Style -Style Warning -Property 'State' } $TableParams = @{ @@ -146,9 +142,8 @@ function Get-AbrWinDHCPv4Scope { } } } - } - catch { - Write-PscriboMessage -IsWarning "$($_.Exception.Message) (IPv4 Scope Failover Table)" + } catch { + Write-PScriboMessage -IsWarning "$($_.Exception.Message) (IPv4 Scope Failover Table)" } try { $DHCPv4Bindings = Get-DhcpServerv4Binding -CimSession $TempCIMSession @@ -157,24 +152,22 @@ function Get-AbrWinDHCPv4Scope { $OutObj = @() foreach ($DHCPv4Binding in $DHCPv4Bindings) { try { - Write-PscriboMessage "Collecting DHCP Server $($DHCPv4Binding.InterfaceAlias) binding." - $SubnetMask = Convert-IpAddressToMaskLength $DHCPv4Binding.SubnetMask + Write-PScriboMessage "Collecting DHCP Server $($DHCPv4Binding.InterfaceAlias) binding." $inObj = [ordered] @{ 'Interface Alias' = $DHCPv4Binding.InterfaceAlias 'IP Address' = $DHCPv4Binding.IPAddress 'Subnet Mask' = $DHCPv4Binding.SubnetMask 'State' = Switch ($DHCPv4Binding.BindingState) { - "" {"-"; break} - $Null {"-"; break} - "True" {"Enabled"} - "False" {"Disabled"} - default {$DHCPv4Binding.BindingState} + "" { "--"; break } + $Null { "--"; break } + "True" { "Enabled" } + "False" { "Disabled" } + default { $DHCPv4Binding.BindingState } } } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "$($_.Exception.Message) (IPv4 Network Interface binding Item)" + } catch { + Write-PScriboMessage -IsWarning "$($_.Exception.Message) (IPv4 Network Interface binding Item)" } } $TableParams = @{ @@ -188,15 +181,13 @@ function Get-AbrWinDHCPv4Scope { $OutObj | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "$($_.Exception.Message) (IPv4 Network Interface binding Table)" + } catch { + Write-PScriboMessage -IsWarning "$($_.Exception.Message) (IPv4 Network Interface binding Table)" } } } - } - catch { - Write-PscriboMessage -IsWarning "$($_.Exception.Message) (IPv4 Scope Summary)" + } catch { + Write-PScriboMessage -IsWarning "$($_.Exception.Message) (IPv4 Scope Summary)" } } end {} diff --git a/Src/Private/Get-AbrWinDHCPv4ScopeServerSetting.ps1 b/Src/Private/Get-AbrWinDHCPv4ScopeServerSetting.ps1 index 5e09afd..5e8857d 100644 --- a/Src/Private/Get-AbrWinDHCPv4ScopeServerSetting.ps1 +++ b/Src/Private/Get-AbrWinDHCPv4ScopeServerSetting.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinDHCPv4ScopeServerSetting { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.3.0 + Version: 0.5.2 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -20,7 +20,7 @@ function Get-AbrWinDHCPv4ScopeServerSetting { begin { Write-PScriboMessage "DHCP InfoLevel set at $($InfoLevel.DHCP)." - Write-PscriboMessage "Collecting Host DHCP Server information." + Write-PScriboMessage "Collecting Host DHCP Server information." } process { @@ -33,7 +33,7 @@ function Get-AbrWinDHCPv4ScopeServerSetting { Write-PScriboMessage "Discovered '$(($DHCPScopeOptions | Measure-Object).Count)' DHCP scopes server opions." foreach ($Option in $DHCPScopeOptions) { try { - Write-PscriboMessage "Collecting DHCP Server Scope Server Option value $($Option.OptionId)" + Write-PScriboMessage "Collecting DHCP Server Scope Server Option value $($Option.OptionId)" $inObj = [ordered] @{ 'Name' = $Option.Name 'Option Id' = $Option.OptionId @@ -41,9 +41,8 @@ function Get-AbrWinDHCPv4ScopeServerSetting { 'Policy Name' = ConvertTo-EmptyToFiller $Option.PolicyName } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "$($_.Exception.Message) (DHCP scopes server opions item)" + } catch { + Write-PScriboMessage -IsWarning "$($_.Exception.Message) (DHCP scopes server opions item)" } } $TableParams = @{ @@ -64,7 +63,7 @@ function Get-AbrWinDHCPv4ScopeServerSetting { $OutObj = @() foreach ($Option in $DHCPScopeOptions) { try { - Write-PscriboMessage "Collecting DHCP Server Scope DNS Setting." + Write-PScriboMessage "Collecting DHCP Server Scope DNS Setting." $inObj = [ordered] @{ 'Dynamic Updates' = $Option.DynamicUpdates 'Dns Suffix' = ConvertTo-EmptyToFiller $Option.DnsSuffix @@ -74,9 +73,8 @@ function Get-AbrWinDHCPv4ScopeServerSetting { 'Delete Dns RR On Lease Expiry' = ConvertTo-EmptyToFiller $Option.DeleteDnsRROnLeaseExpiry } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "$($_.Exception.Message) (Scope DNS Setting Item)" + } catch { + Write-PScriboMessage -IsWarning "$($_.Exception.Message) (Scope DNS Setting Item)" } } @@ -91,9 +89,8 @@ function Get-AbrWinDHCPv4ScopeServerSetting { $OutObj | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "$($_.Exception.Message) (Scope DNS Setting Table)" + } catch { + Write-PScriboMessage -IsWarning "$($_.Exception.Message) (Scope DNS Setting Table)" } } } diff --git a/Src/Private/Get-AbrWinDHCPv4Statistic.ps1 b/Src/Private/Get-AbrWinDHCPv4Statistic.ps1 index b371668..30dd2e7 100644 --- a/Src/Private/Get-AbrWinDHCPv4Statistic.ps1 +++ b/Src/Private/Get-AbrWinDHCPv4Statistic.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinDHCPv4Statistic { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.3.0 + Version: 0.5.2 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -20,7 +20,7 @@ function Get-AbrWinDHCPv4Statistic { begin { Write-PScriboMessage "DHCP InfoLevel set at $($InfoLevel.DHCP)." - Write-PscriboMessage "Collecting Host DHCP Server information." + Write-PScriboMessage "Collecting Host DHCP Server information." } process { @@ -39,18 +39,17 @@ function Get-AbrWinDHCPv4Statistic { 'Percentage Available' = ConvertTo-EmptyToFiller ([math]::Round($DhcpSv4Statistics.PercentageAvailable, 0)) } $OutObj += [pscustomobject]$inobj - } - catch { + } catch { Write-PScriboMessage -IsWarning "$($_.Exception.Message) (IPv4 Service Statistics Item)" } if ($HealthCheck.DHCP.Statistics) { - $OutObj | Where-Object { $_.'Percentage In Use' -gt 95} | Set-Style -Style Warning -Property 'Percentage Available','Percentage In Use' + $OutObj | Where-Object { $_.'Percentage In Use' -gt 95 } | Set-Style -Style Warning -Property 'Percentage Available', 'Percentage In Use' } $TableParams = @{ Name = "DHCP Server Statistics - $($System.toUpper().split(".")[0])" List = $false - ColumnWidths = 17, 17, 17, 17 ,16, 16 + ColumnWidths = 17, 17, 17, 17 , 16, 16 } if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" @@ -58,8 +57,7 @@ function Get-AbrWinDHCPv4Statistic { $OutObj | Sort-Object -Property 'DC Name' | Table @TableParams } } - } - catch { + } catch { Write-PScriboMessage -IsWarning "$($_.Exception.Message) (IPv4 Service Statistics Table)" } } diff --git a/Src/Private/Get-AbrWinDNSInfrastructure.ps1 b/Src/Private/Get-AbrWinDNSInfrastructure.ps1 index 2d0da25..7fa00fc 100644 --- a/Src/Private/Get-AbrWinDNSInfrastructure.ps1 +++ b/Src/Private/Get-AbrWinDNSInfrastructure.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinDNSInfrastructure { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.3.0 + Version: 0.5.2 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -20,7 +20,7 @@ function Get-AbrWinDNSInfrastructure { begin { Write-PScriboMessage "DNS InfoLevel set at $($InfoLevel.DNS)." - Write-PscriboMessage "Collecting Host DNS Server information." + Write-PScriboMessage "Collecting Host DNS Server information." } process { @@ -38,9 +38,8 @@ function Get-AbrWinDNSInfrastructure { 'All IPs' = $DNSSetting.AllIPAddress } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning " $($_.Exception.Message) (Infrastructure Summary)" + } catch { + Write-PScriboMessage -IsWarning " $($_.Exception.Message) (Infrastructure Summary)" } } @@ -62,7 +61,7 @@ function Get-AbrWinDNSInfrastructure { if ($DNSIPSetting) { Section -Style Heading3 "DNS IP Configuration" { Paragraph "The following table details DNS Server IP Configuration Settings" - Blankline + BlankLine $OutObj = @() try { $inObj = [ordered] @{ @@ -75,7 +74,7 @@ function Get-AbrWinDNSInfrastructure { $OutObj = [pscustomobject]$inobj if ($HealthCheck.DNS.DP) { - $OutObj | Where-Object { $_.'DNS IP 1' -eq "127.0.0.1"} | Set-Style -Style Warning -Property 'DNS IP 1' + $OutObj | Where-Object { $_.'DNS IP 1' -eq "127.0.0.1" } | Set-Style -Style Warning -Property 'DNS IP 1' } $TableParams = @{ @@ -87,15 +86,13 @@ function Get-AbrWinDNSInfrastructure { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } - } - catch { - Write-PscriboMessage -IsWarning "$($_.Exception.Message) (DNS IP Configuration Table)" + } catch { + Write-PScriboMessage -IsWarning "$($_.Exception.Message) (DNS IP Configuration Table)" } } @@ -108,7 +105,7 @@ function Get-AbrWinDNSInfrastructure { if ($DNSSetting) { Section -Style Heading3 "Scavenging Options" { Paragraph "The following table details scavenging configuration settings" - Blankline + BlankLine $OutObj = @() try { $inObj = [ordered] @{ @@ -116,14 +113,14 @@ function Get-AbrWinDNSInfrastructure { 'Refresh Interval' = ConvertTo-EmptyToFiller $DNSSetting.RefreshInterval 'Scavenging Interval' = ConvertTo-EmptyToFiller $DNSSetting.ScavengingInterval 'Last Scavenge Time' = Switch ($DNSSetting.LastScavengeTime) { - "" {"-"; break} - $Null {"-"; break} - default {ConvertTo-EmptyToFiller ($DNSSetting.LastScavengeTime.ToString("MM/dd/yyyy"))} + "" { "--"; break } + $Null { "--"; break } + default { ConvertTo-EmptyToFiller ($DNSSetting.LastScavengeTime.ToString("MM/dd/yyyy")) } } 'Scavenging State' = Switch ($DNSSetting.ScavengingState) { - "True" {"Enabled"} - "False" {"Disabled"} - default {ConvertTo-EmptyToFiller $DNSSetting.ScavengingState} + "True" { "Enabled" } + "False" { "Disabled" } + default { ConvertTo-EmptyToFiller $DNSSetting.ScavengingState } } } @@ -137,15 +134,13 @@ function Get-AbrWinDNSInfrastructure { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "$($_.Exception.Message) (Scavenging Item)" + } catch { + Write-PScriboMessage -IsWarning "$($_.Exception.Message) (Scavenging Item)" } } } - } - catch { - Write-PscriboMessage -IsWarning "$($_.Exception.Message) (Scavenging Table)" + } catch { + Write-PScriboMessage -IsWarning "$($_.Exception.Message) (Scavenging Table)" } } #---------------------------------------------------------------------------------------------# @@ -154,7 +149,7 @@ function Get-AbrWinDNSInfrastructure { try { Section -Style Heading3 "Forwarder Options" { Paragraph "The following table details forwarder configuration settings" - Blankline + BlankLine $OutObj = @() try { $DNSSetting = Get-DnsServerForwarder -CimSession $TempCIMSession @@ -175,18 +170,15 @@ function Get-AbrWinDNSInfrastructure { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "$($_.Exception.Message) (Forwarder Item)" + } catch { + Write-PScriboMessage -IsWarning "$($_.Exception.Message) (Forwarder Item)" } } + } catch { + Write-PScriboMessage -IsWarning "$($_.Exception.Message) (Forwarder Table)" } - catch { - Write-PscriboMessage -IsWarning "$($_.Exception.Message) (Forwarder Table)" - } - } - catch { - Write-PscriboMessage -IsWarning "$($_.Exception.Message) (DNS Infrastructure Section)" + } catch { + Write-PScriboMessage -IsWarning "$($_.Exception.Message) (DNS Infrastructure Section)" } } diff --git a/Src/Private/Get-AbrWinDNSZone.ps1 b/Src/Private/Get-AbrWinDNSZone.ps1 index d1faf50..bbb467e 100644 --- a/Src/Private/Get-AbrWinDNSZone.ps1 +++ b/Src/Private/Get-AbrWinDNSZone.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinDNSZone { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.3.0 + Version: 0.5.2 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -20,20 +20,20 @@ function Get-AbrWinDNSZone { begin { Write-PScriboMessage "DNS InfoLevel set at $($InfoLevel.DNS)." - Write-PscriboMessage "Collecting Host DNS Server information." + Write-PScriboMessage "Collecting Host DNS Server information." } process { try { - $DNSSetting = Get-DnsServerZone -CimSession $TempCIMSession | Where-Object {$_.IsReverseLookupZone -like "False" -and $_.ZoneType -notlike "Forwarder"} + $DNSSetting = Get-DnsServerZone -CimSession $TempCIMSession | Where-Object { $_.IsReverseLookupZone -like "False" -and $_.ZoneType -notlike "Forwarder" } if ($DNSSetting) { Section -Style Heading3 "DNS Zone Configuration" { Paragraph "The following table details zones configuration settings" - Blankline + BlankLine $OutObj = @() foreach ($Zones in $DNSSetting) { try { - Write-PscriboMessage "Collecting Actve Directory DNS Zone: '$($Zones.ZoneName)' on $DC" + 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 @@ -44,9 +44,8 @@ function Get-AbrWinDNSZone { 'Signed' = ConvertTo-EmptyToFiller (ConvertTo-TextYN $Zones.IsSigned) } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "$($_.Exception.Message) (Domain Name System Zone Item)" + } catch { + Write-PScriboMessage -IsWarning "$($_.Exception.Message) (Domain Name System Zone Item)" } } @@ -62,11 +61,11 @@ function Get-AbrWinDNSZone { if ($InfoLevel.DNS -ge 2) { try { - $DNSSetting = Invoke-Command -Session $TempPssSession {Get-ChildItem -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DNS Server\Zones\*" | Get-ItemProperty | Where-Object {$_ -match 'SecondaryServers'}} + $DNSSetting = Invoke-Command -Session $TempPssSession { Get-ChildItem -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DNS Server\Zones\*" | Get-ItemProperty | Where-Object { $_ -match 'SecondaryServers' } } if ($DNSSetting) { Section -Style Heading4 "Zone Transfers" { Paragraph "The following table details zone transfer configuration settings" - Blankline + BlankLine $OutObj = @() foreach ($Zone in $DNSSetting) { try { @@ -75,11 +74,11 @@ function Get-AbrWinDNSZone { 'Secondary Servers' = ConvertTo-EmptyToFiller ($Zone.SecondaryServers -join ", ") 'Notify Servers' = ConvertTo-EmptyToFiller $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."} - "2" {"Send zone transfers only to servers you specify in Secondary Servers."} - "3" {"Do not send zone transfers."} - default {$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." } + "2" { "Send zone transfers only to servers you specify in Secondary Servers." } + "3" { "Do not send zone transfers." } + default { $Zone.SecureSecondaries } } } $OutObj = [pscustomobject]$inobj @@ -93,28 +92,26 @@ function Get-AbrWinDNSZone { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning "$($_.Exception.Message) (Zone Transfers Item)" + } catch { + Write-PScriboMessage -IsWarning "$($_.Exception.Message) (Zone Transfers Item)" } } } } - } - catch { - Write-PscriboMessage -IsWarning "$($_.Exception.Message) (Zone Transfers Table)" + } catch { + Write-PScriboMessage -IsWarning "$($_.Exception.Message) (Zone Transfers Table)" } } try { - $DNSSetting = Get-DnsServerZone -CimSession $TempCIMSession | Where-Object {$_.IsReverseLookupZone -like "True"} + $DNSSetting = Get-DnsServerZone -CimSession $TempCIMSession | Where-Object { $_.IsReverseLookupZone -like "True" } if ($DNSSetting) { Section -Style Heading4 "Reverse Lookup Zone Configuration" { Paragraph "The following table details reverse looup zone configuration settings" - Blankline + BlankLine $OutObj = @() foreach ($Zones in $DNSSetting) { try { - Write-PscriboMessage "Collecting Actve Directory DNS Zone: '$($Zones.ZoneName)'" + Write-PScriboMessage "Collecting Actve Directory DNS Zone: '$($Zones.ZoneName)'" $inObj = [ordered] @{ 'Zone Name' = ConvertTo-EmptyToFiller $Zones.ZoneName 'Zone Type' = ConvertTo-EmptyToFiller $Zones.ZoneType @@ -125,9 +122,8 @@ function Get-AbrWinDNSZone { 'Signed' = ConvertTo-EmptyToFiller (ConvertTo-TextYN $Zones.IsSigned) } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "$($_.Exception.Message) (Reverse Lookup Zone Configuration Item)" + } catch { + Write-PScriboMessage -IsWarning "$($_.Exception.Message) (Reverse Lookup Zone Configuration Item)" } } @@ -142,20 +138,19 @@ function Get-AbrWinDNSZone { $OutObj | Sort-Object -Property 'Zone Name' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "$($_.Exception.Message) (Reverse Lookup Zone Configuration Table)" + } catch { + Write-PScriboMessage -IsWarning "$($_.Exception.Message) (Reverse Lookup Zone Configuration Table)" } try { - $DNSSetting = Get-DnsServerZone -CimSession $TempCIMSession | Where-Object {$_.IsReverseLookupZone -like "False" -and $_.ZoneType -like "Forwarder"} + $DNSSetting = Get-DnsServerZone -CimSession $TempCIMSession | Where-Object { $_.IsReverseLookupZone -like "False" -and $_.ZoneType -like "Forwarder" } if ($DNSSetting) { Section -Style Heading4 "Conditional Forwarder" { Paragraph "The following table details conditional forwarder configuration settings" - Blankline + BlankLine $OutObj = @() foreach ($Zones in $DNSSetting) { try { - Write-PscriboMessage "Collecting Actve Directory DNS Zone: '$($Zones.ZoneName)'" + Write-PScriboMessage "Collecting Actve Directory DNS Zone: '$($Zones.ZoneName)'" $inObj = [ordered] @{ 'Zone Name' = $Zones.ZoneName 'Zone Type' = $Zones.ZoneType @@ -164,9 +159,8 @@ function Get-AbrWinDNSZone { 'DS Integrated' = ConvertTo-TextYN $Zones.IsDsIntegrated } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "$($_.Exception.Message) (Conditional Forwarder Item)" + } catch { + Write-PScriboMessage -IsWarning "$($_.Exception.Message) (Conditional Forwarder Item)" } } @@ -181,42 +175,40 @@ function Get-AbrWinDNSZone { $OutObj | Sort-Object -Property 'Zone Name' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "$($_.Exception.Message) (Conditional Forwarder Table)" + } catch { + Write-PScriboMessage -IsWarning "$($_.Exception.Message) (Conditional Forwarder Table)" } if ($InfoLevel.DNS -ge 2) { try { - $DNSSetting = Get-DnsServerZone -CimSession $TempCIMSession | Where-Object {$_.IsReverseLookupZone -like "False" -and $_.ZoneType -eq "Primary"} | Select-Object -ExpandProperty ZoneName + $DNSSetting = Get-DnsServerZone -CimSession $TempCIMSession | Where-Object { $_.IsReverseLookupZone -like "False" -and $_.ZoneType -eq "Primary" } | Select-Object -ExpandProperty ZoneName $Zones = Get-DnsServerZoneAging -CimSession $TempCIMSession -Name $DNSSetting if ($Zones) { Section -Style Heading4 "Zone Scope Aging Properties" { Paragraph "The following table details zone configuration aging settings" - Blankline + BlankLine $OutObj = @() foreach ($Settings in $Zones) { try { - Write-PscriboMessage "Collecting Actve Directory DNS Zone: '$($Settings.ZoneName)'" + 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 'Available For Scavenge' = Switch ($Settings.AvailForScavengeTime) { - "" {"-"; break} - $Null {"-"; break} - default {(ConvertTo-EmptyToFiller ($Settings.AvailForScavengeTime).ToUniversalTime().toString("r")); break} + "" { "--"; break } + $Null { "--"; break } + default { (ConvertTo-EmptyToFiller ($Settings.AvailForScavengeTime).ToUniversalTime().toString("r")); break } } } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning "$($_.Exception.Message) (Zone Scope Aging Item)" + } catch { + Write-PScriboMessage -IsWarning "$($_.Exception.Message) (Zone Scope Aging Item)" } } if ($HealthCheck.DNS.Aging) { - $OutObj | Where-Object { $_.'Aging Enabled' -ne 'Yes'} | Set-Style -Style Warning -Property 'Aging Enabled' + $OutObj | Where-Object { $_.'Aging Enabled' -ne 'Yes' } | Set-Style -Style Warning -Property 'Aging Enabled' } $TableParams = @{ @@ -230,16 +222,14 @@ function Get-AbrWinDNSZone { $OutObj | Sort-Object -Property 'Zone Name' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning "$($_.Exception.Message) (Zone Scope Aging Table)" + } catch { + Write-PScriboMessage -IsWarning "$($_.Exception.Message) (Zone Scope Aging Table)" } } } } - } - catch { - Write-PscriboMessage -IsWarning "$($_.Exception.Message) (Global DNS Zone Information)" + } catch { + Write-PScriboMessage -IsWarning "$($_.Exception.Message) (Global DNS Zone Information)" } } diff --git a/Src/Private/Get-AbrWinFOCluster.ps1 b/Src/Private/Get-AbrWinFOCluster.ps1 index d21bf3d..ba6e8a8 100644 --- a/Src/Private/Get-AbrWinFOCluster.ps1 +++ b/Src/Private/Get-AbrWinFOCluster.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinFOCluster { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.0 + Version: 0.5.2 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -26,7 +26,7 @@ function Get-AbrWinFOCluster { process { try { - $Settings = Invoke-Command -Session $TempPssSession { Get-Cluster -Name $using:Cluster | Select-Object -Property * } + $Settings = Invoke-Command -Session $TempPssSession { Get-Cluster | Select-Object -Property * } if ($Settings) { $OutObj = @() try { @@ -44,7 +44,7 @@ function Get-AbrWinFOCluster { } $TableParams = @{ - Name = "FailOver Cluster Servers Settings - $($System.toUpper().split(".")[0])" + Name = "FailOver Cluster Servers Settings - $($System.split(".")[0])" List = $true ColumnWidths = 40, 60 } diff --git a/Src/Private/Get-AbrWinFOClusterAvailableDisk.ps1 b/Src/Private/Get-AbrWinFOClusterAvailableDisk.ps1 index 0581c4e..45445cc 100644 --- a/Src/Private/Get-AbrWinFOClusterAvailableDisk.ps1 +++ b/Src/Private/Get-AbrWinFOClusterAvailableDisk.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinFOClusterAvailableDisk { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.0 + Version: 0.5.2 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,16 +21,16 @@ function Get-AbrWinFOClusterAvailableDisk { begin { Write-PScriboMessage "FailOverCluster InfoLevel set at $($InfoLevel.FailOverCluster)." - Write-PscriboMessage "Collecting Host FailOver Cluster Available Disk information." + Write-PScriboMessage "Collecting Host FailOver Cluster Available Disk information." } process { try { - $Settings = Invoke-Command -Session $TempPssSession { Get-ClusterAvailableDisk -Cluster $using:Cluster} | Sort-Object -Property Name + $Settings = Invoke-Command -Session $TempPssSession { Get-ClusterAvailableDisk } | Sort-Object -Property Name if ($Settings) { Section -Style Heading3 "Available Disk" { $OutObj = @() - foreach ($Setting in $Settings) { + foreach ($Setting in $Settings) { try { $inObj = [ordered] @{ 'Name' = $Setting.Name @@ -38,14 +38,13 @@ function Get-AbrWinFOClusterAvailableDisk { 'Size' = ConvertTo-FileSizeString $Setting.Size } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } $TableParams = @{ - Name = "Available Disk - $($Cluster.toUpper().split(".")[0])" + Name = "Available Disk - $($Cluster)" List = $false ColumnWidths = 40, 30, 30 } @@ -55,9 +54,8 @@ function Get-AbrWinFOClusterAvailableDisk { $OutObj | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } diff --git a/Src/Private/Get-AbrWinFOClusterFaultDomain.ps1 b/Src/Private/Get-AbrWinFOClusterFaultDomain.ps1 index 587d729..4128adb 100644 --- a/Src/Private/Get-AbrWinFOClusterFaultDomain.ps1 +++ b/Src/Private/Get-AbrWinFOClusterFaultDomain.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinFOClusterFaultDomain { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.0 + Version: 0.5.2 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,7 +21,7 @@ function Get-AbrWinFOClusterFaultDomain { begin { Write-PScriboMessage "FailOverCluster InfoLevel set at $($InfoLevel.FailOverCluster)." - Write-PscriboMessage "Collecting Host FailOver Cluster Fault Domain information." + Write-PScriboMessage "Collecting Host FailOver Cluster Fault Domain information." } process { @@ -30,24 +30,31 @@ function Get-AbrWinFOClusterFaultDomain { if ($Settings) { Section -Style Heading3 "Fault Domain" { $OutObj = @() - foreach ($Setting in $Settings) { + foreach ($Setting in $Settings) { try { $inObj = [ordered] @{ 'Name' = $Setting.Name 'Type' = $Setting.Type - 'Parent Name' = $Setting.ParentName - 'Children Names' = $Setting.ChildrenNames + 'Parent Name' = Switch ([string]::IsNullOrEmpty($Setting.ParentName)) { + $true {"--"} + $false {$Setting.ParentName} + default {'Unknown'} + } + 'Children Names' = Switch ([string]::IsNullOrEmpty($Setting.ChildrenNames)) { + $true {"--"} + $false {$Setting.ChildrenNames} + default {'Unknown'} + } 'Location' = ConvertTo-EmptyToFiller $Setting.Location } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } $TableParams = @{ - Name = "Fault Domain - $($Cluster.toUpper().split(".")[0])" + Name = "Fault Domain - $($Cluster)" List = $false ColumnWidths = 20, 20, 20, 20, 20 } @@ -57,9 +64,8 @@ function Get-AbrWinFOClusterFaultDomain { $OutObj | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } diff --git a/Src/Private/Get-AbrWinFOClusterNetwork.ps1 b/Src/Private/Get-AbrWinFOClusterNetwork.ps1 index b0aad85..3c802b0 100644 --- a/Src/Private/Get-AbrWinFOClusterNetwork.ps1 +++ b/Src/Private/Get-AbrWinFOClusterNetwork.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinFOClusterNetwork { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.0 + Version: 0.5.2 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,16 +21,16 @@ function Get-AbrWinFOClusterNetwork { begin { Write-PScriboMessage "FailOverCluster InfoLevel set at $($InfoLevel.FailOverCluster)." - Write-PscriboMessage "Collecting Host FailOver Cluster Networks information." + Write-PScriboMessage "Collecting Host FailOver Cluster Networks information." } process { try { - $Settings = Invoke-Command -Session $TempPssSession { Get-ClusterNetwork -Cluster $using:Cluster} | Sort-Object -Property Name + $Settings = Invoke-Command -Session $TempPssSession { Get-ClusterNetwork } | Sort-Object -Property Name if ($Settings) { Section -Style Heading3 "Networks" { $OutObj = @() - foreach ($Setting in $Settings) { + foreach ($Setting in $Settings) { try { $inObj = [ordered] @{ 'Name' = $Setting.Name @@ -39,19 +39,18 @@ function Get-AbrWinFOClusterNetwork { 'Address' = "$($Setting.Address)/$($Setting.AddressMask)" } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } if ($HealthCheck.FailOverCluster.Network) { - $OutObj | Where-Object { $_.'State' -ne 'UP'} | Set-Style -Style Warning -Property 'State' + $OutObj | Where-Object { $_.'State' -ne 'UP' } | Set-Style -Style Warning -Property 'State' } $TableParams = @{ - Name = "Networks - $($Cluster.toUpper().split(".")[0])" + Name = "Networks - $($Cluster)" List = $false ColumnWidths = 30, 15, 20, 35 } @@ -63,9 +62,8 @@ function Get-AbrWinFOClusterNetwork { Get-AbrWinFOClusterNetworkInterface } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } diff --git a/Src/Private/Get-AbrWinFOClusterNetworkInterface.ps1 b/Src/Private/Get-AbrWinFOClusterNetworkInterface.ps1 index 012563a..663197d 100644 --- a/Src/Private/Get-AbrWinFOClusterNetworkInterface.ps1 +++ b/Src/Private/Get-AbrWinFOClusterNetworkInterface.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinFOClusterNetworkInterface { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.0 + Version: 0.5.2 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,16 +21,16 @@ function Get-AbrWinFOClusterNetworkInterface { begin { Write-PScriboMessage "FailOverCluster InfoLevel set at $($InfoLevel.FailOverCluster)." - Write-PscriboMessage "Collecting Host FailOver Cluster Network Interface information." + Write-PScriboMessage "Collecting Host FailOver Cluster Network Interface information." } process { try { - $Settings = Invoke-Command -Session $TempPssSession { Get-ClusterNetworkInterface -Cluster $using:Cluster} | Sort-Object -Property Name + $Settings = Invoke-Command -Session $TempPssSession { Get-ClusterNetworkInterface } | Sort-Object -Property Name if ($Settings) { Section -Style Heading3 "Interfaces" { $OutObj = @() - foreach ($Setting in $Settings) { + foreach ($Setting in $Settings) { try { $inObj = [ordered] @{ 'Name' = $Setting.Name @@ -39,19 +39,18 @@ function Get-AbrWinFOClusterNetworkInterface { 'State' = $Setting.State } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } if ($HealthCheck.FailOverCluster.Network) { - $OutObj | Where-Object { $_.'State' -ne 'UP'} | Set-Style -Style Warning -Property 'State' + $OutObj | Where-Object { $_.'State' -ne 'UP' } | Set-Style -Style Warning -Property 'State' } $TableParams = @{ - Name = "Interfaces - $($Cluster.toUpper().split(".")[0])" + Name = "Interfaces - $($Cluster)" List = $false ColumnWidths = 30, 25, 30, 15 } @@ -61,9 +60,8 @@ function Get-AbrWinFOClusterNetworkInterface { $OutObj | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } diff --git a/Src/Private/Get-AbrWinFOClusterNode.ps1 b/Src/Private/Get-AbrWinFOClusterNode.ps1 index 056b534..0ec6b75 100644 --- a/Src/Private/Get-AbrWinFOClusterNode.ps1 +++ b/Src/Private/Get-AbrWinFOClusterNode.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinFOClusterNode { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.0 + Version: 0.5.2 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -24,9 +24,9 @@ function Get-AbrWinFOClusterNode { process { try { - $Settings = Invoke-Command -Session $TempPssSession { Get-ClusterNode -Cluster $using:Cluster} | Sort-Object -Property Identity + $Settings = Invoke-Command -Session $TempPssSession { Get-ClusterNode } | Sort-Object -Property Identity if ($Settings) { - Write-PscriboMessage "Collecting Host FailOver Cluster Permissions Settings information." + Write-PScriboMessage "Collecting Host FailOver Cluster Permissions Settings information." Section -Style Heading3 'Nodes' { $OutObj = @() foreach ($Setting in $Settings) { @@ -45,7 +45,7 @@ function Get-AbrWinFOClusterNode { } if ($HealthCheck.FailOverCluster.Nodes) { - $OutObj | Where-Object { $_.'State' -ne 'UP'} | Set-Style -Style Warning -Property 'State' + $OutObj | Where-Object { $_.'State' -ne 'UP' } | Set-Style -Style Warning -Property 'State' } if ($InfoLevel.FailOverCluster -ge 2) { @@ -67,7 +67,7 @@ function Get-AbrWinFOClusterNode { Paragraph "The following table summarizes the configuration of the Failover Cluster Nodes." BlankLine $TableParams = @{ - Name = "Nodes - $($Cluster.toUpper().split(".")[0])" + Name = "Nodes - $($Cluster)" List = $false Columns = 'Name', 'State', 'Type' ColumnWidths = 40, 30, 30 @@ -80,7 +80,7 @@ function Get-AbrWinFOClusterNode { } } } catch { - Write-PscriboMessage -IsWarning "FailOver Cluster Nodes Section: $($_.Exception.Message)" + Write-PScriboMessage -IsWarning "FailOver Cluster Nodes Section: $($_.Exception.Message)" } } diff --git a/Src/Private/Get-AbrWinFOClusterPermission.ps1 b/Src/Private/Get-AbrWinFOClusterPermission.ps1 index 837e1c5..5145e37 100644 --- a/Src/Private/Get-AbrWinFOClusterPermission.ps1 +++ b/Src/Private/Get-AbrWinFOClusterPermission.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinFOClusterPermission { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.0 + Version: 0.5.2 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,16 +21,16 @@ function Get-AbrWinFOClusterPermission { begin { Write-PScriboMessage "FailOverCluster InfoLevel set at $($InfoLevel.FailOverCluster)." - Write-PscriboMessage "Collecting Host FailOver Cluster Permissions Settings information." + Write-PScriboMessage "Collecting Host FailOver Cluster Permissions Settings information." } process { try { - $Settings = Invoke-Command -Session $TempPssSession { Get-ClusterAccess -Cluster $using:Cluster} | Sort-Object -Property Identity + $Settings = Invoke-Command -Session $TempPssSession { Get-ClusterAccess } | Sort-Object -Property Identity if ($Settings) { Section -Style Heading3 "Access Permissions" { $OutObj = @() - foreach ($Setting in $Settings) { + foreach ($Setting in $Settings) { try { $inObj = [ordered] @{ 'Identity' = $Setting.IdentityReference @@ -38,14 +38,13 @@ function Get-AbrWinFOClusterPermission { 'Rights' = $Setting.ClusterRights } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } $TableParams = @{ - Name = "Access Permission - $($Cluster.toUpper().split(".")[0])" + Name = "Access Permission - $($Cluster)" List = $false ColumnWidths = 60, 20, 20 } @@ -55,9 +54,8 @@ function Get-AbrWinFOClusterPermission { $OutObj | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } diff --git a/Src/Private/Get-AbrWinFOClusterQuorum.ps1 b/Src/Private/Get-AbrWinFOClusterQuorum.ps1 index fc329c8..06b2a72 100644 --- a/Src/Private/Get-AbrWinFOClusterQuorum.ps1 +++ b/Src/Private/Get-AbrWinFOClusterQuorum.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinFOClusterQuorum { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.0 + Version: 0.5.2 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,16 +21,16 @@ function Get-AbrWinFOClusterQuorum { begin { Write-PScriboMessage "FailOverCluster InfoLevel set at $($InfoLevel.FailOverCluster)." - Write-PscriboMessage "Collecting Host FailOver Cluster Quorum information." + Write-PScriboMessage "Collecting Host FailOver Cluster Quorum information." } process { try { - $Settings = Invoke-Command -Session $TempPssSession { Get-ClusterQuorum -Cluster $using:Cluster | Select-Object -Property * } | Sort-Object -Property Name + $Settings = Invoke-Command -Session $TempPssSession { Get-ClusterQuorum | Select-Object -Property * } | Sort-Object -Property Name if ($Settings) { Section -Style Heading3 "Quorum" { $OutObj = @() - foreach ($Setting in $Settings) { + foreach ($Setting in $Settings) { try { $inObj = [ordered] @{ 'Cluster' = $Setting.Cluster @@ -38,14 +38,13 @@ function Get-AbrWinFOClusterQuorum { 'Quorum Type' = $Setting.QuorumType } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } $TableParams = @{ - Name = "Quorum - $($Cluster.toUpper().split(".")[0])" + Name = "Quorum - $($Cluster)" List = $false ColumnWidths = 33, 34, 33 } @@ -55,9 +54,8 @@ function Get-AbrWinFOClusterQuorum { $OutObj | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } diff --git a/Src/Private/Get-AbrWinFOClusterResource.ps1 b/Src/Private/Get-AbrWinFOClusterResource.ps1 index 75171a3..1bfef6d 100644 --- a/Src/Private/Get-AbrWinFOClusterResource.ps1 +++ b/Src/Private/Get-AbrWinFOClusterResource.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinFOClusterResource { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.0 + Version: 0.5.2 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,16 +21,16 @@ function Get-AbrWinFOClusterResource { begin { Write-PScriboMessage "FailOverCluster InfoLevel set at $($InfoLevel.FailOverCluster)." - Write-PscriboMessage "Collecting Host FailOver Cluster Resource information." + Write-PScriboMessage "Collecting Host FailOver Cluster Resource information." } process { try { - $Settings = Invoke-Command -Session $TempPssSession { Get-ClusterResource -Cluster $using:Cluster | Select-Object -Property * } | Sort-Object -Property Name + $Settings = Invoke-Command -Session $TempPssSession { Get-ClusterResource | Select-Object -Property * } | Sort-Object -Property Name if ($Settings) { Section -Style Heading3 "Resource" { $OutObj = @() - foreach ($Setting in $Settings) { + foreach ($Setting in $Settings) { try { $inObj = [ordered] @{ 'Name' = $Setting.Name @@ -39,19 +39,18 @@ function Get-AbrWinFOClusterResource { 'State' = $Setting.State } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } if ($HealthCheck.FailOverCluster.Network) { - $OutObj | Where-Object { $_.'State' -notlike 'Online'} | Set-Style -Style Warning -Property 'State' + $OutObj | Where-Object { $_.'State' -notlike 'Online' } | Set-Style -Style Warning -Property 'State' } $TableParams = @{ - Name = "Resource - $($Cluster.toUpper().split(".")[0])" + Name = "Resource - $($Cluster)" List = $false ColumnWidths = 25, 25, 35, 15 } @@ -61,9 +60,8 @@ function Get-AbrWinFOClusterResource { $OutObj | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } diff --git a/Src/Private/Get-AbrWinFOClusterSharedVolume.ps1 b/Src/Private/Get-AbrWinFOClusterSharedVolume.ps1 index b1133b2..890c6fa 100644 --- a/Src/Private/Get-AbrWinFOClusterSharedVolume.ps1 +++ b/Src/Private/Get-AbrWinFOClusterSharedVolume.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinFOClusterSharedVolume { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.0 + Version: 0.5.2 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,37 +21,40 @@ function Get-AbrWinFOClusterSharedVolume { begin { Write-PScriboMessage "FailOverCluster InfoLevel set at $($InfoLevel.FailOverCluster)." - Write-PscriboMessage "Collecting Host FailOver Cluster Shared Volume information." + Write-PScriboMessage "Collecting Host FailOver Cluster Shared Volume information." } process { try { - $Settings = Invoke-Command -Session $TempPssSession { Get-ClusterSharedVolume -Cluster $using:Cluster | Select-Object -Property * } | Sort-Object -Property Name + $Settings = Invoke-Command -Session $TempPssSession { Get-ClusterSharedVolume | Select-Object -Property * } | Sort-Object -Property Name if ($Settings) { Section -Style Heading3 "Cluster Shared Volume" { $OutObj = @() - foreach ($Setting in $Settings) { + foreach ($Setting in $Settings) { try { $inObj = [ordered] @{ 'Name' = $Setting.Name 'Owner Node' = $Setting.OwnerNode - 'Shared Volume' = $Setting.SharedVolumeInfo.FriendlyVolumeName + 'Shared Volume' = Switch ([string]::IsNullOrEmpty($Setting.SharedVolumeInfo.FriendlyVolumeName)) { + $true {"Unknown"} + $false {$Setting.SharedVolumeInfo.FriendlyVolumeName} + default {"--"} + } 'State' = $Setting.State } $OutObj += [pscustomobject]$inobj - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } if ($HealthCheck.FailOverCluster.ClusterSharedVolume) { - $OutObj | Where-Object { $_.'State' -notlike 'Online'} | Set-Style -Style Warning -Property 'State' + $OutObj | Where-Object { $_.'State' -notlike 'Online' } | Set-Style -Style Warning -Property 'State' } $TableParams = @{ - Name = "Cluster Shared Volume - $($Cluster.toUpper().split(".")[0])" + Name = "Cluster Shared Volume - $($Cluster)" List = $false ColumnWidths = 25, 25, 35, 15 } @@ -63,9 +66,8 @@ function Get-AbrWinFOClusterSharedVolume { Get-AbrWinFOClusterSharedVolumeState } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } diff --git a/Src/Private/Get-AbrWinFOClusterSharedVolumeState.ps1 b/Src/Private/Get-AbrWinFOClusterSharedVolumeState.ps1 index 052bb79..c24cefb 100644 --- a/Src/Private/Get-AbrWinFOClusterSharedVolumeState.ps1 +++ b/Src/Private/Get-AbrWinFOClusterSharedVolumeState.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinFOClusterSharedVolumeState { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.0 + Version: 0.5.2 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -21,16 +21,16 @@ function Get-AbrWinFOClusterSharedVolumeState { begin { Write-PScriboMessage "FailOverCluster InfoLevel set at $($InfoLevel.FailOverCluster)." - Write-PscriboMessage "Collecting Host FailOver Cluster Shared Volume State information." + Write-PScriboMessage "Collecting Host FailOver Cluster Shared Volume State information." } process { try { - $Settings = Invoke-Command -Session $TempPssSession { Get-ClusterSharedVolumeState -Cluster $using:Cluster | Select-Object -Property * } | Sort-Object -Property Name + $Settings = Invoke-Command -Session $TempPssSession { Get-ClusterSharedVolumeState | Select-Object -Property * } | Sort-Object -Property Name if ($Settings) { Section -Style Heading4 "Cluster Shared Volume State" { $OutObj = @() - foreach ($Setting in $Settings) { + foreach ($Setting in $Settings) { try { $inObj = [ordered] @{ 'Name' = $Setting.Name @@ -40,14 +40,17 @@ function Get-AbrWinFOClusterSharedVolumeState { 'Volume Path' = $Setting.VolumeName } $OutObj += [pscustomobject]$inobj + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message - } + } + + if ($HealthCheck.FailOverCluster.ClusterSharedVolume) { + $OutObj | Where-Object { $_.State.Value -eq 'Unavailable' } | Set-Style -Style Warning -Property 'State' } $TableParams = @{ - Name = "Cluster Shared Volume State - $($Cluster.toUpper().split(".")[0])" + Name = "Cluster Shared Volume State - $($Cluster)" List = $false ColumnWidths = 20, 20, 20, 20, 20 } @@ -57,9 +60,8 @@ function Get-AbrWinFOClusterSharedVolumeState { $OutObj | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } diff --git a/Src/Private/Get-AbrWinHostHWSummary.ps1 b/Src/Private/Get-AbrWinHostHWSummary.ps1 index 290a3ee..70fdbc8 100644 --- a/Src/Private/Get-AbrWinHostHWSummary.ps1 +++ b/Src/Private/Get-AbrWinHostHWSummary.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinHostHWSummary { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.2.0 + Version: 0.5.2 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -21,7 +21,7 @@ function Get-AbrWinHostHWSummary { begin { Write-PScriboMessage "Hardware InfoLevel set at $($InfoLevel.Hardware)." - Write-PscriboMessage "Collecting Host Inventory information." + Write-PScriboMessage "Collecting Host Inventory information." } process { @@ -38,9 +38,8 @@ function Get-AbrWinHostHWSummary { 'BIOS Version' = $HostBIOS.Version 'Processor Manufacturer' = $HostCPU[0].Manufacturer 'Processor Model' = $HostCPU[0].Name - 'Number of Processors' = $HostCPU.Length - 'Number of CPU Cores' = $HostCPU[0].NumberOfCores - 'Number of Logical Cores' = $HostCPU[0].NumberOfLogicalProcessors + 'Number of CPU Cores' = ($HostCPU.NumberOfCores | Measure-Object -Sum).Sum + 'Number of Logical Cores' = ($HostCPU.NumberOfLogicalProcessors | Measure-Object -Sum).Sum 'Physical Memory' = "$([Math]::Round($HostComputer.TotalPhysicalMemory / 1Gb)) GB" } $TableParams = @{ @@ -53,9 +52,8 @@ function Get-AbrWinHostHWSummary { } $HostHardware | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } diff --git a/Src/Private/Get-AbrWinHostStorage.ps1 b/Src/Private/Get-AbrWinHostStorage.ps1 index bdf5c1b..77b13dd 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.2.0 + Version: 0.5.2 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -21,7 +21,7 @@ function Get-AbrWinHostStorage { begin { Write-PScriboMessage "Storage InfoLevel set at $($InfoLevel.Storage)." - Write-PscriboMessage "Collecting Host Storage information." + Write-PScriboMessage "Collecting Host Storage information." } process { @@ -31,7 +31,7 @@ function Get-AbrWinHostStorage { if ($HostDisks) { Section -Style Heading3 'Local Disks' { Paragraph 'The following table details physical disks installed in the host' - Blankline + BlankLine $LocalDiskReport = @() ForEach ($Disk in $HostDisks) { try { @@ -43,9 +43,8 @@ function Get-AbrWinHostStorage { 'Disk Size' = "$([Math]::Round($Disk.Size / 1Gb)) GB" } $LocalDiskReport += $TempLocalDiskReport - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } $TableParams = @{ @@ -59,9 +58,8 @@ function Get-AbrWinHostStorage { $LocalDiskReport | Sort-Object -Property 'Disk Number' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } #Report any SAN Disks if they exist try { @@ -69,7 +67,7 @@ function Get-AbrWinHostStorage { if ($SanDisks) { Section -Style Heading3 'SAN Disks' { Paragraph 'The following section details SAN disks connected to the host' - Blankline + BlankLine $SanDiskReport = @() ForEach ($Disk in $SanDisks) { try { @@ -81,9 +79,8 @@ function Get-AbrWinHostStorage { 'Disk Size' = "$([Math]::Round($Disk.Size / 1Gb)) GB" } $SanDiskReport += $TempSanDiskReport - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } $TableParams = @{ @@ -97,9 +94,8 @@ function Get-AbrWinHostStorage { $SanDiskReport | Sort-Object -Property 'Disk Number' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } diff --git a/Src/Private/Get-AbrWinHostStorageISCSI.ps1 b/Src/Private/Get-AbrWinHostStorageISCSI.ps1 index b9062eb..3d4581c 100644 --- a/Src/Private/Get-AbrWinHostStorageISCSI.ps1 +++ b/Src/Private/Get-AbrWinHostStorageISCSI.ps1 @@ -5,7 +5,7 @@ function Get-AbrWinHostStorageISCSI { .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.2.0 + Version: 0.5.2 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -21,7 +21,7 @@ function Get-AbrWinHostStorageISCSI { begin { Write-PScriboMessage "Storage InfoLevel set at $($InfoLevel.Storage)." - Write-PscriboMessage "Collecting Host Storage ISCSI information." + Write-PScriboMessage "Collecting Host Storage ISCSI information." } process { @@ -31,37 +31,40 @@ function Get-AbrWinHostStorageISCSI { if ($iSCSICheck.Status -eq 'Running') { Section -Style Heading3 'Host iSCSI Settings' { Paragraph 'The following section details the iSCSI configuration for the host' - Blankline + BlankLine try { $HostInitiator = Invoke-Command -Session $TempPssSession -ScriptBlock { Get-InitiatorPort } if ($HostInitiator) { - Section -Style Heading4 'iSCSI Target Server' { - Paragraph 'The following table details the hosts iSCI IQN' - Blankline + Section -Style Heading4 'iSCSI Host Initiator' { + Paragraph 'The following table details the hosts iSCSI IQN' + BlankLine $HostInitiatorReport = @() try { $TempHostInitiator = [PSCustomObject]@{ 'Node Address' = $HostInitiator.NodeAddress 'Operational Status' = Switch ($HostInitiator.OperationalStatus) { - 1 {'Unknown'} - 2 {'Operational'} - 3 {'User Offline'} - 4 {'Bypassed'} - 5 {'In diagnostics mode'} - 6 {'Link Down'} - 7 {'Port Error'} - 8 {'Loopback'} - default {$HostInitiator.OperationalStatus} + 1 { 'Unknown' } + 2 { 'Operational' } + 3 { 'User Offline' } + 4 { 'Bypassed' } + 5 { 'In diagnostics mode' } + 6 { 'Link Down' } + 7 { 'Port Error' } + 8 { 'Loopback' } + default { $HostInitiator.OperationalStatus } } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } $HostInitiatorReport += $TempHostInitiator + if ($HealthCheck.Storage.BP) { + $HostInitiatorReport | Where-Object { $_.'Operational Status' -ne 'Operational' } | Set-Style -Style Warning -Property 'Operational Status' + } + $TableParams = @{ - Name = "Host IQN" + Name = "iSCSI Host Initiator" List = $false ColumnWidths = 60, 40 } @@ -73,10 +76,10 @@ function Get-AbrWinHostStorageISCSI { } $HostIscsiTargetServers = Invoke-Command -Session $TempPssSession -ScriptBlock { Get-IscsiTargetPortal } - if($HostIscsiTargetServers){ + if ($HostIscsiTargetServers) { Section -Style Heading4 'iSCSI Target Server' { Paragraph 'The following table details iSCSI Target Server details' - Blankline + BlankLine $HostIscsiTargetServerReport = @() ForEach ($HostIscsiTargetServer in $HostIscsiTargetServers) { try { @@ -85,9 +88,8 @@ function Get-AbrWinHostStorageISCSI { 'Target Portal Port Number' = $HostIscsiTargetServer.TargetPortalPortNumber } $HostIscsiTargetServerReport += $TempHostIscsiTargetServerReport - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } $TableParams = @{ @@ -101,16 +103,15 @@ function Get-AbrWinHostStorageISCSI { $HostIscsiTargetServerReport | Sort-Object -Property 'Target Portal Address' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } try { $HostIscsiTargetVolumes = Invoke-Command -Session $TempPssSession -ScriptBlock { Get-IscsiTarget } - if($HostIscsiTargetVolumes){ + if ($HostIscsiTargetVolumes) { Section -Style Heading4 'iSCIS Target Volumes' { Paragraph 'The following table details iSCSI target volumes' - Blankline + BlankLine $HostIscsiTargetVolumeReport = @() ForEach ($HostIscsiTargetVolume in $HostIscsiTargetVolumes) { try { @@ -119,11 +120,15 @@ function Get-AbrWinHostStorageISCSI { 'Node Connected' = ConvertTo-TextYN $HostIscsiTargetVolume.IsConnected } $HostIscsiTargetVolumeReport += $TempHostIscsiTargetVolumeReport - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } + + if ($HealthCheck.Storage.BP) { + $HostIscsiTargetVolumeReport | Where-Object { $_.'Node Connected' -ne 'Yes' } | Set-Style -Style Warning -Property 'Node Connected' + } + $TableParams = @{ Name = "iSCIS Target Volumes" List = $false @@ -135,16 +140,15 @@ function Get-AbrWinHostStorageISCSI { $HostIscsiTargetVolumeReport | Sort-Object -Property 'Node Address' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } try { $HostIscsiConnections = Invoke-Command -Session $TempPssSession -ScriptBlock { Get-IscsiConnection } - if($HostIscsiConnections){ + if ($HostIscsiConnections) { Section -Style Heading4 'iSCSI Connections' { Paragraph 'The following table details iSCSI Connections' - Blankline + BlankLine $HostIscsiConnectionsReport = @() ForEach ($HostIscsiConnection in $HostIscsiConnections) { try { @@ -154,9 +158,8 @@ function Get-AbrWinHostStorageISCSI { 'Target Address' = $HostIscsiConnection.TargetAddress } $HostIscsiConnectionsReport += $TempHostIscsiConnectionsReport - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } $TableParams = @{ @@ -170,15 +173,13 @@ function Get-AbrWinHostStorageISCSI { $HostIscsiConnectionsReport | Sort-Object -Property 'Connection Identifier' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } diff --git a/Src/Private/Get-AbrWinHostStorageMPIO.ps1 b/Src/Private/Get-AbrWinHostStorageMPIO.ps1 index 3edf1f8..5fbda12 100644 --- a/Src/Private/Get-AbrWinHostStorageMPIO.ps1 +++ b/Src/Private/Get-AbrWinHostStorageMPIO.ps1 @@ -1,12 +1,11 @@ -function Get-AbrWinHostStorageMPIO - { +function Get-AbrWinHostStorageMPIO { <# .SYNOPSIS Used by As Built Report to retrieve Windows Server Host Storage MPIO information. .DESCRIPTION Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.2.0 + Version: 0.5.2 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -22,7 +21,7 @@ function Get-AbrWinHostStorageMPIO begin { Write-PScriboMessage "Storage InfoLevel set at $($InfoLevel.Storage)." - Write-PscriboMessage "Collecting Host Storage MPIO information." + Write-PScriboMessage "Collecting Host Storage MPIO information." } process { @@ -33,15 +32,15 @@ function Get-AbrWinHostStorageMPIO try { Section -Style Heading3 'Host MPIO Settings' { Paragraph 'The following section details host MPIO Settings' - Blankline + BlankLine [string]$MpioLoadBalance = Invoke-Command -Session $TempPssSession -ScriptBlock { Get-MSDSMGlobalDefaultLoadBalancePolicy } Paragraph "The default load balancing policy is: $MpioLoadBalance" - Blankline + BlankLine $MpioAutoClaim = Invoke-Command -Session $TempPssSession -ScriptBlock { Get-MSDSMAutomaticClaimSettings | Select-Object -ExpandProperty Keys } if ($MpioAutoClaim) { Section -Style Heading4 'Multipath I/O AutoClaim' { Paragraph 'The following table details the BUS types MPIO will automatically claim for' - Blankline + BlankLine $MpioAutoClaimReport = @() foreach ($key in $MpioAutoClaim) { try { @@ -49,9 +48,8 @@ function Get-AbrWinHostStorageMPIO $Temp.BusType = $key $Temp.State = 'Enabled' $MpioAutoClaimReport += $Temp - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } $TableParams = @{ @@ -70,7 +68,7 @@ function Get-AbrWinHostStorageMPIO if ($MpioAvailableHws) { Section -Style Heading4 'MPIO Detected Hardware' { Paragraph 'The following table details the hardware detected and claimed by MPIO' - Blankline + BlankLine $MpioAvailableHwReport = @() foreach ($MpioAvailableHw in $MpioAvailableHws) { try { @@ -81,9 +79,8 @@ function Get-AbrWinHostStorageMPIO 'Multipathed' = ConvertTo-TextYN $MpioAvailableHw.IsMultipathed } $MpioAvailableHwReport += $TempMpioAvailableHwReport - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } $TableParams = @{ @@ -97,19 +94,16 @@ function Get-AbrWinHostStorageMPIO $MpioAvailableHwReport | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } diff --git a/Src/Private/Get-AbrWinHostStorageVolume.ps1 b/Src/Private/Get-AbrWinHostStorageVolume.ps1 index 2b4c447..8814443 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.2.0 + Version: 0.5.2 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport diff --git a/Src/Private/Get-AbrWinHyperVHostVM.ps1 b/Src/Private/Get-AbrWinHyperVHostVM.ps1 index c4e32ef..e356635 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.2.0 + Version: 0.5.2 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -21,18 +21,18 @@ function Get-AbrWinHyperVHostVM { begin { Write-PScriboMessage "Hyper-V InfoLevel set at $($InfoLevel.HyperV)." - Write-PscriboMessage "Collecting Hyper-V VM information." + Write-PScriboMessage "Collecting Hyper-V VM information." } process { if ($InfoLevel.HyperV -ge 1) { #$Vms = Get-VM -CimSession $TempCimSession - $global:Vms = Invoke-Command -Session $TempPssSession { Get-VM } + $script:Vms = Invoke-Command -Session $TempPssSession { Get-VM } if ($Vms) { try { Section -Style Heading3 'Hyper-V VMs' { Paragraph 'The following section details the Hyper-V VMs running on this host' - Blankline + BlankLine $VmSummary = @() foreach ($Vm in $Vms) { try { @@ -41,9 +41,8 @@ function Get-AbrWinHyperVHostVM { 'State' = $Vm.State } $VmSummary += $TempVmSummary - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } $TableParams = @{ @@ -59,10 +58,10 @@ function Get-AbrWinHyperVHostVM { try { Section -Style Heading4 ($Vm.Name) { Paragraph 'The following sections detail the VM configuration settings' - Blankline + BlankLine try { Section -ExcludeFromTOC -Style NOTOCHeading5 'Virtual Machine Configuration' { - $DVDDrives = Invoke-Command -Session $TempPssSession -ScriptBlock{ Get-VMDvdDrive -VMName ($using:Vm).Name} + $DVDDrives = Invoke-Command -Session $TempPssSession -ScriptBlock { Get-VMDvdDrive -VMName ($using:Vm).Name } $VmConfiguration = [PSCustomObject]@{ 'VM id' = $Vm.VMid 'VM Path' = $Vm.Path @@ -80,7 +79,7 @@ function Get-AbrWinHyperVHostVM { 'Parent Snapshot Id' = ConvertTo-EmptyToFiller $Vm.ParentSnapshotId 'Parent Snapshot Name' = ConvertTo-EmptyToFiller $Vm.ParentSnapshotName 'Generation' = $Vm.Generation - 'DVD Drives' = $DVDDrives | ForEach-Object {"Controller Type: $($_.ControllerType), Media Type: $($_.DvdMediaType), Path: $($_.Path)"} + 'DVD Drives' = $DVDDrives | ForEach-Object { "Controller Type: $($_.ControllerType), Media Type: $($_.DvdMediaType), Path: $($_.Path)" } } $TableParams = @{ Name = "Virtual Machines" @@ -92,14 +91,13 @@ function Get-AbrWinHyperVHostVM { } $VmConfiguration | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } try { Section -ExcludeFromTOC -Style NOTOCHeading5 'Virtual Machine Guest Integration Service' { $VmIntegrationServiceSummary = @() - $VMIntegrationService = Invoke-Command -Session $TempPssSession -ScriptBlock{ Get-VMIntegrationService -VMName ($using:Vm).Name} + $VMIntegrationService = Invoke-Command -Session $TempPssSession -ScriptBlock { Get-VMIntegrationService -VMName ($using:Vm).Name } Foreach ($Service in $VMIntegrationService) { try { $TempVmIntegrationServiceSummary = [PSCustomObject]@{ @@ -108,9 +106,8 @@ function Get-AbrWinHyperVHostVM { 'Primary Status' = ConvertTo-EmptyToFiller $Service.PrimaryStatusDescription } $VmIntegrationServiceSummary += $TempVmIntegrationServiceSummary - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } $TableParams = @{ @@ -123,13 +120,12 @@ function Get-AbrWinHyperVHostVM { } $VmIntegrationServiceSummary | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } try { #$VmNetworkAdapters = Get-VMNetworkAdapter -CimSession $TempCimSession -VMName $VM.Name - $VmNetworkAdapters = Invoke-Command -Session $TempPssSession -ScriptBlock{ Get-VMNetworkAdapter -VMName ($using:Vm).Name } + $VmNetworkAdapters = Invoke-Command -Session $TempPssSession -ScriptBlock { Get-VMNetworkAdapter -VMName ($using:Vm).Name } if ($VmNetworkAdapters) { Section -ExcludeFromTOC -Style NOTOCHeading5 'VM Network Adapters' { $VmNetworkAdapterReport = @() @@ -142,9 +138,8 @@ function Get-AbrWinHyperVHostVM { 'Switch Name' = $Adapter.SwitchName } $VmNetworkAdapterReport += $TempVmNetworkAdapter - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } @@ -159,13 +154,12 @@ function Get-AbrWinHyperVHostVM { $VmNetworkAdapterReport | Sort-Object -Property 'Name' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } try { #$VmAdapterVlan = Get-VMNetworkAdapterVlan -CimSession $TempCimSession -VMName $VM.Name - $VmAdapterVlan = Invoke-Command -Session $TempPssSession -ScriptBlock{ Get-VMNetworkAdapterVlan -VMName ($using:Vm).Name | Select-Object -Property * } + $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 = @() @@ -178,9 +172,8 @@ function Get-AbrWinHyperVHostVM { 'Trunk Vlans' = $Adapter.AllowedVlanIdList -Join "," } $VmAdapterVlanReport += $TempVmAdapterVlanReport - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } @@ -195,19 +188,18 @@ function Get-AbrWinHyperVHostVM { $VmAdapterVlanReport | Sort-Object -Property 'Adapter Name' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } try { - #$VmHardDisks = Get-VMHardDiskDrive -CimSession $TempCimSession -VMName $VM.Name - $VmHardDisks =Invoke-Command -Session $TempPssSession -ScriptBlock{ Get-VMHardDiskDrive -VMName ($using:Vm).Name } + #$VmHardDisks = Get-VMHardDiskDrive -CimSession $TempCimSession -VMName $VM.Name + $VmHardDisks = Invoke-Command -Session $TempPssSession -ScriptBlock { Get-VMHardDiskDrive -VMName ($using:Vm).Name } if ($VmHardDisks) { Section -ExcludeFromTOC -Style NOTOCHeading5 'VM Hard Disks' { $VmDiskReport = @() foreach ($VmHardDisk in $VMHardDisks) { try { - $VmVhd = Invoke-Command -Session $TempPssSession -ScriptBlock{ Get-VHD -Path ($using:VmHardDisk).Path } + $VmVhd = Invoke-Command -Session $TempPssSession -ScriptBlock { Get-VHD -Path ($using:VmHardDisk).Path } $TempVmDiskReport = [PSCustomObject]@{ 'Disk Path' = $VmVhd.Path 'Disk Format' = $VmVhd.VhdFormat @@ -219,9 +211,8 @@ function Get-AbrWinHyperVHostVM { 'Bus Location' = $VmHardDisk.ControllerLocation } $VmDiskReport += $TempVmDiskReport - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } @@ -236,20 +227,17 @@ function Get-AbrWinHyperVHostVM { $VmDiskReport | Sort-Object -Property 'Disk Path' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } diff --git a/Src/Private/Get-AbrWinHyperVNetworking.ps1 b/Src/Private/Get-AbrWinHyperVNetworking.ps1 index dbb02f9..3fe3367 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.2.0 + Version: 0.5.2 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -21,7 +21,7 @@ function Get-AbrWinHyperVNetworking { begin { Write-PScriboMessage "Hyper-V InfoLevel set at $($InfoLevel.HyperV)." - Write-PscriboMessage "Collecting Hyper-V Networking information." + Write-PScriboMessage "Collecting Hyper-V Networking information." } process { @@ -31,14 +31,14 @@ function Get-AbrWinHyperVNetworking { Section -Style Heading3 "Hyper-V MAC Pool settings" { $VmHostMacPool = [PSCustomObject]@{ 'Mac Address Minimum' = Switch (($VmHost.MacAddressMinimum).Length) { - 0 {"-"} - 12 {$VmHost.MacAddressMinimum -replace '..(?!$)', '$&:'} - default {$VmHost.MacAddressMinimum} + 0 { "--" } + 12 { $VmHost.MacAddressMinimum -replace '..(?!$)', '$&:' } + default { $VmHost.MacAddressMinimum } } 'Mac Address Maximum' = Switch (($VmHost.MacAddressMaximum).Length) { - 0 {"-"} - 12 {$VmHost.MacAddressMaximum -replace '..(?!$)', '$&:'} - default {$VmHost.MacAddressMinimum} + 0 { "--" } + 12 { $VmHost.MacAddressMaximum -replace '..(?!$)', '$&:' } + default { $VmHost.MacAddressMinimum } } } $TableParams = @{ @@ -51,16 +51,15 @@ function Get-AbrWinHyperVNetworking { } $VmHostMacPool | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } try { $VmOsAdapters = Invoke-Command -Session $TempPssSession { Get-VMNetworkAdapter -ManagementOS | Select-Object -Property * } if ($VmOsAdapters) { Section -Style Heading3 "Hyper-V Management OS Adapters" { Paragraph 'The following table details the Management OS Virtual Adapters created on Virtual Switches' - Blankline + BlankLine $VmOsAdapterReport = @() Foreach ($VmOsAdapter in $VmOsAdapters) { try { @@ -74,9 +73,8 @@ function Get-AbrWinHyperVNetworking { 'Vlan ID' = $AdapterVlan.AccessVlanId } $VmOsAdapterReport += $TempVmOsAdapterReport - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } $TableParams = @{ @@ -90,16 +88,15 @@ function Get-AbrWinHyperVNetworking { $VmOsAdapterReport | Sort-Object -Property 'Name' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } try { $VmSwitches = Invoke-Command -Session $TempPssSession { Get-VMSwitch } if ($VmSwitches) { Section -Style Heading3 "Hyper-V vSwitch Settings" { Paragraph 'The following table provide a summary of Hyper-V configured vSwitches' - Blankline + BlankLine $VmSwitchesReport = @() ForEach ($VmSwitch in $VmSwitches) { try { @@ -110,9 +107,8 @@ function Get-AbrWinHyperVNetworking { 'Interface Description' = ConvertTo-EmptyToFiller $VmSwitch.NetAdapterInterfaceDescription } $VmSwitchesReport += $TempVmSwitchesReport - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } @@ -153,20 +149,17 @@ function Get-AbrWinHyperVNetworking { } $VmSwitchReport | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } } + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message - } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } diff --git a/Src/Private/Get-AbrWinHyperVNuma.ps1 b/Src/Private/Get-AbrWinHyperVNuma.ps1 index ecd136a..9cdadfa 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.2.0 + Version: 0.5.2 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @jcolonfzenpr @@ -21,7 +21,7 @@ function Get-AbrWinHyperVNuma { begin { Write-PScriboMessage "Hyper-V InfoLevel set at $($InfoLevel.HyperV)." - Write-PscriboMessage "Collecting Hyper-V Numa information." + Write-PScriboMessage "Collecting Hyper-V Numa information." } process { @@ -36,12 +36,11 @@ function Get-AbrWinHyperVNuma { $TempVmHostNumaReport = [PSCustomObject]@{ 'Numa Node Id' = $Node.NodeId 'Memory Available' = "$([math]::Round(($Node.MemoryAvailable)/1024,0)) GB" - 'Memory Total' = "$([math]::Round(($Node.MemoryTotal)/1024,0)) GB" + 'Memory Total' = "$([math]::Round(($Node.MemoryTotal)/1024,0)) GB" } $VmHostNumaReport += $TempVmHostNumaReport - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } $TableParams = @{ @@ -55,9 +54,8 @@ function Get-AbrWinHyperVNuma { $VmHostNumaReport | Sort-Object -Property 'Numa Node Id' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } diff --git a/Src/Private/Get-AbrWinHyperVSummary.ps1 b/Src/Private/Get-AbrWinHyperVSummary.ps1 index d38c1b6..211499d 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.2.0 + Version: 0.5.2 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -21,13 +21,13 @@ function Get-AbrWinHyperVSummary { begin { Write-PScriboMessage "Hyper-V InfoLevel set at $($InfoLevel.HyperV)." - Write-PscriboMessage "Collecting Hyper-V Summary information." + Write-PScriboMessage "Collecting Hyper-V Summary information." } process { if ($InfoLevel.HyperV -ge 1) { try { - $Global:VmHost = Invoke-Command -Session $TempPssSession { Get-VMHost } + $script:VmHost = Invoke-Command -Session $TempPssSession { Get-VMHost } if ($VmHost) { $VmHostReport = [PSCustomObject]@{ 'Logical Processor Count' = $VmHost.LogicalProcessorCount @@ -53,9 +53,8 @@ function Get-AbrWinHyperVSummary { } $VmHostReport | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } diff --git a/Src/Private/Get-AbrWinIISSummary.ps1 b/Src/Private/Get-AbrWinIISSummary.ps1 index f8ba131..f6a7851 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.3.0 + Version: 0.5.2 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -20,14 +20,14 @@ function Get-AbrWinIISSummary { begin { Write-PScriboMessage "IIS InfoLevel set at $($InfoLevel.IIS)." - Write-PscriboMessage "Collecting IIS Summary information." + Write-PScriboMessage "Collecting IIS Summary information." } process { if ($InfoLevel.IIS -ge 1) { try { $IISApplicationDefaults = Invoke-Command -Session $TempPssSession { (Get-IISServerManager).ApplicationDefaults } - $IISSiteDefaults = Invoke-Command -Session $TempPssSession { (Get-IISServerManager).SiteDefaults | Select-Object ServerAutoStart,@{name='Directory'; Expression={$_.Logfile.Directory}} } + $IISSiteDefaults = Invoke-Command -Session $TempPssSession { (Get-IISServerManager).SiteDefaults | Select-Object ServerAutoStart, @{name = 'Directory'; Expression = { $_.Logfile.Directory } } } if ($IISApplicationDefaults -and $IISSiteDefaults) { try { $IISServerManagerReport = [PSCustomObject]@{ @@ -45,14 +45,12 @@ function Get-AbrWinIISSummary { $TableParams['Caption'] = "- $($TableParams.Name)" } $IISServerManagerReport | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } diff --git a/Src/Private/Get-AbrWinIISWebAppPool.ps1 b/Src/Private/Get-AbrWinIISWebAppPool.ps1 index eb50db0..d889108 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.3.0 + Version: 0.5.2 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -20,7 +20,7 @@ function Get-AbrWinIISWebAppPool { begin { Write-PScriboMessage "IIS InfoLevel set at $($InfoLevel.IIS)." - Write-PscriboMessage "Collecting IIS Sites information." + Write-PScriboMessage "Collecting IIS Sites information." } process { @@ -30,7 +30,7 @@ function Get-AbrWinIISWebAppPool { if ($IISWebAppPools) { Section -Style Heading3 'Application Pools' { Paragraph 'The following table lists IIS Application Pools' - Blankline + BlankLine $IISWebAppPoolsReport = @() foreach ($IISWebAppPool in $IISWebAppPools) { try { @@ -42,9 +42,8 @@ function Get-AbrWinIISWebAppPool { 'Start Mode' = $IISWebAppPool.StartMode } $IISWebAppPoolsReport += $TempIISWebAppPoolsReport - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } @@ -59,9 +58,8 @@ function Get-AbrWinIISWebAppPool { $IISWebAppPoolsReport | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } diff --git a/Src/Private/Get-AbrWinIISWebSite.ps1 b/Src/Private/Get-AbrWinIISWebSite.ps1 index 487013f..763470e 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.3.0 + Version: 0.5.2 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -74,7 +74,7 @@ function Get-AbrWinIISWebSite { 'Auto Start' = ConvertTo-TextYN $IISWebSite.serverAutoStart 'Enabled Protocols ' = $IISWebSite.enabledProtocols 'URL' = Switch (($SiteURL.ResponseUri).count) { - 0 {"-"} + 0 {"--"} default {$SiteURL.ResponseUri} } 'Path ' = $IISWebSite.physicalPath diff --git a/Src/Private/Get-AbrWinLocalAdmin.ps1 b/Src/Private/Get-AbrWinLocalAdmin.ps1 index d0265e9..08bdd76 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.2.0 + Version: 0.5.2 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -21,7 +21,7 @@ function Get-AbrWinLocalAdmin { begin { Write-PScriboMessage "Account InfoLevel set at $($InfoLevel.Account)." - Write-PscriboMessage "Collecting Local Administrator information." + Write-PScriboMessage "Collecting Local Administrator information." } process { @@ -38,9 +38,8 @@ function Get-AbrWinLocalAdmin { 'Account Source' = $LocalAdmin.PrincipalSource } $LocalAdminsReport += $TempLocalAdminsReport - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } $TableParams = @{ @@ -54,9 +53,8 @@ function Get-AbrWinLocalAdmin { $LocalAdminsReport | Sort-Object -Property 'Account Name' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } diff --git a/Src/Private/Get-AbrWinLocalGroup.ps1 b/Src/Private/Get-AbrWinLocalGroup.ps1 index 778dc15..1115bfe 100644 --- a/Src/Private/Get-AbrWinLocalGroup.ps1 +++ b/Src/Private/Get-AbrWinLocalGroup.ps1 @@ -21,7 +21,7 @@ function Get-AbrWinLocalGroup { begin { Write-PScriboMessage "Account InfoLevel set at $($InfoLevel.Account)." - Write-PscriboMessage "Collecting Local Groups information." + Write-PScriboMessage "Collecting Local Groups information." } process { @@ -34,13 +34,20 @@ function Get-AbrWinLocalGroup { try { $TempLocalGroupsReport = [PSCustomObject]@{ 'Group Name' = $LocalGroup.GroupName - 'Description' = $LocalGroup.Description - 'Members' = $LocalGroup.Members + 'Description' = Switch ([string]::IsNullOrEmpty($LocalGroup.Description)) { + $true { "--" } + $false { $LocalGroup.Description } + default { "Unknown" } + } + 'Members' = Switch ([string]::IsNullOrEmpty($LocalGroup.Members)) { + $true { "--" } + $false { $LocalGroup.Members } + default { "Unknown" } + } } $LocalGroupsReport += $TempLocalGroupsReport - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } $TableParams = @{ @@ -54,9 +61,8 @@ function Get-AbrWinLocalGroup { $LocalGroupsReport | Sort-Object -Property 'Group Name' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } diff --git a/Src/Private/Get-AbrWinLocalUser.ps1 b/Src/Private/Get-AbrWinLocalUser.ps1 index c1d1f83..2db9294 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.2.0 + Version: 0.5.2 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -21,7 +21,7 @@ function Get-AbrWinLocalUser { begin { Write-PScriboMessage "Account InfoLevel set at $($InfoLevel.Account)." - Write-PscriboMessage "Collecting Local Users information." + Write-PScriboMessage "Collecting Local Users information." } process { @@ -37,14 +37,13 @@ function Get-AbrWinLocalUser { 'Description' = $LocalUser.Description 'Account Enabled' = ConvertTo-TextYN $LocalUser.Enabled 'Last Logon Date' = Switch (($LocalUser.LastLogon).count) { - 0 {"-"} - default {$LocalUser.LastLogon.ToShortDateString()} + 0 { "--" } + default { $LocalUser.LastLogon.ToShortDateString() } } } $LocalUsersReport += $TempLocalUsersReport - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } $TableParams = @{ @@ -58,9 +57,8 @@ function Get-AbrWinLocalUser { $LocalUsersReport | Sort-Object -Property 'User Name' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } diff --git a/Src/Private/Get-AbrWinNetAdapter.ps1 b/Src/Private/Get-AbrWinNetAdapter.ps1 index 7d22323..2a572b1 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.2.0 + Version: 0.5.2 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -21,7 +21,7 @@ function Get-AbrWinNetAdapter { begin { Write-PScriboMessage "Networking InfoLevel set at $($InfoLevel.Networking)." - Write-PscriboMessage "Collecting Network Adapter information." + Write-PScriboMessage "Collecting Network Adapter information." } process { @@ -40,9 +40,8 @@ function Get-AbrWinNetAdapter { 'Link Speed' = $HostAdapter.LinkSpeed } $HostAdaptersReport += $TempHostAdaptersReport - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } $TableParams = @{ @@ -56,9 +55,8 @@ function Get-AbrWinNetAdapter { $HostAdaptersReport | Sort-Object -Property 'Adapter Name' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } diff --git a/Src/Private/Get-AbrWinNetAdapterMTU.ps1 b/Src/Private/Get-AbrWinNetAdapterMTU.ps1 index c7cec06..6aef404 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.2.0 + Version: 0.5.2 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -21,7 +21,7 @@ function Get-AbrWinNetAdapterMTU { begin { Write-PScriboMessage "Networking InfoLevel set at $($InfoLevel.Networking)." - Write-PscriboMessage "Collecting Network Adapter Interfaces MTU information." + Write-PScriboMessage "Collecting Network Adapter Interfaces MTU information." } process { @@ -38,9 +38,8 @@ function Get-AbrWinNetAdapterMTU { 'MTU Size' = $NetMtu.DisplayValue } $NetMtuReport += $TempNetMtuReport - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } $TableParams = @{ @@ -54,9 +53,8 @@ function Get-AbrWinNetAdapterMTU { $NetMtuReport | Sort-Object -Property 'Adapter Name' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } diff --git a/Src/Private/Get-AbrWinNetDNSClient.ps1 b/Src/Private/Get-AbrWinNetDNSClient.ps1 index db6b76c..1b981d8 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.2.0 + Version: 0.5.2 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -21,7 +21,7 @@ function Get-AbrWinNetDNSClient { begin { Write-PScriboMessage "Networking InfoLevel set at $($InfoLevel.Networking)." - Write-PscriboMessage "Collecting Network DNS Client information." + Write-PScriboMessage "Collecting Network DNS Client information." } process { @@ -31,7 +31,7 @@ function Get-AbrWinNetDNSClient { if ($DnsClient) { Section -Style Heading3 'DNS Client' { Paragraph 'The following table details the DNS Seach Domains' - Blankline + BlankLine $DnsClientReport = [PSCustomObject]@{ 'DNS Suffix' = $DnsClient.SuffixSearchList -Join "," 'Use Suffix Search List' = ConvertTo-TextYN $DnsClient.UseSuffixSearchList @@ -49,9 +49,8 @@ function Get-AbrWinNetDNSClient { $DnsClientReport | Sort-Object -Property 'DNS Suffix' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } diff --git a/Src/Private/Get-AbrWinNetDNSServer.ps1 b/Src/Private/Get-AbrWinNetDNSServer.ps1 index 622bcbc..417cc40 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.2.0 + Version: 0.5.2 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -21,7 +21,7 @@ function Get-AbrWinNetDNSServer { begin { Write-PScriboMessage "Networking InfoLevel set at $($InfoLevel.Networking)." - Write-PscriboMessage "Collecting Network DNS Server information." + Write-PScriboMessage "Collecting Network DNS Server information." } process { @@ -31,7 +31,7 @@ function Get-AbrWinNetDNSServer { if ($DnsServers) { Section -Style Heading3 'DNS Servers' { Paragraph 'The following table details the DNS Server Addresses Configured' - Blankline + BlankLine $DnsServerReport = @() ForEach ($DnsServer in $DnsServers) { try { @@ -40,9 +40,8 @@ function Get-AbrWinNetDNSServer { 'Server Address' = $DnsServer.ServerAddresses -Join "," } $DnsServerReport += $TempDnsServerReport - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } $TableParams = @{ @@ -56,9 +55,8 @@ function Get-AbrWinNetDNSServer { $DnsServerReport | Sort-Object -Property 'Interface' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } diff --git a/Src/Private/Get-AbrWinNetFirewall.ps1 b/Src/Private/Get-AbrWinNetFirewall.ps1 index f11e1ee..50a9de3 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.0 + Version: 0.5.2 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport diff --git a/Src/Private/Get-AbrWinNetIPAddress.ps1 b/Src/Private/Get-AbrWinNetIPAddress.ps1 index 2dcd917..19efb90 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.2.0 + Version: 0.5.2 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -21,7 +21,7 @@ function Get-AbrWinNetIPAddress { begin { Write-PScriboMessage "Networking InfoLevel set at $($InfoLevel.Networking)." - Write-PscriboMessage "Collecting Network IP Address information." + Write-PScriboMessage "Collecting Network IP Address information." } process { @@ -31,7 +31,7 @@ function Get-AbrWinNetIPAddress { if ($NetIPs) { Section -Style Heading3 'IP Addresses' { Paragraph 'The following table details IP Addresses assigned to hosts' - Blankline + BlankLine $NetIpsReport = @() ForEach ($NetIp in $NetIps) { try { @@ -40,12 +40,15 @@ function Get-AbrWinNetIPAddress { 'Interface Description' = $NetIp.InterfaceDescription 'IPv4 Addresses' = $NetIp.IPv4Address.IPAddress -Join "," 'Subnet Mask' = $NetIp.IPv4Address[0].PrefixLength - 'IPv4 Gateway' = $NetIp.IPv4DefaultGateway.NextHop + 'IPv4 Gateway' = Switch ([string]::IsNullOrEmpty($NetIp.IPv4DefaultGateway.NextHop)) { + $true { "--" } + $false { $NetIp.IPv4DefaultGateway.NextHop } + default { "Unknown" } + } } $NetIpsReport += $TempNetIpsReport - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } $TableParams = @{ @@ -59,9 +62,8 @@ function Get-AbrWinNetIPAddress { $NetIpsReport | Sort-Object -Property 'Interface Name' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } diff --git a/Src/Private/Get-AbrWinNetTeamInterface.ps1 b/Src/Private/Get-AbrWinNetTeamInterface.ps1 index cd03ab7..aa7d248 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.2.0 + Version: 0.5.2 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -21,7 +21,7 @@ function Get-AbrWinNetTeamInterface { begin { Write-PScriboMessage "Networking InfoLevel set at $($InfoLevel.Networking)." - Write-PscriboMessage "Collecting Network Team Interfaces information." + Write-PScriboMessage "Collecting Network Team Interfaces information." } process { @@ -31,7 +31,7 @@ function Get-AbrWinNetTeamInterface { if ($NetworkTeamCheck) { Section -Style Heading3 'Network Team Interfaces' { Paragraph 'The following table details Network Team Interfaces' - Blankline + BlankLine $NetTeams = Invoke-Command -Session $TempPssSession { Get-NetLbfoTeam } $NetTeamReport = @() ForEach ($NetTeam in $NetTeams) { @@ -43,9 +43,8 @@ function Get-AbrWinNetTeamInterface { 'Network Adapters' = $NetTeam.Members -Join "," } $NetTeamReport += $TempNetTeamReport - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } $TableParams = @{ @@ -59,9 +58,8 @@ function Get-AbrWinNetTeamInterface { $NetTeamReport | Sort-Object -Property 'Team Name' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } diff --git a/Src/Private/Get-AbrWinOSConfig.ps1 b/Src/Private/Get-AbrWinOSConfig.ps1 index 74811b4..0fa71b5 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.2.0 + Version: 0.5.2 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -21,27 +21,35 @@ function Get-AbrWinOSConfig { begin { Write-PScriboMessage "Operating System InfoLevel set at $($InfoLevel.OperatingSystem)." - Write-PscriboMessage "Collecting Oprating System Configuration information." + Write-PScriboMessage "Collecting Oprating System Configuration information." } process { if ($InfoLevel.OperatingSystem -ge 1) { Section -Style Heading3 'OS Configuration' { Paragraph 'The following section details hos OS configuration' - Blankline + BlankLine $HostOSReport = [PSCustomObject] @{ - 'Windows Product Name' = $HostInfo.WindowsProductName - 'Windows Version' = $HostInfo.WindowsCurrentVersion - 'Windows Build Number' = $HostInfo.OsVersion - 'Windows Install Type' = $HostInfo.WindowsInstallationType - 'AD Domain' = $HostInfo.CsDomain - 'Windows Installation Date' = switch (($HostInfo.OsInstallDate).count) { - 0 {'-'} - default {$HostInfo.OsInstallDate.ToShortDateString()} - } - 'Time Zone' = $HostInfo.TimeZone - 'License Type' = $HostLicense.ProductKeyChannel - 'Partial Product Key' = $HostLicense.PartialProductKey + 'Windows Product Name' = $HostInfo.WindowsProductName + 'Windows Version' = $HostInfo.WindowsCurrentVersion + 'Windows Build Number' = $HostInfo.OsVersion + 'Windows Install Type' = $HostInfo.WindowsInstallationType + 'AD Domain' = $HostInfo.CsDomain + 'Windows Installation Date' = switch (($HostInfo.OsInstallDate).count) { + 0 { "--" } + default { $HostInfo.OsInstallDate.ToShortDateString() } + } + 'Time Zone' = $HostInfo.TimeZone + 'License Type' = Switch ([string]::IsNullOrEmpty($HostLicense.ProductKeyChannel)) { + $true { "--" } + $false { $HostLicense.ProductKeyChannel } + default { "Unknown" } + } + 'Partial Product Key' = Switch ([string]::IsNullOrEmpty($HostLicense.PartialProductKey)) { + $true { "--" } + $false { $HostLicense.PartialProductKey } + default { "Unknown" } + } } $TableParams = @{ Name = "OS Settings" diff --git a/Src/Private/Get-AbrWinOSDriver.ps1 b/Src/Private/Get-AbrWinOSDriver.ps1 index e60adda..ff513dc 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.2.0 + Version: 0.5.2 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -21,7 +21,7 @@ function Get-AbrWinOSDriver { begin { Write-PScriboMessage "Operating System InfoLevel set at $($InfoLevel.OperatingSystem)." - Write-PscriboMessage "Collecting Operating System Drivers information." + Write-PScriboMessage "Collecting Operating System Drivers information." } process { @@ -42,7 +42,7 @@ function Get-AbrWinOSDriver { } $HostDriverReport += $TempDriver } catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + Write-PScriboMessage -IsWarning $_.Exception.Message } } $TableParams = @{ @@ -56,9 +56,8 @@ function Get-AbrWinOSDriver { $HostDriverReport | Sort-Object -Property 'Class Description' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } diff --git a/Src/Private/Get-AbrWinOSHotfix.ps1 b/Src/Private/Get-AbrWinOSHotfix.ps1 index 15fb9b2..a9ac66c 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.4.0 + Version: 0.5.2 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -21,7 +21,7 @@ function Get-AbrWinOSHotfix { begin { Write-PScriboMessage "Operating System InfoLevel set at $($InfoLevel.OperatingSystem)." - Write-PscriboMessage "Collecting Operating System HotFix information." + Write-PScriboMessage "Collecting Operating System HotFix information." } process { @@ -36,11 +36,15 @@ function Get-AbrWinOSHotfix { $TempHotFix = [PSCustomObject] @{ 'Hotfix ID' = $HotFix.HotFixID 'Description' = $HotFix.Description - 'Installation Date' = $HotFix.InstalledOn.ToShortDateString() + 'Installation Date' = Switch ([string]::IsNullOrEmpty($HotFix.InstalledOn)) { + $true {'--'} + $false {$HotFix.InstalledOn.ToShortDateString()} + default {'Unknown'} + } } $HotfixReport += $TempHotFix } catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + Write-PScriboMessage -IsWarning $_.Exception.Message } } $TableParams = @{ @@ -54,13 +58,12 @@ function Get-AbrWinOSHotfix { $HotFixReport | Sort-Object -Property 'Hotfix ID' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } try { $UpdObj = @() - $Updates = Invoke-Command -Session $TempPssSession -ScriptBlock {(New-Object -ComObject Microsoft.Update.Session).CreateupdateSearcher().Search("IsHidden=0 and IsInstalled=0").Updates | Select-Object Title,KBArticleIDs} + $Updates = Invoke-Command -Session $TempPssSession -ScriptBlock { (New-Object -ComObject Microsoft.Update.Session).CreateupdateSearcher().Search("IsHidden=0 and IsInstalled=0").Updates | Select-Object Title, KBArticleIDs } $UpdObj += if ($Updates) { $OutObj = @() foreach ($Update in $Updates) { @@ -74,9 +77,8 @@ function Get-AbrWinOSHotfix { if ($HealthCheck.OperatingSystem.Updates) { $OutObj | Set-Style -Style Warning } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } $TableParams = @{ @@ -96,9 +98,8 @@ function Get-AbrWinOSHotfix { $UpdObj } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } diff --git a/Src/Private/Get-AbrWinOSRoleFeature.ps1 b/Src/Private/Get-AbrWinOSRoleFeature.ps1 index 26cc81e..5fd65a9 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.2.0 + Version: 0.5.2 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -21,13 +21,13 @@ function Get-AbrWinOSRoleFeature { begin { Write-PScriboMessage "Operating System InfoLevel set at $($InfoLevel.OperatingSystem)." - Write-PscriboMessage "Collecting Role & Features information." + Write-PScriboMessage "Collecting Role & Features information." } process { if ($InfoLevel.OperatingSystem -ge 1 -and $OSType.Value -ne 'WorkStation') { try { - $HostRolesAndFeatures = Invoke-Command -Session $TempPssSession -ScriptBlock{ Get-WindowsFeature | Where-Object { $_.Installed -eq $True } } + $HostRolesAndFeatures = Invoke-Command -Session $TempPssSession -ScriptBlock { Get-WindowsFeature | Where-Object { $_.Installed -eq $True } } if ($HostRolesAndFeatures) { Section -Style Heading3 'Roles' { [array]$HostRolesAndFeaturesReport = @() @@ -41,7 +41,7 @@ function Get-AbrWinOSRoleFeature { } $HostRolesAndFeaturesReport += $TempHostRolesAndFeaturesReport } catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + Write-PScriboMessage -IsWarning $_.Exception.Message } } } @@ -69,7 +69,7 @@ function Get-AbrWinOSRoleFeature { } $HostRolesAndFeaturesReport += $TempHostRolesAndFeaturesReport } catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + Write-PScriboMessage -IsWarning $_.Exception.Message } } } @@ -84,16 +84,14 @@ function Get-AbrWinOSRoleFeature { $HostRolesAndFeaturesReport | Sort-Object -Property 'Name' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } diff --git a/Src/Private/Get-AbrWinOSService.ps1 b/Src/Private/Get-AbrWinOSService.ps1 index fffe50a..8a70653 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.3.0 + Version: 0.5.2 Author: Andrew Ramsay Editor: Jonathan Colon Twitter: @asbuiltreport @@ -21,22 +21,22 @@ function Get-AbrWinOSService { begin { Write-PScriboMessage "Operating System InfoLevel set at $($InfoLevel.OperatingSystem)." - Write-PscriboMessage "Collecting Operating System Service information." + Write-PScriboMessage "Collecting Operating System Service information." } process { if ($InfoLevel.OperatingSystem -ge 1) { try { - $Available = Invoke-Command -Session $TempPssSession -ScriptBlock {Get-Service "W32Time" | Select-Object DisplayName, Name, Status} + $Available = Invoke-Command -Session $TempPssSession -ScriptBlock { Get-Service "W32Time" | Select-Object DisplayName, Name, Status } if ($Available) { Section -Style Heading3 'Services' { 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') + 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 = @() Foreach ($Service in $Services) { try { - $Status = Invoke-Command -Session $TempPssSession -ScriptBlock {Get-Service $using:Service -ErrorAction SilentlyContinue | Select-Object DisplayName, Name, Status} + $Status = Invoke-Command -Session $TempPssSession -ScriptBlock { Get-Service $using:Service -ErrorAction SilentlyContinue | Select-Object DisplayName, Name, Status } if ($Status) { $TempServicesReport = [PSCustomObject] @{ 'Display Name' = $Status.DisplayName @@ -46,12 +46,12 @@ function Get-AbrWinOSService { $ServicesReport += $TempServicesReport } } catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + Write-PScriboMessage -IsWarning $_.Exception.Message } } if ($HealthCheck.OperatingSystem.Services) { - $ServicesReport | Where-Object { $_.'Status' -notlike 'Running'} | Set-Style -Style Warning -Property 'Status' + $ServicesReport | Where-Object { $_.'Status' -notlike 'Running' } | Set-Style -Style Warning -Property 'Status' } $TableParams = @{ @@ -65,9 +65,8 @@ function Get-AbrWinOSService { $ServicesReport | Sort-Object -Property 'Display Name' | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } diff --git a/Src/Private/Get-AbrWinSMBNetworkInterface.ps1 b/Src/Private/Get-AbrWinSMBNetworkInterface.ps1 index 38db80f..f31fd58 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.2.0 + Version: 0.5.2 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -20,7 +20,7 @@ function Get-AbrWinSMBNetworkInterface { begin { Write-PScriboMessage "SMB InfoLevel set at $($InfoLevel.SMB)." - Write-PscriboMessage "Collecting File Server Network Interface information." + Write-PScriboMessage "Collecting File Server Network Interface information." } process { @@ -30,23 +30,22 @@ function Get-AbrWinSMBNetworkInterface { if ($SMBNICs) { Section -Style Heading3 "SMB Network Interface" { Paragraph "The following table provide a summary of the SMB protocol network interface information" - Blankline + BlankLine $SMBNICReport = @() foreach ($SMBNIC in $SMBNICs) { try { $TempSMBNicReport = [PSCustomObject]@{ 'Name' = Switch (($SMBNIC.InterfaceIndex).count) { - 0 {"Unknown"} - default {Invoke-Command -Session $TempPssSession { (Get-NetAdapter -InterfaceIndex ($using:SMBNIC).InterfaceIndex).Name}} + 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 + 'RDMA Capable' = ConvertTo-TextYN $SMBNIC.RdmaCapable 'IP Address' = ConvertTo-TextYN $SMBNIC.IpAddress } $SMBNICReport += $TempSMBNicReport - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } @@ -61,9 +60,8 @@ function Get-AbrWinSMBNetworkInterface { $SMBNICReport | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } diff --git a/Src/Private/Get-AbrWinSMBShare.ps1 b/Src/Private/Get-AbrWinSMBShare.ps1 index 5e03e34..e634f83 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.3.0 + Version: 0.5.2 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -20,7 +20,7 @@ function Get-AbrWinSMBShare { begin { Write-PScriboMessage "SMB InfoLevel set at $($InfoLevel.SMB)." - Write-PscriboMessage "Collecting File Server Shares information." + Write-PScriboMessage "Collecting File Server Shares information." } process { @@ -29,19 +29,19 @@ function Get-AbrWinSMBShare { if ($SMBShares) { Section -Style Heading3 'File Shares' { Paragraph 'The following section details network shares' - Blankline + BlankLine $SMBSharesReport = @() foreach ($SMBShare in $SMBShares) { Section -Style Heading4 "$($SMBShare.Name) Share" { Paragraph "The following table details shares configuration" - Blankline + BlankLine try { $ShareAccess = Invoke-Command -Session $TempPssSession { Get-SmbShareAccess -Name ($using:SMBShare).Name } $TempSMBSharesReport = [PSCustomObject]@{ 'Name' = $SMBShare.Name 'Scope Name' = $SMBShare.ScopeName 'Path' = $SMBShare.Path - 'Description' = $SMBShare.Description + 'Description' = $SMBShare.Description 'Access Based Enumeration Mode' = $SMBShare.FolderEnumerationMode 'Caching Mode' = $SMBShare.CachingMode 'Encrypt Data' = ConvertTo-TextYN $SMBShare.EncryptData @@ -57,16 +57,15 @@ function Get-AbrWinSMBShare { $TableParams['Caption'] = "- $($TableParams.Name)" } $SMBSharesReport | Table @TableParams - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } try { $ShareAccess = Invoke-Command -Session $TempPssSession { Get-SmbShareAccess -Name ($using:SMBShare).Name } if ($ShareAccess) { Section -Style Heading5 'Permissions' { Paragraph "The following table details $($SMBShare.Name) shares permissions" - Blankline + BlankLine $ShareAccessReport = @() foreach ($SMBACL in $ShareAccess) { try { @@ -78,9 +77,8 @@ function Get-AbrWinSMBShare { } $ShareAccessReport += $TempSMBAccessReport - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } @@ -95,17 +93,15 @@ function Get-AbrWinSMBShare { $ShareAccessReport | Table @TableParams } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } diff --git a/Src/Private/Get-AbrWinSMBSummary.ps1 b/Src/Private/Get-AbrWinSMBSummary.ps1 index 183abdd..9611161 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.2.0 + Version: 0.5.2 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -20,13 +20,13 @@ function Get-AbrWinSMBSummary { begin { Write-PScriboMessage "SMB InfoLevel set at $($InfoLevel.SMB)." - Write-PscriboMessage "Collecting File Server Summary information." + Write-PScriboMessage "Collecting File Server Summary information." } process { if ($InfoLevel.SMB -ge 1) { try { - $SMBSummary = Get-SmbServerConfiguration -CimSession $TempCimSession | Select-Object AutoShareServer,EnableLeasing,EnableMultiChannel,EnableOplocks,KeepAliveTime,EnableSMB1Protocol,EnableSMB2Protocol + $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 @@ -37,6 +37,11 @@ function Get-AbrWinSMBSummary { 'SMB1 Protocol' = ConvertTo-TextYN $SMBSummary.EnableSMB1Protocol 'SMB2 Protocol' = ConvertTo-TextYN $SMBSummary.EnableSMB2Protocol } + + if ($HealthCheck.SMB.BP) { + $SMBSummaryReport | Where-Object { $_.'SMB1 Protocol' -eq 'Yes' } | Set-Style -Style Warning -Property 'SMB1 Protocol' + } + $TableParams = @{ Name = "SMB Server Settings" List = $true @@ -47,9 +52,8 @@ function Get-AbrWinSMBSummary { } $SMBSummaryReport | Table @TableParams } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } } diff --git a/Src/Private/Get-RequiredFeature.ps1 b/Src/Private/Get-RequiredFeature.ps1 index d38c409..94d4029 100644 --- a/Src/Private/Get-RequiredFeature.ps1 +++ b/Src/Private/Get-RequiredFeature.ps1 @@ -5,7 +5,7 @@ function Get-RequiredFeature { .DESCRIPTION Function to check if the required version of windows feature is installed .NOTES - Version: 0.1.0 + Version: 0.5.2 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -47,7 +47,7 @@ function Get-RequiredFeature { if ($OSType -eq 'WorkStation') { if ($Feature) { $RequiredFeature = Invoke-Command -Session $TempPssSession { Get-WindowsOptionalFeature -FeatureName $Using:Name -Online } - if ($Status) { + if ($Status) { if ($RequiredFeature.State -eq "Enabled") { return $true } else { @@ -60,8 +60,8 @@ function Get-RequiredFeature { } } } else { - $RequiredFeature = Invoke-Command -Session $TempPssSession { Get-WindowsCapability -online -Name $Using:Name } - if ($Status) { + $RequiredFeature = Invoke-Command -Session $TempPssSession { Get-WindowsCapability -Online -Name $Using:Name } + if ($Status) { if ($RequiredFeature.State -eq "Installed") { return $true } else { @@ -74,10 +74,9 @@ function Get-RequiredFeature { } } } - } - elseif ($OSType -eq 'Server' -or $OSType -eq 'DomainController') { + } elseif ($OSType -eq 'Server' -or $OSType -eq 'DomainController') { $RequiredFeature = Invoke-Command -Session $TempPssSession { Get-WindowsFeature -Name $Using:Name } - if ($Status) { + if ($Status) { if ($RequiredFeature.InstallState -eq 'Installed') { return $true } else { diff --git a/Src/Private/SharedUtilsFunctions.ps1 b/Src/Private/SharedUtilsFunctions.ps1 index 2a67f53..7eec124 100644 --- a/Src/Private/SharedUtilsFunctions.ps1 +++ b/Src/Private/SharedUtilsFunctions.ps1 @@ -16,23 +16,23 @@ function ConvertTo-TextYN { [CmdletBinding()] [OutputType([String])] Param - ( + ( [Parameter ( Position = 0, Mandatory)] - [AllowEmptyString()] - [string] - $TEXT - ) + [AllowEmptyString()] + [string] + $TEXT + ) switch ($TEXT) { - "" {"-"; break} - $Null {"-"; break} - "True" {"Yes"; break} - "False" {"No"; break} - default {$TEXT} - } - } # end + "" { "--"; break } + $Null { "--"; break } + "True" { "Yes"; break } + "False" { "No"; break } + default { $TEXT } + } +} # end function ConvertTo-FileSizeString { <# @@ -52,67 +52,36 @@ function ConvertTo-FileSizeString { [CmdletBinding()] [OutputType([String])] Param - ( + ( [Parameter ( Position = 0, Mandatory)] - [int64] - $Size - ) + [int64] + $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} + { $_ -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"} - } - } # end >> function Format-FileSize - -function Invoke-DcDiag { - <# - .SYNOPSIS - Used by As Built Report to get the dcdiag tests for a Domain Controller. - .DESCRIPTION - - .NOTES - Version: 0.4.0 - Author: Adam Bertram - - .EXAMPLE - - .LINK - - #> - param( - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string]$DomainController - ) - $result = Invoke-Command -Session $TempPssSession {dcdiag /s:$using:DomainController} - $result | select-string -pattern '\. (.*) \b(passed|failed)\b test (.*)' | ForEach-Object { - $obj = @{ - TestName = $_.Matches.Groups[3].Value - TestResult = $_.Matches.Groups[2].Value - Entity = $_.Matches.Groups[1].Value - } - [pscustomobject]$obj + { "0 KB" } } -}# end +} # end >> function Format-FileSize function ConvertTo-EmptyToFiller { <# .SYNOPSIS - Used by As Built Report to convert empty culumns to "-". + Used by As Built Report to convert empty culumns to "--". .DESCRIPTION .NOTES Version: 0.5.0 @@ -123,18 +92,17 @@ function ConvertTo-EmptyToFiller { [CmdletBinding()] [OutputType([String])] Param - ( + ( [Parameter ( Position = 0, Mandatory)] - [AllowEmptyString()] - [AllowNull()] - $TEXT - ) - + [AllowEmptyString()] + [string]$TEXT + ) + switch ([string]::IsNullOrEmpty($TEXT)) { - $true {"--"; break} - default {$TEXT} + $true { "--"; break } + default { $TEXT } } } @@ -156,13 +124,13 @@ function Convert-IpAddressToMaskLength { [CmdletBinding()] [OutputType([String])] Param - ( + ( [Parameter ( Position = 0, Mandatory)] - [string] - $SubnetMask - ) + [string] + $SubnetMask + ) [IPAddress] $MASK = $SubnetMask $octets = $MASK.IPAddressToString.Split('.') @@ -198,7 +166,7 @@ function ConvertTo-ADObjectName { ) $ADObject = @() foreach ($Object in $DN) { - $ADObject += Invoke-Command -Session $Session {Get-ADObject $using:Object | Select-Object -ExpandProperty Name} + $ADObject += Invoke-Command -Session $Session { Get-ADObject $using:Object | Select-Object -ExpandProperty Name } } return $ADObject; }# end diff --git a/Src/Public/Invoke-AsBuiltReport.Microsoft.Windows.ps1 b/Src/Public/Invoke-AsBuiltReport.Microsoft.Windows.ps1 index 6b5dd8d..375c4ec 100644 --- a/Src/Public/Invoke-AsBuiltReport.Microsoft.Windows.ps1 +++ b/Src/Public/Invoke-AsBuiltReport.Microsoft.Windows.ps1 @@ -39,10 +39,10 @@ function Invoke-AsBuiltReport.Microsoft.Windows { } } } Catch { - Write-PscriboMessage -IsWarning $_.Exception.Message - } + Write-PScriboMessage -IsWarning $_.Exception.Message + } - $currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent()) + $currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent()) if (-not $currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { @@ -51,12 +51,12 @@ function Invoke-AsBuiltReport.Microsoft.Windows { } # Import Report Configuration - $Report = $ReportConfig.Report - $InfoLevel = $ReportConfig.InfoLevel - $Options = $ReportConfig.Options + $script:Report = $ReportConfig.Report + $script:InfoLevel = $ReportConfig.InfoLevel + $script:Options = $ReportConfig.Options # Used to set values to TitleCase where required - $TextInfo = (Get-Culture).TextInfo + $script:TextInfo = (Get-Culture).TextInfo #region foreach loop foreach ($System in $Target) { @@ -66,8 +66,7 @@ function Invoke-AsBuiltReport.Microsoft.Windows { try { $script:TempPssSession = New-PSSession $System -Credential $Credential -Authentication Negotiate -ErrorAction stop $script:TempCimSession = New-CimSession $System -Credential $Credential -Authentication Negotiate -ErrorAction stop - } - catch { + } catch { Write-PScriboMessage -IsWarning "Unable to connect to $($System)" throw } @@ -79,7 +78,7 @@ function Invoke-AsBuiltReport.Microsoft.Windows { $script:HostCPU = Get-CimInstance -Class Win32_Processor -CimSession $TempCimSession $script:HostComputer = Get-CimInstance -Class Win32_ComputerSystem -CimSession $TempCimSession $script:HostBIOS = Get-CimInstance -Class Win32_Bios -CimSession $TempCimSession - $script:HostLicense = Get-CimInstance -Query 'Select * from SoftwareLicensingProduct' -CimSession $TempCimSession | Where-Object { $_.LicenseStatus -eq 1 } + $script:HostLicense = Get-CimInstance -Query 'Select * from SoftwareLicensingProduct' -CimSession $TempCimSession | Where-Object { $_.LicenseStatus -eq 1 } #Host Hardware Get-AbrWinHostHWSummary #Host OS @@ -87,7 +86,7 @@ function Invoke-AsBuiltReport.Microsoft.Windows { try { Section -Style Heading2 'Host Operating System' { Paragraph 'The following settings details host OS Settings' - Blankline + BlankLine #Host OS Configuration Get-AbrWinOSConfig #Host Hotfixes @@ -101,21 +100,20 @@ function Invoke-AsBuiltReport.Microsoft.Windows { # Host Service Status Get-AbrWinOSService } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } #Local Users and Groups if ($InfoLevel.Account -ge 1) { try { - $LocalUsers = Invoke-Command -Session $TempPssSession { Get-LocalUser | Where-Object {$_.PrincipalSource -ne "ActiveDirectory"} } - $LocalGroups = Invoke-Command -Session $TempPssSession { Get-LocalGroup | Where-Object {$_.PrincipalSource -ne "ActiveDirectory" } | ForEach-Object { [PSCustomObject]@{ GroupName = $_.Name; Description = $_.Description; Members = (Get-LocalGroupMember -Group $_.Name).Name } }} + $LocalUsers = Invoke-Command -Session $TempPssSession { Get-LocalUser | Where-Object { $_.PrincipalSource -ne "ActiveDirectory" } } + $LocalGroups = Invoke-Command -Session $TempPssSession { Get-LocalGroup | Where-Object { $_.PrincipalSource -ne "ActiveDirectory" } | ForEach-Object { [PSCustomObject]@{ GroupName = $_.Name; Description = $_.Description; Members = (Get-LocalGroupMember -Group $_.Name).Name } } } $LocalAdmins = Invoke-Command -Session $TempPssSession { Get-LocalGroupMember -Name 'Administrators' -ErrorAction SilentlyContinue } if ($LocalUsers -or $LocalGroups -or $LocalAdmins) { Section -Style Heading2 'Local Users and Groups' { Paragraph 'The following section details local configured users and groups' - Blankline + BlankLine #Local Users Get-AbrWinLocalUser #Local Groups @@ -124,9 +122,8 @@ function Invoke-AsBuiltReport.Microsoft.Windows { Get-AbrWinLocalAdmin } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } #Host Firewall @@ -136,7 +133,7 @@ function Invoke-AsBuiltReport.Microsoft.Windows { try { Section -Style Heading2 'Host Networking' { Paragraph 'The following section details Host Network Configuration' - Blankline + BlankLine #Host Network Adapter Get-AbrWinNetAdapter #Host Network IP Address @@ -150,9 +147,8 @@ function Invoke-AsBuiltReport.Microsoft.Windows { #Host Network Adapter MTU Get-AbrWinNetAdapterMTU } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } #Host Storage @@ -169,9 +165,8 @@ function Invoke-AsBuiltReport.Microsoft.Windows { #MPIO Setting Get-AbrWinHostStorageMPIO } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } #HyperV Configuration @@ -182,7 +177,7 @@ function Invoke-AsBuiltReport.Microsoft.Windows { if (Get-RequiredFeature -Name Hyper-V-PowerShell -OSType $OSType.Value -Status) { Section -Style Heading2 "Hyper-V Configuration" { Paragraph 'The following table details the Hyper-V server settings' - Blankline + BlankLine # Hyper-V Configuration Get-AbrWinHyperVSummary # Hyper-V Numa Information @@ -195,9 +190,8 @@ function Invoke-AsBuiltReport.Microsoft.Windows { } else { Get-RequiredFeature -Name Hyper-V-PowerShell -OSType $OSType.Value -Service "Hyper-V" } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } else { Write-PScriboMessage "No HyperV service detected. Disabling HyperV server section" @@ -210,7 +204,7 @@ function Invoke-AsBuiltReport.Microsoft.Windows { if (((Get-RequiredFeature -Name web-mgmt-console -OSType $OSType.Value -Status) -and (Get-RequiredFeature -Name Web-Scripting-Tools -OSType $OSType.Value -Status)) -or ((Get-RequiredFeature -Name IIS-WebServerRole -OSType $OSType.Value -Status) -and (Get-RequiredFeature -Name WebServerManagementTools -OSType $OSType.Value -Status) -and (Get-RequiredFeature -Name IIS-ManagementScriptingTools -OSType $OSType.Value -Status))) { Section -Style Heading2 "IIS Configuration" { Paragraph 'The following table details the IIS server settings' - Blankline + BlankLine # IIS Configuration Get-AbrWinIISSummary # IIS Web Application Pools @@ -218,7 +212,7 @@ function Invoke-AsBuiltReport.Microsoft.Windows { # IIS Web Site Get-AbrWinIISWebSite } - } else { + } else { If ($OSType -eq 'Server' -or $OSType -eq 'DomainController') { Get-RequiredFeature -Name web-mgmt-console -OSType $OSType.Value -Service "IIS" Get-RequiredFeature -Name Web-Scripting-Tools -OSType $OSType.Value -Service "IIS" @@ -228,9 +222,8 @@ function Invoke-AsBuiltReport.Microsoft.Windows { Get-RequiredFeature -Name IIS-ManagementScriptingTools -OSType $OSType.Value -Service "IIS" } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } else { Write-PScriboMessage "No W3SVC service detected. Disabling IIS server section" @@ -238,11 +231,11 @@ function Invoke-AsBuiltReport.Microsoft.Windows { } if ($InfoLevel.SMB -ge 1) { try { - $Global:SMBShares = Invoke-Command -Session $TempPssSession { Get-SmbShare | Where-Object {$_.Special -like 'False'} } + $script:SMBShares = Invoke-Command -Session $TempPssSession { Get-SmbShare | Where-Object { $_.Special -like 'False' } } if ($SMBShares) { Section -Style Heading2 "File Server Configuration" { Paragraph 'The following table details the File Server settings' - Blankline + BlankLine # SMB Server Configuration Get-AbrWinSMBSummary # SMB Server Network Interface @@ -251,9 +244,8 @@ function Invoke-AsBuiltReport.Microsoft.Windows { Get-AbrWinSMBShare } } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } if ($InfoLevel.DHCP -ge 1 -and $OSType.Value -ne 'WorkStation') { @@ -263,7 +255,7 @@ function Invoke-AsBuiltReport.Microsoft.Windows { if (Get-RequiredFeature -Name RSAT-DHCP -OSType $OSType.Value -Status) { Section -Style Heading2 "DHCP Server Configuration" { Paragraph 'The following table details the DHCP server configurations' - Blankline + BlankLine # DHCP Server Configuration Get-AbrWinDHCPInfrastructure # DHCP Server Stats @@ -278,9 +270,8 @@ function Invoke-AsBuiltReport.Microsoft.Windows { } else { Get-RequiredFeature -Name RSAT-DHCP -OSType $OSType.Value -Service "DHCP Server" } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } else { Write-PScriboMessage "No DHCPServer service detected. Disabling Dhcp server section" @@ -293,7 +284,7 @@ function Invoke-AsBuiltReport.Microsoft.Windows { if (Get-RequiredFeature -Name RSAT-DNS-Server -OSType $OSType.Value -Status) { Section -Style Heading2 "DNS Server Configuration" { Paragraph 'The following table details the DNS server settings' - Blankline + BlankLine # DNS Server Configuration Get-AbrWinDNSInfrastructure # DNS Zones Configuration @@ -302,9 +293,8 @@ function Invoke-AsBuiltReport.Microsoft.Windows { } else { Get-RequiredFeature -Name RSAT-DNS-Server -OSType $OSType.Value -Service "DNS Server" } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } else { Write-PScriboMessage "No DNS Server service detected. Disabling DNS server section" @@ -315,11 +305,11 @@ function Invoke-AsBuiltReport.Microsoft.Windows { $Status = Invoke-Command -Session $TempPssSession -ScriptBlock { Get-Service 'ClusSvc' -ErrorAction SilentlyContinue } if ($Status.Status -eq "Running") { try { - $script:Cluster = Invoke-Command -Session $TempPssSession -ScriptBlock { (Get-Cluster).Name } - if ((Get-RequiredFeature -Name RSAT-Clustering-PowerShell -OSType $OSType.Value -Status) -and $Cluster) { + $script:Cluster = Invoke-Command -Session $TempPssSession -ScriptBlock { Get-Cluster } + if ((Get-RequiredFeature -Name RSAT-Clustering-PowerShell -OSType $OSType.Value -Status ) -and $Cluster) { Section -Style Heading2 "Failover Cluster Configuration" { Paragraph 'The following table details the Failover Cluster Settings' - Blankline + BlankLine # Failover Cluster Server Configuration Get-AbrWinFOCluster # Cluster Access Permission @@ -340,13 +330,11 @@ function Invoke-AsBuiltReport.Microsoft.Windows { Get-AbrWinFOClusterSharedVolume } - } - else { + } else { Get-RequiredFeature -Name RSAT-Clustering-PowerShell -OSType $OSType.Value -Service "FailOver Cluster" } - } - catch { - Write-PscriboMessage -IsWarning $_.Exception.Message + } catch { + Write-PScriboMessage -IsWarning $_.Exception.Message } } else { Write-PScriboMessage "No FailOver Cluster service detected. Disabling FailOver Cluster section"