Full Code of sqlcollaborative/dbachecks for AI

main 948f90f82fcd cached
184 files
1.9 MB
600.0k tokens
1 requests
Download .txt
Showing preview only (2,031K chars total). Download the full file or copy to clipboard to get everything.
Repository: sqlcollaborative/dbachecks
Branch: main
Commit: 948f90f82fcd
Files: 184
Total size: 1.9 MB

Directory structure:
gitextract_bzjyocov/

├── .devcontainer/
│   ├── codespaces/
│   │   ├── codespaces-docker-compose.yml
│   │   └── devcontainer.json
│   ├── devcontainer.json
│   └── docker-compose.yml
├── .gitattributes
├── .github/
│   ├── FUNDING.yml
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug_report.md
│   │   ├── feature_request.md
│   │   └── question.md
│   ├── Pull_Request_Template.md
│   ├── issue_template.md
│   └── workflows/
│       ├── PR-PesterTest.yml
│       ├── PR.yml
│       ├── deploy-module.yml
│       └── docker-image.yml
├── .gitignore
├── .markdownlint.json
├── .vscode/
│   ├── launch.json
│   ├── settings.json
│   └── tasks.json
├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── GitVersion.yml
├── LICENSE
├── PSScriptAnalyzerSettings.psd1
├── RELEASE.md
├── RequiredModules.psd1
├── Resolve-Dependency.ps1
├── Resolve-Dependency.psd1
├── SECURITY.md
├── azure-pipelines.yml
├── build.ps1
├── build.yaml
├── builddocs.ps1
├── codecov.yml
├── containers/
│   ├── JessAndBeard.psm1
│   ├── base/
│   │   ├── dockerfile
│   │   └── profile.ps1
│   ├── second/
│   │   └── dockerfile
│   └── third/
│       └── dockerfile
├── dbachecksdevcontainer.code-workspace
├── developing/
│   ├── Archive/
│   │   ├── Get-AllInstanceInfo testing.ps1
│   │   ├── Perf Testing pesterv5.ps1
│   │   ├── PerfAndValidate-Checks.ps1
│   │   ├── Validate v4 adn v5.ps1
│   │   ├── initfields.ps1
│   │   ├── originalGet-AllInstanceInfo.ps1
│   │   ├── pesterv5testing.ps1
│   │   └── tests/
│   │       ├── Help.Exceptions.ps1
│   │       ├── InModule.Help.Exceptions.ps1
│   │       ├── InModule.Help.Tests.ps1
│   │       ├── Integration/
│   │       │   ├── DockerTests.ps1
│   │       │   └── docker-compose.yml
│   │       ├── Project.Tests.ps1
│   │       ├── Reset-DbcConfig.Tests.ps1
│   │       ├── Test-SingleFile.ps1
│   │       ├── Unit.Tests.ps1
│   │       ├── build/
│   │       │   ├── Initialize-VstsAgentOnWindowsServerCoreContainer.ps1
│   │       │   ├── Install-VstsAgentOnWindowsServerCoreContainer.ps1
│   │       │   └── Remove-VstsAgentOnWindowsServerCoreContainer.ps1
│   │       ├── checks/
│   │       │   ├── AgentChecks.Tests.ps1
│   │       │   ├── DatabaseChecks.Tests.ps1
│   │       │   ├── InstanceChecks.Tests.ps1
│   │       │   └── ServerChecks.Tests.ps1
│   │       ├── constants.ps1
│   │       ├── functions/
│   │       │   ├── Export-DbcConfig.Tests.ps1
│   │       │   ├── Get-CheckFile.Tests.ps1
│   │       │   ├── Get-CheckInformation.tests.ps1
│   │       │   ├── Get-DatabaseDetail.Tests.ps1
│   │       │   ├── Get-DbcCheck.Tests.ps1
│   │       │   ├── Get-DbcConfig.Tests.ps1
│   │       │   ├── Get-DbcConfigValue.Tests.ps1
│   │       │   ├── Get-DbcTagCollection.Tests.ps1
│   │       │   ├── Import-DbcConfig.Tests.ps1
│   │       │   ├── Invoke-DbcCheck.Tests.ps1
│   │       │   ├── Invoke-DbcConfigFile.Tests.ps1
│   │       │   ├── Set-DbcConfig.Tests.ps1
│   │       │   ├── Set-DbcFile.Tests.ps1
│   │       │   ├── get-check.json
│   │       │   └── results.json
│   │       └── readme.md
│   ├── Howto.md
│   ├── Oslo Demo.ps1
│   ├── PSConfEU demo.md
│   ├── Robs-Instance.ps1
│   ├── Setting up for Sampler.ps1
│   └── settingupfor2022.ps1
├── docs/
│   ├── RELEASE.md
│   ├── functions/
│   │   ├── Clear-DbcPowerBiDataSource.md
│   │   ├── Convert-DbcResult.md
│   │   ├── Export-DbcConfig.md
│   │   ├── Get-DbcCheck.md
│   │   ├── Get-DbcConfig.md
│   │   ├── Get-DbcConfigValue.md
│   │   ├── Get-DbcReleaseNote.md
│   │   ├── Get-DbcTagCollection.md
│   │   ├── Import-DbcConfig.md
│   │   ├── Invoke-DbcCheck.md
│   │   ├── Invoke-DbcConfigFile.md
│   │   ├── Reset-DbcConfig.md
│   │   ├── Save-DbcRequiredModules.md
│   │   ├── Set-DbcCisConfig.md
│   │   ├── Set-DbcConfig.md
│   │   ├── Set-DbcFile.md
│   │   ├── Start-DbcPowerBi.md
│   │   ├── Update-DbcPowerBiDataSource.md
│   │   ├── Update-DbcRequiredModules.md
│   │   └── Write-DbcTable.md
│   └── index.md
├── header-mkdocs.yml
├── mkdocs.yml
├── readme.md
├── source/
│   ├── bin/
│   │   ├── dbachecks-FromDatabase.pbit
│   │   ├── dbachecks.pbit
│   │   └── dbachecks.pbix
│   ├── checks/
│   │   ├── Agent.Tests.ps1
│   │   ├── Agentv5.Tests.ps1
│   │   ├── Database.Tests.ps1
│   │   ├── Databasev5.Tests.ps1
│   │   ├── Domain.Tests.ps1
│   │   ├── HADR.Tests.ps1
│   │   ├── Instance.Tests.ps1
│   │   ├── Instancev5.Tests.ps1
│   │   ├── LogShipping.Tests.ps1
│   │   ├── MaintenanceSolution.Tests.ps1
│   │   └── Server.Tests.ps1
│   ├── dbachecks.psd1
│   ├── dbachecks.psm1
│   ├── functions/
│   │   ├── Clear-DbcPowerBiDataSource.ps1
│   │   ├── Convert-DbcResult.ps1
│   │   ├── Export-DbcConfig.ps1
│   │   ├── Get-DbcCheck.ps1
│   │   ├── Get-DbcConfig.ps1
│   │   ├── Get-DbcConfigValue.ps1
│   │   ├── Get-DbcReleaseNote.ps1
│   │   ├── Get-DbcTagCollection.ps1
│   │   ├── Import-DbcConfig.ps1
│   │   ├── Invoke-DbcCheck.ps1
│   │   ├── Invoke-DbcConfigFile.ps1
│   │   ├── Reset-DbcConfig.ps1
│   │   ├── Save-DbcRequiredModules.ps1
│   │   ├── Set-DbcCisConfig.ps1
│   │   ├── Set-DbcConfig.ps1
│   │   ├── Set-DbcFile.ps1
│   │   ├── Start-DbcPowerBi.ps1
│   │   ├── Update-DbcPowerBiDataSource.ps1
│   │   ├── Update-DbcRequiredModules.ps1
│   │   └── Write-DbcTable.ps1
│   ├── internal/
│   │   ├── assertions/
│   │   │   ├── Agent.Assertions.ps1
│   │   │   ├── Database.Assertions.ps1
│   │   │   ├── Instance.Assertions.ps1
│   │   │   └── Server.Assertions.ps1
│   │   ├── configurations/
│   │   │   ├── DbcCheckDescriptions.json
│   │   │   └── configuration.ps1
│   │   ├── functions/
│   │   │   ├── Get-AllAgentInfo.ps1
│   │   │   ├── Get-AllDatabaseInfo.ps1
│   │   │   ├── Get-CheckFile.ps1
│   │   │   ├── Get-CheckInformation.ps1
│   │   │   ├── Get-CheckRepo.ps1
│   │   │   ├── Get-ComputerName.ps1
│   │   │   ├── Get-DatabaseDetail.ps1
│   │   │   ├── Get-SqlInstance.ps1
│   │   │   ├── Get-Version.ps1
│   │   │   ├── Get-v5Checks.ps1
│   │   │   ├── Invoke-ConfigurationScript.ps1
│   │   │   ├── Invoke-DbcCheckv4.ps1
│   │   │   ├── Invoke-DbcCheckv5.ps1
│   │   │   ├── New-Json.ps1
│   │   │   ├── NewGet-AllInstanceInfo.ps1
│   │   │   ├── Select-DefaultView.ps1
│   │   │   └── Set-DatabaseForIntegrationTesting.ps1
│   │   ├── scripts/
│   │   │   ├── postimport.ps1
│   │   │   └── preimport.ps1
│   │   └── tepp/
│   │       └── autocomplete.ps1
│   └── xml/
│       └── dbachecks.Format.ps1xml
├── tests/
│   ├── Project.Tests.ps1
│   ├── QA/
│   │   └── module.tests.ps1
│   ├── Unit/
│   │   ├── Private/
│   │   │   └── Get-PrivateFunction.tests.ps1
│   │   └── Public/
│   │       ├── Export-DbcConfig.Tests.ps1
│   │       └── Get-Something.tests.ps1
│   ├── Unit.Tests.ps1
│   └── readme.md
└── xml/
    └── dbachecks.Format.ps1xml

================================================
FILE CONTENTS
================================================

================================================
FILE: .devcontainer/codespaces/codespaces-docker-compose.yml
================================================
version: "3"
# because it crashes the integrated terminal in codespaces we need an additional devcontainer.json config. Hopefully this will work as expected.
# hidden away in the docs :-( https://docs.github.com/en/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers#devcontainerjson
services:
    dbachecks1:
      image: sqldbawithabeard/dbachecks1:v2.1.0-beta.1
      volumes:
        - mydata:/var/opt/backups
        - shared:/shared
        # Update this to wherever you want VS Code to mount the folder of your project
        - ..:/workspace:cached
      ports:
        - "7401:1433"
      container_name: dbachecks1
      hostname: dbachecks1
      
    dbachecks2:
      image: sqldbawithabeard/dbachecks2:v2.1.0-beta.1
      volumes:
        - mydata:/var/opt/backups
        - shared:/shared
        # Update this to wherever you want VS Code to mount the folder of your project
        # So that the second container is rebuilt everytime as well 
        - ..:/somewhereweirdworkspace:cached
      ports:
        - "7402:1433"
      container_name: dbachecks2
      hostname: dbachecks2

volumes:
  mydata:
  shared:


================================================
FILE: .devcontainer/codespaces/devcontainer.json
================================================
{
    "name": "dbachecks",
    "workspaceFolder": "/workspace",
    "dockerComposeFile": [
        "codespaces-docker-compose.yml"
    ],
    "remoteEnv": {
        "LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}",
        "MY_SERVER": "dbachecks1"
    },
    "service": "dbachecks1",
    "settings": {
        "editor.renderWhitespace": "all",
        "editor.bracketPairColorization.enabled": true,
        "editor.guides.bracketPairs": true,
        "editor.inlineSuggest.enabled": true,
        "editor.mouseWheelZoom": true,
        "editor.rulers": [
            100
        ],
        "editor.wordWrapColumn": 100,
        "editor.wordWrap": "bounded",
        "files.defaultLanguage": "powershell",
        "git.autofetch": true,
        "powershell.scriptAnalysis.settingsPath": "PSScriptAnalyzerSettings.psd1",
        "powershell.integratedConsole.focusConsoleOnExecute": true,
        "powershell.codeFormatting.preset": "OTBS",
        "powershell.codeFormatting.trimWhitespaceAroundPipe": true,
        "powershell.codeFormatting.useCorrectCasing": true,
        "powershell.codeFormatting.newLineAfterCloseBrace": true,
        "powershell.codeFormatting.newLineAfterOpenBrace": true,
        "powershell.codeFormatting.whitespaceAroundOperator": true,
        "powershell.codeFormatting.addWhitespaceAroundPipe": true,
        "#terminal.integrated.profiles.linux#": {
        "pwsh": {
            "path": "pwsh",
            "icon": "terminal-powershell"
        }
    },
    "terminal.integrated.defaultProfile.linux": "pwsh"
    },
    "extensions": [
        "ms-vscode.powershell",
        "github.vscode-pull-request-github",
        "2gua.rainbow-brackets",
        "oderwat.indent-rainbow",
        "mhutchie.git-graph",
        "usernamehw.errorlens",
        "GitHub.copilot",
        "eamodio.gitlens",
        "TylerLeonhardt.vscode-inline-values-powershell",
        "cschleiden.vscode-github-actions",
        "ms-mssql.mssql",
        "Gruntfuggly.todo-tree"
    ],
    "shutdownAction": "stopCompose",
    "remoteUser": "root"  // not ideal - prob need to setup a non-root user and use that instead. permissions issue without this!
}

================================================
FILE: .devcontainer/devcontainer.json
================================================
{
    "name": "dbachecks",
    "workspaceFolder": "/workspace",
    "dockerComposeFile": [
        "docker-compose.yml"
    ],
    "remoteEnv": {
        "LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}",
        "MY_SERVER": "dbachecks1"
    },
    "service": "dbachecks1",
    "shutdownAction": "stopCompose",
    "remoteUser": "root", // not ideal - prob need to setup a non-root ,user and use that instead. permissions issue without this!
    "customizations": {
        "vscode": {
            "extensions": [
                "ms-vscode.powershell",
                "github.vscode-pull-request-github",
                "oderwat.indent-rainbow",
                "mhutchie.git-graph",
                "usernamehw.errorlens",
                "GitHub.copilot",
                "eamodio.gitlens",
                "TylerLeonhardt.vscode-inline-values-powershell",
                "cschleiden.vscode-github-actions",
                "ms-mssql.mssql",
                "Gruntfuggly.todo-tree",
                "streetsidesoftware.code-spell-checker"
            ],
            "settings": {
                "editor.renderWhitespace": "all",
                "editor.bracketPairColorization.enabled": true,
                "editor.guides.bracketPairs": true,
                "editor.inlineSuggest.enabled": true,
                "editor.mouseWheelZoom": true,
                "editor.rulers": [
                    100
                ],
                "editor.wordWrapColumn": 100,
                "editor.wordWrap": "bounded",
                "files.defaultLanguage": "powershell",
                "git.autofetch": true,
                "powershell.developer.bundledModulesPath": "${cwd}/output/RequiredModules",
                "powershell.scriptAnalysis.settingsPath": "PSScriptAnalyzerSettings.psd1",
                "powershell.integratedConsole.focusConsoleOnExecute": true,
                "powershell.codeFormatting.preset": "OTBS",
                "powershell.codeFormatting.trimWhitespaceAroundPipe": true,
                "powershell.codeFormatting.useCorrectCasing": true,
                "powershell.codeFormatting.newLineAfterCloseBrace": true,
                "powershell.codeFormatting.newLineAfterOpenBrace": true,
                "powershell.codeFormatting.whitespaceBeforeOpenBrace": true,
                "powershell.codeFormatting.whitespaceBeforeOpenParen": true,
                "powershell.codeFormatting.whitespaceAroundOperator": true,
                "powershell.codeFormatting.whitespaceAfterSeparator": true,
                "powershell.codeFormatting.addWhitespaceAroundPipe": true,
                "powershell.codeFormatting.openBraceOnSameLine": true,
                "powershell.codeFormatting.ignoreOneLineBlock": true,
                "powershell.codeFormatting.pipelineIndentationStyle": "IncreaseIndentationAfterEveryPipeline",
                "powershell.codeFormatting.alignPropertyValuePairs": true,
                "powershell.codeFormatting.blankLinesAroundCommentHelpBlock": true,
                "powershell.codeFormatting.blankLinesAroundFunctionDefinitionBody": true,
                "powershell.codeFormatting.blankLinesAroundPipeline": true,
                "powershell.codeFormatting.blankLinesAroundRegion": true,
                "powershell.codeFormatting.blankLinesBeforeCloseBrace": true,
                "powershell.codeFormatting.blankLinesBeforeFirstLine": true,
                "powershell.codeFormatting.blankLinesBeforeOpenBrace": true,
                "powershell.codeFormatting.blankLinesBetweenMemberDefinition": true,
                "powershell.codeFormatting.blankLinesBetweenUsings": true,
                "powershell.codeFormatting.collapseBracesToIndentation": true,
                "powershell.codeFormatting.collapsePipeline": true,
                "powershell.codeFormatting.newLineAfterCloseBraceInBlock": true,
                "powershell.codeFormatting.newLineAfterCloseBraceInElse": true,
                "powershell.codeFormatting.newLineAfterCloseBraceInFunction": true,
                "powershell.codeFormatting.newLineAfterCloseBraceInIf": true,
                "powershell.codeFormatting.newLineAfterCloseBraceInSwitch": true,
                "powershell.codeFormatting.newLineAfterCloseBraceInTry": true,
                "powershell.codeFormatting.newLineAfterCloseBraceInWhile": true,
                "powershell.codeFormatting.newLineAfterColonInHashtable": true,
                "powershell.codeFormatting.newLineAfterComma": true,
                "powershell.codeFormatting.newLineAfterDoWhile": true,
                "powershell.codeFormatting.newLineAfterFor": true,
                "powershell.codeFormatting.newLineAfterForEach": true,
                "powershell.codeFormatting.newLineAfterIf": true,
                "powershell.codeFormatting.newLineAfterOpenBraceInBlock": true,
                "powershell.codeFormatting.newLineAfterOpenBraceInElse": true,
                "powershell.codeFormatting.newLineAfterOpenBraceInFunction": true,
                "powershell.codeFormatting.newLineAfterOpenBraceInIf": true,
                "powershell.codeFormatting.newLineAfterOpenBraceInSwitch": true,
                "powershell.codeFormatting.newLineAfterOpenBraceInTry": true,
                "powershell.codeFormatting.newLineAfterOpenBraceInWhile": true,
                "powershell.codeFormatting.newLineAfterSwitch": true,
                "powershell.codeFormatting.newLineAfterTry": true,
                "powershell.codeFormatting.newLineAfterWhile": true,
                "powershell.codeFormatting.newLineBeforeCloseBrace": true,
                "powershell.codeFormatting.newLineBeforeElse": true,
                "powershell.codeFormatting.newLineBeforeElseIf": true,
                "powershell.codeFormatting.newLineBeforeCatch": true,
                "powershell.codeFormatting.newLineBeforeFinally": true,
                "powershell.codeFormatting.newLineBetweenTypeDefinitionMembers": true,
                "powershell.codeFormatting.pipelineIndentation": 4,
                "powershell.codeFormatting.spaceAfterComma": true,
                "powershell.codeFormatting.spaceAfterSemicolon": true,
                "powershell.codeFormatting.spaceAroundOperator": true,
                "powershell.codeFormatting.spaceBeforeComma": true,
                "powershell.codeFormatting.spaceBeforeSemicolon": true,
                "powershell.codeFormatting.spaceBetweenEmptyBraces": true,
                "powershell.codeFormatting.spaceBetweenEmptyParenthesis": true,
                "powershell.codeFormatting.useConsistentIndentation": true,
                "powershell.codeFormatting.useCorrectCasingForCommand": true,
                "powershell.codeFormatting.useCorrectCasingForParameter": true,
                "powershell.codeFormatting.useCorrectCasingForKeyword": true,
                "powershell.codeFormatting.useCorrectCasingForType": true,
                "powershell.codeFormatting.useCorrectCasingForVariable": true,
                "powershell.codeFormatting.useConsistentWhitespace": true,
                "powershell.codeFormatting.useCorrectCasingForAttribute": true,
                "powershell.codeFormatting.useCorrectCasingForProperty": true,
                "powershell.codeFormatting.useCorrectCasingForEnum": true,
                "powershell.codeFormatting.useCorrectCasingForMethod": true,
                "powershell.codeFormatting.useCorrectCasingForFunction": true,
                "powershell.codeFormatting.useCorrectCasingForClass": true,
                "powershell.codeFormatting.useCorrectCasingForInterface": true,
                "powershell.codeFormatting.useCorrectCasingForNamespace": true,
                "powershell.codeFormatting.useCorrectCasingForModule": true,
                "powershell.codeFormatting.useCorrectCasingForWorkflow": true,
                "powershell.codeFormatting.useCorrectCasingForParameterSet": true,
                "powershell.codeFormatting.useCorrectCasingForVariableInForLoop": true,
                "powershell.codeFormatting.useCorrectCasingForDSCResource": true,
                "powershell.codeFormatting.useCorrectCasingForDSCResourceParameter": true,
                "powershell.codeFormatting.useCorrectCasingForEnumMember": true,
                "powershell.codeFormatting.useCorrectCasingForCommentHelp": true,
                "powershell.codeFormatting.useCorrectCasingForCommentHelpParameter": true,
                "powershell.codeFormatting.useCorrectCasingForCommentHelpKeyword": true,
                "powershell.codeFormatting.useCorrectCasingForCommentHelpParameterSet": true,
                "powershell.codeFormatting.useCorrectCasingForCommentHelpType": true,
                "powershell.codeFormatting.useCorrectCasingForCommentHelpFunction": true,
                "powershell.codeFormatting.useCorrectCasingForCommentHelpWorkflow": true,
                "powershell.codeFormatting.useCorrectCasingForCommentHelpModule": true,
                "powershell.codeFormatting.useCorrectCasingForCommentHelpClass": true,
                "powershell.codeFormatting.useCorrectCasingForCommentHelpInterface": true,
                "powershell.codeFormatting.useCorrectCasingForCommentHelpEnum": true,
                "powershell.codeFormatting.useCorrectCasingForCommentHelpDSCResource": true,
                "powershell.codeFormatting.useCorrectCasingForCommentHelpExample": true,
                "powershell.codeFormatting.useCorrectCasingForCommentHelpInputs": true,
                "powershell.codeFormatting.useCorrectCasingForCommentHelpOutputs": true,
                "powershell.codeFormatting.useCorrectCasingForCommentHelpNotes": true,
                "powershell.codeFormatting.useCorrectCasingForCommentHelpLink": true,
                "powershell.codeFormatting.useCorrectCasingForCommentHelpComponent": true,
                "powershell.codeFormatting.useCorrectCasingForCommentHelpRole": true,
                "powershell.codeFormatting.useCorrectCasingForCommentHelpFunctionality": true,
                "powershell.codeFormatting.useCorrectCasingForCommentHelpForwardHelpCategory": true,
                "powershell.codeFormatting.useCorrectCasingForCommentHelpForwardHelpTargetName": true,
                "powershell.codeFormatting.autoCorrectAliases": true,
                "powershell.codeFormatting.avoidSemicolonsAsLineTerminators": true,
                // "powershell.codeFormatting.useConstantStrings": true,
                "powershell.codeFormatting.whitespaceBetweenParameters": true,
                "powershell.codeFormatting.whitespaceInsideBrace": true,
                "powershell.codeFolding.enable": true,
                "powershell.codeFolding.showLastLine": true,
                "powershell.enableReferencesCodeLens": true,
                "editor.formatOnSave": true,
                "editor.formatOnSaveMode": "file",
                "editor.formatOnPaste": true,
                "editor.formatOnType": true,
                "editor.autoClosingBrackets": "always",
                "#terminal.integrated.profiles.linux#": {
                    "pwsh": {
                        "path": "pwsh",
                        "icon": "terminal-powershell"
                    }
                },
                "terminal.integrated.defaultProfile.linux": "pwsh"
            }
        }
    },
    "postCreateCommand": ""
}

================================================
FILE: .devcontainer/docker-compose.yml
================================================
version: "3"
services:
    dbachecks1:
      image: dbachecks/sqlinstance1:v2.38.0
      volumes:
        - mydata:/var/opt/backups
        - shared:/shared
        # Update this to wherever you want VS Code to mount the folder of your project
        - ..:/workspace:cached
      ports:
        - "7401:1433"
      container_name: dbachecks1
      hostname: dbachecks1

    dbachecks2:
      image: dbachecks/sqlinstance2:v2.38.0
      volumes:
        - mydata:/var/opt/backups
        - shared:/shared
        # Update this to wherever you want VS Code to mount the folder of your project
        # So that the second container is rebuilt everytime as well
        - ..:/somewhereweirdworkspace:cached
      ports:
        - "7402:1433"
      container_name: dbachecks2
      hostname: dbachecks2

      # This is our SQL2022 container
    dbachecks3:
      image: dbachecks/sqlinstance3:v2.38.0
      volumes:
        - mydata:/var/opt/backups
        - shared:/shared
        # Update this to wherever you want VS Code to mount the folder of your project
        # So that the second container is rebuilt everytime as well
        - ..:/somewhereweirdworkspace:cached
      ports:
        - "7403:1433"
      container_name: dbachecks3
      hostname: dbachecks3


volumes:
  mydata:
  shared:


================================================
FILE: .gitattributes
================================================
# Auto detect text files and perform LF normalization
* text=auto

# Custom for Visual Studio
*.cs     diff=csharp

# Standard to msysgit
*.doc	 diff=astextplain
*.DOC	 diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot  diff=astextplain
*.DOT  diff=astextplain
*.pdf  diff=astextplain
*.PDF	 diff=astextplain
*.rtf	 diff=astextplain
*.RTF	 diff=astextplain


================================================
FILE: .github/FUNDING.yml
================================================
# These are supported funding model platforms

github: [sqldbawithabeard, jpomfret, ClaudioESSilva, potatoqualitee]


================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.md
================================================
---
name: Bug report
about: Create a report to help us improve

---

<!-- ERASE the sections that are not applicable but please provide as much information as possible -->

## Bug Report

### General Troubleshooting steps
- [ ] Verified running the latest release of dbachecks? 

Does `(Find-Module dbachecks).Version match (Get-Module dbachecks).Version.ToString()`

![image](https://user-images.githubusercontent.com/6729780/37113488-60e5e172-21fa-11e8-8115-814edfbfabb6.png)

- [ ] Verified errors are not related to permissions?
- [ ] Can duplicate in new/clean PowerShell session (clean = `powershell -NoProfile`)?

### Version Information
 - Operating System (Name|Version): <!-- enter name and version -->
 - PowerShell Version: <!-- enter version of PS where code is run -->
 - SQL Server (Edition|Version): <!-- enter Edition and Version for Source and Target if applicable -->

### Steps to Reproduce
<--  
  PLEASE include as much information as possible if this is a bug report.
  The more you include the faster we can identify the problem and get it fixed
-->
 - [ ] Attach any screenshots (if possible/allowed)
 - [ ] Attach output from PowerShell console (if possible/allowed)

### Description of Bug

<--  
  PLEASE include as much information as possible if this is a bug
Explain what it does that you would like it not to do
or
What it doesnt do that you would like it to do :-)
-->


================================================
FILE: .github/ISSUE_TEMPLATE/feature_request.md
================================================
---
name: Feature request
about: Suggest an idea for this project

---

## Feature Request
   
<-- Simply answer the question - What would you like dbachecks to do that it doesn't? -->   
   
## New Check
   
### What would you like to check?
   
### What should be configurable for the results of the check ?
    
<-- A value, a set of properties (like FULL, SIMPLE, BULKLOGGED) -->  
<-- Should there be any default values for the configs? -->   
    
### What should be able to be excluded from being tested ?
    
<-- Could be databases, Could be Availability Groups etc -->  
<-- This would not be instances -->  
   
## Additional information    
    
<!-- replace with your answer -->


================================================
FILE: .github/ISSUE_TEMPLATE/question.md
================================================
---
name: Question
about: Ask a question

---

### Question

Feel free to ask a question using this template :-)


================================================
FILE: .github/Pull_Request_Template.md
================================================
# A New PR

THANK YOU - We love to get PR's and really appreciate your time and help to improve this module

## Accepting a PR

Before we accept the PR - please confirm that you have run the tests locally to avoid our automated build and release process failing. You can see how to do that in our wiki

https://github.com/sqlcollaborative/dbachecks/wiki 

## Please confirm you have 0 failing Pester Tests

[] There are 0 failing Pester tests

## Changes this PR brings

Please add below the changes that this PR covers. It doesnt need an essay just the bullet points :-)

================================================
FILE: .github/issue_template.md
================================================
<!-- ERASE the sections that are not applicable but please provide as much information as possible -->
## Issue

This is a bug or unexpected behaviour/feature request/new check/question (delete as applicable)

<!-- Please fill in the appropriate information below and delete any uneeded information-->

## Bug Report

### General Troubleshooting steps
- [ ] Verified running the latest release of dbachecks? 

Does `(Find-Module dbachecks).Version match (Get-Module dbachecks).Version.ToString()`

![image](https://user-images.githubusercontent.com/6729780/37113488-60e5e172-21fa-11e8-8115-814edfbfabb6.png)

- [ ] Verified errors are not related to permissions?
- [ ] Can duplicate in new/clean PowerShell session (clean = `powershell -NoProfile`)?

### Version Information
 - Operating System (Name|Version): <!-- enter name and version -->
 - PowerShell Version: <!-- enter version of PS where code is run -->
 - SQL Server (Edition|Version): <!-- enter Edition and Version for Source and Target if applicable -->

### Steps to Reproduce
<--  
  PLEASE include as much information as possible if this is a bug report.
  The more you include the faster we can identify the problem and get it fixed
-->
 - [ ] Attach any screenshots (if possible/allowed)
 - [ ] Attach output from PowerShell console (if possible/allowed)

## Feature Request
   
<-- Simply answer the question - What would you like dbachecks to do that it doesn't? -->   
   
## New Check
   
### What would you like to check?
   
### What should be configurable for the results of the check ?
    
<-- A value, a set of properties (like FULL, SIMPLE, BULKLOGGED) -->  
<-- Should there be any default values for the configs? -->   
    
### What should be able to be excluded from being tested ?
    
<-- Could be databases, Could be Availability Groups etc -->  
<-- This would not be instances -->  
   
## Additional information    
    
<!-- replace with your answer -->


================================================
FILE: .github/workflows/PR-PesterTest.yml
================================================
name: PR-Pester

on:
  pull_request:
    branches:
    - development

jobs:
  build:

    runs-on: windows-latest
    steps:
    - name: Checkout code Install and run Pester annoyingly on Windows PowerShell https://github.com/pester/Pester/issues/1295
      uses: actions/checkout@v2.1.0
    
    - run: |
          pwd
          $manifest = Import-PowershellDataFile -Path .\dbachecks.psd1
          $PSFrameworkVersion = $manifest.RequiredModules.Where{$_.ModuleName -eq 'PSFramework'}.ModuleVersion
          $dbatoolsVersion = $manifest.RequiredModules.Where{$_.ModuleName -eq 'dbatools'}.ModuleVersion
  
          Install-Module Pester  -RequiredVersion 4.10.0 -Force
          Install-Module dbatools  -RequiredVersion $dbatoolsVersion  -Force
          Install-Module PSFramework  -RequiredVersion $PsFrameworkVersion  -Force
  
          Import-Module .\dbachecks.psd1 -Verbose
          $PesterResults = Invoke-Pester .\tests -ExcludeTag Integration -Show Fails -PassThru
          If($PesterResults.FailedCount -ne 0){
            Write-Warning "Some Tests Failed - See results above"
            [System.Environment]::Exit(1)
          }
      shell: powershell


================================================
FILE: .github/workflows/PR.yml
================================================
on:
  pull_request:
    branches:
    - main
    paths-ignore:
    - CHANGELOG.md
    tags:
    - '**'
    - '!*preview*'
env:
  buildFolderName: output
  buildArtifactName: output
  testResultFolderName: testResults
jobs:
  Build_Stage_Package_Module:
    name: Package Module
    runs-on: ubuntu-latest
    steps:
    - name: Checkout Code
      uses: actions/checkout@v3
      with:
        ref: ${{github.event.pull_request.head.ref}}
        repository: ${{github.event.pull_request.head.repo.full_name}}   # checkout the correct branch name
        fetch-depth: 0
    - name: Install GitVersion
      uses: gittools/actions/gitversion/setup@v0.9.15
      with:
        versionSpec: 5.x
    - name: Evaluate Next Version
      uses: gittools/actions/gitversion/execute@v0.9.15
      with:
        configFilePath: GitVersion.yml
    - name: Build & Package Module
      shell: pwsh
      run: ./build.ps1 -ResolveDependency -tasks pack -Verbose
      env:
        ModuleVersion: ${{ env.gitVersion.NuGetVersionV2 }}
    - name: Publish Build Artifact
      uses: actions/upload-artifact@v4
      with:
        name: ${{ env.buildArtifactName }}
        path: ${{ env.buildFolderName }}/
  Test_Stage_test_linux:
    name: Linux
    runs-on: ubuntu-latest
    needs:
    - Build_Stage_Package_Module
    steps:
    - name: Checkout Code
      uses: actions/checkout@v3
      with:
        ref: ${{github.event.pull_request.head.ref}}
        repository: ${{github.event.pull_request.head.repo.full_name}}   # checkout the correct branch name
        fetch-depth: 0
    - name: Download Build Artifact
      uses: actions/download-artifact@v4
      with:
        name: ${{ env.buildArtifactName }}
        path: ${{ env.buildFolderName }}
    - name: Run Tests
      shell: pwsh
      run: ./build.ps1 -tasks noop ; ./build.ps1 -tasks test # to get around dbatools failing to load XE.core.dll if
    - name: Publish Test Artifact
      uses: actions/upload-artifact@v4
      with:
        path: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/
        name: CodeCoverageLinux
      if: success() || failure()
  Test_Stage_test_windows_core:
    name: Windows (PowerShell)
    runs-on: windows-2019
    needs:
    - Build_Stage_Package_Module
    steps:
    - name: Checkout Code
      uses: actions/checkout@v3
      with:
        ref: ${{github.event.pull_request.head.ref}}
        repository: ${{github.event.pull_request.head.repo.full_name}}   # checkout the correct branch name
        fetch-depth: 0
    - name: Download Build Artifact
      uses: actions/download-artifact@v4
      with:
        name: ${{ env.buildArtifactName }}
        path: ${{ env.buildFolderName }}
    - name: Run Tests
      shell: pwsh
      run: ./build.ps1 -tasks noop; ipmo dbatools ; ./build.ps1 -tasks test # to get around dbatools failing to load XE.core.dll if

    - name: Publish Test Artifact
      uses: actions/upload-artifact@v4
      with:
        path: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/
        name: CodeCoverageWinPS7
      if: success() || failure()
  Test_Stage_test_windows_ps:
    name: Windows (Windows PowerShell)
    runs-on: windows-2019
    needs:
    - Build_Stage_Package_Module
    steps:
    - name: Checkout Code
      uses: actions/checkout@v3
      with:
        ref: ${{github.event.pull_request.head.ref}}
        repository: ${{github.event.pull_request.head.repo.full_name}}   # checkout the correct branch name
        fetch-depth: 0
    - name: Download Build Artifact
      uses: actions/download-artifact@v4
      with:
        name: ${{ env.buildArtifactName }}
        path: ${{ env.buildFolderName }}
    - name: Run Tests
      shell: pwsh
      run: ./build.ps1 -ResolveDependency -tasks test
    - name: Publish Test Artifact
      uses: actions/upload-artifact@v4
      with:
        path: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/
        name: CodeCoverageWinPS51
      if: success() || failure()
  Test_Stage_Code_Coverage:
    name: Publish Code Coverage
    if: success() || failure()
    runs-on: ubuntu-latest
    needs:
    - Build_Stage_Package_Module
    - Test_Stage_test_linux
    - Test_Stage_test_windows_core
    - Test_Stage_test_windows_ps
    steps:
    - name: Checkout Code
      uses: actions/checkout@v3
      with:
        ref: ${{github.event.pull_request.head.ref}}   # checkout the correct branch name
        repository: ${{github.event.pull_request.head.repo.full_name}}   # checkout the correct branch name
        fetch-depth: 0

    - name: Download Test Artifact Linux
      uses: actions/download-artifact@v4
      with:
        name: CodeCoverageLinux
        path: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/CodeCoverageLinux/
    - name: Download Test Artifact Windows (PS 5.1)
      uses: actions/download-artifact@v4
      with:
        name: CodeCoverageWinPS51
        path: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/CodeCoverageWinPS51/
    - name: Download Test Artifact Windows (PS7)
      uses: actions/download-artifact@v4
      with:
        name: CodeCoverageWinPS7
        path: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/CodeCoverageWinPS7/

    - name: Publish Linux Test Results
      id: linux-test-results
      uses: EnricoMi/publish-unit-test-result-action@v2
      if: always()
      with:
        nunit_files: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/CodeCoverageLinux/NUnit*.xml
        check_name: Linux Test Results
    - name: Publish WinPS51 Test Results
      id: winps51-test-results
      uses: EnricoMi/publish-unit-test-result-action@v2
      if: always()
      with:
        nunit_files: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/CodeCoverageWinPS51/NUnit*.xml
        check_name: WinPS51 Test Results
    - name: Publish WinPS71 Test Results
      id: winps71-test-results
      uses: EnricoMi/publish-unit-test-result-action@v2
      if: always()
      with:
        nunit_files: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/CodeCoverageWinPS7/NUnit*.xml
        check_name: WinPS71 Test Results


================================================
FILE: .github/workflows/deploy-module.yml
================================================
on:
  push:
    branches:
    - main
    paths-ignore:
    - CHANGELOG.md
    - containers/**
    - .github/**
    tags:
    - '**'
    - '!*preview*'
env:
  buildFolderName: output
  buildArtifactName: output
  testResultFolderName: testResults
jobs:
  Build_Stage_Package_Module:
    name: Package Module
    runs-on: ubuntu-latest
    steps:
    - name: Checkout Code
      uses: actions/checkout@v3
      with:
        ref: ${{ github.head_ref }}   # checkout the correct branch name
        fetch-depth: 0
    - name: Install GitVersion
      uses: gittools/actions/gitversion/setup@v0.9.15
      with:
        versionSpec: 5.x
    - name: Evaluate Next Version
      uses: gittools/actions/gitversion/execute@v0.9.15
      with:
        configFilePath: GitVersion.yml
    - name: Build & Package Module
      shell: pwsh
      run: ./build.ps1 -ResolveDependency -tasks pack -Verbose
      env:
        ModuleVersion: ${{ env.gitVersion.NuGetVersionV2 }}
    - name: Publish Build Artifact
      uses: actions/upload-artifact@v4
      with:
        name: ${{ env.buildArtifactName }}
        path: ${{ env.buildFolderName }}/
  Test_Stage_test_linux:
    name: Linux
    runs-on: ubuntu-latest
    needs:
    - Build_Stage_Package_Module
    steps:
    - name: Checkout Code
      uses: actions/checkout@v3
      with:
        ref: ${{ github.head_ref }}   # checkout the correct branch name
        fetch-depth: 0
    - name: Download Build Artifact
      uses: actions/download-artifact@v4
      with:
        name: ${{ env.buildArtifactName }}
        path: ${{ env.buildFolderName }}
    - name: Run Tests
      shell: pwsh
      run: ./build.ps1 -tasks noop; ipmo dbatools ; ./build.ps1 -tasks test # to get around dbatools failing to load XE.core.dll if
    - name: Publish Test Artifact
      uses: actions/upload-artifact@v4
      with:
        path: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/
        name: CodeCoverageLinux
      if: success() || failure()
  Test_Stage_test_windows_core:
    name: Windows (PowerShell)
    runs-on: windows-2019
    needs:
    - Build_Stage_Package_Module
    steps:
    - name: Checkout Code
      uses: actions/checkout@v3
      with:
        ref: ${{ github.head_ref }}   # checkout the correct branch name
        fetch-depth: 0
    - name: Download Build Artifact
      uses: actions/download-artifact@v4
      with:
        name: ${{ env.buildArtifactName }}
        path: ${{ env.buildFolderName }}
    - name: Run Tests
      shell: pwsh
      run: ./build.ps1 -tasks noop; ipmo dbatools ; ./build.ps1 -tasks test # to get around dbatools failing to load XE.core.dll if

    - name: Publish Test Artifact
      uses: actions/upload-artifact@v4
      with:
        path: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/
        name: CodeCoverageWinPS7
      if: success() || failure()
  Test_Stage_test_windows_ps:
    name: Windows (Windows PowerShell)
    runs-on: windows-2019
    needs:
    - Build_Stage_Package_Module
    steps:
    - name: Checkout Code
      uses: actions/checkout@v3
      with:
        ref: ${{ github.head_ref }}   # checkout the correct branch name
        fetch-depth: 0
    - name: Download Build Artifact
      uses: actions/download-artifact@v4
      with:
        name: ${{ env.buildArtifactName }}
        path: ${{ env.buildFolderName }}
    - name: Run Tests
      shell: pwsh
      run: ./build.ps1 -ResolveDependency -tasks test
    - name: Publish Test Artifact
      uses: actions/upload-artifact@v4
      with:
        path: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/
        name: CodeCoverageWinPS51
      if: success() || failure()
#   Test_Stage_test_macos:
#     name: macOS
#     runs-on: macos-latest
#     needs:
#     - Build_Stage_Package_Module
#     steps:
#     - name: Checkout Code
#       uses: actions/checkout@v3
#       with:
#         ref: ${{ github.head_ref }}   # checkout the correct branch name
#         fetch-depth: 0
#     - name: Download Build Artifact
#       uses: actions/download-artifact@v4
#       with:
#         name: ${{ env.buildArtifactName }}
#         path: ${{ env.buildFolderName }}
#     - name: Run Tests
#       shell: pwsh
#       run: ./build.ps1 -tasks noop; ipmo dbatools ; ./build.ps1 -tasks test # to get # around dbatools failing to load XE.core.dll if
#
#     - name: Publish Test Artifact
#       uses: actions/upload-artifact@v4
#       with:
#         path: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/
#         name: CodeCoverageMacOS
#       if: success() || failure()
  Test_Stage_Code_Coverage:
    name: Publish Code Coverage
    if: success() || failure()
    runs-on: ubuntu-latest
    needs:
    - Build_Stage_Package_Module
#    - Test_Stage_test_macos
    - Test_Stage_test_linux
    - Test_Stage_test_windows_core
    - Test_Stage_test_windows_ps
    steps:
    - name: Checkout Code
      uses: actions/checkout@v3
      with:
        ref: ${{ github.head_ref }}   # checkout the correct branch name
        fetch-depth: 0
#    - name: Download Test Artifact macOS
#      uses: actions/download-artifact@v4
#      with:
#        name: CodeCoverageMacOS
#        path: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/CodeCoverageMacOS/
    - name: Download Test Artifact Linux
      uses: actions/download-artifact@v4
      with:
        name: CodeCoverageLinux
        path: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/CodeCoverageLinux/
    - name: Download Test Artifact Windows (PS 5.1)
      uses: actions/download-artifact@v4
      with:
        name: CodeCoverageWinPS51
        path: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/CodeCoverageWinPS51/
    - name: Download Test Artifact Windows (PS7)
      uses: actions/download-artifact@v4
      with:
        name: CodeCoverageWinPS7
        path: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/CodeCoverageWinPS7/
#    - name: Publish MacOs Test Results
#      id: macos-test-results
#      uses: EnricoMi/publish-unit-test-result-action@v2
#      if: always()
#      with:
#        nunit_files: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/#CodeCoverageMacOS/NUnit*.xml
#        check_name: MacOs Test Results
    - name: Publish Linux Test Results
      id: linux-test-results
      uses: EnricoMi/publish-unit-test-result-action@v2
      if: always()
      with:
        nunit_files: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/CodeCoverageLinux/NUnit*.xml
        check_name: Linux Test Results
    - name: Publish WinPS51 Test Results
      id: winps51-test-results
      uses: EnricoMi/publish-unit-test-result-action@v2
      if: always()
      with:
        nunit_files: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/CodeCoverageWinPS51/NUnit*.xml
        check_name: WinPS51 Test Results
    - name: Publish WinPS71 Test Results
      id: winps71-test-results
      uses: EnricoMi/publish-unit-test-result-action@v2
      if: always()
      with:
        nunit_files: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/CodeCoverageWinPS7/NUnit*.xml
        check_name: WinPS71 Test Results
#    - name: Set Macos badge color
#      shell: bash
#      run: |
#        case ${{ fromJSON( steps.macos-test-results.outputs.json ).conclusion }} in
#          success)
#            echo "MACOSBADGE_COLOR=31c653" >> $GITHUB_ENV
#            ;;
#          failure)
#            echo "MACOSBADGE_COLOR=800000" >> $GITHUB_ENV
#            ;;
#          neutral)
#            echo "MACOSBADGE_COLOR=696969" >> $GITHUB_ENV
#            ;;
#        esac
#    - name: Create Macos badge
#      uses:  emibcn/badge-action@v1.2.1
#      with:
#        label: Tests
#        status: '${{ fromJSON( steps.macos-test-results.outputs.json ).formatted.stats.#tests }} tests, ${{ fromJSON( steps.macos-test-results.outputs.json ).formatted.#stats.runs }} runs: ${{ fromJSON( steps.macos-test-results.outputs.json ).#conclusion }}'
#        color: ${{ env.MACOSBADGE_COLOR }}
#        path: macos-badge.svg
#    - name: Upload MacOs badge to Gist
#      # Upload only for main branch
#      if: >
#        github.event_name == 'workflow_run' && github.event.workflow_run.head_branch == #'main' ||
#        github.event_name != 'workflow_run' && github.ref == 'refs/heads/main'
#      uses: andymckay/append-gist-action@1fbfbbce708a39bd45846f0955ed5521f2099c6d
#      with:
#        token: ${{ secrets.GIST_TOKEN }}
#        gistURL: https://gist.githubusercontent.com/SQLDBAWithABeard/#7a5d2837e29654202f22392187c75fec
#        file: macos-badge.svg
    - name: Set Linux badge color
      shell: bash
      run: |
        case ${{ fromJSON( steps.linux-test-results.outputs.json ).conclusion }} in
          success)
            echo "LINUXBADGE_COLOR=31c653" >> $GITHUB_ENV
            ;;
          failure)
            echo "LINUXBADGE_COLOR=800000" >> $GITHUB_ENV
            ;;
          neutral)
            echo "LINUXBADGE_COLOR=696969" >> $GITHUB_ENV
            ;;
        esac
    - name: Create Linux badge
      uses:  emibcn/badge-action@v1.2.1
      with:
        label: Tests
        status: '${{ fromJSON( steps.linux-test-results.outputs.json ).formatted.stats.tests }} tests, ${{ fromJSON( steps.linux-test-results.outputs.json ).formatted.stats.runs }} runs: ${{ fromJSON( steps.linux-test-results.outputs.json ).conclusion }}'
        color: ${{ env.LINUXBADGE_COLOR }}
        path: linux-badge.svg
    - name: Upload Linux badge to Gist
      # Upload only for main branch
      if: >
        github.event_name == 'workflow_run' && github.event.workflow_run.head_branch == 'main' ||
        github.event_name != 'workflow_run' && github.ref == 'refs/heads/main'
      uses: andymckay/append-gist-action@1fbfbbce708a39bd45846f0955ed5521f2099c6d
      with:
        token: ${{ secrets.GIST_TOKEN }}
        gistURL: https://gist.githubusercontent.com/SQLDBAWithABeard/7a5d2837e29654202f22392187c75fec
        file: linux-badge.svg
    - name: Set WinPS51 badge color
      shell: bash
      run: |
        case ${{ fromJSON( steps.winps51-test-results.outputs.json ).conclusion }} in
          success)
            echo "WINPS51BADGE_COLOR=31c653" >> $GITHUB_ENV
            ;;
          failure)
            echo "WINPS51BADGE_COLOR=800000" >> $GITHUB_ENV
            ;;
          neutral)
            echo "WINPS51BADGE_COLOR=696969" >> $GITHUB_ENV
            ;;
        esac
    - name: Create WINPS51 badge
      uses:  emibcn/badge-action@v1.2.1
      with:
        label: Tests
        status: '${{ fromJSON( steps.winps51-test-results.outputs.json ).formatted.stats.tests }} tests, ${{ fromJSON( steps.winps51-test-results.outputs.json ).formatted.stats.runs }} runs: ${{ fromJSON( steps.winps51-test-results.outputs.json ).conclusion }}'
        color: ${{ env.WINPS51BADGE_COLOR }}
        path: winps51-badge.svg
    - name: Upload WINPS51 badge to Gist
      # Upload only for main branch
      if: >
        github.event_name == 'workflow_run' && github.event.workflow_run.head_branch == 'main' ||
        github.event_name != 'workflow_run' && github.ref == 'refs/heads/main'
      uses: andymckay/append-gist-action@1fbfbbce708a39bd45846f0955ed5521f2099c6d
      with:
        token: ${{ secrets.GIST_TOKEN }}
        gistURL: https://gist.githubusercontent.com/SQLDBAWithABeard/7a5d2837e29654202f22392187c75fec
        file: winps51-badge.svg
    - name: Set WinPS7 badge color
      shell: bash
      run: |
        case ${{ fromJSON( steps.winps71-test-results.outputs.json ).conclusion }} in
          success)
            echo "WINPS7BADGE_COLOR=31c653" >> $GITHUB_ENV
            ;;
          failure)
            echo "WINPS7BADGE_COLOR=800000" >> $GITHUB_ENV
            ;;
          neutral)
            echo "WINPS7BADGE_COLOR=696969" >> $GITHUB_ENV
            ;;
        esac
    - name: Create WinPS7 badge
      uses:  emibcn/badge-action@v1.2.1
      with:
        label: Tests
        status: '${{ fromJSON( steps.winps71-test-results.outputs.json ).formatted.stats.tests }} tests, ${{ fromJSON( steps.winps71-test-results.outputs.json ).formatted.stats.runs }} runs: ${{ fromJSON( steps.winps71-test-results.outputs.json ).conclusion }}'
        color: ${{ env.WINPS7BADGE_COLOR }}
        path: winps7-badge.svg
    - name: Upload WINPS7 badge to Gist
      # Upload only for main branch
      if: >
        github.event_name == 'workflow_run' && github.event.workflow_run.head_branch == 'main' ||
        github.event_name != 'workflow_run' && github.ref == 'refs/heads/main'
      uses: andymckay/append-gist-action@1fbfbbce708a39bd45846f0955ed5521f2099c6d
      with:
        token: ${{ secrets.GIST_TOKEN }}
        gistURL: https://gist.githubusercontent.com/SQLDBAWithABeard/7a5d2837e29654202f22392187c75fec
        file: winps7-badge.svg
  Deploy_Stage_Deploy_Module:
    name: Deploy Module
    runs-on: ubuntu-latest
    needs:
     - Build_Stage_Package_Module
     - Test_Stage_test_linux
     - Test_Stage_test_windows_core
     - Test_Stage_test_windows_ps
#     - Test_Stage_test_macos
     - Test_Stage_Code_Coverage
    if: ${{ success() && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) }}
    steps:
    - name: Checkout Code
      uses: actions/checkout@v3
      with:
        ref: ${{ github.head_ref }}   # checkout the correct branch name
        fetch-depth: 0
    - name: Download Build Artifact
      uses: actions/download-artifact@v4
      with:
        name: ${{ env.buildArtifactName }}
        path: ${{ env.buildFolderName }}
    - name: Publish Release
      shell: pwsh
      # run: Import-Module ./output/RequiredModules/PowerShellForGitHub/0.16.1/PowerShellForGitHub.psd1 ; ./build.ps1 -tasks publish
      run: ./build.ps1 -tasks publish
      env:
        GitHubToken: ${{ secrets.GitHubToken }}
        GalleryApiToken: ${{ secrets.GalleryApiToken }}
    - name: Send Changelog PR
      shell: pwsh
      run: Get-Module -Name PowerShellForGitHub -ListAvailable ;./build.ps1  -tasks Create_ChangeLog_GitHub_PR
      env:
        GitHubToken: ${{ secrets.GitHubToken }}

    - name: Merge main -> containers
      uses: devmasx/merge-branch@1.4.0
      with:
        type: now
        from_branch: main
        target_branch: containers
        github_token: ${{ secrets.GITHUB_TOKEN }}



================================================
FILE: .github/workflows/docker-image.yml
================================================
name: Docker Image CI

on:
  push:
    branches: [ containers ]
    paths:
      - ".devcontainer/devcontainer.json"
      - ".devcontainer/docker-compose.yml"
      - ".devcontainer/codespaces/devcontainer.json"
      - ".devcontainer/codespaces/codespaces-docker-compose.yml"
      - containers/**

  workflow_dispatch:

jobs:
  docker:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: '0'
      -
        name: Bump version and push tag
        id: bump
        uses: anothrNick/github-tag-action@1.52.0
        env:
          DEFAULT_BUMP: minor
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          WITH_V: true
          RELEASE_BRANCHES: main, containers
      -
        name: Set up QEMU
        uses: docker/setup-qemu-action@v2
      -
        name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v2
      -
        name: Login to DockerHub
        uses: docker/login-action@v2
        with:
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}
      -
        name: Build and push First Container
        uses: docker/build-push-action@v3
        with:
          push: true
          context: containers/base/
          tags: dbachecks/sqlinstance1:${{ steps.bump.outputs.new_tag }},dbachecks/sqlinstance1:latest
      -
        name: Build and push second Container
        uses: docker/build-push-action@v3
        with:
          push: true
          context: containers/second/
          tags: dbachecks/sqlinstance2:${{ steps.bump.outputs.new_tag }},dbachecks/sqlinstance2:latest
      -
        name: Build and push third Container
        uses: docker/build-push-action@v3
        with:
          push: true
          context: containers/third/
          tags: dbachecks/sqlinstance3:${{ steps.bump.outputs.new_tag }},dbachecks/sqlinstance3:latest
      -
        name: Find and Replace
        uses: jacobtomlinson/gha-find-replace@v2
        with:
          find: "dbachecks/sqlinstance1:.*"
          replace: "dbachecks/sqlinstance1:${{ steps.bump.outputs.new_tag }}"
          include: "**docker-compose.yml"
      -
        name: Find and Replace Instance2
        uses: jacobtomlinson/gha-find-replace@v2
        with:
          find: "dbachecks/sqlinstance2:.*"
          replace: "dbachecks/sqlinstance2:${{ steps.bump.outputs.new_tag }}"
          include: "**docker-compose.yml"
      -
        name: Find and Replace Instance3
        uses: jacobtomlinson/gha-find-replace@v2
        with:
          find: "dbachecks/sqlinstance3:.*"
          replace: "dbachecks/sqlinstance3:${{ steps.bump.outputs.new_tag }}"
          include: "**docker-compose.yml"
      -
        name: Add & Commit
        uses: EndBug/add-and-commit@v9
        with:
          author_name: Beardy McBeardFace
          author_email: mrrobsewell@outlook.com
          message: 'The Beard says we have another container - This is an automated message'
      -
        name: create pull request
        run: gh pr create -B main -H containers --title 'Merge containers into main [skip ci]' --body 'Created by Github action'
        env:
            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

================================================
FILE: .gitignore
================================================
*.psproj
dbachecks.psprojs
config.json

output/

**.bak
*.local.*
!**/README.md
.kitchen/

*.nupkg
*.suo
*.user
*.coverage
.vs
.psproj
.sln
markdownissues.txt
node_modules
package-lock.json


================================================
FILE: .markdownlint.json
================================================
{
    "default": true,
    "MD029": {
        "style": "one"
    },
    "MD013": true,
    "MD024": false,
    "MD034": false,
    "no-hard-tabs": true
}


================================================
FILE: .vscode/launch.json
================================================
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "PowerShell: Launch Current File",
            "type": "PowerShell",
            "request": "launch",
            "script": "${file}",
            "cwd": "${file}"
        }
    ]
}

================================================
FILE: .vscode/settings.json
================================================
{
    "cSpell.words": [
        "auto",
        "autogrowth",
        "Boggiano",
        "checkdb",
        "count",
        "cpu",
        "datafile",
        "dbachecks",
        "dbcconfig",
        "djfcc",
        "dstrait",
        "errorlogentries",
        "errorvar",
        "failover",
        "filegroup",
        "fkck",
        "growth",
        "HADR",
        "Imenes",
        "kerberos",
        "logfile",
        "longrunningjob",
        "longrunningjobs",
        "niphod",
        "notcontactable",
        "notcontains",
        "Olas",
        "pingable",
        "prioritisation",
        "prioritised",
        "Psitem",
        "Remoting",
        "sadisabled",
        "Schenk",
        "skipall",
        "SOZDBA",
        "spns",
        "synchronised",
        "tboggiano",
        "Tempdb",
        "trusted",
        "type",
        "whoisactive",
        "whoisactivedatabase"
    ],
    "[markdown]": {
        "editor.trimAutoWhitespace": false,
        "files.trimTrailingWhitespace": false
    },
    "cSpell.enableFiletypes": [
        "powershell"
    ]
}

================================================
FILE: .vscode/tasks.json
================================================
{
    "version": "2.0.0",
    "_runner": "terminal",
    "windows": {
        "options": {
            "shell": {
                "executable": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
                "args": [
                    "-NoProfile",
                    "-ExecutionPolicy",
                    "Bypass",
                    "-Command"
                ]
            }
        }
    },
    "linux": {
        "options": {
            "shell": {
                "executable": "/usr/bin/pwsh",
                "args": [
                    "-NoProfile",
                    "-Command"
                ]
            }
        }
    },
    "osx": {
        "options": {
            "shell": {
                "executable": "/usr/local/bin/pwsh",
                "args": [
                    "-NoProfile",
                    "-Command"
                ]
            }
        }
    },
    "tasks": [
        {
            "label": "build",
            "type": "shell",
            "command": "&${cwd}/build.ps1",
            "args": [],
            "presentation": {
                "echo": true,
                "reveal": "always",
                "focus": true,
                "panel": "new",
                "clear": false
            },
            "runOptions": {
                "runOn": "default"
            },
            "problemMatcher": [
                {
                    "owner": "powershell",
                    "fileLocation": [
                        "absolute"
                    ],
                    "severity": "error",
                    "pattern": [
                        {
                            "regexp": "^\\s*(\\[-\\]\\s*.*?)(\\d+)ms\\s*$",
                            "message": 1
                        },
                        {
                            "regexp": "(.*)",
                            "code": 1
                        },
                        {
                            "regexp": ""
                        },
                        {
                            "regexp": "^.*,\\s*(.*):\\s*line\\s*(\\d+).*",
                            "file": 1,
                            "line": 2
                        }
                    ]
                }
            ]
        },
        {
            "label": "test",
            "type": "shell",
            "command": "&${cwd}/build.ps1",
            "args": ["-AutoRestore","-Tasks","test"],
            "presentation": {
                "echo": true,
                "reveal": "always",
                "focus": true,
                "panel": "dedicated",
                "showReuseMessage": true,
                "clear": false
            },
            "problemMatcher": [
                {
                    "owner": "powershell",
                    "fileLocation": [
                        "absolute"
                    ],
                    "severity": "error",
                    "pattern": [
                        {
                            "regexp": "^\\s*(\\[-\\]\\s*.*?)(\\d+)ms\\s*$",
                            "message": 1
                        },
                        {
                            "regexp": "(.*)",
                            "code": 1
                        },
                        {
                            "regexp": ""
                        },
                        {
                            "regexp": "^.*,\\s*(.*):\\s*line\\s*(\\d+).*",
                            "file": 1,
                            "line": 2
                        }
                    ]
                }
            ]
        }
    ]
}


================================================
FILE: CHANGELOG.md
================================================
# Changelog for workspace

The format is based on and uses the types of changes according to [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

- fixed typo in Invoke-PerfAndValidateCheck so we know which version we're looking at
- Updated HADR checks to use dbatools new outputs

## [3.0.2] - 2025-03-10

### Added
 
- added pester tests to check that changelog is edited.
- and a space for the demos

### Changed

- Fix to Invoke-DbcCheck so that tests that have not been converted to v5 produce warning messages.

## [3.0.1-preview0026] - 2023-08-28

### Added

- Pester v5 support for agent checks.


## [3.0.1-preview0025] - 2023-08-28

### Added

- PageVerify check converted to V5 functionality.

### Changed

- For changes in existing functionality.

### Deprecated

- For soon-to-be removed features.

### Removed

- For now removed features.

### Fixed

- For any bug fix.

### Security

- In case of vulnerabilities.



================================================
FILE: CODE_OF_CONDUCT.md
================================================
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/


================================================
FILE: CONTRIBUTING.md
================================================
# Contributing

## Welcome

Before we go any further, thanks for being here. Thanks for using dbachecks and especially thanks 
for being here and looking into how you can help!

## Important resources

- docs
- bugs
- communicate with the team
    - slack
    - github discussions?
- presentations\blogs?

## Running the Tests

If want to know how to run this module's tests you can look at the [Testing Guidelines](https://dsccommunity.org/guidelines/testing-guidelines/#running-tests)

## Environment details

We strongly believe that 'every repo should have a devcontainer' and therefore we've built one
for this project that includes 3 SQL Servers and everything you need to develop and build the 
dbachecks module.

It's magic!

### Prerequisites:

In order to use the devcontainer there are a few things you need to get started.

- [Docker](https://www.docker.com/get-started)
- [git](https://git-scm.com/downloads)
- [VSCode](https://code.visualstudio.com/download)
- [Remote Development Extension for VSCode](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack)

### Setup

Once the prerequisites are in place follow these steps to download the repo and start up the
devcontainer. The first time you build the devcontainer it will need to pull down the images
so that could take a hot second depending on your internet speeds.

1. Download the repo from GitHub
    ```PowerShell
    # change directory to where you'd like the repo to go
    cd C:\GitHub\

    # clone the repo from GitHub
    git clone https://github.com/dataplat/dbachecks

    # move into the folder
    cd .\dbachecks\

    # open VSCode
    code .
    ```

754662. Once code opens, there should be a toast in the bottom right that suggests you 'ReOpen in Container'.
1. The first time you do this it may take a little, and you'll need an internet connection, as it'll download the container images used in our demos

### Develop & Build

We are using the [Sampler](https://github.com/gaelcolas/Sampler) Powershell Module to structure our module.
This makes it easier to develop and test the module locally.

The workflow for using this and developing the code - for example to add a new Database level check you could follow
this guide.

1. Download the repo locally and create a new branch to develop on
    ```PowerShell
    git checkout -b newStuff # give it a proper name!
    ```

1. Develop in the source repository, to add a check you need to add the following code:
  - add check code to `source/checks/DatabaseV5.Tests.ps1`
  - add required configurations to `source/internal/configurations/configuration.ps1`
    - `skip.database.checkName`
    - `policy.database.checkNameExcludeDb`
  - add required properties to object info to `source/internal/functions/Get-AllDatabaseInfo.ps1`

1. Build the module
    ```PowerShell
    ./build.ps1 -Tasks build
    ```

1. Sampler automatically adds the new version to your path you can prove that with the following code:
    ```PowerShell
    get-module dbachecks -ListAvailable | Select-Object Name, ModuleBase
    ```

1. Import new version of the module
    ```PowerShell
    Import-Module dbachecks -force
    ```

1. Test out the new code
    ```PowerShell
    # save the password to make for easy connections
    $password = ConvertTo-SecureString "dbatools.IO" -AsPlainText -Force
    $cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "sqladmin", $password

    $show = 'All'
    $checks = 'RecoveryModel' # <-- change this to your new check name 

    $sqlinstances = 'localhost,7401', 'localhost,7402', 'localhost,7403'
    #$sqlinstances = 'dbachecks1', 'dbachecks2', 'dbachecks3' # need client aliases for this to work New-DbaClientAlias

    # Run v5 checks
    $v5code = Invoke-DbcCheck -SqlInstance $Sqlinstances -SqlCredential $cred -Check $Checks -legacy $false -Show $show -PassThru -Verbose
    ```

1. If you are working on the v4 --> v5 upgrade you can also confirm your v5 test results match v4 with the following
    ```PowerShell
    # save the password to make for easy connections
    $password = ConvertTo-SecureString "dbatools.IO" -AsPlainText -Force
    $cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "sqladmin", $password

    $show = 'All'
    $checks = 'RecoveryModel' # <-- change this to your new check name 

    $sqlinstances = 'localhost,7401', 'localhost,7402', 'localhost,7403'
    #$sqlinstances = 'dbachecks1', 'dbachecks2', 'dbachecks3' # need client aliases for this to work New-DbaClientAlias

    # Check results of the tests - are we testing the same things with the same results for v4 & v5
    Invoke-PerfAndValidateCheck -SQLInstances $sqlinstances -Checks $Checks
    # Include the specific details for the perf testing
    Invoke-PerfAndValidateCheck -SQLInstances $sqlinstances -Checks $Checks -PerfDetail
    # Include the test results - this helps troubleshooting if your tests aren't the same
    Invoke-PerfAndValidateCheck -SQLInstances $sqlinstances -Checks $Checks -showTestResults
    ```

1. Once you are happy with your code, push your branch to GitHub and create a PR against the dbachecks repo.

1. Thanks!

### Rebuild your devcontainer

The only way to properly rebuild to ensure that all volumes etc are removed is to open up a console
or PowerShell window outside of the devcontainer and run the following:

```PowerShell
    cd \path-of-dbachecks-folder\.devcontainer 

    docker-compose -f "docker-compose.yml" -p "bitsdbatools_devcontainer" down
```

## How to submit changes: 
TODO:
Pull Request protocol etc. You might also include what response they'll get back from the team on submission, or any caveats about the speed of response.

## How to report a bug: 
TODO:
Bugs are problems in code, in the functionality of an application or in its UI design; you can submit them through "bug trackers" and most projects invite you to do so, so that they may "debug" with more efficiency and the input of a contributor. Take a look at Atom's example for how to teach people to report bugs to your project.

## Templates:
TODO: 
in this section of your file, you might also want to link to a bug report "template" like this one here which contributors can copy and add context to; this will keep your bugs tidy and relevant.

## Style Guide
TODO:
include extensions and vscode settings we use to keep things neat

## Code of Conduct
TODO: maybe beef this out - stolen from data sat repo for now.

We expect and demand that you follow some basic rules. Nothing dramatic here. There will be a proper code of conduct for the websites added soon, but in this repository

BE EXCELLENT TO EACH OTHER

Do I need to say more? If your behaviour or communication does not fit into this statement, we do not wish for you to help us.


================================================
FILE: GitVersion.yml
================================================
mode: ContinuousDelivery
next-version: 3.0.0
major-version-bump-message: '(breaking\schange|breaking|major)\b'
minor-version-bump-message: '(adds?|features?|minor)\b'
patch-version-bump-message: '\s?(fix|patch)'
no-bump-message: '\+semver:\s?(none|skip)'
assembly-informational-format: '{NuGetVersionV2}+Sha.{Sha}.Date.{CommitDate}'
branches:
  master:
    tag: preview
    regex: ^main$
  pull-request:
    tag: PR
  feature:
    tag: useBranchName
    increment: Minor
    regex: f(eature(s)?)?[\/-]
    source-branches: ['master']
  hotfix:
    tag: fix
    increment: Patch
    regex: (hot)?fix(es)?[\/-]
    source-branches: ['master']

ignore:
  sha: []
merge-message-formats: {}


# feature:
#   tag: useBranchName
#   increment: Minor
#   regex: f(eature(s)?)?[/-]
#   source-branches: ['master']
# hotfix:
#   tag: fix
#   increment: Patch
#   regex: (hot)?fix(es)?[/-]
#   source-branches: ['master']



================================================
FILE: LICENSE
================================================
MIT License

Copyright (c) 2017 Chrissy LeMaire

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


================================================
FILE: PSScriptAnalyzerSettings.psd1
================================================
# PSScriptAnalyzerSettings.psd1
# Settings for PSScriptAnalyzer invocation.
@{
    Rules = @{
        PSUseCompatibleCommands = @{
            # Turns the rule on
            Enable = $true

            # Lists the PowerShell platforms we want to check compatibility with
            TargetProfiles = @(
                'win-8_x64_10.0.17763.0_7.0.0_x64_3.1.2_core.json',
                'ubuntu_x64_18.04_7.0.0_x64_3.1.2_core.json',
                'win-8_x64_10.0.17763.0_5.1.17763.316_x64_4.0.30319.42000_framework'
             #   'win-8_x64_6.2.9200.0_3.0_x64_4.0.30319.42000_framework'
            )
            # You can specify commands to not check like this, which also will ignore its parameters:
            IgnoreCommands = @(
                'It', # Because Pester!
                'Should', # Because Pester!
                'Context', # Because Pester!
                'BeforeAll', # Because Pester!
                'AfterAll', # Because Pester!
                'Describe' # Because Pester!
                'Invoke-Pester' #Because Pester!
                'InModuleScope' #Because Pester!
                'Mock' #Because Pester!
                'Assert-MockCalled' #Because Pester!
                'Get-LocalGroupMember' # Because we handle it
            )
        }
        PSUseCompatibleSyntax = @{
            # This turns the rule on (setting it to false will turn it off)
            Enable = $true

            # Simply list the targeted versions of PowerShell here
            TargetVersions = @(
                '5.1'
                '6.1',
                '6.2',
                '7.0'
            )
        }
    }
        # Do not analyze the following rules. Use ExcludeRules when you have
    # commented out the IncludeRules settings above and want to include all
    # the default rules except for those you exclude below.
    # Note: if a rule is in both c and ExcludeRules, the rule
    # will be excluded.
     ExcludeRules = @('PSAvoidAssignmentToAutomaticVariable')
}

================================================
FILE: RELEASE.md
================================================
## 23rd August 2021

Fixed bug where custom tests left an empty DbcResult #846
Added feature to overwrite config file if it already exists for Export-DbcConfig #844
Enabled ping latency testing in PowerShell Core

##Latest
## 23rd August 2021

Removed the Verbose for the Pester load - Apologies, this was Rob!
Thank you [@MikeyBronowski](https://www.github.com/MikeyBronowski) Get the file at the end so Export-DbcConfig can be used with Invoke-Item addresses #843 #845
Thank you [@MikeyBronowski](https://www.github.com/MikeyBronowski) spelling and full stops #842
Thank you [ashdar](https://github.com/ashdar) Check for existence in the Tag list before adding a Tag to the Tag list #853
Thank you [ashdar](https://github.com/ashdar) Updated PowerPlan Assertion #850
Thank you [tboggiano](https://github.com/tboggiano) CIS check for SQL Mail XPS for SQL Server 2008 and below (was) #779
Thank you [tboggiano](https://github.com/tboggiano) Added function to set CIS config (was) #776
Thank you [tboggiano](https://github.com/tboggiano) CIS check for TCP IP Protocols (was) #775

## April 7th 2021

Thank you [@mikedavem](https://www.github.com/mikedavem) Fixed rogue verbose when importing [#834](https://github.com/sqlcollaborative/dbachecks/issues/834)

Thank you [@mikedavem](https://www.github.com/mikedavem) Test NetBios Over TCP/IP should be disabled for cluster network interface [#833](https://github.com/sqlcollaborative/dbachecks/issues/833)

Thank you [@conseilit](https://www.github.com/conseilit) Add LogfilePercentUsed check. Log might fill even if simple recovery model or full recovery model + Tlog backup in case of replication, CDC, HADR issues. [#831](https://github.com/sqlcollaborative/dbachecks/issues/831) [#832](https://github.com/sqlcollaborative/dbachecks/issues/832)

Thank you [@conseilit](https://www.github.com/conseilit) Getting SQL Server instance DateTime prevent Log Backup checks to fail if the instance is not in the same timezone than the computer running dbaChecks scripts. [#830](https://github.com/sqlcollaborative/dbachecks/issues/830)

Thank you [@MikeyBronowski](https://www.github.com/MikeyBronowski) Get-DbcConfig Adding support to multiple names [#829](https://github.com/sqlcollaborative/dbachecks/issues/829)

Thank you [@MikeyBronowski](https://www.github.com/MikeyBronowski) Spellings [#827](https://github.com/sqlcollaborative/dbachecks/issues/827)

Thank you [@TheAntGreen](https://www.github.com/TheAntGreen) updated variables to make errors obvious [#825](https://github.com/sqlcollaborative/dbachecks/issues/825)

Thank you [@MrBlueSky](https://www.github.com/MrBlueSky) - add info to suggest using Duplicate index command [#807](https://github.com/sqlcollaborative/dbachecks/issues/807)

Thank you [@PsPsam](https://www.github.com/PsPsam) - Ping check to work on core and 5.1 [#763](https://github.com/sqlcollaborative/dbachecks/issues/763)

Thank you [@zikato](https://www.github.com/zikato) - certificate expiration gives two failures if in the past [#785](https://github.com/sqlcollaborative/dbachecks/issues/785)

Thank you [@mikedavem](https://www.github.com/mikedavem) - allow more than 99 days for retention for Olas jobs [#835](https://github.com/sqlcollaborative/dbachecks/issues/835)

Thank you [@Shashtsoh](https://www.github.com/Shashtsoh) - Remove aliases to work in core [#837](https://github.com/sqlcollaborative/dbachecks/issues/837)

Thank you [@a4ic6n](https://www.github.com/a4ic6n) - Max Memory check false succeeds [#836](https://github.com/sqlcollaborative/dbachecks/issues/836)


## December 14th 2020

Thank you tboggiano Browser check altered for instance count #758
Thank you zikato - Fixing datafile auto growth #786
Thank you fatherjack Typos #767
Thank you tboggiano Query Store enabled and disabled test improvements #791
Thank you relsna fixed issue with error log window #814
Thank you @TheAntGreen Typos #815
Thank you @TheAntGreen Add additional filter to filter out negative run_durations #816
Thank you @TheAntGreen Add policy for additional excluded dbs from the SAFE CLR check #817
Thank you @MikeyBronowski Fix the check for enabled alerts #819
Thank you @MikeyBronowski Updating the link in documentation #820
Thank you @mikedavem Updated HADR checks with additional checks #822
Thank you @mikedavem Database backup diff check - fix issue #812 #824

## Date November 23rd 2020

Finally Rob gets around to working on PRs - Really sorry it has taken so long

Fixes for bug 780 & 783 #784 - Thank you @TheAntGreen
Fix local windows groups, additional filter needed on the object filter #789 - Thank you @TheAntGreen
$null check for anything running SQL2008R2 or below as containment doesnt exist in those versions. #790 - Thank you @TheAntGreen

Fix for IsClustered checks for service startup types #792  - Thank you @TheAntGreen

CertCheck took ages to run, was still checking excluded DB's then filtering, change to not query the excluded DBs #793  - Thank you @TheAntGreen

Fixed few typos in docs #799 - Thank you @jpomfret

Fixed few typos in docs #799 - Thank you @TheAntGreen

DuplicateIndex Check - Added new configuration option to allow people to filter out databases, as SSRS DB's have duplicate indexes and names are configuration in older versions, defaults to ReportServer & ReportServerTempDB

GuestUserConnect - Changes method to Get-Database instead of InstanceSMO so its easier to filter out none accessable databases as the check would report false positives for offline or restoring databases

NotExpectedTraceFlag - added a filter to filter out any trace flags which WHERE expected to prevent false positive alerts #801 - Thank you @TheAntGreen

Add policy to exclude databases on the trustworthy check #806  - Thank you @TheAntGreen

Unused Index Check wasn't executing correctly #808   - Thank you @TheAntGreen

#803 Addition of the date filter for File Autogrowth detection #809   - Thank you @TheAntGreen

New Check - Agent Mail Profile #811   - Thank you @TheAntGreen

Scan for startup procs, use config option to override the value in use #813  - Thank you @TheAntGreen

##Latest

## Date September 22nd 2020

Only Importing Pester v4 and lower to reduce Pester v5 errors

## Date July 13th 2020

Thank you jpomfret Added skip.backup.readonly config  #777
Thank you jpomfret typos  #771
Thank you jpomfret Added MSDB suspect pages table check  #768
Thank you markaugust Added instance name to Agent Service ACcount checks #766
Thank you tboggiano fixed Agent Run time calculation #746

## Date 9th May 2020

UPDATED TO VERSION 2

New Commands

    Convert-DbcResult - To parse results and add Label, ComputerName, Instance and Database
    Set-DbcFile - To save the parsed results to a file json, csv or xml
    Write-DbcTable - to add results to a database

New Parameter
    -FromDatabase on Star-DbcPowerBi - to open new Power Bi template file

New PowerBi template file for reporting on results from the database

Improved Spelling

Updated Unit Tests for Checks to enabled results to be parsed

Improved Check Titles

Configuration for Max history days for Job duration

Stop trying to check inaccessible databases for checks

Improved Query Store checks

Ensure long running agent jobs ignores durations longer than 24 hours

Ignore jobs that never stop from the duration check

##Latest

## Date 29th March 2020

UPDATED MINIMUM POWERSHELL VERSION

Updated Required versions of Pester, dbatools and PSFramework modules

Thank you @dstrait
    Fix variable for SaDisabled check #750
    Fix errant braces in SQL Browser Service Check #751
    Fix PingComputer Check #752

Thank you markaugust
    Fix to ensure AG Name is in HADR checks #755

Thank you Tracey Boggiano
    Added Contained Database auth check and Query Store Enabled Checks #756

Thank you Rob
    Added exclude database config for Query store checks
    Version check for Query Store Checks
    Some spellings!

##Latest

## Date 18th March 2020
Thank you Tracey tboggiano
    New CIS user-defined CLRs to be set to SAFE_ACCESS #734
    CIS tests for if service accounts are local admins #736

Thank you Rob
    Getting service accounts tests to pass if no service
    Made long running jobs check work as expected
    Improved Database Mail check
    Made sure disk allocations dont run on Core

Thank you mikedavem
    Fixed bug in disk allocation check exclusions
    Added multiple ags to the HADR check #742

## Date 14th March 2020
Thank you Tracey tboggiano
    New CIS Check Hide Instance #728
    New CIS Check Symmetric Key #732
    New CIS Check Agent Proxy not have access to public Role #732

## Date 8th January 2020
Thank you Tracey tboggiano
    New CIS Check Guest Account connect permissions #725
    New CIS Check BuiltIn Admins login #726
    New CIS Check public role permissions #729
    New CIS Check local windows groups do not have logins #731
    Update sa login check #730

Thank you Rob
    Added Tag parameter to Get-DbcCheck
    Updated tests to work with PowerShell 7

## Date 22nd December
Thank you Tracey tboggiano
    Two New CIS Checks Contained databases should be auto-closed #721
    sa login disabled and should not exist #719

Thank you Rob
    Fix bug in Agent Tests #723

## Date 28th November
Thank you Tracey tboggiano
    Added new CIS Check for the latest SQL build #716

Thank you Rob
    Making the SQL Engine Service Check configurable #706

## Date 26th November
Thank you Tracey @tboggiano
    Added new CIS Check for OLE AUtomation Procedures to be disabled #707
    Moving the Cross DB Ownership Chaining check into the AllInstance check to help speed up checks #708
Thank you Rob
    Fixing the Tags so that they are picked up by AllInstanceInfo Fixes #715

## Date 16th November
Thank you Matt @matt2005
    Removed rogue else from Agents Tests #713

## Date 17th October
Thank you Shane @SOZDBA
    Improved Documentation
Thank you Gareth NewMan
    Added New Check - Default File Path

## Date 1st October 2019
Thank you Rob
Fixed some merge issues with a load of code :-(
Created GitHub Action to run Pester Checks on PR
Thank you @TracyBoggiano
Added New Checks
    RemoteAccessDisabled
    ScanForStartUpProcedures
Thank you Gareth Newman
    Improved wording in tests #700 , #697
    Fix incorrect calculation in last agent run time #696 #698
Fixed bug in AllInstanceInfo
Thank you Richard Imenes
    Fixed dead links in readme #702
Thank you Benjamin Schenk
    Fixed Send-MailMessage in readme #705

## Date 30th July 2019
Thank you Rob ;-)
Added two new checks #239
    LastJobRunTime and LongRunningJob
Added four new configs
    skip.agent.longrunningjobs
    skip.agent.lastjobruntime
    agent.longrunningjob.percentage
    agent.lastjobruntime.percentage

## Date 29th July 2019
Thank you @TracyBoggiano
Added tags for checks that will be part of CIS checks #642
CIS project started
Added check for default trace enabled #684

## Date 23rd July 2019
Thank you @dstrait, @Sozdba
Fix tests that use time to work if client and instance are in different time zones #610
Fixed Maintenance Solution clean up time test #633
Improved Run time #635
Improved Error Log warning window honouring #637
Ignore SQL 2005 for some tests #630,629,#628
Skip TF1118 test if SQL2016 or above

## Date 8th July 2019
Thanks to Chuck for notifying of error
Fixed Update-DbcPowerBiDataSource


## Date 2nd July 2019
dbachecks works with PowerShell Core #620
dbachecks works with dbatools v1 #624
Minimum PowerShell Now 5.0 #568
Prettier output in test names for @cl because she is ace #495
Fixes for none-readable secondaries causing tests to fail #611
Added ability to exclude disks from disk allocation check #561
Added ability to exclude cancelled jobs from failed job check #552
Added max job history for failed jobs #552
Some extra tags added

## Date 22nd May 2019 at Techorama in Room 12
Thank You @SOZDBA, @djfcc, @wsmelton
Improved validation for IP addresses in clusters
Ignored Off-line databases for Pseudo Recovery Checks
Some internal testing changes


## Date 05/02/2019
Thank you Chrissy! @cl
added default environment #596
altered configuration validation for mail to stop errors
Ensured database status check doesnt fail as readonly for snapshots

## Date 31/01/2019
Thank you Chrissy!
add support for inline config file, fixes #501 #594

## Date 29/01/2019
Added skip for authentication scheme #587
Added WhatIf to Update-DbcPowerBiDataSource Thank you @shaneis #590
$null to the left Thank you @jwmoss #588

## Date 19/01/2019
Thank you Claudio
Added extra check for Job History Settings #582
Added extra check for Error Log Count #583
Added integration test code and docker compose file

##Latest

## Date 22/11/2018
Spelling - Thanks RonaldHensbergen
Fix for #576 When calling just Invoke-DbcCheck without a Check it fails to run the Server Tests correctly


## Date 12/11/2018
Added more information to the output - thanks @ClaudioESSilva
Spelling - Thanks ChrisTuckerNM
Fix for #564 - Error Importing DbcConfig in PowerShell 4 - Thanks @niphod

## Date 29/10/2018
Fixed #435 Page verify on SQL 2000 and SQL2005
Reduced number of calls to the instance for database checks improving performance

## Date 27/10/2018
Fixed #435 Page verify on SQL 2000 and SQL2005
Reduced number of calls to the instance for database checks improving performance

## Date 17/10/2018
Spelling and Because added - Thank you @LowlyDBA
New Check for XPCmdShell enabled added

## Date 11/10/2018
Added Check for CLR Enabled
Added Check for Cross Database Ownership Chaining
Added Check for Database Mail XPs
Added Check for Ad Hoc Distributed Queries
Added Tag for security
Demo CI/CD at Polar Conf

## Date 24/09/2018
Moved the Instance Connection Check to the Instance Tests
Fixed bug with Set-DbcConfig not adding none-arrays!
New Check for Expected Trace Flags
New Check for Not Expected TraceFlags
Stopped dbatools chatty messages polluting the test results

## Date 07/09/2018
Updated dbatools required module to 0.9.410
Renamed all dbatools commands to new naming convention
Fixed Bug with JSON file naming
Improved Server Checks to remove Red and improve speed for none contactable servers
Altered all server checks to use assertions and added pester Tests
Removed left over ogv entry

## Date 05/09/2018
New Check for 2 digit cut off thanks @CláudioESSilva
https://claudioessilva.eu/2018/09/04/dont-cutoff-yourself-when-dealing-with-dates-in-t-sql-did-you-know/
Fixed bug with adding NoneContactable Instances to variable
Improved error handling for HADR checks

## Date 28/08/2018
Added MaxBehind to SupportedBuild Tests - Thank you @LowlyDBA
Ensured the Database parameter checks only the specified Databases - Thank you @jpomfret
Updated Set-DbcConfig to allow Append to append arrays to arrays closes #535
Altered json filename creation to avoid max characters error
Altered PowerBi to display information correctly with filename changes

## Date 24/08/2017
Fixed Error with using Credential and stopped changing path when running checks from custom repos - Thank you @sammyxx

## Date 23/08/2017
Update to the help message for clusters by @LowlyDBA
Potential Breaking Change - Removed Tags from names of json files so that PowerBi will correctly show Environment names

## Date 15/08/2018
Fixed issue 521 ExcludeDatabase parameter doesn't work - THANK YOU @jpomfret
THANK YOU @jpomfret - Issue 509 -Database should only check databases listed and exclude all others
Further update to Update-DbcPowerBiDataSource to allow Environment as well as specify filename
Improved performance of the Server checks
Improved performance of the Instance checks
Improved performance of the Database checks
Improved performance of the ErrorLog checks
Removed Send-DbcSendMailMessage until it can be re-coded

## Date 13/08/2018
Fixed #504 by enabling FileName parameter on Update-PowerBiDataSource
Added in new function to begin to reduce the number of calls to each instance
Reduced required Pester version to 4.3.1
Further PowerShell V4 improvements

## Date 06/08/2018
Added New Check for tempdb data file sizes to be the same - Thank you @garethnewman #512
Altered Services Check so that clustered instances start mode is checked correctly thank you @kylejdoyle #516
Skip PowerPlan test if no connection thanks @cl #490
Fixed bug with XESession and PSv4 thank you @kylejdoyle #517
Error silently on failing Service check (thanks Rob ;-) )
Fixed dbatools command names
Fixed PSv4 support for importing the module also

## Date 31/07/2018

Added check for Database Exists - Thanks @sqldbawithbeard
Added excluded databases config to each Database Check and wrote Pester Test for that #506
Added msdb to exclusion fro duplicate index #506
Fixed offline install bug #484

## Date 30/07/2018

Updated Required Module versions - Thank you @cl
Updated Agent Checks to fail a test on no connection rather than throw all the PowerShell errors - Thanks @sqldbawithbeard
Updated HADR Checks for PS4 compatibility Issue #513

## Date 28/06/2018

Don't check versions before 2008 for AdHocWorkloads Thank you John McCall @LowlyDBA
More Spelling! Thank you John McCall @LowlyDBA
Updated required version and dbatools error log command name Thank you Our Glorious Chrissy @cl

## Date 30/05/2018
New Release Notes command added
Spelling

## Date 29/05/2012



================================================
FILE: RequiredModules.psd1
================================================
@{
    PSDependOptions       = @{
        AddToPath  = $true
        Target     = 'output\RequiredModules'
        Parameters = @{
            Repository = 'PSGallery'
        }
    }

    'dbatools.library'    = 'latest'
    InvokeBuild           = 'latest'
    PSScriptAnalyzer      = 'latest'
    Pester                = 'latest'
    Plaster               = 'latest'
    ModuleBuilder         = 'latest'
    ChangelogManagement   = 'latest'
    Sampler               = 'latest'
    'Sampler.GitHubTasks' = 'latest'
    MarkdownLinkCheck     = 'latest'
    dbatools              = 'latest'
    PSFramework           = 'latest'
}



================================================
FILE: Resolve-Dependency.ps1
================================================
<#
    .DESCRIPTION
        Bootstrap script for PSDepend.

    .PARAMETER DependencyFile
        Specifies the configuration file for the this script. The default value is
        'RequiredModules.psd1' relative to this script's path.

    .PARAMETER PSDependTarget
        Path for PSDepend to be bootstrapped and save other dependencies.
        Can also be CurrentUser or AllUsers if you wish to install the modules in
        such scope. The default value is 'output/RequiredModules' relative to
        this script's path.

    .PARAMETER Proxy
        Specifies the URI to use for Proxy when attempting to bootstrap
        PackageProvider and PowerShellGet.

    .PARAMETER ProxyCredential
        Specifies the credential to contact the Proxy when provided.

    .PARAMETER Scope
        Specifies the scope to bootstrap the PackageProvider and PSGet if not available.
        THe default value is 'CurrentUser'.

    .PARAMETER Gallery
        Specifies the gallery to use when bootstrapping PackageProvider, PSGet and
        when calling PSDepend (can be overridden in Dependency files). The default
        value is 'PSGallery'.

    .PARAMETER GalleryCredential
        Specifies the credentials to use with the Gallery specified above.

    .PARAMETER AllowOldPowerShellGetModule
        Allow you to use a locally installed version of PowerShellGet older than
        1.6.0 (not recommended). Default it will install the latest PowerShellGet
        if an older version than 2.0 is detected.

    .PARAMETER MinimumPSDependVersion
        Allow you to specify a minimum version fo PSDepend, if you're after specific
        features.

    .PARAMETER AllowPrerelease
        Not yet written.

    .PARAMETER WithYAML
        Not yet written.

    .NOTES
        Load defaults for parameters values from Resolve-Dependency.psd1 if not
        provided as parameter.
#>
[CmdletBinding()]
param
(
    [Parameter()]
    [System.String]
    $DependencyFile = 'RequiredModules.psd1',

    [Parameter()]
    [System.String]
    $PSDependTarget = (Join-Path -Path $PSScriptRoot -ChildPath 'output/RequiredModules'),

    [Parameter()]
    [System.Uri]
    $Proxy,

    [Parameter()]
    [System.Management.Automation.PSCredential]
    $ProxyCredential,

    [Parameter()]
    [ValidateSet('CurrentUser', 'AllUsers')]
    [System.String]
    $Scope = 'CurrentUser',

    [Parameter()]
    [System.String]
    $Gallery = 'PSGallery',

    [Parameter()]
    [System.Management.Automation.PSCredential]
    $GalleryCredential,

    [Parameter()]
    [System.Management.Automation.SwitchParameter]
    $AllowOldPowerShellGetModule,

    [Parameter()]
    [System.String]
    $MinimumPSDependVersion,

    [Parameter()]
    [System.Management.Automation.SwitchParameter]
    $AllowPrerelease,

    [Parameter()]
    [System.Management.Automation.SwitchParameter]
    $WithYAML,

    [Parameter()]
    [System.Collections.Hashtable]
    $RegisterGallery
)

try
{
    if ($PSVersionTable.PSVersion.Major -le 5)
    {
        if (-not (Get-Command -Name 'Import-PowerShellDataFile' -ErrorAction 'SilentlyContinue'))
        {
            Import-Module -Name Microsoft.PowerShell.Utility -RequiredVersion '3.1.0.0'
        }

        <#
            Making sure the imported PackageManagement module is not from PS7 module
            path. The VSCode PS extension is changing the $env:PSModulePath and
            prioritize the PS7 path. This is an issue with PowerShellGet because
            it loads an old version if available (or fail to load latest).
        #>
        Get-Module -ListAvailable PackageManagement |
            Where-Object -Property 'ModuleBase' -NotMatch 'powershell.7' |
            Select-Object -First 1 |
            Import-Module -Force
    }

    Write-Verbose -Message 'Importing Bootstrap default parameters from ''$PSScriptRoot/Resolve-Dependency.psd1''.'

    $resolveDependencyConfigPath = Join-Path -Path $PSScriptRoot -ChildPath '.\Resolve-Dependency.psd1' -Resolve -ErrorAction 'Stop'

    $resolveDependencyDefaults = Import-PowerShellDataFile -Path $resolveDependencyConfigPath

    $parameterToDefault = $MyInvocation.MyCommand.ParameterSets.Where{ $_.Name -eq $PSCmdlet.ParameterSetName }.Parameters.Keys

    if ($parameterToDefault.Count -eq 0)
    {
        $parameterToDefault = $MyInvocation.MyCommand.Parameters.Keys
    }

    # Set the parameters available in the Parameter Set, or it's not possible to choose yet, so all parameters are an option.
    foreach ($parameterName in $parameterToDefault)
    {
        if (-not $PSBoundParameters.Keys.Contains($parameterName) -and $resolveDependencyDefaults.ContainsKey($parameterName))
        {
            Write-Verbose -Message "Setting parameter '$parameterName' to value '$($resolveDependencyDefaults[$parameterName])'."

            try
            {
                $variableValue = $resolveDependencyDefaults[$parameterName]

                if ($variableValue -is [System.String])
                {
                    $variableValue = $ExecutionContext.InvokeCommand.ExpandString($variableValue)
                }

                $PSBoundParameters.Add($parameterName, $variableValue)

                Set-Variable -Name $parameterName -value $variableValue -Force -ErrorAction 'SilentlyContinue'
            }
            catch
            {
                Write-Verbose -Message "Error adding default for $parameterName : $($_.Exception.Message)."
            }
        }
    }
}
catch
{
    Write-Warning -Message "Error attempting to import Bootstrap's default parameters from '$resolveDependencyConfigPath': $($_.Exception.Message)."
}

Write-Progress -Activity 'Bootstrap:' -PercentComplete 0 -CurrentOperation 'NuGet Bootstrap'

# TODO: This should handle the parameter $AllowOldPowerShellGetModule.
$powerShellGetModule = Import-Module -Name 'PowerShellGet' -MinimumVersion '2.0' -ErrorAction 'SilentlyContinue' -PassThru

# Install the package provider if it is not available.
$nuGetProvider = Get-PackageProvider -Name 'NuGet' -ListAvailable | Select-Object -First 1

if (-not $powerShellGetModule -and -not $nuGetProvider)
{
    $providerBootstrapParameters = @{
        Name           = 'nuget'
        Force          = $true
        ForceBootstrap = $true
        ErrorAction    = 'Stop'
    }

    switch ($PSBoundParameters.Keys)
    {
        'Proxy'
        {
            $providerBootstrapParameters.Add('Proxy', $Proxy)
        }

        'ProxyCredential'
        {
            $providerBootstrapParameters.Add('ProxyCredential', $ProxyCredential)
        }

        'Scope'
        {
            $providerBootstrapParameters.Add('Scope', $Scope)
        }

        'AllowPrerelease'
        {
            $providerBootstrapParameters.Add('AllowPrerelease', $AllowPrerelease)
        }
    }

    if ($AllowPrerelease)
    {
        $providerBootstrapParameters.Add('AllowPrerelease', $true)
    }

    Write-Information -MessageData 'Bootstrap: Installing NuGet Package Provider from the web (Make sure Microsoft addresses/ranges are allowed).'

    # TODO: This does not handle a private Gallery yet.
    $null = Install-PackageProvider @providerBootstrapParams

    $nuGetProvider = Get-PackageProvider -Name 'NuGet' -ListAvailable | Select-Object -First 1

    $nuGetProviderVersion = $nuGetProvider.Version.ToString()

    Write-Information -MessageData "Bootstrap: Importing NuGet Package Provider version $nuGetProviderVersion to current session."

    $Null = Import-PackageProvider -Name 'NuGet' -RequiredVersion $nuGetProviderVersion -Force
}

if ($RegisterGallery)
{
    if ($RegisterGallery.ContainsKey('Name') -and -not [System.String]::IsNullOrEmpty($RegisterGallery.Name))
    {
        $Gallery = $RegisterGallery.Name
    }
    else
    {
        $RegisterGallery.Name = $Gallery
    }

    Write-Progress -Activity 'Bootstrap:' -PercentComplete 7 -CurrentOperation "Verifying private package repository '$Gallery'" -Completed

    $previousRegisteredRepository = Get-PSRepository -Name $Gallery -ErrorAction 'SilentlyContinue'

    if ($previousRegisteredRepository.SourceLocation -ne $RegisterGallery.SourceLocation)
    {
        if ($previousRegisteredRepository)
        {
            Write-Progress -Activity 'Bootstrap:' -PercentComplete 9 -CurrentOperation "Re-registrering private package repository '$Gallery'" -Completed

            Unregister-PSRepository -Name $Gallery

            $unregisteredPreviousRepository = $true
        }
        else
        {
            Write-Progress -Activity 'Bootstrap:' -PercentComplete 9 -CurrentOperation "Registering private package repository '$Gallery'" -Completed
        }

        Register-PSRepository @RegisterGallery
    }
}

Write-Progress -Activity 'Bootstrap:' -PercentComplete 10 -CurrentOperation "Ensuring Gallery $Gallery is trusted"

# Fail if the given PSGallery is not registered.
$previousGalleryInstallationPolicy = (Get-PSRepository -Name $Gallery -ErrorAction 'Stop').InstallationPolicy

if ($previousGalleryInstallationPolicy -ne 'Trusted')
{
    # Only change policy if the repository is not trusted
    Set-PSRepository -Name $Gallery -InstallationPolicy 'Trusted' -ErrorAction 'Ignore'
}

try
{
    Write-Progress -Activity 'Bootstrap:' -PercentComplete 25 -CurrentOperation 'Checking PowerShellGet'

    # Ensure the module is loaded and retrieve the version you have.
    $powerShellGetVersion = (Import-Module -Name 'PowerShellGet' -PassThru -ErrorAction 'SilentlyContinue').Version

    Write-Verbose -Message "Bootstrap: The PowerShellGet version is $powerShellGetVersion"

    # Versions below 2.0 are considered old, unreliable & not recommended
    if (-not $powerShellGetVersion -or ($powerShellGetVersion -lt [System.Version] '2.0' -and -not $AllowOldPowerShellGetModule))
    {
        Write-Progress -Activity 'Bootstrap:' -PercentComplete 40 -CurrentOperation 'Installing newer version of PowerShellGet'

        $installPowerShellGetParameters = @{
            Name               = 'PowerShellGet'
            Force              = $True
            SkipPublisherCheck = $true
            AllowClobber       = $true
            Scope              = $Scope
            Repository         = $Gallery
        }

        switch ($PSBoundParameters.Keys)
        {
            'Proxy'
            {
                $installPowerShellGetParameters.Add('Proxy', $Proxy)
            }

            'ProxyCredential'
            {
                $installPowerShellGetParameters.Add('ProxyCredential', $ProxyCredential)
            }

            'GalleryCredential'
            {
                $installPowerShellGetParameters.Add('Credential', $GalleryCredential)
            }
            'AllowPrerelease'
            {
                $installPowerShellGetParameters.Add('AllowPrerelease', $AllowPrerelease)
            }
        }

        Write-Progress -Activity 'Bootstrap:' -PercentComplete 60 -CurrentOperation 'Installing newer version of PowerShellGet'

        Install-Module @installPowerShellGetParameters

        Remove-Module -Name 'PowerShellGet' -Force -ErrorAction 'SilentlyContinue'
        Remove-Module -Name 'PackageManagement' -Force

        $powerShellGetModule = Import-Module PowerShellGet -Force -PassThru

        $powerShellGetVersion = $powerShellGetModule.Version.ToString()

        Write-Information -MessageData "Bootstrap: PowerShellGet version loaded is $powerShellGetVersion"
    }

    # Try to import the PSDepend module from the available modules.
    $getModuleParameters = @{
        Name          = 'PSDepend'
        ListAvailable = $true
    }

    $psDependModule = Get-Module @getModuleParameters

    if ($PSBoundParameters.ContainsKey('MinimumPSDependVersion'))
    {
        try
        {
            $psDependModule = $psDependModule | Where-Object -FilterScript { $_.Version -ge $MinimumPSDependVersion }
        }
        catch
        {
            throw ('There was a problem finding the minimum version of PSDepend. Error: {0}' -f $_)
        }
    }

    if (-not $psDependModule)
    {
        # PSDepend module not found, installing or saving it.
        if ($PSDependTarget -in 'CurrentUser', 'AllUsers')
        {
            Write-Debug -Message "PSDepend module not found. Attempting to install from Gallery '$Gallery'."

            Write-Warning -Message "Installing PSDepend in $PSDependTarget Scope."

            $installPSDependParameters = @{
                Name               = 'PSDepend'
                Repository         = $Gallery
                Force              = $true
                Scope              = $PSDependTarget
                SkipPublisherCheck = $true
                AllowClobber       = $true
            }

            if ($MinimumPSDependVersion)
            {
                $installPSDependParameters.Add('MinimumVersion', $MinimumPSDependVersion)
            }

            Write-Progress -Activity 'Bootstrap:' -PercentComplete 75 -CurrentOperation "Installing PSDepend from $Gallery"

            Install-Module @installPSDependParameters
        }
        else
        {
            Write-Debug -Message "PSDepend module not found. Attempting to Save from Gallery $Gallery to $PSDependTarget"

            $saveModuleParameters = @{
                Name       = 'PSDepend'
                Repository = $Gallery
                Path       = $PSDependTarget
                Force      = $true
            }

            if ($MinimumPSDependVersion)
            {
                $saveModuleParameters.add('MinimumVersion', $MinimumPSDependVersion)
            }

            Write-Progress -Activity 'Bootstrap:' -PercentComplete 75 -CurrentOperation "Saving & Importing PSDepend from $Gallery to $Scope"

            Save-Module @saveModuleParameters
        }
    }

    Write-Progress -Activity 'Bootstrap:' -PercentComplete 80 -CurrentOperation 'Loading PSDepend'

    $importModulePSDependParameters = @{
        Name        = 'PSDepend'
        ErrorAction = 'Stop'
        Force       = $true
    }

    if ($PSBoundParameters.ContainsKey('MinimumPSDependVersion'))
    {
        $importModulePSDependParameters.Add('MinimumVersion', $MinimumPSDependVersion)
    }

    # We should have successfully bootstrapped PSDepend. Fail if not available.
    $null = Import-Module @importModulePSDependParameters

    if ($WithYAML)
    {
        Write-Progress -Activity 'Bootstrap:' -PercentComplete 82 -CurrentOperation 'Verifying PowerShell module PowerShell-Yaml'

        if (-not (Get-Module -ListAvailable -Name 'PowerShell-Yaml'))
        {
            Write-Progress -Activity 'Bootstrap:' -PercentComplete 85 -CurrentOperation 'Installing PowerShell module PowerShell-Yaml'

            Write-Verbose -Message "PowerShell-Yaml module not found. Attempting to Save from Gallery '$Gallery' to '$PSDependTarget'."

            $SaveModuleParam = @{
                Name       = 'PowerShell-Yaml'
                Repository = $Gallery
                Path       = $PSDependTarget
                Force      = $true
            }

            Save-Module @SaveModuleParam
        }
        else
        {
            Write-Verbose "PowerShell-Yaml is already available"
        }
    }

    Write-Progress -Activity 'Bootstrap:' -PercentComplete 90 -CurrentOperation 'Invoke PSDepend'

    Write-Progress -Activity "PSDepend:" -PercentComplete 0 -CurrentOperation "Restoring Build Dependencies"

    if (Test-Path -Path $DependencyFile)
    {
        $psDependParameters = @{
            Force = $true
            Path  = $DependencyFile
        }

        # TODO: Handle when the Dependency file is in YAML, and -WithYAML is specified.
        Invoke-PSDepend @psDependParameters
    }

    Write-Progress -Activity "PSDepend:" -PercentComplete 100 -CurrentOperation "Dependencies restored" -Completed

    Write-Progress -Activity 'Bootstrap:' -PercentComplete 100 -CurrentOperation "Bootstrap complete" -Completed
}
finally
{
    if ($RegisterGallery)
    {
        Write-Verbose -Message "Removing private package repository '$Gallery'."
        Unregister-PSRepository -Name $Gallery
    }

    if ($unregisteredPreviousRepository)
    {
        Write-Verbose -Message "Reverting private package repository '$Gallery' to previous location URI:s."

        $registerPSRepositoryParameters = @{
            Name = $previousRegisteredRepository.Name
            InstallationPolicy = $previousRegisteredRepository.InstallationPolicy
        }

        if ($previousRegisteredRepository.SourceLocation)
        {
            $registerPSRepositoryParameters.SourceLocation = $previousRegisteredRepository.SourceLocation
        }

        if ($previousRegisteredRepository.PublishLocation)
        {
            $registerPSRepositoryParameters.PublishLocation = $previousRegisteredRepository.PublishLocation
        }

        if ($previousRegisteredRepository.ScriptSourceLocation)
        {
            $registerPSRepositoryParameters.ScriptSourceLocation = $previousRegisteredRepository.ScriptSourceLocation
        }

        if ($previousRegisteredRepository.ScriptPublishLocation)
        {
            $registerPSRepositoryParameters.ScriptPublishLocation = $previousRegisteredRepository.ScriptPublishLocation
        }

        Register-PSRepository @registerPSRepositoryParameters
    }

    # Only try to revert installation policy if the repository exist
    if ((Get-PSRepository -Name $Gallery -ErrorAction 'SilentlyContinue'))
    {
        if ($previousGalleryInstallationPolicy -and $previousGalleryInstallationPolicy -ne 'Trusted')
        {
            # Reverting the Installation Policy for the given gallery if it was not already trusted
            Set-PSRepository -Name $Gallery -InstallationPolicy $previousGalleryInstallationPolicy
        }
    }

    Write-Verbose -Message "Project Bootstrapped, returning to Invoke-Build"
}


================================================
FILE: Resolve-Dependency.psd1
================================================
@{
    #PSDependTarget  = './output/modules'
    #Proxy = ''
    #ProxyCredential = '$MyCredentialVariable' #TODO: find a way to support credentials in build (resolve variable)

    Gallery         = 'PSGallery'

    # To use a private nuget repository change the following to your own feed. The locations must be a Nuget v2 feed due
    # to limitation in PowerShellGet v2.x. Example below is for a Azure DevOps Server project-scoped feed. While resolving
    # dependencies it will be registered as a trusted repository with the name specified in the property 'Gallery' above,
    # unless property 'Name' is provided in the hashtable below, if so it will override the property 'Gallery' above. The
    # registered repository will be removed when dependencies has been resolved, unless it was already registered to begin
    # with. If repository is registered already but with different URL:s the repository will be re-registered and reverted
    # after dependencies has been resolved. Currently only Windows integrated security works with private Nuget v2 feeds
    # (or if it is a public feed with no security), it is not possible yet to securely provide other credentials for the feed.
    #RegisterGallery = @{
    #    #Name = 'MyPrivateFeedName'
    #    GallerySourceLocation = 'https://azdoserver.company.local/<org_name>/<project_name>/_packaging/<feed_name>/nuget/v2'
    #    GalleryPublishLocation = 'https://azdoserver.company.local/<org_name>/<project_name>/_packaging/<feed_name>/nuget/v2'
    #    GalleryScriptSourceLocation = 'https://azdoserver.company.local/<org_name>/<project_name>/_packaging/<feed_name>/nuget/v2'
    #    GalleryScriptPublishLocation = 'https://azdoserver.company.local/<org_name>/<project_name>/_packaging/<feed_name>/nuget/v2'
    #    #InstallationPolicy = 'Trusted'
    #}

    #AllowOldPowerShellGetModule = $true
    #MinimumPSDependVersion = '0.3.0'
    AllowPrerelease = $false
    WithYAML        = $true # Will also bootstrap PowerShell-Yaml to read other config files
}



================================================
FILE: SECURITY.md
================================================
## Security

The DSC Community takes the security of our modules seriously, which includes all source code repositories managed through our GitHub organization.

If you believe you have found a security vulnerability in any DSC Community owned repository, please report it to us as described below.

## Reporting Security Issues

**Please do not report security vulnerabilities through public GitHub issues.**

Instead, please report them to one or several members of the DSC Community organization.
The easiest way to do so is to send us a direct message via twitter or slack.

You should receive a response within 48 hours. If for some reason you do not, please follow up to other member of the community.

Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:

  * Type of issue
  * Full paths of source file(s) related to the manifestation of the issue
  * The location of the affected source code (tag/branch/commit or direct URL)
  * Any special configuration required to reproduce the issue
  * Step-by-step instructions to reproduce the issue
  * Proof-of-concept or exploit code (if possible)
  * Impact of the issue, including how an attacker might exploit the issue

This information will help us triage your report more quickly.

## Preferred Languages

We prefer all communications to be in English.


================================================
FILE: azure-pipelines.yml
================================================
trigger:
  branches:
    include:
    - main
  paths:
    exclude:
    - CHANGELOG.md
  tags:
    include:
    - "v*"
    exclude:
    - "*-*"

variables:
  buildFolderName: output
  buildArtifactName: output
  testResultFolderName: testResults
  defaultBranch: main

stages:
  - stage: Build
    jobs:
      - job: Package_Module
        displayName: 'Package Module'
        pool:
          vmImage: 'ubuntu-latest'
        steps:
          - pwsh: |
              dotnet tool install --global GitVersion.Tool
              $gitVersionObject = dotnet-gitversion | ConvertFrom-Json
              $gitVersionObject.PSObject.Properties.ForEach{
                  Write-Host -Object "Setting Task Variable '$($_.Name)' with value '$($_.Value)'."
                  Write-Host -Object "##vso[task.setvariable variable=$($_.Name);]$($_.Value)"
              }
              Write-Host -Object "##vso[build.updatebuildnumber]$($gitVersionObject.FullSemVer)"
            displayName: Calculate ModuleVersion (GitVersion)

          - task: PowerShell@2
            name: package
            displayName: 'Build & Package Module'
            inputs:
              filePath: './build.ps1'
              arguments: '-ResolveDependency -tasks pack'
              pwsh: true
            env:
              ModuleVersion: $(NuGetVersionV2)

          - task: PublishPipelineArtifact@1
            displayName: 'Publish Build Artifact'
            inputs:
              targetPath: '$(buildFolderName)/'
              artifact: $(buildArtifactName)
              publishLocation: 'pipeline'
              parallel: true

  - stage: Test
    dependsOn: Build
    jobs:
      - job: test_linux
        displayName: 'Linux'
        timeoutInMinutes: 0
        pool:
          vmImage: 'ubuntu-latest'
        steps:
          - task: DownloadPipelineArtifact@2
            displayName: 'Download Build Artifact'
            inputs:
              buildType: 'current'
              artifactName: $(buildArtifactName)
              targetPath: '$(Build.SourcesDirectory)/$(buildFolderName)'

          - task: PowerShell@2
            name: test
            displayName: 'Run Tests'
            inputs:
              filePath: './build.ps1'
              arguments: '-tasks test'

          - task: PublishTestResults@2
            displayName: 'Publish Test Results'
            condition: succeededOrFailed()
            inputs:
              testResultsFormat: 'NUnit'
              testResultsFiles: '$(buildFolderName)/$(testResultFolderName)/NUnit*.xml'
              testRunTitle: 'Linux'

          - task: PublishPipelineArtifact@1
            displayName: 'Publish Test Artifact'
            inputs:
              targetPath: '$(buildFolderName)/$(testResultFolderName)/'
              artifactName: 'CodeCoverageLinux'
              parallel: true

      - job: test_windows_core
        displayName: 'Windows (PowerShell)'
        timeoutInMinutes: 0
        pool:
          vmImage: 'windows-latest'
        steps:
          - task: DownloadPipelineArtifact@2
            displayName: 'Download Build Artifact'
            inputs:
              buildType: 'current'
              artifactName: $(buildArtifactName)
              targetPath: '$(Build.SourcesDirectory)/$(buildFolderName)'

          - task: PowerShell@2
            name: test
            displayName: 'Run Tests'
            inputs:
              filePath: './build.ps1'
              arguments: '-tasks test'
              pwsh: true

          - task: PublishTestResults@2
            displayName: 'Publish Test Results'
            condition: succeededOrFailed()
            inputs:
              testResultsFormat: 'NUnit'
              testResultsFiles: '$(buildFolderName)/$(testResultFolderName)/NUnit*.xml'
              testRunTitle: 'Windows (PowerShell)'

          - task: PublishPipelineArtifact@1
            displayName: 'Publish Test Artifact'
            inputs:
              targetPath: '$(buildFolderName)/$(testResultFolderName)/'
              artifactName: 'CodeCoverageWinPS7'
              parallel: true

      - job: test_windows_ps
        displayName: 'Windows (Windows PowerShell)'
        timeoutInMinutes: 0
        pool:
          vmImage: 'windows-latest'
        steps:
          - task: DownloadPipelineArtifact@2
            displayName: 'Download Build Artifact'
            inputs:
              buildType: 'current'
              artifactName: $(buildArtifactName)
              targetPath: '$(Build.SourcesDirectory)/$(buildFolderName)'

          - task: PowerShell@2
            name: test
            displayName: 'Run Tests'
            inputs:
              filePath: './build.ps1'
              arguments: '-tasks test'
              pwsh: false

          - task: PublishTestResults@2
            displayName: 'Publish Test Results'
            condition: succeededOrFailed()
            inputs:
              testResultsFormat: 'NUnit'
              testResultsFiles: '$(buildFolderName)/$(testResultFolderName)/NUnit*.xml'
              testRunTitle: 'Windows (Windows PowerShell)'

          - task: PublishPipelineArtifact@1
            displayName: 'Publish Test Artifact'
            inputs:
              targetPath: '$(buildFolderName)/$(testResultFolderName)/'
              artifactName: 'CodeCoverageWinPS51'
              parallel: true

      - job: test_macos
        displayName: 'macOS'
        timeoutInMinutes: 0
        pool:
          vmImage: 'macos-latest'
        steps:
          - task: DownloadPipelineArtifact@2
            displayName: 'Download Build Artifact'
            inputs:
              buildType: 'current'
              artifactName: $(buildArtifactName)
              targetPath: '$(Build.SourcesDirectory)/$(buildFolderName)'

          - task: PowerShell@2
            name: test
            displayName: 'Run Tests'
            inputs:
              filePath: './build.ps1'
              arguments: '-tasks test'
              pwsh: true

          - task: PublishTestResults@2
            displayName: 'Publish Test Results'
            condition: succeededOrFailed()
            inputs:
              testResultsFormat: 'NUnit'
              testResultsFiles: '$(buildFolderName)/$(testResultFolderName)/NUnit*.xml'
              testRunTitle: 'MacOS'

          - task: PublishPipelineArtifact@1
            displayName: 'Publish Test Artifact'
            inputs:
              targetPath: '$(buildFolderName)/$(testResultFolderName)/'
              artifactName: 'CodeCoverageMacOS'
              parallel: true

      # If no code coverage should be reported, then this entire removed:
      - job: Code_Coverage
        displayName: 'Publish Code Coverage'
        dependsOn:
          - test_macos
          - test_linux
          - test_windows_core
          - test_windows_ps
        pool:
          vmImage: 'ubuntu-latest'
        timeoutInMinutes: 0
        steps:
          - pwsh: |
              $repositoryOwner,$repositoryName = $env:BUILD_REPOSITORY_NAME -split '/'
              echo "##vso[task.setvariable variable=RepositoryOwner;isOutput=true]$repositoryOwner"
              echo "##vso[task.setvariable variable=RepositoryName;isOutput=true]$repositoryName"
            name: dscBuildVariable
            displayName: 'Set Environment Variables'

          - task: DownloadPipelineArtifact@2
            displayName: 'Download Pipeline Artifact'
            inputs:
              buildType: 'current'
              artifactName: $(buildArtifactName)
              targetPath: '$(Build.SourcesDirectory)/$(buildArtifactName)'

          - task: DownloadPipelineArtifact@2
            displayName: 'Download Test Artifact macOS'
            inputs:
              buildType: 'current'
              artifactName: 'CodeCoverageMacOS'
              targetPath: '$(Build.SourcesDirectory)/$(buildFolderName)/$(testResultFolderName)'

          - task: DownloadPipelineArtifact@2
            displayName: 'Download Test Artifact Linux'
            inputs:
              buildType: 'current'
              artifactName: 'CodeCoverageLinux'
              targetPath: '$(Build.SourcesDirectory)/$(buildFolderName)/$(testResultFolderName)'

          - task: DownloadPipelineArtifact@2
            displayName: 'Download Test Artifact Windows (PS 5.1)'
            inputs:
              buildType: 'current'
              artifactName: 'CodeCoverageWinPS51'
              targetPath: '$(Build.SourcesDirectory)/$(buildFolderName)/$(testResultFolderName)'

          - task: DownloadPipelineArtifact@2
            displayName: 'Download Test Artifact Windows (PS7)'
            inputs:
              buildType: 'current'
              artifactName: 'CodeCoverageWinPS7'
              targetPath: '$(Build.SourcesDirectory)/$(buildFolderName)/$(testResultFolderName)'

          # Make sure to update build.yaml to support these tasks, then uncomment these tasks:
          #- task: PowerShell@2
          #  name: merge
          #  displayName: 'Merge Code Coverage files'
          #  inputs:
          #    filePath: './build.ps1'
          #    arguments: '-tasks merge'
          #    pwsh: true
          #- task: PublishCodeCoverageResults@1
          #  displayName: 'Publish Azure Code Coverage'
          #  inputs:
          #    codeCoverageTool: 'JaCoCo'
          #    summaryFileLocation: '$(buildFolderName)/$(testResultFolderName)/JaCoCo_coverage.xml'
          #    pathToSources: '$(Build.SourcesDirectory)/$(dscBuildVariable.RepositoryName)/'

          # Uncomment if Codecov.io should be used (see docs at Codecov.io how to use and the required repository configuration).
          #- script: |
          #    bash <(curl -s https://codecov.io/bash) -f "./$(buildFolderName)/$(testResultFolderName)/JaCoCo_coverage.xml"
          #  displayName: 'Publish Code Coverage to Codecov.io'

  - stage: Deploy
    dependsOn: Test
    # Only execute deploy stage if we're on main and previous stage succeeded
    condition: |
      and(
        succeeded(),
        or(
          eq(variables['Build.SourceBranch'], 'refs/heads/main'),
          startsWith(variables['Build.SourceBranch'], 'refs/tags/')
        ),
        contains(variables['System.TeamFoundationCollectionUri'], 'MyOrgName')
      )
    jobs:
      - job: Deploy_Module
        displayName: 'Deploy Module'
        pool:
          vmImage: 'ubuntu-latest'
        steps:
          - task: DownloadPipelineArtifact@2
            displayName: 'Download Build Artifact'
            inputs:
              buildType: 'current'
              artifactName: $(buildArtifactName)
              targetPath: '$(Build.SourcesDirectory)/$(buildFolderName)'
          - task: PowerShell@2
            name: publishRelease
            displayName: 'Publish Release'
            inputs:
              filePath: './build.ps1'
              arguments: '-tasks publish'
              pwsh: true
            env:
              GitHubToken: $(GitHubToken)
              GalleryApiToken: $(GalleryApiToken)
              ReleaseBranch: $(defaultBranch)
              MainGitBranch: $(defaultBranch)
          - task: PowerShell@2
            name: sendChangelogPR
            displayName: 'Send Changelog PR'
            inputs:
              filePath: './build.ps1'
              arguments: '-tasks Create_ChangeLog_GitHub_PR'
              pwsh: true
            env:
              GitHubToken: $(GitHubToken)
              ReleaseBranch: $(defaultBranch)
              MainGitBranch: $(defaultBranch)



================================================
FILE: build.ps1
================================================
<#
    .DESCRIPTION
        Bootstrap and build script for PowerShell module CI/CD pipeline

    .PARAMETER Tasks
        The task or tasks to run. The default value is '.' (runs the default task).

    .PARAMETER CodeCoverageThreshold
        The code coverage target threshold to uphold. Set to 0 to disable.
        The default value is '' (empty string).

    .PARAMETER BuildConfig
        Not yet written.

    .PARAMETER OutputDirectory
        Specifies the folder to build the artefact into. The default value is 'output'.

    .PARAMETER BuiltModuleSubdirectory
        Subdirectory name to build the module (under $OutputDirectory). The default
        value is '' (empty string).

    .PARAMETER RequiredModulesDirectory
        Can be a path (relative to $PSScriptRoot or absolute) to tell Resolve-Dependency
        and PSDepend where to save the required modules. It is also possible to use
        'CurrentUser' och 'AllUsers' to install missing dependencies. You can override
        the value for PSDepend in the Build.psd1 build manifest. The default value is
        'output/RequiredModules'.

    .PARAMETER PesterScript
        One or more paths that will override the Pester configuration in build
        configuration file when running the build task Invoke_Pester_Tests.

        If running Pester 5 test, use the alias PesterPath to be future-proof.

    .PARAMETER PesterTag
        Filter which tags to run when invoking Pester tests. This is used in the
        Invoke-Pester.pester.build.ps1 tasks.

    .PARAMETER PesterExcludeTag
        Filter which tags to exclude when invoking Pester tests. This is used in
        the Invoke-Pester.pester.build.ps1 tasks.

    .PARAMETER DscTestTag
        Filter which tags to run when invoking DSC Resource tests. This is used
        in the DscResource.Test.build.ps1 tasks.

    .PARAMETER DscTestExcludeTag
        Filter which tags to exclude when invoking DSC Resource tests. This is
        used in the DscResource.Test.build.ps1 tasks.

    .PARAMETER ResolveDependency
        Not yet written.

    .PARAMETER BuildInfo
        The build info object from ModuleBuilder. Defaults to an empty hashtable.

    .PARAMETER AutoRestore
        Not yet written.
#>
[CmdletBinding()]
param
(
    [Parameter(Position = 0)]
    [System.String[]]
    $Tasks = '.',

    [Parameter()]
    [System.String]
    $CodeCoverageThreshold = '',

    [Parameter()]
    [System.String]
    [ValidateScript(
        { Test-Path -Path $_ }
    )]
    $BuildConfig,

    [Parameter()]
    [System.String]
    $OutputDirectory = 'output',

    [Parameter()]
    [System.String]
    $BuiltModuleSubdirectory = '',

    [Parameter()]
    [System.String]
    $RequiredModulesDirectory = $(Join-Path 'output' 'RequiredModules'),

    [Parameter()]
    # This alias is to prepare for the rename of this parameter to PesterPath when Pester 4 support is removed
    [Alias('PesterPath')]
    [System.Object[]]
    $PesterScript,

    [Parameter()]
    [System.String[]]
    $PesterTag,

    [Parameter()]
    [System.String[]]
    $PesterExcludeTag,

    [Parameter()]
    [System.String[]]
    $DscTestTag,

    [Parameter()]
    [System.String[]]
    $DscTestExcludeTag,

    [Parameter()]
    [Alias('bootstrap')]
    [System.Management.Automation.SwitchParameter]
    $ResolveDependency,

    [Parameter(DontShow)]
    [AllowNull()]
    [System.Collections.Hashtable]
    $BuildInfo,

    [Parameter()]
    [System.Management.Automation.SwitchParameter]
    $AutoRestore
)

<#
    The BEGIN block (at the end of this file) handles the Bootstrap of the Environment
    before Invoke-Build can run the tasks if the parameter ResolveDependency (or
    parameter alias Bootstrap) is specified.
#>

process
{

    if ($MyInvocation.ScriptName -notLike '*Invoke-Build.ps1')
    {
        # Only run the process block through InvokeBuild (look at the Begin block at the bottom of this script).
        return
    }

    # Execute the Build process from the .build.ps1 path.
    Push-Location -Path $PSScriptRoot -StackName 'BeforeBuild'

    try
    {
        Write-Host -Object "[build] Parsing defined tasks" -ForeGroundColor Magenta

        # Load the default BuildInfo if the parameter BuildInfo is not set.
        if (-not $PSBoundParameters.ContainsKey('BuildInfo'))
        {
            try
            {
                if (Test-Path -Path $BuildConfig)
                {
                    $configFile = Get-Item -Path $BuildConfig

                    Write-Host -Object "[build] Loading Configuration from $configFile"

                    $BuildInfo = switch -Regex ($configFile.Extension)
                    {
                        # Native Support for PSD1
                        '\.psd1'
                        {
                            if (-not (Get-Command -Name Import-PowerShellDataFile -ErrorAction SilentlyContinue))
                            {
                                Import-Module -Name Microsoft.PowerShell.Utility -RequiredVersion 3.1.0.0
                            }

                            Import-PowerShellDataFile -Path $BuildConfig
                        }

                        # Support for yaml when module PowerShell-Yaml is available
                        '\.[yaml|yml]'
                        {
                            Import-Module -Name 'powershell-yaml' -ErrorAction Stop

                            ConvertFrom-Yaml -Yaml (Get-Content -Raw $configFile)
                        }

                        # Native Support for JSON and JSONC (by Removing comments)
                        '\.[json|jsonc]'
                        {
                            $jsonFile = Get-Content -Raw -Path $configFile

                            $jsonContent = $jsonFile -replace '(?m)\s*//.*?$' -replace '(?ms)/\*.*?\*/'

                            # Yaml is superset of JSON.
                            ConvertFrom-Yaml -Yaml $jsonContent
                        }

                        # Unknown extension, return empty hashtable.
                        default
                        {
                            Write-Error -Message "Extension '$_' not supported. using @{}"

                            @{ }
                        }
                    }
                }
                else
                {
                    Write-Host -Object "Configuration file '$($BuildConfig.FullName)' not found" -ForegroundColor Red

                    # No config file was found, return empty hashtable.
                    $BuildInfo = @{ }
                }
            }
            catch
            {
                $logMessage = "Error loading Config '$($BuildConfig.FullName)'.`r`nAre you missing dependencies?`r`nMake sure you run './build.ps1 -ResolveDependency -tasks noop' before running build to restore the required modules."

                Write-Host -Object $logMessage -ForegroundColor Yellow

                $BuildInfo = @{ }

                Write-Error -Message $_.Exception.Message
            }
        }

        # If the Invoke-Build Task Header is specified in the Build Info, set it.
        if ($BuildInfo.TaskHeader)
        {
            Set-BuildHeader -Script ([scriptblock]::Create($BuildInfo.TaskHeader))
        }

        <#
            Add BuildModuleOutput to PSModule Path environment variable.
            Moved here (not in begin block) because build file can contains BuiltSubModuleDirectory value.
        #>
        if ($BuiltModuleSubdirectory)
        {
            if (-not (Split-Path -IsAbsolute -Path $BuiltModuleSubdirectory))
            {
                $BuildModuleOutput = Join-Path -Path $OutputDirectory -ChildPath $BuiltModuleSubdirectory
            }
            else
            {
                $BuildModuleOutput = $BuiltModuleSubdirectory
            }
        } # test if BuiltModuleSubDirectory set in build config file
        elseif ($BuildInfo.ContainsKey('BuiltModuleSubDirectory'))
        {
            $BuildModuleOutput = Join-Path -Path $OutputDirectory -ChildPath $BuildInfo['BuiltModuleSubdirectory']
        }
        else
        {
            $BuildModuleOutput = $OutputDirectory
        }

        # Pre-pending $BuildModuleOutput folder to PSModulePath to resolve built module from this folder.
        if ($powerShellModulePaths -notcontains $BuildModuleOutput)
        {
            Write-Host -Object "[build] Pre-pending '$BuildModuleOutput' folder to PSModulePath" -ForegroundColor Green

            $env:PSModulePath = $BuildModuleOutput + [System.IO.Path]::PathSeparator + $env:PSModulePath
        }

        <#
            Import Tasks from modules via their exported aliases when defined in Build Manifest.
            https://github.com/nightroman/Invoke-Build/tree/master/Tasks/Import#example-2-import-from-a-module-with-tasks
        #>
        if ($BuildInfo.ContainsKey('ModuleBuildTasks'))
        {
            foreach ($module in $BuildInfo['ModuleBuildTasks'].Keys)
            {
                try
                {
                    Write-Host -Object "Importing tasks from module $module" -ForegroundColor DarkGray

                    $loadedModule = Import-Module -Name $module -PassThru -ErrorAction Stop

                    foreach ($TaskToExport in $BuildInfo['ModuleBuildTasks'].($module))
                    {
                        $loadedModule.ExportedAliases.GetEnumerator().Where{
                            Write-Host -Object "`t Loading $($_.Key)..." -ForegroundColor DarkGray

                            # Using -like to support wildcard.
                            $_.Key -like $TaskToExport
                        }.ForEach{
                            # Dot-sourcing the Tasks via their exported aliases.
                            . (Get-Alias $_.Key)
                        }
                    }
                }
                catch
                {
                    Write-Host -Object "Could not load tasks for module $module." -ForegroundColor Red

                    Write-Error -Message $_
                }
            }
        }

        # Loading Build Tasks defined in the .build/ folder (will override the ones imported above if same task name).
        Get-ChildItem -Path '.build/' -Recurse -Include '*.ps1' -ErrorAction Ignore |
            ForEach-Object {
                "Importing file $($_.BaseName)" | Write-Verbose

                . $_.FullName
            }

        # Synopsis: Empty task, useful to test the bootstrap process.
        task noop { }

        # Define default task sequence ("."), can be overridden in the $BuildInfo.
        task . {
            Write-Build -Object 'No sequence currently defined for the default task' -ForegroundColor Yellow
        }

        Write-Host -Object 'Adding Workflow from configuration:' -ForegroundColor DarkGray

        # Load Invoke-Build task sequences/workflows from $BuildInfo.
        foreach ($workflow in $BuildInfo.BuildWorkflow.keys)
        {
            Write-Verbose -Message "Creating Build Workflow '$Workflow' with tasks $($BuildInfo.BuildWorkflow.($Workflow) -join ', ')."

            $workflowItem = $BuildInfo.BuildWorkflow.($workflow)

            if ($workflowItem.Trim() -match '^\{(?<sb>[\w\W]*)\}$')
            {
                $workflowItem = [ScriptBlock]::Create($Matches['sb'])
            }

            Write-Host -Object "  +-> $workflow" -ForegroundColor DarkGray

            task $workflow $workflowItem
        }

        Write-Host -Object "[build] Executing requested workflow: $($Tasks -join ', ')" -ForeGroundColor Magenta

    }
    finally
    {
        Pop-Location -StackName 'BeforeBuild'
    }
}

Begin
{
    # Find build config if not specified.
    if (-not $BuildConfig)
    {
        $config = Get-ChildItem -Path "$PSScriptRoot\*" -Include 'build.y*ml', 'build.psd1', 'build.json*' -ErrorAction Ignore

        if (-not $config -or ($config -is [System.Array] -and $config.Length -le 0))
        {
            throw 'No build configuration found. Specify path via parameter BuildConfig.'
        }
        elseif ($config -is [System.Array])
        {
            if ($config.Length -gt 1)
            {
                throw 'More than one build configuration found. Specify which path to use via parameter BuildConfig.'
            }

            $BuildConfig = $config[0]
        }
        else
        {
            $BuildConfig = $config
        }
    }

    # Bootstrapping the environment before using Invoke-Build as task runner

    if ($MyInvocation.ScriptName -notlike '*Invoke-Build.ps1')
    {
        Write-Host -Object "[pre-build] Starting Build Init" -ForegroundColor Green

        Push-Location $PSScriptRoot -StackName 'BuildModule'
    }

    if ($RequiredModulesDirectory -in @('CurrentUser', 'AllUsers'))
    {
        # Installing modules instead of saving them.
        Write-Host -Object "[pre-build] Required Modules will be installed to the PowerShell module path that is used for $RequiredModulesDirectory." -ForegroundColor Green

        <#
            The variable $PSDependTarget will be used below when building the splatting
            variable before calling Resolve-Dependency.ps1, unless overridden in the
            file Resolve-Dependency.psd1.
        #>
        $PSDependTarget = $RequiredModulesDirectory
    }
    else
    {
        if (-not (Split-Path -IsAbsolute -Path $OutputDirectory))
        {
            $OutputDirectory = Join-Path -Path $PSScriptRoot -ChildPath $OutputDirectory
        }

        # Resolving the absolute path to save the required modules to.
        if (-not (Split-Path -IsAbsolute -Path $RequiredModulesDirectory))
        {
            $RequiredModulesDirectory = Join-Path -Path $PSScriptRoot -ChildPath $RequiredModulesDirectory
        }

        # Create the output/modules folder if not exists, or resolve the Absolute path otherwise.
        if (Resolve-Path -Path $RequiredModulesDirectory -ErrorAction SilentlyContinue)
        {
            Write-Debug -Message "[pre-build] Required Modules path already exist at $RequiredModulesDirectory"

            $requiredModulesPath = Convert-Path -Path $RequiredModulesDirectory
        }
        else
        {
            Write-Host -Object "[pre-build] Creating required modules directory $RequiredModulesDirectory." -ForegroundColor Green

            $requiredModulesPath = (New-Item -ItemType Directory -Force -Path $RequiredModulesDirectory).FullName
        }

        $powerShellModulePaths = $env:PSModulePath -split [System.IO.Path]::PathSeparator

        # Pre-pending $requiredModulesPath folder to PSModulePath to resolve from this folder FIRST.
        if ($RequiredModulesDirectory -notin @('CurrentUser', 'AllUsers') -and
            ($powerShellModulePaths -notcontains $RequiredModulesDirectory))
        {
            Write-Host -Object "[pre-build] Pre-pending '$RequiredModulesDirectory' folder to PSModulePath" -ForegroundColor Green

            $env:PSModulePath = $RequiredModulesDirectory + [System.IO.Path]::PathSeparator + $env:PSModulePath
        }

        $powerShellYamlModule = Get-Module -Name 'powershell-yaml' -ListAvailable
        $invokeBuildModule = Get-Module -Name 'InvokeBuild' -ListAvailable
        $psDependModule = Get-Module -Name 'PSDepend' -ListAvailable

        # Checking if the user should -ResolveDependency.
        if (-not ($powerShellYamlModule -and $invokeBuildModule -and $psDependModule) -and -not $ResolveDependency)
        {
            if ($AutoRestore -or -not $PSBoundParameters.ContainsKey('Tasks') -or $Tasks -contains 'build')
            {
                Write-Host -Object "[pre-build] Dependency missing, running './build.ps1 -ResolveDependency -Tasks noop' for you `r`n" -ForegroundColor Yellow

                $ResolveDependency = $true
            }
            else
            {
                Write-Warning -Message "Some required Modules are missing, make sure you first run with the '-ResolveDependency' parameter. Running 'build.ps1 -ResolveDependency -Tasks noop' will pull required modules without running the build task."
            }
        }

        <#
            The variable $PSDependTarget will be used below when building the splatting
            variable before calling Resolve-Dependency.ps1, unless overridden in the
            file Resolve-Dependency.psd1.
        #>
        $PSDependTarget = $requiredModulesPath
    }

    if ($ResolveDependency)
    {
        Write-Host -Object "[pre-build] Resolving dependencies." -ForegroundColor Green
        $resolveDependencyParams = @{ }

        # If BuildConfig is a Yaml file, bootstrap powershell-yaml via ResolveDependency.
        if ($BuildConfig -match '\.[yaml|yml]$')
        {
            $resolveDependencyParams.Add('WithYaml', $true)
        }

        $resolveDependencyAvailableParams = (Get-Command -Name '.\Resolve-Dependency.ps1').Parameters.Keys

        foreach ($cmdParameter in $resolveDependencyAvailableParams)
        {
            # The parameter has been explicitly used for calling the .build.ps1
            if ($MyInvocation.BoundParameters.ContainsKey($cmdParameter))
            {
                $paramValue = $MyInvocation.BoundParameters.Item($cmdParameter)

                Write-Debug " adding  $cmdParameter :: $paramValue [from user-provided parameters to Build.ps1]"

                $resolveDependencyParams.Add($cmdParameter, $paramValue)
            }
            # Use defaults parameter value from Build.ps1, if any
            else
            {
                $paramValue = Get-Variable -Name $cmdParameter -ValueOnly -ErrorAction Ignore

                if ($paramValue)
                {
                    Write-Debug " adding  $cmdParameter :: $paramValue [from default Build.ps1 variable]"

                    $resolveDependencyParams.Add($cmdParameter, $paramValue)
                }
            }
        }

        Write-Host -Object "[pre-build] Starting bootstrap process." -ForegroundColor Green

        .\Resolve-Dependency.ps1 @resolveDependencyParams
    }

    if ($MyInvocation.ScriptName -notlike '*Invoke-Build.ps1')
    {
        Write-Verbose -Message "Bootstrap completed. Handing back to InvokeBuild."

        if ($PSBoundParameters.ContainsKey('ResolveDependency'))
        {
            Write-Verbose -Message "Dependency already resolved. Removing task."

            $null = $PSBoundParameters.Remove('ResolveDependency')
        }

        Write-Host -Object "[build] Starting build with InvokeBuild." -ForegroundColor Green

        Invoke-Build @PSBoundParameters -Task $Tasks -File $MyInvocation.MyCommand.Path

        Pop-Location -StackName 'BuildModule'

        return
    }
}


================================================
FILE: build.yaml
================================================
---
# Invoke-Build Header to be used to 'decorate' the terminal output of the tasks.
TaskHeader: |
  param($Path)
  ""
  "=" * 79
  Write-Build Cyan "`t`t`t$($Task.Name.replace("_"," ").ToUpper())"
  Write-Build DarkGray  "$(Get-BuildSynopsis $Task)"
  "-" * 79
  Write-Build DarkGray "  $Path"
  Write-Build DarkGray "  $($Task.InvocationInfo.ScriptName):$($Task.InvocationInfo.ScriptLineNumber)"
  ""

####################################################
# Pipeline Build Task Configuration (Invoke-Build) #
####################################################
BuildWorkflow:
  '.': 
    - build
    - test

  build:
    - Clean
    - Build_Module_ModuleBuilder
    - Build_NestedModules_ModuleBuilder
    - Create_changelog_release_output

  pack:
    - build
    - package_module_nupkg

  test:
    - Pester_Tests_Stop_On_Fail
    #- Convert_Pester_Coverage
    - Pester_if_Code_Coverage_Under_Threshold

  # Use this task when you have multiple parallel tests, which produce multiple
  # code coverage files and needs to get merged into one file.
  #merge:
    #- Merge_CodeCoverage_Files

  publish:
    - publish_module_to_gallery
    - Publish_Release_To_GitHub
  #  - Publish_GitHub_Wiki_Content

####################################################
#          ModuleBuilder Configuration             #
####################################################

CopyPaths:
  - bin
  - checks
  - functions
  - internal
  - xml
Encoding: UTF8
VersionedOutputDirectory: true

####################################################
#       PESTER  Configuration                      #
####################################################

# PESTER CONFIG START
Pester:
  # Pester Advanced configuration.
  # If a key is not set it will be using Sampler pipeline default value.
  Configuration:
    Run:
      Path: tests
        
      ExcludePath:
    Filter:
      Tag:
      ExcludeTag:
        
    Output:
      Verbosity: None
    CodeCoverage:
      Path: '*/checks/*'
      OutputFormat:
      CoveragePercentTarget: 0
      OutputPath: JaCoCo_coverage.xml
      OutputEncoding: ascii
      ExcludeTests:
    TestResult:
      OutputFormat: NUnitXML
      OutputPath:
      OutputEncoding:
      TestSuiteName:

####################################################
#         Import ModuleBuilder Configuration              #
####################################################

# Import ModuleBuilder tasks from a specific PowerShell module using the build task's alias. Wildcard * can be used to specify all tasks that has a similar
# prefix and or suffix. The module contain the task must be added as a required
# module in the file RequiredModules.psd1.
ModuleBuildTasks:
  Sampler:
    - '*.build.Sampler.ib.tasks'
  Sampler.GitHubTasks:
    - '*.ib.tasks'


####################################################
#              PSDepend Configuration              #
####################################################
Resolve-Dependency:
  Gallery: 'PSGallery'
  AllowPrerelease: false
  Verbose: false

####################################################
#               GitHub Configuration               #
####################################################
GitHubConfig:
  GitHubFilesToAdd:
    - 'CHANGELOG.md'
  GitHubConfigUserName: BeardAutoBot
  GitHubConfigUserEmail: mrrobsewell@outlook.com
  UpdateChangelogOnPrerelease: true


================================================
FILE: builddocs.ps1
================================================
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 

Install-Module PlatyPs -Scope CurrentUser -Force
Import-Module PlatyPs

# Get the Module versions
Install-Module Configuration -RequiredVersion 1.3.0 -Scope CurrentUser -Force
$Modules = Get-ManifestValue -Path .\dbachecks.psd1 -PropertyName RequiredModules

$PSFrameworkVersion = $Modules.Where{$_.Get_Item('ModuleName') -eq 'PSFramework'}[0].Get_Item('ModuleVersion')
$dbatoolsVersion = $Modules.Where{$_.Get_Item('ModuleName') -eq 'dbatools'}[0].Get_Item('ModuleVersion')

# Install Pester
try {
    Write-Output "Installing Pester"
    Install-Module Pester  -RequiredVersion 4.10.0  -Scope CurrentUser -Force -SkipPublisherCheck
    Write-Output "Installed Pester"

}
catch {
    Write-Error "Failed to Install Pester $($_)"
}


# Install dbatools
try {
    Write-Output "Installing PSFramework"
    Install-Module PSFramework  -RequiredVersion $PsFrameworkVersion  -Scope CurrentUser -Force
    Write-Output "Installed PSFramework"

}
catch {
    Write-Error "Failed to Install PSFramework $($_)"
}
# Install dbachecks
try {
    Write-Output "Installing dbatools"
    Write-Output "Install-Module dbatools  -RequiredVersion $dbatoolsVersion  -Scope CurrentUser -Force"
    Install-Module dbatools  -RequiredVersion $dbatoolsVersion  -Scope CurrentUser -Force
    Write-Output "Installed dbatools"

}
catch {
    Write-Error "Failed to Install dbatools $($_)"
}


# Add current folder to PSModulePath
try {
    Write-Output "Adding local folder to PSModulePath"
    $ENV:PSModulePath = $ENV:PSModulePath + ";$pwd"
    Write-Output "Added local folder to PSModulePath"
    $ENV:PSModulePath.Split(';')
}
catch {
    Write-Error "Failed to add $pwd to PSModulePAth - $_"
}
try {
    Write-Output "Importing dbachecks"
    Import-Module .\dbachecks.psd1 -verbose
    Write-Output "Imported dbachecks"

}
catch {
    try {
        Write-Output "Importing dbachecks again to get around the stupid failure for dbatools"
        Import-Module .\dbachecks.psd1 -verbose
        Write-Output "Imported dbachecks - again to get around the stupid failure for dbatools"
    }
    catch {
        Write-Error "Failed to Install dbachecks $($_)"
    }
}


$ProjectRoot = Get-Location
$ReleaseNotes = ".\RELEASE.md"
$ChangeLog = "$ProjectRoot\docs\ChangeLog.md"


#Build YAMLText starting with the header
$YMLtext = (Get-Content "$ProjectRoot\header-mkdocs.yml") -join "`n"
$YMLtext = "$YMLtext`n"

$parameters = @{
    Path        = $ReleaseNotes
    ErrorAction = 'SilentlyContinue'
}
$ReleaseText = (Get-Content @parameters) -join "`n"
if ($ReleaseText) {
    $ReleaseText | Set-Content "$ProjectRoot\docs\RELEASE.md"
    $YMLText = "$YMLtext  - Release Notes: RELEASE.md`n"
}
if ((Test-Path -Path $ChangeLog)) {
    $YMLText = "$YMLtext  - Change Log: ChangeLog.md`n"
}
$YMLText = "$YMLtext  - Functions:`n"

$Params = @{
    Module       = 'dbachecks'
    Force        = $true
    OutputFolder = "$ProjectRoot\docs\functions"
    NoMetadata   = $true
}
New-MarkdownHelp @Params | foreach-object {
    $Function = $_.Name -replace '\.md', ''
    $Part = "    - {0}: functions/{1}" -f $Function, $_.Name
    $YMLText = "{0}{1}`n" -f $YMLText, $Part
    $Part
}
$YMLtext | Set-Content -Path "$ProjectRoot\mkdocs.yml"
# SIG # Begin signature block
# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUDdPclX9bMrkY1BsUGvj1TEwy
# ciqgggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B
# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD
# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz
# c3VyZWQgSUQgQ29kZSBTaWduaW5nIENBMB4XDTE3MDUwOTAwMDAwMFoXDTIwMDUx
# MzEyMDAwMFowVzELMAkGA1UEBhMCVVMxETAPBgNVBAgTCFZpcmdpbmlhMQ8wDQYD
# VQQHEwZWaWVubmExETAPBgNVBAoTCGRiYXRvb2xzMREwDwYDVQQDEwhkYmF0b29s
# czCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAI8ng7JxnekL0AO4qQgt
# Kr6p3q3SNOPh+SUZH+SyY8EA2I3wR7BMoT7rnZNolTwGjUXn7bRC6vISWg16N202
# 1RBWdTGW2rVPBVLF4HA46jle4hcpEVquXdj3yGYa99ko1w2FOWzLjKvtLqj4tzOh
# K7wa/Gbmv0Si/FU6oOmctzYMI0QXtEG7lR1HsJT5kywwmgcjyuiN28iBIhT6man0
# Ib6xKDv40PblKq5c9AFVldXUGVeBJbLhcEAA1nSPSLGdc7j4J2SulGISYY7ocuX3
# tkv01te72Mv2KkqqpfkLEAQjXgtM0hlgwuc8/A4if+I0YtboCMkVQuwBpbR9/6ys
# Z+sCAwEAAaOCAcUwggHBMB8GA1UdIwQYMBaAFFrEuXsqCqOl6nEDwGD5LfZldQ5Y
# MB0GA1UdDgQWBBRcxSkFqeA3vvHU0aq2mVpFRSOdmjAOBgNVHQ8BAf8EBAMCB4Aw
# EwYDVR0lBAwwCgYIKwYBBQUHAwMwdwYDVR0fBHAwbjA1oDOgMYYvaHR0cDovL2Ny
# bDMuZGlnaWNlcnQuY29tL3NoYTItYXNzdXJlZC1jcy1nMS5jcmwwNaAzoDGGL2h0
# dHA6Ly9jcmw0LmRpZ2ljZXJ0LmNvbS9zaGEyLWFzc3VyZWQtY3MtZzEuY3JsMEwG
# A1UdIARFMEMwNwYJYIZIAYb9bAMBMCowKAYIKwYBBQUHAgEWHGh0dHBzOi8vd3d3
# LmRpZ2ljZXJ0LmNvbS9DUFMwCAYGZ4EMAQQBMIGEBggrBgEFBQcBAQR4MHYwJAYI
# KwYBBQUHMAGGGGh0dHA6Ly9vY3NwLmRpZ2ljZXJ0LmNvbTBOBggrBgEFBQcwAoZC
# aHR0cDovL2NhY2VydHMuZGlnaWNlcnQuY29tL0RpZ2lDZXJ0U0hBMkFzc3VyZWRJ
# RENvZGVTaWduaW5nQ0EuY3J0MAwGA1UdEwEB/wQCMAAwDQYJKoZIhvcNAQELBQAD
# ggEBANuBGTbzCRhgG0Th09J0m/qDqohWMx6ZOFKhMoKl8f/l6IwyDrkG48JBkWOA
# QYXNAzvp3Ro7aGCNJKRAOcIjNKYef/PFRfFQvMe07nQIj78G8x0q44ZpOVCp9uVj
# sLmIvsmF1dcYhOWs9BOG/Zp9augJUtlYpo4JW+iuZHCqjhKzIc74rEEiZd0hSm8M
# asshvBUSB9e8do/7RhaKezvlciDaFBQvg5s0fICsEhULBRhoyVOiUKUcemprPiTD
# xh3buBLuN0bBayjWmOMlkG1Z6i8DUvWlPGz9jiBT3ONBqxXfghXLL6n8PhfppBhn
# daPQO8+SqF5rqrlyBPmRRaTz2GQwggUwMIIEGKADAgECAhAECRgbX9W7ZnVTQ7Vv
# lVAIMA0GCSqGSIb3DQEBCwUAMGUxCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdp
# Q2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20xJDAiBgNVBAMTG0Rp
# Z2lDZXJ0IEFzc3VyZWQgSUQgUm9vdCBDQTAeFw0xMzEwMjIxMjAwMDBaFw0yODEw
# MjIxMjAwMDBaMHIxCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMx
# GTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20xMTAvBgNVBAMTKERpZ2lDZXJ0IFNI
# QTIgQXNzdXJlZCBJRCBDb2RlIFNpZ25pbmcgQ0EwggEiMA0GCSqGSIb3DQEBAQUA
# A4IBDwAwggEKAoIBAQD407Mcfw4Rr2d3B9MLMUkZz9D7RZmxOttE9X/lqJ3bMtdx
# 6nadBS63j/qSQ8Cl+YnUNxnXtqrwnIal2CWsDnkoOn7p0WfTxvspJ8fTeyOU5JEj
# lpB3gvmhhCNmElQzUHSxKCa7JGnCwlLyFGeKiUXULaGj6YgsIJWuHEqHCN8M9eJN
# YBi+qsSyrnAxZjNxPqxwoqvOf+l8y5Kh5TsxHM/q8grkV7tKtel05iv+bMt+dDk2
# DZDv5LVOpKnqagqrhPOsZ061xPeM0SAlI+sIZD5SlsHyDxL0xY4PwaLoLFH3c7y9
# hbFig3NBggfkOItqcyDQD2RzPJ6fpjOp/RnfJZPRAgMBAAGjggHNMIIByTASBgNV
# HRMBAf8ECDAGAQH/AgEAMA4GA1UdDwEB/wQEAwIBhjATBgNVHSUEDDAKBggrBgEF
# BQcDAzB5BggrBgEFBQcBAQRtMGswJAYIKwYBBQUHMAGGGGh0dHA6Ly9vY3NwLmRp
# Z2ljZXJ0LmNvbTBDBggrBgEFBQcwAoY3aHR0cDovL2NhY2VydHMuZGlnaWNlcnQu
# Y29tL0RpZ2lDZXJ0QXNzdXJlZElEUm9vdENBLmNydDCBgQYDVR0fBHoweDA6oDig
# NoY0aHR0cDovL2NybDQuZGlnaWNlcnQuY29tL0RpZ2lDZXJ0QXNzdXJlZElEUm9v
# dENBLmNybDA6oDigNoY0aHR0cDovL2NybDMuZGlnaWNlcnQuY29tL0RpZ2lDZXJ0
# QXNzdXJlZElEUm9vdENBLmNybDBPBgNVHSAESDBGMDgGCmCGSAGG/WwAAgQwKjAo
# BggrBgEFBQcCARYcaHR0cHM6Ly93d3cuZGlnaWNlcnQuY29tL0NQUzAKBghghkgB
# hv1sAzAdBgNVHQ4EFgQUWsS5eyoKo6XqcQPAYPkt9mV1DlgwHwYDVR0jBBgwFoAU
# Reuir/SSy4IxLVGLp6chnfNtyA8wDQYJKoZIhvcNAQELBQADggEBAD7sDVoks/Mi
# 0RXILHwlKXaoHV0cLToaxO8wYdd+C2D9wz0PxK+L/e8q3yBVN7Dh9tGSdQ9RtG6l
# jlriXiSBThCk7j9xjmMOE0ut119EefM2FAaK95xGTlz/kLEbBw6RFfu6r7VRwo0k
# riTGxycqoSkoGjpxKAI8LpGjwCUR4pwUR6F6aGivm6dcIFzZcbEMj7uo+MUSaJ/P
# QMtARKUT8OZkDCUIQjKyNookAv4vcn4c10lFluhZHen6dGRrsutmQ9qzsIzV6Q3d
# 9gEgzpkxYz0IGhizgZtPxpMQBvwHgfqL2vmCSfdibqFT+hKUGIUukpHqaGxEMrJm
# oecYpJpkUe8xggIoMIICJAIBATCBhjByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMM
# RGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQD
# EyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgQ29kZSBTaWduaW5nIENBAhACwXUo
# dNXChDGFKtigZGnKMAkGBSsOAwIaBQCgeDAYBgorBgEEAYI3AgEMMQowCKACgACh
# AoAAMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcCAQsxDjAM
# BgorBgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBSzz+yLLVqFPDBCsi+BQFmjwuh5
# CDANBgkqhkiG9w0BAQEFAASCAQAI3TlWQUHrQTKwuJY5pedwnfvBmc2GSTrPbMhQ
# arwpd8yDmEMl9QCuUDEcRYSyXaLoxqa5RgVpIj717MUFSmVDWPTKtXuTak23Mstv
# vl88D/cpH5fJvkdM7IA+EMdfX9q03wWMnKop84MiAdsKfyLPN+xCNx5jLy/CYOEm
# 8k8f3TrZ8z4/zZIsYiAS0kQHx1okKF4+cvYUNParzPyfWJVVhdfsquNnW3x6C1hK
# E0pI9m6gW0ZXsNn3rLwi4bc68GUuMsNQTGN4DuihFGo1OGhFt8OZ40lTglfYWmVr
# pepNkgAGQFJLoYWlWMuCOUFbcqfA2XU88s9M1sAfrjY69mLj
# SIG # End signature block


================================================
FILE: codecov.yml
================================================
codecov:
  require_ci_to_pass: no
  # main should be the baseline for reporting
  branch: main

comment:
  layout: "reach, diff, flags, files"
  behavior: default

coverage:
  range: 50..80
  round: down
  precision: 0

  status:
    project:
      default:
        # Set the overall project code coverage requirement to 70%
        target: 70
    patch:
      default:
        # Set the pull request requirement to not regress overall coverage by more than 5%
        # and let codecov.io set the goal for the code changed in the patch.
        target: auto
        threshold: 5

# This is not needed if the module only contain class-based resources.
fixes:
  - '^\d+\.\d+\.\d+::source'  # move path "X.Y.Z" => "source"

# Use this if there are paths that should not be part of the code coverage, for
# example a deprecated function where tests has been removed.
#ignore:
#  - 'source/Public/Get-Deprecated.ps1'



================================================
FILE: containers/JessAndBeard.psm1
================================================
# TODO remove all the training day code :-)
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '', Justification = 'Because this is just for testing and developing')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingWriteHost', '', Justification = 'Because this is for the prompt and it is required')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'containers', Justification = 'Because it is a global variable used later')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'SQLInstances', Justification = 'Because it is a global variable used later')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'currentAccountName', Justification = 'Because silly script analyuser cant see it is used')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'v4code', Justification = 'Because silly script analyuser cant see it is used')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'v5code', Justification = 'Because silly script analyuser cant see it is used')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'originalCodeMessage', Justification = 'Because silly script analyuser cant see it is used')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'cred', Justification = 'Because silly script analyuser cant see it is used')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidGlobalVars', 'Global:allofTheThings', Justification = 'Dont tell me what to do')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidGlobalVars', 'Global:Italwaysis', Justification = 'Dont tell me what to do')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidGlobalVars', 'Global:v4code', Justification = 'Dont tell me what to do')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidGlobalVars', 'Global:v5code', Justification = 'Dont tell me what to do')]
[CmdletBinding()]
param()
#region words
$ShallWePLayAGame = @"

  _____ _           _ _  __          __    _____  _                           _____                     ___
 / ____| |         | | | \ \        / /   |  __ \| |                 /\      / ____|                   |__ \
| (___ | |__   __ _| | |  \ \  /\  / /__  | |__) | | __ _ _   _     /  \    | |  __  __ _ _ __ ___   ___  ) |
 \___ \| '_ \ / _` | | |   \ \/  \/ / _ \ |  ___/| |/ _` | | | |   / /\ \   | | |_ |/ _` | '_ ` _ \ / _ \/ /
 ____) | | | | (_| | | |    \  /\  /  __/ | |    | | (_| | |_| |  / ____ \  | |__| | (_| | | | | | |  __/_|
|_____/|_| |_|\__,_|_|_|     \/  \/ \___| |_|    |_|\__,_|\__, | /_/    \_\  \_____|\__,_|_| |_| |_|\___(_)
                                                           __/ |
                                                          |___/
"@
#ANSI Shadow https://patorjk.com/software/taag/#p=testall&f=Doom&t=Shall%20We%20Play%20A%20Game%3F
$ShallWePLayAGame = @"

 ███████╗██╗  ██╗ █████╗ ██╗     ██╗         ██╗    ██╗███████╗    ██████╗ ██╗      █████╗ ██╗   ██╗     █████╗      ██████╗  █████╗ ███╗   ███╗███████╗██████╗
 ██╔════╝██║  ██║██╔══██╗██║     ██║         ██║    ██║██╔════╝    ██╔══██╗██║     ██╔══██╗╚██╗ ██╔╝    ██╔══██╗    ██╔════╝ ██╔══██╗████╗ ████║██╔════╝╚════██╗
 ███████╗███████║███████║██║     ██║         ██║ █╗ ██║█████╗      ██████╔╝██║     ███████║ ╚████╔╝     ███████║    ██║  ███╗███████║██╔████╔██║█████╗    ▄███╔╝
 ╚════██║██╔══██║██╔══██║██║     ██║         ██║███╗██║██╔══╝      ██╔═══╝ ██║     ██╔══██║  ╚██╔╝      ██╔══██║    ██║   ██║██╔══██║██║╚██╔╝██║██╔══╝    ▀▀══╝
 ███████║██║  ██║██║  ██║███████╗███████╗    ╚███╔███╔╝███████╗    ██║     ███████╗██║  ██║   ██║       ██║  ██║    ╚██████╔╝██║  ██║██║ ╚═╝ ██║███████╗  ██╗
 ╚══════╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚══════╝     ╚══╝╚══╝ ╚══════╝    ╚═╝     ╚══════╝╚═╝  ╚═╝   ╚═╝       ╚═╝  ╚═╝     ╚═════╝ ╚═╝  ╚═╝╚═╝     ╚═╝╚══════╝  ╚═╝


"@

$OhNo1 = @"
 ██████  ██░ ██  ▄▄▄       ██▓     ██▓        █     █░▓█████     ██▓███   ██▓    ▄▄▄     ▓██   ██▓    ▄▄▄           ▄████  ▄▄▄       ███▄ ▄███▓▓█████
▒██    ▒ ▓██░ ██▒▒████▄    ▓██▒    ▓██▒       ▓█░ █ ░█░▓█   ▀    ▓██░  ██▒▓██▒   ▒████▄    ▒██  ██▒   ▒████▄        ██▒ ▀█▒▒████▄    ▓██▒▀█▀ ██▒▓█   ▀
░ ▓██▄   ▒██▀▀██░▒██  ▀█▄  ▒██░    ▒██░       ▒█░ █ ░█ ▒███      ▓██░ ██▓▒▒██░   ▒██  ▀█▄   ▒██ ██░   ▒██  ▀█▄     ▒██░▄▄▄░▒██  ▀█▄  ▓██    ▓██░▒███
  ▒   ██▒░▓█ ░██ ░██▄▄▄▄██ ▒██░    ▒██░       ░█░ █ ░█ ▒▓█  ▄    ▒██▄█▓▒ ▒▒██░   ░██▄▄▄▄██  ░ ▐██▓░   ░██▄▄▄▄██    ░▓█  ██▓░██▄▄▄▄██ ▒██    ▒██ ▒▓█  ▄
▒██████▒▒░▓█▒░██▓ ▓█   ▓██▒░██████▒░██████▒   ░░██▒██▓ ░▒████▒   ▒██▒ ░  ░░██████▒▓█   ▓██▒ ░ ██▒▓░    ▓█   ▓██▒   ░▒▓███▀▒ ▓█   ▓██▒▒██▒   ░██▒░▒████▒
▒ ▒▓▒ ▒ ░ ▒ ░░▒░▒ ▒▒   ▓▒█░░ ▒░▓  ░░ ▒░▓  ░   ░ ▓░▒ ▒  ░░ ▒░ ░   ▒▓▒░ ░  ░░ ▒░▓  ░▒▒   ▓▒█░  ██▒▒▒     ▒▒   ▓▒█░    ░▒   ▒  ▒▒   ▓▒█░░ ▒░   ░  ░░░ ▒░ ░
░ ░▒  ░ ░ ▒ ░▒░ ░  ▒   ▒▒ ░░ ░ ▒  ░░ ░ ▒  ░     ▒ ░ ░   ░ ░  ░   ░▒ ░     ░ ░ ▒  ░ ▒   ▒▒ ░▓██ ░▒░      ▒   ▒▒ ░     ░   ░   ▒   ▒▒ ░░  ░      ░ ░ ░  ░
░  ░  ░   ░  ░░ ░  ░   ▒     ░ ░     ░ ░        ░   ░     ░      ░░         ░ ░    ░   ▒   ▒ ▒ ░░       ░   ▒      ░ ░   ░   ░   ▒   ░      ░      ░
      ░   ░  ░  ░      ░  ░    ░  ░    ░  ░       ░       ░  ░                ░  ░     ░  ░░ ░              ░  ░         ░       ░  ░       ░      ░  ░
                                                                                           ░ ░
"@

$OhNo2 = @"

▄████  ▒█████   ▒█████  ▓█████▄     ▄▄▄▄ ▓██   ██▓▓█████
██▒ ▀█▒▒██▒  ██▒▒██▒  ██▒▒██▀ ██▌   ▓█████▄▒██  ██▒▓█   ▀
▒██░▄▄▄░▒██░  ██▒▒██░  ██▒░██   █▌   ▒██▒ ▄██▒██ ██░▒███
░▓█  ██▓▒██   ██░▒██   ██░░▓█▄   ▌   ▒██░█▀  ░ ▐██▓░▒▓█  ▄
░▒▓███▀▒░ ████▓▒░░ ████▓▒░░▒████▓    ░▓█  ▀█▓░ ██▒▓░░▒████▒
░▒   ▒ ░ ▒░▒░▒░ ░ ▒░▒░▒░  ▒▒▓  ▒    ░▒▓███▀▒ ██▒▒▒ ░░ ▒░ ░
 ░   ░   ░ ▒ ▒░   ░ ▒ ▒░  ░ ▒  ▒    ▒░▒   ░▓██ ░▒░  ░ ░  ░
░ ░   ░ ░ ░ ░ ▒  ░ ░ ░ ▒   ░ ░  ░     ░    ░▒ ▒ ░░     ░
     ░     ░ ░      ░ ░     ░        ░     ░ ░        ░  ░
                          ░               ░░ ░
▄▄▄█████▓ ██░ ██ ▓█████    ▓█████  ███▄    █ ▓█████▄
▓  ██▒ ▓▒▓██░ ██▒▓█   ▀    ▓█   ▀  ██ ▀█   █ ▒██▀ ██▌
▒ ▓██░ ▒░▒██▀▀██░▒███      ▒███   ▓██  ▀█ ██▒░██   █▌
░ ▓██▓ ░ ░▓█ ░██ ▒▓█  ▄    ▒▓█  ▄ ▓██▒  ▐▌██▒░▓█▄   ▌
 ▒██▒ ░ ░▓█▒░██▓░▒████▒   ░▒████▒▒██░   ▓██░░▒████▓
 ▒ ░░    ▒ ░░▒░▒░░ ▒░ ░   ░░ ▒░ ░░ ▒░   ▒ ▒  ▒▒▓  ▒
   ░     ▒ ░▒░ ░ ░ ░  ░    ░ ░  ░░ ░░   ░ ▒░ ░ ▒  ▒
 ░       ░  ░░ ░   ░         ░      ░   ░ ░  ░ ░  ░
         ░  ░  ░   ░  ░      ░  ░         ░    ░
                                             ░

"@
$ChooseYourgame = @"

 ██████ ██   ██  ██████   ██████  ███████ ███████     ██    ██  ██████  ██    ██ ██████       ██████   █████  ███    ███ ███████
██      ██   ██ ██    ██ ██    ██ ██      ██           ██  ██  ██    ██ ██    ██ ██   ██     ██       ██   ██ ████  ████ ██          ██
██      ███████ ██    ██ ██    ██ ███████ █████         ████   ██    ██ ██    ██ ██████      ██   ███ ███████ ██ ████ ██ █████          █████
██      ██   ██ ██    ██ ██    ██      ██ ██             ██    ██    ██ ██    ██ ██   ██     ██    ██ ██   ██ ██  ██  ██ ██          ██
 ██████ ██   ██  ██████   ██████  ███████ ███████        ██     ██████   ██████  ██   ██      ██████  ██   ██ ██      ██ ███████
"@
$wrongChoice = @"

 █     █░ ██▀███   ▒█████   ███▄    █   ▄████
▓█░ █ ░█░▓██ ▒ ██▒▒██▒  ██▒ ██ ▀█   █  ██▒ ▀█▒
▒█░ █ ░█ ▓██ ░▄█ ▒▒██░  ██▒▓██  ▀█ ██▒▒██░▄▄▄░
░█░ █ ░█ ▒██▀▀█▄  ▒██   ██░▓██▒  ▐▌██▒░▓█  ██▓
░░██▒██▓ ░██▓ ▒██▒░ ████▓▒░▒██░   ▓██░░▒▓███▀▒
░ ▓░▒ ▒  ░ ▒▓ ░▒▓░░ ▒░▒░▒░ ░ ▒░   ▒ ▒  ░▒   ▒
  ▒ ░ ░    ░▒ ░ ▒░  ░ ▒ ▒░ ░ ░░   ░ ▒░  ░   ░
  ░   ░    ░░   ░ ░ ░ ░ ▒     ░   ░ ░ ░ ░   ░
    ░       ░         ░ ░           ░       ░

 ▄████▄   ██░ ██  ▒█████   ██▓ ▄████▄  ▓█████
▒██▀ ▀█  ▓██░ ██▒▒██▒  ██▒▓██▒▒██▀ ▀█  ▓█   ▀
▒▓█    ▄ ▒██▀▀██░▒██░  ██▒▒██▒▒▓█    ▄ ▒███
▒▓▓▄ ▄██▒░▓█ ░██ ▒██   ██░░██░▒▓▓▄ ▄██▒▒▓█  ▄
▒ ▓███▀ ░░▓█▒░██▓░ ████▓▒░░██░▒ ▓███▀ ░░▒████▒
░ ░▒ ▒  ░ ▒ ░░▒░▒░ ▒░▒░▒░ ░▓  ░ ░▒ ▒  ░░░ ▒░ ░
  ░  ▒    ▒ ░▒░ ░  ░ ▒ ▒░  ▒ ░  ░  ▒    ░ ░  ░
░         ░  ░░ ░░ ░ ░ ▒   ▒ ░░           ░
░ ░       ░  ░  ░    ░ ░   ░  ░ ░         ░  ░
░                             ░
"@
$Global:allofTheThings = @"
 ▄▄▄       ██▓     ██▓        ▒█████    █████▒   ▄▄▄█████▓ ██░ ██ ▓█████
▒████▄    ▓██▒    ▓██▒       ▒██▒  ██▒▓██   ▒    ▓  ██▒ ▓▒▓██░ ██▒▓█   ▀
▒██  ▀█▄  ▒██░    ▒██░       ▒██░  ██▒▒████ ░    ▒ ▓██░ ▒░▒██▀▀██░▒███
░██▄▄▄▄██ ▒██░    ▒██░       ▒██   ██░░▓█▒  ░    ░ ▓██▓ ░ ░▓█ ░██ ▒▓█  ▄
 ▓█   ▓██▒░██████▒░██████▒   ░ ████▓▒░░▒█░         ▒██▒ ░ ░▓█▒░██▓░▒████▒
 ▒▒   ▓▒█░░ ▒░▓  ░░ ▒░▓  ░   ░ ▒░▒░▒░  ▒ ░         ▒ ░░    ▒ ░░▒░▒░░ ▒░ ░
  ▒   ▒▒ ░░ ░ ▒  ░░ ░ ▒  ░     ░ ▒ ▒░  ░             ░     ▒ ░▒░ ░ ░ ░  ░
  ░   ▒     ░ ░     ░ ░      ░ ░ ░ ▒   ░ ░         ░       ░  ░░ ░   ░
      ░  ░    ░  ░    ░  ░       ░ ░                       ░  ░  ░   ░  ░

            ▄▄▄█████▓ ██░ ██  ██▓ ███▄    █   ▄████   ██████
            ▓  ██▒ ▓▒▓██░ ██▒▓██▒ ██ ▀█   █  ██▒ ▀█▒▒██    ▒
            ▒ ▓██░ ▒░▒██▀▀██░▒██▒▓██  ▀█ ██▒▒██░▄▄▄░░ ▓██▄
            ░ ▓██▓ ░ ░▓█ ░██ ░██░▓██▒  ▐▌██▒░▓█  ██▓  ▒   ██▒
              ▒██▒ ░ ░▓█▒░██▓░██░▒██░   ▓██░░▒▓███▀▒▒██████▒▒
              ▒ ░░    ▒ ░░▒░▒░▓  ░ ▒░   ▒ ▒  ░▒   ▒ ▒ ▒▓▒ ▒ ░
                ░     ▒ ░▒░ ░ ▒ ░░ ░░   ░ ▒░  ░   ░ ░ ░▒  ░ ░
              ░       ░  ░░ ░ ▒ ░   ░   ░ ░ ░ ░   ░ ░  ░  ░
                      ░  ░  ░ ░           ░       ░       ░

"@

$Global:Italwaysis = @"

██▓▄▄▄█████▓  ██████     ▄▄▄       ██▓     █     █░ ▄▄▄     ▓██   ██▓  ██████
▓██▒▓  ██▒ ▓▒▒██    ▒    ▒████▄    ▓██▒    ▓█░ █ ░█░▒████▄    ▒██  ██▒▒██    ▒
▒██▒▒ ▓██░ ▒░░ ▓██▄      ▒██  ▀█▄  ▒██░    ▒█░ █ ░█ ▒██  ▀█▄   ▒██ ██░░ ▓██▄
░██░░ ▓██▓ ░   ▒   ██▒   ░██▄▄▄▄██ ▒██░    ░█░ █ ░█ ░██▄▄▄▄██  ░ ▐██▓░  ▒   ██▒
░██░  ▒██▒ ░ ▒██████▒▒    ▓█   ▓██▒░██████▒░░██▒██▓  ▓█   ▓██▒ ░ ██▒▓░▒██████▒▒
░▓    ▒ ░░   ▒ ▒▓▒ ▒ ░    ▒▒   ▓▒█░░ ▒░▓  ░░ ▓░▒ ▒   ▒▒   ▓▒█░  ██▒▒▒ ▒ ▒▓▒ ▒ ░
 ▒ ░    ░    ░ ░▒  ░ ░     ▒   ▒▒ ░░ ░ ▒  ░  ▒ ░ ░    ▒   ▒▒ ░▓██ ░▒░ ░ ░▒  ░ ░
 ▒ ░  ░      ░  ░  ░       ░   ▒     ░ ░     ░   ░    ░   ▒   ▒ ▒ ░░  ░  ░  ░
 ░                 ░           ░  ░    ░  ░    ░          ░  ░░ ░           ░
                                                              ░ ░
▄▄▄█████▓ ██░ ██  ██▀███  ▓█████ ▓█████     ▄▄▄       ███▄ ▄███▓
▓  ██▒ ▓▒▓██░ ██▒▓██ ▒ ██▒▓█   ▀ ▓█   ▀    ▒████▄    ▓██▒▀█▀ ██▒
▒ ▓██░ ▒░▒██▀▀██░▓██ ░▄█ ▒▒███   ▒███      ▒██  ▀█▄  ▓██    ▓██░
░ ▓██▓ ░ ░▓█ ░██ ▒██▀▀█▄  ▒▓█  ▄ ▒▓█  ▄    ░██▄▄▄▄██ ▒██    ▒██
  ▒██▒ ░ ░▓█▒░██▓░██▓ ▒██▒░▒████▒░▒████▒    ▓█   ▓██▒▒██▒   ░██▒
  ▒ ░░    ▒ ░░▒░▒░ ▒▓ ░▒▓░░░ ▒░ ░░░ ▒░ ░    ▒▒   ▓▒█░░ ▒░   ░  ░
    ░     ▒ ░▒░ ░  ░▒ ░ ▒░ ░ ░  ░ ░ ░  ░     ▒   ▒▒ ░░  ░      ░
  ░       ░  ░░ ░  ░░   ░    ░      ░        ░   ▒   ░      ░
          ░  ░  ░   ░        ░  ░   ░  ░         ░  ░       ░

"@
#endregion

# If we are not using the config files because they take too long even though they are the correct wya to do things
# we don't need this replace inhere
# [version]$dbachecksversioninconfig = (Get-DbcConfigValue -Name app.checkrepos).Split('/')[-1].Split('\')[0]
# [version]$dbachecksmodulevarsion = (Get-Module dbachecks).Version
#
# if ($dbachecksmodulevarsion -ne $dbachecksversioninconfig) {
#   Get-ChildItem /workspace/Demos/dbachecksconfigs/*.json | ForEach-Object {
#     (Get-Content -Path $_.FullName) -replace $dbachecksversioninconfig, $dbachecksmodulevarsion | Set-Content $_.FullName
#   }
# }
function Start-Game {
  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Justification = 'Dont tell me what to do')]
  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'Clear-Host', Justification = 'Dont tell me what to do')]
  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'cls', Justification = 'Dont tell me what to do')]
  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingCmdletAliases', 'cls', Justification = 'Dont tell me what to do')]
  [CmdletBinding()]
  param()
  #region set-up
  # Because we are using volumes for the restore demo, need to ensure they are clean before starting the game
  Remove-Item '/var/opt/backups/dbachecks1' -Recurse -Force -ErrorAction SilentlyContinue

  $securePassword = ('dbatools.IO' | ConvertTo-SecureString -AsPlainText -Force)
  $containercredential = New-Object System.Management.Automation.PSCredential('sqladmin', $securePassword)

  New-DbaDatabase -SqlInstance $dbachecks1 -SqlCredential $containercredential -Name Validation -RecoveryModel Full -WarningAction SilentlyContinue | Out-Null

  # we need an app login
  $Password = ConvertTo-SecureString PubsAdmin -AsPlainText -Force
  New-DbaLogin -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Login PubsAdmin -SecurePassword $Password -WarningAction SilentlyContinue | Out-Null
  New-DbaDbUser -SqlInstance $dbachecks1 -SqlCredential $containercredential -Database Pubs -Login PubsAdmin -Username PubsAdmin -WarningAction SilentlyContinue | Out-Null
  Add-DbaDbRoleMember -SqlInstance $dbachecks1 -SqlCredential $containercredential -Database Pubs -User PubsAdmin -Role db_owner -Confirm:$false | Out-Null

  # Let's add some things to find
  Invoke-DbaQuery -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Northwind -WarningAction SilentlyContinue -Query "
  CREATE PROCEDURE SP_FindMe AS BEGIN
    with cte as (
      select top 1 OrderID, ProductID
      FROM dbo.[Order Details]
      ORDER BY NEWID()
    )
    DELETE
    FROM cte
  END

  GO

  CREATE TRIGGER dbo.trg_chaos_monkey
    ON  dbo.[order details]
    INSTEAD OF UPDATE
  AS
  BEGIN
    print 'no update for you'
  END
  GO
  CREATE FUNCTION udf_FindMe
  (@test int = 1)
  RETURNS int
  AS
  -- For the order details
  BEGIN
    RETURN @test
  END"

  # Add a failed job
  $job = New-DbaAgentJob -SqlInstance $dbachecks2 -SqlCredential $containercredential -Job IamBroke -WarningAction SilentlyContinue
  if ($job) {
    $null = New-DbaAgentJobStep -SqlInstance $dbachecks2 -SqlCredential $containercredential -Job $job.Name -Subsystem TransactSql -Command 'Select * from MissingTable' -StepName 'Step One'
    $null = $job | Start-DbaAgentJob
  }


  #endregion

  Clear-Host # dont use cls here
  $title = "Joshua Says"
  $yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", "Will continue"
  $no = New-Object System.Management.Automation.Host.ChoiceDescription "&No", "Will exit"
  $options = [System.Management.Automation.Host.ChoiceDescription[]]($yes, $no)
  $result = $host.ui.PromptForChoice($title, $ShallWePLayAGame, $options, 0)

  if ($result -eq 1) {
    cls
    Write-Output $OhNo1
    Start-Sleep -Seconds 1
    cls
    Start-Sleep -Milliseconds 250
    Write-Output $OhNo2
  } elseif ($result -eq 0) {
    Clear-Host # Dont use cls here
    Get-Index
  }
}

function Get-Index {
  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Justification = 'Dont tell me what to do')]
  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'Clear-Host', Justification = 'Dont tell me what to do')]
  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'cls', Justification = 'Dont tell me what to do')]
  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingCmdletAliases', 'cls', Justification = 'Dont tell me what to do')]
  [CmdletBinding()]
  param()
  cls
  Write-Output $ChooseYourgame
  $gameChapters = @(
    ("&1 - Introduction to dbatools", "1 - Introduction to dbatools"),
    ("&2 - Backup and Restore", "2 - Backup and Restore"),
    ("&3 - Copy Copy Copy", "3 - Copy Copy Copy"),
    ("&4 - Snapshots", "4 - Snapshots"),
    ("&5 - Export", "5 - Export"),
    ("&6 - Availability Groups", "6 - Availability Groups"),
    ("&7 - Finding Things", "7 - Finding Things"),
    ("&8 - Data Masking", "8 - Data Masking"),
    ("&9 - Logins", "9 - Logins"),
    ("&M - Advanced Migrations", "10 - Advanced Migrations"),
    ("&R - Registered Servers", "11 - Registered Servers"),
    ("&C - Estate Validation", "12 - Estate Validation"),
    ("&T - TIC TAC TOE", "98 - TIC TAC TOE"),
    ("&Q - Quit", "Quit")
  )

  $options = New-Object System.Collections.ObjectModel.Collection[System.Management.Automation.Host.ChoiceDescription]

  foreach ($Chapter in $gameChapters) {
    $message = '{0}' -f $chapter[1]
    Write-Output $message
    $options.Add((New-Object System.Management.Automation.Host.ChoiceDescription $Chapter ) )
  }
  $title = "Joshua Says"
  $IndexChoice = $host.ui.PromptForChoice($title, "Make Your Choice", $options, 0) + 1

  switch ($IndexChoice) {
    1 {
      cls
      code /workspace/Demos/01-introduction.ps1
      #reset and run tests
      Write-PSFHostColor -String "It was a dark and stormy morning and ripe for learning about dbatools" -DefaultColor DarkCyan
      Write-PSFHostColor -String "The teachers arrived in the class first thing and ran some tests" -DefaultColor DarkYellow
      Write-PSFHostColor -String "They needed to ensure that nothing was wrong before" -DefaultColor DarkRed
      Write-PSFHostColor -String "The Introduction to dbatools" -DefaultColor DarkMagenta
      Write-PSFHostColor -String "Narrator - The Tests are running" -DefaultColor Blue
      Assert-Correct -chapter intro
      Get-GameTimeRemaining
    }
    2 {
      cls
      code /workspace/Demos/02-BackUpRestore.ps1
      Write-PSFHostColor -String "All the students knew that backups and restores were so very important" -DefaultColor DarkCyan
      Write-PSFHostColor -String "To ensure the safety and security of their employees data" -DefaultColor DarkYellow
      Write-PSFHostColor -String "The instructors need to ensure that everything is ok before" -DefaultColor DarkRed
      Write-PSFHostColor -String "2 - Backup and Restore" -DefaultColor DarkMagenta
      Write-PSFHostColor -String "Narrator - The Tests are running" -DefaultColor Blue
      Assert-Correct -chapter Backup
      Get-GameTimeRemaining
    }
    3 {
      cls
      code /workspace/Demos/03-CopyCopy.ps1
      Write-PSFHostColor -String "Entering this chapter carefully" -DefaultColor DarkCyan
      Write-PSFHostColor -String "the players realised that is all looked the same" -DefaultColor DarkYellow
      Write-PSFHostColor -String "It's almost like it has been copied over" -DefaultColor DarkRed
      Write-PSFHostColor -String "3 - Copy Copy Copy" -DefaultColor DarkMagenta
      Write-PSFHostColor -String "Narrator - The Tests are running" -DefaultColor Blue
      Assert-Correct -chapter Copy
      Get-GameTimeRemaining
    }
    4 {
      cls
      code /workspace/Demos/04-Snapshots.ps1
      Write-PSFHostColor -String "The sound of a gun echoed down the corridor" -DefaultColor DarkCyan
      Write-PSFHostColor -String "But as the mist cleared they realised that it was not that sort of shot" -DefaultColor DarkYellow
      Write-PSFHostColor -String "Welcome, said the deep voice, come on in" -DefaultColor DarkRed
      Write-PSFHostColor -String "4 - SnapShots"  -DefaultColor DarkMagenta
      Write-PSFHostColor -String "Narrator - The Tests are running" -DefaultColor Blue
      Assert-Correct -chapter SnapShots
      Get-GameTimeRemaining
    }
    6 {
      cls
      code /workspace/Demos/06-AvailabilityGroups.ps1
      Write-PSFHostColor -String "The noise was getting louder" -DefaultColor DarkCyan
      Write-PSFHostColor -String "This machine can no longer take the strain of the app and the reporting" -DefaultColor DarkYellow
      Write-PSFHostColor -String "I need many copies of this data the voice shouted and quickly now" -DefaultColor DarkRed
      Write-PSFHostColor -String "6 - Availability Groups"  -DefaultColor DarkMagenta
      Write-PSFHostColor -String "Narrator - The Tests are running" -DefaultColor Blue
      Assert-Correct -chapter Ags
      Get-GameTimeRemaining
    }
    5 {
      cls
      code /workspace/Demos/05-Export.ps1
      Write-PSFHostColor -String "As they stomped through the swamp" -DefaultColor DarkCyan
      Write-PSFHostColor -String "They wished the path was easier" -DefaultColor DarkYellow
      Write-PSFHostColor -String "If only someone had written it all down where it could be found.........." -DefaultColor DarkRed
      Write-PSFHostColor -String "5 - Export"  -DefaultColor DarkMagenta
      Write-PSFHostColor -String "Narrator - The Tests are running" -DefaultColor Blue
      Assert-Correct -chapter Export
      Get-GameTimeRemaining
    }
    7 {
      cls
      code /workspace/Demos/07-FindingThings.ps1
      Write-PSFHostColor -String "Lost, said the wispy voices" -DefaultColor DarkCyan
      Write-PSFHostColor -String "and unless you can locate the right things" -DefaultColor DarkYellow
      Write-PSFHostColor -String "~~~~~~~  YOU SHALL BE LOST FOREVER  ~~~~~~~" -DefaultColor DarkRed
      Write-PSFHostColor -String "7 - Finding Things"  -DefaultColor DarkMagenta
      Write-PSFHostColor -String "Narrator - The Tests are running" -DefaultColor Blue

      Assert-Correct -chapter Found
      Get-GameTimeRemaining
    }
    8 {
      cls
      code /workspace/Demos/08-DataMasking.ps1
      Write-PSFHostColor -String "They could hear them rushing towards them" -DefaultColor DarkCyan
      Write-PSFHostColor -String "shouting and hollering in a dreadful manner" -DefaultColor DarkYellow
      Write-PSFHostColor -String "But what was on those faces? Are those ....... Masks?" -DefaultColor DarkRed
      Write-PSFHostColor -String "8 - Data Masking"  -DefaultColor DarkMagenta
      Write-PSFHostColor -String "Narrator - The Tests are running" -DefaultColor Blue
      Assert-Correct -chapter Masking
      Get-GameTimeRemaining
    }
    9 {
      cls
      code /workspace/Demos/09-Logins.ps1
      Write-PSFHostColor -String "They saw a house in the distance and picked up speed" -DefaultColor DarkCyan
      Write-PSFHostColor -String "A massive wooden door faced them, they rang the bell" -DefaultColor DarkYellow
      Write-PSFHostColor -String "The monsters were close though ~~~ LET US IN" -DefaultColor DarkRed
      Write-PSFHostColor -String "PLEASE ~~~ LET US IN" -DefaultColor DarkRed
      Write-PSFHostColor -String "9 - Logins"  -DefaultColor DarkMagenta
      Write-PSFHostColor -String "Narrator - The Tests are running" -DefaultColor Blue
      Assert-Correct -chapter Logins
      Get-GameTimeRemaining
    }
    #even though you choose M
    10 {
      cls
      Write-Output "10 - Advanced Migrations"
      code /workspace/Demos/10-AdvancedMigrations.ps1

      Write-PSFHostColor -String "Just running some tests a mo" -DefaultColor Green
      Assert-Correct -chapter AdvMigration
      Get-GameTimeRemaining

      Write-PSFHostColor -String "we also need an app to run in the background" -DefaultColor Green
      Write-PSFHostColor -String "In a new session run Invoke-PubsApplication" -DefaultColor Green
    }
    #even though you choose R
    11 {
      cls
      Write-Output "11 - Registered Servers"
      code /workspace/Demos/11-RegisteredServers.ps1

      Write-PSFHostColor -String "Just running some tests a mo" -DefaultColor Green
      # Assert-Correct -chapter RegisterdServers
      Get-GameTimeRemaining
    }
    #even though you choose C
    12 {
      cls
      Write-Output "12 - Estate Validation"
      code /workspace/Demos/12-EstateValidation.ps1

      Write-PSFHostColor -String "Just running some tests a mo" -DefaultColor Green
      # Assert-Correct -chapter RegisterdServers
      Get-GameTimeRemaining
    }
    # even though you choose G
    14 {
      cls
      $Message = ' GREETINGS PROFESSOR FALKEN

      HELLO

      A STRANGE GAME.
      THE ONLY WINNING MOVE IS NOT TO PLAY.

      HOW ABOUT A NICE GAME OF CHESS?
                                                                       '
      Write-Host $message -BackgroundColor 03fcf4 -ForegroundColor Black
    }
    # even though you choose T
    13 {
      Start-TicTacToe
    }
    'q' {
      cls
    }
    Default {
      cls
      Write-Output $wrongChoice
      Start-Sleep -Seconds 1
      cls
      Start-Sleep -Milliseconds 250
      Write-Output $OhNo2
      $message = "You chose - {0}" -f $IndexChoice
      Write-Output $message
    }
  }
}

function Set-ConnectionInfo {
  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Justification = 'Dont tell me what to do')]
  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'Clear-Host', Justification = 'Dont tell me what to do')]
  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'cls', Justification = 'Dont tell me what to do')]
  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingCmdletAliases', 'cls', Justification = 'Dont tell me what to do')]
  [CmdletBinding()]
  param()
  #region Set up connection
  $securePassword = ('dbatools.IO' | ConvertTo-SecureString -AsPlainText -Force)
  $containercredential = New-Object System.Management.Automation.PSCredential('sqladmin', $securePassword)

  #$Global:PSDefaultParameterValues = @{
  #  "*dba*:SqlCredential"            = $containercredential
  #  "*dba*:SourceSqlCredential"      = $containercredential
  #  "*dba*:DestinationSqlCredential" = $containercredential
  #  "*dba*:DestinationCredential"    = $containercredential
  #  "*dba*:PrimarySqlCredential"     = $containercredential
  #  "*dba*:SecondarySqlCredential"   = $containercredential
  #}


  $containers = $SQLInstances = $dbachecks1, $dbachecks2, $dbachecks3 = 'dbachecks1', 'dbachecks2', 'dbachecks3'
  #endregion
}

Set-ConnectionInfo

function Set-FailedTestMessage {
  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Justification = 'Dont tell me what to do')]
  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'Clear-Host', Justification = 'Dont tell me what to do')]
  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'Out-GridView', Justification = 'Dont tell me what to do')]
  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'cls', Justification = 'Dont tell me what to do')]
  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingCmdletAliases', 'cls', Justification = 'Dont tell me what to do')]
  [CmdletBinding()]
  param()
  $FailedTests = ($results.FailedCount | Measure-Object -Sum).Sum
  if ($FailedTests -gt 0) {
    Write-PSFHostColor -String "NARRATOR - A thing went wrong" -DefaultColor DarkMagenta
    Write-PSFHostColor -String "NARRATOR - It MUST be fixed before we can continue" -DefaultColor DarkMagenta
    $Failures = $results.TestResult | Where-Object Result -EQ 'Failed' | Select-Object Describe, Context, Name, FailureMessage
    $Failures.ForEach{
      $Message = '{0} at {1} in {2}' -f $_.FailureMessage, $_.Name, $_.Describe
      Write-PSFHostColor -String $Message -DefaultColor DarkCyan
    }
  }
}
function Assert-Correct {
  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Justification = 'Dont tell me what to do')]
  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'Clear-Host', Justification = 'Dont tell me what to do')]
  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'cls', Justification = 'Dont tell me what to do')]
  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingCmdletAliases', 'cls', Justification = 'Dont tell me what to do')]
  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'results', Justification = 'Because it is a global variable used later')]

  [CmdletBinding()]
  param (
    # Parameter help description
    [Parameter()]
    [ValidateSet(
      'initial',
      'Intro' ,
      'Backup',
      'Copy',
      'SnapShots',
      'Export',
      'Ags',
      'Found',
      'Masking',
      'Logins',
      'AdvMigration'
    )]
    [string]
    $chapter = 'initial'
  )
  # $Global:PSDefaultParameterValues.CLear()
  switch ($chapter) {
    'initial' {
      # Valid estate is as we expect

      $null = Reset-DbcConfig
      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $true  # so we dont get silly output from convert-dbcresult

      Set-DbcConfig -Name app.sqlinstance -Value $containers
      Set-DbcConfig -Name policy.connection.authscheme -Value 'SQL'
      Set-DbcConfig -Name skip.connection.remoting -Value $true
      Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection -Verbose

      Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks2'
      Invoke-DbcCheck -SqlCredential $containercredential -Check DatabaseExists

      Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks1'
      Set-DbcConfig -Name database.exists -Value 'pubs', 'NorthWind' -Append
      Invoke-DbcCheck -SqlCredential $containercredential -Check DatabaseExists

      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $false  # reset
    }
    'Intro' {
      # Valid estate is as we expect

      $null = Reset-DbcConfig
      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $true  # so we dont get silly output from convert-dbcresult
      $null = Set-DbcConfig -Name app.sqlinstance -Value $containers
      $null = Set-DbcConfig -Name policy.connection.authscheme -Value 'SQL'
      $null = Set-DbcConfig -Name skip.connection.remoting -Value $true
      $check1 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection -Show Summary -PassThru
      $check1 | Convert-DbcResult -Label Intro -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation

      $null = Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks2'
      $check2 = Invoke-DbcCheck -SqlCredential $containercredential -Check DatabaseExists -Show Summary -PassThru
      $check2 | Convert-DbcResult -Label Intro -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation

      $null = Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks1'
      $null = Set-DbcConfig -Name database.exists -Value 'pubs', 'NorthWind' -Append
      $check3 = Invoke-DbcCheck -SqlCredential $containercredential -Check DatabaseExists -Show Summary -PassThru
      $check3 | Convert-DbcResult -Label Intro -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation

      $results = @($check1, $check2, $check3)
      Set-FailedTestMessage

      Write-PSFHostColor -String "Are you ready to begin your adventure?" -DefaultColor Blue
      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $false  # reset
    }
    'Backup' {
      # Valid estate is as we expect

      $null = Reset-DbcConfig
      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $true  # so we dont get silly output from convert-dbcresult
      $null = Set-DbcConfig -Name app.checkrepos -Value '/workspace/Demos/dbachecksconfigs' -Append
      $null = Set-DbcConfig -Name app.sqlinstance -Value $containers
      $null = Set-DbcConfig -Name policy.connection.authscheme -Value 'SQL'
      $null = Set-DbcConfig -Name skip.connection.remoting -Value $true
      $null = Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks2'

      $check1 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection, DatabaseExists -Show Summary -PassThru
      $check1 | Convert-DbcResult -Label Backup -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation

      $null = Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks1'
      $null = Set-DbcConfig -Name database.exists -Value 'master', 'model', 'msdb', 'Northwind', 'pubs', 'tempdb'

      $check2 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection, DatabaseExists, NoDatabasesOn1, NoBackupFiles -Show Summary -PassThru
      $check2 | Convert-DbcResult -Label Backup -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation

      $results = @($check1, $check2)
      Set-FailedTestMessage
      Write-PSFHostColor -String "Should you create a save point before this chapter?" -DefaultColor Blue
      Start-Sleep -Seconds 5
      Write-PSFHostColor -String "Or can you make it to the end?" -DefaultColor DarkRed
      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $false # reset

    }
    'Copy' {
      # Valid estate is as we expect

      $null = Reset-DbcConfig
      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $true  # so we dont get silly output from convert-dbcresult
      $null = Set-DbcConfig -Name app.checkrepos -Value '/workspace/Demos/dbachecksconfigs' -Append
      Set-DbcConfig -Name app.sqlinstance -Value $containers | Out-Null
      Set-DbcConfig -Name policy.connection.authscheme -Value 'SQL' | Out-Null
      Set-DbcConfig -Name skip.connection.remoting -Value $true | Out-Null
      Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks2' | Out-Null
      Set-DbcConfig -Name database.exists -Value 'master', 'model', 'msdb', 'tempdb' | Out-Null

      $check1 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection, DatabaseExists, NoDatabasesOn2, NeedNoLogins -Show Summary -PassThru
      $check1 | Convert-DbcResult -Label Copy -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation

      Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks1' | Out-Null
      Set-DbcConfig -Name database.exists -Value 'master', 'model', 'msdb', 'Northwind', 'pubs', 'pubs-0', 'pubs-1', 'pubs-10', 'pubs-2', 'pubs-3', 'pubs-4', 'pubs-5', 'pubs-6', 'pubs-7', 'pubs-8', 'pubs-9', 'tempdb' | Out-Null
      $check2 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection, DatabaseExists -Show Summary -PassThru
      $check2 | Convert-DbcResult -Label Copy -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation

      $results = @($check1, $check2)
      Set-FailedTestMessage
      Write-PSFHostColor -String "If you get database missing failures - Chapter 2 will be your friend" -DefaultColor Magenta
      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $false # reset
    }
    'Snapshots' {
      # Valid estate is as we expect
      Write-PSFHostColor -String "Running the SnapShot Chapter checks" -DefaultColor Green
      $null = Reset-DbcConfig
      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $true  # so we dont get silly output from convert-dbcresult
      Set-DbcConfig -Name app.checkrepos -Value '/workspace/Demos/dbachecksconfigs' -Append | Out-Null
      Set-DbcConfig -Name app.sqlinstance -Value $containers | Out-Null
      Set-DbcConfig -Name policy.connection.authscheme -Value 'SQL' | Out-Null
      Set-DbcConfig -Name skip.connection.remoting -Value $true | Out-Null
      Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks2' | Out-Null
      Set-DbcConfig -Name database.exists -Value 'master', 'model', 'msdb', 'tempdb' | Out-Null
      $check1 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection, DatabaseExists, NoDatabasesOn2, DatabaseStatus, NoSnapshots -Show Summary -PassThru
      $check1 | Convert-DbcResult -Label SnapShots -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation

      Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks1' | Out-Null
      Set-DbcConfig -Name database.exists -Value 'master', 'model', 'msdb', 'Northwind', 'pubs', 'tempdb' | Out-Null
      $check2 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection, DatabaseExists, DatabaseStatus -Show Summary -PassThru
      $check1 | Convert-DbcResult -Label SnapShots -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation
      $results = @($check1, $check2)
      Set-FailedTestMessage
      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $false # reset
    }
    'Export' {
      # Valid estate is as we expect

      $null = Reset-DbcConfig
      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $true  # so we dont get silly output from convert-dbcresult
      $null = Set-DbcConfig -Name app.sqlinstance -Value $containers
      $null = Set-DbcConfig -Name policy.connection.authscheme -Value 'SQL'
      $null = Set-DbcConfig -Name skip.connection.remoting -Value $true
      $check1 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection -Show Summary -PassThru
      $check1 | Convert-DbcResult -Label Export -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation

      $null = Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks2'
      $check2 = Invoke-DbcCheck -SqlCredential $containercredential -Check DatabaseExists -Show Summary -PassThru
      $check2 | Convert-DbcResult -Label Export -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation

      $null = Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks1'
      $null = Set-DbcConfig -Name database.exists -Value 'pubs', 'NorthWind' -Append
      $check3 = Invoke-DbcCheck -SqlCredential $containercredential -Check DatabaseExists -Show Summary -PassThru
      $check3 | Convert-DbcResult -Label Export -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation
      $results = @($check1, $check2, $check3)
      Set-FailedTestMessage
      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $false
    }
    'Ags' {
      # Valid estate is as we expect

      $null = Reset-DbcConfig
      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $true  # so we dont get silly output from convert-dbcresult
      $null = Set-DbcConfig -Name app.checkrepos -Value '/workspace/Demos/dbachecksconfigs' -Append | Out-Null
      $null = Set-DbcConfig -Name app.sqlinstance -Value $containers
      $null = Set-DbcConfig -Name policy.connection.authscheme -Value 'SQL'
      $null = Set-DbcConfig -Name skip.connection.remoting -Value $true
      $check1 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection -Show Summary -PassThru
      $check1 | Convert-DbcResult -Label AvailabilityGroups -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation

      Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks2' | Out-Null
      Set-DbcConfig -Name database.exists -Value 'master', 'model', 'msdb', 'tempdb' | Out-Null
      $check2 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection, DatabaseExists, NoDatabasesOn2, DatabaseStatus, NoSnapshots, NoAgs -Show Summary -PassThru
      $check2 | Convert-DbcResult -Label AvailabilityGroups -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation

      Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks1' | Out-Null
      Set-DbcConfig -Name database.exists -Value 'master', 'model', 'msdb', 'Northwind', 'pubs', 'pubs-0', 'pubs-1', 'pubs-10', 'pubs-2', 'pubs-3', 'pubs-4', 'pubs-5', 'pubs-6', 'pubs-7', 'pubs-8', 'pubs-9', 'tempdb' | Out-Null
      $check3 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection, DatabaseExists, DatabaseStatus -Show Summary -PassThru
      $check3 | Convert-DbcResult -Label AvailabilityGroups -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation
      $results = @($check1, $check2, $check3)
      Set-FailedTestMessage
      Write-PSFHostColor -String "If you get database missing failures - Chapter 2 will be your friend" -DefaultColor Magenta
      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $false
    }
    'AdvMigration' {
      # Valid estate is as we expect

      $null = Reset-DbcConfig
      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $true  # so we dont get silly output from convert-dbcresult
      Set-DbcConfig -Name app.checkrepos -Value '/workspace/Demos/dbachecksconfigs' -Append | Out-Null
      $null = Set-DbcConfig -Name app.sqlinstance -Value $containers
      $null = Set-DbcConfig -Name policy.connection.authscheme -Value 'SQL'
      $null = Set-DbcConfig -Name skip.connection.remoting -Value $true
      $check1 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection -Show Summary -PassThru
      $check1 | Convert-DbcResult -Label AdvancedMigration -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation

      Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks2' | Out-Null
      Set-DbcConfig -Name database.exists -Value 'master', 'model', 'msdb', 'tempdb' | Out-Null
      $check2 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection, DatabaseExists, NoDatabasesOn2, DatabaseStatus, NoSnapshots, NoAgs -Show Summary -PassThru
      $check2 | Convert-DbcResult -Label AdvancedMigration -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation

      Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks1' | Out-Null
      Set-DbcConfig -Name database.exists -Value 'master', 'model', 'msdb', 'Northwind', 'pubs', 'tempdb' | Out-Null
      $check3 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection, DatabaseExists, DatabaseStatus -Show Summary -PassThru
      $check3 | Convert-DbcResult -Label AdvancedMigration -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation

      $results = @($check1, $check2, $check3)
      Set-FailedTestMessage
      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $false
    }
    'Found' {
      # Valid estate is as we expect

      $null = Reset-DbcConfig
      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $true  # so we dont get silly output from convert-dbcresult
      Set-DbcConfig -Name app.checkrepos -Value '/workspace/Demos/dbachecksconfigs' -Append | Out-Null
      $null = Set-DbcConfig -Name app.sqlinstance -Value $containers
      $null = Set-DbcConfig -Name policy.connection.authscheme -Value 'SQL'
      $null = Set-DbcConfig -Name skip.connection.remoting -Value $true
      $check1 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection -Show Summary -PassThru
      $check1 | Convert-DbcResult -Label Found -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation

      Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks2' | Out-Null
      Set-DbcConfig -Name database.exists -Value 'master', 'model', 'msdb', 'tempdb' | Out-Null
      $check2 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection, DatabaseExists, NeedJobs, NeedFailedJobs  -Show Summary -PassThru
      $check2 | Convert-DbcResult -Label Found -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation

      Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks1' | Out-Null
      Set-DbcConfig -Name database.exists -Value 'master', 'model', 'msdb', 'Northwind', 'pubs', 'tempdb' | Out-Null
      $check3 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection, DatabaseExists, DatabaseStatus, NeedSps, NeedUDfs, NeedTriggers, NeedLogins -Show Summary -PassThru
      $check3 | Convert-DbcResult -Label Found -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation

      $results = @($check1, $check2, $check3)
      Set-FailedTestMessage
      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $false
    }
    'Masking' {
      # Valid estate is as we expect

      $null = Reset-DbcConfig
      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $true  # so we dont get silly output from convert-dbcresult
      Set-DbcConfig -Name app.checkrepos -Value '/workspace/Demos/dbachecksconfigs' -Append | Out-Null
      $null = Set-DbcConfig -Name app.sqlinstance -Value $containers
      $null = Set-DbcConfig -Name policy.connection.authscheme -Value 'SQL'
      $null = Set-DbcConfig -Name skip.connection.remoting -Value $true
      $check1 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection -Show Summary -PassThru
      $check1 | Convert-DbcResult -Label Masking -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation

      Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks2' | Out-Null
      Set-DbcConfig -Name database.exists -Value 'master', 'model', 'msdb', 'tempdb' | Out-Null
      $check2 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection, DatabaseExists -Show Summary -PassThru
      $check2 | Convert-DbcResult -Label Masking -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation

      Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks1' | Out-Null
      Set-DbcConfig -Name datab
Download .txt
gitextract_bzjyocov/

├── .devcontainer/
│   ├── codespaces/
│   │   ├── codespaces-docker-compose.yml
│   │   └── devcontainer.json
│   ├── devcontainer.json
│   └── docker-compose.yml
├── .gitattributes
├── .github/
│   ├── FUNDING.yml
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug_report.md
│   │   ├── feature_request.md
│   │   └── question.md
│   ├── Pull_Request_Template.md
│   ├── issue_template.md
│   └── workflows/
│       ├── PR-PesterTest.yml
│       ├── PR.yml
│       ├── deploy-module.yml
│       └── docker-image.yml
├── .gitignore
├── .markdownlint.json
├── .vscode/
│   ├── launch.json
│   ├── settings.json
│   └── tasks.json
├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── GitVersion.yml
├── LICENSE
├── PSScriptAnalyzerSettings.psd1
├── RELEASE.md
├── RequiredModules.psd1
├── Resolve-Dependency.ps1
├── Resolve-Dependency.psd1
├── SECURITY.md
├── azure-pipelines.yml
├── build.ps1
├── build.yaml
├── builddocs.ps1
├── codecov.yml
├── containers/
│   ├── JessAndBeard.psm1
│   ├── base/
│   │   ├── dockerfile
│   │   └── profile.ps1
│   ├── second/
│   │   └── dockerfile
│   └── third/
│       └── dockerfile
├── dbachecksdevcontainer.code-workspace
├── developing/
│   ├── Archive/
│   │   ├── Get-AllInstanceInfo testing.ps1
│   │   ├── Perf Testing pesterv5.ps1
│   │   ├── PerfAndValidate-Checks.ps1
│   │   ├── Validate v4 adn v5.ps1
│   │   ├── initfields.ps1
│   │   ├── originalGet-AllInstanceInfo.ps1
│   │   ├── pesterv5testing.ps1
│   │   └── tests/
│   │       ├── Help.Exceptions.ps1
│   │       ├── InModule.Help.Exceptions.ps1
│   │       ├── InModule.Help.Tests.ps1
│   │       ├── Integration/
│   │       │   ├── DockerTests.ps1
│   │       │   └── docker-compose.yml
│   │       ├── Project.Tests.ps1
│   │       ├── Reset-DbcConfig.Tests.ps1
│   │       ├── Test-SingleFile.ps1
│   │       ├── Unit.Tests.ps1
│   │       ├── build/
│   │       │   ├── Initialize-VstsAgentOnWindowsServerCoreContainer.ps1
│   │       │   ├── Install-VstsAgentOnWindowsServerCoreContainer.ps1
│   │       │   └── Remove-VstsAgentOnWindowsServerCoreContainer.ps1
│   │       ├── checks/
│   │       │   ├── AgentChecks.Tests.ps1
│   │       │   ├── DatabaseChecks.Tests.ps1
│   │       │   ├── InstanceChecks.Tests.ps1
│   │       │   └── ServerChecks.Tests.ps1
│   │       ├── constants.ps1
│   │       ├── functions/
│   │       │   ├── Export-DbcConfig.Tests.ps1
│   │       │   ├── Get-CheckFile.Tests.ps1
│   │       │   ├── Get-CheckInformation.tests.ps1
│   │       │   ├── Get-DatabaseDetail.Tests.ps1
│   │       │   ├── Get-DbcCheck.Tests.ps1
│   │       │   ├── Get-DbcConfig.Tests.ps1
│   │       │   ├── Get-DbcConfigValue.Tests.ps1
│   │       │   ├── Get-DbcTagCollection.Tests.ps1
│   │       │   ├── Import-DbcConfig.Tests.ps1
│   │       │   ├── Invoke-DbcCheck.Tests.ps1
│   │       │   ├── Invoke-DbcConfigFile.Tests.ps1
│   │       │   ├── Set-DbcConfig.Tests.ps1
│   │       │   ├── Set-DbcFile.Tests.ps1
│   │       │   ├── get-check.json
│   │       │   └── results.json
│   │       └── readme.md
│   ├── Howto.md
│   ├── Oslo Demo.ps1
│   ├── PSConfEU demo.md
│   ├── Robs-Instance.ps1
│   ├── Setting up for Sampler.ps1
│   └── settingupfor2022.ps1
├── docs/
│   ├── RELEASE.md
│   ├── functions/
│   │   ├── Clear-DbcPowerBiDataSource.md
│   │   ├── Convert-DbcResult.md
│   │   ├── Export-DbcConfig.md
│   │   ├── Get-DbcCheck.md
│   │   ├── Get-DbcConfig.md
│   │   ├── Get-DbcConfigValue.md
│   │   ├── Get-DbcReleaseNote.md
│   │   ├── Get-DbcTagCollection.md
│   │   ├── Import-DbcConfig.md
│   │   ├── Invoke-DbcCheck.md
│   │   ├── Invoke-DbcConfigFile.md
│   │   ├── Reset-DbcConfig.md
│   │   ├── Save-DbcRequiredModules.md
│   │   ├── Set-DbcCisConfig.md
│   │   ├── Set-DbcConfig.md
│   │   ├── Set-DbcFile.md
│   │   ├── Start-DbcPowerBi.md
│   │   ├── Update-DbcPowerBiDataSource.md
│   │   ├── Update-DbcRequiredModules.md
│   │   └── Write-DbcTable.md
│   └── index.md
├── header-mkdocs.yml
├── mkdocs.yml
├── readme.md
├── source/
│   ├── bin/
│   │   ├── dbachecks-FromDatabase.pbit
│   │   ├── dbachecks.pbit
│   │   └── dbachecks.pbix
│   ├── checks/
│   │   ├── Agent.Tests.ps1
│   │   ├── Agentv5.Tests.ps1
│   │   ├── Database.Tests.ps1
│   │   ├── Databasev5.Tests.ps1
│   │   ├── Domain.Tests.ps1
│   │   ├── HADR.Tests.ps1
│   │   ├── Instance.Tests.ps1
│   │   ├── Instancev5.Tests.ps1
│   │   ├── LogShipping.Tests.ps1
│   │   ├── MaintenanceSolution.Tests.ps1
│   │   └── Server.Tests.ps1
│   ├── dbachecks.psd1
│   ├── dbachecks.psm1
│   ├── functions/
│   │   ├── Clear-DbcPowerBiDataSource.ps1
│   │   ├── Convert-DbcResult.ps1
│   │   ├── Export-DbcConfig.ps1
│   │   ├── Get-DbcCheck.ps1
│   │   ├── Get-DbcConfig.ps1
│   │   ├── Get-DbcConfigValue.ps1
│   │   ├── Get-DbcReleaseNote.ps1
│   │   ├── Get-DbcTagCollection.ps1
│   │   ├── Import-DbcConfig.ps1
│   │   ├── Invoke-DbcCheck.ps1
│   │   ├── Invoke-DbcConfigFile.ps1
│   │   ├── Reset-DbcConfig.ps1
│   │   ├── Save-DbcRequiredModules.ps1
│   │   ├── Set-DbcCisConfig.ps1
│   │   ├── Set-DbcConfig.ps1
│   │   ├── Set-DbcFile.ps1
│   │   ├── Start-DbcPowerBi.ps1
│   │   ├── Update-DbcPowerBiDataSource.ps1
│   │   ├── Update-DbcRequiredModules.ps1
│   │   └── Write-DbcTable.ps1
│   ├── internal/
│   │   ├── assertions/
│   │   │   ├── Agent.Assertions.ps1
│   │   │   ├── Database.Assertions.ps1
│   │   │   ├── Instance.Assertions.ps1
│   │   │   └── Server.Assertions.ps1
│   │   ├── configurations/
│   │   │   ├── DbcCheckDescriptions.json
│   │   │   └── configuration.ps1
│   │   ├── functions/
│   │   │   ├── Get-AllAgentInfo.ps1
│   │   │   ├── Get-AllDatabaseInfo.ps1
│   │   │   ├── Get-CheckFile.ps1
│   │   │   ├── Get-CheckInformation.ps1
│   │   │   ├── Get-CheckRepo.ps1
│   │   │   ├── Get-ComputerName.ps1
│   │   │   ├── Get-DatabaseDetail.ps1
│   │   │   ├── Get-SqlInstance.ps1
│   │   │   ├── Get-Version.ps1
│   │   │   ├── Get-v5Checks.ps1
│   │   │   ├── Invoke-ConfigurationScript.ps1
│   │   │   ├── Invoke-DbcCheckv4.ps1
│   │   │   ├── Invoke-DbcCheckv5.ps1
│   │   │   ├── New-Json.ps1
│   │   │   ├── NewGet-AllInstanceInfo.ps1
│   │   │   ├── Select-DefaultView.ps1
│   │   │   └── Set-DatabaseForIntegrationTesting.ps1
│   │   ├── scripts/
│   │   │   ├── postimport.ps1
│   │   │   └── preimport.ps1
│   │   └── tepp/
│   │       └── autocomplete.ps1
│   └── xml/
│       └── dbachecks.Format.ps1xml
├── tests/
│   ├── Project.Tests.ps1
│   ├── QA/
│   │   └── module.tests.ps1
│   ├── Unit/
│   │   ├── Private/
│   │   │   └── Get-PrivateFunction.tests.ps1
│   │   └── Public/
│   │       ├── Export-DbcConfig.Tests.ps1
│   │       └── Get-Something.tests.ps1
│   ├── Unit.Tests.ps1
│   └── readme.md
└── xml/
    └── dbachecks.Format.ps1xml
Condensed preview — 184 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (2,067K chars).
[
  {
    "path": ".devcontainer/codespaces/codespaces-docker-compose.yml",
    "chars": 1159,
    "preview": "version: \"3\"\n# because it crashes the integrated terminal in codespaces we need an additional devcontainer.json config. "
  },
  {
    "path": ".devcontainer/codespaces/devcontainer.json",
    "chars": 2169,
    "preview": "{\n    \"name\": \"dbachecks\",\n    \"workspaceFolder\": \"/workspace\",\n    \"dockerComposeFile\": [\n        \"codespaces-docker-co"
  },
  {
    "path": ".devcontainer/devcontainer.json",
    "chars": 11449,
    "preview": "{\n    \"name\": \"dbachecks\",\n    \"workspaceFolder\": \"/workspace\",\n    \"dockerComposeFile\": [\n        \"docker-compose.yml\"\n"
  },
  {
    "path": ".devcontainer/docker-compose.yml",
    "chars": 1299,
    "preview": "version: \"3\"\nservices:\n    dbachecks1:\n      image: dbachecks/sqlinstance1:v2.38.0\n      volumes:\n        - mydata:/var/"
  },
  {
    "path": ".gitattributes",
    "chars": 378,
    "preview": "# Auto detect text files and perform LF normalization\n* text=auto\n\n# Custom for Visual Studio\n*.cs     diff=csharp\n\n# St"
  },
  {
    "path": ".github/FUNDING.yml",
    "chars": 116,
    "preview": "# These are supported funding model platforms\n\ngithub: [sqldbawithabeard, jpomfret, ClaudioESSilva, potatoqualitee]\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.md",
    "chars": 1402,
    "preview": "---\nname: Bug report\nabout: Create a report to help us improve\n\n---\n\n<!-- ERASE the sections that are not applicable but"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature_request.md",
    "chars": 692,
    "preview": "---\nname: Feature request\nabout: Suggest an idea for this project\n\n---\n\n## Feature Request\n   \n<-- Simply answer the que"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/question.md",
    "chars": 113,
    "preview": "---\nname: Question\nabout: Ask a question\n\n---\n\n### Question\n\nFeel free to ask a question using this template :-)\n"
  },
  {
    "path": ".github/Pull_Request_Template.md",
    "chars": 571,
    "preview": "# A New PR\n\nTHANK YOU - We love to get PR's and really appreciate your time and help to improve this module\n\n## Acceptin"
  },
  {
    "path": ".github/issue_template.md",
    "chars": 1944,
    "preview": "<!-- ERASE the sections that are not applicable but please provide as much information as possible -->\n## Issue\n\nThis is"
  },
  {
    "path": ".github/workflows/PR-PesterTest.yml",
    "chars": 1174,
    "preview": "name: PR-Pester\n\non:\n  pull_request:\n    branches:\n    - development\n\njobs:\n  build:\n\n    runs-on: windows-latest\n    st"
  },
  {
    "path": ".github/workflows/PR.yml",
    "chars": 6153,
    "preview": "on:\n  pull_request:\n    branches:\n    - main\n    paths-ignore:\n    - CHANGELOG.md\n    tags:\n    - '**'\n    - '!*preview*"
  },
  {
    "path": ".github/workflows/deploy-module.yml",
    "chars": 14386,
    "preview": "on:\n  push:\n    branches:\n    - main\n    paths-ignore:\n    - CHANGELOG.md\n    - containers/**\n    - .github/**\n    tags:"
  },
  {
    "path": ".github/workflows/docker-image.yml",
    "chars": 3227,
    "preview": "name: Docker Image CI\n\non:\n  push:\n    branches: [ containers ]\n    paths:\n      - \".devcontainer/devcontainer.json\"\n   "
  },
  {
    "path": ".gitignore",
    "chars": 190,
    "preview": "*.psproj\ndbachecks.psprojs\nconfig.json\n\noutput/\n\n**.bak\n*.local.*\n!**/README.md\n.kitchen/\n\n*.nupkg\n*.suo\n*.user\n*.covera"
  },
  {
    "path": ".markdownlint.json",
    "chars": 154,
    "preview": "{\n    \"default\": true,\n    \"MD029\": {\n        \"style\": \"one\"\n    },\n    \"MD013\": true,\n    \"MD024\": false,\n    \"MD034\": "
  },
  {
    "path": ".vscode/launch.json",
    "chars": 462,
    "preview": "{\n    // Use IntelliSense to learn about possible attributes.\n    // Hover to view descriptions of existing attributes.\n"
  },
  {
    "path": ".vscode/settings.json",
    "chars": 1097,
    "preview": "{\n    \"cSpell.words\": [\n        \"auto\",\n        \"autogrowth\",\n        \"Boggiano\",\n        \"checkdb\",\n        \"count\",\n  "
  },
  {
    "path": ".vscode/tasks.json",
    "chars": 3643,
    "preview": "{\n    \"version\": \"2.0.0\",\n    \"_runner\": \"terminal\",\n    \"windows\": {\n        \"options\": {\n            \"shell\": {\n      "
  },
  {
    "path": "CHANGELOG.md",
    "chars": 1042,
    "preview": "# Changelog for workspace\n\nThe format is based on and uses the types of changes according to [Keep a Changelog](https://"
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "chars": 3193,
    "preview": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nIn the interest of fostering an open and welcoming environment, w"
  },
  {
    "path": "CONTRIBUTING.md",
    "chars": 6838,
    "preview": "# Contributing\n\n## Welcome\n\nBefore we go any further, thanks for being here. Thanks for using dbachecks and especially t"
  },
  {
    "path": "GitVersion.yml",
    "chars": 912,
    "preview": "mode: ContinuousDelivery\nnext-version: 3.0.0\nmajor-version-bump-message: '(breaking\\schange|breaking|major)\\b'\nminor-ver"
  },
  {
    "path": "LICENSE",
    "chars": 1072,
    "preview": "MIT License\n\nCopyright (c) 2017 Chrissy LeMaire\n\nPermission is hereby granted, free of charge, to any person obtaining a"
  },
  {
    "path": "PSScriptAnalyzerSettings.psd1",
    "chars": 2005,
    "preview": "# PSScriptAnalyzerSettings.psd1\n# Settings for PSScriptAnalyzer invocation.\n@{\n    Rules = @{\n        PSUseCompatibleCom"
  },
  {
    "path": "RELEASE.md",
    "chars": 17282,
    "preview": "## 23rd August 2021\n\nFixed bug where custom tests left an empty DbcResult #846\nAdded feature to overwrite config file if"
  },
  {
    "path": "RequiredModules.psd1",
    "chars": 632,
    "preview": "@{\n    PSDependOptions       = @{\n        AddToPath  = $true\n        Target     = 'output\\RequiredModules'\n        Param"
  },
  {
    "path": "Resolve-Dependency.ps1",
    "chars": 17894,
    "preview": "<#\n    .DESCRIPTION\n        Bootstrap script for PSDepend.\n\n    .PARAMETER DependencyFile\n        Specifies the configur"
  },
  {
    "path": "Resolve-Dependency.psd1",
    "chars": 2029,
    "preview": "@{\n    #PSDependTarget  = './output/modules'\n    #Proxy = ''\n    #ProxyCredential = '$MyCredentialVariable' #TODO: find "
  },
  {
    "path": "SECURITY.md",
    "chars": 1415,
    "preview": "## Security\n\nThe DSC Community takes the security of our modules seriously, which includes all source code repositories "
  },
  {
    "path": "azure-pipelines.yml",
    "chars": 11532,
    "preview": "trigger:\n  branches:\n    include:\n    - main\n  paths:\n    exclude:\n    - CHANGELOG.md\n  tags:\n    include:\n    - \"v*\"\n  "
  },
  {
    "path": "build.ps1",
    "chars": 18758,
    "preview": "<#\n    .DESCRIPTION\n        Bootstrap and build script for PowerShell module CI/CD pipeline\n\n    .PARAMETER Tasks\n      "
  },
  {
    "path": "build.yaml",
    "chars": 3352,
    "preview": "---\n# Invoke-Build Header to be used to 'decorate' the terminal output of the tasks.\nTaskHeader: |\n  param($Path)\n  \"\"\n "
  },
  {
    "path": "builddocs.ps1",
    "chars": 8023,
    "preview": "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 \n\nInstall-Module PlatyPs -Scope CurrentU"
  },
  {
    "path": "codecov.yml",
    "chars": 914,
    "preview": "codecov:\n  require_ci_to_pass: no\n  # main should be the baseline for reporting\n  branch: main\n\ncomment:\n  layout: \"reac"
  },
  {
    "path": "containers/JessAndBeard.psm1",
    "chars": 109601,
    "preview": "# TODO remove all the training day code :-)\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSec"
  },
  {
    "path": "containers/base/dockerfile",
    "chars": 298,
    "preview": "FROM dbachecks/sqlinstance1\n\nUSER root\n\n# remove old dbatools directory so 2.0 will import\nRUN rm -rf /usr/local/share/p"
  },
  {
    "path": "containers/base/profile.ps1",
    "chars": 3782,
    "preview": "[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '', Justification ="
  },
  {
    "path": "containers/second/dockerfile",
    "chars": 211,
    "preview": "FROM dbachecks/sqlinstance2\nUSER root\n# Install PowerShell\nRUN apt-get update && apt install -y powershell\n# install git"
  },
  {
    "path": "containers/third/dockerfile",
    "chars": 215,
    "preview": "FROM dbachecks/sqlinstance3\nUSER root\n# Install PowerShell  \nRUN apt-get update && apt install -y powershell\n# install g"
  },
  {
    "path": "dbachecksdevcontainer.code-workspace",
    "chars": 5095,
    "preview": "{\n\t\"folders\": [\n\t\t{\n\t\t\t\"path\": \".\"\n\t\t}\n\t],\n\t\"settings\": {\n\t\t\"powershell.scriptAnalysis.settingsPath\": \"PSScriptAnalyzerS"
  },
  {
    "path": "developing/Archive/Get-AllInstanceInfo testing.ps1",
    "chars": 3095,
    "preview": "# Get-AllInstanceInfo testing \n\n# so the initial load doesnt skew the figures\nipmo dbatools\nipmo ./dbachecks.psd1\nfuncti"
  },
  {
    "path": "developing/Archive/Perf Testing pesterv5.ps1",
    "chars": 4495,
    "preview": "## To Test performance - I pull the dbatools docker repo and cd to the samples/stackoverflow Directory\n\n## I changed the"
  },
  {
    "path": "developing/Archive/PerfAndValidate-Checks.ps1",
    "chars": 7231,
    "preview": "## To Test performance - I pull the dbatools docker repo and cd to the samples/stackoverflow Directory\n\n## I changed the"
  },
  {
    "path": "developing/Archive/Validate v4 adn v5.ps1",
    "chars": 7958,
    "preview": "## To Test performance - I pull the dbatools docker repo and cd to the samples/stackoverflow Directory\n\n## I changed the"
  },
  {
    "path": "developing/Archive/initfields.ps1",
    "chars": 6817,
    "preview": "# uses Jakubs Profiler Module - Install-Module Profiler\n$withinitFIeldsSMO = {\n    $password = ConvertTo-SecureString \"d"
  },
  {
    "path": "developing/Archive/originalGet-AllInstanceInfo.ps1",
    "chars": 31714,
    "preview": "function Get-AllInstanceInfo {\n    # Using the unique tags gather the information required\n    Param($Instance, $Tags, $"
  },
  {
    "path": "developing/Archive/pesterv5testing.ps1",
    "chars": 12252,
    "preview": "## To Test pull the dbatools docker repo and cd to the samples/stackoverflow Directory\n\n## I changed the ports because I"
  },
  {
    "path": "developing/Archive/tests/Help.Exceptions.ps1",
    "chars": 4735,
    "preview": "\n\n\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCi"
  },
  {
    "path": "developing/Archive/tests/InModule.Help.Exceptions.ps1",
    "chars": 5219,
    "preview": "[cmdletbinding()]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidGlobalVars', '', Justification='Because sc"
  },
  {
    "path": "developing/Archive/tests/InModule.Help.Tests.ps1",
    "chars": 13043,
    "preview": "[cmdletbinding()]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidGlobalVars', '', Justification='Because sco"
  },
  {
    "path": "developing/Archive/tests/Integration/DockerTests.ps1",
    "chars": 12988,
    "preview": "[cmdletbinding()]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', '', Justifi"
  },
  {
    "path": "developing/Archive/tests/Integration/docker-compose.yml",
    "chars": 802,
    "preview": "version: '3.7'\n\nservices:\n    sql2012:\n        image: dbafromthecold/sqlserver2012dev:sp4\n        ports:  \n          - \""
  },
  {
    "path": "developing/Archive/tests/Project.Tests.ps1",
    "chars": 7476,
    "preview": "$packages = get-package\nif ($packages.Name  -contains \"PSScriptAnalyzer\") {\n    #PSScriptAnalyzer is installed on the sy"
  },
  {
    "path": "developing/Archive/tests/Reset-DbcConfig.Tests.ps1",
    "chars": 11093,
    "preview": "[cmdletbinding()]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingInvokeExpression', '', Justification='"
  },
  {
    "path": "developing/Archive/tests/Test-SingleFile.ps1",
    "chars": 5529,
    "preview": "param(\n    [Parameter(Mandatory = $true)]\n    [string]\n    $FileToTest\n)\n\n$FileToTest = Resolve-Path $FileToTest\n$fileNa"
  },
  {
    "path": "developing/Archive/tests/Unit.Tests.ps1",
    "chars": 18021,
    "preview": "$ModuleBase = Split-Path -Parent $MyInvocation.MyCommand.Path\n# For tests in .\\Tests subdirectory\nif ((Split-Path $Modu"
  },
  {
    "path": "developing/Archive/tests/build/Initialize-VstsAgentOnWindowsServerCoreContainer.ps1",
    "chars": 42198,
    "preview": "##################################################################################################################\n# Scr"
  },
  {
    "path": "developing/Archive/tests/build/Install-VstsAgentOnWindowsServerCoreContainer.ps1",
    "chars": 58791,
    "preview": "########################################################################################################################"
  },
  {
    "path": "developing/Archive/tests/build/Remove-VstsAgentOnWindowsServerCoreContainer.ps1",
    "chars": 15220,
    "preview": "########################################################################################################################"
  },
  {
    "path": "developing/Archive/tests/checks/AgentChecks.Tests.ps1",
    "chars": 16130,
    "preview": "# load all of the assertion functions\n(Get-ChildItem $PSScriptRoot/../../internal/assertions/).ForEach{. $Psitem.FullNam"
  },
  {
    "path": "developing/Archive/tests/checks/DatabaseChecks.Tests.ps1",
    "chars": 23728,
    "preview": "[cmdletbinding()]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingCmdletAliases', '', Justification='stu"
  },
  {
    "path": "developing/Archive/tests/checks/InstanceChecks.Tests.ps1",
    "chars": 63936,
    "preview": "# load all of the assertion functions\n(Get-ChildItem $PSScriptRoot/../../internal/assertions/).ForEach{ . $Psitem.FullNa"
  },
  {
    "path": "developing/Archive/tests/checks/ServerChecks.Tests.ps1",
    "chars": 97385,
    "preview": "[Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSAvoidUsingComputerNameHardcoded\", \"\")]\n[CmdletBinding()]\nparam ()\n"
  },
  {
    "path": "developing/Archive/tests/constants.ps1",
    "chars": 4816,
    "preview": "$script:ModuleRoot = $PSScriptRoot\n$script:localapp = \"$env:localappdata\\dbachecks\"\n# SIG # Begin signature block\n# MIIN"
  },
  {
    "path": "developing/Archive/tests/functions/Export-DbcConfig.Tests.ps1",
    "chars": 983,
    "preview": "\nDescribe \"Export-DbcConfig Unit Tests\" -Tags \"IntegrationTests\" {\n    Context \"Command executes properly and returns p"
  },
  {
    "path": "developing/Archive/tests/functions/Get-CheckFile.Tests.ps1",
    "chars": 9847,
    "preview": "Remove-Module dbachecks -ErrorAction SilentlyContinue\nImport-Module \"$PSScriptRoot\\..\\..\\dbachecks.psd1\"\n\n. \"$PSScriptRo"
  },
  {
    "path": "developing/Archive/tests/functions/Get-CheckInformation.tests.ps1",
    "chars": 10894,
    "preview": "$ModuleBase = Split-Path -Parent $MyInvocation.MyCommand.Path\nRemove-Module dbachecks -ErrorAction SilentlyContinue\nImpo"
  },
  {
    "path": "developing/Archive/tests/functions/Get-DatabaseDetail.Tests.ps1",
    "chars": 7526,
    "preview": "[cmdletbinding()]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', '', Justifi"
  },
  {
    "path": "developing/Archive/tests/functions/Get-DbcCheck.Tests.ps1",
    "chars": 5498,
    "preview": "Remove-Module dbachecks -ErrorAction SilentlyContinue\nImport-Module \"$PSScriptRoot\\..\\..\\dbachecks.psd1\"\n. \"$PSScriptRo"
  },
  {
    "path": "developing/Archive/tests/functions/Get-DbcConfig.Tests.ps1",
    "chars": 5725,
    "preview": "[cmdletbinding()]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', '', Justif"
  },
  {
    "path": "developing/Archive/tests/functions/Get-DbcConfigValue.Tests.ps1",
    "chars": 5372,
    "preview": "[cmdletbinding()]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', '', Justif"
  },
  {
    "path": "developing/Archive/tests/functions/Get-DbcTagCollection.Tests.ps1",
    "chars": 5278,
    "preview": "$commandname = $MyInvocation.MyCommand.Name.Replace(\".Tests.ps1\", \"\")\n. \"$PSScriptRoot\\..\\constants.ps1\"\n\nDescribe \"$co"
  },
  {
    "path": "developing/Archive/tests/functions/Import-DbcConfig.Tests.ps1",
    "chars": 5593,
    "preview": "$commandname = $MyInvocation.MyCommand.Name.Replace(\".Tests.ps1\", \"\")\n. \"$PSScriptRoot\\..\\constants.ps1\"\n\nDescribe \"$co"
  },
  {
    "path": "developing/Archive/tests/functions/Invoke-DbcCheck.Tests.ps1",
    "chars": 5322,
    "preview": "$commandname = $MyInvocation.MyCommand.Name.Replace(\".Tests.ps1\", \"\")\n. \"$PSScriptRoot\\..\\constants.ps1\"\n\nDescribe \"$co"
  },
  {
    "path": "developing/Archive/tests/functions/Invoke-DbcConfigFile.Tests.ps1",
    "chars": 5302,
    "preview": "$commandname = $MyInvocation.MyCommand.Name.Replace(\".Tests.ps1\", \"\")\n. \"$PSScriptRoot\\..\\constants.ps1\"\n\nDescribe \"$co"
  },
  {
    "path": "developing/Archive/tests/functions/Set-DbcConfig.Tests.ps1",
    "chars": 5538,
    "preview": "[cmdletbinding()]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', '', Justif"
  },
  {
    "path": "developing/Archive/tests/functions/Set-DbcFile.Tests.ps1",
    "chars": 30841,
    "preview": "$commandname = $MyInvocation.MyCommand.Name.Replace(\".Tests.ps1\", \"\")\nRemove-Module dbachecks -ErrorAction SilentlyConti"
  },
  {
    "path": "developing/Archive/tests/functions/get-check.json",
    "chars": 42091,
    "preview": "[\n    {\n        \"Group\":  \"Agent\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"AgentServiceAccount\",\n        "
  },
  {
    "path": "developing/Archive/tests/functions/results.json",
    "chars": 2499,
    "preview": "{\n  \"TagFilter\": [\n    \"AutoClose\",\n    \"lastgoodcheckdb\",\n    \"BackupPathAccess\",\n    \"FailedJob\"\n  ],\n  \"ExcludeTagFil"
  },
  {
    "path": "developing/Archive/tests/readme.md",
    "chars": 466,
    "preview": "# Tests Folder\n\n## Description\n\nThis folder holds the Unit and integration tests for the dbachecks module\n\n## assertions"
  },
  {
    "path": "developing/Howto.md",
    "chars": 3536,
    "preview": "# Developing with Sampler set up\n\nSuper quick introduction. I have altered the project to use Sampler by Gael to scaffol"
  },
  {
    "path": "developing/Oslo Demo.ps1",
    "chars": 4680,
    "preview": "# Oslo Demo\n\n./build.ps1 -tasks build\n\n#region setup\n$containers = $SQLInstances = $dbachecks1, $dbachecks2, $dbachecks3"
  },
  {
    "path": "developing/PSConfEU demo.md",
    "chars": 1850,
    "preview": "# PSConfEU demo\n\n1. Develop in the source repository\n  - copy existing check & rewrite - add check to `source/checks/Dat"
  },
  {
    "path": "developing/Robs-Instance.ps1",
    "chars": 3700,
    "preview": "./build.ps1 -Tasks build\n\n$Checks = 'ErrorLogCount', 'XESessionExists', 'XESessionStopped', 'XpCmdShellDisabled', 'WhoIs"
  },
  {
    "path": "developing/Setting up for Sampler.ps1",
    "chars": 996,
    "preview": "# Setting up for Sampler\n\nInstall-Module -Name 'Sampler' -Scope 'CurrentUser' -AllowPrerelease\n$samplerModule = Import-M"
  },
  {
    "path": "developing/settingupfor2022.ps1",
    "chars": 1491,
    "preview": "docker run -p 52001:1433 dbatools/sqlinstance2 \ndocker run -p 52000:1433 -v sqlserver:/var/opt/sqlserver  -d dbatools/sq"
  },
  {
    "path": "docs/RELEASE.md",
    "chars": 17282,
    "preview": "## 23rd August 2021\n\nFixed bug where custom tests left an empty DbcResult #846\nAdded feature to overwrite config file if"
  },
  {
    "path": "docs/functions/Clear-DbcPowerBiDataSource.md",
    "chars": 2386,
    "preview": "# Clear-DbcPowerBiDataSource\n\n## SYNOPSIS\nClears the data source directory created by Update-DbcPowerBiDataSource\n\n## SY"
  },
  {
    "path": "docs/functions/Convert-DbcResult.md",
    "chars": 2596,
    "preview": "# Convert-DbcResult\n\n## SYNOPSIS\nTakes the results of Invoke-DbcCheck, parses it and converts it to a datatable object\n\n"
  },
  {
    "path": "docs/functions/Export-DbcConfig.md",
    "chars": 1794,
    "preview": "# Export-DbcConfig\n\n## SYNOPSIS\nExports dbachecks configs to a json file to make it easier to modify or be used for spec"
  },
  {
    "path": "docs/functions/Get-DbcCheck.md",
    "chars": 1629,
    "preview": "# Get-DbcCheck\n\n## SYNOPSIS\nLists all checks, tags and unique identifiers\n\n## SYNTAX\n\n```\nGet-DbcCheck [[-Tag] <String>]"
  },
  {
    "path": "docs/functions/Get-DbcConfig.md",
    "chars": 1816,
    "preview": "# Get-DbcConfig\n\n## SYNOPSIS\nRetrieves configuration elements by name.\n\n## SYNTAX\n\n```\nGet-DbcConfig [[-Name] <String[]>"
  },
  {
    "path": "docs/functions/Get-DbcConfigValue.md",
    "chars": 1813,
    "preview": "# Get-DbcConfigValue\n\n## SYNOPSIS\nRetrieves raw configuration values by name.\n\n## SYNTAX\n\n```\nGet-DbcConfigValue [[-Name"
  },
  {
    "path": "docs/functions/Get-DbcReleaseNote.md",
    "chars": 954,
    "preview": "# Get-DbcReleaseNote\n\n## SYNOPSIS\nReturns the release notes for the module - organised by date\n\n## SYNTAX\n\n```\nGet-DbcRe"
  },
  {
    "path": "docs/functions/Get-DbcTagCollection.md",
    "chars": 1922,
    "preview": "# Get-DbcTagCollection\n\n## SYNOPSIS\nRetrieves a list of all available tags.\nSimplistic, similar to Get-Verb.\n\n## SYNTAX\n"
  },
  {
    "path": "docs/functions/Import-DbcConfig.md",
    "chars": 2195,
    "preview": "# Import-DbcConfig\n\n## SYNOPSIS\nImports dbachecks configs from a json file\n\n## SYNTAX\n\n```\nImport-DbcConfig [[-Path] <St"
  },
  {
    "path": "docs/functions/Invoke-DbcCheck.md",
    "chars": 97834,
    "preview": "# Invoke-DbcCheck\n\n## SYNOPSIS\nInvoke-DbcCheck is a SQL-centric Invoke-Pester wrapper\n\n## SYNTAX\n\n### Default (Default)\n"
  },
  {
    "path": "docs/functions/Invoke-DbcConfigFile.md",
    "chars": 1866,
    "preview": "# Invoke-DbcConfigFile\n\n## SYNOPSIS\nOpens the default location of the json config file for easy edits.\n\n## SYNTAX\n\n```\nI"
  },
  {
    "path": "docs/functions/Reset-DbcConfig.md",
    "chars": 1422,
    "preview": "# Reset-DbcConfig\n\n## SYNOPSIS\nResets configuration entries to their default values.\n\n## SYNTAX\n\n```\nReset-DbcConfig [[-"
  },
  {
    "path": "docs/functions/Save-DbcRequiredModules.md",
    "chars": 1960,
    "preview": "# Save-DbcRequiredModules\n\n## SYNOPSIS\nSaves all required modules, including dbachecks, dbatools, Pester and PSFramework"
  },
  {
    "path": "docs/functions/Set-DbcCisConfig.md",
    "chars": 1454,
    "preview": "# Set-DbcCisConfig\n\n## SYNOPSIS\nSets values for CIS checks.\n\n## SYNTAX\n\n```\nSet-DbcCisConfig [-WhatIf] [-Confirm] [<Comm"
  },
  {
    "path": "docs/functions/Set-DbcConfig.md",
    "chars": 4178,
    "preview": "# Set-DbcConfig\n\n## SYNOPSIS\nSets configuration values for specific checks.\n\n## SYNTAX\n\n```\nSet-DbcConfig [[-Name] <Stri"
  },
  {
    "path": "docs/functions/Set-DbcFile.md",
    "chars": 5504,
    "preview": "# Set-DbcFile\n\n## SYNOPSIS\nWrites the result of Invoke-DbcCheck to a file (after converting with Convert-DbcResult)\n\n## "
  },
  {
    "path": "docs/functions/Start-DbcPowerBi.md",
    "chars": 3573,
    "preview": "# Start-DbcPowerBi\n\n## SYNOPSIS\nLaunches one of the included dbachecks Power BI dashboards either the original for json "
  },
  {
    "path": "docs/functions/Update-DbcPowerBiDataSource.md",
    "chars": 7443,
    "preview": "# Update-DbcPowerBiDataSource\n\n## SYNOPSIS\nConverts Pester results and exports file in required format for launching the"
  },
  {
    "path": "docs/functions/Update-DbcRequiredModules.md",
    "chars": 2033,
    "preview": "# Update-DbcRequiredModules\n\n## SYNOPSIS\nUpdates all required modules, including dbachecks.\n\n## SYNTAX\n\n```\nUpdate-DbcRe"
  },
  {
    "path": "docs/functions/Write-DbcTable.md",
    "chars": 3706,
    "preview": "# Write-DbcTable\n\n## SYNOPSIS\nWrites the result of Invoke-DbcCheck (with -PassThru) after Convert-DbcResult to a databas"
  },
  {
    "path": "docs/index.md",
    "chars": 15705,
    "preview": "# dbachecks\n\n<img align=\"left\" src=\"https://user-images.githubusercontent.com/8278033/34322840-ed09114e-e832-11e7-9670-9"
  },
  {
    "path": "header-mkdocs.yml",
    "chars": 300,
    "preview": "site_name: dbachecks\nrepo_url: https://github.com/sqlcollaborative/dbachecks\nsite_author: The Beard\nedit_uri: edit/main/"
  },
  {
    "path": "mkdocs.yml",
    "chars": 1491,
    "preview": "site_name: dbachecks\nrepo_url: https://github.com/sqlcollaborative/dbachecks\nsite_author: The Beard\nedit_uri: edit/main/"
  },
  {
    "path": "readme.md",
    "chars": 19433,
    "preview": "# dbachecks\n\n<a href=\"https://star-history.com/#dataplat/dbachecks&Date\"><img align=\"right\" height=\"300\" src=\"https://ap"
  },
  {
    "path": "source/checks/Agent.Tests.ps1",
    "chars": 27889,
    "preview": "$filename = $MyInvocation.MyCommand.Name.Replace('.Tests.ps1', '')\n. $PSScriptRoot/../internal/assertions/Agent.Assertio"
  },
  {
    "path": "source/checks/Agentv5.Tests.ps1",
    "chars": 16427,
    "preview": "# So the v5 files need to be handled differently.\n# We will start with a BeforeDiscovery which will gather the Instance "
  },
  {
    "path": "source/checks/Database.Tests.ps1",
    "chars": 74203,
    "preview": "$filename = $MyInvocation.MyCommand.Name.Replace(\".Tests.ps1\", \"\")\n. $PSScriptRoot/../internal/assertions/Database.Asser"
  },
  {
    "path": "source/checks/Databasev5.Tests.ps1",
    "chars": 22837,
    "preview": "# So the v5 files need to be handled differently.\n# Ww will start with a BeforeDiscovery , $Filename which for the Datab"
  },
  {
    "path": "source/checks/Domain.Tests.ps1",
    "chars": 11906,
    "preview": "$filename = $MyInvocation.MyCommand.Name.Replace(\".Tests.ps1\", \"\")\n\nDescribe \"Active Directory Domain Name\" -Tags Domain"
  },
  {
    "path": "source/checks/HADR.Tests.ps1",
    "chars": 29503,
    "preview": "$filename = $MyInvocation.MyCommand.Name.Replace(\".Tests.ps1\", \"\")\n\n# Get all the info in the function\nfunction Get-Clus"
  },
  {
    "path": "source/checks/Instance.Tests.ps1",
    "chars": 69064,
    "preview": "$filename = $MyInvocation.MyCommand.Name.Replace(\".Tests.ps1\", \"\")\n. $PSScriptRoot/../internal/assertions/Instance.Asser"
  },
  {
    "path": "source/checks/Instancev5.Tests.ps1",
    "chars": 38344,
    "preview": "# So the v5 files need to be handled differently.\n# Ww will start with a BeforeDiscovery which will gather the Instance "
  },
  {
    "path": "source/checks/LogShipping.Tests.ps1",
    "chars": 5781,
    "preview": "$filename = $MyInvocation.MyCommand.Name.Replace(\".Tests.ps1\", \"\")\nDescribe \"Log Shipping Status Primary\" -Tags LogShipp"
  },
  {
    "path": "source/checks/MaintenanceSolution.Tests.ps1",
    "chars": 26392,
    "preview": "$filename = $MyInvocation.MyCommand.Name.Replace(\".Tests.ps1\", \"\")\n\nDescribe \"Ola maintenance solution installed\" -Tags "
  },
  {
    "path": "source/checks/Server.Tests.ps1",
    "chars": 9447,
    "preview": "$filename = $MyInvocation.MyCommand.Name.Replace(\".Tests.ps1\", \"\")\n. $PSScriptRoot/../internal/assertions/Server.Asserti"
  },
  {
    "path": "source/dbachecks.psm1",
    "chars": 1963,
    "preview": "$script:ModuleRoot = $PSScriptRoot\n$VerbosePreference = \"SilentlyContinue\"\n\nfunction Import-ModuleFile {\n    [CmdletBin"
  },
  {
    "path": "source/functions/Clear-DbcPowerBiDataSource.ps1",
    "chars": 6364,
    "preview": "<#\n.SYNOPSIS\n    Clears the data source directory created by Update-DbcPowerBiDataSource\n.DESCRIPTION\n    Clears the da"
  },
  {
    "path": "source/functions/Convert-DbcResult.ps1",
    "chars": 7355,
    "preview": "<#\n.SYNOPSIS\nTakes the results of Invoke-DbcCheck, parses it and converts it to a datatable object\n\n.DESCRIPTION\nYou nee"
  },
  {
    "path": "source/functions/Export-DbcConfig.ps1",
    "chars": 2136,
    "preview": "<#\n.SYNOPSIS\n    Exports dbachecks configs to a json file to make it easier to modify or be used for specific configura"
  },
  {
    "path": "source/functions/Get-DbcCheck.ps1",
    "chars": 2299,
    "preview": "<#\n    .SYNOPSIS\n        Lists all checks, tags and unique identifiers\n\n    .DESCRIPTION\n        Lists all checks, tags"
  },
  {
    "path": "source/functions/Get-DbcConfig.ps1",
    "chars": 6343,
    "preview": "<#\n.SYNOPSIS\n    Retrieves configuration elements by name.\n\n.DESCRIPTION\n    Retrieves configuration elements by name.\n"
  },
  {
    "path": "source/functions/Get-DbcConfigValue.ps1",
    "chars": 6060,
    "preview": "<#\n.SYNOPSIS\n    Retrieves raw configuration values by name.\n\n.DESCRIPTION\n    Retrieves raw configuration values by na"
  },
  {
    "path": "source/functions/Get-DbcReleaseNote.ps1",
    "chars": 5601,
    "preview": "<#\n.SYNOPSIS\nReturns the release notes for the module - organised by date\n\n.DESCRIPTION\nGrabs the release notes for the "
  },
  {
    "path": "source/functions/Get-DbcTagCollection.ps1",
    "chars": 6258,
    "preview": "<#\n.SYNOPSIS\nRetrieves a list of all available tags. Simplistic, similar to Get-Verb.\n\n.DESCRIPTION\nRetrieves a list of"
  },
  {
    "path": "source/functions/Import-DbcConfig.ps1",
    "chars": 1729,
    "preview": "<#\n.SYNOPSIS\nImports dbachecks configs from a json file\n\n.DESCRIPTION\n   Imports dbachecks configs from a json file\n\n.P"
  },
  {
    "path": "source/functions/Invoke-DbcCheck.ps1",
    "chars": 16883,
    "preview": "\n<#\n.SYNOPSIS\nInvoke-DbcCheck is a SQL-centric Invoke-Pester wrapper\n\n.DESCRIPTION\nThe Invoke-DbcCheck function runs Pe"
  },
  {
    "path": "source/functions/Invoke-DbcConfigFile.ps1",
    "chars": 6317,
    "preview": "<#\n.SYNOPSIS\nOpens the default location of the json config file for easy edits.\n\n.DESCRIPTION\nOpens the default locatio"
  },
  {
    "path": "source/functions/Reset-DbcConfig.ps1",
    "chars": 7034,
    "preview": ". $script:ModuleRoot/internal/functions/Invoke-ConfigurationScript.ps1\n<#\n.SYNOPSIS\nResets configuration entries to thei"
  },
  {
    "path": "source/functions/Save-DbcRequiredModules.ps1",
    "chars": 6541,
    "preview": "<#\n.SYNOPSIS\nSaves all required modules, including dbachecks, dbatools, Pester and PSFramework to a directory. Ideal fo"
  },
  {
    "path": "source/functions/Set-DbcCisConfig.ps1",
    "chars": 4041,
    "preview": "<#\n.SYNOPSIS\nSets values for CIS checks.\n.DESCRIPTION\nSets CIS checks to defaults values that were different than normal"
  },
  {
    "path": "source/functions/Set-DbcConfig.ps1",
    "chars": 9300,
    "preview": "<#\n.SYNOPSIS\nSets configuration values for specific checks.\n\n.DESCRIPTION\nChanges configuration values which enable eac"
  },
  {
    "path": "source/functions/Set-DbcFile.ps1",
    "chars": 12545,
    "preview": "<#\n.SYNOPSIS\nWrites the result of Invoke-DbcCheck to a file (after converting with Convert-DbcResult)\n\n.DESCRIPTION\nWhen"
  },
  {
    "path": "source/functions/Start-DbcPowerBi.ps1",
    "chars": 8772,
    "preview": "<#\n.SYNOPSIS\nLaunches one of the included dbachecks Power BI dashboards either the original for json files or the new o"
  },
  {
    "path": "source/functions/Update-DbcPowerBiDataSource.ps1",
    "chars": 13113,
    "preview": "<#\n.SYNOPSIS\nConverts Pester results and exports file in required format for launching the\nPower BI command. **You will "
  },
  {
    "path": "source/functions/Update-DbcRequiredModules.ps1",
    "chars": 6691,
    "preview": "<#\n.SYNOPSIS\nUpdates all required modules, including dbachecks.\n\n.DESCRIPTION\nUpdates all required modules, including db"
  },
  {
    "path": "source/functions/Write-DbcTable.ps1",
    "chars": 9747,
    "preview": "<#\n.SYNOPSIS\nWrites the result of Invoke-DbcCheck (with -PassThru) after Convert-DbcResult to a database table\n\n.DESCRIP"
  },
  {
    "path": "source/internal/assertions/Agent.Assertions.ps1",
    "chars": 6956,
    "preview": "function Assert-DatabaseMailEnabled {\n    param (\n        $SQLInstance,\n        $DatabaseMailEnabled\n    )\n   (Get-DbaSp"
  },
  {
    "path": "source/internal/assertions/Database.Assertions.ps1",
    "chars": 10999,
    "preview": "function Get-Database {\n    Param(\n        [string]$Instance,\n        [string[]]$ExcludedDbs,\n        [string[]]$Databas"
  },
  {
    "path": "source/internal/assertions/Instance.Assertions.ps1",
    "chars": 47075,
    "preview": "<#\nThis file is used to hold the Assertions for the Instance.Tests\n\nWhen adding new checks or improving existing ones -\n"
  },
  {
    "path": "source/internal/assertions/Server.Assertions.ps1",
    "chars": 15490,
    "preview": "<#\nThis file is used to hold the Assertions for the Server.Tests\n\nFollow the guidance in Instance.Assertions to add new "
  },
  {
    "path": "source/internal/configurations/DbcCheckDescriptions.json",
    "chars": 27689,
    "preview": "[{\n        \"UniqueTag\": \"AgentServiceAccount\",\n        \"Description\": \"Tests that the SQL Agent Account is running and s"
  },
  {
    "path": "source/internal/configurations/configuration.ps1",
    "chars": 59870,
    "preview": "# Fred magic\n#Set-PSFConfig -Handler { if (Get-PSFTaskEngineCache -Module dbachecks -Name module-imported) { Write-PSFM"
  },
  {
    "path": "source/internal/functions/Get-AllAgentInfo.ps1",
    "chars": 22198,
    "preview": "function Get-AllAgentInfo {\n    # Using the unique tags gather the information required\n    Param($Instance, $Tags)\n\n   "
  },
  {
    "path": "source/internal/functions/Get-AllDatabaseInfo.ps1",
    "chars": 15424,
    "preview": "function Get-AllDatabaseInfo {\n    # Using the unique tags gather the information required\n    Param($Instance, $Tags)\n\n"
  },
  {
    "path": "source/internal/functions/Get-CheckFile.ps1",
    "chars": 5605,
    "preview": "<#\n.SYNOPSIS\nThis will return all of the files that match a Check name - either by name or by pester tag\n\n.DESCRIPTION\nT"
  },
  {
    "path": "source/internal/functions/Get-CheckInformation.ps1",
    "chars": 7096,
    "preview": "# Returns all of the tags that have been specified in the checks file for this run of the Invoke-DbcCheck\nfunction Get-C"
  },
  {
    "path": "source/internal/functions/Get-CheckRepo.ps1",
    "chars": 240,
    "preview": "# Can't set arrays right now, w/e\nfunction Get-CheckRepo {\n    $repos = Get-DbcConfigValue app.checkrepos\n    if ($repo"
  },
  {
    "path": "source/internal/functions/Get-ComputerName.ps1",
    "chars": 5169,
    "preview": "function Get-ComputerName {\n    if ($null -ne $computername) {\n        return [array]$computername\n    }\n    else {\n   "
  },
  {
    "path": "source/internal/functions/Get-DatabaseDetail.ps1",
    "chars": 7208,
    "preview": "function Get-DatabaseDetail {\n    param (\n        [DbaInstanceParameter[]]$SqlInstance,\n        [object[]]$ExcludeDataba"
  },
  {
    "path": "source/internal/functions/Get-SqlInstance.ps1",
    "chars": 5131,
    "preview": "function Get-Instance {\n    if ($null -ne $sqlinstance) {\n        return [array]$sqlinstance\n    }\n\n    $instances = Ge"
  },
  {
    "path": "source/internal/functions/Get-Version.ps1",
    "chars": 4847,
    "preview": "function Get-Version {\n    Param($SqlInstance)\n    (Connect-DbaInstance -SqlInstance $SqlInstance).Version.Major\n}\n# SIG"
  },
  {
    "path": "source/internal/functions/Get-v5Checks.ps1",
    "chars": 1042,
    "preview": "function Get-v5Checks {\n    $v5files = Get-ChildItem -Path $v5Path -Recurse -Filter *.ps1 -Exclude *-v5.ps1        \n    "
  },
  {
    "path": "source/internal/functions/Invoke-ConfigurationScript.ps1",
    "chars": 5243,
    "preview": "function Invoke-ConfigurationScript {\n    <#\n    .SYNOPSIS\n    Invokes the configurations/configuration.ps1 script\n\n    "
  },
  {
    "path": "source/internal/functions/Invoke-DbcCheckv4.ps1",
    "chars": 14092,
    "preview": "function Invoke-DbcCheckv4 {\n    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidGlobalVars', '', Justificati"
  },
  {
    "path": "source/internal/functions/Invoke-DbcCheckv5.ps1",
    "chars": 14820,
    "preview": "function Invoke-DbcCheckv5 {\n    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidGlobalVars', '', Justificati"
  },
  {
    "path": "source/internal/functions/New-Json.ps1",
    "chars": 12246,
    "preview": "\nfunction New-Json {\n    [CmdletBinding(SupportsShouldProcess)]\n    Param()\n    # Parse repo for tags and descriptions t"
  },
  {
    "path": "source/internal/functions/NewGet-AllInstanceInfo.ps1",
    "chars": 36918,
    "preview": "function NewGet-AllInstanceInfo {\n    # Using the unique tags gather the information required\n    Param($Instance, $Tags"
  },
  {
    "path": "source/internal/functions/Select-DefaultView.ps1",
    "chars": 7244,
    "preview": "function Select-DefaultView {\n    <#\n\n    This command enables us to send full on objects to the pipeline without the u"
  },
  {
    "path": "source/internal/functions/Set-DatabaseForIntegrationTesting.ps1",
    "chars": 5492,
    "preview": "<#\n\nThis function is intended for use in integration testing.\nIt ensures the test database exists and the test instnace."
  },
  {
    "path": "source/internal/scripts/postimport.ps1",
    "chars": 6552,
    "preview": "# Add all things you want to run after importing the main code\n\n# Load Configurations\nforeach ($file in (Get-ChildItem "
  },
  {
    "path": "source/internal/scripts/preimport.ps1",
    "chars": 4797,
    "preview": "# Add all things you want to run before importing the main code\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoII"
  },
  {
    "path": "source/internal/tepp/autocomplete.ps1",
    "chars": 6293,
    "preview": "# Register that script block\nRegister-PSFTeppScriptblock -Name SqlInstance -ScriptBlock { Get-PSFConfig -Module dbachec"
  },
  {
    "path": "source/xml/dbachecks.Format.ps1xml",
    "chars": 1209,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<Configuration>\n  <ViewDefinitions>\n\t<View>\n\t\t<Name>dbachecks.Check</Name>\n\t\t\t<"
  },
  {
    "path": "tests/Project.Tests.ps1",
    "chars": 4794,
    "preview": "BeforeDiscovery {\n    $script:ModuleName = 'dbachecks'\n    $ModuleBase = (Get-Module -Name $ModuleName -ListAvailable).M"
  },
  {
    "path": "tests/QA/module.tests.ps1",
    "chars": 8304,
    "preview": "\nBeforeDiscovery {\n    $script:moduleName = $ProjectName\n\n    Remove-Module -Name $script:moduleName -Force -ErrorAction"
  },
  {
    "path": "tests/Unit/Private/Get-PrivateFunction.tests.ps1",
    "chars": 822,
    "preview": "<#\n$ProjectPath = \"$PSScriptRoot\\..\\..\\..\" | Convert-Path\n$ProjectName = ((Get-ChildItem -Path $ProjectPath\\*\\*.psd1).Wh"
  },
  {
    "path": "tests/Unit/Public/Export-DbcConfig.Tests.ps1",
    "chars": 1026,
    "preview": "\nDescribe \"Export-DbcConfig Unit Tests\" -Tags \"IntegrationTests\" {\n    Context \"Command executes properly and returns p"
  },
  {
    "path": "tests/Unit/Public/Get-Something.tests.ps1",
    "chars": 2325,
    "preview": "<#\n$ProjectPath = \"$PSScriptRoot\\..\\..\\..\" | Convert-Path\n$ProjectName = ((Get-ChildItem -Path $ProjectPath\\*\\*.psd1).Wh"
  },
  {
    "path": "tests/Unit.Tests.ps1",
    "chars": 22836,
    "preview": "\n# This should stop people making breaking changes to the tests without first altering the test\n\nBeforeDiscovery {\n    R"
  },
  {
    "path": "tests/readme.md",
    "chars": 466,
    "preview": "# Tests Folder\n\n## Description\n\nThis folder holds the Unit and integration tests for the dbachecks module\n\n## assertions"
  },
  {
    "path": "xml/dbachecks.Format.ps1xml",
    "chars": 1209,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<Configuration>\n  <ViewDefinitions>\n\t<View>\n\t\t<Name>dbachecks.Check</Name>\n\t\t\t<"
  }
]

// ... and 4 more files (download for full content)

About this extraction

This page contains the full source code of the sqlcollaborative/dbachecks GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 184 files (1.9 MB), approximately 600.0k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!