├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.yml │ ├── change_request.yml │ └── config.yml ├── PULL_REQUEST_TEMPLATE.md └── workflows │ ├── PSScriptAnalyzer.yml │ ├── PSScriptAnalyzerSettings.psd1 │ ├── Release.yml │ └── codeql.yml ├── .gitignore ├── .vscode └── settings.json ├── AsBuiltReport.Microsoft.Windows.Style.ps1 ├── AsBuiltReport.Microsoft.Windows.json ├── AsBuiltReport.Microsoft.Windows.psd1 ├── AsBuiltReport.Microsoft.Windows.psm1 ├── CHANGELOG.md ├── LICENSE ├── README.md ├── Samples ├── Sample Microsoft Windows As Built Report.html └── Sample Microsoft Windows As Built Report.pdf └── Src ├── Private ├── Get-AbrWinApplication.ps1 ├── Get-AbrWinDHCPInfrastructure.ps1 ├── Get-AbrWinDHCPv4PerScopeSetting.ps1 ├── Get-AbrWinDHCPv4Scope.ps1 ├── Get-AbrWinDHCPv4ScopeServerSetting.ps1 ├── Get-AbrWinDHCPv4Statistic.ps1 ├── Get-AbrWinDNSInfrastructure.ps1 ├── Get-AbrWinDNSZone.ps1 ├── Get-AbrWinFOCluster.ps1 ├── Get-AbrWinFOClusterAvailableDisk.ps1 ├── Get-AbrWinFOClusterFaultDomain.ps1 ├── Get-AbrWinFOClusterNetwork.ps1 ├── Get-AbrWinFOClusterNetworkInterface.ps1 ├── Get-AbrWinFOClusterNode.ps1 ├── Get-AbrWinFOClusterPermission.ps1 ├── Get-AbrWinFOClusterQuorum.ps1 ├── Get-AbrWinFOClusterResource.ps1 ├── Get-AbrWinFOClusterSharedVolume.ps1 ├── Get-AbrWinFOClusterSharedVolumeState.ps1 ├── Get-AbrWinHostHWSummary.ps1 ├── Get-AbrWinHostStorage.ps1 ├── Get-AbrWinHostStorageISCSI.ps1 ├── Get-AbrWinHostStorageMPIO.ps1 ├── Get-AbrWinHostStorageVolume.ps1 ├── Get-AbrWinHyperVHostVM.ps1 ├── Get-AbrWinHyperVNetworking.ps1 ├── Get-AbrWinHyperVNuma.ps1 ├── Get-AbrWinHyperVSummary.ps1 ├── Get-AbrWinIISSummary.ps1 ├── Get-AbrWinIISWebAppPool.ps1 ├── Get-AbrWinIISWebSite.ps1 ├── Get-AbrWinLocalAdmin.ps1 ├── Get-AbrWinLocalGroup.ps1 ├── Get-AbrWinLocalUser.ps1 ├── Get-AbrWinNetAdapter.ps1 ├── Get-AbrWinNetAdapterMTU.ps1 ├── Get-AbrWinNetDNSClient.ps1 ├── Get-AbrWinNetDNSServer.ps1 ├── Get-AbrWinNetFirewall.ps1 ├── Get-AbrWinNetIPAddress.ps1 ├── Get-AbrWinNetTeamInterface.ps1 ├── Get-AbrWinOSConfig.ps1 ├── Get-AbrWinOSDriver.ps1 ├── Get-AbrWinOSHotfix.ps1 ├── Get-AbrWinOSRoleFeature.ps1 ├── Get-AbrWinOSService.ps1 ├── Get-AbrWinSMBNetworkInterface.ps1 ├── Get-AbrWinSMBShare.ps1 ├── Get-AbrWinSMBSummary.ps1 ├── Get-AbrWinSQLBackupDevice.ps1 ├── Get-AbrWinSQLBuild.ps1 ├── Get-AbrWinSQLDatabase.ps1 ├── Get-AbrWinSQLLogin.ps1 ├── Get-AbrWinSQLRole.ps1 ├── Get-RequiredFeature.ps1 └── SharedUtilsFunctions.ps1 └── Public └── Invoke-AsBuiltReport.Microsoft.Windows.ps1 /.github/ISSUE_TEMPLATE/bug_report.yml: -------------------------------------------------------------------------------- 1 | name: Bug Report 2 | description: File a bug report 3 | labels: ["bug"] 4 | assignees: 5 | - rebelinux 6 | body: 7 | - type: textarea 8 | id: bug-description 9 | attributes: 10 | label: Bug description 11 | description: >- 12 | Please provide a clear and concise description of the bug. 13 | validations: 14 | required: true 15 | - type: input 16 | id: command-line-input 17 | attributes: 18 | label: Command-line input 19 | description: >- 20 | Please provide the command line input you are using to run AsBuiltReport. Please ensure that you obscure any sensitive information. 21 | placeholder: New-AsBuiltReport -Report Microsoft.Windows -Target xxxxxxx -Format Word,HTML -OutputFolderPath .\Documents\ -AsBuiltConfigFilePath .\AsBuiltReport\AsBuiltReport.json -ReportConfigFilePath .\AsBuiltReport\AsBuiltReport.Microsoft.Windows.json -EnableHealthCheck -Verbose 22 | validations: 23 | required: true 24 | - type: textarea 25 | id: steps-to-reproduce 26 | attributes: 27 | label: Steps to reproduce 28 | description: >- 29 | Please provide a detailed list of steps to reproduce the bug. 30 | placeholder: |- 31 | 1. .... 32 | 2. .... 33 | 3. .... 34 | validations: 35 | required: true 36 | - type: textarea 37 | id: expected-behaviour 38 | attributes: 39 | label: Expected behaviour 40 | description: >- 41 | Please provide a clear and concise description of what you expected to happen. 42 | validations: 43 | required: true 44 | - type: textarea 45 | id: screenshots 46 | attributes: 47 | label: Screenshots 48 | description: >- 49 | Please attach any screenshots to help explain the problem. Please ensure that you obscure any sensitive information. 50 | placeholder: |- 51 | Drag and drop screenshots here. 52 | - type: textarea 53 | id: operating-system 54 | attributes: 55 | label: Operating System 56 | description: Please provide information about the operating system are you using. 57 | placeholder: macOS Big Sur, Windows 10, Ubuntu 20.04 LTS 58 | validations: 59 | required: true 60 | - type: textarea 61 | id: powershell-version 62 | attributes: 63 | label: PowerShell Version 64 | description: Please provide information about the PowerShell version you are using. Please provide the output from the following PowerShell command `$PSVersionTable`. 65 | placeholder: $PSVersionTable 66 | validations: 67 | required: true 68 | - type: textarea 69 | id: powershell-modules 70 | attributes: 71 | label: PowerShell Modules 72 | description: Please provide information about the PowerShell modules are you using. Please provide the output from the following PowerShell command `Get-Module -ListAvailable @("AsBuiltReport.Core";"AsBuiltReport.Microsoft.Windows";"PScribo") | Select Name, Version` 73 | placeholder: Get-Module -ListAvailable @("AsBuiltReport.Core";"AsBuiltReport.Microsoft.Windows";"PScribo") | Select Name, Version 74 | validations: 75 | required: true 76 | - type: textarea 77 | id: additional-context 78 | attributes: 79 | label: Additional Context 80 | description: This field is optional. You may provide additional context for the bug you wish to report. You may wish to include links to any related [issues](https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows/issues) or other relevant information. 81 | - type: checkboxes 82 | id: checklist 83 | attributes: 84 | label: Before submitting 85 | description: >- 86 | Please ensure your bug report fulfills all of the following requirements. 87 | If you are unsure of what a specific requirement means, please follow the links to learn about it and understand why it is necessary before submitting. 88 | options: 89 | - label: >- 90 | I have read and followed the [bug reporting guidelines](https://www.asbuiltreport.com/about/contributing/#reporting-issues-and-bugs). 91 | required: true 92 | - label: >- 93 | I have read [the documentation](https://www.asbuiltreport.com/user-guide/new-asbuiltconfig), 94 | and referred to the [known issues](https://www.asbuiltreport.com/support/known-issues/) before submitting this bug report. 95 | required: true 96 | - label: >- 97 | I have checked for previously opened & closed [issues](https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows/issues) before submitting this bug report. 98 | required: true 99 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/change_request.yml: -------------------------------------------------------------------------------- 1 | name: Change Request 2 | description: Request a new change or an improvement 3 | labels: ["change request"] 4 | assignees: 5 | - rebelinux 6 | body: 7 | - type: textarea 8 | id: description 9 | attributes: 10 | label: Description 11 | description: >- 12 | Please provide a detailed description of your idea so that the project maintainers and contributors can fully understand what change, feature, or improvement you are proposing. 13 | validations: 14 | required: true 15 | - type: textarea 16 | id: additional-context 17 | attributes: 18 | label: Additional Context 19 | description: This field is optional. You may provide additional context for the idea you wish to propose. You may wish to include links to any related [issues](https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows/issues) or other relevant information. 20 | - type: checkboxes 21 | id: checklist 22 | attributes: 23 | label: Before submitting 24 | description: >- 25 | Please ensure your change request fulfills all of the following requirements. 26 | If you are unsure of what a specific requirement means, please follow the links to learn about it and understand why it is necessary before submitting. 27 | options: 28 | - label: >- 29 | I have read [the documentation](https://www.asbuiltreport.com/user-guide/new-asbuiltconfig), 30 | and referred to the [known issues](https://www.asbuiltreport.com/user-guide/known-issues/) before submitting this change request. 31 | required: true 32 | - label: >- 33 | I have checked for previously opened & closed [issues](https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows/issues) before submitting this change request. 34 | required: true 35 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Description 4 | 5 | 6 | ## Related Issue 7 | 8 | 9 | 10 | 11 | 12 | ## Motivation and Context 13 | 14 | 15 | ## How Has This Been Tested? 16 | 17 | 18 | 19 | 20 | ## Screenshots (if appropriate): 21 | 22 | ## Types of changes 23 | 24 | - [ ] Bug fix (non-breaking change which fixes an issue) 25 | - [ ] New feature (non-breaking change which adds functionality) 26 | - [ ] Breaking change (fix or feature that would cause existing functionality to change) 27 | 28 | ## Checklist: 29 | 30 | 31 | - [ ] My code follows the code style of this project. 32 | - [ ] My change requires a change to the documentation. 33 | - [ ] I have updated the documentation accordingly. 34 | - [ ] I have read the [**CONTRIBUTING**](/CONTRIBUTING.md) document. 35 | -------------------------------------------------------------------------------- /.github/workflows/PSScriptAnalyzer.yml: -------------------------------------------------------------------------------- 1 | name: PSScriptAnalyzer 2 | on: [push, pull_request] 3 | jobs: 4 | lint: 5 | name: Run PSScriptAnalyzer 6 | runs-on: ubuntu-latest 7 | steps: 8 | - uses: actions/checkout@v4 9 | - name: lint 10 | uses: devblackops/github-action-psscriptanalyzer@master 11 | with: 12 | sendComment: true 13 | failOnErrors: true 14 | failOnWarnings: false 15 | failOnInfos: false 16 | repoToken: ${{ secrets.GITHUB_TOKEN }} 17 | settingsPath: .github/workflows/PSScriptAnalyzerSettings.psd1 -------------------------------------------------------------------------------- /.github/workflows/PSScriptAnalyzerSettings.psd1: -------------------------------------------------------------------------------- 1 | @{ 2 | ExcludeRules = @( 3 | 'PSUseToExportFieldsInManifest', 4 | 'PSReviewUnusedParameter', 5 | 'PSUseDeclaredVarsMoreThanAssignments', 6 | 'PSAvoidGlobalVars' 7 | 'PSUseSingularNouns' 8 | ) 9 | } -------------------------------------------------------------------------------- /.github/workflows/Release.yml: -------------------------------------------------------------------------------- 1 | name: Publish PowerShell Module 2 | 3 | on: 4 | release: 5 | types: [published] 6 | 7 | jobs: 8 | publish-to-gallery: 9 | runs-on: windows-2019 10 | steps: 11 | - uses: actions/checkout@v4 12 | - name: Set PSRepository to Trusted for PowerShell Gallery 13 | shell: pwsh 14 | run: | 15 | Set-PSRepository -Name PSGallery -InstallationPolicy Trusted 16 | - name: Install DBAtools module 17 | shell: pwsh 18 | run: | 19 | Install-Module -Name dbatools -Repository PSGallery -Force 20 | - name: Install AsBuiltReport.Core module 21 | shell: pwsh 22 | run: | 23 | Install-Module -Name AsBuiltReport.Core -Repository PSGallery -Force 24 | - name: Test Module Manifest 25 | shell: pwsh 26 | run: | 27 | Test-ModuleManifest .\AsBuiltReport.Microsoft.Windows.psd1 28 | - name: Publish module to PowerShell Gallery 29 | shell: pwsh 30 | run: | 31 | Publish-Module -Path ./ -NuGetApiKey ${{ secrets.PSGALLERY_API_KEY }} -Verbose 32 | tweet: 33 | needs: publish-to-gallery 34 | runs-on: ubuntu-latest 35 | steps: 36 | - uses: Eomm/why-don-t-you-tweet@v2 37 | # We don't want to tweet if the repository is not a public one 38 | if: ${{ !github.event.repository.private }} 39 | with: 40 | # GitHub event payload 41 | # https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#release 42 | tweet-message: "[New Release] ${{ github.event.repository.name }} ${{ github.event.release.tag_name }}! Check out what's new! ${{ github.event.release.html_url }} #Microsoft #Windows #AsBuiltReport #PowerShell #MVPBuzz" 43 | env: 44 | TWITTER_CONSUMER_API_KEY: ${{ secrets.TWITTER_CONSUMER_API_KEY }} 45 | TWITTER_CONSUMER_API_SECRET: ${{ secrets.TWITTER_CONSUMER_API_SECRET }} 46 | TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }} 47 | TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }} 48 | bsky-post: 49 | needs: publish-to-gallery 50 | runs-on: ubuntu-latest 51 | steps: 52 | - uses: zentered/bluesky-post-action@v0.2.0 53 | with: 54 | post: "[New Release] ${{ github.event.repository.name }} ${{ github.event.release.tag_name }}! Check out what's new! ${{ github.event.release.html_url }} #Microsoft #Windows #AsBuiltReport #PowerShell #MVPBuzz" 55 | env: 56 | BSKY_IDENTIFIER: ${{ secrets.BSKY_IDENTIFIER }} 57 | BSKY_PASSWORD: ${{ secrets.BSKY_PASSWORD }} 58 | -------------------------------------------------------------------------------- /.github/workflows/codeql.yml: -------------------------------------------------------------------------------- 1 | # This workflow uses actions that are not certified by GitHub. 2 | # They are provided by a third-party and are governed by 3 | # separate terms of service, privacy policy, and support 4 | # documentation. 5 | # 6 | # https://github.com/microsoft/action-psscriptanalyzer 7 | # For more information on PSScriptAnalyzer in general, see 8 | # https://github.com/PowerShell/PSScriptAnalyzer 9 | 10 | name: CodeQL 11 | 12 | on: 13 | push: 14 | branches: [ "dev" ] 15 | pull_request: 16 | branches: [ "dev" ] 17 | 18 | permissions: 19 | contents: read 20 | 21 | jobs: 22 | build: 23 | permissions: 24 | contents: read # for actions/checkout to fetch code 25 | security-events: write # for github/codeql-action/upload-sarif to upload SARIF results 26 | actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status 27 | name: PSScriptAnalyzer 28 | runs-on: ubuntu-latest 29 | steps: 30 | - uses: actions/checkout@v4 31 | 32 | - name: Run PSScriptAnalyzer 33 | uses: microsoft/psscriptanalyzer-action@v1.1 34 | with: 35 | # Check https://github.com/microsoft/action-psscriptanalyzer for more info about the options. 36 | # The below set up runs PSScriptAnalyzer to your entire repository and runs some basic security rules. 37 | path: .\ 38 | recurse: true 39 | # Include your own basic security rules. Removing this option will run all the rules 40 | excludeRule: '"PSAvoidUsingPlainTextForPassword", "PSAvoidUsingUsernameAndPasswordParams", "PSAvoidUsingConvertToSecureStringWithPlainText"' 41 | output: results.sarif 42 | 43 | # Upload the SARIF file generated in the previous step 44 | - name: Upload SARIF results file 45 | uses: github/codeql-action/upload-sarif@v3 46 | with: 47 | sarif_file: results.sarif 48 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | debug.log 2 | .gitignore 3 | # Created by https://www.toptal.com/developers/gitignore/api/powershell 4 | # Edit at https://www.toptal.com/developers/gitignore?templates=powershell 5 | 6 | ### PowerShell ### 7 | # Exclude packaged modules 8 | *.zip 9 | 10 | # Exclude .NET assemblies from source 11 | *.dll 12 | 13 | # End of https://www.toptal.com/developers/gitignore/api/powershell 14 | 15 | ### vscode ### 16 | .vscode/tasks.json 17 | .vscode/launch.json 18 | .vscode/extensions.json 19 | *.code-workspace 20 | 21 | # End of https://www.toptal.com/developers/gitignore/api/hugo,vscode 22 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "powershell.codeFormatting.preset": "Custom", 3 | "powershell.codeFormatting.useCorrectCasing": true, 4 | "powershell.codeFormatting.autoCorrectAliases": true, 5 | "powershell.codeFormatting.whitespaceBeforeOpenBrace": true, 6 | "powershell.codeFormatting.whitespaceBeforeOpenParen": true, 7 | "powershell.codeFormatting.whitespaceAroundOperator": true, 8 | "powershell.codeFormatting.whitespaceAfterSeparator": true, 9 | "powershell.codeFormatting.addWhitespaceAroundPipe": true, 10 | "powershell.codeFormatting.ignoreOneLineBlock": true, 11 | "powershell.codeFormatting.newLineAfterCloseBrace": false, 12 | "powershell.codeFormatting.newLineAfterOpenBrace": true, 13 | "powershell.codeFormatting.openBraceOnSameLine": true, 14 | "powershell.codeFormatting.alignPropertyValuePairs": false, 15 | "powershell.codeFolding.enable": true, 16 | "powershell.scriptAnalysis.enable": true, 17 | "powershell.scriptAnalysis.settingsPath": ".github/workflows/PSScriptAnalyzerSettings.psd1", 18 | "editor.tabSize": 4, 19 | "editor.insertSpaces": true, 20 | "editor.detectIndentation": false, 21 | "editor.rulers": [ 22 | 115 23 | ], 24 | "files.trimTrailingWhitespace": true 25 | } -------------------------------------------------------------------------------- /AsBuiltReport.Microsoft.Windows.json: -------------------------------------------------------------------------------- 1 | { 2 | "Report": { 3 | "Name": "Microsoft Windows As Built Report", 4 | "Version": "1.0", 5 | "Status": "Released", 6 | "ShowCoverPageImage": true, 7 | "ShowTableOfContents": true, 8 | "ShowHeaderFooter": true, 9 | "ShowTableCaptions": true 10 | }, 11 | "Options": { 12 | "SQLLogin": false, 13 | "SQLUserName": "", 14 | "SQLSecurePassword": "" 15 | }, 16 | "InfoLevel": { 17 | "_comment_": "Please refer to the AsBuiltReport project contributing guide for information about how to define InfoLevels.", 18 | "_comment_": "0 = Disabled, 1 = Enabled, 2 = Adv Summary, 3 = Detailed, 4 = Adv Detailed, 5 = Comprehensive", 19 | "Hardware": 1, 20 | "OperatingSystem": 1, 21 | "Account": 1, 22 | "Networking": 1, 23 | "Storage": 1, 24 | "HyperV": 1, 25 | "IIS": 1, 26 | "SMB": 1, 27 | "DHCP": 1, 28 | "DNS": 1, 29 | "FailOverCluster": 1, 30 | "SQLServer": 1 31 | }, 32 | "HealthCheck": { 33 | "Networking": { 34 | "Firewall": true 35 | }, 36 | "OperatingSystem": { 37 | "Services": true, 38 | "Updates": true 39 | }, 40 | "DNS": { 41 | "Aging": true, 42 | "DP": true 43 | }, 44 | "DHCP": { 45 | "SumStatusmary": true, 46 | "Credential": true, 47 | "Statistics": true, 48 | "BP": true 49 | }, 50 | "FailOverCluster": { 51 | "Nodes": true, 52 | "Network": true, 53 | "ClusterSharedVolume": true 54 | }, 55 | "Storage": { 56 | "BP": true 57 | }, 58 | "SMB": { 59 | "BP": true 60 | }, 61 | "SQLServer": { 62 | "BP": true 63 | } 64 | } 65 | } -------------------------------------------------------------------------------- /AsBuiltReport.Microsoft.Windows.psd1: -------------------------------------------------------------------------------- 1 | # 2 | # Module manifest for module 'AsBuiltReport.Microsoft.Windows' 3 | # 4 | # Generated by: Andrew Ramsay 5 | # 6 | # Generated on: 1/03/2021 7 | # 8 | 9 | @{ 10 | 11 | # Script module or binary module file associated with this manifest. 12 | RootModule = 'AsBuiltReport.Microsoft.Windows.psm1' 13 | 14 | # Version number of this module. 15 | ModuleVersion = '0.5.6' 16 | 17 | # Supported PSEditions 18 | # CompatiblePSEditions = @() 19 | 20 | # ID used to uniquely identify this module 21 | GUID = '29c96c3d-bce4-4a9f-a429-5ba40a63d8ed' 22 | 23 | # Author of this module 24 | Author = 'Andrew Ramsay' 25 | 26 | # Company or vendor of this module 27 | # CompanyName = 'Unknown' 28 | 29 | # Copyright statement for this module 30 | Copyright = '(c) 2024 Andrew Ramsay. All rights reserved.' 31 | 32 | # Description of the functionality provided by this module 33 | Description = 'A PowerShell module to generate an as built report on the configuration of Microsoft Windows.' 34 | 35 | # Minimum version of the Windows PowerShell engine required by this module 36 | PowerShellVersion = '5.1' 37 | 38 | # Name of the Windows PowerShell host required by this module 39 | # PowerShellHostName = '' 40 | 41 | # Minimum version of the Windows PowerShell host required by this module 42 | # PowerShellHostVersion = '' 43 | 44 | # Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only. 45 | # DotNetFrameworkVersion = '' 46 | 47 | # Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only. 48 | # CLRVersion = '' 49 | 50 | # Processor architecture (None, X86, Amd64) required by this module 51 | # ProcessorArchitecture = '' 52 | 53 | # Modules that must be imported into the global environment prior to importing this module 54 | RequiredModules = @( 55 | @{ 56 | ModuleName = 'AsBuiltReport.Core'; 57 | ModuleVersion = '1.4.0' 58 | }, 59 | @{ 60 | ModuleName = 'dbatools'; 61 | ModuleVersion = '2.1.27' 62 | } 63 | ) 64 | 65 | # Assemblies that must be loaded prior to importing this module 66 | # RequiredAssemblies = @() 67 | 68 | # Script files (.ps1) that are run in the caller's environment prior to importing this module. 69 | # ScriptsToProcess = @() 70 | 71 | # Type files (.ps1xml) to be loaded when importing this module 72 | # TypesToProcess = @() 73 | 74 | # Format files (.ps1xml) to be loaded when importing this module 75 | # FormatsToProcess = @() 76 | 77 | # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess 78 | # NestedModules = @() 79 | 80 | # 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. 81 | FunctionsToExport = @('Invoke-AsBuiltReport.Microsoft.Windows') 82 | 83 | # 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. 84 | # CmdletsToExport = '*' 85 | 86 | # Variables to export from this module 87 | # VariablesToExport = '*' 88 | 89 | # 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. 90 | # AliasesToExport = '*' 91 | 92 | # DSC resources to export from this module 93 | # DscResourcesToExport = @() 94 | 95 | # List of all modules packaged with this module 96 | # ModuleList = @() 97 | 98 | # List of all files packaged with this module 99 | # FileList = @() 100 | 101 | # 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. 102 | PrivateData = @{ 103 | 104 | PSData = @{ 105 | # Tags applied to this module. These help with module discovery in online galleries. 106 | Tags = 'AsBuiltReport', 'Report', 'Microsoft', 'Documentation', 'PScribo', 'PSEdition_Desktop', 'Windows' 107 | 108 | # A URL to the license for this module. 109 | LicenseUri = 'https://raw.githubusercontent.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows/master/LICENSE' 110 | 111 | # A URL to the main website for this project. 112 | ProjectUri = 'https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows' 113 | 114 | # A URL to an icon representing this module. 115 | IconUri = 'https://github.com/AsBuiltReport.png' 116 | 117 | # ReleaseNotes of this module 118 | ReleaseNotes = 'https://raw.githubusercontent.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows/master/CHANGELOG.md' 119 | 120 | # Prerelease string of this module 121 | # Prerelease = '' 122 | 123 | # Flag to indicate whether the module requires explicit user acceptance for install/update/save 124 | # RequireLicenseAcceptance = $false 125 | 126 | # External dependent modules of this module 127 | # ExternalModuleDependencies = @() 128 | 129 | } # End of PSData hashtable 130 | 131 | } # End of PrivateData hashtable 132 | 133 | # HelpInfo URI of this module 134 | # HelpInfoURI = '' 135 | 136 | # Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. 137 | # DefaultCommandPrefix = '' 138 | 139 | } 140 | 141 | 142 | -------------------------------------------------------------------------------- /AsBuiltReport.Microsoft.Windows.psm1: -------------------------------------------------------------------------------- 1 | # Get public and private function definition files and dot source them 2 | $Public = @(Get-ChildItem -Path $PSScriptRoot\Src\Public\*.ps1 -ErrorAction SilentlyContinue) 3 | $Private = @(Get-ChildItem -Path $PSScriptRoot\Src\Private\*.ps1 -ErrorAction SilentlyContinue) 4 | 5 | foreach ($Module in @($Public + $Private)) { 6 | try { 7 | . $Module.FullName 8 | } catch { 9 | Write-Error -Message "Failed to import function $($Module.FullName): $_" 10 | } 11 | } 12 | 13 | Export-ModuleMember -Function $Public.BaseName 14 | Export-ModuleMember -Function $Private.BaseName -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # :arrows_counterclockwise: Microsoft Windows As Built Report Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 6 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 | 8 | ## [0.5.6] - 2024-11-20 9 | 10 | ### Added 11 | 12 | - Initial support for Server 2025 13 | 14 | ### Changed 15 | 16 | - Increase Dbatools module requirement v2.1.27 17 | - Improve detection of empty fields in tables 18 | - Improve detection of true/false elements in tables 19 | - Update GitHub release workflow to add post to Bluesky social platform 20 | 21 | ### Fixed 22 | 23 | - Fix [#36](https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows/issues/36) 24 | 25 | ## [0.5.5] - 2024-07-29 26 | 27 | ### Changed 28 | 29 | - Increase dbatools module version (v2.1.18) 30 | - Increase Eomm/why-don-t-you-tweet (v2.0) 31 | 32 | ### Fixed 33 | 34 | - Fix DNS Zone table not displaying 'Available For Scavenge' and 'Last Scavenge Time' correctly 35 | - Fix DHCP Infrastructure table not displaying 'Database Logging Enabled' and 'Database Backup Interval' correctly 36 | - Fix [#31](https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows/issues/31) 37 | 38 | ## [0.5.4] - 2024-05-16 39 | 40 | ### Changed 41 | 42 | - Increase AsBuiltReport.Core module version (v1.4.0) 43 | 44 | ### Fixed 45 | 46 | - Fix [#25](https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows/issues/25) 47 | - Fix [#26](https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows/issues/26) 48 | 49 | ## [0.5.3] - 2024-03-06 50 | 51 | ### Added 52 | 53 | - Add SQL Server support 54 | - General Information 55 | - Security 56 | - Login 57 | - Roles 58 | - Databases 59 | - User 60 | - System 61 | - Server Objects 62 | - Backup Devices 63 | 64 | ## [0.5.2] - 2024-02-18 65 | 66 | ### Added 67 | 68 | - Add Local Windows Group Members information @flynngw 69 | - Add more HealthCheck conditions 70 | 71 | ### Changed 72 | 73 | - Improve report readability 74 | 75 | ### Fixed 76 | 77 | - Fix CodeQL security alerts 78 | - Fix FailOver Cluster section 79 | - Fix issue in Get-AbrWinOSHotfix install date logic 80 | 81 | ## [0.5.1] - 2023-05-16 82 | 83 | ### Added 84 | 85 | - Added Hyper-V per VM configuration reporting @oolejniczak 86 | - Added Hyper-V Management OS Adapters table @rebelinux 87 | 88 | ## [0.5.0] - 2023-05-08 89 | 90 | ### Added 91 | 92 | - Added FailOver Cluster section 93 | 94 | ### Changed 95 | 96 | - Improved bug and feature request templates 97 | - Changed default logo from Microsoft to the AsBuiltReport logo due to licensing requirements 98 | - Changed default report style font to 'Segoe Ui' to align with Microsoft guidelines 99 | - Changed Required Modules to AsBuiltReport.Core v1.3.0 100 | 101 | ## [0.4.1] - 2022-10-20 102 | 103 | ### Fixed 104 | 105 | - Fixes [#8](https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows/issues/8) 106 | 107 | ## [0.4.0] - 2022-10-20 108 | 109 | ### Added 110 | 111 | - Added table to show the pending/missing Windows updates (Health Check) 112 | 113 | ## [0.3.0] - 2022-01-29 114 | 115 | ### Added 116 | 117 | - Added DHCP Server Section 118 | - Added DNS Server Section 119 | 120 | ### Changed 121 | 122 | - Changed WINRM session authentication from kerberos to negotiate 123 | 124 | ## [0.2.0] - 2022-01-26 125 | 126 | ### Added 127 | 128 | - Added Windows Logo 129 | - Added table column sorting on primary key 130 | - Added table caption 131 | - Updated project ReadMe file 132 | - Added IIS Web Server section 133 | - Added SMB File Server section 134 | - Added Windows Service Status to OS section 135 | 136 | ### Changed 137 | 138 | - Migrate report to new module structure 139 | - Implemented better error handling (try/catch) 140 | 141 | ## [0.1.0] - 2021-08-11 142 | 143 | ### Added 144 | 145 | - Added Host Hardware Summary 146 | - Added Host Operating System Section 147 | - Added Host Networking Section 148 | - Added Host Storage Section 149 | - Added Host ISCSI Section 150 | - Added Hyper-V Configuration Section 151 | - Added Local Users and Groups Section 152 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 AsBuiltReport 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Samples/Sample Microsoft Windows As Built Report.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows/ab62864ee2f9393abb0140748fc8e54344bd813d/Samples/Sample Microsoft Windows As Built Report.pdf -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinApplication.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinApplication { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Windows Server Application Inventory information. 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.6 9 | Author: Andrew Ramsay 10 | Editor: Jonathan Colon 11 | Twitter: @asbuiltreport 12 | Github: AsBuiltReport 13 | Credits: Iain Brighton (@iainbrighton) - PScribo module 14 | 15 | .LINK 16 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 17 | #> 18 | [CmdletBinding()] 19 | param ( 20 | ) 21 | 22 | begin { 23 | Write-PScriboMessage "Operating System InfoLevel set at $($InfoLevel.OperatingSystem)." 24 | Write-PScriboMessage "Collecting Application Inventory information." 25 | } 26 | 27 | process { 28 | if ($InfoLevel.OperatingSystem -ge 1) { 29 | try { 30 | [array]$AddRemove = @() 31 | $AddRemove += Invoke-Command -Session $TempPssSession { Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\* } 32 | $AddRemove += Invoke-Command -Session $TempPssSession { Get-ItemProperty HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* } 33 | if ($AddRemove) { 34 | Section -Style Heading3 'Installed Applications' { 35 | Paragraph 'The following settings details applications listed in Add/Remove Programs' 36 | BlankLine 37 | $OutObj = @() 38 | ForEach ($App in $AddRemove) { 39 | try { 40 | $inObj = [ordered] @{ 41 | 'Application Name' = $App.DisplayName 42 | 'Publisher' = $App.Publisher 43 | 'Version' = Switch ([string]::IsNullOrEmpty($App.DisplayVersion)) { 44 | $true { "--" } 45 | $false { $App.DisplayVersion } 46 | default { "Unknown" } 47 | } 48 | 'Install Date' = Switch ([string]::IsNullOrEmpty($App.InstallDate)) { 49 | $true { "--" } 50 | $false { $App.InstallDate } 51 | default { 'Unknown' } 52 | } 53 | } 54 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 55 | } catch { 56 | Write-PScriboMessage -IsWarning $_.Exception.Message 57 | } 58 | } 59 | $TableParams = @{ 60 | Name = "Installed Applications" 61 | List = $false 62 | ColumnWidths = 30, 30, 20, 20 63 | } 64 | if ($Report.ShowTableCaptions) { 65 | $TableParams['Caption'] = "- $($TableParams.Name)" 66 | } 67 | $OutObj | Where-Object { $_.'Application Name' -notlike '--' } | Sort-Object -Property 'Application Name' | Table @TableParams 68 | } 69 | } 70 | } catch { 71 | Write-PScriboMessage -IsWarning $_.Exception.Message 72 | } 73 | } 74 | } 75 | end {} 76 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinDHCPInfrastructure.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinDHCPInfrastructure { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Microsoft DHCP Servers 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.4 9 | Author: Jonathan Colon 10 | Twitter: @jcolonfzenpr 11 | Github: rebelinux 12 | Credits: Iain Brighton (@iainbrighton) - PScribo module 13 | 14 | .LINK 15 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 16 | #> 17 | 18 | [CmdletBinding()] 19 | param ( 20 | ) 21 | 22 | begin { 23 | Write-PScriboMessage "DHCP InfoLevel set at $($InfoLevel.DHCP)." 24 | Write-PScriboMessage "Collecting Host DHCP Server information." 25 | } 26 | 27 | process { 28 | try { 29 | $Settings = Get-DhcpServerSetting -CimSession $TempCIMSession 30 | $Database = Get-DhcpServerDatabase -CimSession $TempCIMSession 31 | $DNSCredential = Get-DhcpServerDnsCredential -CimSession $TempCIMSession 32 | if ($Settings -and $Database -and $DNSCredential) { 33 | $OutObj = @() 34 | try { 35 | $inObj = [ordered] @{ 36 | 'Domain Joined' = $Settings.IsDomainJoined 37 | 'Authorized' = $Settings.IsAuthorized 38 | 'Conflict Detection Attempts' = $Settings.ConflictDetectionAttempts 39 | 'Activate Policies' = $Settings.ActivatePolicies 40 | 'Dynamic Bootp' = $Settings.DynamicBootp 41 | 'Database Path' = $Database.FileName 42 | 'Database Backup Path' = $Database.BackupPath 43 | 'Database Backup Interval' = switch ([string]::IsNullOrEmpty($Database.BackupInterval)) { 44 | $true { "--" } 45 | $false { "$($Database.BackupInterval) min" } 46 | default { 'Unknown' } 47 | } 48 | 'Database Logging Enabled' = Switch ([string]::IsNullOrEmpty($Database.LoggingEnabled)) { 49 | $true { "--" } 50 | $false { $Database.LoggingEnabled } 51 | default { 'Unknown' } 52 | } 53 | 'User Name' = $DNSCredential.UserName 54 | 'Domain Name' = $DNSCredential.DomainName 55 | } 56 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 57 | } catch { 58 | Write-PScriboMessage -IsWarning $_.Exception.Message 59 | } 60 | 61 | if ($HealthCheck.DHCP.BP) { 62 | $OutObj | Where-Object { $_.'Conflict Detection Attempts' -eq 0 } | Set-Style -Style Warning -Property 'Conflict Detection Attempts' 63 | $OutObj | Where-Object { $_.'Authorized' -like 'No' } | Set-Style -Style Warning -Property 'Authorized' 64 | $OutObj | Where-Object { $_.'User Name' -like "--" } | Set-Style -Style Warning -Property 'User Name', 'Domain Name' 65 | 66 | } 67 | 68 | $TableParams = @{ 69 | Name = "DHCP Servers Settings - $($System.toUpper().split(".")[0])" 70 | List = $true 71 | ColumnWidths = 40, 60 72 | } 73 | if ($Report.ShowTableCaptions) { 74 | $TableParams['Caption'] = "- $($TableParams.Name)" 75 | } 76 | $OutObj | Table @TableParams 77 | } 78 | } catch { 79 | Write-PScriboMessage -IsWarning $_.Exception.Message 80 | } 81 | } 82 | 83 | end {} 84 | 85 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinDHCPv4PerScopeSetting.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinDHCPv4PerScopeSetting { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Microsoft Windows DHCP Servers Scopes Server Options from DHCP Servers 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.2 9 | Author: Jonathan Colon 10 | Twitter: @jcolonfzenpr 11 | Github: rebelinux 12 | Credits: Iain Brighton (@iainbrighton) - PScribo module 13 | 14 | .LINK 15 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 16 | #> 17 | [CmdletBinding()] 18 | param ( 19 | ) 20 | 21 | begin { 22 | Write-PScriboMessage "DHCP InfoLevel set at $($InfoLevel.DHCP)." 23 | Write-PScriboMessage "Collecting Host DHCP Server Scope information." 24 | } 25 | 26 | process { 27 | try { 28 | $DHCPScopes = Get-DhcpServerv4Scope -CimSession $TempCimSession | Select-Object -ExpandProperty ScopeId 29 | if ($DHCPScopes) { 30 | Section -Style Heading3 "Per Scope Options" { 31 | Paragraph "The following section provides a summary of the DHCP servers Scope Server Options information." 32 | BlankLine 33 | foreach ($Scope in $DHCPScopes) { 34 | try { 35 | $DHCPScopeOptions = Get-DhcpServerv4OptionValue -CimSession $TempCIMSession -ScopeId $Scope 36 | if ($DHCPScopeOptions) { 37 | Section -Style Heading4 "$Scope" { 38 | Paragraph "The following table details Scope Server Options Settings." 39 | BlankLine 40 | $OutObj = @() 41 | foreach ($Option in $DHCPScopeOptions) { 42 | try { 43 | Write-PScriboMessage "Collecting DHCP Server Scope Server Option value $($Option.OptionId)" 44 | $inObj = [ordered] @{ 45 | 'Name' = $Option.Name 46 | 'Option Id' = $Option.OptionId 47 | 'Value' = $Option.Value 48 | 'Policy Name' = $Option.PolicyName 49 | } 50 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 51 | } catch { 52 | Write-PScriboMessage -IsWarning "$($_.Exception.Message) (Scope Options Item)" 53 | } 54 | } 55 | 56 | $TableParams = @{ 57 | Name = "Scopes Options - $Scope" 58 | List = $false 59 | ColumnWidths = 40, 15, 20, 25 60 | } 61 | if ($Report.ShowTableCaptions) { 62 | $TableParams['Caption'] = "- $($TableParams.Name)" 63 | } 64 | $OutObj | Sort-Object -Property 'Option Id' | Table @TableParams 65 | } 66 | } 67 | } catch { 68 | Write-PScriboMessage -IsWarning "$($_.Exception.Message) (Scope Options Section)" 69 | } 70 | } 71 | } 72 | } 73 | } catch { 74 | Write-PScriboMessage -IsWarning "$($_.Exception.Message) (Scope Options Section)" 75 | } 76 | } 77 | 78 | end {} 79 | 80 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinDHCPv4ScopeServerSetting.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinDHCPv4ScopeServerSetting { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Microsoft Windows DHCP Servers Scopes Server Options from DHCP Servers 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.2 9 | Author: Jonathan Colon 10 | Twitter: @jcolonfzenpr 11 | Github: rebelinux 12 | Credits: Iain Brighton (@iainbrighton) - PScribo module 13 | 14 | .LINK 15 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 16 | #> 17 | [CmdletBinding()] 18 | param ( 19 | ) 20 | 21 | begin { 22 | Write-PScriboMessage "DHCP InfoLevel set at $($InfoLevel.DHCP)." 23 | Write-PScriboMessage "Collecting Host DHCP Server information." 24 | } 25 | 26 | process { 27 | $DHCPScopeOptions = Get-DhcpServerv4OptionValue -CimSession $TempCIMSession 28 | if ($DHCPScopeOptions) { 29 | Section -Style Heading3 "Scope Server Options" { 30 | Paragraph "The following section provides a summary of the DHCP servers Scope Server Options information." 31 | BlankLine 32 | $OutObj = @() 33 | Write-PScriboMessage "Discovered '$(($DHCPScopeOptions | Measure-Object).Count)' DHCP scopes server opions." 34 | foreach ($Option in $DHCPScopeOptions) { 35 | try { 36 | Write-PScriboMessage "Collecting DHCP Server Scope Server Option value $($Option.OptionId)" 37 | $inObj = [ordered] @{ 38 | 'Name' = $Option.Name 39 | 'Option Id' = $Option.OptionId 40 | 'Value' = $Option.Value 41 | 'Policy Name' = $Option.PolicyName 42 | } 43 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 44 | } catch { 45 | Write-PScriboMessage -IsWarning "$($_.Exception.Message) (DHCP scopes server opions item)" 46 | } 47 | } 48 | $TableParams = @{ 49 | Name = "Scopes Server Options - $($System.split(".", 2).ToUpper()[0])" 50 | List = $false 51 | ColumnWidths = 40, 15, 20, 25 52 | } 53 | if ($Report.ShowTableCaptions) { 54 | $TableParams['Caption'] = "- $($TableParams.Name)" 55 | } 56 | $OutObj | Sort-Object -Property 'Option Id' | Table @TableParams 57 | try { 58 | $DHCPScopeOptions = Get-DhcpServerv4DnsSetting -CimSession $TempCIMSession 59 | if ($DHCPScopeOptions) { 60 | Section -Style Heading4 "Scope DNS Setting" { 61 | Paragraph "The following section provides a summary of the DHCP servers Scope DNS Setting information." 62 | BlankLine 63 | $OutObj = @() 64 | foreach ($Option in $DHCPScopeOptions) { 65 | try { 66 | Write-PScriboMessage "Collecting DHCP Server Scope DNS Setting." 67 | $inObj = [ordered] @{ 68 | 'Dynamic Updates' = $Option.DynamicUpdates 69 | 'Dns Suffix' = $Option.DnsSuffix 70 | 'Name Protection' = $Option.NameProtection 71 | 'Update Dns RR For Older Clients' = $Option.UpdateDnsRRForOlderClients 72 | 'Disable Dns Ptr RR Update' = $Option.DisableDnsPtrRRUpdate 73 | 'Delete Dns RR On Lease Expiry' = $Option.DeleteDnsRROnLeaseExpiry 74 | } 75 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 76 | } catch { 77 | Write-PScriboMessage -IsWarning "$($_.Exception.Message) (Scope DNS Setting Item)" 78 | } 79 | } 80 | 81 | $TableParams = @{ 82 | Name = "Scopes DNS Setting - $($System.toUpper().split(".", 2)[0])" 83 | List = $true 84 | ColumnWidths = 40, 60 85 | } 86 | if ($Report.ShowTableCaptions) { 87 | $TableParams['Caption'] = "- $($TableParams.Name)" 88 | } 89 | $OutObj | Table @TableParams 90 | } 91 | } 92 | } catch { 93 | Write-PScriboMessage -IsWarning "$($_.Exception.Message) (Scope DNS Setting Table)" 94 | } 95 | } 96 | } 97 | } 98 | 99 | end {} 100 | 101 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinDHCPv4Statistic.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinDHCPv4Statistic { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Microsoft Windows DHCP Servers from Domain Controller 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.2 9 | Author: Jonathan Colon 10 | Twitter: @jcolonfzenpr 11 | Github: rebelinux 12 | Credits: Iain Brighton (@iainbrighton) - PScribo module 13 | 14 | .LINK 15 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 16 | #> 17 | [CmdletBinding()] 18 | param ( 19 | ) 20 | 21 | begin { 22 | Write-PScriboMessage "DHCP InfoLevel set at $($InfoLevel.DHCP)." 23 | Write-PScriboMessage "Collecting Host DHCP Server information." 24 | } 25 | 26 | process { 27 | try { 28 | $DhcpSv4Statistics = Get-DhcpServerv4Statistics -CimSession $TempCIMSession 29 | if ($DhcpSv4Statistics) { 30 | Section -Style Heading3 'Service Statistics' { 31 | $OutObj = @() 32 | try { 33 | $inObj = [ordered] @{ 34 | 'Total Scopes' = $DhcpSv4Statistics.TotalScopes 35 | 'Total Addresses' = $DhcpSv4Statistics.TotalAddresses 36 | 'Addresses In Use' = $DhcpSv4Statistics.AddressesInUse 37 | 'Addresses Available' = $DhcpSv4Statistics.AddressesAvailable 38 | 'Percentage In Use' = ([math]::Round($DhcpSv4Statistics.PercentageInUse, 0)) 39 | 'Percentage Available' = ([math]::Round($DhcpSv4Statistics.PercentageAvailable, 0)) 40 | } 41 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 42 | } catch { 43 | Write-PScriboMessage -IsWarning "$($_.Exception.Message) (IPv4 Service Statistics Item)" 44 | } 45 | if ($HealthCheck.DHCP.Statistics) { 46 | $OutObj | Where-Object { $_.'Percentage In Use' -gt 95 } | Set-Style -Style Warning -Property 'Percentage Available', 'Percentage In Use' 47 | } 48 | 49 | $TableParams = @{ 50 | Name = "DHCP Server Statistics - $($System.toUpper().split(".")[0])" 51 | List = $false 52 | ColumnWidths = 17, 17, 17, 17 , 16, 16 53 | } 54 | if ($Report.ShowTableCaptions) { 55 | $TableParams['Caption'] = "- $($TableParams.Name)" 56 | } 57 | $OutObj | Sort-Object -Property 'DC Name' | Table @TableParams 58 | } 59 | } 60 | } catch { 61 | Write-PScriboMessage -IsWarning "$($_.Exception.Message) (IPv4 Service Statistics Table)" 62 | } 63 | } 64 | 65 | end {} 66 | 67 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinDNSInfrastructure.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinDNSInfrastructure { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Microsoft Windows Domain Name System Infrastructure information. 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.4 9 | Author: Jonathan Colon 10 | Twitter: @jcolonfzenpr 11 | Github: rebelinux 12 | Credits: Iain Brighton (@iainbrighton) - PScribo module 13 | 14 | .LINK 15 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 16 | #> 17 | [CmdletBinding()] 18 | param ( 19 | ) 20 | 21 | begin { 22 | Write-PScriboMessage "DNS InfoLevel set at $($InfoLevel.DNS)." 23 | Write-PScriboMessage "Collecting Host DNS Server information." 24 | } 25 | 26 | process { 27 | try { 28 | $DNSSetting = Get-DnsServerSetting -CimSession $TempCIMSession 29 | if ($DNSSetting) { 30 | $OutObj = @() 31 | try { 32 | $inObj = [ordered] @{ 33 | 'Build Number' = $DNSSetting.BuildNumber 34 | 'IPv6' = ($DNSSetting.EnableIPv6) 35 | 'DnsSec' = ($DNSSetting.EnableDnsSec) 36 | 'ReadOnly DC' = ($DNSSetting.IsReadOnlyDC) 37 | 'Listening IP' = $DNSSetting.ListeningIPAddress 38 | 'All IPs' = $DNSSetting.AllIPAddress 39 | } 40 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 41 | } catch { 42 | Write-PScriboMessage -IsWarning " $($_.Exception.Message) (Infrastructure Summary)" 43 | } 44 | } 45 | 46 | $TableParams = @{ 47 | Name = "DNS Servers Settings - $($System.toUpper().split(".")[0])" 48 | List = $true 49 | ColumnWidths = 40, 60 50 | } 51 | if ($Report.ShowTableCaptions) { 52 | $TableParams['Caption'] = "- $($TableParams.Name)" 53 | } 54 | $OutObj | Sort-Object -Property 'DC Name' | Table @TableParams 55 | #---------------------------------------------------------------------------------------------# 56 | # DNS IP Section # 57 | #---------------------------------------------------------------------------------------------# 58 | if ($InfoLevel.DNS -ge 2) { 59 | try { 60 | $DNSIPSetting = Get-NetAdapter -CimSession $TempCIMSession | Get-DnsClientServerAddress -CimSession $TempCIMSession -AddressFamily IPv4 61 | if ($DNSIPSetting) { 62 | Section -Style Heading3 "DNS IP Configuration" { 63 | Paragraph "The following table details DNS Server IP Configuration Settings" 64 | BlankLine 65 | $OutObj = @() 66 | try { 67 | $inObj = [ordered] @{ 68 | 'Interface' = $DNSIPSetting.InterfaceAlias 69 | 'DNS IP 1' = $DNSIPSetting.ServerAddresses[0] 70 | 'DNS IP 2' = $DNSIPSetting.ServerAddresses[1] 71 | 'DNS IP 3' = $DNSIPSetting.ServerAddresses[2] 72 | 'DNS IP 4' = $DNSIPSetting.ServerAddresses[3] 73 | } 74 | $OutObj = [pscustomobject](ConvertTo-HashToYN $inObj) 75 | 76 | if ($HealthCheck.DNS.DP) { 77 | $OutObj | Where-Object { $_.'DNS IP 1' -eq "127.0.0.1" } | Set-Style -Style Warning -Property 'DNS IP 1' 78 | } 79 | 80 | $TableParams = @{ 81 | Name = "IP Configuration - $($System.toUpper().split(".")[0])" 82 | List = $false 83 | ColumnWidths = 20, 20, 20, 20, 20 84 | } 85 | if ($Report.ShowTableCaptions) { 86 | $TableParams['Caption'] = "- $($TableParams.Name)" 87 | } 88 | $OutObj | Table @TableParams 89 | } catch { 90 | Write-PScriboMessage -IsWarning $_.Exception.Message 91 | } 92 | } 93 | } 94 | } catch { 95 | Write-PScriboMessage -IsWarning "$($_.Exception.Message) (DNS IP Configuration Table)" 96 | } 97 | } 98 | 99 | #---------------------------------------------------------------------------------------------# 100 | # DNS Scanvenging Section # 101 | #---------------------------------------------------------------------------------------------# 102 | if ($InfoLevel.DNS -ge 2) { 103 | try { 104 | $DNSSetting = Get-DnsServerScavenging -CimSession $TempCIMSession 105 | if ($DNSSetting) { 106 | Section -Style Heading3 "Scavenging Options" { 107 | Paragraph "The following table details scavenging configuration settings" 108 | BlankLine 109 | $OutObj = @() 110 | try { 111 | $inObj = [ordered] @{ 112 | 'NoRefresh Interval' = $DNSSetting.NoRefreshInterval 113 | 'Refresh Interval' = $DNSSetting.RefreshInterval 114 | 'Scavenging Interval' = $DNSSetting.ScavengingInterval 115 | 'Last Scavenge Time' = Switch ([string]::IsNullOrEmpty($DNSSetting.LastScavengeTime)) { 116 | $true { "--" } 117 | $false { ($DNSSetting.LastScavengeTime.ToString("MM/dd/yyyy")) } 118 | default { 'Unknown' } 119 | } 120 | 'Scavenging State' = Switch ($DNSSetting.ScavengingState) { 121 | "True" { "Enabled" } 122 | "False" { "Disabled" } 123 | default { $DNSSetting.ScavengingState } 124 | } 125 | } 126 | 127 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 128 | $TableParams = @{ 129 | Name = "Scavenging - $($System.toUpper().split(".")[0])" 130 | List = $false 131 | ColumnWidths = 20, 20, 20, 20, 20 132 | } 133 | if ($Report.ShowTableCaptions) { 134 | $TableParams['Caption'] = "- $($TableParams.Name)" 135 | } 136 | $OutObj | Table @TableParams 137 | } catch { 138 | Write-PScriboMessage -IsWarning "$($_.Exception.Message) (Scavenging Item)" 139 | } 140 | } 141 | } 142 | } catch { 143 | Write-PScriboMessage -IsWarning "$($_.Exception.Message) (Scavenging Table)" 144 | } 145 | } 146 | #---------------------------------------------------------------------------------------------# 147 | # DNS Forwarder Section # 148 | #---------------------------------------------------------------------------------------------# 149 | try { 150 | Section -Style Heading3 "Forwarder Options" { 151 | Paragraph "The following table details forwarder configuration settings" 152 | BlankLine 153 | $OutObj = @() 154 | try { 155 | $DNSSetting = Get-DnsServerForwarder -CimSession $TempCIMSession 156 | $Recursion = Get-DnsServerRecursion -CimSession $TempCIMSession 157 | $inObj = [ordered] @{ 158 | 'IP Address' = $DNSSetting.IPAddress -join "," 159 | 'Timeout' = ("$($DNSSetting.Timeout)/s") 160 | 'Use Root Hint' = ($DNSSetting.UseRootHint) 161 | 'Use Recursion' = ($Recursion.Enable) 162 | } 163 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 164 | $TableParams = @{ 165 | Name = "Forwarders - $($System.toUpper().split(".")[0])" 166 | List = $false 167 | ColumnWidths = 25, 25, 25, 25 168 | } 169 | if ($Report.ShowTableCaptions) { 170 | $TableParams['Caption'] = "- $($TableParams.Name)" 171 | } 172 | $OutObj | Table @TableParams 173 | } catch { 174 | Write-PScriboMessage -IsWarning "$($_.Exception.Message) (Forwarder Item)" 175 | } 176 | } 177 | } catch { 178 | Write-PScriboMessage -IsWarning "$($_.Exception.Message) (Forwarder Table)" 179 | } 180 | } catch { 181 | Write-PScriboMessage -IsWarning "$($_.Exception.Message) (DNS Infrastructure Section)" 182 | } 183 | } 184 | 185 | end {} 186 | 187 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinFOCluster.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinFOCluster { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Microsoft FailOver Cluster configuration 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.2 9 | Author: Jonathan Colon 10 | Twitter: @jcolonfzenpr 11 | Github: rebelinux 12 | Credits: Iain Brighton (@iainbrighton) - PScribo module 13 | 14 | .LINK 15 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 16 | #> 17 | 18 | [CmdletBinding()] 19 | param ( 20 | ) 21 | 22 | begin { 23 | Write-PScriboMessage "FailOverCluster InfoLevel set at $($InfoLevel.FailOverCluster)." 24 | Write-PScriboMessage "Collecting Host FailOver Cluster Server information." 25 | } 26 | 27 | process { 28 | try { 29 | $Settings = Invoke-Command -Session $TempPssSession { Get-Cluster | Select-Object -Property * } 30 | if ($Settings) { 31 | $OutObj = @() 32 | try { 33 | $inObj = [ordered] @{ 34 | 'Name' = $Settings.Name 35 | 'Domain' = $Settings.Domain 36 | 'Shared Volumes Root' = $Settings.SharedVolumesRoot 37 | 'Administrative Access Point' = $Settings.AdministrativeAccessPoint 38 | 'Description' = $Settings.Description 39 | } 40 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 41 | } catch { 42 | Write-PScriboMessage -IsWarning $_.Exception.Message 43 | } 44 | 45 | $TableParams = @{ 46 | Name = "FailOver Cluster Servers Settings - $($System.split(".")[0])" 47 | List = $true 48 | ColumnWidths = 40, 60 49 | } 50 | if ($Report.ShowTableCaptions) { 51 | $TableParams['Caption'] = "- $($TableParams.Name)" 52 | } 53 | $OutObj | Table @TableParams 54 | } 55 | } catch { 56 | Write-PScriboMessage -IsWarning $_.Exception.Message 57 | } 58 | } 59 | 60 | end {} 61 | 62 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinFOClusterAvailableDisk.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinFOClusterAvailableDisk { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Microsoft FailOver Cluster Available Disk 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.2 9 | Author: Jonathan Colon 10 | Twitter: @jcolonfzenpr 11 | Github: rebelinux 12 | Credits: Iain Brighton (@iainbrighton) - PScribo module 13 | 14 | .LINK 15 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 16 | #> 17 | 18 | [CmdletBinding()] 19 | param ( 20 | ) 21 | 22 | begin { 23 | Write-PScriboMessage "FailOverCluster InfoLevel set at $($InfoLevel.FailOverCluster)." 24 | Write-PScriboMessage "Collecting Host FailOver Cluster Available Disk information." 25 | } 26 | 27 | process { 28 | try { 29 | $Settings = Invoke-Command -Session $TempPssSession { Get-ClusterAvailableDisk } | Sort-Object -Property Name 30 | if ($Settings) { 31 | Section -Style Heading3 "Available Disk" { 32 | $OutObj = @() 33 | foreach ($Setting in $Settings) { 34 | try { 35 | $inObj = [ordered] @{ 36 | 'Name' = $Setting.Name 37 | 'Number' = $Setting.Number 38 | 'Size' = ConvertTo-FileSizeString $Setting.Size 39 | } 40 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 41 | } catch { 42 | Write-PScriboMessage -IsWarning $_.Exception.Message 43 | } 44 | } 45 | 46 | $TableParams = @{ 47 | Name = "Available Disk - $($Cluster)" 48 | List = $false 49 | ColumnWidths = 40, 30, 30 50 | } 51 | if ($Report.ShowTableCaptions) { 52 | $TableParams['Caption'] = "- $($TableParams.Name)" 53 | } 54 | $OutObj | Table @TableParams 55 | } 56 | } 57 | } catch { 58 | Write-PScriboMessage -IsWarning $_.Exception.Message 59 | } 60 | } 61 | 62 | end {} 63 | 64 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinFOClusterFaultDomain.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinFOClusterFaultDomain { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Microsoft FailOver Cluster Fault Domain 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.2 9 | Author: Jonathan Colon 10 | Twitter: @jcolonfzenpr 11 | Github: rebelinux 12 | Credits: Iain Brighton (@iainbrighton) - PScribo module 13 | 14 | .LINK 15 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 16 | #> 17 | 18 | [CmdletBinding()] 19 | param ( 20 | ) 21 | 22 | begin { 23 | Write-PScriboMessage "FailOverCluster InfoLevel set at $($InfoLevel.FailOverCluster)." 24 | Write-PScriboMessage "Collecting Host FailOver Cluster Fault Domain information." 25 | } 26 | 27 | process { 28 | try { 29 | $Settings = Get-ClusterFaultDomain -CimSession $TempCimSession | Sort-Object -Property Name 30 | if ($Settings) { 31 | Section -Style Heading3 "Fault Domain" { 32 | $OutObj = @() 33 | foreach ($Setting in $Settings) { 34 | try { 35 | $inObj = [ordered] @{ 36 | 'Name' = $Setting.Name 37 | 'Type' = $Setting.Type 38 | 'Parent Name' = Switch ([string]::IsNullOrEmpty($Setting.ParentName)) { 39 | $true { "--" } 40 | $false { $Setting.ParentName } 41 | default { 'Unknown' } 42 | } 43 | 'Children Names' = Switch ([string]::IsNullOrEmpty($Setting.ChildrenNames)) { 44 | $true { "--" } 45 | $false { $Setting.ChildrenNames } 46 | default { 'Unknown' } 47 | } 48 | 'Location' = $Setting.Location 49 | } 50 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 51 | } catch { 52 | Write-PScriboMessage -IsWarning $_.Exception.Message 53 | } 54 | } 55 | 56 | $TableParams = @{ 57 | Name = "Fault Domain - $($Cluster)" 58 | List = $false 59 | ColumnWidths = 20, 20, 20, 20, 20 60 | } 61 | if ($Report.ShowTableCaptions) { 62 | $TableParams['Caption'] = "- $($TableParams.Name)" 63 | } 64 | $OutObj | Table @TableParams 65 | } 66 | } 67 | } catch { 68 | Write-PScriboMessage -IsWarning $_.Exception.Message 69 | } 70 | } 71 | 72 | end {} 73 | 74 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinFOClusterNetwork.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinFOClusterNetwork { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Microsoft FailOver Cluster Networks 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.2 9 | Author: Jonathan Colon 10 | Twitter: @jcolonfzenpr 11 | Github: rebelinux 12 | Credits: Iain Brighton (@iainbrighton) - PScribo module 13 | 14 | .LINK 15 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 16 | #> 17 | 18 | [CmdletBinding()] 19 | param ( 20 | ) 21 | 22 | begin { 23 | Write-PScriboMessage "FailOverCluster InfoLevel set at $($InfoLevel.FailOverCluster)." 24 | Write-PScriboMessage "Collecting Host FailOver Cluster Networks information." 25 | } 26 | 27 | process { 28 | try { 29 | $Settings = Invoke-Command -Session $TempPssSession { Get-ClusterNetwork } | Sort-Object -Property Name 30 | if ($Settings) { 31 | Section -Style Heading3 "Networks" { 32 | $OutObj = @() 33 | foreach ($Setting in $Settings) { 34 | try { 35 | $inObj = [ordered] @{ 36 | 'Name' = $Setting.Name 37 | 'State' = $Setting.State 38 | 'Role' = $Setting.Role 39 | 'Address' = "$($Setting.Address)/$($Setting.AddressMask)" 40 | } 41 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 42 | } catch { 43 | Write-PScriboMessage -IsWarning $_.Exception.Message 44 | } 45 | } 46 | 47 | 48 | if ($HealthCheck.FailOverCluster.Network) { 49 | $OutObj | Where-Object { $_.'State' -ne 'UP' } | Set-Style -Style Warning -Property 'State' 50 | } 51 | 52 | $TableParams = @{ 53 | Name = "Networks - $($Cluster)" 54 | List = $false 55 | ColumnWidths = 30, 15, 20, 35 56 | } 57 | if ($Report.ShowTableCaptions) { 58 | $TableParams['Caption'] = "- $($TableParams.Name)" 59 | } 60 | $OutObj | Table @TableParams 61 | # Cluster Network Interfaces 62 | Get-AbrWinFOClusterNetworkInterface 63 | } 64 | } 65 | } catch { 66 | Write-PScriboMessage -IsWarning $_.Exception.Message 67 | } 68 | } 69 | 70 | end {} 71 | 72 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinFOClusterNetworkInterface.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinFOClusterNetworkInterface { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Microsoft FailOver Cluster Network Interfaces 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.2 9 | Author: Jonathan Colon 10 | Twitter: @jcolonfzenpr 11 | Github: rebelinux 12 | Credits: Iain Brighton (@iainbrighton) - PScribo module 13 | 14 | .LINK 15 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 16 | #> 17 | 18 | [CmdletBinding()] 19 | param ( 20 | ) 21 | 22 | begin { 23 | Write-PScriboMessage "FailOverCluster InfoLevel set at $($InfoLevel.FailOverCluster)." 24 | Write-PScriboMessage "Collecting Host FailOver Cluster Network Interface information." 25 | } 26 | 27 | process { 28 | try { 29 | $Settings = Invoke-Command -Session $TempPssSession { Get-ClusterNetworkInterface } | Sort-Object -Property Name 30 | if ($Settings) { 31 | Section -Style Heading3 "Interfaces" { 32 | $OutObj = @() 33 | foreach ($Setting in $Settings) { 34 | try { 35 | $inObj = [ordered] @{ 36 | 'Name' = $Setting.Name 37 | 'Node' = $Setting.Node 38 | 'Network' = $Setting.Network 39 | 'State' = $Setting.State 40 | } 41 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 42 | } catch { 43 | Write-PScriboMessage -IsWarning $_.Exception.Message 44 | } 45 | } 46 | 47 | 48 | if ($HealthCheck.FailOverCluster.Network) { 49 | $OutObj | Where-Object { $_.'State' -ne 'UP' } | Set-Style -Style Warning -Property 'State' 50 | } 51 | 52 | $TableParams = @{ 53 | Name = "Interfaces - $($Cluster)" 54 | List = $false 55 | ColumnWidths = 30, 25, 30, 15 56 | } 57 | if ($Report.ShowTableCaptions) { 58 | $TableParams['Caption'] = "- $($TableParams.Name)" 59 | } 60 | $OutObj | Table @TableParams 61 | } 62 | } 63 | } catch { 64 | Write-PScriboMessage -IsWarning $_.Exception.Message 65 | } 66 | } 67 | 68 | end {} 69 | 70 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinFOClusterNode.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinFOClusterNode { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Microsoft FailOver Cluster Nodes 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.2 9 | Author: Jonathan Colon 10 | Twitter: @jcolonfzenpr 11 | Github: rebelinux 12 | Credits: Iain Brighton (@iainbrighton) - PScribo module 13 | 14 | .LINK 15 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 16 | #> 17 | [CmdletBinding()] 18 | param ( 19 | ) 20 | 21 | begin { 22 | Write-PScriboMessage "FailOverCluster InfoLevel set at $($InfoLevel.Infrastructure.FailOverCluster)." 23 | } 24 | 25 | process { 26 | try { 27 | $Settings = Invoke-Command -Session $TempPssSession { Get-ClusterNode } | Sort-Object -Property Identity 28 | if ($Settings) { 29 | Write-PScriboMessage "Collecting Host FailOver Cluster Permissions Settings information." 30 | Section -Style Heading3 'Nodes' { 31 | $OutObj = @() 32 | foreach ($Setting in $Settings) { 33 | $inObj = [ordered] @{ 34 | 'Name' = $Setting.Name 35 | 'State' = $Setting.State 36 | 'Type' = $Setting.Type 37 | 'Cluster' = $Setting.Cluster 38 | 'Fault Domain' = $Setting.FaultDomain 39 | 'Model' = $Setting.Model 40 | 'Manufacturer' = $Setting.Manufacturer 41 | 'Description' = $Setting.Description 42 | 43 | } 44 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 45 | } 46 | 47 | if ($HealthCheck.FailOverCluster.Nodes) { 48 | $OutObj | Where-Object { $_.'State' -ne 'UP' } | Set-Style -Style Warning -Property 'State' 49 | } 50 | 51 | if ($InfoLevel.FailOverCluster -ge 2) { 52 | Paragraph "The following sections detail the configuration of the Failover Cluster Nodes." 53 | foreach ($Setting in $OutObj) { 54 | Section -ExcludeFromTOC -Style NOTOCHeading4 "$($Setting.Name)" { 55 | $TableParams = @{ 56 | Name = "Node - $($Setting.Name)" 57 | List = $true 58 | ColumnWidths = 50, 50 59 | } 60 | if ($Report.ShowTableCaptions) { 61 | $TableParams['Caption'] = "- $($TableParams.Name)" 62 | } 63 | $Setting | Table @TableParams 64 | } 65 | } 66 | } else { 67 | Paragraph "The following table summarizes the configuration of the Failover Cluster Nodes." 68 | BlankLine 69 | $TableParams = @{ 70 | Name = "Nodes - $($Cluster)" 71 | List = $false 72 | Columns = 'Name', 'State', 'Type' 73 | ColumnWidths = 40, 30, 30 74 | } 75 | if ($Report.ShowTableCaptions) { 76 | $TableParams['Caption'] = "- $($TableParams.Name)" 77 | } 78 | $OutObj | Table @TableParams 79 | } 80 | } 81 | } 82 | } catch { 83 | Write-PScriboMessage -IsWarning "FailOver Cluster Nodes Section: $($_.Exception.Message)" 84 | } 85 | } 86 | 87 | end {} 88 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinFOClusterPermission.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinFOClusterPermission { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Microsoft FailOver Cluster Permissions 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.2 9 | Author: Jonathan Colon 10 | Twitter: @jcolonfzenpr 11 | Github: rebelinux 12 | Credits: Iain Brighton (@iainbrighton) - PScribo module 13 | 14 | .LINK 15 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 16 | #> 17 | 18 | [CmdletBinding()] 19 | param ( 20 | ) 21 | 22 | begin { 23 | Write-PScriboMessage "FailOverCluster InfoLevel set at $($InfoLevel.FailOverCluster)." 24 | Write-PScriboMessage "Collecting Host FailOver Cluster Permissions Settings information." 25 | } 26 | 27 | process { 28 | try { 29 | $Settings = Invoke-Command -Session $TempPssSession { Get-ClusterAccess } | Sort-Object -Property Identity 30 | if ($Settings) { 31 | Section -Style Heading3 "Access Permissions" { 32 | $OutObj = @() 33 | foreach ($Setting in $Settings) { 34 | try { 35 | $inObj = [ordered] @{ 36 | 'Identity' = $Setting.IdentityReference 37 | 'Access Control Type' = $Setting.AccessControlType 38 | 'Rights' = $Setting.ClusterRights 39 | } 40 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 41 | } catch { 42 | Write-PScriboMessage -IsWarning $_.Exception.Message 43 | } 44 | } 45 | 46 | $TableParams = @{ 47 | Name = "Access Permission - $($Cluster)" 48 | List = $false 49 | ColumnWidths = 60, 20, 20 50 | } 51 | if ($Report.ShowTableCaptions) { 52 | $TableParams['Caption'] = "- $($TableParams.Name)" 53 | } 54 | $OutObj | Table @TableParams 55 | } 56 | } 57 | } catch { 58 | Write-PScriboMessage -IsWarning $_.Exception.Message 59 | } 60 | } 61 | 62 | end {} 63 | 64 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinFOClusterQuorum.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinFOClusterQuorum { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Microsoft FailOver Cluster Quorum 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.2 9 | Author: Jonathan Colon 10 | Twitter: @jcolonfzenpr 11 | Github: rebelinux 12 | Credits: Iain Brighton (@iainbrighton) - PScribo module 13 | 14 | .LINK 15 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 16 | #> 17 | 18 | [CmdletBinding()] 19 | param ( 20 | ) 21 | 22 | begin { 23 | Write-PScriboMessage "FailOverCluster InfoLevel set at $($InfoLevel.FailOverCluster)." 24 | Write-PScriboMessage "Collecting Host FailOver Cluster Quorum information." 25 | } 26 | 27 | process { 28 | try { 29 | $Settings = Invoke-Command -Session $TempPssSession { Get-ClusterQuorum | Select-Object -Property * } | Sort-Object -Property Name 30 | if ($Settings) { 31 | Section -Style Heading3 "Quorum" { 32 | $OutObj = @() 33 | foreach ($Setting in $Settings) { 34 | try { 35 | $inObj = [ordered] @{ 36 | 'Cluster' = $Setting.Cluster 37 | 'Quorum Resource' = $Setting.QuorumResource 38 | 'Quorum Type' = $Setting.QuorumType 39 | } 40 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 41 | } catch { 42 | Write-PScriboMessage -IsWarning $_.Exception.Message 43 | } 44 | } 45 | 46 | $TableParams = @{ 47 | Name = "Quorum - $($Cluster)" 48 | List = $false 49 | ColumnWidths = 33, 34, 33 50 | } 51 | if ($Report.ShowTableCaptions) { 52 | $TableParams['Caption'] = "- $($TableParams.Name)" 53 | } 54 | $OutObj | Table @TableParams 55 | } 56 | } 57 | } catch { 58 | Write-PScriboMessage -IsWarning $_.Exception.Message 59 | } 60 | } 61 | 62 | end {} 63 | 64 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinFOClusterResource.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinFOClusterResource { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Microsoft FailOver Cluster Resource 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.2 9 | Author: Jonathan Colon 10 | Twitter: @jcolonfzenpr 11 | Github: rebelinux 12 | Credits: Iain Brighton (@iainbrighton) - PScribo module 13 | 14 | .LINK 15 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 16 | #> 17 | 18 | [CmdletBinding()] 19 | param ( 20 | ) 21 | 22 | begin { 23 | Write-PScriboMessage "FailOverCluster InfoLevel set at $($InfoLevel.FailOverCluster)." 24 | Write-PScriboMessage "Collecting Host FailOver Cluster Resource information." 25 | } 26 | 27 | process { 28 | try { 29 | $Settings = Invoke-Command -Session $TempPssSession { Get-ClusterResource | Select-Object -Property * } | Sort-Object -Property Name 30 | if ($Settings) { 31 | Section -Style Heading3 "Resource" { 32 | $OutObj = @() 33 | foreach ($Setting in $Settings) { 34 | try { 35 | $inObj = [ordered] @{ 36 | 'Name' = $Setting.Name 37 | 'Owner Group' = $Setting.OwnerGroup 38 | 'Resource Type' = $Setting.ResourceType 39 | 'State' = $Setting.State 40 | } 41 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 42 | } catch { 43 | Write-PScriboMessage -IsWarning $_.Exception.Message 44 | } 45 | } 46 | 47 | 48 | if ($HealthCheck.FailOverCluster.Network) { 49 | $OutObj | Where-Object { $_.'State' -notlike 'Online' } | Set-Style -Style Warning -Property 'State' 50 | } 51 | 52 | $TableParams = @{ 53 | Name = "Resource - $($Cluster)" 54 | List = $false 55 | ColumnWidths = 25, 25, 35, 15 56 | } 57 | if ($Report.ShowTableCaptions) { 58 | $TableParams['Caption'] = "- $($TableParams.Name)" 59 | } 60 | $OutObj | Table @TableParams 61 | } 62 | } 63 | } catch { 64 | Write-PScriboMessage -IsWarning $_.Exception.Message 65 | } 66 | } 67 | 68 | end {} 69 | 70 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinFOClusterSharedVolume.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinFOClusterSharedVolume { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Microsoft FailOver Cluster Shared Volume 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.5 9 | Author: Jonathan Colon 10 | Twitter: @jcolonfzenpr 11 | Github: rebelinux 12 | Credits: Iain Brighton (@iainbrighton) - PScribo module 13 | 14 | .LINK 15 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 16 | #> 17 | 18 | [CmdletBinding()] 19 | param ( 20 | ) 21 | 22 | begin { 23 | Write-PScriboMessage "FailOverCluster InfoLevel set at $($InfoLevel.FailOverCluster)." 24 | Write-PScriboMessage "Collecting Host FailOver Cluster Shared Volume information." 25 | } 26 | 27 | process { 28 | try { 29 | $Settings = Invoke-Command -Session $TempPssSession { Get-ClusterSharedVolume | Select-Object -Property * } | Sort-Object -Property Name 30 | if ($Settings) { 31 | Section -Style Heading3 "Cluster Shared Volume" { 32 | $OutObj = @() 33 | foreach ($Setting in $Settings) { 34 | try { 35 | $inObj = [ordered] @{ 36 | 'Name' = $Setting.Name 37 | 'Owner Node' = $Setting.OwnerNode 38 | 'Shared Volume' = Switch ([string]::IsNullOrEmpty($Setting.SharedVolumeInfo.FriendlyVolumeName)) { 39 | $true { "Unknown" } 40 | $false { $Setting.SharedVolumeInfo.FriendlyVolumeName } 41 | default { "--" } 42 | } 43 | 'State' = $Setting.State 44 | } 45 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 46 | } catch { 47 | Write-PScriboMessage -IsWarning $_.Exception.Message 48 | } 49 | } 50 | 51 | 52 | if ($HealthCheck.FailOverCluster.ClusterSharedVolume) { 53 | $OutObj | Where-Object { $_.'State' -notlike 'Online' } | Set-Style -Style Warning -Property 'State' 54 | } 55 | 56 | $TableParams = @{ 57 | Name = "Cluster Shared Volume - $($Cluster)" 58 | List = $false 59 | ColumnWidths = 25, 25, 35, 15 60 | } 61 | if ($Report.ShowTableCaptions) { 62 | $TableParams['Caption'] = "- $($TableParams.Name)" 63 | } 64 | $OutObj | Table @TableParams 65 | #Cluster Shared Volume State 66 | Get-AbrWinFOClusterSharedVolumeState 67 | } 68 | } 69 | } catch { 70 | Write-PScriboMessage -IsWarning $_.Exception.Message 71 | } 72 | } 73 | 74 | end {} 75 | 76 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinFOClusterSharedVolumeState.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinFOClusterSharedVolumeState { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Microsoft FailOver Cluster Shared Volume State 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.2 9 | Author: Jonathan Colon 10 | Twitter: @jcolonfzenpr 11 | Github: rebelinux 12 | Credits: Iain Brighton (@iainbrighton) - PScribo module 13 | 14 | .LINK 15 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 16 | #> 17 | 18 | [CmdletBinding()] 19 | param ( 20 | ) 21 | 22 | begin { 23 | Write-PScriboMessage "FailOverCluster InfoLevel set at $($InfoLevel.FailOverCluster)." 24 | Write-PScriboMessage "Collecting Host FailOver Cluster Shared Volume State information." 25 | } 26 | 27 | process { 28 | try { 29 | $Settings = Invoke-Command -Session $TempPssSession { Get-ClusterSharedVolumeState | Select-Object -Property * } | Sort-Object -Property Name 30 | if ($Settings) { 31 | Section -Style Heading4 "Cluster Shared Volume State" { 32 | $OutObj = @() 33 | foreach ($Setting in $Settings) { 34 | try { 35 | $inObj = [ordered] @{ 36 | 'Name' = $Setting.Name 37 | 'Node' = $Setting.Node 38 | 'State' = $Setting.StateInfo 39 | 'Volume Name' = $Setting.VolumeFriendlyName 40 | 'Volume Path' = $Setting.VolumeName 41 | } 42 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 43 | } catch { 44 | Write-PScriboMessage -IsWarning $_.Exception.Message 45 | } 46 | } 47 | 48 | if ($HealthCheck.FailOverCluster.ClusterSharedVolume) { 49 | $OutObj | Where-Object { $_.State.Value -eq 'Unavailable' } | Set-Style -Style Warning -Property 'State' 50 | } 51 | 52 | $TableParams = @{ 53 | Name = "Cluster Shared Volume State - $($Cluster)" 54 | List = $false 55 | ColumnWidths = 20, 20, 20, 20, 20 56 | } 57 | if ($Report.ShowTableCaptions) { 58 | $TableParams['Caption'] = "- $($TableParams.Name)" 59 | } 60 | $OutObj | Table @TableParams 61 | } 62 | } 63 | } catch { 64 | Write-PScriboMessage -IsWarning $_.Exception.Message 65 | } 66 | } 67 | 68 | end {} 69 | 70 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinHostHWSummary.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinHostHWSummary { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Windows Server Hardware Inventory information. 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.2 9 | Author: Andrew Ramsay 10 | Editor: Jonathan Colon 11 | Twitter: @asbuiltreport 12 | Github: AsBuiltReport 13 | Credits: Iain Brighton (@iainbrighton) - PScribo module 14 | 15 | .LINK 16 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 17 | #> 18 | [CmdletBinding()] 19 | param ( 20 | ) 21 | 22 | begin { 23 | Write-PScriboMessage "Hardware InfoLevel set at $($InfoLevel.Hardware)." 24 | Write-PScriboMessage "Collecting Host Inventory information." 25 | } 26 | 27 | process { 28 | if ($InfoLevel.Hardware -ge 1) { 29 | try { 30 | Section -Style Heading2 'Host Hardware Settings' { 31 | Paragraph 'The following section details hardware settings for the host' 32 | BlankLine 33 | $OutObj = @() 34 | $inObj = [ordered] @{ 35 | 'Manufacturer' = $HostComputer.Manufacturer 36 | 'Model' = $HostComputer.Model 37 | 'Product ID' = $HostComputer.SystemSKUNumbe 38 | 'Serial Number' = $HostBIOS.SerialNumber 39 | 'BIOS Version' = $HostBIOS.Version 40 | 'Processor Manufacturer' = $HostCPU[0].Manufacturer 41 | 'Processor Model' = $HostCPU[0].Name 42 | 'Number of CPU Cores' = ($HostCPU.NumberOfCores | Measure-Object -Sum).Sum 43 | 'Number of Logical Cores' = ($HostCPU.NumberOfLogicalProcessors | Measure-Object -Sum).Sum 44 | 'Physical Memory' = "$([Math]::Round($HostComputer.TotalPhysicalMemory / 1Gb)) GB" 45 | } 46 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 47 | 48 | $TableParams = @{ 49 | Name = "Host Hardware Specifications" 50 | List = $true 51 | ColumnWidths = 50, 50 52 | } 53 | if ($Report.ShowTableCaptions) { 54 | $TableParams['Caption'] = "- $($TableParams.Name)" 55 | } 56 | $OutObj | Table @TableParams 57 | } 58 | } catch { 59 | Write-PScriboMessage -IsWarning $_.Exception.Message 60 | } 61 | } 62 | } 63 | end {} 64 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinHostStorage.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinHostStorage { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Windows Server Host Storage information. 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.6 9 | Author: Andrew Ramsay 10 | Editor: Jonathan Colon 11 | Twitter: @asbuiltreport 12 | Github: AsBuiltReport 13 | Credits: Iain Brighton (@iainbrighton) - PScribo module 14 | 15 | .LINK 16 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 17 | #> 18 | [CmdletBinding()] 19 | param ( 20 | ) 21 | 22 | begin { 23 | Write-PScriboMessage "Storage InfoLevel set at $($InfoLevel.Storage)." 24 | Write-PScriboMessage "Collecting Host Storage information." 25 | } 26 | 27 | process { 28 | if ($InfoLevel.Storage -ge 1) { 29 | try { 30 | $HostDisks = Invoke-Command -Session $TempPssSession -ScriptBlock { Get-Disk | Where-Object { $_.BusType -ne "iSCSI" -and $_.BusType -ne "Fibre Channel" } } 31 | if ($HostDisks) { 32 | Section -Style Heading3 'Local Disks' { 33 | Paragraph 'The following table details physical disks installed in the host' 34 | BlankLine 35 | $OutObj = @() 36 | ForEach ($Disk in $HostDisks) { 37 | try { 38 | $inObj = [ordered] @{ 39 | 'Disk Number' = $Disk.Number 40 | 'Model' = $Disk.Model 41 | 'Serial Number' = $Disk.SerialNumber 42 | 'Partition Style' = $Disk.PartitionStyle 43 | 'Disk Size' = "$([Math]::Round($Disk.Size / 1Gb)) GB" 44 | } 45 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 46 | } catch { 47 | Write-PScriboMessage -IsWarning $_.Exception.Message 48 | } 49 | } 50 | $TableParams = @{ 51 | Name = "Local Disks" 52 | List = $false 53 | ColumnWidths = 20, 20, 20, 20, 20 54 | } 55 | if ($Report.ShowTableCaptions) { 56 | $TableParams['Caption'] = "- $($TableParams.Name)" 57 | } 58 | $OutObj | Sort-Object -Property 'Disk Number' | Table @TableParams 59 | } 60 | } 61 | } catch { 62 | Write-PScriboMessage -IsWarning $_.Exception.Message 63 | } 64 | #Report any SAN Disks if they exist 65 | try { 66 | $SanDisks = Invoke-Command -Session $TempPssSession -ScriptBlock { Get-Disk | Where-Object { $_.BusType -Eq "iSCSI" -or $_.BusType -Eq "Fibre Channel" } } 67 | if ($SanDisks) { 68 | Section -Style Heading3 'SAN Disks' { 69 | Paragraph 'The following section details SAN disks connected to the host' 70 | BlankLine 71 | $OutObj = @() 72 | ForEach ($Disk in $SanDisks) { 73 | try { 74 | $inObj = [ordered] @{ 75 | 'Disk Number' = $Disk.Number 76 | 'Model' = $Disk.Model 77 | 'Serial Number' = $Disk.SerialNumber 78 | 'Partition Style' = $Disk.PartitionStyle 79 | 'Disk Size' = "$([Math]::Round($Disk.Size / 1Gb)) GB" 80 | } 81 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 82 | } catch { 83 | Write-PScriboMessage -IsWarning $_.Exception.Message 84 | } 85 | } 86 | $TableParams = @{ 87 | Name = "SAN Disks" 88 | List = $false 89 | ColumnWidths = 20, 20, 20, 20, 20 90 | } 91 | if ($Report.ShowTableCaptions) { 92 | $TableParams['Caption'] = "- $($TableParams.Name)" 93 | } 94 | $OutObj | Sort-Object -Property 'Disk Number' | Table @TableParams 95 | } 96 | } 97 | } catch { 98 | Write-PScriboMessage -IsWarning $_.Exception.Message 99 | } 100 | } 101 | } 102 | end {} 103 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinHostStorageMPIO.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinHostStorageMPIO { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Windows Server Host Storage MPIO information. 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.6 9 | Author: Andrew Ramsay 10 | Editor: Jonathan Colon 11 | Twitter: @asbuiltreport 12 | Github: AsBuiltReport 13 | Credits: Iain Brighton (@iainbrighton) - PScribo module 14 | 15 | .LINK 16 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 17 | #> 18 | [CmdletBinding()] 19 | param ( 20 | ) 21 | 22 | begin { 23 | Write-PScriboMessage "Storage InfoLevel set at $($InfoLevel.Storage)." 24 | Write-PScriboMessage "Collecting Host Storage MPIO information." 25 | } 26 | 27 | process { 28 | if ($InfoLevel.Storage -ge 1 -and $OSType.Value -ne 'WorkStation') { 29 | try { 30 | $MPIOInstalledCheck = Invoke-Command -Session $TempPssSession { Get-WindowsFeature | Where-Object { $_.Name -like "Multipath*" } } 31 | if ($MPIOInstalledCheck.InstallState -eq "Installed") { 32 | try { 33 | Section -Style Heading3 'Host MPIO Settings' { 34 | Paragraph 'The following section details host MPIO Settings' 35 | BlankLine 36 | [string]$MpioLoadBalance = Invoke-Command -Session $TempPssSession -ScriptBlock { Get-MSDSMGlobalDefaultLoadBalancePolicy } 37 | Paragraph "The default load balancing policy is: $MpioLoadBalance" 38 | BlankLine 39 | $MpioAutoClaim = Invoke-Command -Session $TempPssSession -ScriptBlock { Get-MSDSMAutomaticClaimSettings | Select-Object -ExpandProperty Keys } 40 | if ($MpioAutoClaim) { 41 | Section -Style Heading4 'Multipath I/O AutoClaim' { 42 | Paragraph 'The following table details the BUS types MPIO will automatically claim for' 43 | BlankLine 44 | $OutObj = @() 45 | foreach ($key in $MpioAutoClaim) { 46 | try { 47 | $Temp = "" | Select-Object BusType, State 48 | $Temp.BusType = $key 49 | $Temp.State = 'Enabled' 50 | $OutObj += $Temp 51 | } catch { 52 | Write-PScriboMessage -IsWarning $_.Exception.Message 53 | } 54 | } 55 | $TableParams = @{ 56 | Name = "Multipath I/O Auto Claim Settings" 57 | List = $false 58 | ColumnWidths = 50, 50 59 | } 60 | if ($Report.ShowTableCaptions) { 61 | $TableParams['Caption'] = "- $($TableParams.Name)" 62 | } 63 | $OutObj | Sort-Object -Property 'BusType' | Table @TableParams 64 | } 65 | } 66 | try { 67 | $MpioAvailableHws = Invoke-Command -Session $TempPssSession -ScriptBlock { Get-MPIOAvailableHw } 68 | if ($MpioAvailableHws) { 69 | Section -Style Heading4 'MPIO Detected Hardware' { 70 | Paragraph 'The following table details the hardware detected and claimed by MPIO' 71 | BlankLine 72 | $OutObj = @() 73 | foreach ($MpioAvailableHw in $MpioAvailableHws) { 74 | try { 75 | $inObj = [ordered] @{ 76 | 'Vendor' = $MpioAvailableHw.VendorId 77 | 'Product' = $MpioAvailableHw.ProductId 78 | 'BusType' = $MpioAvailableHw.BusType 79 | 'Multipathed' = $MpioAvailableHw.IsMultipathed 80 | } 81 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 82 | } catch { 83 | Write-PScriboMessage -IsWarning $_.Exception.Message 84 | } 85 | } 86 | $TableParams = @{ 87 | Name = "MPIO Available Hardware" 88 | List = $false 89 | ColumnWidths = 25, 25, 25, 25 90 | } 91 | if ($Report.ShowTableCaptions) { 92 | $TableParams['Caption'] = "- $($TableParams.Name)" 93 | } 94 | $OutObj | Table @TableParams 95 | } 96 | } 97 | } catch { 98 | Write-PScriboMessage -IsWarning $_.Exception.Message 99 | } 100 | } 101 | } catch { 102 | Write-PScriboMessage -IsWarning $_.Exception.Message 103 | } 104 | } 105 | } catch { 106 | Write-PScriboMessage -IsWarning $_.Exception.Message 107 | } 108 | } 109 | } 110 | end {} 111 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinHostStorageVolume.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinHostStorageVolume { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Windows Server Host Storage Volume information. 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.6 9 | Author: Andrew Ramsay 10 | Editor: Jonathan Colon 11 | Twitter: @asbuiltreport 12 | Github: AsBuiltReport 13 | Credits: Iain Brighton (@iainbrighton) - PScribo module 14 | 15 | .LINK 16 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 17 | #> 18 | [CmdletBinding()] 19 | param ( 20 | ) 21 | 22 | begin { 23 | Write-PScriboMessage "Storage InfoLevel set at $($InfoLevel.Storage)." 24 | Write-PScriboMessage "Collecting Host Storage Volume information." 25 | } 26 | 27 | process { 28 | if ($InfoLevel.Storage -ge 1) { 29 | try { 30 | $HostVolumes = Invoke-Command -Session $TempPssSession -ScriptBlock { Get-Volume | Where-Object { $_.DriveType -ne "CD-ROM" -and $_.DriveLetter } } 31 | if ($HostVolumes) { 32 | Section -Style Heading3 'Host Volumes' { 33 | Paragraph 'The following section details local volumes on the host' 34 | BlankLine 35 | $OutObj = @() 36 | ForEach ($HostVolume in $HostVolumes) { 37 | try { 38 | $inObj = [ordered] @{ 39 | 'Drive Letter' = $HostVolume.DriveLetter 40 | 'File System Label' = $HostVolume.FileSystemLabel 41 | 'File System' = $HostVolume.FileSystem 42 | 'Size' = "$([Math]::Round($HostVolume.Size / 1gb)) GB" 43 | 'Free Space' = "$([Math]::Round($HostVolume.SizeRemaining / 1gb)) GB" 44 | 'Health Status' = $HostVolume.HealthStatus 45 | } 46 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 47 | } catch { 48 | Write-PScriboMessage -IsWarning $_.Exception.Message 49 | } 50 | } 51 | $TableParams = @{ 52 | Name = "Host Volumes" 53 | List = $false 54 | ColumnWidths = 15, 15, 15, 20, 20, 15 55 | } 56 | if ($Report.ShowTableCaptions) { 57 | $TableParams['Caption'] = "- $($TableParams.Name)" 58 | } 59 | $OutObj | Sort-Object -Property 'Drive Letter' | Table @TableParams 60 | } 61 | } 62 | } catch { 63 | Write-PScriboMessage -IsWarning $_.Exception.Message 64 | } 65 | } 66 | } 67 | end {} 68 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinHyperVNetworking.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinHyperVNetworking { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Windows Server Hyper-V Networking information. 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.6 9 | Author: Andrew Ramsay 10 | Editor: Jonathan Colon 11 | Twitter: @asbuiltreport 12 | Github: AsBuiltReport 13 | Credits: Iain Brighton (@iainbrighton) - PScribo module 14 | 15 | .LINK 16 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 17 | #> 18 | [CmdletBinding()] 19 | param ( 20 | ) 21 | 22 | begin { 23 | Write-PScriboMessage "Hyper-V InfoLevel set at $($InfoLevel.HyperV)." 24 | Write-PScriboMessage "Collecting Hyper-V Networking information." 25 | } 26 | 27 | process { 28 | if ($InfoLevel.HyperV -ge 1) { 29 | try { 30 | try { 31 | Section -Style Heading3 "Hyper-V MAC Pool settings" { 32 | $OutObj = @() 33 | $inObj = [ordered] @{ 34 | 'Mac Address Minimum' = Switch (($VmHost.MacAddressMinimum).Length) { 35 | 0 { "--" } 36 | 12 { $VmHost.MacAddressMinimum -replace '..(?!$)', '$&:' } 37 | default { $VmHost.MacAddressMinimum } 38 | } 39 | 'Mac Address Maximum' = Switch (($VmHost.MacAddressMaximum).Length) { 40 | 0 { "--" } 41 | 12 { $VmHost.MacAddressMaximum -replace '..(?!$)', '$&:' } 42 | default { $VmHost.MacAddressMinimum } 43 | } 44 | } 45 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 46 | 47 | $TableParams = @{ 48 | Name = "Host MAC Pool" 49 | List = $false 50 | ColumnWidths = 50, 50 51 | } 52 | if ($Report.ShowTableCaptions) { 53 | $TableParams['Caption'] = "- $($TableParams.Name)" 54 | } 55 | $OutObj | Table @TableParams 56 | } 57 | } catch { 58 | Write-PScriboMessage -IsWarning $_.Exception.Message 59 | } 60 | try { 61 | $VmOsAdapters = Invoke-Command -Session $TempPssSession { Get-VMNetworkAdapter -ManagementOS | Select-Object -Property * } 62 | if ($VmOsAdapters) { 63 | Section -Style Heading3 "Hyper-V Management OS Adapters" { 64 | Paragraph 'The following table details the Management OS Virtual Adapters created on Virtual Switches' 65 | BlankLine 66 | $OutObj = @() 67 | Foreach ($VmOsAdapter in $VmOsAdapters) { 68 | try { 69 | $AdapterVlan = Invoke-Command -Session $TempPssSession { Get-VMNetworkAdapterVlan -ManagementOS -VMNetworkAdapterName ($using:VmOsAdapter).Name | Select-Object -Property * } 70 | $inObj = [ordered] @{ 71 | 'Name' = $VmOsAdapter.Name 72 | 'Switch Name' = $VmOsAdapter.SwitchName 73 | 'Mac Address' = $VmOsAdapter.MacAddress 74 | 'IPv4 Address' = $VmOsAdapter.IPAddresses 75 | 'Adapter Mode' = $AdapterVlan.OperationMode 76 | 'Vlan ID' = $AdapterVlan.AccessVlanId 77 | } 78 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 79 | } catch { 80 | Write-PScriboMessage -IsWarning $_.Exception.Message 81 | } 82 | } 83 | $TableParams = @{ 84 | Name = "VM Management OS Adapters" 85 | List = $true 86 | ColumnWidths = 50, 50 87 | } 88 | if ($Report.ShowTableCaptions) { 89 | $TableParams['Caption'] = "- $($TableParams.Name)" 90 | } 91 | $OutObj | Sort-Object -Property 'Name' | Table @TableParams 92 | } 93 | } 94 | } catch { 95 | Write-PScriboMessage -IsWarning $_.Exception.Message 96 | } 97 | try { 98 | $VmSwitches = Invoke-Command -Session $TempPssSession { Get-VMSwitch } 99 | if ($VmSwitches) { 100 | Section -Style Heading3 "Hyper-V vSwitch Settings" { 101 | Paragraph 'The following table provide a summary of Hyper-V configured vSwitches' 102 | BlankLine 103 | $OutObj = @() 104 | ForEach ($VmSwitch in $VmSwitches) { 105 | try { 106 | $inObj = [ordered] @{ 107 | 'Switch Name' = $VmSwitch.Name 108 | 'Switch Type' = $VmSwitch.SwitchType 109 | 'Embedded Team' = $VmSwitch.EmbeddedTeamingEnabled 110 | 'Interface Description' = $VmSwitch.NetAdapterInterfaceDescription 111 | } 112 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 113 | } catch { 114 | Write-PScriboMessage -IsWarning $_.Exception.Message 115 | } 116 | } 117 | 118 | $TableParams = @{ 119 | Name = "Virtual Switch Summary" 120 | List = $false 121 | ColumnWidths = 30, 20, 20, 30 122 | } 123 | if ($Report.ShowTableCaptions) { 124 | $TableParams['Caption'] = "- $($TableParams.Name)" 125 | } 126 | $OutObj | Sort-Object -Property 'Switch Name' | Table @TableParams 127 | 128 | Foreach ($VmSwitch in $VmSwitches) { 129 | try { 130 | Section -ExcludeFromTOC -Style NOTOCHeading4 ($VmSwitch.Name) { 131 | $OutObj = @() 132 | $inObj = [ordered] @{ 133 | 'Switch Name' = $VmSwitch.Name 134 | 'Switch Type' = $VmSwitch.SwitchType 135 | 'Switch Embedded Teaming Status' = $VmSwitch.EmbeddedTeamingEnabled 136 | 'Bandwidth Reservation Mode' = $VmSwitch.BandwidthReservationMode 137 | 'Bandwidth Reservation Percentage' = $VmSwitch.Percentage 138 | 'Management OS Allowed' = $VmSwitch.AllowManagementOS 139 | 'Physical Adapters' = $VmSwitch.NetAdapterInterfaceDescriptions -Join "," 140 | 'IOV Support' = $VmSwitch.IovSupport 141 | 'IOV Support Reasons' = $VmSwitch.IovSupportReasons 142 | 'Available VM Queues' = $VmSwitch.AvailableVMQueues 143 | 'Packet Direct Enabled' = $VmSwitch.PacketDirectinUse 144 | } 145 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 146 | 147 | 148 | $TableParams = @{ 149 | Name = "VM Switch Details" 150 | List = $true 151 | ColumnWidths = 50, 50 152 | } 153 | if ($Report.ShowTableCaptions) { 154 | $TableParams['Caption'] = "- $($TableParams.Name)" 155 | } 156 | $OutObj | Table @TableParams 157 | } 158 | } catch { 159 | Write-PScriboMessage -IsWarning $_.Exception.Message 160 | } 161 | } 162 | } 163 | } 164 | } catch { 165 | Write-PScriboMessage -IsWarning $_.Exception.Message 166 | } 167 | } catch { 168 | Write-PScriboMessage -IsWarning $_.Exception.Message 169 | } 170 | } 171 | } 172 | end {} 173 | } 174 | -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinHyperVNuma.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinHyperVNuma { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Windows Server Hyper-V Numa information. 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.6 9 | Author: Andrew Ramsay 10 | Editor: Jonathan Colon 11 | Twitter: @jcolonfzenpr 12 | Github: rebelinux 13 | Credits: Iain Brighton (@iainbrighton) - PScribo module 14 | 15 | .LINK 16 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 17 | #> 18 | [CmdletBinding()] 19 | param ( 20 | ) 21 | 22 | begin { 23 | Write-PScriboMessage "Hyper-V InfoLevel set at $($InfoLevel.HyperV)." 24 | Write-PScriboMessage "Collecting Hyper-V Numa information." 25 | } 26 | 27 | process { 28 | if ($InfoLevel.HyperV -ge 1) { 29 | try { 30 | $VmHostNumaNodes = Invoke-Command -Session $TempPssSession { Get-VMHostNumaNode } 31 | if ($VmHostNumaNodes) { 32 | Section -Style Heading3 "Hyper-V NUMA Boundaries" { 33 | $OutObj = @() 34 | foreach ($Node in $VmHostNumaNodes) { 35 | try { 36 | $inObj = [ordered] @{ 37 | 'Numa Node Id' = $Node.NodeId 38 | 'Memory Available' = "$([math]::Round(($Node.MemoryAvailable)/1024,0)) GB" 39 | 'Memory Total' = "$([math]::Round(($Node.MemoryTotal)/1024,0)) GB" 40 | } 41 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 42 | } catch { 43 | Write-PScriboMessage -IsWarning $_.Exception.Message 44 | } 45 | } 46 | $TableParams = @{ 47 | Name = "Host NUMA Nodes" 48 | List = $false 49 | ColumnWidths = 34, 33, 33 50 | } 51 | if ($Report.ShowTableCaptions) { 52 | $TableParams['Caption'] = "- $($TableParams.Name)" 53 | } 54 | $OutObj | Sort-Object -Property 'Numa Node Id' | Table @TableParams 55 | } 56 | } 57 | } catch { 58 | Write-PScriboMessage -IsWarning $_.Exception.Message 59 | } 60 | } 61 | } 62 | end {} 63 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinHyperVSummary.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinHyperVSummary { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Windows Server Hyper-V Summary information. 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.6 9 | Author: Andrew Ramsay 10 | Editor: Jonathan Colon 11 | Twitter: @asbuiltreport 12 | Github: AsBuiltReport 13 | Credits: Iain Brighton (@iainbrighton) - PScribo module 14 | 15 | .LINK 16 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 17 | #> 18 | [CmdletBinding()] 19 | param ( 20 | ) 21 | 22 | begin { 23 | Write-PScriboMessage "Hyper-V InfoLevel set at $($InfoLevel.HyperV)." 24 | Write-PScriboMessage "Collecting Hyper-V Summary information." 25 | } 26 | 27 | process { 28 | if ($InfoLevel.HyperV -ge 1) { 29 | try { 30 | $script:VmHost = Invoke-Command -Session $TempPssSession { Get-VMHost } 31 | if ($VmHost) { 32 | $OutObj = @() 33 | $inObj = [ordered] @{ 34 | 'Logical Processor Count' = $VmHost.LogicalProcessorCount 35 | 'Memory Capacity' = "$([Math]::Round($VmHost.MemoryCapacity / 1gb)) GB" 36 | 'VM Default Path' = $VmHost.VirtualMachinePath 37 | 'VM Disk Default Path' = $VmHost.VirtualHardDiskPath 38 | 'Supported VM Versions' = $VmHost.SupportedVmVersions -Join "," 39 | 'Numa Spannning Enabled' = $VmHost.NumaSpanningEnabled 40 | 'Iov Support' = $VmHost.IovSupport 41 | 'VM Migrations Enabled' = $VmHost.VirtualMachineMigrationEnabled 42 | 'Allow any network for Migrations' = $VmHost.UseAnyNetworkForMigration 43 | 'VM Migration Authentication Type' = $VmHost.VirtualMachineMigrationAuthenticationType 44 | 'Max Concurrent Storage Migrations' = $VmHost.MaximumStorageMigrations 45 | 'Max Concurrent VM Migrations' = $VmHost.MaximumStorageMigrations 46 | } 47 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 48 | 49 | $TableParams = @{ 50 | Name = "Hyper-V Host Settings" 51 | List = $true 52 | ColumnWidths = 50, 50 53 | } 54 | if ($Report.ShowTableCaptions) { 55 | $TableParams['Caption'] = "- $($TableParams.Name)" 56 | } 57 | $OutObj | Table @TableParams 58 | } 59 | } catch { 60 | Write-PScriboMessage -IsWarning $_.Exception.Message 61 | } 62 | } 63 | } 64 | end {} 65 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinIISSummary.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinIISSummary { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Windows Server IIS Summary information. 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.6 9 | Author: Jonathan Colon 10 | Twitter: @jcolonfzenpr 11 | Github: rebelinux 12 | Credits: Iain Brighton (@iainbrighton) - PScribo module 13 | 14 | .LINK 15 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 16 | #> 17 | [CmdletBinding()] 18 | param ( 19 | ) 20 | 21 | begin { 22 | Write-PScriboMessage "IIS InfoLevel set at $($InfoLevel.IIS)." 23 | Write-PScriboMessage "Collecting IIS Summary information." 24 | } 25 | 26 | process { 27 | if ($InfoLevel.IIS -ge 1) { 28 | try { 29 | $OutObj = @() 30 | $IISApplicationDefaults = Invoke-Command -Session $TempPssSession { (Get-IISServerManager).ApplicationDefaults } 31 | $IISSiteDefaults = Invoke-Command -Session $TempPssSession { (Get-IISServerManager).SiteDefaults | Select-Object ServerAutoStart, @{name = 'Directory'; Expression = { $_.Logfile.Directory } } } 32 | if ($IISApplicationDefaults -and $IISSiteDefaults) { 33 | try { 34 | $inObj = [ordered] @{ 35 | 'Default Application Pool' = ($IISApplicationDefaults).ApplicationPoolName 36 | 'Enabled Protocols' = (($IISApplicationDefaults).EnabledProtocols).toUpper() 37 | 'Logfile Path' = ($IISSiteDefaults).Directory 38 | 'Server Auto Start' = ($IISSiteDefaults).ServerAutoStart 39 | } 40 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 41 | 42 | $TableParams = @{ 43 | Name = "IIS Host Settings" 44 | List = $false 45 | ColumnWidths = 25, 25, 25, 25 46 | } 47 | if ($Report.ShowTableCaptions) { 48 | $TableParams['Caption'] = "- $($TableParams.Name)" 49 | } 50 | $OutObj | Table @TableParams 51 | } catch { 52 | Write-PScriboMessage -IsWarning $_.Exception.Message 53 | } 54 | } 55 | } catch { 56 | Write-PScriboMessage -IsWarning $_.Exception.Message 57 | } 58 | } 59 | } 60 | end {} 61 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinIISWebAppPool.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinIISWebAppPool { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Windows Server IIS Sites information. 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.6 9 | Author: Jonathan Colon 10 | Twitter: @jcolonfzenpr 11 | Github: rebelinux 12 | Credits: Iain Brighton (@iainbrighton) - PScribo module 13 | 14 | .LINK 15 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 16 | #> 17 | [CmdletBinding()] 18 | param ( 19 | ) 20 | 21 | begin { 22 | Write-PScriboMessage "IIS InfoLevel set at $($InfoLevel.IIS)." 23 | Write-PScriboMessage "Collecting IIS Sites information." 24 | } 25 | 26 | process { 27 | if ($InfoLevel.IIS -ge 1) { 28 | try { 29 | $IISWebAppPools = Invoke-Command -Session $TempPssSession { Get-IISAppPool } 30 | if ($IISWebAppPools) { 31 | Section -Style Heading3 'Application Pools' { 32 | Paragraph 'The following table lists IIS Application Pools' 33 | BlankLine 34 | $OutObj = @() 35 | foreach ($IISWebAppPool in $IISWebAppPools) { 36 | try { 37 | $inObj = [ordered] @{ 38 | 'Name' = $IISWebAppPool.Name 39 | 'Status' = $IISWebAppPool.State 40 | 'CLR Ver' = $IISWebAppPool.ManagedRuntimeVersion 41 | 'Pipeline Mode ' = $IISWebAppPool.ManagedPipelineMode 42 | 'Start Mode' = $IISWebAppPool.StartMode 43 | } 44 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 45 | } catch { 46 | Write-PScriboMessage -IsWarning $_.Exception.Message 47 | } 48 | } 49 | 50 | $TableParams = @{ 51 | Name = "Application Pools" 52 | List = $false 53 | ColumnWidths = 30, 15, 15, 20, 20 54 | } 55 | if ($Report.ShowTableCaptions) { 56 | $TableParams['Caption'] = "- $($TableParams.Name)" 57 | } 58 | $OutObj | Table @TableParams 59 | } 60 | } 61 | } catch { 62 | Write-PScriboMessage -IsWarning $_.Exception.Message 63 | } 64 | } 65 | } 66 | end {} 67 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinIISWebSite.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinIISWebSite { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Windows Server IIS Sites information. 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.6 9 | Author: Jonathan Colon 10 | Twitter: @jcolonfzenpr 11 | Github: rebelinux 12 | Credits: Iain Brighton (@iainbrighton) - PScribo module 13 | 14 | .LINK 15 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 16 | #> 17 | [CmdletBinding()] 18 | param ( 19 | ) 20 | 21 | begin { 22 | Write-PScriboMessage "IIS InfoLevel set at $($InfoLevel.IIS)." 23 | Write-PScriboMessage "Collecting IIS Sites information." 24 | } 25 | 26 | process { 27 | if ($InfoLevel.IIS -ge 1) { 28 | try { 29 | $IISWebSites = Invoke-Command -Session $TempPssSession { Get-Website } 30 | if ($IISWebSites) { 31 | Section -Style Heading3 'Sites Summary' { 32 | Paragraph 'The following table provide a summary of IIS Web Sites' 33 | BlankLine 34 | $OutObj = @() 35 | foreach ($IISWebSite in $IISWebSites) { 36 | try { 37 | $inObj = [ordered] @{ 38 | 'Name' = $IISWebSite.Name 39 | 'Status' = $IISWebSite.state 40 | 'Binding' = $IISWebSite.bindings.Collection 41 | 'Application Pool' = $IISWebSite.applicationPool 42 | } 43 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 44 | } catch { 45 | Write-PScriboMessage -IsWarning $_.Exception.Message 46 | } 47 | } 48 | 49 | $TableParams = @{ 50 | Name = "IIS Web Sites" 51 | List = $false 52 | ColumnWidths = 25, 25, 25, 25 53 | } 54 | if ($Report.ShowTableCaptions) { 55 | $TableParams['Caption'] = "- $($TableParams.Name)" 56 | } 57 | $OutObj | Table @TableParams 58 | try { 59 | $IISWebSites = Invoke-Command -Session $TempPssSession { Get-Website } 60 | if ($IISWebSites) { 61 | Section -Style Heading4 'Sites Configuration' { 62 | Paragraph 'The following section details IIS Web Sites configuration' 63 | BlankLine 64 | $OutObj = @() 65 | foreach ($IISWebSite in $IISWebSites) { 66 | try { 67 | Section -Style Heading5 "$($IISWebSite.Name)" { 68 | Paragraph "The following table details $($IISWebSite.Name) settings" 69 | BlankLine 70 | $SiteURL = Invoke-Command -Session $TempPssSession { Get-WebURL -PSPath "IIS:\Sites\$(($using:IISWebSite).Name)" } 71 | $inObj = [ordered] @{ 72 | 'Name' = $IISWebSite.Name 73 | 'Auto Start' = $IISWebSite.serverAutoStart 74 | 'Enabled Protocols ' = $IISWebSite.enabledProtocols 75 | 'URL' = Switch (($SiteURL.ResponseUri).count) { 76 | 0 { "--" } 77 | default { $SiteURL.ResponseUri } 78 | } 79 | 'Path ' = $IISWebSite.physicalPath 80 | 'Log Path' = $IISWebSite.logFile.directory 81 | 82 | } 83 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 84 | 85 | $TableParams = @{ 86 | Name = "IIS Web Sites - $($IISWebSite.Name)" 87 | List = $true 88 | ColumnWidths = 40, 60 89 | } 90 | if ($Report.ShowTableCaptions) { 91 | $TableParams['Caption'] = "- $($TableParams.Name)" 92 | } 93 | $OutObj | Table @TableParams 94 | try { 95 | $IISWebApps = Invoke-Command -Session $TempPssSession { Get-WebApplication -Site $(($using:IISWebSite).Name) } 96 | if ($IISWebApps) { 97 | Section -Style Heading5 "Web Applications" { 98 | Paragraph "The following table details $($IISWebSite.Name) Web Application" 99 | BlankLine 100 | $OutObj = @() 101 | foreach ($IISWebApp in $IISWebApps) { 102 | try { 103 | $inObj = [ordered] @{ 104 | 'Name' = $IISWebApp.Path 105 | 'Application pool' = $IISWebApp.Applicationpool 106 | 'Physical Path ' = $IISWebApp.PhysicalPath 107 | } 108 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 109 | } catch { 110 | Write-PScriboMessage -IsWarning $_.Exception.Message 111 | } 112 | } 113 | 114 | $TableParams = @{ 115 | Name = "Web Applications - $($IISWebSite.Name)" 116 | List = $false 117 | ColumnWidths = 35, 20, 45 118 | } 119 | if ($Report.ShowTableCaptions) { 120 | $TableParams['Caption'] = "- $($TableParams.Name)" 121 | } 122 | $OutObj | Table @TableParams 123 | } 124 | } 125 | } catch { 126 | Write-PScriboMessage -IsWarning $_.Exception.Message 127 | } 128 | } 129 | } catch { 130 | Write-PScriboMessage -IsWarning $_.Exception.Message 131 | } 132 | } 133 | } 134 | } 135 | } catch { 136 | Write-PScriboMessage -IsWarning $_.Exception.Message 137 | } 138 | } 139 | } 140 | } catch { 141 | Write-PScriboMessage -IsWarning $_.Exception.Message 142 | } 143 | } 144 | } 145 | end {} 146 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinLocalAdmin.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinLocalAdmin { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Windows Server Local Administrator information. 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.6 9 | Author: Andrew Ramsay 10 | Editor: Jonathan Colon 11 | Twitter: @asbuiltreport 12 | Github: AsBuiltReport 13 | Credits: Iain Brighton (@iainbrighton) - PScribo module 14 | 15 | .LINK 16 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 17 | #> 18 | [CmdletBinding()] 19 | param ( 20 | ) 21 | 22 | begin { 23 | Write-PScriboMessage "Account InfoLevel set at $($InfoLevel.Account)." 24 | Write-PScriboMessage "Collecting Local Administrator information." 25 | } 26 | 27 | process { 28 | if ($InfoLevel.Account -ge 1) { 29 | try { 30 | if ($LocalAdmins) { 31 | Section -Style Heading3 'Local Administrators' { 32 | $OutObj = @() 33 | ForEach ($LocalAdmin in $LocalAdmins) { 34 | try { 35 | $inObj = [ordered] @{ 36 | 'Account Name' = $LocalAdmin.Name 37 | 'Account Type' = $LocalAdmin.ObjectClass 38 | 'Account Source' = $LocalAdmin.PrincipalSource 39 | } 40 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 41 | } catch { 42 | Write-PScriboMessage -IsWarning $_.Exception.Message 43 | } 44 | } 45 | $TableParams = @{ 46 | Name = "Local Administrators" 47 | List = $false 48 | ColumnWidths = 40, 30, 30 49 | } 50 | if ($Report.ShowTableCaptions) { 51 | $TableParams['Caption'] = "- $($TableParams.Name)" 52 | } 53 | $OutObj | Sort-Object -Property 'Account Name' | Table @TableParams 54 | } 55 | } 56 | } catch { 57 | Write-PScriboMessage -IsWarning $_.Exception.Message 58 | } 59 | } 60 | } 61 | end {} 62 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinLocalGroup.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinLocalGroup { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Windows Server Local Groups information. 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.6 9 | Author: Andrew Ramsay 10 | Editor: Jonathan Colon 11 | Twitter: @asbuiltreport 12 | Github: AsBuiltReport 13 | Credits: Iain Brighton (@iainbrighton) - PScribo module 14 | 15 | .LINK 16 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 17 | #> 18 | [CmdletBinding()] 19 | param ( 20 | ) 21 | 22 | begin { 23 | Write-PScriboMessage "Account InfoLevel set at $($InfoLevel.Account)." 24 | Write-PScriboMessage "Collecting Local Groups information." 25 | } 26 | 27 | process { 28 | if ($InfoLevel.Account -ge 1) { 29 | try { 30 | if ($LocalGroups) { 31 | Section -Style Heading3 'Local Groups' { 32 | $OutObj = @() 33 | ForEach ($LocalGroup in $LocalGroups) { 34 | try { 35 | $inObj = [ordered] @{ 36 | 'Group Name' = $LocalGroup.GroupName 37 | 'Description' = Switch ([string]::IsNullOrEmpty($LocalGroup.Description)) { 38 | $true { "--" } 39 | $false { $LocalGroup.Description } 40 | default { "Unknown" } 41 | } 42 | 'Members' = Switch ([string]::IsNullOrEmpty($LocalGroup.Members)) { 43 | $true { "--" } 44 | $false { $LocalGroup.Members } 45 | default { "Unknown" } 46 | } 47 | } 48 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 49 | } catch { 50 | Write-PScriboMessage -IsWarning $_.Exception.Message 51 | } 52 | } 53 | $TableParams = @{ 54 | Name = "Local Group Summary" 55 | List = $false 56 | ColumnWidths = 30, 40, 30 57 | } 58 | if ($Report.ShowTableCaptions) { 59 | $TableParams['Caption'] = "- $($TableParams.Name)" 60 | } 61 | $OutObj | Sort-Object -Property 'Group Name' | Table @TableParams 62 | } 63 | } 64 | } catch { 65 | Write-PScriboMessage -IsWarning $_.Exception.Message 66 | } 67 | } 68 | } 69 | end {} 70 | } 71 | -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinLocalUser.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinLocalUser { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Windows Server Local Users information. 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.6 9 | Author: Andrew Ramsay 10 | Editor: Jonathan Colon 11 | Twitter: @asbuiltreport 12 | Github: AsBuiltReport 13 | Credits: Iain Brighton (@iainbrighton) - PScribo module 14 | 15 | .LINK 16 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 17 | #> 18 | [CmdletBinding()] 19 | param ( 20 | ) 21 | 22 | begin { 23 | Write-PScriboMessage "Account InfoLevel set at $($InfoLevel.Account)." 24 | Write-PScriboMessage "Collecting Local Users information." 25 | } 26 | 27 | process { 28 | if ($InfoLevel.Account -ge 1) { 29 | try { 30 | if ($LocalUsers) { 31 | Section -Style Heading3 'Local Users' { 32 | $OutObj = @() 33 | ForEach ($LocalUser in $LocalUsers) { 34 | try { 35 | $inObj = [ordered] @{ 36 | 'User Name' = $LocalUser.Name 37 | 'Description' = $LocalUser.Description 38 | 'Account Enabled' = $LocalUser.Enabled 39 | 'Last Logon Date' = Switch (($LocalUser.LastLogon).count) { 40 | 0 { "--" } 41 | default { $LocalUser.LastLogon.ToShortDateString() } 42 | } 43 | } 44 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 45 | } catch { 46 | Write-PScriboMessage -IsWarning $_.Exception.Message 47 | } 48 | } 49 | $TableParams = @{ 50 | Name = "Local Users" 51 | List = $false 52 | ColumnWidths = 20, 40, 10, 30 53 | } 54 | if ($Report.ShowTableCaptions) { 55 | $TableParams['Caption'] = "- $($TableParams.Name)" 56 | } 57 | $OutObj | Sort-Object -Property 'User Name' | Table @TableParams 58 | } 59 | } 60 | } catch { 61 | Write-PScriboMessage -IsWarning $_.Exception.Message 62 | } 63 | } 64 | } 65 | end {} 66 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinNetAdapter.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinNetAdapter { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Windows Server Network Adapter information. 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.6 9 | Author: Andrew Ramsay 10 | Editor: Jonathan Colon 11 | Twitter: @asbuiltreport 12 | Github: AsBuiltReport 13 | Credits: Iain Brighton (@iainbrighton) - PScribo module 14 | 15 | .LINK 16 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 17 | #> 18 | [CmdletBinding()] 19 | param ( 20 | ) 21 | 22 | begin { 23 | Write-PScriboMessage "Networking InfoLevel set at $($InfoLevel.Networking)." 24 | Write-PScriboMessage "Collecting Network Adapter information." 25 | } 26 | 27 | process { 28 | if ($InfoLevel.Networking -ge 1) { 29 | try { 30 | $HostAdapters = Invoke-Command -Session $TempPssSession { Get-NetAdapter } 31 | if ($HostAdapters) { 32 | Section -Style Heading3 'Network Adapters' { 33 | $OutObj = @() 34 | ForEach ($HostAdapter in $HostAdapters) { 35 | try { 36 | $inObj = [ordered] @{ 37 | 'Adapter Name' = $HostAdapter.Name 38 | 'Adapter Description' = $HostAdapter.InterfaceDescription 39 | 'Mac Address' = $HostAdapter.MacAddress 40 | 'Link Speed' = $HostAdapter.LinkSpeed 41 | } 42 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 43 | } catch { 44 | Write-PScriboMessage -IsWarning $_.Exception.Message 45 | } 46 | } 47 | $TableParams = @{ 48 | Name = "Network Adapters" 49 | List = $false 50 | ColumnWidths = 30, 35, 20, 15 51 | } 52 | if ($Report.ShowTableCaptions) { 53 | $TableParams['Caption'] = "- $($TableParams.Name)" 54 | } 55 | $OutObj | Sort-Object -Property 'Adapter Name' | Table @TableParams 56 | } 57 | } 58 | } catch { 59 | Write-PScriboMessage -IsWarning $_.Exception.Message 60 | } 61 | } 62 | } 63 | end {} 64 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinNetAdapterMTU.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinNetAdapterMTU { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Windows Server Network Adapter Interface MTU information. 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.6 9 | Author: Andrew Ramsay 10 | Editor: Jonathan Colon 11 | Twitter: @asbuiltreport 12 | Github: AsBuiltReport 13 | Credits: Iain Brighton (@iainbrighton) - PScribo module 14 | 15 | .LINK 16 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 17 | #> 18 | [CmdletBinding()] 19 | param ( 20 | ) 21 | 22 | begin { 23 | Write-PScriboMessage "Networking InfoLevel set at $($InfoLevel.Networking)." 24 | Write-PScriboMessage "Collecting Network Adapter Interfaces MTU information." 25 | } 26 | 27 | process { 28 | if ($InfoLevel.Networking -ge 1) { 29 | try { 30 | $NetMtus = Invoke-Command -Session $TempPssSession { Get-NetAdapterAdvancedProperty | Where-Object { $_.DisplayName -eq 'Jumbo Packet' } } 31 | if ($NetMtus) { 32 | Section -Style Heading3 'Network Adapter MTU' { 33 | $OutObj = @() 34 | ForEach ($NetMtu in $NetMtus) { 35 | try { 36 | $inObj = [ordered] @{ 37 | 'Adapter Name' = $NetMtu.Name 38 | 'MTU Size' = $NetMtu.DisplayValue 39 | } 40 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 41 | } catch { 42 | Write-PScriboMessage -IsWarning $_.Exception.Message 43 | } 44 | } 45 | $TableParams = @{ 46 | Name = "Network Adapter MTU" 47 | List = $false 48 | ColumnWidths = 50, 50 49 | } 50 | if ($Report.ShowTableCaptions) { 51 | $TableParams['Caption'] = "- $($TableParams.Name)" 52 | } 53 | $OutObj | Sort-Object -Property 'Adapter Name' | Table @TableParams 54 | } 55 | } 56 | } catch { 57 | Write-PScriboMessage -IsWarning $_.Exception.Message 58 | } 59 | } 60 | } 61 | end {} 62 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinNetDNSClient.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinNetDNSClient { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Windows Server Network DNS Client information. 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.6 9 | Author: Andrew Ramsay 10 | Editor: Jonathan Colon 11 | Twitter: @asbuiltreport 12 | Github: AsBuiltReport 13 | Credits: Iain Brighton (@iainbrighton) - PScribo module 14 | 15 | .LINK 16 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 17 | #> 18 | [CmdletBinding()] 19 | param ( 20 | ) 21 | 22 | begin { 23 | Write-PScriboMessage "Networking InfoLevel set at $($InfoLevel.Networking)." 24 | Write-PScriboMessage "Collecting Network DNS Client information." 25 | } 26 | 27 | process { 28 | if ($InfoLevel.Networking -ge 1) { 29 | try { 30 | $DnsClient = Invoke-Command -Session $TempPssSession { Get-DnsClientGlobalSetting } 31 | if ($DnsClient) { 32 | Section -Style Heading3 'DNS Client' { 33 | Paragraph 'The following table details the DNS Search Domains' 34 | BlankLine 35 | $OutObj = @() 36 | $inObj = [ordered] @{ 37 | 'DNS Suffix' = $DnsClient.SuffixSearchList -Join "," 38 | 'Use Suffix Search List' = $DnsClient.UseSuffixSearchList 39 | 'Use Devolution' = $DnsClient.UseDevolution 40 | 'Devolution Level' = $DnsClient.DevolutionLevel 41 | } 42 | 43 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 44 | 45 | $TableParams = @{ 46 | Name = "DNS Search Domain" 47 | List = $false 48 | ColumnWidths = 40, 20, 20, 20 49 | } 50 | if ($Report.ShowTableCaptions) { 51 | $TableParams['Caption'] = "- $($TableParams.Name)" 52 | } 53 | $OutObj | Sort-Object -Property 'DNS Suffix' | Table @TableParams 54 | } 55 | } 56 | } catch { 57 | Write-PScriboMessage -IsWarning $_.Exception.Message 58 | } 59 | } 60 | } 61 | end {} 62 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinNetDNSServer.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinNetDNSServer { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Windows Server Network DNS Server information. 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.6 9 | Author: Andrew Ramsay 10 | Editor: Jonathan Colon 11 | Twitter: @asbuiltreport 12 | Github: AsBuiltReport 13 | Credits: Iain Brighton (@iainbrighton) - PScribo module 14 | 15 | .LINK 16 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 17 | #> 18 | [CmdletBinding()] 19 | param ( 20 | ) 21 | 22 | begin { 23 | Write-PScriboMessage "Networking InfoLevel set at $($InfoLevel.Networking)." 24 | Write-PScriboMessage "Collecting Network DNS Server information." 25 | } 26 | 27 | process { 28 | if ($InfoLevel.Networking -ge 1) { 29 | try { 30 | $DnsServers = Invoke-Command -Session $TempPssSession { Get-DnsClientServerAddress -AddressFamily IPv4 | Where-Object { $_.ServerAddresses -notlike $null -and $_.InterfaceAlias -notlike "*isatap*" } } 31 | if ($DnsServers) { 32 | Section -Style Heading3 'DNS Servers' { 33 | Paragraph 'The following table details the DNS Server Addresses Configured' 34 | BlankLine 35 | $OutObj = @() 36 | ForEach ($DnsServer in $DnsServers) { 37 | try { 38 | $inObj = [ordered] @{ 39 | 'Interface' = $DnsServer.InterfaceAlias 40 | 'Server Address' = $DnsServer.ServerAddresses -Join "," 41 | } 42 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 43 | } catch { 44 | Write-PScriboMessage -IsWarning $_.Exception.Message 45 | } 46 | } 47 | $TableParams = @{ 48 | Name = "DNS Servers" 49 | List = $false 50 | ColumnWidths = 40, 60 51 | } 52 | if ($Report.ShowTableCaptions) { 53 | $TableParams['Caption'] = "- $($TableParams.Name)" 54 | } 55 | $OutObj | Sort-Object -Property 'Interface' | Table @TableParams 56 | } 57 | } 58 | } catch { 59 | Write-PScriboMessage -IsWarning $_.Exception.Message 60 | } 61 | } 62 | } 63 | end {} 64 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinNetFirewall.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinNetFirewall { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Windows Server Host Firewall information. 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.6 9 | Author: Andrew Ramsay 10 | Editor: Jonathan Colon 11 | Twitter: @asbuiltreport 12 | Github: AsBuiltReport 13 | Credits: Iain Brighton (@iainbrighton) - PScribo module 14 | 15 | .LINK 16 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 17 | #> 18 | [CmdletBinding()] 19 | param ( 20 | ) 21 | 22 | begin { 23 | Write-PScriboMessage "Networking InfoLevel set at $($InfoLevel.Networking)." 24 | Write-PscriboMessage "Collecting Host Firewall information." 25 | } 26 | 27 | process { 28 | if ($InfoLevel.Networking -ge 1) { 29 | try { 30 | $NetFirewallProfile = Get-NetFirewallProfile -CimSession $TempCimSession 31 | if ($NetFirewallProfile) { 32 | Section -Style Heading2 'Windows Firewall' { 33 | $OutObj = @() 34 | Foreach ($FirewallProfile in $NetFireWallProfile) { 35 | try { 36 | $inObj = [ordered] @{ 37 | 'Profile' = $FirewallProfile.Name 38 | 'Profile Enabled' = $FirewallProfile.Enabled 39 | 'Inbound Action' = $FirewallProfile.DefaultInboundAction 40 | 'Outbound Action' = $FirewallProfile.DefaultOutboundAction 41 | } 42 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 43 | } 44 | catch { 45 | Write-PscriboMessage -IsWarning $_.Exception.Message 46 | } 47 | } 48 | 49 | if ($HealthCheck.Networking.Firewall) { 50 | $OutObj | Where-Object { $_.'Profile Enabled' -notlike 'Yes'} | Set-Style -Style Warning -Property 'Profile Enabled' 51 | } 52 | 53 | $TableParams = @{ 54 | Name = "Windows Firewall Profiles" 55 | List = $false 56 | ColumnWidths = 25, 25, 25, 25 57 | } 58 | if ($Report.ShowTableCaptions) { 59 | $TableParams['Caption'] = "- $($TableParams.Name)" 60 | } 61 | $OutObj | Sort-Object -Property 'Profile' | Table @TableParams 62 | } 63 | } 64 | } 65 | catch { 66 | Write-PscriboMessage -IsWarning $_.Exception.Message 67 | } 68 | } 69 | } 70 | end {} 71 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinNetIPAddress.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinNetIPAddress { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Windows Server Network IP Address information. 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.6 9 | Author: Andrew Ramsay 10 | Editor: Jonathan Colon 11 | Twitter: @asbuiltreport 12 | Github: AsBuiltReport 13 | Credits: Iain Brighton (@iainbrighton) - PScribo module 14 | 15 | .LINK 16 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 17 | #> 18 | [CmdletBinding()] 19 | param ( 20 | ) 21 | 22 | begin { 23 | Write-PScriboMessage "Networking InfoLevel set at $($InfoLevel.Networking)." 24 | Write-PScriboMessage "Collecting Network IP Address information." 25 | } 26 | 27 | process { 28 | if ($InfoLevel.Networking -ge 1) { 29 | try { 30 | $NetIPs = Invoke-Command -Session $TempPssSession { Get-NetIPConfiguration | Where-Object -FilterScript { ($_.NetAdapter.Status -Eq "Up") } } 31 | if ($NetIPs) { 32 | Section -Style Heading3 'IP Addresses' { 33 | Paragraph 'The following table details IP Addresses assigned to hosts' 34 | BlankLine 35 | $OutObj = @() 36 | ForEach ($NetIp in $NetIps) { 37 | try { 38 | $inObj = [ordered] @{ 39 | 'Interface Name' = $NetIp.InterfaceAlias 40 | 'Interface Description' = $NetIp.InterfaceDescription 41 | 'IPv4 Addresses' = $NetIp.IPv4Address.IPAddress -Join "," 42 | 'Subnet Mask' = $NetIp.IPv4Address[0].PrefixLength 43 | 'IPv4 Gateway' = Switch ([string]::IsNullOrEmpty($NetIp.IPv4DefaultGateway.NextHop)) { 44 | $true { "--" } 45 | $false { $NetIp.IPv4DefaultGateway.NextHop } 46 | default { "Unknown" } 47 | } 48 | } 49 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 50 | } catch { 51 | Write-PScriboMessage -IsWarning $_.Exception.Message 52 | } 53 | } 54 | $TableParams = @{ 55 | Name = "Net IP Addresse" 56 | List = $false 57 | ColumnWidths = 25, 25, 20, 10, 20 58 | } 59 | if ($Report.ShowTableCaptions) { 60 | $TableParams['Caption'] = "- $($TableParams.Name)" 61 | } 62 | $OutObj | Sort-Object -Property 'Interface Name' | Table @TableParams 63 | } 64 | } 65 | } catch { 66 | Write-PScriboMessage -IsWarning $_.Exception.Message 67 | } 68 | } 69 | } 70 | end {} 71 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinNetTeamInterface.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinNetTeamInterface { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Windows Server Network Team Interfaces information. 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.6 9 | Author: Andrew Ramsay 10 | Editor: Jonathan Colon 11 | Twitter: @asbuiltreport 12 | Github: AsBuiltReport 13 | Credits: Iain Brighton (@iainbrighton) - PScribo module 14 | 15 | .LINK 16 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 17 | #> 18 | [CmdletBinding()] 19 | param ( 20 | ) 21 | 22 | begin { 23 | Write-PScriboMessage "Networking InfoLevel set at $($InfoLevel.Networking)." 24 | Write-PScriboMessage "Collecting Network Team Interfaces information." 25 | } 26 | 27 | process { 28 | if ($InfoLevel.Networking -ge 1) { 29 | try { 30 | $NetworkTeamCheck = Invoke-Command -Session $TempPssSession { Get-NetLbfoTeam } 31 | if ($NetworkTeamCheck) { 32 | Section -Style Heading3 'Network Team Interfaces' { 33 | Paragraph 'The following table details Network Team Interfaces' 34 | BlankLine 35 | $NetTeams = Invoke-Command -Session $TempPssSession { Get-NetLbfoTeam } 36 | $OutObj = @() 37 | ForEach ($NetTeam in $NetTeams) { 38 | try { 39 | $inObj = [ordered] @{ 40 | 'Team Name' = $NetTeam.Name 41 | 'Team Mode' = $NetTeam.tm 42 | 'Load Balancing' = $NetTeam.lba 43 | 'Network Adapters' = $NetTeam.Members -Join "," 44 | } 45 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 46 | } catch { 47 | Write-PScriboMessage -IsWarning $_.Exception.Message 48 | } 49 | } 50 | $TableParams = @{ 51 | Name = "Network Team Interfaces" 52 | List = $false 53 | ColumnWidths = 20, 20, 20, 20 54 | } 55 | if ($Report.ShowTableCaptions) { 56 | $TableParams['Caption'] = "- $($TableParams.Name)" 57 | } 58 | $OutObj | Sort-Object -Property 'Team Name' | Table @TableParams 59 | } 60 | } 61 | } catch { 62 | Write-PScriboMessage -IsWarning $_.Exception.Message 63 | } 64 | } 65 | } 66 | end {} 67 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinOSConfig.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinOSConfig { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Windows Server Operating System Configuration information. 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.6 9 | Author: Andrew Ramsay 10 | Editor: Jonathan Colon 11 | Twitter: @asbuiltreport 12 | Github: AsBuiltReport 13 | Credits: Iain Brighton (@iainbrighton) - PScribo module 14 | 15 | .LINK 16 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 17 | #> 18 | [CmdletBinding()] 19 | param ( 20 | ) 21 | 22 | begin { 23 | Write-PScriboMessage "Operating System InfoLevel set at $($InfoLevel.OperatingSystem)." 24 | Write-PScriboMessage "Collecting Oprating System Configuration information." 25 | } 26 | 27 | process { 28 | if ($InfoLevel.OperatingSystem -ge 1) { 29 | Section -Style Heading3 'OS Configuration' { 30 | Paragraph 'The following section details host OS configuration' 31 | BlankLine 32 | $OutObj = @() 33 | $inObj = [ordered] @{ 34 | 'Windows Product Name' = $HostInfo.WindowsProductName 35 | 'Windows Version' = $HostInfo.WindowsCurrentVersion 36 | 'Windows Build Number' = $HostInfo.OsVersion 37 | 'Windows Install Type' = $HostInfo.WindowsInstallationType 38 | 'AD Domain' = $HostInfo.CsDomain 39 | 'Windows Installation Date' = switch (($HostInfo.OsInstallDate).count) { 40 | 0 { "--" } 41 | default { $HostInfo.OsInstallDate.ToShortDateString() } 42 | } 43 | 'Time Zone' = $HostInfo.TimeZone 44 | 'License Type' = Switch ([string]::IsNullOrEmpty($HostLicense.ProductKeyChannel)) { 45 | $true { "--" } 46 | $false { $HostLicense.ProductKeyChannel } 47 | default { "Unknown" } 48 | } 49 | 'Partial Product Key' = Switch ([string]::IsNullOrEmpty($HostLicense.PartialProductKey)) { 50 | $true { "--" } 51 | $false { $HostLicense.PartialProductKey } 52 | default { "Unknown" } 53 | } 54 | } 55 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 56 | 57 | $TableParams = @{ 58 | Name = "OS Settings" 59 | List = $true 60 | ColumnWidths = 50, 50 61 | } 62 | if ($Report.ShowTableCaptions) { 63 | $TableParams['Caption'] = "- $($TableParams.Name)" 64 | } 65 | $OutObj | Table @TableParams 66 | } 67 | } 68 | } 69 | end {} 70 | } 71 | -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinOSDriver.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinOSDriver { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Windows Server Operating System Drivers information. 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.6 9 | Author: Andrew Ramsay 10 | Editor: Jonathan Colon 11 | Twitter: @asbuiltreport 12 | Github: AsBuiltReport 13 | Credits: Iain Brighton (@iainbrighton) - PScribo module 14 | 15 | .LINK 16 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 17 | #> 18 | [CmdletBinding()] 19 | param ( 20 | ) 21 | 22 | begin { 23 | Write-PScriboMessage "Operating System InfoLevel set at $($InfoLevel.OperatingSystem)." 24 | Write-PScriboMessage "Collecting Operating System Drivers information." 25 | } 26 | 27 | process { 28 | if ($InfoLevel.OperatingSystem -ge 1) { 29 | try { 30 | $HostDriversList = Invoke-Command -Session $TempPssSession { Get-WindowsDriver -Online } 31 | if ($HostDriversList) { 32 | Section -Style Heading3 'Drivers' { 33 | Invoke-Command -Session $TempPssSession { Import-Module DISM } 34 | $OutObj = @() 35 | ForEach ($HostDriver in $HostDriversList) { 36 | try { 37 | $inObj = [ordered] @{ 38 | 'Class Description' = $HostDriver.ClassDescription 39 | 'Provider Name' = $HostDriver.ProviderName 40 | 'Driver Version' = $HostDriver.Version 41 | 'Version Date' = $HostDriver.Date.ToShortDateString() 42 | } 43 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 44 | } catch { 45 | Write-PScriboMessage -IsWarning $_.Exception.Message 46 | } 47 | } 48 | $TableParams = @{ 49 | Name = "Hardware Drivers" 50 | List = $false 51 | ColumnWidths = 30, 30, 20, 20 52 | } 53 | if ($Report.ShowTableCaptions) { 54 | $TableParams['Caption'] = "- $($TableParams.Name)" 55 | } 56 | $OutObj | Sort-Object -Property 'Class Description' | Table @TableParams 57 | } 58 | } 59 | } catch { 60 | Write-PScriboMessage -IsWarning $_.Exception.Message 61 | } 62 | } 63 | } 64 | end {} 65 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinOSHotfix.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinOSHotfix { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Windows Server Operating System HotFix information. 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.6 9 | Author: Andrew Ramsay 10 | Editor: Jonathan Colon 11 | Twitter: @asbuiltreport 12 | Github: AsBuiltReport 13 | Credits: Iain Brighton (@iainbrighton) - PScribo module 14 | 15 | .LINK 16 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 17 | #> 18 | [CmdletBinding()] 19 | param ( 20 | ) 21 | 22 | begin { 23 | Write-PScriboMessage "Operating System InfoLevel set at $($InfoLevel.OperatingSystem)." 24 | Write-PScriboMessage "Collecting Operating System HotFix information." 25 | } 26 | 27 | process { 28 | if ($InfoLevel.OperatingSystem -ge 1) { 29 | try { 30 | $HotFixes = Invoke-Command -Session $TempPssSession -ScriptBlock { Get-HotFix } 31 | if ($HotFixes) { 32 | Section -Style Heading3 'Installed Hotfixes' { 33 | $OutObj = @() 34 | Foreach ($HotFix in $HotFixes) { 35 | try { 36 | $inObj = [ordered] @{ 37 | 'Hotfix ID' = $HotFix.HotFixID 38 | 'Description' = $HotFix.Description 39 | 'Installation Date' = Switch ([string]::IsNullOrEmpty($HotFix.InstalledOn)) { 40 | $true { '--' } 41 | $false { $HotFix.InstalledOn.ToShortDateString() } 42 | default { 'Unknown' } 43 | } 44 | } 45 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 46 | } catch { 47 | Write-PScriboMessage -IsWarning $_.Exception.Message 48 | } 49 | } 50 | $TableParams = @{ 51 | Name = "Installed Hotfixes" 52 | List = $false 53 | ColumnWidths = 34, 33, 33 54 | } 55 | if ($Report.ShowTableCaptions) { 56 | $TableParams['Caption'] = "- $($TableParams.Name)" 57 | } 58 | $OutObj | Sort-Object -Property 'Hotfix ID' | Table @TableParams 59 | } 60 | } 61 | } catch { 62 | Write-PScriboMessage -IsWarning $_.Exception.Message 63 | } 64 | try { 65 | $UpdObj = @() 66 | $Updates = Invoke-Command -Session $TempPssSession -ScriptBlock { (New-Object -ComObject Microsoft.Update.Session).CreateupdateSearcher().Search("IsHidden=0 and IsInstalled=0").Updates | Select-Object Title, KBArticleIDs } 67 | $UpdObj += if ($Updates) { 68 | $OutObj = @() 69 | foreach ($Update in $Updates) { 70 | try { 71 | $inObj = [ordered] @{ 72 | 'KB Article' = "KB$($Update.KBArticleIDs)" 73 | 'Name' = $Update.Title 74 | } 75 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 76 | 77 | if ($HealthCheck.OperatingSystem.Updates) { 78 | $OutObj | Set-Style -Style Warning 79 | } 80 | } catch { 81 | Write-PScriboMessage -IsWarning $_.Exception.Message 82 | } 83 | } 84 | $TableParams = @{ 85 | Name = "Missing Windows Updates" 86 | List = $false 87 | ColumnWidths = 40, 60 88 | } 89 | if ($Report.ShowTableCaptions) { 90 | $TableParams['Caption'] = "- $($TableParams.Name)" 91 | } 92 | $OutObj | Sort-Object -Property 'Name' | Table @TableParams 93 | } 94 | if ($UpdObj) { 95 | Section -Style Heading3 'Missing Windows Updates' { 96 | Paragraph "The following section provides a summary of pending/missing windows updates." 97 | BlankLine 98 | $UpdObj 99 | } 100 | } 101 | } catch { 102 | Write-PScriboMessage -IsWarning $_.Exception.Message 103 | } 104 | } 105 | } 106 | end {} 107 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinOSRoleFeature.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinOSRoleFeature { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Windows Server Role & Features information. 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.6 9 | Author: Andrew Ramsay 10 | Editor: Jonathan Colon 11 | Twitter: @asbuiltreport 12 | Github: AsBuiltReport 13 | Credits: Iain Brighton (@iainbrighton) - PScribo module 14 | 15 | .LINK 16 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 17 | #> 18 | [CmdletBinding()] 19 | param ( 20 | ) 21 | 22 | begin { 23 | Write-PScriboMessage "Operating System InfoLevel set at $($InfoLevel.OperatingSystem)." 24 | Write-PScriboMessage "Collecting Role & Features information." 25 | } 26 | 27 | process { 28 | if ($InfoLevel.OperatingSystem -ge 1 -and $OSType.Value -ne 'WorkStation') { 29 | try { 30 | $HostRolesAndFeatures = Invoke-Command -Session $TempPssSession -ScriptBlock { Get-WindowsFeature | Where-Object { $_.Installed -eq $True } } 31 | if ($HostRolesAndFeatures) { 32 | Section -Style Heading3 'Roles' { 33 | $OutObj = @() 34 | ForEach ($HostRoleAndFeature in $HostRolesAndFeatures) { 35 | if ( $HostRoleAndFeature.FeatureType -eq 'Role') { 36 | try { 37 | $inObj = [ordered] @{ 38 | 'Name' = $HostRoleAndFeature.DisplayName 39 | 'Type' = $HostRoleAndFeature.FeatureType 40 | 'Description' = $HostRoleAndFeature.Description 41 | } 42 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 43 | } catch { 44 | Write-PScriboMessage -IsWarning $_.Exception.Message 45 | } 46 | } 47 | } 48 | $TableParams = @{ 49 | Name = "Roles" 50 | List = $false 51 | ColumnWidths = 20, 10, 70 52 | } 53 | if ($Report.ShowTableCaptions) { 54 | $TableParams['Caption'] = "- $($TableParams.Name)" 55 | } 56 | $OutObj | Sort-Object -Property 'Name' | Table @TableParams 57 | if ($InfoLevel.OperatingSystem -ge 2) { 58 | try { 59 | if ($HostRolesAndFeatures) { 60 | Section -Style Heading3 'Features and Role Services' { 61 | $OutObj = @() 62 | ForEach ($HostRoleAndFeature in $HostRolesAndFeatures) { 63 | if ( $HostRoleAndFeature.FeatureType -eq 'Role Service' -or $HostRoleAndFeature.FeatureType -eq 'Feature') { 64 | try { 65 | $inObj = [ordered] @{ 66 | 'Name' = $HostRoleAndFeature.DisplayName 67 | 'Type' = $HostRoleAndFeature.FeatureType 68 | 'Description' = $HostRoleAndFeature.Description 69 | } 70 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 71 | } catch { 72 | Write-PScriboMessage -IsWarning $_.Exception.Message 73 | } 74 | } 75 | } 76 | $TableParams = @{ 77 | Name = "Feature & Role Services" 78 | List = $false 79 | ColumnWidths = 20, 10, 70 80 | } 81 | if ($Report.ShowTableCaptions) { 82 | $TableParams['Caption'] = "- $($TableParams.Name)" 83 | } 84 | $OutObj | Sort-Object -Property 'Name' | Table @TableParams 85 | } 86 | } 87 | } catch { 88 | Write-PScriboMessage -IsWarning $_.Exception.Message 89 | } 90 | } 91 | } 92 | } 93 | } catch { 94 | Write-PScriboMessage -IsWarning $_.Exception.Message 95 | } 96 | } 97 | } 98 | end {} 99 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinOSService.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinOSService { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Windows Server Operating System Services information. 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.6 9 | Author: Andrew Ramsay 10 | Editor: Jonathan Colon 11 | Twitter: @asbuiltreport 12 | Github: AsBuiltReport 13 | Credits: Iain Brighton (@iainbrighton) - PScribo module 14 | 15 | .LINK 16 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 17 | #> 18 | [CmdletBinding()] 19 | param ( 20 | ) 21 | 22 | begin { 23 | Write-PScriboMessage "Operating System InfoLevel set at $($InfoLevel.OperatingSystem)." 24 | Write-PScriboMessage "Collecting Operating System Service information." 25 | } 26 | 27 | process { 28 | if ($InfoLevel.OperatingSystem -ge 1) { 29 | try { 30 | $Available = Invoke-Command -Session $TempPssSession -ScriptBlock { Get-Service "W32Time" | Select-Object DisplayName, Name, Status } 31 | if ($Available) { 32 | Section -Style Heading3 'Services' { 33 | Paragraph 'The following table details status of important services' 34 | BlankLine 35 | $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') 36 | $OutObj = @() 37 | Foreach ($Service in $Services) { 38 | try { 39 | $Status = Invoke-Command -Session $TempPssSession -ScriptBlock { Get-Service $using:Service -ErrorAction SilentlyContinue | Select-Object DisplayName, Name, Status } 40 | if ($Status) { 41 | $inObj = [ordered] @{ 42 | 'Display Name' = $Status.DisplayName 43 | 'Short Name' = $Status.Name 44 | 'Status' = $Status.Status 45 | } 46 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 47 | } 48 | } catch { 49 | Write-PScriboMessage -IsWarning $_.Exception.Message 50 | } 51 | } 52 | 53 | if ($HealthCheck.OperatingSystem.Services) { 54 | $OutObj | Where-Object { $_.'Status' -notlike 'Running' } | Set-Style -Style Warning -Property 'Status' 55 | } 56 | 57 | $TableParams = @{ 58 | Name = "Services Status" 59 | List = $false 60 | ColumnWidths = 50, 25, 25 61 | } 62 | if ($Report.ShowTableCaptions) { 63 | $TableParams['Caption'] = "- $($TableParams.Name)" 64 | } 65 | $OutObj | Sort-Object -Property 'Display Name' | Table @TableParams 66 | } 67 | } 68 | } catch { 69 | Write-PScriboMessage -IsWarning $_.Exception.Message 70 | } 71 | } 72 | } 73 | end {} 74 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinSMBNetworkInterface.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinSMBNetworkInterface { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Windows Server File Server NIC information. 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.6 9 | Author: Jonathan Colon 10 | Twitter: @jcolonfzenpr 11 | Github: rebelinux 12 | Credits: Iain Brighton (@iainbrighton) - PScribo module 13 | 14 | .LINK 15 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 16 | #> 17 | [CmdletBinding()] 18 | param ( 19 | ) 20 | 21 | begin { 22 | Write-PScriboMessage "SMB InfoLevel set at $($InfoLevel.SMB)." 23 | Write-PScriboMessage "Collecting File Server Network Interface information." 24 | } 25 | 26 | process { 27 | if ($InfoLevel.SMB -ge 1) { 28 | try { 29 | $SMBNICs = Invoke-Command -Session $TempPssSession { Get-SmbServerNetworkInterface } 30 | if ($SMBNICs) { 31 | Section -Style Heading3 "SMB Network Interface" { 32 | Paragraph "The following table provide a summary of the SMB protocol network interface information" 33 | BlankLine 34 | $OutObj = @() 35 | foreach ($SMBNIC in $SMBNICs) { 36 | try { 37 | $inObj = [ordered] @{ 38 | 'Name' = Switch (($SMBNIC.InterfaceIndex).count) { 39 | 0 { "Unknown" } 40 | default { Invoke-Command -Session $TempPssSession { (Get-NetAdapter -InterfaceIndex ($using:SMBNIC).InterfaceIndex).Name } } 41 | } 42 | 'RSS Capable' = $SMBNIC.RssCapable 43 | 'RDMA Capable' = $SMBNIC.RdmaCapable 44 | 'IP Address' = $SMBNIC.IpAddress 45 | } 46 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 47 | } catch { 48 | Write-PScriboMessage -IsWarning $_.Exception.Message 49 | } 50 | } 51 | 52 | $TableParams = @{ 53 | Name = "SMB Network Interfaces" 54 | List = $false 55 | ColumnWidths = 34, 16, 16, 34 56 | } 57 | if ($Report.ShowTableCaptions) { 58 | $TableParams['Caption'] = "- $($TableParams.Name)" 59 | } 60 | $OutObj | Table @TableParams 61 | } 62 | } 63 | } catch { 64 | Write-PScriboMessage -IsWarning $_.Exception.Message 65 | } 66 | } 67 | } 68 | end {} 69 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinSMBShare.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinSMBShare { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Windows Server File Server Shares information. 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.6 9 | Author: Jonathan Colon 10 | Twitter: @jcolonfzenpr 11 | Github: rebelinux 12 | Credits: Iain Brighton (@iainbrighton) - PScribo module 13 | 14 | .LINK 15 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 16 | #> 17 | [CmdletBinding()] 18 | param ( 19 | ) 20 | 21 | begin { 22 | Write-PScriboMessage "SMB InfoLevel set at $($InfoLevel.SMB)." 23 | Write-PScriboMessage "Collecting File Server Shares information." 24 | } 25 | 26 | process { 27 | if ($InfoLevel.SMB -ge 1) { 28 | try { 29 | if ($SMBShares) { 30 | Section -Style Heading3 'File Shares' { 31 | Paragraph 'The following section details network shares' 32 | BlankLine 33 | $OutObj = @() 34 | foreach ($SMBShare in $SMBShares) { 35 | Section -Style Heading4 "$($SMBShare.Name) Share" { 36 | Paragraph "The following table details shares configuration" 37 | BlankLine 38 | try { 39 | $ShareAccess = Invoke-Command -Session $TempPssSession { Get-SmbShareAccess -Name ($using:SMBShare).Name } 40 | $inObj = [ordered] @{ 41 | 'Name' = $SMBShare.Name 42 | 'Scope Name' = $SMBShare.ScopeName 43 | 'Path' = $SMBShare.Path 44 | 'Description' = $SMBShare.Description 45 | 'Access Based Enumeration Mode' = $SMBShare.FolderEnumerationMode 46 | 'Caching Mode' = $SMBShare.CachingMode 47 | 'Encrypt Data' = $SMBShare.EncryptData 48 | 'State' = $SMBShare.ShareState 49 | } 50 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 51 | $TableParams = @{ 52 | Name = "File Server Shares - $($SMBShare.Name)" 53 | List = $true 54 | ColumnWidths = 40, 60 55 | } 56 | if ($Report.ShowTableCaptions) { 57 | $TableParams['Caption'] = "- $($TableParams.Name)" 58 | } 59 | $OutObj | Table @TableParams 60 | } catch { 61 | Write-PScriboMessage -IsWarning $_.Exception.Message 62 | } 63 | try { 64 | $ShareAccess = Invoke-Command -Session $TempPssSession { Get-SmbShareAccess -Name ($using:SMBShare).Name } 65 | if ($ShareAccess) { 66 | Section -Style Heading5 'Permissions' { 67 | Paragraph "The following table details $($SMBShare.Name) shares permissions" 68 | BlankLine 69 | $OutObj = @() 70 | foreach ($SMBACL in $ShareAccess) { 71 | try { 72 | $inObj = [ordered] @{ 73 | 'Scope Name' = $SMBACL.ScopeName 74 | 'Account Name' = $SMBACL.AccountName 75 | 'Access Control Type' = $SMBACL.AccessControlType 76 | 'Access Right' = $SMBACL.AccessRight 77 | } 78 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 79 | 80 | } catch { 81 | Write-PScriboMessage -IsWarning $_.Exception.Message 82 | } 83 | } 84 | 85 | $TableParams = @{ 86 | Name = "Share Permissions - $($SMBShare.Name)" 87 | List = $false 88 | ColumnWidths = 25, 25, 25, 25 89 | } 90 | if ($Report.ShowTableCaptions) { 91 | $TableParams['Caption'] = "- $($TableParams.Name)" 92 | } 93 | $OutObj | Table @TableParams 94 | } 95 | } 96 | } catch { 97 | Write-PScriboMessage -IsWarning $_.Exception.Message 98 | } 99 | } 100 | } 101 | } 102 | } 103 | } catch { 104 | Write-PScriboMessage -IsWarning $_.Exception.Message 105 | } 106 | } 107 | } 108 | end {} 109 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinSMBSummary.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinSMBSummary { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Windows Server File Server Summary information. 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.6 9 | Author: Jonathan Colon 10 | Twitter: @jcolonfzenpr 11 | Github: rebelinux 12 | Credits: Iain Brighton (@iainbrighton) - PScribo module 13 | 14 | .LINK 15 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 16 | #> 17 | [CmdletBinding()] 18 | param ( 19 | ) 20 | 21 | begin { 22 | Write-PScriboMessage "SMB InfoLevel set at $($InfoLevel.SMB)." 23 | Write-PScriboMessage "Collecting File Server Summary information." 24 | } 25 | 26 | process { 27 | if ($InfoLevel.SMB -ge 1) { 28 | try { 29 | $SMBSummary = Get-SmbServerConfiguration -CimSession $TempCimSession | Select-Object AutoShareServer, EnableLeasing, EnableMultiChannel, EnableOplocks, KeepAliveTime, EnableSMB1Protocol, EnableSMB2Protocol 30 | if ($SMBSummary) { 31 | $OutObj = @() 32 | $inObj = [ordered] @{ 33 | 'Auto Share Server' = $SMBSummary.AutoShareServer 34 | 'Enable Leasing' = $SMBSummary.EnableLeasing 35 | 'Enable MultiChannel' = $SMBSummary.EnableMultiChannel 36 | 'Enable Oplocks' = $SMBSummary.EnableOplocks 37 | 'Keep Alive Time' = $SMBSummary.KeepAliveTime 38 | 'SMB1 Protocol' = $SMBSummary.EnableSMB1Protocol 39 | 'SMB2 Protocol' = $SMBSummary.EnableSMB2Protocol 40 | } 41 | $OutObj += [pscustomobject](ConvertTo-HashToYN $inObj) 42 | 43 | 44 | if ($HealthCheck.SMB.BP) { 45 | $OutObj | Where-Object { $_.'SMB1 Protocol' -eq 'Yes' } | Set-Style -Style Warning -Property 'SMB1 Protocol' 46 | } 47 | 48 | $TableParams = @{ 49 | Name = "SMB Server Settings" 50 | List = $true 51 | ColumnWidths = 40, 60 52 | } 53 | if ($Report.ShowTableCaptions) { 54 | $TableParams['Caption'] = "- $($TableParams.Name)" 55 | } 56 | $OutObj | Table @TableParams 57 | } 58 | } catch { 59 | Write-PScriboMessage -IsWarning $_.Exception.Message 60 | } 61 | } 62 | } 63 | end {} 64 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinSQLBackupDevice.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinSQLBackupDevice { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Windows SQL Server backup device information. 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.3 9 | Author: Jonathan Colon 10 | Twitter: @rebelinux 11 | Github: AsBuiltReport 12 | Credits: Iain Brighton (@iainbrighton) - PScribo module 13 | 14 | .LINK 15 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 16 | #> 17 | [CmdletBinding()] 18 | param ( 19 | ) 20 | 21 | begin { 22 | Write-PScriboMessage "SQL Server Backup Device InfoLevel set at $($InfoLevel.SQLServer)." 23 | } 24 | 25 | process { 26 | try { 27 | Write-PScriboMessage "Collecting SQL Server Backup Device information." 28 | $SQLBackUpDevices = Get-DbaBackupDevice -SqlInstance $SQLServer | Sort-Object -Property Name 29 | if ($SQLBackUpDevices) { 30 | Write-PScriboMessage "Collecting SQL Server Backup Device information." 31 | Section -Style Heading4 'Backup Device' { 32 | $ItemInfo = @() 33 | foreach ($Item in $SQLBackUpDevices) { 34 | try { 35 | $InObj = [Ordered]@{ 36 | 'Name' = $Item.Name 37 | 'Backup Device Type' = $Item.BackupDeviceType 38 | 'Physical Location' = $Item.PhysicalLocation 39 | 'Skip Tape Label' = $Item.SkipTapeLabel 40 | } 41 | $ItemInfo += [pscustomobject](ConvertTo-HashToYN $inObj) 42 | } catch { 43 | Write-PScriboMessage -IsWarning "SQL Server System Backup Device Section: $($_.Exception.Message)" 44 | } 45 | } 46 | 47 | if ($InfoLevel.SQLServer -ge 2) { 48 | Paragraph "The following sections detail the configuration of the backup device." 49 | foreach ($Item in $ItemInfo) { 50 | Section -Style NOTOCHeading5 -ExcludeFromTOC "$($Item.Name)" { 51 | $TableParams = @{ 52 | Name = "Backup Device - $($Item.Name)" 53 | List = $true 54 | ColumnWidths = 50, 50 55 | } 56 | if ($Report.ShowTableCaptions) { 57 | $TableParams['Caption'] = "- $($TableParams.Name)" 58 | } 59 | $Item | Table @TableParams 60 | } 61 | } 62 | } else { 63 | Paragraph "The following table summarises the configuration of the backup device." 64 | BlankLine 65 | $TableParams = @{ 66 | Name = "Backup Devices" 67 | List = $false 68 | Columns = 'Name', 'Backup Device Type', 'Physical Location' 69 | ColumnWidths = 25, 25, 50 70 | } 71 | if ($Report.ShowTableCaptions) { 72 | $TableParams['Caption'] = "- $($TableParams.Name)" 73 | } 74 | $ItemInfo | Table @TableParams 75 | } 76 | } 77 | } 78 | } catch { 79 | Write-PScriboMessage -IsWarning "SQL Server Backup Device Section: $($_.Exception.Message)" 80 | } 81 | } 82 | end {} 83 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinSQLBuild.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinSQLBuild { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Windows SQL Server Properties information. 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.2 9 | Author: Andrew Ramsay 10 | Editor: Jonathan Colon 11 | Twitter: @asbuiltreport 12 | Github: AsBuiltReport 13 | Credits: Iain Brighton (@iainbrighton) - PScribo module 14 | 15 | .LINK 16 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 17 | #> 18 | [CmdletBinding()] 19 | param ( 20 | ) 21 | 22 | begin { 23 | Write-PScriboMessage "SQL Server InfoLevel set at $($InfoLevel.SQLServer)." 24 | Write-PScriboMessage "Collecting SQL Server Properties information." 25 | } 26 | 27 | process { 28 | if ($InfoLevel.SQLServer -ge 1) { 29 | try { 30 | $Properties = Get-DbaInstanceProperty -SqlInstance $SQLServer | ForEach-Object { @{$_.Name = $_.Value } } 31 | $Build = Get-DbaBuild -SqlInstance $SQLServer -WarningAction SilentlyContinue 32 | if ($Properties) { 33 | Section -Style Heading3 'General Information' { 34 | Paragraph 'The following table details sql server properties information' 35 | BlankLine 36 | [array]$SQLServerObjt = @() 37 | $TempSQLServerObjt = [PSCustomObject]@{ 38 | 'Instance Name' = $Build.SqlInstance 39 | 'Fully Qualified Net Name' = $Properties.FullyQualifiedNetName 40 | 'Supported Until' = $Build.SupportedUntil.ToShortDateString() 41 | 'Edition' = $Properties.Edition 42 | 'Level' = "Microsoft SQL Server $($Build.NameLevel)" 43 | 'Build' = $Properties.VersionString 44 | 'Service Pack' = $Properties.ProductLevel 45 | 'Comulative Update' = $Build.CULevel 46 | 'KB Level' = $Build.KBLevel 47 | 'Case Sensitive' = $Properties.IsCaseSensitive 48 | 'Full Text Installed' = $Properties.IsFullTextInstalled 49 | 'XTP Supported' = $Properties.IsXTPSupported 50 | 'Clustered' = $Properties.IsClustered 51 | 'Single User' = $Properties.IsSingleUser 52 | 'Language' = $Properties.Language 53 | 'Collation' = $Properties.Collation 54 | 'Sql CharSet Name' = $Properties.SqlCharSetName 55 | 'Root Directory' = $Properties.RootDirectory 56 | 'Master DB Path' = $Properties.MasterDBPath 57 | 'Master DB Log Path' = $Properties.MasterDBLogPath 58 | 'Backup Directory' = $Properties.BackupDirectory 59 | 'Default File' = $Properties.DefaultFile 60 | 'Default Log' = $Properties.DefaultLog 61 | 'Login Mode' = $Properties.LoginMode 62 | 'Mail Profile' = $Properties.MailProfile 63 | 'Warning' = $Build.Warning 64 | } 65 | $SQLServerObjt += $TempSQLServerObjt 66 | 67 | $TableParams = @{ 68 | Name = "General Information" 69 | List = $True 70 | ColumnWidths = 40, 60 71 | } 72 | if ($Report.ShowTableCaptions) { 73 | $TableParams['Caption'] = "- $($TableParams.Name)" 74 | } 75 | $SQLServerObjt | Table @TableParams 76 | } 77 | } 78 | } catch { 79 | Write-PScriboMessage -IsWarning $_.Exception.Message 80 | } 81 | } 82 | } 83 | end {} 84 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinSQLLogin.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinSQLLogin { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Windows SQL Server login information. 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.3 9 | Author: Jonathan Colon 10 | Twitter: @rebelinux 11 | Github: AsBuiltReport 12 | Credits: Iain Brighton (@iainbrighton) - PScribo module 13 | 14 | .LINK 15 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 16 | #> 17 | [CmdletBinding()] 18 | param ( 19 | ) 20 | 21 | begin { 22 | Write-PScriboMessage "SQL Server Logins InfoLevel set at $($InfoLevel.SQLServer)." 23 | } 24 | 25 | process { 26 | try { 27 | Write-PScriboMessage "Collecting SQL Server logins information." 28 | $SQLLogins = Get-DbaLogin -SqlInstance $SQLServer | Sort-Object -Property Name 29 | if ($SQLLogins) { 30 | Write-PScriboMessage "Collecting SQL Server logins information." 31 | Section -Style Heading4 'Logins' { 32 | $ItemInfo = @() 33 | foreach ($Item in $SQLLogins) { 34 | $ServerRoles = try { Get-DbaServerRoleMember -SqlInstance $SQLServer -Login $Item.Name } catch { Out-Null } 35 | try { 36 | $InObj = [Ordered]@{ 37 | 'Name' = $Item.Name 38 | 'Login Type' = $Item.LoginType -creplace '(?<=\w)([A-Z])', ' $1' 39 | 'Server Roles' = Switch ([string]::IsNullOrEmpty($ServerRoles.Role)) { 40 | $true { '--' } 41 | $false { $ServerRoles.Role } 42 | default { 'Unknown' } 43 | } 44 | 'Create Date' = $Item.CreateDate 45 | 'Last Login' = Switch ([string]::IsNullOrEmpty($Item.LastLogin)) { 46 | $true { 'Never' } 47 | $false { $Item.LastLogin } 48 | default { 'Unknown' } 49 | } 50 | 'Has Access?' = $Item.HasAccess 51 | 'Is Locked?' = Switch ([string]::IsNullOrEmpty($Item.IsLocked)) { 52 | $true { 'No' } 53 | $false { $Item.IsLocked } 54 | default { 'Unknown' } 55 | } 56 | 'Is Disabled?' = $Item.IsDisabled 57 | 'Must Change Password' = Switch ([string]::IsNullOrEmpty($Item.MustChangePassword)) { 58 | $true { 'No' } 59 | $false { $Item.MustChangePassword } 60 | default { 'Unknown' } 61 | } 62 | 63 | 64 | } 65 | $ItemInfo += [pscustomobject](ConvertTo-HashToYN $inObj) 66 | } catch { 67 | Write-PScriboMessage -IsWarning "SQL Server System Login Section: $($_.Exception.Message)" 68 | } 69 | } 70 | 71 | if ($InfoLevel.SQLServer -ge 2) { 72 | Paragraph "The following sections detail the configuration of the security login." 73 | foreach ($Item in $ItemInfo) { 74 | Section -Style NOTOCHeading5 -ExcludeFromTOC "$($Item.Name)" { 75 | $TableParams = @{ 76 | Name = "Login - $($Item.Name)" 77 | List = $true 78 | ColumnWidths = 50, 50 79 | } 80 | if ($Report.ShowTableCaptions) { 81 | $TableParams['Caption'] = "- $($TableParams.Name)" 82 | } 83 | $Item | Table @TableParams 84 | } 85 | } 86 | } else { 87 | Paragraph "The following table summarises the configuration of the security login." 88 | BlankLine 89 | $TableParams = @{ 90 | Name = "Logins" 91 | List = $false 92 | Columns = 'Name', 'Login Type', 'Server Roles', 'Has Access?', 'Is Locked?', 'Is Disabled?' 93 | ColumnWidths = 30, 17, 17, 12, 12, 12 94 | } 95 | if ($Report.ShowTableCaptions) { 96 | $TableParams['Caption'] = "- $($TableParams.Name)" 97 | } 98 | $ItemInfo | Table @TableParams 99 | } 100 | } 101 | } 102 | } catch { 103 | Write-PScriboMessage -IsWarning "SQL Server System Security Login Section: $($_.Exception.Message)" 104 | } 105 | } 106 | end {} 107 | } -------------------------------------------------------------------------------- /Src/Private/Get-AbrWinSQLRole.ps1: -------------------------------------------------------------------------------- 1 | function Get-AbrWinSQLRole { 2 | <# 3 | .SYNOPSIS 4 | Used by As Built Report to retrieve Windows SQL Server roles information. 5 | .DESCRIPTION 6 | Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo. 7 | .NOTES 8 | Version: 0.5.3 9 | Author: Jonathan Colon 10 | Twitter: @rebelinux 11 | Github: AsBuiltReport 12 | Credits: Iain Brighton (@iainbrighton) - PScribo module 13 | 14 | .LINK 15 | https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows 16 | #> 17 | [CmdletBinding()] 18 | param ( 19 | ) 20 | 21 | begin { 22 | Write-PScriboMessage "SQL Server Roles InfoLevel set at $($InfoLevel.SQLServer)." 23 | } 24 | 25 | process { 26 | try { 27 | Write-PScriboMessage "Collecting SQL Server roles information." 28 | $SQLRoles = Get-DbaServerRole -SqlInstance $SQLServer | Sort-Object -Property Role 29 | if ($SQLRoles) { 30 | Write-PScriboMessage "Collecting SQL Server roles information." 31 | Section -Style Heading4 'Roles' { 32 | $ItemInfo = @() 33 | foreach ($Item in $SQLRoles) { 34 | try { 35 | $InObj = [Ordered]@{ 36 | 'Name' = $Item.Role 37 | 'Owner' = $Item.Owner 38 | 'Login' = Switch ([string]::IsNullOrEmpty($Item.Login)) { 39 | $true { '--' } 40 | $false { $Item.Login } 41 | default { 'Unknown' } 42 | } 43 | 'Fixed Role' = $Item.IsFixedRole 44 | 'Create Date' = $Item.DateCreated 45 | } 46 | $ItemInfo += [pscustomobject](ConvertTo-HashToYN $inObj) 47 | } catch { 48 | Write-PScriboMessage -IsWarning "SQL Server System Roles Section: $($_.Exception.Message)" 49 | } 50 | } 51 | 52 | if ($InfoLevel.SQLServer -ge 2) { 53 | Paragraph "The following sections detail the configuration of the security roles." 54 | foreach ($Item in $ItemInfo) { 55 | Section -Style NOTOCHeading5 -ExcludeFromTOC "$($Item.Name)" { 56 | $TableParams = @{ 57 | Name = "Role - $($Item.Name)" 58 | List = $true 59 | ColumnWidths = 50, 50 60 | } 61 | if ($Report.ShowTableCaptions) { 62 | $TableParams['Caption'] = "- $($TableParams.Name)" 63 | } 64 | $Item | Table @TableParams 65 | } 66 | } 67 | } else { 68 | Paragraph "The following table summarises the configuration of the security role." 69 | BlankLine 70 | $TableParams = @{ 71 | Name = "Roles" 72 | List = $false 73 | Columns = 'Name', 'Owner', 'Login' 74 | ColumnWidths = 25, 25, 50 75 | } 76 | if ($Report.ShowTableCaptions) { 77 | $TableParams['Caption'] = "- $($TableParams.Name)" 78 | } 79 | $ItemInfo | Table @TableParams 80 | } 81 | } 82 | } 83 | } catch { 84 | Write-PScriboMessage -IsWarning "SQL Server Role Section: $($_.Exception.Message)" 85 | } 86 | } 87 | end {} 88 | } -------------------------------------------------------------------------------- /Src/Private/Get-RequiredFeature.ps1: -------------------------------------------------------------------------------- 1 | function Get-RequiredFeature { 2 | <# 3 | .SYNOPSIS 4 | Function to check if the required version of windows feature is installed 5 | .DESCRIPTION 6 | Function to check if the required version of windows feature is installed 7 | .NOTES 8 | Version: 0.5.5 9 | Author: Jonathan Colon 10 | Twitter: @jcolonfzenpr 11 | Github: rebelinux 12 | .PARAMETER Name 13 | The name of the required windows feature 14 | .PARAMETER Version 15 | The version of the required windows feature 16 | #> 17 | 18 | Param 19 | ( 20 | [CmdletBinding()] 21 | [Parameter(Mandatory = $true, ValueFromPipeline = $false)] 22 | [ValidateNotNullOrEmpty()] 23 | [String] 24 | $Name, 25 | 26 | [Parameter(Mandatory = $true, ValueFromPipeline = $false)] 27 | [ValidateNotNullOrEmpty()] 28 | [String] 29 | $OSType, 30 | 31 | [Parameter(Mandatory = $false, ValueFromPipeline = $false)] 32 | [Switch] 33 | $Feature = $False, 34 | 35 | [Parameter(Mandatory = $false, ValueFromPipeline = $false)] 36 | [Switch] 37 | $Status = $False, 38 | 39 | [Parameter(Mandatory = $false, ValueFromPipeline = $false)] 40 | [ValidateNotNullOrEmpty()] 41 | [String] 42 | $Service 43 | ) 44 | 45 | process { 46 | # Check if the required version of Module is installed 47 | if ($OSType -eq 'WorkStation') { 48 | if ($Feature) { 49 | $RequiredFeature = Invoke-Command -Session $TempPssSession { Get-WindowsOptionalFeature -FeatureName $Using:Name -Online } 50 | if ($Status) { 51 | if ($RequiredFeature.State -eq "Enabled") { 52 | return $true 53 | } else { 54 | return $false 55 | } 56 | } 57 | if (-Not $Status) { 58 | if ($RequiredFeature.State -ne "Enabled") { 59 | Write-PScriboMessage -IsWarning "$Name module is required to be installed on $System to be able to document $Service service. Run 'Enable-WindowsOptionalFeature -Online -FeatureName '$($Name)'' to install the required modules." 60 | } 61 | } 62 | } else { 63 | $RequiredFeature = Invoke-Command -Session $TempPssSession { Get-WindowsCapability -Online -Name $Using:Name } 64 | if ($Status) { 65 | if ($RequiredFeature.State -eq "Installed") { 66 | return $true 67 | } else { 68 | return $false 69 | } 70 | } 71 | if (-Not $Status) { 72 | if ($RequiredFeature.State -ne "Installed") { 73 | Write-PScriboMessage -IsWarning "$Name module is required to be installed on $System to be able to document $Service service. Run 'Add-WindowsCapability -online -Name '$($Name)'' to install the required modules." 74 | } 75 | } 76 | } 77 | } elseif ($OSType -eq 'Server' -or $OSType -eq 'DomainController') { 78 | $RequiredFeature = Invoke-Command -Session $TempPssSession { Get-WindowsFeature -Name $Using:Name } 79 | if ($Status) { 80 | if ($RequiredFeature.InstallState -eq 'Installed') { 81 | return $true 82 | } else { 83 | return $false 84 | } 85 | } 86 | if (-Not $Status) { 87 | if ($RequiredFeature.InstallState -ne 'Installed') { 88 | Write-PScriboMessage -IsWarning "$Name module is required to be installed on $System to be able to document $Service service. Run 'Install-WindowsFeature -Name '$($Name)'' to install the required modules." 89 | } 90 | } 91 | } else { 92 | throw "Unable to validate if $Name is installed. https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows" 93 | } 94 | } 95 | end {} 96 | } --------------------------------------------------------------------------------