[
  {
    "path": ".devcontainer/codespaces/codespaces-docker-compose.yml",
    "content": "version: \"3\"\n# because it crashes the integrated terminal in codespaces we need an additional devcontainer.json config. Hopefully this will work as expected.\n# hidden away in the docs :-( https://docs.github.com/en/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers#devcontainerjson\nservices:\n    dbachecks1:\n      image: sqldbawithabeard/dbachecks1:v2.1.0-beta.1\n      volumes:\n        - mydata:/var/opt/backups\n        - shared:/shared\n        # Update this to wherever you want VS Code to mount the folder of your project\n        - ..:/workspace:cached\n      ports:\n        - \"7401:1433\"\n      container_name: dbachecks1\n      hostname: dbachecks1\n      \n    dbachecks2:\n      image: sqldbawithabeard/dbachecks2:v2.1.0-beta.1\n      volumes:\n        - mydata:/var/opt/backups\n        - shared:/shared\n        # Update this to wherever you want VS Code to mount the folder of your project\n        # So that the second container is rebuilt everytime as well \n        - ..:/somewhereweirdworkspace:cached\n      ports:\n        - \"7402:1433\"\n      container_name: dbachecks2\n      hostname: dbachecks2\n\nvolumes:\n  mydata:\n  shared:\n"
  },
  {
    "path": ".devcontainer/codespaces/devcontainer.json",
    "content": "{\n    \"name\": \"dbachecks\",\n    \"workspaceFolder\": \"/workspace\",\n    \"dockerComposeFile\": [\n        \"codespaces-docker-compose.yml\"\n    ],\n    \"remoteEnv\": {\n        \"LOCAL_WORKSPACE_FOLDER\": \"${localWorkspaceFolder}\",\n        \"MY_SERVER\": \"dbachecks1\"\n    },\n    \"service\": \"dbachecks1\",\n    \"settings\": {\n        \"editor.renderWhitespace\": \"all\",\n        \"editor.bracketPairColorization.enabled\": true,\n        \"editor.guides.bracketPairs\": true,\n        \"editor.inlineSuggest.enabled\": true,\n        \"editor.mouseWheelZoom\": true,\n        \"editor.rulers\": [\n            100\n        ],\n        \"editor.wordWrapColumn\": 100,\n        \"editor.wordWrap\": \"bounded\",\n        \"files.defaultLanguage\": \"powershell\",\n        \"git.autofetch\": true,\n        \"powershell.scriptAnalysis.settingsPath\": \"PSScriptAnalyzerSettings.psd1\",\n        \"powershell.integratedConsole.focusConsoleOnExecute\": true,\n        \"powershell.codeFormatting.preset\": \"OTBS\",\n        \"powershell.codeFormatting.trimWhitespaceAroundPipe\": true,\n        \"powershell.codeFormatting.useCorrectCasing\": true,\n        \"powershell.codeFormatting.newLineAfterCloseBrace\": true,\n        \"powershell.codeFormatting.newLineAfterOpenBrace\": true,\n        \"powershell.codeFormatting.whitespaceAroundOperator\": true,\n        \"powershell.codeFormatting.addWhitespaceAroundPipe\": true,\n        \"#terminal.integrated.profiles.linux#\": {\n        \"pwsh\": {\n            \"path\": \"pwsh\",\n            \"icon\": \"terminal-powershell\"\n        }\n    },\n    \"terminal.integrated.defaultProfile.linux\": \"pwsh\"\n    },\n    \"extensions\": [\n        \"ms-vscode.powershell\",\n        \"github.vscode-pull-request-github\",\n        \"2gua.rainbow-brackets\",\n        \"oderwat.indent-rainbow\",\n        \"mhutchie.git-graph\",\n        \"usernamehw.errorlens\",\n        \"GitHub.copilot\",\n        \"eamodio.gitlens\",\n        \"TylerLeonhardt.vscode-inline-values-powershell\",\n        \"cschleiden.vscode-github-actions\",\n        \"ms-mssql.mssql\",\n        \"Gruntfuggly.todo-tree\"\n    ],\n    \"shutdownAction\": \"stopCompose\",\n    \"remoteUser\": \"root\"  // not ideal - prob need to setup a non-root user and use that instead. permissions issue without this!\n}"
  },
  {
    "path": ".devcontainer/devcontainer.json",
    "content": "{\n    \"name\": \"dbachecks\",\n    \"workspaceFolder\": \"/workspace\",\n    \"dockerComposeFile\": [\n        \"docker-compose.yml\"\n    ],\n    \"remoteEnv\": {\n        \"LOCAL_WORKSPACE_FOLDER\": \"${localWorkspaceFolder}\",\n        \"MY_SERVER\": \"dbachecks1\"\n    },\n    \"service\": \"dbachecks1\",\n    \"shutdownAction\": \"stopCompose\",\n    \"remoteUser\": \"root\", // not ideal - prob need to setup a non-root ,user and use that instead. permissions issue without this!\n    \"customizations\": {\n        \"vscode\": {\n            \"extensions\": [\n                \"ms-vscode.powershell\",\n                \"github.vscode-pull-request-github\",\n                \"oderwat.indent-rainbow\",\n                \"mhutchie.git-graph\",\n                \"usernamehw.errorlens\",\n                \"GitHub.copilot\",\n                \"eamodio.gitlens\",\n                \"TylerLeonhardt.vscode-inline-values-powershell\",\n                \"cschleiden.vscode-github-actions\",\n                \"ms-mssql.mssql\",\n                \"Gruntfuggly.todo-tree\",\n                \"streetsidesoftware.code-spell-checker\"\n            ],\n            \"settings\": {\n                \"editor.renderWhitespace\": \"all\",\n                \"editor.bracketPairColorization.enabled\": true,\n                \"editor.guides.bracketPairs\": true,\n                \"editor.inlineSuggest.enabled\": true,\n                \"editor.mouseWheelZoom\": true,\n                \"editor.rulers\": [\n                    100\n                ],\n                \"editor.wordWrapColumn\": 100,\n                \"editor.wordWrap\": \"bounded\",\n                \"files.defaultLanguage\": \"powershell\",\n                \"git.autofetch\": true,\n                \"powershell.developer.bundledModulesPath\": \"${cwd}/output/RequiredModules\",\n                \"powershell.scriptAnalysis.settingsPath\": \"PSScriptAnalyzerSettings.psd1\",\n                \"powershell.integratedConsole.focusConsoleOnExecute\": true,\n                \"powershell.codeFormatting.preset\": \"OTBS\",\n                \"powershell.codeFormatting.trimWhitespaceAroundPipe\": true,\n                \"powershell.codeFormatting.useCorrectCasing\": true,\n                \"powershell.codeFormatting.newLineAfterCloseBrace\": true,\n                \"powershell.codeFormatting.newLineAfterOpenBrace\": true,\n                \"powershell.codeFormatting.whitespaceBeforeOpenBrace\": true,\n                \"powershell.codeFormatting.whitespaceBeforeOpenParen\": true,\n                \"powershell.codeFormatting.whitespaceAroundOperator\": true,\n                \"powershell.codeFormatting.whitespaceAfterSeparator\": true,\n                \"powershell.codeFormatting.addWhitespaceAroundPipe\": true,\n                \"powershell.codeFormatting.openBraceOnSameLine\": true,\n                \"powershell.codeFormatting.ignoreOneLineBlock\": true,\n                \"powershell.codeFormatting.pipelineIndentationStyle\": \"IncreaseIndentationAfterEveryPipeline\",\n                \"powershell.codeFormatting.alignPropertyValuePairs\": true,\n                \"powershell.codeFormatting.blankLinesAroundCommentHelpBlock\": true,\n                \"powershell.codeFormatting.blankLinesAroundFunctionDefinitionBody\": true,\n                \"powershell.codeFormatting.blankLinesAroundPipeline\": true,\n                \"powershell.codeFormatting.blankLinesAroundRegion\": true,\n                \"powershell.codeFormatting.blankLinesBeforeCloseBrace\": true,\n                \"powershell.codeFormatting.blankLinesBeforeFirstLine\": true,\n                \"powershell.codeFormatting.blankLinesBeforeOpenBrace\": true,\n                \"powershell.codeFormatting.blankLinesBetweenMemberDefinition\": true,\n                \"powershell.codeFormatting.blankLinesBetweenUsings\": true,\n                \"powershell.codeFormatting.collapseBracesToIndentation\": true,\n                \"powershell.codeFormatting.collapsePipeline\": true,\n                \"powershell.codeFormatting.newLineAfterCloseBraceInBlock\": true,\n                \"powershell.codeFormatting.newLineAfterCloseBraceInElse\": true,\n                \"powershell.codeFormatting.newLineAfterCloseBraceInFunction\": true,\n                \"powershell.codeFormatting.newLineAfterCloseBraceInIf\": true,\n                \"powershell.codeFormatting.newLineAfterCloseBraceInSwitch\": true,\n                \"powershell.codeFormatting.newLineAfterCloseBraceInTry\": true,\n                \"powershell.codeFormatting.newLineAfterCloseBraceInWhile\": true,\n                \"powershell.codeFormatting.newLineAfterColonInHashtable\": true,\n                \"powershell.codeFormatting.newLineAfterComma\": true,\n                \"powershell.codeFormatting.newLineAfterDoWhile\": true,\n                \"powershell.codeFormatting.newLineAfterFor\": true,\n                \"powershell.codeFormatting.newLineAfterForEach\": true,\n                \"powershell.codeFormatting.newLineAfterIf\": true,\n                \"powershell.codeFormatting.newLineAfterOpenBraceInBlock\": true,\n                \"powershell.codeFormatting.newLineAfterOpenBraceInElse\": true,\n                \"powershell.codeFormatting.newLineAfterOpenBraceInFunction\": true,\n                \"powershell.codeFormatting.newLineAfterOpenBraceInIf\": true,\n                \"powershell.codeFormatting.newLineAfterOpenBraceInSwitch\": true,\n                \"powershell.codeFormatting.newLineAfterOpenBraceInTry\": true,\n                \"powershell.codeFormatting.newLineAfterOpenBraceInWhile\": true,\n                \"powershell.codeFormatting.newLineAfterSwitch\": true,\n                \"powershell.codeFormatting.newLineAfterTry\": true,\n                \"powershell.codeFormatting.newLineAfterWhile\": true,\n                \"powershell.codeFormatting.newLineBeforeCloseBrace\": true,\n                \"powershell.codeFormatting.newLineBeforeElse\": true,\n                \"powershell.codeFormatting.newLineBeforeElseIf\": true,\n                \"powershell.codeFormatting.newLineBeforeCatch\": true,\n                \"powershell.codeFormatting.newLineBeforeFinally\": true,\n                \"powershell.codeFormatting.newLineBetweenTypeDefinitionMembers\": true,\n                \"powershell.codeFormatting.pipelineIndentation\": 4,\n                \"powershell.codeFormatting.spaceAfterComma\": true,\n                \"powershell.codeFormatting.spaceAfterSemicolon\": true,\n                \"powershell.codeFormatting.spaceAroundOperator\": true,\n                \"powershell.codeFormatting.spaceBeforeComma\": true,\n                \"powershell.codeFormatting.spaceBeforeSemicolon\": true,\n                \"powershell.codeFormatting.spaceBetweenEmptyBraces\": true,\n                \"powershell.codeFormatting.spaceBetweenEmptyParenthesis\": true,\n                \"powershell.codeFormatting.useConsistentIndentation\": true,\n                \"powershell.codeFormatting.useCorrectCasingForCommand\": true,\n                \"powershell.codeFormatting.useCorrectCasingForParameter\": true,\n                \"powershell.codeFormatting.useCorrectCasingForKeyword\": true,\n                \"powershell.codeFormatting.useCorrectCasingForType\": true,\n                \"powershell.codeFormatting.useCorrectCasingForVariable\": true,\n                \"powershell.codeFormatting.useConsistentWhitespace\": true,\n                \"powershell.codeFormatting.useCorrectCasingForAttribute\": true,\n                \"powershell.codeFormatting.useCorrectCasingForProperty\": true,\n                \"powershell.codeFormatting.useCorrectCasingForEnum\": true,\n                \"powershell.codeFormatting.useCorrectCasingForMethod\": true,\n                \"powershell.codeFormatting.useCorrectCasingForFunction\": true,\n                \"powershell.codeFormatting.useCorrectCasingForClass\": true,\n                \"powershell.codeFormatting.useCorrectCasingForInterface\": true,\n                \"powershell.codeFormatting.useCorrectCasingForNamespace\": true,\n                \"powershell.codeFormatting.useCorrectCasingForModule\": true,\n                \"powershell.codeFormatting.useCorrectCasingForWorkflow\": true,\n                \"powershell.codeFormatting.useCorrectCasingForParameterSet\": true,\n                \"powershell.codeFormatting.useCorrectCasingForVariableInForLoop\": true,\n                \"powershell.codeFormatting.useCorrectCasingForDSCResource\": true,\n                \"powershell.codeFormatting.useCorrectCasingForDSCResourceParameter\": true,\n                \"powershell.codeFormatting.useCorrectCasingForEnumMember\": true,\n                \"powershell.codeFormatting.useCorrectCasingForCommentHelp\": true,\n                \"powershell.codeFormatting.useCorrectCasingForCommentHelpParameter\": true,\n                \"powershell.codeFormatting.useCorrectCasingForCommentHelpKeyword\": true,\n                \"powershell.codeFormatting.useCorrectCasingForCommentHelpParameterSet\": true,\n                \"powershell.codeFormatting.useCorrectCasingForCommentHelpType\": true,\n                \"powershell.codeFormatting.useCorrectCasingForCommentHelpFunction\": true,\n                \"powershell.codeFormatting.useCorrectCasingForCommentHelpWorkflow\": true,\n                \"powershell.codeFormatting.useCorrectCasingForCommentHelpModule\": true,\n                \"powershell.codeFormatting.useCorrectCasingForCommentHelpClass\": true,\n                \"powershell.codeFormatting.useCorrectCasingForCommentHelpInterface\": true,\n                \"powershell.codeFormatting.useCorrectCasingForCommentHelpEnum\": true,\n                \"powershell.codeFormatting.useCorrectCasingForCommentHelpDSCResource\": true,\n                \"powershell.codeFormatting.useCorrectCasingForCommentHelpExample\": true,\n                \"powershell.codeFormatting.useCorrectCasingForCommentHelpInputs\": true,\n                \"powershell.codeFormatting.useCorrectCasingForCommentHelpOutputs\": true,\n                \"powershell.codeFormatting.useCorrectCasingForCommentHelpNotes\": true,\n                \"powershell.codeFormatting.useCorrectCasingForCommentHelpLink\": true,\n                \"powershell.codeFormatting.useCorrectCasingForCommentHelpComponent\": true,\n                \"powershell.codeFormatting.useCorrectCasingForCommentHelpRole\": true,\n                \"powershell.codeFormatting.useCorrectCasingForCommentHelpFunctionality\": true,\n                \"powershell.codeFormatting.useCorrectCasingForCommentHelpForwardHelpCategory\": true,\n                \"powershell.codeFormatting.useCorrectCasingForCommentHelpForwardHelpTargetName\": true,\n                \"powershell.codeFormatting.autoCorrectAliases\": true,\n                \"powershell.codeFormatting.avoidSemicolonsAsLineTerminators\": true,\n                // \"powershell.codeFormatting.useConstantStrings\": true,\n                \"powershell.codeFormatting.whitespaceBetweenParameters\": true,\n                \"powershell.codeFormatting.whitespaceInsideBrace\": true,\n                \"powershell.codeFolding.enable\": true,\n                \"powershell.codeFolding.showLastLine\": true,\n                \"powershell.enableReferencesCodeLens\": true,\n                \"editor.formatOnSave\": true,\n                \"editor.formatOnSaveMode\": \"file\",\n                \"editor.formatOnPaste\": true,\n                \"editor.formatOnType\": true,\n                \"editor.autoClosingBrackets\": \"always\",\n                \"#terminal.integrated.profiles.linux#\": {\n                    \"pwsh\": {\n                        \"path\": \"pwsh\",\n                        \"icon\": \"terminal-powershell\"\n                    }\n                },\n                \"terminal.integrated.defaultProfile.linux\": \"pwsh\"\n            }\n        }\n    },\n    \"postCreateCommand\": \"\"\n}"
  },
  {
    "path": ".devcontainer/docker-compose.yml",
    "content": "version: \"3\"\nservices:\n    dbachecks1:\n      image: dbachecks/sqlinstance1:v2.38.0\n      volumes:\n        - mydata:/var/opt/backups\n        - shared:/shared\n        # Update this to wherever you want VS Code to mount the folder of your project\n        - ..:/workspace:cached\n      ports:\n        - \"7401:1433\"\n      container_name: dbachecks1\n      hostname: dbachecks1\n\n    dbachecks2:\n      image: dbachecks/sqlinstance2:v2.38.0\n      volumes:\n        - mydata:/var/opt/backups\n        - shared:/shared\n        # Update this to wherever you want VS Code to mount the folder of your project\n        # So that the second container is rebuilt everytime as well\n        - ..:/somewhereweirdworkspace:cached\n      ports:\n        - \"7402:1433\"\n      container_name: dbachecks2\n      hostname: dbachecks2\n\n      # This is our SQL2022 container\n    dbachecks3:\n      image: dbachecks/sqlinstance3:v2.38.0\n      volumes:\n        - mydata:/var/opt/backups\n        - shared:/shared\n        # Update this to wherever you want VS Code to mount the folder of your project\n        # So that the second container is rebuilt everytime as well\n        - ..:/somewhereweirdworkspace:cached\n      ports:\n        - \"7403:1433\"\n      container_name: dbachecks3\n      hostname: dbachecks3\n\n\nvolumes:\n  mydata:\n  shared:\n"
  },
  {
    "path": ".gitattributes",
    "content": "# Auto detect text files and perform LF normalization\n* text=auto\n\n# Custom for Visual Studio\n*.cs     diff=csharp\n\n# Standard to msysgit\n*.doc\t diff=astextplain\n*.DOC\t diff=astextplain\n*.docx diff=astextplain\n*.DOCX diff=astextplain\n*.dot  diff=astextplain\n*.DOT  diff=astextplain\n*.pdf  diff=astextplain\n*.PDF\t diff=astextplain\n*.rtf\t diff=astextplain\n*.RTF\t diff=astextplain\n"
  },
  {
    "path": ".github/FUNDING.yml",
    "content": "# These are supported funding model platforms\n\ngithub: [sqldbawithabeard, jpomfret, ClaudioESSilva, potatoqualitee]\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.md",
    "content": "---\nname: Bug report\nabout: Create a report to help us improve\n\n---\n\n<!-- ERASE the sections that are not applicable but please provide as much information as possible -->\n\n## Bug Report\n\n### General Troubleshooting steps\n- [ ] Verified running the latest release of dbachecks? \n\nDoes `(Find-Module dbachecks).Version match (Get-Module dbachecks).Version.ToString()`\n\n![image](https://user-images.githubusercontent.com/6729780/37113488-60e5e172-21fa-11e8-8115-814edfbfabb6.png)\n\n- [ ] Verified errors are not related to permissions?\n- [ ] Can duplicate in new/clean PowerShell session (clean = `powershell -NoProfile`)?\n\n### Version Information\n - Operating System (Name|Version): <!-- enter name and version -->\n - PowerShell Version: <!-- enter version of PS where code is run -->\n - SQL Server (Edition|Version): <!-- enter Edition and Version for Source and Target if applicable -->\n\n### Steps to Reproduce\n<--  \n  PLEASE include as much information as possible if this is a bug report.\n  The more you include the faster we can identify the problem and get it fixed\n-->\n - [ ] Attach any screenshots (if possible/allowed)\n - [ ] Attach output from PowerShell console (if possible/allowed)\n\n### Description of Bug\n\n<--  \n  PLEASE include as much information as possible if this is a bug\nExplain what it does that you would like it not to do\nor\nWhat it doesnt do that you would like it to do :-)\n-->\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature_request.md",
    "content": "---\nname: Feature request\nabout: Suggest an idea for this project\n\n---\n\n## Feature Request\n   \n<-- Simply answer the question - What would you like dbachecks to do that it doesn't? -->   \n   \n## New Check\n   \n### What would you like to check?\n   \n### What should be configurable for the results of the check ?\n    \n<-- A value, a set of properties (like FULL, SIMPLE, BULKLOGGED) -->  \n<-- Should there be any default values for the configs? -->   \n    \n### What should be able to be excluded from being tested ?\n    \n<-- Could be databases, Could be Availability Groups etc -->  \n<-- This would not be instances -->  \n   \n## Additional information    \n    \n<!-- replace with your answer -->\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/question.md",
    "content": "---\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",
    "content": "# 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## Accepting a PR\n\nBefore 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\n\nhttps://github.com/sqlcollaborative/dbachecks/wiki \n\n## Please confirm you have 0 failing Pester Tests\n\n[] There are 0 failing Pester tests\n\n## Changes this PR brings\n\nPlease add below the changes that this PR covers. It doesnt need an essay just the bullet points :-)"
  },
  {
    "path": ".github/issue_template.md",
    "content": "<!-- ERASE the sections that are not applicable but please provide as much information as possible -->\n## Issue\n\nThis is a bug or unexpected behaviour/feature request/new check/question (delete as applicable)\n\n<!-- Please fill in the appropriate information below and delete any uneeded information-->\n\n## Bug Report\n\n### General Troubleshooting steps\n- [ ] Verified running the latest release of dbachecks? \n\nDoes `(Find-Module dbachecks).Version match (Get-Module dbachecks).Version.ToString()`\n\n![image](https://user-images.githubusercontent.com/6729780/37113488-60e5e172-21fa-11e8-8115-814edfbfabb6.png)\n\n- [ ] Verified errors are not related to permissions?\n- [ ] Can duplicate in new/clean PowerShell session (clean = `powershell -NoProfile`)?\n\n### Version Information\n - Operating System (Name|Version): <!-- enter name and version -->\n - PowerShell Version: <!-- enter version of PS where code is run -->\n - SQL Server (Edition|Version): <!-- enter Edition and Version for Source and Target if applicable -->\n\n### Steps to Reproduce\n<--  \n  PLEASE include as much information as possible if this is a bug report.\n  The more you include the faster we can identify the problem and get it fixed\n-->\n - [ ] Attach any screenshots (if possible/allowed)\n - [ ] Attach output from PowerShell console (if possible/allowed)\n\n## Feature Request\n   \n<-- Simply answer the question - What would you like dbachecks to do that it doesn't? -->   \n   \n## New Check\n   \n### What would you like to check?\n   \n### What should be configurable for the results of the check ?\n    \n<-- A value, a set of properties (like FULL, SIMPLE, BULKLOGGED) -->  \n<-- Should there be any default values for the configs? -->   \n    \n### What should be able to be excluded from being tested ?\n    \n<-- Could be databases, Could be Availability Groups etc -->  \n<-- This would not be instances -->  \n   \n## Additional information    \n    \n<!-- replace with your answer -->\n"
  },
  {
    "path": ".github/workflows/PR-PesterTest.yml",
    "content": "name: PR-Pester\n\non:\n  pull_request:\n    branches:\n    - development\n\njobs:\n  build:\n\n    runs-on: windows-latest\n    steps:\n    - name: Checkout code Install and run Pester annoyingly on Windows PowerShell https://github.com/pester/Pester/issues/1295\n      uses: actions/checkout@v2.1.0\n    \n    - run: |\n          pwd\n          $manifest = Import-PowershellDataFile -Path .\\dbachecks.psd1\n          $PSFrameworkVersion = $manifest.RequiredModules.Where{$_.ModuleName -eq 'PSFramework'}.ModuleVersion\n          $dbatoolsVersion = $manifest.RequiredModules.Where{$_.ModuleName -eq 'dbatools'}.ModuleVersion\n  \n          Install-Module Pester  -RequiredVersion 4.10.0 -Force\n          Install-Module dbatools  -RequiredVersion $dbatoolsVersion  -Force\n          Install-Module PSFramework  -RequiredVersion $PsFrameworkVersion  -Force\n  \n          Import-Module .\\dbachecks.psd1 -Verbose\n          $PesterResults = Invoke-Pester .\\tests -ExcludeTag Integration -Show Fails -PassThru\n          If($PesterResults.FailedCount -ne 0){\n            Write-Warning \"Some Tests Failed - See results above\"\n            [System.Environment]::Exit(1)\n          }\n      shell: powershell\n"
  },
  {
    "path": ".github/workflows/PR.yml",
    "content": "on:\n  pull_request:\n    branches:\n    - main\n    paths-ignore:\n    - CHANGELOG.md\n    tags:\n    - '**'\n    - '!*preview*'\nenv:\n  buildFolderName: output\n  buildArtifactName: output\n  testResultFolderName: testResults\njobs:\n  Build_Stage_Package_Module:\n    name: Package Module\n    runs-on: ubuntu-latest\n    steps:\n    - name: Checkout Code\n      uses: actions/checkout@v3\n      with:\n        ref: ${{github.event.pull_request.head.ref}}\n        repository: ${{github.event.pull_request.head.repo.full_name}}   # checkout the correct branch name\n        fetch-depth: 0\n    - name: Install GitVersion\n      uses: gittools/actions/gitversion/setup@v0.9.15\n      with:\n        versionSpec: 5.x\n    - name: Evaluate Next Version\n      uses: gittools/actions/gitversion/execute@v0.9.15\n      with:\n        configFilePath: GitVersion.yml\n    - name: Build & Package Module\n      shell: pwsh\n      run: ./build.ps1 -ResolveDependency -tasks pack -Verbose\n      env:\n        ModuleVersion: ${{ env.gitVersion.NuGetVersionV2 }}\n    - name: Publish Build Artifact\n      uses: actions/upload-artifact@v4\n      with:\n        name: ${{ env.buildArtifactName }}\n        path: ${{ env.buildFolderName }}/\n  Test_Stage_test_linux:\n    name: Linux\n    runs-on: ubuntu-latest\n    needs:\n    - Build_Stage_Package_Module\n    steps:\n    - name: Checkout Code\n      uses: actions/checkout@v3\n      with:\n        ref: ${{github.event.pull_request.head.ref}}\n        repository: ${{github.event.pull_request.head.repo.full_name}}   # checkout the correct branch name\n        fetch-depth: 0\n    - name: Download Build Artifact\n      uses: actions/download-artifact@v4\n      with:\n        name: ${{ env.buildArtifactName }}\n        path: ${{ env.buildFolderName }}\n    - name: Run Tests\n      shell: pwsh\n      run: ./build.ps1 -tasks noop ; ./build.ps1 -tasks test # to get around dbatools failing to load XE.core.dll if\n    - name: Publish Test Artifact\n      uses: actions/upload-artifact@v4\n      with:\n        path: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/\n        name: CodeCoverageLinux\n      if: success() || failure()\n  Test_Stage_test_windows_core:\n    name: Windows (PowerShell)\n    runs-on: windows-2019\n    needs:\n    - Build_Stage_Package_Module\n    steps:\n    - name: Checkout Code\n      uses: actions/checkout@v3\n      with:\n        ref: ${{github.event.pull_request.head.ref}}\n        repository: ${{github.event.pull_request.head.repo.full_name}}   # checkout the correct branch name\n        fetch-depth: 0\n    - name: Download Build Artifact\n      uses: actions/download-artifact@v4\n      with:\n        name: ${{ env.buildArtifactName }}\n        path: ${{ env.buildFolderName }}\n    - name: Run Tests\n      shell: pwsh\n      run: ./build.ps1 -tasks noop; ipmo dbatools ; ./build.ps1 -tasks test # to get around dbatools failing to load XE.core.dll if\n\n    - name: Publish Test Artifact\n      uses: actions/upload-artifact@v4\n      with:\n        path: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/\n        name: CodeCoverageWinPS7\n      if: success() || failure()\n  Test_Stage_test_windows_ps:\n    name: Windows (Windows PowerShell)\n    runs-on: windows-2019\n    needs:\n    - Build_Stage_Package_Module\n    steps:\n    - name: Checkout Code\n      uses: actions/checkout@v3\n      with:\n        ref: ${{github.event.pull_request.head.ref}}\n        repository: ${{github.event.pull_request.head.repo.full_name}}   # checkout the correct branch name\n        fetch-depth: 0\n    - name: Download Build Artifact\n      uses: actions/download-artifact@v4\n      with:\n        name: ${{ env.buildArtifactName }}\n        path: ${{ env.buildFolderName }}\n    - name: Run Tests\n      shell: pwsh\n      run: ./build.ps1 -ResolveDependency -tasks test\n    - name: Publish Test Artifact\n      uses: actions/upload-artifact@v4\n      with:\n        path: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/\n        name: CodeCoverageWinPS51\n      if: success() || failure()\n  Test_Stage_Code_Coverage:\n    name: Publish Code Coverage\n    if: success() || failure()\n    runs-on: ubuntu-latest\n    needs:\n    - Build_Stage_Package_Module\n    - Test_Stage_test_linux\n    - Test_Stage_test_windows_core\n    - Test_Stage_test_windows_ps\n    steps:\n    - name: Checkout Code\n      uses: actions/checkout@v3\n      with:\n        ref: ${{github.event.pull_request.head.ref}}   # checkout the correct branch name\n        repository: ${{github.event.pull_request.head.repo.full_name}}   # checkout the correct branch name\n        fetch-depth: 0\n\n    - name: Download Test Artifact Linux\n      uses: actions/download-artifact@v4\n      with:\n        name: CodeCoverageLinux\n        path: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/CodeCoverageLinux/\n    - name: Download Test Artifact Windows (PS 5.1)\n      uses: actions/download-artifact@v4\n      with:\n        name: CodeCoverageWinPS51\n        path: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/CodeCoverageWinPS51/\n    - name: Download Test Artifact Windows (PS7)\n      uses: actions/download-artifact@v4\n      with:\n        name: CodeCoverageWinPS7\n        path: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/CodeCoverageWinPS7/\n\n    - name: Publish Linux Test Results\n      id: linux-test-results\n      uses: EnricoMi/publish-unit-test-result-action@v2\n      if: always()\n      with:\n        nunit_files: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/CodeCoverageLinux/NUnit*.xml\n        check_name: Linux Test Results\n    - name: Publish WinPS51 Test Results\n      id: winps51-test-results\n      uses: EnricoMi/publish-unit-test-result-action@v2\n      if: always()\n      with:\n        nunit_files: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/CodeCoverageWinPS51/NUnit*.xml\n        check_name: WinPS51 Test Results\n    - name: Publish WinPS71 Test Results\n      id: winps71-test-results\n      uses: EnricoMi/publish-unit-test-result-action@v2\n      if: always()\n      with:\n        nunit_files: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/CodeCoverageWinPS7/NUnit*.xml\n        check_name: WinPS71 Test Results\n"
  },
  {
    "path": ".github/workflows/deploy-module.yml",
    "content": "on:\n  push:\n    branches:\n    - main\n    paths-ignore:\n    - CHANGELOG.md\n    - containers/**\n    - .github/**\n    tags:\n    - '**'\n    - '!*preview*'\nenv:\n  buildFolderName: output\n  buildArtifactName: output\n  testResultFolderName: testResults\njobs:\n  Build_Stage_Package_Module:\n    name: Package Module\n    runs-on: ubuntu-latest\n    steps:\n    - name: Checkout Code\n      uses: actions/checkout@v3\n      with:\n        ref: ${{ github.head_ref }}   # checkout the correct branch name\n        fetch-depth: 0\n    - name: Install GitVersion\n      uses: gittools/actions/gitversion/setup@v0.9.15\n      with:\n        versionSpec: 5.x\n    - name: Evaluate Next Version\n      uses: gittools/actions/gitversion/execute@v0.9.15\n      with:\n        configFilePath: GitVersion.yml\n    - name: Build & Package Module\n      shell: pwsh\n      run: ./build.ps1 -ResolveDependency -tasks pack -Verbose\n      env:\n        ModuleVersion: ${{ env.gitVersion.NuGetVersionV2 }}\n    - name: Publish Build Artifact\n      uses: actions/upload-artifact@v4\n      with:\n        name: ${{ env.buildArtifactName }}\n        path: ${{ env.buildFolderName }}/\n  Test_Stage_test_linux:\n    name: Linux\n    runs-on: ubuntu-latest\n    needs:\n    - Build_Stage_Package_Module\n    steps:\n    - name: Checkout Code\n      uses: actions/checkout@v3\n      with:\n        ref: ${{ github.head_ref }}   # checkout the correct branch name\n        fetch-depth: 0\n    - name: Download Build Artifact\n      uses: actions/download-artifact@v4\n      with:\n        name: ${{ env.buildArtifactName }}\n        path: ${{ env.buildFolderName }}\n    - name: Run Tests\n      shell: pwsh\n      run: ./build.ps1 -tasks noop; ipmo dbatools ; ./build.ps1 -tasks test # to get around dbatools failing to load XE.core.dll if\n    - name: Publish Test Artifact\n      uses: actions/upload-artifact@v4\n      with:\n        path: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/\n        name: CodeCoverageLinux\n      if: success() || failure()\n  Test_Stage_test_windows_core:\n    name: Windows (PowerShell)\n    runs-on: windows-2019\n    needs:\n    - Build_Stage_Package_Module\n    steps:\n    - name: Checkout Code\n      uses: actions/checkout@v3\n      with:\n        ref: ${{ github.head_ref }}   # checkout the correct branch name\n        fetch-depth: 0\n    - name: Download Build Artifact\n      uses: actions/download-artifact@v4\n      with:\n        name: ${{ env.buildArtifactName }}\n        path: ${{ env.buildFolderName }}\n    - name: Run Tests\n      shell: pwsh\n      run: ./build.ps1 -tasks noop; ipmo dbatools ; ./build.ps1 -tasks test # to get around dbatools failing to load XE.core.dll if\n\n    - name: Publish Test Artifact\n      uses: actions/upload-artifact@v4\n      with:\n        path: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/\n        name: CodeCoverageWinPS7\n      if: success() || failure()\n  Test_Stage_test_windows_ps:\n    name: Windows (Windows PowerShell)\n    runs-on: windows-2019\n    needs:\n    - Build_Stage_Package_Module\n    steps:\n    - name: Checkout Code\n      uses: actions/checkout@v3\n      with:\n        ref: ${{ github.head_ref }}   # checkout the correct branch name\n        fetch-depth: 0\n    - name: Download Build Artifact\n      uses: actions/download-artifact@v4\n      with:\n        name: ${{ env.buildArtifactName }}\n        path: ${{ env.buildFolderName }}\n    - name: Run Tests\n      shell: pwsh\n      run: ./build.ps1 -ResolveDependency -tasks test\n    - name: Publish Test Artifact\n      uses: actions/upload-artifact@v4\n      with:\n        path: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/\n        name: CodeCoverageWinPS51\n      if: success() || failure()\n#   Test_Stage_test_macos:\n#     name: macOS\n#     runs-on: macos-latest\n#     needs:\n#     - Build_Stage_Package_Module\n#     steps:\n#     - name: Checkout Code\n#       uses: actions/checkout@v3\n#       with:\n#         ref: ${{ github.head_ref }}   # checkout the correct branch name\n#         fetch-depth: 0\n#     - name: Download Build Artifact\n#       uses: actions/download-artifact@v4\n#       with:\n#         name: ${{ env.buildArtifactName }}\n#         path: ${{ env.buildFolderName }}\n#     - name: Run Tests\n#       shell: pwsh\n#       run: ./build.ps1 -tasks noop; ipmo dbatools ; ./build.ps1 -tasks test # to get # around dbatools failing to load XE.core.dll if\n#\n#     - name: Publish Test Artifact\n#       uses: actions/upload-artifact@v4\n#       with:\n#         path: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/\n#         name: CodeCoverageMacOS\n#       if: success() || failure()\n  Test_Stage_Code_Coverage:\n    name: Publish Code Coverage\n    if: success() || failure()\n    runs-on: ubuntu-latest\n    needs:\n    - Build_Stage_Package_Module\n#    - Test_Stage_test_macos\n    - Test_Stage_test_linux\n    - Test_Stage_test_windows_core\n    - Test_Stage_test_windows_ps\n    steps:\n    - name: Checkout Code\n      uses: actions/checkout@v3\n      with:\n        ref: ${{ github.head_ref }}   # checkout the correct branch name\n        fetch-depth: 0\n#    - name: Download Test Artifact macOS\n#      uses: actions/download-artifact@v4\n#      with:\n#        name: CodeCoverageMacOS\n#        path: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/CodeCoverageMacOS/\n    - name: Download Test Artifact Linux\n      uses: actions/download-artifact@v4\n      with:\n        name: CodeCoverageLinux\n        path: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/CodeCoverageLinux/\n    - name: Download Test Artifact Windows (PS 5.1)\n      uses: actions/download-artifact@v4\n      with:\n        name: CodeCoverageWinPS51\n        path: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/CodeCoverageWinPS51/\n    - name: Download Test Artifact Windows (PS7)\n      uses: actions/download-artifact@v4\n      with:\n        name: CodeCoverageWinPS7\n        path: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/CodeCoverageWinPS7/\n#    - name: Publish MacOs Test Results\n#      id: macos-test-results\n#      uses: EnricoMi/publish-unit-test-result-action@v2\n#      if: always()\n#      with:\n#        nunit_files: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/#CodeCoverageMacOS/NUnit*.xml\n#        check_name: MacOs Test Results\n    - name: Publish Linux Test Results\n      id: linux-test-results\n      uses: EnricoMi/publish-unit-test-result-action@v2\n      if: always()\n      with:\n        nunit_files: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/CodeCoverageLinux/NUnit*.xml\n        check_name: Linux Test Results\n    - name: Publish WinPS51 Test Results\n      id: winps51-test-results\n      uses: EnricoMi/publish-unit-test-result-action@v2\n      if: always()\n      with:\n        nunit_files: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/CodeCoverageWinPS51/NUnit*.xml\n        check_name: WinPS51 Test Results\n    - name: Publish WinPS71 Test Results\n      id: winps71-test-results\n      uses: EnricoMi/publish-unit-test-result-action@v2\n      if: always()\n      with:\n        nunit_files: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/CodeCoverageWinPS7/NUnit*.xml\n        check_name: WinPS71 Test Results\n#    - name: Set Macos badge color\n#      shell: bash\n#      run: |\n#        case ${{ fromJSON( steps.macos-test-results.outputs.json ).conclusion }} in\n#          success)\n#            echo \"MACOSBADGE_COLOR=31c653\" >> $GITHUB_ENV\n#            ;;\n#          failure)\n#            echo \"MACOSBADGE_COLOR=800000\" >> $GITHUB_ENV\n#            ;;\n#          neutral)\n#            echo \"MACOSBADGE_COLOR=696969\" >> $GITHUB_ENV\n#            ;;\n#        esac\n#    - name: Create Macos badge\n#      uses:  emibcn/badge-action@v1.2.1\n#      with:\n#        label: Tests\n#        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 }}'\n#        color: ${{ env.MACOSBADGE_COLOR }}\n#        path: macos-badge.svg\n#    - name: Upload MacOs badge to Gist\n#      # Upload only for main branch\n#      if: >\n#        github.event_name == 'workflow_run' && github.event.workflow_run.head_branch == #'main' ||\n#        github.event_name != 'workflow_run' && github.ref == 'refs/heads/main'\n#      uses: andymckay/append-gist-action@1fbfbbce708a39bd45846f0955ed5521f2099c6d\n#      with:\n#        token: ${{ secrets.GIST_TOKEN }}\n#        gistURL: https://gist.githubusercontent.com/SQLDBAWithABeard/#7a5d2837e29654202f22392187c75fec\n#        file: macos-badge.svg\n    - name: Set Linux badge color\n      shell: bash\n      run: |\n        case ${{ fromJSON( steps.linux-test-results.outputs.json ).conclusion }} in\n          success)\n            echo \"LINUXBADGE_COLOR=31c653\" >> $GITHUB_ENV\n            ;;\n          failure)\n            echo \"LINUXBADGE_COLOR=800000\" >> $GITHUB_ENV\n            ;;\n          neutral)\n            echo \"LINUXBADGE_COLOR=696969\" >> $GITHUB_ENV\n            ;;\n        esac\n    - name: Create Linux badge\n      uses:  emibcn/badge-action@v1.2.1\n      with:\n        label: Tests\n        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 }}'\n        color: ${{ env.LINUXBADGE_COLOR }}\n        path: linux-badge.svg\n    - name: Upload Linux badge to Gist\n      # Upload only for main branch\n      if: >\n        github.event_name == 'workflow_run' && github.event.workflow_run.head_branch == 'main' ||\n        github.event_name != 'workflow_run' && github.ref == 'refs/heads/main'\n      uses: andymckay/append-gist-action@1fbfbbce708a39bd45846f0955ed5521f2099c6d\n      with:\n        token: ${{ secrets.GIST_TOKEN }}\n        gistURL: https://gist.githubusercontent.com/SQLDBAWithABeard/7a5d2837e29654202f22392187c75fec\n        file: linux-badge.svg\n    - name: Set WinPS51 badge color\n      shell: bash\n      run: |\n        case ${{ fromJSON( steps.winps51-test-results.outputs.json ).conclusion }} in\n          success)\n            echo \"WINPS51BADGE_COLOR=31c653\" >> $GITHUB_ENV\n            ;;\n          failure)\n            echo \"WINPS51BADGE_COLOR=800000\" >> $GITHUB_ENV\n            ;;\n          neutral)\n            echo \"WINPS51BADGE_COLOR=696969\" >> $GITHUB_ENV\n            ;;\n        esac\n    - name: Create WINPS51 badge\n      uses:  emibcn/badge-action@v1.2.1\n      with:\n        label: Tests\n        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 }}'\n        color: ${{ env.WINPS51BADGE_COLOR }}\n        path: winps51-badge.svg\n    - name: Upload WINPS51 badge to Gist\n      # Upload only for main branch\n      if: >\n        github.event_name == 'workflow_run' && github.event.workflow_run.head_branch == 'main' ||\n        github.event_name != 'workflow_run' && github.ref == 'refs/heads/main'\n      uses: andymckay/append-gist-action@1fbfbbce708a39bd45846f0955ed5521f2099c6d\n      with:\n        token: ${{ secrets.GIST_TOKEN }}\n        gistURL: https://gist.githubusercontent.com/SQLDBAWithABeard/7a5d2837e29654202f22392187c75fec\n        file: winps51-badge.svg\n    - name: Set WinPS7 badge color\n      shell: bash\n      run: |\n        case ${{ fromJSON( steps.winps71-test-results.outputs.json ).conclusion }} in\n          success)\n            echo \"WINPS7BADGE_COLOR=31c653\" >> $GITHUB_ENV\n            ;;\n          failure)\n            echo \"WINPS7BADGE_COLOR=800000\" >> $GITHUB_ENV\n            ;;\n          neutral)\n            echo \"WINPS7BADGE_COLOR=696969\" >> $GITHUB_ENV\n            ;;\n        esac\n    - name: Create WinPS7 badge\n      uses:  emibcn/badge-action@v1.2.1\n      with:\n        label: Tests\n        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 }}'\n        color: ${{ env.WINPS7BADGE_COLOR }}\n        path: winps7-badge.svg\n    - name: Upload WINPS7 badge to Gist\n      # Upload only for main branch\n      if: >\n        github.event_name == 'workflow_run' && github.event.workflow_run.head_branch == 'main' ||\n        github.event_name != 'workflow_run' && github.ref == 'refs/heads/main'\n      uses: andymckay/append-gist-action@1fbfbbce708a39bd45846f0955ed5521f2099c6d\n      with:\n        token: ${{ secrets.GIST_TOKEN }}\n        gistURL: https://gist.githubusercontent.com/SQLDBAWithABeard/7a5d2837e29654202f22392187c75fec\n        file: winps7-badge.svg\n  Deploy_Stage_Deploy_Module:\n    name: Deploy Module\n    runs-on: ubuntu-latest\n    needs:\n     - Build_Stage_Package_Module\n     - Test_Stage_test_linux\n     - Test_Stage_test_windows_core\n     - Test_Stage_test_windows_ps\n#     - Test_Stage_test_macos\n     - Test_Stage_Code_Coverage\n    if: ${{ success() && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) }}\n    steps:\n    - name: Checkout Code\n      uses: actions/checkout@v3\n      with:\n        ref: ${{ github.head_ref }}   # checkout the correct branch name\n        fetch-depth: 0\n    - name: Download Build Artifact\n      uses: actions/download-artifact@v4\n      with:\n        name: ${{ env.buildArtifactName }}\n        path: ${{ env.buildFolderName }}\n    - name: Publish Release\n      shell: pwsh\n      # run: Import-Module ./output/RequiredModules/PowerShellForGitHub/0.16.1/PowerShellForGitHub.psd1 ; ./build.ps1 -tasks publish\n      run: ./build.ps1 -tasks publish\n      env:\n        GitHubToken: ${{ secrets.GitHubToken }}\n        GalleryApiToken: ${{ secrets.GalleryApiToken }}\n    - name: Send Changelog PR\n      shell: pwsh\n      run: Get-Module -Name PowerShellForGitHub -ListAvailable ;./build.ps1  -tasks Create_ChangeLog_GitHub_PR\n      env:\n        GitHubToken: ${{ secrets.GitHubToken }}\n\n    - name: Merge main -> containers\n      uses: devmasx/merge-branch@1.4.0\n      with:\n        type: now\n        from_branch: main\n        target_branch: containers\n        github_token: ${{ secrets.GITHUB_TOKEN }}\n\n"
  },
  {
    "path": ".github/workflows/docker-image.yml",
    "content": "name: Docker Image CI\n\non:\n  push:\n    branches: [ containers ]\n    paths:\n      - \".devcontainer/devcontainer.json\"\n      - \".devcontainer/docker-compose.yml\"\n      - \".devcontainer/codespaces/devcontainer.json\"\n      - \".devcontainer/codespaces/codespaces-docker-compose.yml\"\n      - containers/**\n\n  workflow_dispatch:\n\njobs:\n  docker:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v3\n        with:\n          fetch-depth: '0'\n      -\n        name: Bump version and push tag\n        id: bump\n        uses: anothrNick/github-tag-action@1.52.0\n        env:\n          DEFAULT_BUMP: minor\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n          WITH_V: true\n          RELEASE_BRANCHES: main, containers\n      -\n        name: Set up QEMU\n        uses: docker/setup-qemu-action@v2\n      -\n        name: Set up Docker Buildx\n        uses: docker/setup-buildx-action@v2\n      -\n        name: Login to DockerHub\n        uses: docker/login-action@v2\n        with:\n          username: ${{ secrets.DOCKERHUB_USERNAME }}\n          password: ${{ secrets.DOCKERHUB_TOKEN }}\n      -\n        name: Build and push First Container\n        uses: docker/build-push-action@v3\n        with:\n          push: true\n          context: containers/base/\n          tags: dbachecks/sqlinstance1:${{ steps.bump.outputs.new_tag }},dbachecks/sqlinstance1:latest\n      -\n        name: Build and push second Container\n        uses: docker/build-push-action@v3\n        with:\n          push: true\n          context: containers/second/\n          tags: dbachecks/sqlinstance2:${{ steps.bump.outputs.new_tag }},dbachecks/sqlinstance2:latest\n      -\n        name: Build and push third Container\n        uses: docker/build-push-action@v3\n        with:\n          push: true\n          context: containers/third/\n          tags: dbachecks/sqlinstance3:${{ steps.bump.outputs.new_tag }},dbachecks/sqlinstance3:latest\n      -\n        name: Find and Replace\n        uses: jacobtomlinson/gha-find-replace@v2\n        with:\n          find: \"dbachecks/sqlinstance1:.*\"\n          replace: \"dbachecks/sqlinstance1:${{ steps.bump.outputs.new_tag }}\"\n          include: \"**docker-compose.yml\"\n      -\n        name: Find and Replace Instance2\n        uses: jacobtomlinson/gha-find-replace@v2\n        with:\n          find: \"dbachecks/sqlinstance2:.*\"\n          replace: \"dbachecks/sqlinstance2:${{ steps.bump.outputs.new_tag }}\"\n          include: \"**docker-compose.yml\"\n      -\n        name: Find and Replace Instance3\n        uses: jacobtomlinson/gha-find-replace@v2\n        with:\n          find: \"dbachecks/sqlinstance3:.*\"\n          replace: \"dbachecks/sqlinstance3:${{ steps.bump.outputs.new_tag }}\"\n          include: \"**docker-compose.yml\"\n      -\n        name: Add & Commit\n        uses: EndBug/add-and-commit@v9\n        with:\n          author_name: Beardy McBeardFace\n          author_email: mrrobsewell@outlook.com\n          message: 'The Beard says we have another container - This is an automated message'\n      -\n        name: create pull request\n        run: gh pr create -B main -H containers --title 'Merge containers into main [skip ci]' --body 'Created by Github action'\n        env:\n            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}"
  },
  {
    "path": ".gitignore",
    "content": "*.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*.coverage\n.vs\n.psproj\n.sln\nmarkdownissues.txt\nnode_modules\npackage-lock.json\n"
  },
  {
    "path": ".markdownlint.json",
    "content": "{\n    \"default\": true,\n    \"MD029\": {\n        \"style\": \"one\"\n    },\n    \"MD013\": true,\n    \"MD024\": false,\n    \"MD034\": false,\n    \"no-hard-tabs\": true\n}\n"
  },
  {
    "path": ".vscode/launch.json",
    "content": "{\n    // Use IntelliSense to learn about possible attributes.\n    // Hover to view descriptions of existing attributes.\n    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387\n    \"version\": \"0.2.0\",\n    \"configurations\": [\n        {\n            \"name\": \"PowerShell: Launch Current File\",\n            \"type\": \"PowerShell\",\n            \"request\": \"launch\",\n            \"script\": \"${file}\",\n            \"cwd\": \"${file}\"\n        }\n    ]\n}"
  },
  {
    "path": ".vscode/settings.json",
    "content": "{\n    \"cSpell.words\": [\n        \"auto\",\n        \"autogrowth\",\n        \"Boggiano\",\n        \"checkdb\",\n        \"count\",\n        \"cpu\",\n        \"datafile\",\n        \"dbachecks\",\n        \"dbcconfig\",\n        \"djfcc\",\n        \"dstrait\",\n        \"errorlogentries\",\n        \"errorvar\",\n        \"failover\",\n        \"filegroup\",\n        \"fkck\",\n        \"growth\",\n        \"HADR\",\n        \"Imenes\",\n        \"kerberos\",\n        \"logfile\",\n        \"longrunningjob\",\n        \"longrunningjobs\",\n        \"niphod\",\n        \"notcontactable\",\n        \"notcontains\",\n        \"Olas\",\n        \"pingable\",\n        \"prioritisation\",\n        \"prioritised\",\n        \"Psitem\",\n        \"Remoting\",\n        \"sadisabled\",\n        \"Schenk\",\n        \"skipall\",\n        \"SOZDBA\",\n        \"spns\",\n        \"synchronised\",\n        \"tboggiano\",\n        \"Tempdb\",\n        \"trusted\",\n        \"type\",\n        \"whoisactive\",\n        \"whoisactivedatabase\"\n    ],\n    \"[markdown]\": {\n        \"editor.trimAutoWhitespace\": false,\n        \"files.trimTrailingWhitespace\": false\n    },\n    \"cSpell.enableFiletypes\": [\n        \"powershell\"\n    ]\n}"
  },
  {
    "path": ".vscode/tasks.json",
    "content": "{\n    \"version\": \"2.0.0\",\n    \"_runner\": \"terminal\",\n    \"windows\": {\n        \"options\": {\n            \"shell\": {\n                \"executable\": \"C:\\\\Windows\\\\System32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe\",\n                \"args\": [\n                    \"-NoProfile\",\n                    \"-ExecutionPolicy\",\n                    \"Bypass\",\n                    \"-Command\"\n                ]\n            }\n        }\n    },\n    \"linux\": {\n        \"options\": {\n            \"shell\": {\n                \"executable\": \"/usr/bin/pwsh\",\n                \"args\": [\n                    \"-NoProfile\",\n                    \"-Command\"\n                ]\n            }\n        }\n    },\n    \"osx\": {\n        \"options\": {\n            \"shell\": {\n                \"executable\": \"/usr/local/bin/pwsh\",\n                \"args\": [\n                    \"-NoProfile\",\n                    \"-Command\"\n                ]\n            }\n        }\n    },\n    \"tasks\": [\n        {\n            \"label\": \"build\",\n            \"type\": \"shell\",\n            \"command\": \"&${cwd}/build.ps1\",\n            \"args\": [],\n            \"presentation\": {\n                \"echo\": true,\n                \"reveal\": \"always\",\n                \"focus\": true,\n                \"panel\": \"new\",\n                \"clear\": false\n            },\n            \"runOptions\": {\n                \"runOn\": \"default\"\n            },\n            \"problemMatcher\": [\n                {\n                    \"owner\": \"powershell\",\n                    \"fileLocation\": [\n                        \"absolute\"\n                    ],\n                    \"severity\": \"error\",\n                    \"pattern\": [\n                        {\n                            \"regexp\": \"^\\\\s*(\\\\[-\\\\]\\\\s*.*?)(\\\\d+)ms\\\\s*$\",\n                            \"message\": 1\n                        },\n                        {\n                            \"regexp\": \"(.*)\",\n                            \"code\": 1\n                        },\n                        {\n                            \"regexp\": \"\"\n                        },\n                        {\n                            \"regexp\": \"^.*,\\\\s*(.*):\\\\s*line\\\\s*(\\\\d+).*\",\n                            \"file\": 1,\n                            \"line\": 2\n                        }\n                    ]\n                }\n            ]\n        },\n        {\n            \"label\": \"test\",\n            \"type\": \"shell\",\n            \"command\": \"&${cwd}/build.ps1\",\n            \"args\": [\"-AutoRestore\",\"-Tasks\",\"test\"],\n            \"presentation\": {\n                \"echo\": true,\n                \"reveal\": \"always\",\n                \"focus\": true,\n                \"panel\": \"dedicated\",\n                \"showReuseMessage\": true,\n                \"clear\": false\n            },\n            \"problemMatcher\": [\n                {\n                    \"owner\": \"powershell\",\n                    \"fileLocation\": [\n                        \"absolute\"\n                    ],\n                    \"severity\": \"error\",\n                    \"pattern\": [\n                        {\n                            \"regexp\": \"^\\\\s*(\\\\[-\\\\]\\\\s*.*?)(\\\\d+)ms\\\\s*$\",\n                            \"message\": 1\n                        },\n                        {\n                            \"regexp\": \"(.*)\",\n                            \"code\": 1\n                        },\n                        {\n                            \"regexp\": \"\"\n                        },\n                        {\n                            \"regexp\": \"^.*,\\\\s*(.*):\\\\s*line\\\\s*(\\\\d+).*\",\n                            \"file\": 1,\n                            \"line\": 2\n                        }\n                    ]\n                }\n            ]\n        }\n    ]\n}\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "# Changelog for workspace\n\nThe format is based on and uses the types of changes according to [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## [Unreleased]\n\n- fixed typo in Invoke-PerfAndValidateCheck so we know which version we're looking at\n- Updated HADR checks to use dbatools new outputs\n\n## [3.0.2] - 2025-03-10\n\n### Added\n \n- added pester tests to check that changelog is edited.\n- and a space for the demos\n\n### Changed\n\n- Fix to Invoke-DbcCheck so that tests that have not been converted to v5 produce warning messages.\n\n## [3.0.1-preview0026] - 2023-08-28\n\n### Added\n\n- Pester v5 support for agent checks.\n\n\n## [3.0.1-preview0025] - 2023-08-28\n\n### Added\n\n- PageVerify check converted to V5 functionality.\n\n### Changed\n\n- For changes in existing functionality.\n\n### Deprecated\n\n- For soon-to-be removed features.\n\n### Removed\n\n- For now removed features.\n\n### Fixed\n\n- For any bug fix.\n\n### Security\n\n- In case of vulnerabilities.\n\n"
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "content": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nIn 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.\n\n## Our Standards\n\nExamples of behavior that contributes to creating a positive environment include:\n\n* Using welcoming and inclusive language\n* Being respectful of differing viewpoints and experiences\n* Gracefully accepting constructive criticism\n* Focusing on what is best for the community\n* Showing empathy towards other community members\n\nExamples of unacceptable behavior by participants include:\n\n* The use of sexualized language or imagery and unwelcome sexual attention or advances\n* Trolling, insulting/derogatory comments, and personal or political attacks\n* Public or private harassment\n* Publishing others' private information, such as a physical or electronic address, without explicit permission\n* Other conduct which could reasonably be considered inappropriate in a professional setting\n\n## Our Responsibilities\n\nProject 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.\n\nProject 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.\n\n## Scope\n\nThis 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.\n\n## Enforcement\n\nInstances 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.\n\nProject 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.\n\n## Attribution\n\nThis Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]\n\n[homepage]: http://contributor-covenant.org\n[version]: http://contributor-covenant.org/version/1/4/\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "# Contributing\n\n## Welcome\n\nBefore we go any further, thanks for being here. Thanks for using dbachecks and especially thanks \nfor being here and looking into how you can help!\n\n## Important resources\n\n- docs\n- bugs\n- communicate with the team\n    - slack\n    - github discussions?\n- presentations\\blogs?\n\n## Running the Tests\n\nIf 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)\n\n## Environment details\n\nWe strongly believe that 'every repo should have a devcontainer' and therefore we've built one\nfor this project that includes 3 SQL Servers and everything you need to develop and build the \ndbachecks module.\n\nIt's magic!\n\n### Prerequisites:\n\nIn order to use the devcontainer there are a few things you need to get started.\n\n- [Docker](https://www.docker.com/get-started)\n- [git](https://git-scm.com/downloads)\n- [VSCode](https://code.visualstudio.com/download)\n- [Remote Development Extension for VSCode](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack)\n\n### Setup\n\nOnce the prerequisites are in place follow these steps to download the repo and start up the\ndevcontainer. The first time you build the devcontainer it will need to pull down the images\nso that could take a hot second depending on your internet speeds.\n\n1. Download the repo from GitHub\n    ```PowerShell\n    # change directory to where you'd like the repo to go\n    cd C:\\GitHub\\\n\n    # clone the repo from GitHub\n    git clone https://github.com/dataplat/dbachecks\n\n    # move into the folder\n    cd .\\dbachecks\\\n\n    # open VSCode\n    code .\n    ```\n\n754662. Once code opens, there should be a toast in the bottom right that suggests you 'ReOpen in Container'.\n1. 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\n\n### Develop & Build\n\nWe are using the [Sampler](https://github.com/gaelcolas/Sampler) Powershell Module to structure our module.\nThis makes it easier to develop and test the module locally.\n\nThe workflow for using this and developing the code - for example to add a new Database level check you could follow\nthis guide.\n\n1. Download the repo locally and create a new branch to develop on\n    ```PowerShell\n    git checkout -b newStuff # give it a proper name!\n    ```\n\n1. Develop in the source repository, to add a check you need to add the following code:\n  - add check code to `source/checks/DatabaseV5.Tests.ps1`\n  - add required configurations to `source/internal/configurations/configuration.ps1`\n    - `skip.database.checkName`\n    - `policy.database.checkNameExcludeDb`\n  - add required properties to object info to `source/internal/functions/Get-AllDatabaseInfo.ps1`\n\n1. Build the module\n    ```PowerShell\n    ./build.ps1 -Tasks build\n    ```\n\n1. Sampler automatically adds the new version to your path you can prove that with the following code:\n    ```PowerShell\n    get-module dbachecks -ListAvailable | Select-Object Name, ModuleBase\n    ```\n\n1. Import new version of the module\n    ```PowerShell\n    Import-Module dbachecks -force\n    ```\n\n1. Test out the new code\n    ```PowerShell\n    # save the password to make for easy connections\n    $password = ConvertTo-SecureString \"dbatools.IO\" -AsPlainText -Force\n    $cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"sqladmin\", $password\n\n    $show = 'All'\n    $checks = 'RecoveryModel' # <-- change this to your new check name \n\n    $sqlinstances = 'localhost,7401', 'localhost,7402', 'localhost,7403'\n    #$sqlinstances = 'dbachecks1', 'dbachecks2', 'dbachecks3' # need client aliases for this to work New-DbaClientAlias\n\n    # Run v5 checks\n    $v5code = Invoke-DbcCheck -SqlInstance $Sqlinstances -SqlCredential $cred -Check $Checks -legacy $false -Show $show -PassThru -Verbose\n    ```\n\n1. If you are working on the v4 --> v5 upgrade you can also confirm your v5 test results match v4 with the following\n    ```PowerShell\n    # save the password to make for easy connections\n    $password = ConvertTo-SecureString \"dbatools.IO\" -AsPlainText -Force\n    $cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"sqladmin\", $password\n\n    $show = 'All'\n    $checks = 'RecoveryModel' # <-- change this to your new check name \n\n    $sqlinstances = 'localhost,7401', 'localhost,7402', 'localhost,7403'\n    #$sqlinstances = 'dbachecks1', 'dbachecks2', 'dbachecks3' # need client aliases for this to work New-DbaClientAlias\n\n    # Check results of the tests - are we testing the same things with the same results for v4 & v5\n    Invoke-PerfAndValidateCheck -SQLInstances $sqlinstances -Checks $Checks\n    # Include the specific details for the perf testing\n    Invoke-PerfAndValidateCheck -SQLInstances $sqlinstances -Checks $Checks -PerfDetail\n    # Include the test results - this helps troubleshooting if your tests aren't the same\n    Invoke-PerfAndValidateCheck -SQLInstances $sqlinstances -Checks $Checks -showTestResults\n    ```\n\n1. Once you are happy with your code, push your branch to GitHub and create a PR against the dbachecks repo.\n\n1. Thanks!\n\n### Rebuild your devcontainer\n\nThe only way to properly rebuild to ensure that all volumes etc are removed is to open up a console\nor PowerShell window outside of the devcontainer and run the following:\n\n```PowerShell\n    cd \\path-of-dbachecks-folder\\.devcontainer \n\n    docker-compose -f \"docker-compose.yml\" -p \"bitsdbatools_devcontainer\" down\n```\n\n## How to submit changes: \nTODO:\nPull 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.\n\n## How to report a bug: \nTODO:\nBugs 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.\n\n## Templates:\nTODO: \nin 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.\n\n## Style Guide\nTODO:\ninclude extensions and vscode settings we use to keep things neat\n\n## Code of Conduct\nTODO: maybe beef this out - stolen from data sat repo for now.\n\nWe 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\n\nBE EXCELLENT TO EACH OTHER\n\nDo 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.\n"
  },
  {
    "path": "GitVersion.yml",
    "content": "mode: ContinuousDelivery\nnext-version: 3.0.0\nmajor-version-bump-message: '(breaking\\schange|breaking|major)\\b'\nminor-version-bump-message: '(adds?|features?|minor)\\b'\npatch-version-bump-message: '\\s?(fix|patch)'\nno-bump-message: '\\+semver:\\s?(none|skip)'\nassembly-informational-format: '{NuGetVersionV2}+Sha.{Sha}.Date.{CommitDate}'\nbranches:\n  master:\n    tag: preview\n    regex: ^main$\n  pull-request:\n    tag: PR\n  feature:\n    tag: useBranchName\n    increment: Minor\n    regex: f(eature(s)?)?[\\/-]\n    source-branches: ['master']\n  hotfix:\n    tag: fix\n    increment: Patch\n    regex: (hot)?fix(es)?[\\/-]\n    source-branches: ['master']\n\nignore:\n  sha: []\nmerge-message-formats: {}\n\n\n# feature:\n#   tag: useBranchName\n#   increment: Minor\n#   regex: f(eature(s)?)?[/-]\n#   source-branches: ['master']\n# hotfix:\n#   tag: fix\n#   increment: Patch\n#   regex: (hot)?fix(es)?[/-]\n#   source-branches: ['master']\n\n"
  },
  {
    "path": "LICENSE",
    "content": "MIT License\n\nCopyright (c) 2017 Chrissy LeMaire\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "PSScriptAnalyzerSettings.psd1",
    "content": "# PSScriptAnalyzerSettings.psd1\n# Settings for PSScriptAnalyzer invocation.\n@{\n    Rules = @{\n        PSUseCompatibleCommands = @{\n            # Turns the rule on\n            Enable = $true\n\n            # Lists the PowerShell platforms we want to check compatibility with\n            TargetProfiles = @(\n                'win-8_x64_10.0.17763.0_7.0.0_x64_3.1.2_core.json',\n                'ubuntu_x64_18.04_7.0.0_x64_3.1.2_core.json',\n                'win-8_x64_10.0.17763.0_5.1.17763.316_x64_4.0.30319.42000_framework'\n             #   'win-8_x64_6.2.9200.0_3.0_x64_4.0.30319.42000_framework'\n            )\n            # You can specify commands to not check like this, which also will ignore its parameters:\n            IgnoreCommands = @(\n                'It', # Because Pester!\n                'Should', # Because Pester!\n                'Context', # Because Pester!\n                'BeforeAll', # Because Pester!\n                'AfterAll', # Because Pester!\n                'Describe' # Because Pester!\n                'Invoke-Pester' #Because Pester!\n                'InModuleScope' #Because Pester!\n                'Mock' #Because Pester!\n                'Assert-MockCalled' #Because Pester!\n                'Get-LocalGroupMember' # Because we handle it\n            )\n        }\n        PSUseCompatibleSyntax = @{\n            # This turns the rule on (setting it to false will turn it off)\n            Enable = $true\n\n            # Simply list the targeted versions of PowerShell here\n            TargetVersions = @(\n                '5.1'\n                '6.1',\n                '6.2',\n                '7.0'\n            )\n        }\n    }\n        # Do not analyze the following rules. Use ExcludeRules when you have\n    # commented out the IncludeRules settings above and want to include all\n    # the default rules except for those you exclude below.\n    # Note: if a rule is in both c and ExcludeRules, the rule\n    # will be excluded.\n     ExcludeRules = @('PSAvoidAssignmentToAutomaticVariable')\n}"
  },
  {
    "path": "RELEASE.md",
    "content": "## 23rd August 2021\n\nFixed bug where custom tests left an empty DbcResult #846\nAdded feature to overwrite config file if it already exists for Export-DbcConfig #844\nEnabled ping latency testing in PowerShell Core\n\n##Latest\n## 23rd August 2021\n\nRemoved the Verbose for the Pester load - Apologies, this was Rob!\nThank 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\nThank you [@MikeyBronowski](https://www.github.com/MikeyBronowski) spelling and full stops #842\nThank you [ashdar](https://github.com/ashdar) Check for existence in the Tag list before adding a Tag to the Tag list #853\nThank you [ashdar](https://github.com/ashdar) Updated PowerPlan Assertion #850\nThank you [tboggiano](https://github.com/tboggiano) CIS check for SQL Mail XPS for SQL Server 2008 and below (was) #779\nThank you [tboggiano](https://github.com/tboggiano) Added function to set CIS config (was) #776\nThank you [tboggiano](https://github.com/tboggiano) CIS check for TCP IP Protocols (was) #775\n\n## April 7th 2021\n\nThank you [@mikedavem](https://www.github.com/mikedavem) Fixed rogue verbose when importing [#834](https://github.com/sqlcollaborative/dbachecks/issues/834)\n\nThank 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)\n\nThank 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)\n\nThank 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)\n\nThank you [@MikeyBronowski](https://www.github.com/MikeyBronowski) Get-DbcConfig Adding support to multiple names [#829](https://github.com/sqlcollaborative/dbachecks/issues/829)\n\nThank you [@MikeyBronowski](https://www.github.com/MikeyBronowski) Spellings [#827](https://github.com/sqlcollaborative/dbachecks/issues/827)\n\nThank you [@TheAntGreen](https://www.github.com/TheAntGreen) updated variables to make errors obvious [#825](https://github.com/sqlcollaborative/dbachecks/issues/825)\n\nThank you [@MrBlueSky](https://www.github.com/MrBlueSky) - add info to suggest using Duplicate index command [#807](https://github.com/sqlcollaborative/dbachecks/issues/807)\n\nThank you [@PsPsam](https://www.github.com/PsPsam) - Ping check to work on core and 5.1 [#763](https://github.com/sqlcollaborative/dbachecks/issues/763)\n\nThank you [@zikato](https://www.github.com/zikato) - certificate expiration gives two failures if in the past [#785](https://github.com/sqlcollaborative/dbachecks/issues/785)\n\nThank 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)\n\nThank you [@Shashtsoh](https://www.github.com/Shashtsoh) - Remove aliases to work in core [#837](https://github.com/sqlcollaborative/dbachecks/issues/837)\n\nThank you [@a4ic6n](https://www.github.com/a4ic6n) - Max Memory check false succeeds [#836](https://github.com/sqlcollaborative/dbachecks/issues/836)\n\n\n## December 14th 2020\n\nThank you tboggiano Browser check altered for instance count #758\nThank you zikato - Fixing datafile auto growth #786\nThank you fatherjack Typos #767\nThank you tboggiano Query Store enabled and disabled test improvements #791\nThank you relsna fixed issue with error log window #814\nThank you @TheAntGreen Typos #815\nThank you @TheAntGreen Add additional filter to filter out negative run_durations #816\nThank you @TheAntGreen Add policy for additional excluded dbs from the SAFE CLR check #817\nThank you @MikeyBronowski Fix the check for enabled alerts #819\nThank you @MikeyBronowski Updating the link in documentation #820\nThank you @mikedavem Updated HADR checks with additional checks #822\nThank you @mikedavem Database backup diff check - fix issue #812 #824\n\n## Date November 23rd 2020\n\nFinally Rob gets around to working on PRs - Really sorry it has taken so long\n\nFixes for bug 780 & 783 #784 - Thank you @TheAntGreen\nFix local windows groups, additional filter needed on the object filter #789 - Thank you @TheAntGreen\n$null check for anything running SQL2008R2 or below as containment doesnt exist in those versions. #790 - Thank you @TheAntGreen\n\nFix for IsClustered checks for service startup types #792  - Thank you @TheAntGreen\n\nCertCheck took ages to run, was still checking excluded DB's then filtering, change to not query the excluded DBs #793  - Thank you @TheAntGreen\n\nFixed few typos in docs #799 - Thank you @jpomfret\n\nFixed few typos in docs #799 - Thank you @TheAntGreen\n\nDuplicateIndex 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\n\nGuestUserConnect - 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\n\nNotExpectedTraceFlag - added a filter to filter out any trace flags which WHERE expected to prevent false positive alerts #801 - Thank you @TheAntGreen\n\nAdd policy to exclude databases on the trustworthy check #806  - Thank you @TheAntGreen\n\nUnused Index Check wasn't executing correctly #808   - Thank you @TheAntGreen\n\n#803 Addition of the date filter for File Autogrowth detection #809   - Thank you @TheAntGreen\n\nNew Check - Agent Mail Profile #811   - Thank you @TheAntGreen\n\nScan for startup procs, use config option to override the value in use #813  - Thank you @TheAntGreen\n\n##Latest\n\n## Date September 22nd 2020\n\nOnly Importing Pester v4 and lower to reduce Pester v5 errors\n\n## Date July 13th 2020\n\nThank you jpomfret Added skip.backup.readonly config  #777\nThank you jpomfret typos  #771\nThank you jpomfret Added MSDB suspect pages table check  #768\nThank you markaugust Added instance name to Agent Service ACcount checks #766\nThank you tboggiano fixed Agent Run time calculation #746\n\n## Date 9th May 2020\n\nUPDATED TO VERSION 2\n\nNew Commands\n\n    Convert-DbcResult - To parse results and add Label, ComputerName, Instance and Database\n    Set-DbcFile - To save the parsed results to a file json, csv or xml\n    Write-DbcTable - to add results to a database\n\nNew Parameter\n    -FromDatabase on Star-DbcPowerBi - to open new Power Bi template file\n\nNew PowerBi template file for reporting on results from the database\n\nImproved Spelling\n\nUpdated Unit Tests for Checks to enabled results to be parsed\n\nImproved Check Titles\n\nConfiguration for Max history days for Job duration\n\nStop trying to check inaccessible databases for checks\n\nImproved Query Store checks\n\nEnsure long running agent jobs ignores durations longer than 24 hours\n\nIgnore jobs that never stop from the duration check\n\n##Latest\n\n## Date 29th March 2020\n\nUPDATED MINIMUM POWERSHELL VERSION\n\nUpdated Required versions of Pester, dbatools and PSFramework modules\n\nThank you @dstrait\n    Fix variable for SaDisabled check #750\n    Fix errant braces in SQL Browser Service Check #751\n    Fix PingComputer Check #752\n\nThank you markaugust\n    Fix to ensure AG Name is in HADR checks #755\n\nThank you Tracey Boggiano\n    Added Contained Database auth check and Query Store Enabled Checks #756\n\nThank you Rob\n    Added exclude database config for Query store checks\n    Version check for Query Store Checks\n    Some spellings!\n\n##Latest\n\n## Date 18th March 2020\nThank you Tracey tboggiano\n    New CIS user-defined CLRs to be set to SAFE_ACCESS #734\n    CIS tests for if service accounts are local admins #736\n\nThank you Rob\n    Getting service accounts tests to pass if no service\n    Made long running jobs check work as expected\n    Improved Database Mail check\n    Made sure disk allocations dont run on Core\n\nThank you mikedavem\n    Fixed bug in disk allocation check exclusions\n    Added multiple ags to the HADR check #742\n\n## Date 14th March 2020\nThank you Tracey tboggiano\n    New CIS Check Hide Instance #728\n    New CIS Check Symmetric Key #732\n    New CIS Check Agent Proxy not have access to public Role #732\n\n## Date 8th January 2020\nThank you Tracey tboggiano\n    New CIS Check Guest Account connect permissions #725\n    New CIS Check BuiltIn Admins login #726\n    New CIS Check public role permissions #729\n    New CIS Check local windows groups do not have logins #731\n    Update sa login check #730\n\nThank you Rob\n    Added Tag parameter to Get-DbcCheck\n    Updated tests to work with PowerShell 7\n\n## Date 22nd December\nThank you Tracey tboggiano\n    Two New CIS Checks Contained databases should be auto-closed #721\n    sa login disabled and should not exist #719\n\nThank you Rob\n    Fix bug in Agent Tests #723\n\n## Date 28th November\nThank you Tracey tboggiano\n    Added new CIS Check for the latest SQL build #716\n\nThank you Rob\n    Making the SQL Engine Service Check configurable #706\n\n## Date 26th November\nThank you Tracey @tboggiano\n    Added new CIS Check for OLE AUtomation Procedures to be disabled #707\n    Moving the Cross DB Ownership Chaining check into the AllInstance check to help speed up checks #708\nThank you Rob\n    Fixing the Tags so that they are picked up by AllInstanceInfo Fixes #715\n\n## Date 16th November\nThank you Matt @matt2005\n    Removed rogue else from Agents Tests #713\n\n## Date 17th October\nThank you Shane @SOZDBA\n    Improved Documentation\nThank you Gareth NewMan\n    Added New Check - Default File Path\n\n## Date 1st October 2019\nThank you Rob\nFixed some merge issues with a load of code :-(\nCreated GitHub Action to run Pester Checks on PR\nThank you @TracyBoggiano\nAdded New Checks\n    RemoteAccessDisabled\n    ScanForStartUpProcedures\nThank you Gareth Newman\n    Improved wording in tests #700 , #697\n    Fix incorrect calculation in last agent run time #696 #698\nFixed bug in AllInstanceInfo\nThank you Richard Imenes\n    Fixed dead links in readme #702\nThank you Benjamin Schenk\n    Fixed Send-MailMessage in readme #705\n\n## Date 30th July 2019\nThank you Rob ;-)\nAdded two new checks #239\n    LastJobRunTime and LongRunningJob\nAdded four new configs\n    skip.agent.longrunningjobs\n    skip.agent.lastjobruntime\n    agent.longrunningjob.percentage\n    agent.lastjobruntime.percentage\n\n## Date 29th July 2019\nThank you @TracyBoggiano\nAdded tags for checks that will be part of CIS checks #642\nCIS project started\nAdded check for default trace enabled #684\n\n## Date 23rd July 2019\nThank you @dstrait, @Sozdba\nFix tests that use time to work if client and instance are in different time zones #610\nFixed Maintenance Solution clean up time test #633\nImproved Run time #635\nImproved Error Log warning window honouring #637\nIgnore SQL 2005 for some tests #630,629,#628\nSkip TF1118 test if SQL2016 or above\n\n## Date 8th July 2019\nThanks to Chuck for notifying of error\nFixed Update-DbcPowerBiDataSource\n\n\n## Date 2nd July 2019\ndbachecks works with PowerShell Core #620\ndbachecks works with dbatools v1 #624\nMinimum PowerShell Now 5.0 #568\nPrettier output in test names for @cl because she is ace #495\nFixes for none-readable secondaries causing tests to fail #611\nAdded ability to exclude disks from disk allocation check #561\nAdded ability to exclude cancelled jobs from failed job check #552\nAdded max job history for failed jobs #552\nSome extra tags added\n\n## Date 22nd May 2019 at Techorama in Room 12\nThank You @SOZDBA, @djfcc, @wsmelton\nImproved validation for IP addresses in clusters\nIgnored Off-line databases for Pseudo Recovery Checks\nSome internal testing changes\n\n\n## Date 05/02/2019\nThank you Chrissy! @cl\nadded default environment #596\naltered configuration validation for mail to stop errors\nEnsured database status check doesnt fail as readonly for snapshots\n\n## Date 31/01/2019\nThank you Chrissy!\nadd support for inline config file, fixes #501 #594\n\n## Date 29/01/2019\nAdded skip for authentication scheme #587\nAdded WhatIf to Update-DbcPowerBiDataSource Thank you @shaneis #590\n$null to the left Thank you @jwmoss #588\n\n## Date 19/01/2019\nThank you Claudio\nAdded extra check for Job History Settings #582\nAdded extra check for Error Log Count #583\nAdded integration test code and docker compose file\n\n##Latest\n\n## Date 22/11/2018\nSpelling - Thanks RonaldHensbergen\nFix for #576 When calling just Invoke-DbcCheck without a Check it fails to run the Server Tests correctly\n\n\n## Date 12/11/2018\nAdded more information to the output - thanks @ClaudioESSilva\nSpelling - Thanks ChrisTuckerNM\nFix for #564 - Error Importing DbcConfig in PowerShell 4 - Thanks @niphod\n\n## Date 29/10/2018\nFixed #435 Page verify on SQL 2000 and SQL2005\nReduced number of calls to the instance for database checks improving performance\n\n## Date 27/10/2018\nFixed #435 Page verify on SQL 2000 and SQL2005\nReduced number of calls to the instance for database checks improving performance\n\n## Date 17/10/2018\nSpelling and Because added - Thank you @LowlyDBA\nNew Check for XPCmdShell enabled added\n\n## Date 11/10/2018\nAdded Check for CLR Enabled\nAdded Check for Cross Database Ownership Chaining\nAdded Check for Database Mail XPs\nAdded Check for Ad Hoc Distributed Queries\nAdded Tag for security\nDemo CI/CD at Polar Conf\n\n## Date 24/09/2018\nMoved the Instance Connection Check to the Instance Tests\nFixed bug with Set-DbcConfig not adding none-arrays!\nNew Check for Expected Trace Flags\nNew Check for Not Expected TraceFlags\nStopped dbatools chatty messages polluting the test results\n\n## Date 07/09/2018\nUpdated dbatools required module to 0.9.410\nRenamed all dbatools commands to new naming convention\nFixed Bug with JSON file naming\nImproved Server Checks to remove Red and improve speed for none contactable servers\nAltered all server checks to use assertions and added pester Tests\nRemoved left over ogv entry\n\n## Date 05/09/2018\nNew Check for 2 digit cut off thanks @CláudioESSilva\nhttps://claudioessilva.eu/2018/09/04/dont-cutoff-yourself-when-dealing-with-dates-in-t-sql-did-you-know/\nFixed bug with adding NoneContactable Instances to variable\nImproved error handling for HADR checks\n\n## Date 28/08/2018\nAdded MaxBehind to SupportedBuild Tests - Thank you @LowlyDBA\nEnsured the Database parameter checks only the specified Databases - Thank you @jpomfret\nUpdated Set-DbcConfig to allow Append to append arrays to arrays closes #535\nAltered json filename creation to avoid max characters error\nAltered PowerBi to display information correctly with filename changes\n\n## Date 24/08/2017\nFixed Error with using Credential and stopped changing path when running checks from custom repos - Thank you @sammyxx\n\n## Date 23/08/2017\nUpdate to the help message for clusters by @LowlyDBA\nPotential Breaking Change - Removed Tags from names of json files so that PowerBi will correctly show Environment names\n\n## Date 15/08/2018\nFixed issue 521 ExcludeDatabase parameter doesn't work - THANK YOU @jpomfret\nTHANK YOU @jpomfret - Issue 509 -Database should only check databases listed and exclude all others\nFurther update to Update-DbcPowerBiDataSource to allow Environment as well as specify filename\nImproved performance of the Server checks\nImproved performance of the Instance checks\nImproved performance of the Database checks\nImproved performance of the ErrorLog checks\nRemoved Send-DbcSendMailMessage until it can be re-coded\n\n## Date 13/08/2018\nFixed #504 by enabling FileName parameter on Update-PowerBiDataSource\nAdded in new function to begin to reduce the number of calls to each instance\nReduced required Pester version to 4.3.1\nFurther PowerShell V4 improvements\n\n## Date 06/08/2018\nAdded New Check for tempdb data file sizes to be the same - Thank you @garethnewman #512\nAltered Services Check so that clustered instances start mode is checked correctly thank you @kylejdoyle #516\nSkip PowerPlan test if no connection thanks @cl #490\nFixed bug with XESession and PSv4 thank you @kylejdoyle #517\nError silently on failing Service check (thanks Rob ;-) )\nFixed dbatools command names\nFixed PSv4 support for importing the module also\n\n## Date 31/07/2018\n\nAdded check for Database Exists - Thanks @sqldbawithbeard\nAdded excluded databases config to each Database Check and wrote Pester Test for that #506\nAdded msdb to exclusion fro duplicate index #506\nFixed offline install bug #484\n\n## Date 30/07/2018\n\nUpdated Required Module versions - Thank you @cl\nUpdated Agent Checks to fail a test on no connection rather than throw all the PowerShell errors - Thanks @sqldbawithbeard\nUpdated HADR Checks for PS4 compatibility Issue #513\n\n## Date 28/06/2018\n\nDon't check versions before 2008 for AdHocWorkloads Thank you John McCall @LowlyDBA\nMore Spelling! Thank you John McCall @LowlyDBA\nUpdated required version and dbatools error log command name Thank you Our Glorious Chrissy @cl\n\n## Date 30/05/2018\nNew Release Notes command added\nSpelling\n\n## Date 29/05/2012\n\n"
  },
  {
    "path": "RequiredModules.psd1",
    "content": "@{\n    PSDependOptions       = @{\n        AddToPath  = $true\n        Target     = 'output\\RequiredModules'\n        Parameters = @{\n            Repository = 'PSGallery'\n        }\n    }\n\n    'dbatools.library'    = 'latest'\n    InvokeBuild           = 'latest'\n    PSScriptAnalyzer      = 'latest'\n    Pester                = 'latest'\n    Plaster               = 'latest'\n    ModuleBuilder         = 'latest'\n    ChangelogManagement   = 'latest'\n    Sampler               = 'latest'\n    'Sampler.GitHubTasks' = 'latest'\n    MarkdownLinkCheck     = 'latest'\n    dbatools              = 'latest'\n    PSFramework           = 'latest'\n}\n\n"
  },
  {
    "path": "Resolve-Dependency.ps1",
    "content": "<#\n    .DESCRIPTION\n        Bootstrap script for PSDepend.\n\n    .PARAMETER DependencyFile\n        Specifies the configuration file for the this script. The default value is\n        'RequiredModules.psd1' relative to this script's path.\n\n    .PARAMETER PSDependTarget\n        Path for PSDepend to be bootstrapped and save other dependencies.\n        Can also be CurrentUser or AllUsers if you wish to install the modules in\n        such scope. The default value is 'output/RequiredModules' relative to\n        this script's path.\n\n    .PARAMETER Proxy\n        Specifies the URI to use for Proxy when attempting to bootstrap\n        PackageProvider and PowerShellGet.\n\n    .PARAMETER ProxyCredential\n        Specifies the credential to contact the Proxy when provided.\n\n    .PARAMETER Scope\n        Specifies the scope to bootstrap the PackageProvider and PSGet if not available.\n        THe default value is 'CurrentUser'.\n\n    .PARAMETER Gallery\n        Specifies the gallery to use when bootstrapping PackageProvider, PSGet and\n        when calling PSDepend (can be overridden in Dependency files). The default\n        value is 'PSGallery'.\n\n    .PARAMETER GalleryCredential\n        Specifies the credentials to use with the Gallery specified above.\n\n    .PARAMETER AllowOldPowerShellGetModule\n        Allow you to use a locally installed version of PowerShellGet older than\n        1.6.0 (not recommended). Default it will install the latest PowerShellGet\n        if an older version than 2.0 is detected.\n\n    .PARAMETER MinimumPSDependVersion\n        Allow you to specify a minimum version fo PSDepend, if you're after specific\n        features.\n\n    .PARAMETER AllowPrerelease\n        Not yet written.\n\n    .PARAMETER WithYAML\n        Not yet written.\n\n    .NOTES\n        Load defaults for parameters values from Resolve-Dependency.psd1 if not\n        provided as parameter.\n#>\n[CmdletBinding()]\nparam\n(\n    [Parameter()]\n    [System.String]\n    $DependencyFile = 'RequiredModules.psd1',\n\n    [Parameter()]\n    [System.String]\n    $PSDependTarget = (Join-Path -Path $PSScriptRoot -ChildPath 'output/RequiredModules'),\n\n    [Parameter()]\n    [System.Uri]\n    $Proxy,\n\n    [Parameter()]\n    [System.Management.Automation.PSCredential]\n    $ProxyCredential,\n\n    [Parameter()]\n    [ValidateSet('CurrentUser', 'AllUsers')]\n    [System.String]\n    $Scope = 'CurrentUser',\n\n    [Parameter()]\n    [System.String]\n    $Gallery = 'PSGallery',\n\n    [Parameter()]\n    [System.Management.Automation.PSCredential]\n    $GalleryCredential,\n\n    [Parameter()]\n    [System.Management.Automation.SwitchParameter]\n    $AllowOldPowerShellGetModule,\n\n    [Parameter()]\n    [System.String]\n    $MinimumPSDependVersion,\n\n    [Parameter()]\n    [System.Management.Automation.SwitchParameter]\n    $AllowPrerelease,\n\n    [Parameter()]\n    [System.Management.Automation.SwitchParameter]\n    $WithYAML,\n\n    [Parameter()]\n    [System.Collections.Hashtable]\n    $RegisterGallery\n)\n\ntry\n{\n    if ($PSVersionTable.PSVersion.Major -le 5)\n    {\n        if (-not (Get-Command -Name 'Import-PowerShellDataFile' -ErrorAction 'SilentlyContinue'))\n        {\n            Import-Module -Name Microsoft.PowerShell.Utility -RequiredVersion '3.1.0.0'\n        }\n\n        <#\n            Making sure the imported PackageManagement module is not from PS7 module\n            path. The VSCode PS extension is changing the $env:PSModulePath and\n            prioritize the PS7 path. This is an issue with PowerShellGet because\n            it loads an old version if available (or fail to load latest).\n        #>\n        Get-Module -ListAvailable PackageManagement |\n            Where-Object -Property 'ModuleBase' -NotMatch 'powershell.7' |\n            Select-Object -First 1 |\n            Import-Module -Force\n    }\n\n    Write-Verbose -Message 'Importing Bootstrap default parameters from ''$PSScriptRoot/Resolve-Dependency.psd1''.'\n\n    $resolveDependencyConfigPath = Join-Path -Path $PSScriptRoot -ChildPath '.\\Resolve-Dependency.psd1' -Resolve -ErrorAction 'Stop'\n\n    $resolveDependencyDefaults = Import-PowerShellDataFile -Path $resolveDependencyConfigPath\n\n    $parameterToDefault = $MyInvocation.MyCommand.ParameterSets.Where{ $_.Name -eq $PSCmdlet.ParameterSetName }.Parameters.Keys\n\n    if ($parameterToDefault.Count -eq 0)\n    {\n        $parameterToDefault = $MyInvocation.MyCommand.Parameters.Keys\n    }\n\n    # Set the parameters available in the Parameter Set, or it's not possible to choose yet, so all parameters are an option.\n    foreach ($parameterName in $parameterToDefault)\n    {\n        if (-not $PSBoundParameters.Keys.Contains($parameterName) -and $resolveDependencyDefaults.ContainsKey($parameterName))\n        {\n            Write-Verbose -Message \"Setting parameter '$parameterName' to value '$($resolveDependencyDefaults[$parameterName])'.\"\n\n            try\n            {\n                $variableValue = $resolveDependencyDefaults[$parameterName]\n\n                if ($variableValue -is [System.String])\n                {\n                    $variableValue = $ExecutionContext.InvokeCommand.ExpandString($variableValue)\n                }\n\n                $PSBoundParameters.Add($parameterName, $variableValue)\n\n                Set-Variable -Name $parameterName -value $variableValue -Force -ErrorAction 'SilentlyContinue'\n            }\n            catch\n            {\n                Write-Verbose -Message \"Error adding default for $parameterName : $($_.Exception.Message).\"\n            }\n        }\n    }\n}\ncatch\n{\n    Write-Warning -Message \"Error attempting to import Bootstrap's default parameters from '$resolveDependencyConfigPath': $($_.Exception.Message).\"\n}\n\nWrite-Progress -Activity 'Bootstrap:' -PercentComplete 0 -CurrentOperation 'NuGet Bootstrap'\n\n# TODO: This should handle the parameter $AllowOldPowerShellGetModule.\n$powerShellGetModule = Import-Module -Name 'PowerShellGet' -MinimumVersion '2.0' -ErrorAction 'SilentlyContinue' -PassThru\n\n# Install the package provider if it is not available.\n$nuGetProvider = Get-PackageProvider -Name 'NuGet' -ListAvailable | Select-Object -First 1\n\nif (-not $powerShellGetModule -and -not $nuGetProvider)\n{\n    $providerBootstrapParameters = @{\n        Name           = 'nuget'\n        Force          = $true\n        ForceBootstrap = $true\n        ErrorAction    = 'Stop'\n    }\n\n    switch ($PSBoundParameters.Keys)\n    {\n        'Proxy'\n        {\n            $providerBootstrapParameters.Add('Proxy', $Proxy)\n        }\n\n        'ProxyCredential'\n        {\n            $providerBootstrapParameters.Add('ProxyCredential', $ProxyCredential)\n        }\n\n        'Scope'\n        {\n            $providerBootstrapParameters.Add('Scope', $Scope)\n        }\n\n        'AllowPrerelease'\n        {\n            $providerBootstrapParameters.Add('AllowPrerelease', $AllowPrerelease)\n        }\n    }\n\n    if ($AllowPrerelease)\n    {\n        $providerBootstrapParameters.Add('AllowPrerelease', $true)\n    }\n\n    Write-Information -MessageData 'Bootstrap: Installing NuGet Package Provider from the web (Make sure Microsoft addresses/ranges are allowed).'\n\n    # TODO: This does not handle a private Gallery yet.\n    $null = Install-PackageProvider @providerBootstrapParams\n\n    $nuGetProvider = Get-PackageProvider -Name 'NuGet' -ListAvailable | Select-Object -First 1\n\n    $nuGetProviderVersion = $nuGetProvider.Version.ToString()\n\n    Write-Information -MessageData \"Bootstrap: Importing NuGet Package Provider version $nuGetProviderVersion to current session.\"\n\n    $Null = Import-PackageProvider -Name 'NuGet' -RequiredVersion $nuGetProviderVersion -Force\n}\n\nif ($RegisterGallery)\n{\n    if ($RegisterGallery.ContainsKey('Name') -and -not [System.String]::IsNullOrEmpty($RegisterGallery.Name))\n    {\n        $Gallery = $RegisterGallery.Name\n    }\n    else\n    {\n        $RegisterGallery.Name = $Gallery\n    }\n\n    Write-Progress -Activity 'Bootstrap:' -PercentComplete 7 -CurrentOperation \"Verifying private package repository '$Gallery'\" -Completed\n\n    $previousRegisteredRepository = Get-PSRepository -Name $Gallery -ErrorAction 'SilentlyContinue'\n\n    if ($previousRegisteredRepository.SourceLocation -ne $RegisterGallery.SourceLocation)\n    {\n        if ($previousRegisteredRepository)\n        {\n            Write-Progress -Activity 'Bootstrap:' -PercentComplete 9 -CurrentOperation \"Re-registrering private package repository '$Gallery'\" -Completed\n\n            Unregister-PSRepository -Name $Gallery\n\n            $unregisteredPreviousRepository = $true\n        }\n        else\n        {\n            Write-Progress -Activity 'Bootstrap:' -PercentComplete 9 -CurrentOperation \"Registering private package repository '$Gallery'\" -Completed\n        }\n\n        Register-PSRepository @RegisterGallery\n    }\n}\n\nWrite-Progress -Activity 'Bootstrap:' -PercentComplete 10 -CurrentOperation \"Ensuring Gallery $Gallery is trusted\"\n\n# Fail if the given PSGallery is not registered.\n$previousGalleryInstallationPolicy = (Get-PSRepository -Name $Gallery -ErrorAction 'Stop').InstallationPolicy\n\nif ($previousGalleryInstallationPolicy -ne 'Trusted')\n{\n    # Only change policy if the repository is not trusted\n    Set-PSRepository -Name $Gallery -InstallationPolicy 'Trusted' -ErrorAction 'Ignore'\n}\n\ntry\n{\n    Write-Progress -Activity 'Bootstrap:' -PercentComplete 25 -CurrentOperation 'Checking PowerShellGet'\n\n    # Ensure the module is loaded and retrieve the version you have.\n    $powerShellGetVersion = (Import-Module -Name 'PowerShellGet' -PassThru -ErrorAction 'SilentlyContinue').Version\n\n    Write-Verbose -Message \"Bootstrap: The PowerShellGet version is $powerShellGetVersion\"\n\n    # Versions below 2.0 are considered old, unreliable & not recommended\n    if (-not $powerShellGetVersion -or ($powerShellGetVersion -lt [System.Version] '2.0' -and -not $AllowOldPowerShellGetModule))\n    {\n        Write-Progress -Activity 'Bootstrap:' -PercentComplete 40 -CurrentOperation 'Installing newer version of PowerShellGet'\n\n        $installPowerShellGetParameters = @{\n            Name               = 'PowerShellGet'\n            Force              = $True\n            SkipPublisherCheck = $true\n            AllowClobber       = $true\n            Scope              = $Scope\n            Repository         = $Gallery\n        }\n\n        switch ($PSBoundParameters.Keys)\n        {\n            'Proxy'\n            {\n                $installPowerShellGetParameters.Add('Proxy', $Proxy)\n            }\n\n            'ProxyCredential'\n            {\n                $installPowerShellGetParameters.Add('ProxyCredential', $ProxyCredential)\n            }\n\n            'GalleryCredential'\n            {\n                $installPowerShellGetParameters.Add('Credential', $GalleryCredential)\n            }\n            'AllowPrerelease'\n            {\n                $installPowerShellGetParameters.Add('AllowPrerelease', $AllowPrerelease)\n            }\n        }\n\n        Write-Progress -Activity 'Bootstrap:' -PercentComplete 60 -CurrentOperation 'Installing newer version of PowerShellGet'\n\n        Install-Module @installPowerShellGetParameters\n\n        Remove-Module -Name 'PowerShellGet' -Force -ErrorAction 'SilentlyContinue'\n        Remove-Module -Name 'PackageManagement' -Force\n\n        $powerShellGetModule = Import-Module PowerShellGet -Force -PassThru\n\n        $powerShellGetVersion = $powerShellGetModule.Version.ToString()\n\n        Write-Information -MessageData \"Bootstrap: PowerShellGet version loaded is $powerShellGetVersion\"\n    }\n\n    # Try to import the PSDepend module from the available modules.\n    $getModuleParameters = @{\n        Name          = 'PSDepend'\n        ListAvailable = $true\n    }\n\n    $psDependModule = Get-Module @getModuleParameters\n\n    if ($PSBoundParameters.ContainsKey('MinimumPSDependVersion'))\n    {\n        try\n        {\n            $psDependModule = $psDependModule | Where-Object -FilterScript { $_.Version -ge $MinimumPSDependVersion }\n        }\n        catch\n        {\n            throw ('There was a problem finding the minimum version of PSDepend. Error: {0}' -f $_)\n        }\n    }\n\n    if (-not $psDependModule)\n    {\n        # PSDepend module not found, installing or saving it.\n        if ($PSDependTarget -in 'CurrentUser', 'AllUsers')\n        {\n            Write-Debug -Message \"PSDepend module not found. Attempting to install from Gallery '$Gallery'.\"\n\n            Write-Warning -Message \"Installing PSDepend in $PSDependTarget Scope.\"\n\n            $installPSDependParameters = @{\n                Name               = 'PSDepend'\n                Repository         = $Gallery\n                Force              = $true\n                Scope              = $PSDependTarget\n                SkipPublisherCheck = $true\n                AllowClobber       = $true\n            }\n\n            if ($MinimumPSDependVersion)\n            {\n                $installPSDependParameters.Add('MinimumVersion', $MinimumPSDependVersion)\n            }\n\n            Write-Progress -Activity 'Bootstrap:' -PercentComplete 75 -CurrentOperation \"Installing PSDepend from $Gallery\"\n\n            Install-Module @installPSDependParameters\n        }\n        else\n        {\n            Write-Debug -Message \"PSDepend module not found. Attempting to Save from Gallery $Gallery to $PSDependTarget\"\n\n            $saveModuleParameters = @{\n                Name       = 'PSDepend'\n                Repository = $Gallery\n                Path       = $PSDependTarget\n                Force      = $true\n            }\n\n            if ($MinimumPSDependVersion)\n            {\n                $saveModuleParameters.add('MinimumVersion', $MinimumPSDependVersion)\n            }\n\n            Write-Progress -Activity 'Bootstrap:' -PercentComplete 75 -CurrentOperation \"Saving & Importing PSDepend from $Gallery to $Scope\"\n\n            Save-Module @saveModuleParameters\n        }\n    }\n\n    Write-Progress -Activity 'Bootstrap:' -PercentComplete 80 -CurrentOperation 'Loading PSDepend'\n\n    $importModulePSDependParameters = @{\n        Name        = 'PSDepend'\n        ErrorAction = 'Stop'\n        Force       = $true\n    }\n\n    if ($PSBoundParameters.ContainsKey('MinimumPSDependVersion'))\n    {\n        $importModulePSDependParameters.Add('MinimumVersion', $MinimumPSDependVersion)\n    }\n\n    # We should have successfully bootstrapped PSDepend. Fail if not available.\n    $null = Import-Module @importModulePSDependParameters\n\n    if ($WithYAML)\n    {\n        Write-Progress -Activity 'Bootstrap:' -PercentComplete 82 -CurrentOperation 'Verifying PowerShell module PowerShell-Yaml'\n\n        if (-not (Get-Module -ListAvailable -Name 'PowerShell-Yaml'))\n        {\n            Write-Progress -Activity 'Bootstrap:' -PercentComplete 85 -CurrentOperation 'Installing PowerShell module PowerShell-Yaml'\n\n            Write-Verbose -Message \"PowerShell-Yaml module not found. Attempting to Save from Gallery '$Gallery' to '$PSDependTarget'.\"\n\n            $SaveModuleParam = @{\n                Name       = 'PowerShell-Yaml'\n                Repository = $Gallery\n                Path       = $PSDependTarget\n                Force      = $true\n            }\n\n            Save-Module @SaveModuleParam\n        }\n        else\n        {\n            Write-Verbose \"PowerShell-Yaml is already available\"\n        }\n    }\n\n    Write-Progress -Activity 'Bootstrap:' -PercentComplete 90 -CurrentOperation 'Invoke PSDepend'\n\n    Write-Progress -Activity \"PSDepend:\" -PercentComplete 0 -CurrentOperation \"Restoring Build Dependencies\"\n\n    if (Test-Path -Path $DependencyFile)\n    {\n        $psDependParameters = @{\n            Force = $true\n            Path  = $DependencyFile\n        }\n\n        # TODO: Handle when the Dependency file is in YAML, and -WithYAML is specified.\n        Invoke-PSDepend @psDependParameters\n    }\n\n    Write-Progress -Activity \"PSDepend:\" -PercentComplete 100 -CurrentOperation \"Dependencies restored\" -Completed\n\n    Write-Progress -Activity 'Bootstrap:' -PercentComplete 100 -CurrentOperation \"Bootstrap complete\" -Completed\n}\nfinally\n{\n    if ($RegisterGallery)\n    {\n        Write-Verbose -Message \"Removing private package repository '$Gallery'.\"\n        Unregister-PSRepository -Name $Gallery\n    }\n\n    if ($unregisteredPreviousRepository)\n    {\n        Write-Verbose -Message \"Reverting private package repository '$Gallery' to previous location URI:s.\"\n\n        $registerPSRepositoryParameters = @{\n            Name = $previousRegisteredRepository.Name\n            InstallationPolicy = $previousRegisteredRepository.InstallationPolicy\n        }\n\n        if ($previousRegisteredRepository.SourceLocation)\n        {\n            $registerPSRepositoryParameters.SourceLocation = $previousRegisteredRepository.SourceLocation\n        }\n\n        if ($previousRegisteredRepository.PublishLocation)\n        {\n            $registerPSRepositoryParameters.PublishLocation = $previousRegisteredRepository.PublishLocation\n        }\n\n        if ($previousRegisteredRepository.ScriptSourceLocation)\n        {\n            $registerPSRepositoryParameters.ScriptSourceLocation = $previousRegisteredRepository.ScriptSourceLocation\n        }\n\n        if ($previousRegisteredRepository.ScriptPublishLocation)\n        {\n            $registerPSRepositoryParameters.ScriptPublishLocation = $previousRegisteredRepository.ScriptPublishLocation\n        }\n\n        Register-PSRepository @registerPSRepositoryParameters\n    }\n\n    # Only try to revert installation policy if the repository exist\n    if ((Get-PSRepository -Name $Gallery -ErrorAction 'SilentlyContinue'))\n    {\n        if ($previousGalleryInstallationPolicy -and $previousGalleryInstallationPolicy -ne 'Trusted')\n        {\n            # Reverting the Installation Policy for the given gallery if it was not already trusted\n            Set-PSRepository -Name $Gallery -InstallationPolicy $previousGalleryInstallationPolicy\n        }\n    }\n\n    Write-Verbose -Message \"Project Bootstrapped, returning to Invoke-Build\"\n}\n"
  },
  {
    "path": "Resolve-Dependency.psd1",
    "content": "@{\n    #PSDependTarget  = './output/modules'\n    #Proxy = ''\n    #ProxyCredential = '$MyCredentialVariable' #TODO: find a way to support credentials in build (resolve variable)\n\n    Gallery         = 'PSGallery'\n\n    # To use a private nuget repository change the following to your own feed. The locations must be a Nuget v2 feed due\n    # to limitation in PowerShellGet v2.x. Example below is for a Azure DevOps Server project-scoped feed. While resolving\n    # dependencies it will be registered as a trusted repository with the name specified in the property 'Gallery' above,\n    # unless property 'Name' is provided in the hashtable below, if so it will override the property 'Gallery' above. The\n    # registered repository will be removed when dependencies has been resolved, unless it was already registered to begin\n    # with. If repository is registered already but with different URL:s the repository will be re-registered and reverted\n    # after dependencies has been resolved. Currently only Windows integrated security works with private Nuget v2 feeds\n    # (or if it is a public feed with no security), it is not possible yet to securely provide other credentials for the feed.\n    #RegisterGallery = @{\n    #    #Name = 'MyPrivateFeedName'\n    #    GallerySourceLocation = 'https://azdoserver.company.local/<org_name>/<project_name>/_packaging/<feed_name>/nuget/v2'\n    #    GalleryPublishLocation = 'https://azdoserver.company.local/<org_name>/<project_name>/_packaging/<feed_name>/nuget/v2'\n    #    GalleryScriptSourceLocation = 'https://azdoserver.company.local/<org_name>/<project_name>/_packaging/<feed_name>/nuget/v2'\n    #    GalleryScriptPublishLocation = 'https://azdoserver.company.local/<org_name>/<project_name>/_packaging/<feed_name>/nuget/v2'\n    #    #InstallationPolicy = 'Trusted'\n    #}\n\n    #AllowOldPowerShellGetModule = $true\n    #MinimumPSDependVersion = '0.3.0'\n    AllowPrerelease = $false\n    WithYAML        = $true # Will also bootstrap PowerShell-Yaml to read other config files\n}\n\n"
  },
  {
    "path": "SECURITY.md",
    "content": "## Security\n\nThe DSC Community takes the security of our modules seriously, which includes all source code repositories managed through our GitHub organization.\n\nIf you believe you have found a security vulnerability in any DSC Community owned repository, please report it to us as described below.\n\n## Reporting Security Issues\n\n**Please do not report security vulnerabilities through public GitHub issues.**\n\nInstead, please report them to one or several members of the DSC Community organization.\nThe easiest way to do so is to send us a direct message via twitter or slack.\n\nYou should receive a response within 48 hours. If for some reason you do not, please follow up to other member of the community.\n\nPlease 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:\n\n  * Type of issue\n  * Full paths of source file(s) related to the manifestation of the issue\n  * The location of the affected source code (tag/branch/commit or direct URL)\n  * Any special configuration required to reproduce the issue\n  * Step-by-step instructions to reproduce the issue\n  * Proof-of-concept or exploit code (if possible)\n  * Impact of the issue, including how an attacker might exploit the issue\n\nThis information will help us triage your report more quickly.\n\n## Preferred Languages\n\nWe prefer all communications to be in English.\n"
  },
  {
    "path": "azure-pipelines.yml",
    "content": "trigger:\n  branches:\n    include:\n    - main\n  paths:\n    exclude:\n    - CHANGELOG.md\n  tags:\n    include:\n    - \"v*\"\n    exclude:\n    - \"*-*\"\n\nvariables:\n  buildFolderName: output\n  buildArtifactName: output\n  testResultFolderName: testResults\n  defaultBranch: main\n\nstages:\n  - stage: Build\n    jobs:\n      - job: Package_Module\n        displayName: 'Package Module'\n        pool:\n          vmImage: 'ubuntu-latest'\n        steps:\n          - pwsh: |\n              dotnet tool install --global GitVersion.Tool\n              $gitVersionObject = dotnet-gitversion | ConvertFrom-Json\n              $gitVersionObject.PSObject.Properties.ForEach{\n                  Write-Host -Object \"Setting Task Variable '$($_.Name)' with value '$($_.Value)'.\"\n                  Write-Host -Object \"##vso[task.setvariable variable=$($_.Name);]$($_.Value)\"\n              }\n              Write-Host -Object \"##vso[build.updatebuildnumber]$($gitVersionObject.FullSemVer)\"\n            displayName: Calculate ModuleVersion (GitVersion)\n\n          - task: PowerShell@2\n            name: package\n            displayName: 'Build & Package Module'\n            inputs:\n              filePath: './build.ps1'\n              arguments: '-ResolveDependency -tasks pack'\n              pwsh: true\n            env:\n              ModuleVersion: $(NuGetVersionV2)\n\n          - task: PublishPipelineArtifact@1\n            displayName: 'Publish Build Artifact'\n            inputs:\n              targetPath: '$(buildFolderName)/'\n              artifact: $(buildArtifactName)\n              publishLocation: 'pipeline'\n              parallel: true\n\n  - stage: Test\n    dependsOn: Build\n    jobs:\n      - job: test_linux\n        displayName: 'Linux'\n        timeoutInMinutes: 0\n        pool:\n          vmImage: 'ubuntu-latest'\n        steps:\n          - task: DownloadPipelineArtifact@2\n            displayName: 'Download Build Artifact'\n            inputs:\n              buildType: 'current'\n              artifactName: $(buildArtifactName)\n              targetPath: '$(Build.SourcesDirectory)/$(buildFolderName)'\n\n          - task: PowerShell@2\n            name: test\n            displayName: 'Run Tests'\n            inputs:\n              filePath: './build.ps1'\n              arguments: '-tasks test'\n\n          - task: PublishTestResults@2\n            displayName: 'Publish Test Results'\n            condition: succeededOrFailed()\n            inputs:\n              testResultsFormat: 'NUnit'\n              testResultsFiles: '$(buildFolderName)/$(testResultFolderName)/NUnit*.xml'\n              testRunTitle: 'Linux'\n\n          - task: PublishPipelineArtifact@1\n            displayName: 'Publish Test Artifact'\n            inputs:\n              targetPath: '$(buildFolderName)/$(testResultFolderName)/'\n              artifactName: 'CodeCoverageLinux'\n              parallel: true\n\n      - job: test_windows_core\n        displayName: 'Windows (PowerShell)'\n        timeoutInMinutes: 0\n        pool:\n          vmImage: 'windows-latest'\n        steps:\n          - task: DownloadPipelineArtifact@2\n            displayName: 'Download Build Artifact'\n            inputs:\n              buildType: 'current'\n              artifactName: $(buildArtifactName)\n              targetPath: '$(Build.SourcesDirectory)/$(buildFolderName)'\n\n          - task: PowerShell@2\n            name: test\n            displayName: 'Run Tests'\n            inputs:\n              filePath: './build.ps1'\n              arguments: '-tasks test'\n              pwsh: true\n\n          - task: PublishTestResults@2\n            displayName: 'Publish Test Results'\n            condition: succeededOrFailed()\n            inputs:\n              testResultsFormat: 'NUnit'\n              testResultsFiles: '$(buildFolderName)/$(testResultFolderName)/NUnit*.xml'\n              testRunTitle: 'Windows (PowerShell)'\n\n          - task: PublishPipelineArtifact@1\n            displayName: 'Publish Test Artifact'\n            inputs:\n              targetPath: '$(buildFolderName)/$(testResultFolderName)/'\n              artifactName: 'CodeCoverageWinPS7'\n              parallel: true\n\n      - job: test_windows_ps\n        displayName: 'Windows (Windows PowerShell)'\n        timeoutInMinutes: 0\n        pool:\n          vmImage: 'windows-latest'\n        steps:\n          - task: DownloadPipelineArtifact@2\n            displayName: 'Download Build Artifact'\n            inputs:\n              buildType: 'current'\n              artifactName: $(buildArtifactName)\n              targetPath: '$(Build.SourcesDirectory)/$(buildFolderName)'\n\n          - task: PowerShell@2\n            name: test\n            displayName: 'Run Tests'\n            inputs:\n              filePath: './build.ps1'\n              arguments: '-tasks test'\n              pwsh: false\n\n          - task: PublishTestResults@2\n            displayName: 'Publish Test Results'\n            condition: succeededOrFailed()\n            inputs:\n              testResultsFormat: 'NUnit'\n              testResultsFiles: '$(buildFolderName)/$(testResultFolderName)/NUnit*.xml'\n              testRunTitle: 'Windows (Windows PowerShell)'\n\n          - task: PublishPipelineArtifact@1\n            displayName: 'Publish Test Artifact'\n            inputs:\n              targetPath: '$(buildFolderName)/$(testResultFolderName)/'\n              artifactName: 'CodeCoverageWinPS51'\n              parallel: true\n\n      - job: test_macos\n        displayName: 'macOS'\n        timeoutInMinutes: 0\n        pool:\n          vmImage: 'macos-latest'\n        steps:\n          - task: DownloadPipelineArtifact@2\n            displayName: 'Download Build Artifact'\n            inputs:\n              buildType: 'current'\n              artifactName: $(buildArtifactName)\n              targetPath: '$(Build.SourcesDirectory)/$(buildFolderName)'\n\n          - task: PowerShell@2\n            name: test\n            displayName: 'Run Tests'\n            inputs:\n              filePath: './build.ps1'\n              arguments: '-tasks test'\n              pwsh: true\n\n          - task: PublishTestResults@2\n            displayName: 'Publish Test Results'\n            condition: succeededOrFailed()\n            inputs:\n              testResultsFormat: 'NUnit'\n              testResultsFiles: '$(buildFolderName)/$(testResultFolderName)/NUnit*.xml'\n              testRunTitle: 'MacOS'\n\n          - task: PublishPipelineArtifact@1\n            displayName: 'Publish Test Artifact'\n            inputs:\n              targetPath: '$(buildFolderName)/$(testResultFolderName)/'\n              artifactName: 'CodeCoverageMacOS'\n              parallel: true\n\n      # If no code coverage should be reported, then this entire removed:\n      - job: Code_Coverage\n        displayName: 'Publish Code Coverage'\n        dependsOn:\n          - test_macos\n          - test_linux\n          - test_windows_core\n          - test_windows_ps\n        pool:\n          vmImage: 'ubuntu-latest'\n        timeoutInMinutes: 0\n        steps:\n          - pwsh: |\n              $repositoryOwner,$repositoryName = $env:BUILD_REPOSITORY_NAME -split '/'\n              echo \"##vso[task.setvariable variable=RepositoryOwner;isOutput=true]$repositoryOwner\"\n              echo \"##vso[task.setvariable variable=RepositoryName;isOutput=true]$repositoryName\"\n            name: dscBuildVariable\n            displayName: 'Set Environment Variables'\n\n          - task: DownloadPipelineArtifact@2\n            displayName: 'Download Pipeline Artifact'\n            inputs:\n              buildType: 'current'\n              artifactName: $(buildArtifactName)\n              targetPath: '$(Build.SourcesDirectory)/$(buildArtifactName)'\n\n          - task: DownloadPipelineArtifact@2\n            displayName: 'Download Test Artifact macOS'\n            inputs:\n              buildType: 'current'\n              artifactName: 'CodeCoverageMacOS'\n              targetPath: '$(Build.SourcesDirectory)/$(buildFolderName)/$(testResultFolderName)'\n\n          - task: DownloadPipelineArtifact@2\n            displayName: 'Download Test Artifact Linux'\n            inputs:\n              buildType: 'current'\n              artifactName: 'CodeCoverageLinux'\n              targetPath: '$(Build.SourcesDirectory)/$(buildFolderName)/$(testResultFolderName)'\n\n          - task: DownloadPipelineArtifact@2\n            displayName: 'Download Test Artifact Windows (PS 5.1)'\n            inputs:\n              buildType: 'current'\n              artifactName: 'CodeCoverageWinPS51'\n              targetPath: '$(Build.SourcesDirectory)/$(buildFolderName)/$(testResultFolderName)'\n\n          - task: DownloadPipelineArtifact@2\n            displayName: 'Download Test Artifact Windows (PS7)'\n            inputs:\n              buildType: 'current'\n              artifactName: 'CodeCoverageWinPS7'\n              targetPath: '$(Build.SourcesDirectory)/$(buildFolderName)/$(testResultFolderName)'\n\n          # Make sure to update build.yaml to support these tasks, then uncomment these tasks:\n          #- task: PowerShell@2\n          #  name: merge\n          #  displayName: 'Merge Code Coverage files'\n          #  inputs:\n          #    filePath: './build.ps1'\n          #    arguments: '-tasks merge'\n          #    pwsh: true\n          #- task: PublishCodeCoverageResults@1\n          #  displayName: 'Publish Azure Code Coverage'\n          #  inputs:\n          #    codeCoverageTool: 'JaCoCo'\n          #    summaryFileLocation: '$(buildFolderName)/$(testResultFolderName)/JaCoCo_coverage.xml'\n          #    pathToSources: '$(Build.SourcesDirectory)/$(dscBuildVariable.RepositoryName)/'\n\n          # Uncomment if Codecov.io should be used (see docs at Codecov.io how to use and the required repository configuration).\n          #- script: |\n          #    bash <(curl -s https://codecov.io/bash) -f \"./$(buildFolderName)/$(testResultFolderName)/JaCoCo_coverage.xml\"\n          #  displayName: 'Publish Code Coverage to Codecov.io'\n\n  - stage: Deploy\n    dependsOn: Test\n    # Only execute deploy stage if we're on main and previous stage succeeded\n    condition: |\n      and(\n        succeeded(),\n        or(\n          eq(variables['Build.SourceBranch'], 'refs/heads/main'),\n          startsWith(variables['Build.SourceBranch'], 'refs/tags/')\n        ),\n        contains(variables['System.TeamFoundationCollectionUri'], 'MyOrgName')\n      )\n    jobs:\n      - job: Deploy_Module\n        displayName: 'Deploy Module'\n        pool:\n          vmImage: 'ubuntu-latest'\n        steps:\n          - task: DownloadPipelineArtifact@2\n            displayName: 'Download Build Artifact'\n            inputs:\n              buildType: 'current'\n              artifactName: $(buildArtifactName)\n              targetPath: '$(Build.SourcesDirectory)/$(buildFolderName)'\n          - task: PowerShell@2\n            name: publishRelease\n            displayName: 'Publish Release'\n            inputs:\n              filePath: './build.ps1'\n              arguments: '-tasks publish'\n              pwsh: true\n            env:\n              GitHubToken: $(GitHubToken)\n              GalleryApiToken: $(GalleryApiToken)\n              ReleaseBranch: $(defaultBranch)\n              MainGitBranch: $(defaultBranch)\n          - task: PowerShell@2\n            name: sendChangelogPR\n            displayName: 'Send Changelog PR'\n            inputs:\n              filePath: './build.ps1'\n              arguments: '-tasks Create_ChangeLog_GitHub_PR'\n              pwsh: true\n            env:\n              GitHubToken: $(GitHubToken)\n              ReleaseBranch: $(defaultBranch)\n              MainGitBranch: $(defaultBranch)\n\n"
  },
  {
    "path": "build.ps1",
    "content": "<#\n    .DESCRIPTION\n        Bootstrap and build script for PowerShell module CI/CD pipeline\n\n    .PARAMETER Tasks\n        The task or tasks to run. The default value is '.' (runs the default task).\n\n    .PARAMETER CodeCoverageThreshold\n        The code coverage target threshold to uphold. Set to 0 to disable.\n        The default value is '' (empty string).\n\n    .PARAMETER BuildConfig\n        Not yet written.\n\n    .PARAMETER OutputDirectory\n        Specifies the folder to build the artefact into. The default value is 'output'.\n\n    .PARAMETER BuiltModuleSubdirectory\n        Subdirectory name to build the module (under $OutputDirectory). The default\n        value is '' (empty string).\n\n    .PARAMETER RequiredModulesDirectory\n        Can be a path (relative to $PSScriptRoot or absolute) to tell Resolve-Dependency\n        and PSDepend where to save the required modules. It is also possible to use\n        'CurrentUser' och 'AllUsers' to install missing dependencies. You can override\n        the value for PSDepend in the Build.psd1 build manifest. The default value is\n        'output/RequiredModules'.\n\n    .PARAMETER PesterScript\n        One or more paths that will override the Pester configuration in build\n        configuration file when running the build task Invoke_Pester_Tests.\n\n        If running Pester 5 test, use the alias PesterPath to be future-proof.\n\n    .PARAMETER PesterTag\n        Filter which tags to run when invoking Pester tests. This is used in the\n        Invoke-Pester.pester.build.ps1 tasks.\n\n    .PARAMETER PesterExcludeTag\n        Filter which tags to exclude when invoking Pester tests. This is used in\n        the Invoke-Pester.pester.build.ps1 tasks.\n\n    .PARAMETER DscTestTag\n        Filter which tags to run when invoking DSC Resource tests. This is used\n        in the DscResource.Test.build.ps1 tasks.\n\n    .PARAMETER DscTestExcludeTag\n        Filter which tags to exclude when invoking DSC Resource tests. This is\n        used in the DscResource.Test.build.ps1 tasks.\n\n    .PARAMETER ResolveDependency\n        Not yet written.\n\n    .PARAMETER BuildInfo\n        The build info object from ModuleBuilder. Defaults to an empty hashtable.\n\n    .PARAMETER AutoRestore\n        Not yet written.\n#>\n[CmdletBinding()]\nparam\n(\n    [Parameter(Position = 0)]\n    [System.String[]]\n    $Tasks = '.',\n\n    [Parameter()]\n    [System.String]\n    $CodeCoverageThreshold = '',\n\n    [Parameter()]\n    [System.String]\n    [ValidateScript(\n        { Test-Path -Path $_ }\n    )]\n    $BuildConfig,\n\n    [Parameter()]\n    [System.String]\n    $OutputDirectory = 'output',\n\n    [Parameter()]\n    [System.String]\n    $BuiltModuleSubdirectory = '',\n\n    [Parameter()]\n    [System.String]\n    $RequiredModulesDirectory = $(Join-Path 'output' 'RequiredModules'),\n\n    [Parameter()]\n    # This alias is to prepare for the rename of this parameter to PesterPath when Pester 4 support is removed\n    [Alias('PesterPath')]\n    [System.Object[]]\n    $PesterScript,\n\n    [Parameter()]\n    [System.String[]]\n    $PesterTag,\n\n    [Parameter()]\n    [System.String[]]\n    $PesterExcludeTag,\n\n    [Parameter()]\n    [System.String[]]\n    $DscTestTag,\n\n    [Parameter()]\n    [System.String[]]\n    $DscTestExcludeTag,\n\n    [Parameter()]\n    [Alias('bootstrap')]\n    [System.Management.Automation.SwitchParameter]\n    $ResolveDependency,\n\n    [Parameter(DontShow)]\n    [AllowNull()]\n    [System.Collections.Hashtable]\n    $BuildInfo,\n\n    [Parameter()]\n    [System.Management.Automation.SwitchParameter]\n    $AutoRestore\n)\n\n<#\n    The BEGIN block (at the end of this file) handles the Bootstrap of the Environment\n    before Invoke-Build can run the tasks if the parameter ResolveDependency (or\n    parameter alias Bootstrap) is specified.\n#>\n\nprocess\n{\n\n    if ($MyInvocation.ScriptName -notLike '*Invoke-Build.ps1')\n    {\n        # Only run the process block through InvokeBuild (look at the Begin block at the bottom of this script).\n        return\n    }\n\n    # Execute the Build process from the .build.ps1 path.\n    Push-Location -Path $PSScriptRoot -StackName 'BeforeBuild'\n\n    try\n    {\n        Write-Host -Object \"[build] Parsing defined tasks\" -ForeGroundColor Magenta\n\n        # Load the default BuildInfo if the parameter BuildInfo is not set.\n        if (-not $PSBoundParameters.ContainsKey('BuildInfo'))\n        {\n            try\n            {\n                if (Test-Path -Path $BuildConfig)\n                {\n                    $configFile = Get-Item -Path $BuildConfig\n\n                    Write-Host -Object \"[build] Loading Configuration from $configFile\"\n\n                    $BuildInfo = switch -Regex ($configFile.Extension)\n                    {\n                        # Native Support for PSD1\n                        '\\.psd1'\n                        {\n                            if (-not (Get-Command -Name Import-PowerShellDataFile -ErrorAction SilentlyContinue))\n                            {\n                                Import-Module -Name Microsoft.PowerShell.Utility -RequiredVersion 3.1.0.0\n                            }\n\n                            Import-PowerShellDataFile -Path $BuildConfig\n                        }\n\n                        # Support for yaml when module PowerShell-Yaml is available\n                        '\\.[yaml|yml]'\n                        {\n                            Import-Module -Name 'powershell-yaml' -ErrorAction Stop\n\n                            ConvertFrom-Yaml -Yaml (Get-Content -Raw $configFile)\n                        }\n\n                        # Native Support for JSON and JSONC (by Removing comments)\n                        '\\.[json|jsonc]'\n                        {\n                            $jsonFile = Get-Content -Raw -Path $configFile\n\n                            $jsonContent = $jsonFile -replace '(?m)\\s*//.*?$' -replace '(?ms)/\\*.*?\\*/'\n\n                            # Yaml is superset of JSON.\n                            ConvertFrom-Yaml -Yaml $jsonContent\n                        }\n\n                        # Unknown extension, return empty hashtable.\n                        default\n                        {\n                            Write-Error -Message \"Extension '$_' not supported. using @{}\"\n\n                            @{ }\n                        }\n                    }\n                }\n                else\n                {\n                    Write-Host -Object \"Configuration file '$($BuildConfig.FullName)' not found\" -ForegroundColor Red\n\n                    # No config file was found, return empty hashtable.\n                    $BuildInfo = @{ }\n                }\n            }\n            catch\n            {\n                $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.\"\n\n                Write-Host -Object $logMessage -ForegroundColor Yellow\n\n                $BuildInfo = @{ }\n\n                Write-Error -Message $_.Exception.Message\n            }\n        }\n\n        # If the Invoke-Build Task Header is specified in the Build Info, set it.\n        if ($BuildInfo.TaskHeader)\n        {\n            Set-BuildHeader -Script ([scriptblock]::Create($BuildInfo.TaskHeader))\n        }\n\n        <#\n            Add BuildModuleOutput to PSModule Path environment variable.\n            Moved here (not in begin block) because build file can contains BuiltSubModuleDirectory value.\n        #>\n        if ($BuiltModuleSubdirectory)\n        {\n            if (-not (Split-Path -IsAbsolute -Path $BuiltModuleSubdirectory))\n            {\n                $BuildModuleOutput = Join-Path -Path $OutputDirectory -ChildPath $BuiltModuleSubdirectory\n            }\n            else\n            {\n                $BuildModuleOutput = $BuiltModuleSubdirectory\n            }\n        } # test if BuiltModuleSubDirectory set in build config file\n        elseif ($BuildInfo.ContainsKey('BuiltModuleSubDirectory'))\n        {\n            $BuildModuleOutput = Join-Path -Path $OutputDirectory -ChildPath $BuildInfo['BuiltModuleSubdirectory']\n        }\n        else\n        {\n            $BuildModuleOutput = $OutputDirectory\n        }\n\n        # Pre-pending $BuildModuleOutput folder to PSModulePath to resolve built module from this folder.\n        if ($powerShellModulePaths -notcontains $BuildModuleOutput)\n        {\n            Write-Host -Object \"[build] Pre-pending '$BuildModuleOutput' folder to PSModulePath\" -ForegroundColor Green\n\n            $env:PSModulePath = $BuildModuleOutput + [System.IO.Path]::PathSeparator + $env:PSModulePath\n        }\n\n        <#\n            Import Tasks from modules via their exported aliases when defined in Build Manifest.\n            https://github.com/nightroman/Invoke-Build/tree/master/Tasks/Import#example-2-import-from-a-module-with-tasks\n        #>\n        if ($BuildInfo.ContainsKey('ModuleBuildTasks'))\n        {\n            foreach ($module in $BuildInfo['ModuleBuildTasks'].Keys)\n            {\n                try\n                {\n                    Write-Host -Object \"Importing tasks from module $module\" -ForegroundColor DarkGray\n\n                    $loadedModule = Import-Module -Name $module -PassThru -ErrorAction Stop\n\n                    foreach ($TaskToExport in $BuildInfo['ModuleBuildTasks'].($module))\n                    {\n                        $loadedModule.ExportedAliases.GetEnumerator().Where{\n                            Write-Host -Object \"`t Loading $($_.Key)...\" -ForegroundColor DarkGray\n\n                            # Using -like to support wildcard.\n                            $_.Key -like $TaskToExport\n                        }.ForEach{\n                            # Dot-sourcing the Tasks via their exported aliases.\n                            . (Get-Alias $_.Key)\n                        }\n                    }\n                }\n                catch\n                {\n                    Write-Host -Object \"Could not load tasks for module $module.\" -ForegroundColor Red\n\n                    Write-Error -Message $_\n                }\n            }\n        }\n\n        # Loading Build Tasks defined in the .build/ folder (will override the ones imported above if same task name).\n        Get-ChildItem -Path '.build/' -Recurse -Include '*.ps1' -ErrorAction Ignore |\n            ForEach-Object {\n                \"Importing file $($_.BaseName)\" | Write-Verbose\n\n                . $_.FullName\n            }\n\n        # Synopsis: Empty task, useful to test the bootstrap process.\n        task noop { }\n\n        # Define default task sequence (\".\"), can be overridden in the $BuildInfo.\n        task . {\n            Write-Build -Object 'No sequence currently defined for the default task' -ForegroundColor Yellow\n        }\n\n        Write-Host -Object 'Adding Workflow from configuration:' -ForegroundColor DarkGray\n\n        # Load Invoke-Build task sequences/workflows from $BuildInfo.\n        foreach ($workflow in $BuildInfo.BuildWorkflow.keys)\n        {\n            Write-Verbose -Message \"Creating Build Workflow '$Workflow' with tasks $($BuildInfo.BuildWorkflow.($Workflow) -join ', ').\"\n\n            $workflowItem = $BuildInfo.BuildWorkflow.($workflow)\n\n            if ($workflowItem.Trim() -match '^\\{(?<sb>[\\w\\W]*)\\}$')\n            {\n                $workflowItem = [ScriptBlock]::Create($Matches['sb'])\n            }\n\n            Write-Host -Object \"  +-> $workflow\" -ForegroundColor DarkGray\n\n            task $workflow $workflowItem\n        }\n\n        Write-Host -Object \"[build] Executing requested workflow: $($Tasks -join ', ')\" -ForeGroundColor Magenta\n\n    }\n    finally\n    {\n        Pop-Location -StackName 'BeforeBuild'\n    }\n}\n\nBegin\n{\n    # Find build config if not specified.\n    if (-not $BuildConfig)\n    {\n        $config = Get-ChildItem -Path \"$PSScriptRoot\\*\" -Include 'build.y*ml', 'build.psd1', 'build.json*' -ErrorAction Ignore\n\n        if (-not $config -or ($config -is [System.Array] -and $config.Length -le 0))\n        {\n            throw 'No build configuration found. Specify path via parameter BuildConfig.'\n        }\n        elseif ($config -is [System.Array])\n        {\n            if ($config.Length -gt 1)\n            {\n                throw 'More than one build configuration found. Specify which path to use via parameter BuildConfig.'\n            }\n\n            $BuildConfig = $config[0]\n        }\n        else\n        {\n            $BuildConfig = $config\n        }\n    }\n\n    # Bootstrapping the environment before using Invoke-Build as task runner\n\n    if ($MyInvocation.ScriptName -notlike '*Invoke-Build.ps1')\n    {\n        Write-Host -Object \"[pre-build] Starting Build Init\" -ForegroundColor Green\n\n        Push-Location $PSScriptRoot -StackName 'BuildModule'\n    }\n\n    if ($RequiredModulesDirectory -in @('CurrentUser', 'AllUsers'))\n    {\n        # Installing modules instead of saving them.\n        Write-Host -Object \"[pre-build] Required Modules will be installed to the PowerShell module path that is used for $RequiredModulesDirectory.\" -ForegroundColor Green\n\n        <#\n            The variable $PSDependTarget will be used below when building the splatting\n            variable before calling Resolve-Dependency.ps1, unless overridden in the\n            file Resolve-Dependency.psd1.\n        #>\n        $PSDependTarget = $RequiredModulesDirectory\n    }\n    else\n    {\n        if (-not (Split-Path -IsAbsolute -Path $OutputDirectory))\n        {\n            $OutputDirectory = Join-Path -Path $PSScriptRoot -ChildPath $OutputDirectory\n        }\n\n        # Resolving the absolute path to save the required modules to.\n        if (-not (Split-Path -IsAbsolute -Path $RequiredModulesDirectory))\n        {\n            $RequiredModulesDirectory = Join-Path -Path $PSScriptRoot -ChildPath $RequiredModulesDirectory\n        }\n\n        # Create the output/modules folder if not exists, or resolve the Absolute path otherwise.\n        if (Resolve-Path -Path $RequiredModulesDirectory -ErrorAction SilentlyContinue)\n        {\n            Write-Debug -Message \"[pre-build] Required Modules path already exist at $RequiredModulesDirectory\"\n\n            $requiredModulesPath = Convert-Path -Path $RequiredModulesDirectory\n        }\n        else\n        {\n            Write-Host -Object \"[pre-build] Creating required modules directory $RequiredModulesDirectory.\" -ForegroundColor Green\n\n            $requiredModulesPath = (New-Item -ItemType Directory -Force -Path $RequiredModulesDirectory).FullName\n        }\n\n        $powerShellModulePaths = $env:PSModulePath -split [System.IO.Path]::PathSeparator\n\n        # Pre-pending $requiredModulesPath folder to PSModulePath to resolve from this folder FIRST.\n        if ($RequiredModulesDirectory -notin @('CurrentUser', 'AllUsers') -and\n            ($powerShellModulePaths -notcontains $RequiredModulesDirectory))\n        {\n            Write-Host -Object \"[pre-build] Pre-pending '$RequiredModulesDirectory' folder to PSModulePath\" -ForegroundColor Green\n\n            $env:PSModulePath = $RequiredModulesDirectory + [System.IO.Path]::PathSeparator + $env:PSModulePath\n        }\n\n        $powerShellYamlModule = Get-Module -Name 'powershell-yaml' -ListAvailable\n        $invokeBuildModule = Get-Module -Name 'InvokeBuild' -ListAvailable\n        $psDependModule = Get-Module -Name 'PSDepend' -ListAvailable\n\n        # Checking if the user should -ResolveDependency.\n        if (-not ($powerShellYamlModule -and $invokeBuildModule -and $psDependModule) -and -not $ResolveDependency)\n        {\n            if ($AutoRestore -or -not $PSBoundParameters.ContainsKey('Tasks') -or $Tasks -contains 'build')\n            {\n                Write-Host -Object \"[pre-build] Dependency missing, running './build.ps1 -ResolveDependency -Tasks noop' for you `r`n\" -ForegroundColor Yellow\n\n                $ResolveDependency = $true\n            }\n            else\n            {\n                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.\"\n            }\n        }\n\n        <#\n            The variable $PSDependTarget will be used below when building the splatting\n            variable before calling Resolve-Dependency.ps1, unless overridden in the\n            file Resolve-Dependency.psd1.\n        #>\n        $PSDependTarget = $requiredModulesPath\n    }\n\n    if ($ResolveDependency)\n    {\n        Write-Host -Object \"[pre-build] Resolving dependencies.\" -ForegroundColor Green\n        $resolveDependencyParams = @{ }\n\n        # If BuildConfig is a Yaml file, bootstrap powershell-yaml via ResolveDependency.\n        if ($BuildConfig -match '\\.[yaml|yml]$')\n        {\n            $resolveDependencyParams.Add('WithYaml', $true)\n        }\n\n        $resolveDependencyAvailableParams = (Get-Command -Name '.\\Resolve-Dependency.ps1').Parameters.Keys\n\n        foreach ($cmdParameter in $resolveDependencyAvailableParams)\n        {\n            # The parameter has been explicitly used for calling the .build.ps1\n            if ($MyInvocation.BoundParameters.ContainsKey($cmdParameter))\n            {\n                $paramValue = $MyInvocation.BoundParameters.Item($cmdParameter)\n\n                Write-Debug \" adding  $cmdParameter :: $paramValue [from user-provided parameters to Build.ps1]\"\n\n                $resolveDependencyParams.Add($cmdParameter, $paramValue)\n            }\n            # Use defaults parameter value from Build.ps1, if any\n            else\n            {\n                $paramValue = Get-Variable -Name $cmdParameter -ValueOnly -ErrorAction Ignore\n\n                if ($paramValue)\n                {\n                    Write-Debug \" adding  $cmdParameter :: $paramValue [from default Build.ps1 variable]\"\n\n                    $resolveDependencyParams.Add($cmdParameter, $paramValue)\n                }\n            }\n        }\n\n        Write-Host -Object \"[pre-build] Starting bootstrap process.\" -ForegroundColor Green\n\n        .\\Resolve-Dependency.ps1 @resolveDependencyParams\n    }\n\n    if ($MyInvocation.ScriptName -notlike '*Invoke-Build.ps1')\n    {\n        Write-Verbose -Message \"Bootstrap completed. Handing back to InvokeBuild.\"\n\n        if ($PSBoundParameters.ContainsKey('ResolveDependency'))\n        {\n            Write-Verbose -Message \"Dependency already resolved. Removing task.\"\n\n            $null = $PSBoundParameters.Remove('ResolveDependency')\n        }\n\n        Write-Host -Object \"[build] Starting build with InvokeBuild.\" -ForegroundColor Green\n\n        Invoke-Build @PSBoundParameters -Task $Tasks -File $MyInvocation.MyCommand.Path\n\n        Pop-Location -StackName 'BuildModule'\n\n        return\n    }\n}\n"
  },
  {
    "path": "build.yaml",
    "content": "---\n# Invoke-Build Header to be used to 'decorate' the terminal output of the tasks.\nTaskHeader: |\n  param($Path)\n  \"\"\n  \"=\" * 79\n  Write-Build Cyan \"`t`t`t$($Task.Name.replace(\"_\",\" \").ToUpper())\"\n  Write-Build DarkGray  \"$(Get-BuildSynopsis $Task)\"\n  \"-\" * 79\n  Write-Build DarkGray \"  $Path\"\n  Write-Build DarkGray \"  $($Task.InvocationInfo.ScriptName):$($Task.InvocationInfo.ScriptLineNumber)\"\n  \"\"\n\n####################################################\n# Pipeline Build Task Configuration (Invoke-Build) #\n####################################################\nBuildWorkflow:\n  '.': \n    - build\n    - test\n\n  build:\n    - Clean\n    - Build_Module_ModuleBuilder\n    - Build_NestedModules_ModuleBuilder\n    - Create_changelog_release_output\n\n  pack:\n    - build\n    - package_module_nupkg\n\n  test:\n    - Pester_Tests_Stop_On_Fail\n    #- Convert_Pester_Coverage\n    - Pester_if_Code_Coverage_Under_Threshold\n\n  # Use this task when you have multiple parallel tests, which produce multiple\n  # code coverage files and needs to get merged into one file.\n  #merge:\n    #- Merge_CodeCoverage_Files\n\n  publish:\n    - publish_module_to_gallery\n    - Publish_Release_To_GitHub\n  #  - Publish_GitHub_Wiki_Content\n\n####################################################\n#          ModuleBuilder Configuration             #\n####################################################\n\nCopyPaths:\n  - bin\n  - checks\n  - functions\n  - internal\n  - xml\nEncoding: UTF8\nVersionedOutputDirectory: true\n\n####################################################\n#       PESTER  Configuration                      #\n####################################################\n\n# PESTER CONFIG START\nPester:\n  # Pester Advanced configuration.\n  # If a key is not set it will be using Sampler pipeline default value.\n  Configuration:\n    Run:\n      Path: tests\n        \n      ExcludePath:\n    Filter:\n      Tag:\n      ExcludeTag:\n        \n    Output:\n      Verbosity: None\n    CodeCoverage:\n      Path: '*/checks/*'\n      OutputFormat:\n      CoveragePercentTarget: 0\n      OutputPath: JaCoCo_coverage.xml\n      OutputEncoding: ascii\n      ExcludeTests:\n    TestResult:\n      OutputFormat: NUnitXML\n      OutputPath:\n      OutputEncoding:\n      TestSuiteName:\n\n####################################################\n#         Import ModuleBuilder Configuration              #\n####################################################\n\n# 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\n# prefix and or suffix. The module contain the task must be added as a required\n# module in the file RequiredModules.psd1.\nModuleBuildTasks:\n  Sampler:\n    - '*.build.Sampler.ib.tasks'\n  Sampler.GitHubTasks:\n    - '*.ib.tasks'\n\n\n####################################################\n#              PSDepend Configuration              #\n####################################################\nResolve-Dependency:\n  Gallery: 'PSGallery'\n  AllowPrerelease: false\n  Verbose: false\n\n####################################################\n#               GitHub Configuration               #\n####################################################\nGitHubConfig:\n  GitHubFilesToAdd:\n    - 'CHANGELOG.md'\n  GitHubConfigUserName: BeardAutoBot\n  GitHubConfigUserEmail: mrrobsewell@outlook.com\n  UpdateChangelogOnPrerelease: true\n"
  },
  {
    "path": "builddocs.ps1",
    "content": "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 \n\nInstall-Module PlatyPs -Scope CurrentUser -Force\nImport-Module PlatyPs\n\n# Get the Module versions\nInstall-Module Configuration -RequiredVersion 1.3.0 -Scope CurrentUser -Force\n$Modules = Get-ManifestValue -Path .\\dbachecks.psd1 -PropertyName RequiredModules\n\n$PSFrameworkVersion = $Modules.Where{$_.Get_Item('ModuleName') -eq 'PSFramework'}[0].Get_Item('ModuleVersion')\n$dbatoolsVersion = $Modules.Where{$_.Get_Item('ModuleName') -eq 'dbatools'}[0].Get_Item('ModuleVersion')\n\n# Install Pester\ntry {\n    Write-Output \"Installing Pester\"\n    Install-Module Pester  -RequiredVersion 4.10.0  -Scope CurrentUser -Force -SkipPublisherCheck\n    Write-Output \"Installed Pester\"\n\n}\ncatch {\n    Write-Error \"Failed to Install Pester $($_)\"\n}\n\n\n# Install dbatools\ntry {\n    Write-Output \"Installing PSFramework\"\n    Install-Module PSFramework  -RequiredVersion $PsFrameworkVersion  -Scope CurrentUser -Force\n    Write-Output \"Installed PSFramework\"\n\n}\ncatch {\n    Write-Error \"Failed to Install PSFramework $($_)\"\n}\n# Install dbachecks\ntry {\n    Write-Output \"Installing dbatools\"\n    Write-Output \"Install-Module dbatools  -RequiredVersion $dbatoolsVersion  -Scope CurrentUser -Force\"\n    Install-Module dbatools  -RequiredVersion $dbatoolsVersion  -Scope CurrentUser -Force\n    Write-Output \"Installed dbatools\"\n\n}\ncatch {\n    Write-Error \"Failed to Install dbatools $($_)\"\n}\n\n\n# Add current folder to PSModulePath\ntry {\n    Write-Output \"Adding local folder to PSModulePath\"\n    $ENV:PSModulePath = $ENV:PSModulePath + \";$pwd\"\n    Write-Output \"Added local folder to PSModulePath\"\n    $ENV:PSModulePath.Split(';')\n}\ncatch {\n    Write-Error \"Failed to add $pwd to PSModulePAth - $_\"\n}\ntry {\n    Write-Output \"Importing dbachecks\"\n    Import-Module .\\dbachecks.psd1 -verbose\n    Write-Output \"Imported dbachecks\"\n\n}\ncatch {\n    try {\n        Write-Output \"Importing dbachecks again to get around the stupid failure for dbatools\"\n        Import-Module .\\dbachecks.psd1 -verbose\n        Write-Output \"Imported dbachecks - again to get around the stupid failure for dbatools\"\n    }\n    catch {\n        Write-Error \"Failed to Install dbachecks $($_)\"\n    }\n}\n\n\n$ProjectRoot = Get-Location\n$ReleaseNotes = \".\\RELEASE.md\"\n$ChangeLog = \"$ProjectRoot\\docs\\ChangeLog.md\"\n\n\n#Build YAMLText starting with the header\n$YMLtext = (Get-Content \"$ProjectRoot\\header-mkdocs.yml\") -join \"`n\"\n$YMLtext = \"$YMLtext`n\"\n\n$parameters = @{\n    Path        = $ReleaseNotes\n    ErrorAction = 'SilentlyContinue'\n}\n$ReleaseText = (Get-Content @parameters) -join \"`n\"\nif ($ReleaseText) {\n    $ReleaseText | Set-Content \"$ProjectRoot\\docs\\RELEASE.md\"\n    $YMLText = \"$YMLtext  - Release Notes: RELEASE.md`n\"\n}\nif ((Test-Path -Path $ChangeLog)) {\n    $YMLText = \"$YMLtext  - Change Log: ChangeLog.md`n\"\n}\n$YMLText = \"$YMLtext  - Functions:`n\"\n\n$Params = @{\n    Module       = 'dbachecks'\n    Force        = $true\n    OutputFolder = \"$ProjectRoot\\docs\\functions\"\n    NoMetadata   = $true\n}\nNew-MarkdownHelp @Params | foreach-object {\n    $Function = $_.Name -replace '\\.md', ''\n    $Part = \"    - {0}: functions/{1}\" -f $Function, $_.Name\n    $YMLText = \"{0}{1}`n\" -f $YMLText, $Part\n    $Part\n}\n$YMLtext | Set-Content -Path \"$ProjectRoot\\mkdocs.yml\"\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUDdPclX9bMrkY1BsUGvj1TEwy\n# ciqgggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz\n# c3VyZWQgSUQgQ29kZSBTaWduaW5nIENBMB4XDTE3MDUwOTAwMDAwMFoXDTIwMDUx\n# MzEyMDAwMFowVzELMAkGA1UEBhMC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/kLEbBw6RFfu6r7VRwo0k\n# riTGxycqoSkoGjpxKAI8LpGjwCUR4pwUR6F6aGivm6dcIFzZcbEMj7uo+MUSaJ/P\n# QMtARKUT8OZkDCUIQjKyNookAv4vcn4c10lFluhZHen6dGRrsutmQ9qzsIzV6Q3d\n# 9gEgzpkxYz0IGhizgZtPxpMQBvwHgfqL2vmCSfdibqFT+hKUGIUukpHqaGxEMrJm\n# oecYpJpkUe8xggIoMIICJAIBATCBhjByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMM\n# RGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQD\n# EyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgQ29kZSBTaWduaW5nIENBAhACwXUo\n# dNXChDGFKtigZGnKMAkGBSsOAwIaBQCgeDAYBgorBgEEAYI3AgEMMQowCKACgACh\n# AoAAMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcCAQsxDjAM\n# BgorBgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBSzz+yLLVqFPDBCsi+BQFmjwuh5\n# CDANBgkqhkiG9w0BAQEFAASCAQAI3TlWQUHrQTKwuJY5pedwnfvBmc2GSTrPbMhQ\n# arwpd8yDmEMl9QCuUDEcRYSyXaLoxqa5RgVpIj717MUFSmVDWPTKtXuTak23Mstv\n# vl88D/cpH5fJvkdM7IA+EMdfX9q03wWMnKop84MiAdsKfyLPN+xCNx5jLy/CYOEm\n# 8k8f3TrZ8z4/zZIsYiAS0kQHx1okKF4+cvYUNParzPyfWJVVhdfsquNnW3x6C1hK\n# E0pI9m6gW0ZXsNn3rLwi4bc68GUuMsNQTGN4DuihFGo1OGhFt8OZ40lTglfYWmVr\n# pepNkgAGQFJLoYWlWMuCOUFbcqfA2XU88s9M1sAfrjY69mLj\n# SIG # End signature block\n"
  },
  {
    "path": "codecov.yml",
    "content": "codecov:\n  require_ci_to_pass: no\n  # main should be the baseline for reporting\n  branch: main\n\ncomment:\n  layout: \"reach, diff, flags, files\"\n  behavior: default\n\ncoverage:\n  range: 50..80\n  round: down\n  precision: 0\n\n  status:\n    project:\n      default:\n        # Set the overall project code coverage requirement to 70%\n        target: 70\n    patch:\n      default:\n        # Set the pull request requirement to not regress overall coverage by more than 5%\n        # and let codecov.io set the goal for the code changed in the patch.\n        target: auto\n        threshold: 5\n\n# This is not needed if the module only contain class-based resources.\nfixes:\n  - '^\\d+\\.\\d+\\.\\d+::source'  # move path \"X.Y.Z\" => \"source\"\n\n# Use this if there are paths that should not be part of the code coverage, for\n# example a deprecated function where tests has been removed.\n#ignore:\n#  - 'source/Public/Get-Deprecated.ps1'\n\n"
  },
  {
    "path": "containers/JessAndBeard.psm1",
    "content": "# TODO remove all the training day code :-)\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '', Justification = 'Because this is just for testing and developing')]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingWriteHost', '', Justification = 'Because this is for the prompt and it is required')]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'containers', Justification = 'Because it is a global variable used later')]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'SQLInstances', Justification = 'Because it is a global variable used later')]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'currentAccountName', Justification = 'Because silly script analyuser cant see it is used')]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'v4code', Justification = 'Because silly script analyuser cant see it is used')]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'v5code', Justification = 'Because silly script analyuser cant see it is used')]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'originalCodeMessage', Justification = 'Because silly script analyuser cant see it is used')]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'cred', Justification = 'Because silly script analyuser cant see it is used')]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidGlobalVars', 'Global:allofTheThings', Justification = 'Dont tell me what to do')]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidGlobalVars', 'Global:Italwaysis', Justification = 'Dont tell me what to do')]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidGlobalVars', 'Global:v4code', Justification = 'Dont tell me what to do')]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidGlobalVars', 'Global:v5code', Justification = 'Dont tell me what to do')]\n[CmdletBinding()]\nparam()\n#region words\n$ShallWePLayAGame = @\"\n\n  _____ _           _ _  __          __    _____  _                           _____                     ___\n / ____| |         | | | \\ \\        / /   |  __ \\| |                 /\\      / ____|                   |__ \\\n| (___ | |__   __ _| | |  \\ \\  /\\  / /__  | |__) | | __ _ _   _     /  \\    | |  __  __ _ _ __ ___   ___  ) |\n \\___ \\| '_ \\ / _` | | |   \\ \\/  \\/ / _ \\ |  ___/| |/ _` | | | |   / /\\ \\   | | |_ |/ _` | '_ ` _ \\ / _ \\/ /\n ____) | | | | (_| | | |    \\  /\\  /  __/ | |    | | (_| | |_| |  / ____ \\  | |__| | (_| | | | | | |  __/_|\n|_____/|_| |_|\\__,_|_|_|     \\/  \\/ \\___| |_|    |_|\\__,_|\\__, | /_/    \\_\\  \\_____|\\__,_|_| |_| |_|\\___(_)\n                                                           __/ |\n                                                          |___/\n\"@\n#ANSI Shadow https://patorjk.com/software/taag/#p=testall&f=Doom&t=Shall%20We%20Play%20A%20Game%3F\n$ShallWePLayAGame = @\"\n\n ███████╗██╗  ██╗ █████╗ ██╗     ██╗         ██╗    ██╗███████╗    ██████╗ ██╗      █████╗ ██╗   ██╗     █████╗      ██████╗  █████╗ ███╗   ███╗███████╗██████╗\n ██╔════╝██║  ██║██╔══██╗██║     ██║         ██║    ██║██╔════╝    ██╔══██╗██║     ██╔══██╗╚██╗ ██╔╝    ██╔══██╗    ██╔════╝ ██╔══██╗████╗ ████║██╔════╝╚════██╗\n ███████╗███████║███████║██║     ██║         ██║ █╗ ██║█████╗      ██████╔╝██║     ███████║ ╚████╔╝     ███████║    ██║  ███╗███████║██╔████╔██║█████╗    ▄███╔╝\n ╚════██║██╔══██║██╔══██║██║     ██║         ██║███╗██║██╔══╝      ██╔═══╝ ██║     ██╔══██║  ╚██╔╝      ██╔══██║    ██║   ██║██╔══██║██║╚██╔╝██║██╔══╝    ▀▀══╝\n ███████║██║  ██║██║  ██║███████╗███████╗    ╚███╔███╔╝███████╗    ██║     ███████╗██║  ██║   ██║       ██║  ██║    ╚██████╔╝██║  ██║██║ ╚═╝ ██║███████╗  ██╗\n ╚══════╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚══════╝     ╚══╝╚══╝ ╚══════╝    ╚═╝     ╚══════╝╚═╝  ╚═╝   ╚═╝       ╚═╝  ╚═╝     ╚═════╝ ╚═╝  ╚═╝╚═╝     ╚═╝╚══════╝  ╚═╝\n\n\n\"@\n\n$OhNo1 = @\"\n ██████  ██░ ██  ▄▄▄       ██▓     ██▓        █     █░▓█████     ██▓███   ██▓    ▄▄▄     ▓██   ██▓    ▄▄▄           ▄████  ▄▄▄       ███▄ ▄███▓▓█████\n▒██    ▒ ▓██░ ██▒▒████▄    ▓██▒    ▓██▒       ▓█░ █ ░█░▓█   ▀    ▓██░  ██▒▓██▒   ▒████▄    ▒██  ██▒   ▒████▄        ██▒ ▀█▒▒████▄    ▓██▒▀█▀ ██▒▓█   ▀\n░ ▓██▄   ▒██▀▀██░▒██  ▀█▄  ▒██░    ▒██░       ▒█░ █ ░█ ▒███      ▓██░ ██▓▒▒██░   ▒██  ▀█▄   ▒██ ██░   ▒██  ▀█▄     ▒██░▄▄▄░▒██  ▀█▄  ▓██    ▓██░▒███\n  ▒   ██▒░▓█ ░██ ░██▄▄▄▄██ ▒██░    ▒██░       ░█░ █ ░█ ▒▓█  ▄    ▒██▄█▓▒ ▒▒██░   ░██▄▄▄▄██  ░ ▐██▓░   ░██▄▄▄▄██    ░▓█  ██▓░██▄▄▄▄██ ▒██    ▒██ ▒▓█  ▄\n▒██████▒▒░▓█▒░██▓ ▓█   ▓██▒░██████▒░██████▒   ░░██▒██▓ ░▒████▒   ▒██▒ ░  ░░██████▒▓█   ▓██▒ ░ ██▒▓░    ▓█   ▓██▒   ░▒▓███▀▒ ▓█   ▓██▒▒██▒   ░██▒░▒████▒\n▒ ▒▓▒ ▒ ░ ▒ ░░▒░▒ ▒▒   ▓▒█░░ ▒░▓  ░░ ▒░▓  ░   ░ ▓░▒ ▒  ░░ ▒░ ░   ▒▓▒░ ░  ░░ ▒░▓  ░▒▒   ▓▒█░  ██▒▒▒     ▒▒   ▓▒█░    ░▒   ▒  ▒▒   ▓▒█░░ ▒░   ░  ░░░ ▒░ ░\n░ ░▒  ░ ░ ▒ ░▒░ ░  ▒   ▒▒ ░░ ░ ▒  ░░ ░ ▒  ░     ▒ ░ ░   ░ ░  ░   ░▒ ░     ░ ░ ▒  ░ ▒   ▒▒ ░▓██ ░▒░      ▒   ▒▒ ░     ░   ░   ▒   ▒▒ ░░  ░      ░ ░ ░  ░\n░  ░  ░   ░  ░░ ░  ░   ▒     ░ ░     ░ ░        ░   ░     ░      ░░         ░ ░    ░   ▒   ▒ ▒ ░░       ░   ▒      ░ ░   ░   ░   ▒   ░      ░      ░\n      ░   ░  ░  ░      ░  ░    ░  ░    ░  ░       ░       ░  ░                ░  ░     ░  ░░ ░              ░  ░         ░       ░  ░       ░      ░  ░\n                                                                                           ░ ░\n\"@\n\n$OhNo2 = @\"\n\n▄████  ▒█████   ▒█████  ▓█████▄     ▄▄▄▄ ▓██   ██▓▓█████\n██▒ ▀█▒▒██▒  ██▒▒██▒  ██▒▒██▀ ██▌   ▓█████▄▒██  ██▒▓█   ▀\n▒██░▄▄▄░▒██░  ██▒▒██░  ██▒░██   █▌   ▒██▒ ▄██▒██ ██░▒███\n░▓█  ██▓▒██   ██░▒██   ██░░▓█▄   ▌   ▒██░█▀  ░ ▐██▓░▒▓█  ▄\n░▒▓███▀▒░ ████▓▒░░ ████▓▒░░▒████▓    ░▓█  ▀█▓░ ██▒▓░░▒████▒\n░▒   ▒ ░ ▒░▒░▒░ ░ ▒░▒░▒░  ▒▒▓  ▒    ░▒▓███▀▒ ██▒▒▒ ░░ ▒░ ░\n ░   ░   ░ ▒ ▒░   ░ ▒ ▒░  ░ ▒  ▒    ▒░▒   ░▓██ ░▒░  ░ ░  ░\n░ ░   ░ ░ ░ ░ ▒  ░ ░ ░ ▒   ░ ░  ░     ░    ░▒ ▒ ░░     ░\n     ░     ░ ░      ░ ░     ░        ░     ░ ░        ░  ░\n                          ░               ░░ ░\n▄▄▄█████▓ ██░ ██ ▓█████    ▓█████  ███▄    █ ▓█████▄\n▓  ██▒ ▓▒▓██░ ██▒▓█   ▀    ▓█   ▀  ██ ▀█   █ ▒██▀ ██▌\n▒ ▓██░ ▒░▒██▀▀██░▒███      ▒███   ▓██  ▀█ ██▒░██   █▌\n░ ▓██▓ ░ ░▓█ ░██ ▒▓█  ▄    ▒▓█  ▄ ▓██▒  ▐▌██▒░▓█▄   ▌\n ▒██▒ ░ ░▓█▒░██▓░▒████▒   ░▒████▒▒██░   ▓██░░▒████▓\n ▒ ░░    ▒ ░░▒░▒░░ ▒░ ░   ░░ ▒░ ░░ ▒░   ▒ ▒  ▒▒▓  ▒\n   ░     ▒ ░▒░ ░ ░ ░  ░    ░ ░  ░░ ░░   ░ ▒░ ░ ▒  ▒\n ░       ░  ░░ ░   ░         ░      ░   ░ ░  ░ ░  ░\n         ░  ░  ░   ░  ░      ░  ░         ░    ░\n                                             ░\n\n\"@\n$ChooseYourgame = @\"\n\n ██████ ██   ██  ██████   ██████  ███████ ███████     ██    ██  ██████  ██    ██ ██████       ██████   █████  ███    ███ ███████\n██      ██   ██ ██    ██ ██    ██ ██      ██           ██  ██  ██    ██ ██    ██ ██   ██     ██       ██   ██ ████  ████ ██          ██\n██      ███████ ██    ██ ██    ██ ███████ █████         ████   ██    ██ ██    ██ ██████      ██   ███ ███████ ██ ████ ██ █████          █████\n██      ██   ██ ██    ██ ██    ██      ██ ██             ██    ██    ██ ██    ██ ██   ██     ██    ██ ██   ██ ██  ██  ██ ██          ██\n ██████ ██   ██  ██████   ██████  ███████ ███████        ██     ██████   ██████  ██   ██      ██████  ██   ██ ██      ██ ███████\n\"@\n$wrongChoice = @\"\n\n █     █░ ██▀███   ▒█████   ███▄    █   ▄████\n▓█░ █ ░█░▓██ ▒ ██▒▒██▒  ██▒ ██ ▀█   █  ██▒ ▀█▒\n▒█░ █ ░█ ▓██ ░▄█ ▒▒██░  ██▒▓██  ▀█ ██▒▒██░▄▄▄░\n░█░ █ ░█ ▒██▀▀█▄  ▒██   ██░▓██▒  ▐▌██▒░▓█  ██▓\n░░██▒██▓ ░██▓ ▒██▒░ ████▓▒░▒██░   ▓██░░▒▓███▀▒\n░ ▓░▒ ▒  ░ ▒▓ ░▒▓░░ ▒░▒░▒░ ░ ▒░   ▒ ▒  ░▒   ▒\n  ▒ ░ ░    ░▒ ░ ▒░  ░ ▒ ▒░ ░ ░░   ░ ▒░  ░   ░\n  ░   ░    ░░   ░ ░ ░ ░ ▒     ░   ░ ░ ░ ░   ░\n    ░       ░         ░ ░           ░       ░\n\n ▄████▄   ██░ ██  ▒█████   ██▓ ▄████▄  ▓█████\n▒██▀ ▀█  ▓██░ ██▒▒██▒  ██▒▓██▒▒██▀ ▀█  ▓█   ▀\n▒▓█    ▄ ▒██▀▀██░▒██░  ██▒▒██▒▒▓█    ▄ ▒███\n▒▓▓▄ ▄██▒░▓█ ░██ ▒██   ██░░██░▒▓▓▄ ▄██▒▒▓█  ▄\n▒ ▓███▀ ░░▓█▒░██▓░ ████▓▒░░██░▒ ▓███▀ ░░▒████▒\n░ ░▒ ▒  ░ ▒ ░░▒░▒░ ▒░▒░▒░ ░▓  ░ ░▒ ▒  ░░░ ▒░ ░\n  ░  ▒    ▒ ░▒░ ░  ░ ▒ ▒░  ▒ ░  ░  ▒    ░ ░  ░\n░         ░  ░░ ░░ ░ ░ ▒   ▒ ░░           ░\n░ ░       ░  ░  ░    ░ ░   ░  ░ ░         ░  ░\n░                             ░\n\"@\n$Global:allofTheThings = @\"\n ▄▄▄       ██▓     ██▓        ▒█████    █████▒   ▄▄▄█████▓ ██░ ██ ▓█████\n▒████▄    ▓██▒    ▓██▒       ▒██▒  ██▒▓██   ▒    ▓  ██▒ ▓▒▓██░ ██▒▓█   ▀\n▒██  ▀█▄  ▒██░    ▒██░       ▒██░  ██▒▒████ ░    ▒ ▓██░ ▒░▒██▀▀██░▒███\n░██▄▄▄▄██ ▒██░    ▒██░       ▒██   ██░░▓█▒  ░    ░ ▓██▓ ░ ░▓█ ░██ ▒▓█  ▄\n ▓█   ▓██▒░██████▒░██████▒   ░ ████▓▒░░▒█░         ▒██▒ ░ ░▓█▒░██▓░▒████▒\n ▒▒   ▓▒█░░ ▒░▓  ░░ ▒░▓  ░   ░ ▒░▒░▒░  ▒ ░         ▒ ░░    ▒ ░░▒░▒░░ ▒░ ░\n  ▒   ▒▒ ░░ ░ ▒  ░░ ░ ▒  ░     ░ ▒ ▒░  ░             ░     ▒ ░▒░ ░ ░ ░  ░\n  ░   ▒     ░ ░     ░ ░      ░ ░ ░ ▒   ░ ░         ░       ░  ░░ ░   ░\n      ░  ░    ░  ░    ░  ░       ░ ░                       ░  ░  ░   ░  ░\n\n            ▄▄▄█████▓ ██░ ██  ██▓ ███▄    █   ▄████   ██████\n            ▓  ██▒ ▓▒▓██░ ██▒▓██▒ ██ ▀█   █  ██▒ ▀█▒▒██    ▒\n            ▒ ▓██░ ▒░▒██▀▀██░▒██▒▓██  ▀█ ██▒▒██░▄▄▄░░ ▓██▄\n            ░ ▓██▓ ░ ░▓█ ░██ ░██░▓██▒  ▐▌██▒░▓█  ██▓  ▒   ██▒\n              ▒██▒ ░ ░▓█▒░██▓░██░▒██░   ▓██░░▒▓███▀▒▒██████▒▒\n              ▒ ░░    ▒ ░░▒░▒░▓  ░ ▒░   ▒ ▒  ░▒   ▒ ▒ ▒▓▒ ▒ ░\n                ░     ▒ ░▒░ ░ ▒ ░░ ░░   ░ ▒░  ░   ░ ░ ░▒  ░ ░\n              ░       ░  ░░ ░ ▒ ░   ░   ░ ░ ░ ░   ░ ░  ░  ░\n                      ░  ░  ░ ░           ░       ░       ░\n\n\"@\n\n$Global:Italwaysis = @\"\n\n██▓▄▄▄█████▓  ██████     ▄▄▄       ██▓     █     █░ ▄▄▄     ▓██   ██▓  ██████\n▓██▒▓  ██▒ ▓▒▒██    ▒    ▒████▄    ▓██▒    ▓█░ █ ░█░▒████▄    ▒██  ██▒▒██    ▒\n▒██▒▒ ▓██░ ▒░░ ▓██▄      ▒██  ▀█▄  ▒██░    ▒█░ █ ░█ ▒██  ▀█▄   ▒██ ██░░ ▓██▄\n░██░░ ▓██▓ ░   ▒   ██▒   ░██▄▄▄▄██ ▒██░    ░█░ █ ░█ ░██▄▄▄▄██  ░ ▐██▓░  ▒   ██▒\n░██░  ▒██▒ ░ ▒██████▒▒    ▓█   ▓██▒░██████▒░░██▒██▓  ▓█   ▓██▒ ░ ██▒▓░▒██████▒▒\n░▓    ▒ ░░   ▒ ▒▓▒ ▒ ░    ▒▒   ▓▒█░░ ▒░▓  ░░ ▓░▒ ▒   ▒▒   ▓▒█░  ██▒▒▒ ▒ ▒▓▒ ▒ ░\n ▒ ░    ░    ░ ░▒  ░ ░     ▒   ▒▒ ░░ ░ ▒  ░  ▒ ░ ░    ▒   ▒▒ ░▓██ ░▒░ ░ ░▒  ░ ░\n ▒ ░  ░      ░  ░  ░       ░   ▒     ░ ░     ░   ░    ░   ▒   ▒ ▒ ░░  ░  ░  ░\n ░                 ░           ░  ░    ░  ░    ░          ░  ░░ ░           ░\n                                                              ░ ░\n▄▄▄█████▓ ██░ ██  ██▀███  ▓█████ ▓█████     ▄▄▄       ███▄ ▄███▓\n▓  ██▒ ▓▒▓██░ ██▒▓██ ▒ ██▒▓█   ▀ ▓█   ▀    ▒████▄    ▓██▒▀█▀ ██▒\n▒ ▓██░ ▒░▒██▀▀██░▓██ ░▄█ ▒▒███   ▒███      ▒██  ▀█▄  ▓██    ▓██░\n░ ▓██▓ ░ ░▓█ ░██ ▒██▀▀█▄  ▒▓█  ▄ ▒▓█  ▄    ░██▄▄▄▄██ ▒██    ▒██\n  ▒██▒ ░ ░▓█▒░██▓░██▓ ▒██▒░▒████▒░▒████▒    ▓█   ▓██▒▒██▒   ░██▒\n  ▒ ░░    ▒ ░░▒░▒░ ▒▓ ░▒▓░░░ ▒░ ░░░ ▒░ ░    ▒▒   ▓▒█░░ ▒░   ░  ░\n    ░     ▒ ░▒░ ░  ░▒ ░ ▒░ ░ ░  ░ ░ ░  ░     ▒   ▒▒ ░░  ░      ░\n  ░       ░  ░░ ░  ░░   ░    ░      ░        ░   ▒   ░      ░\n          ░  ░  ░   ░        ░  ░   ░  ░         ░  ░       ░\n\n\"@\n#endregion\n\n# If we are not using the config files because they take too long even though they are the correct wya to do things\n# we don't need this replace inhere\n# [version]$dbachecksversioninconfig = (Get-DbcConfigValue -Name app.checkrepos).Split('/')[-1].Split('\\')[0]\n# [version]$dbachecksmodulevarsion = (Get-Module dbachecks).Version\n#\n# if ($dbachecksmodulevarsion -ne $dbachecksversioninconfig) {\n#   Get-ChildItem /workspace/Demos/dbachecksconfigs/*.json | ForEach-Object {\n#     (Get-Content -Path $_.FullName) -replace $dbachecksversioninconfig, $dbachecksmodulevarsion | Set-Content $_.FullName\n#   }\n# }\nfunction Start-Game {\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Justification = 'Dont tell me what to do')]\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'Clear-Host', Justification = 'Dont tell me what to do')]\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'cls', Justification = 'Dont tell me what to do')]\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingCmdletAliases', 'cls', Justification = 'Dont tell me what to do')]\n  [CmdletBinding()]\n  param()\n  #region set-up\n  # Because we are using volumes for the restore demo, need to ensure they are clean before starting the game\n  Remove-Item '/var/opt/backups/dbachecks1' -Recurse -Force -ErrorAction SilentlyContinue\n\n  $securePassword = ('dbatools.IO' | ConvertTo-SecureString -AsPlainText -Force)\n  $containercredential = New-Object System.Management.Automation.PSCredential('sqladmin', $securePassword)\n\n  New-DbaDatabase -SqlInstance $dbachecks1 -SqlCredential $containercredential -Name Validation -RecoveryModel Full -WarningAction SilentlyContinue | Out-Null\n\n  # we need an app login\n  $Password = ConvertTo-SecureString PubsAdmin -AsPlainText -Force\n  New-DbaLogin -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Login PubsAdmin -SecurePassword $Password -WarningAction SilentlyContinue | Out-Null\n  New-DbaDbUser -SqlInstance $dbachecks1 -SqlCredential $containercredential -Database Pubs -Login PubsAdmin -Username PubsAdmin -WarningAction SilentlyContinue | Out-Null\n  Add-DbaDbRoleMember -SqlInstance $dbachecks1 -SqlCredential $containercredential -Database Pubs -User PubsAdmin -Role db_owner -Confirm:$false | Out-Null\n\n  # Let's add some things to find\n  Invoke-DbaQuery -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Northwind -WarningAction SilentlyContinue -Query \"\n  CREATE PROCEDURE SP_FindMe AS BEGIN\n    with cte as (\n      select top 1 OrderID, ProductID\n      FROM dbo.[Order Details]\n      ORDER BY NEWID()\n    )\n    DELETE\n    FROM cte\n  END\n\n  GO\n\n  CREATE TRIGGER dbo.trg_chaos_monkey\n    ON  dbo.[order details]\n    INSTEAD OF UPDATE\n  AS\n  BEGIN\n    print 'no update for you'\n  END\n  GO\n  CREATE FUNCTION udf_FindMe\n  (@test int = 1)\n  RETURNS int\n  AS\n  -- For the order details\n  BEGIN\n    RETURN @test\n  END\"\n\n  # Add a failed job\n  $job = New-DbaAgentJob -SqlInstance $dbachecks2 -SqlCredential $containercredential -Job IamBroke -WarningAction SilentlyContinue\n  if ($job) {\n    $null = New-DbaAgentJobStep -SqlInstance $dbachecks2 -SqlCredential $containercredential -Job $job.Name -Subsystem TransactSql -Command 'Select * from MissingTable' -StepName 'Step One'\n    $null = $job | Start-DbaAgentJob\n  }\n\n\n  #endregion\n\n  Clear-Host # dont use cls here\n  $title = \"Joshua Says\"\n  $yes = New-Object System.Management.Automation.Host.ChoiceDescription \"&Yes\", \"Will continue\"\n  $no = New-Object System.Management.Automation.Host.ChoiceDescription \"&No\", \"Will exit\"\n  $options = [System.Management.Automation.Host.ChoiceDescription[]]($yes, $no)\n  $result = $host.ui.PromptForChoice($title, $ShallWePLayAGame, $options, 0)\n\n  if ($result -eq 1) {\n    cls\n    Write-Output $OhNo1\n    Start-Sleep -Seconds 1\n    cls\n    Start-Sleep -Milliseconds 250\n    Write-Output $OhNo2\n  } elseif ($result -eq 0) {\n    Clear-Host # Dont use cls here\n    Get-Index\n  }\n}\n\nfunction Get-Index {\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Justification = 'Dont tell me what to do')]\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'Clear-Host', Justification = 'Dont tell me what to do')]\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'cls', Justification = 'Dont tell me what to do')]\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingCmdletAliases', 'cls', Justification = 'Dont tell me what to do')]\n  [CmdletBinding()]\n  param()\n  cls\n  Write-Output $ChooseYourgame\n  $gameChapters = @(\n    (\"&1 - Introduction to dbatools\", \"1 - Introduction to dbatools\"),\n    (\"&2 - Backup and Restore\", \"2 - Backup and Restore\"),\n    (\"&3 - Copy Copy Copy\", \"3 - Copy Copy Copy\"),\n    (\"&4 - Snapshots\", \"4 - Snapshots\"),\n    (\"&5 - Export\", \"5 - Export\"),\n    (\"&6 - Availability Groups\", \"6 - Availability Groups\"),\n    (\"&7 - Finding Things\", \"7 - Finding Things\"),\n    (\"&8 - Data Masking\", \"8 - Data Masking\"),\n    (\"&9 - Logins\", \"9 - Logins\"),\n    (\"&M - Advanced Migrations\", \"10 - Advanced Migrations\"),\n    (\"&R - Registered Servers\", \"11 - Registered Servers\"),\n    (\"&C - Estate Validation\", \"12 - Estate Validation\"),\n    (\"&T - TIC TAC TOE\", \"98 - TIC TAC TOE\"),\n    (\"&Q - Quit\", \"Quit\")\n  )\n\n  $options = New-Object System.Collections.ObjectModel.Collection[System.Management.Automation.Host.ChoiceDescription]\n\n  foreach ($Chapter in $gameChapters) {\n    $message = '{0}' -f $chapter[1]\n    Write-Output $message\n    $options.Add((New-Object System.Management.Automation.Host.ChoiceDescription $Chapter ) )\n  }\n  $title = \"Joshua Says\"\n  $IndexChoice = $host.ui.PromptForChoice($title, \"Make Your Choice\", $options, 0) + 1\n\n  switch ($IndexChoice) {\n    1 {\n      cls\n      code /workspace/Demos/01-introduction.ps1\n      #reset and run tests\n      Write-PSFHostColor -String \"It was a dark and stormy morning and ripe for learning about dbatools\" -DefaultColor DarkCyan\n      Write-PSFHostColor -String \"The teachers arrived in the class first thing and ran some tests\" -DefaultColor DarkYellow\n      Write-PSFHostColor -String \"They needed to ensure that nothing was wrong before\" -DefaultColor DarkRed\n      Write-PSFHostColor -String \"The Introduction to dbatools\" -DefaultColor DarkMagenta\n      Write-PSFHostColor -String \"Narrator - The Tests are running\" -DefaultColor Blue\n      Assert-Correct -chapter intro\n      Get-GameTimeRemaining\n    }\n    2 {\n      cls\n      code /workspace/Demos/02-BackUpRestore.ps1\n      Write-PSFHostColor -String \"All the students knew that backups and restores were so very important\" -DefaultColor DarkCyan\n      Write-PSFHostColor -String \"To ensure the safety and security of their employees data\" -DefaultColor DarkYellow\n      Write-PSFHostColor -String \"The instructors need to ensure that everything is ok before\" -DefaultColor DarkRed\n      Write-PSFHostColor -String \"2 - Backup and Restore\" -DefaultColor DarkMagenta\n      Write-PSFHostColor -String \"Narrator - The Tests are running\" -DefaultColor Blue\n      Assert-Correct -chapter Backup\n      Get-GameTimeRemaining\n    }\n    3 {\n      cls\n      code /workspace/Demos/03-CopyCopy.ps1\n      Write-PSFHostColor -String \"Entering this chapter carefully\" -DefaultColor DarkCyan\n      Write-PSFHostColor -String \"the players realised that is all looked the same\" -DefaultColor DarkYellow\n      Write-PSFHostColor -String \"It's almost like it has been copied over\" -DefaultColor DarkRed\n      Write-PSFHostColor -String \"3 - Copy Copy Copy\" -DefaultColor DarkMagenta\n      Write-PSFHostColor -String \"Narrator - The Tests are running\" -DefaultColor Blue\n      Assert-Correct -chapter Copy\n      Get-GameTimeRemaining\n    }\n    4 {\n      cls\n      code /workspace/Demos/04-Snapshots.ps1\n      Write-PSFHostColor -String \"The sound of a gun echoed down the corridor\" -DefaultColor DarkCyan\n      Write-PSFHostColor -String \"But as the mist cleared they realised that it was not that sort of shot\" -DefaultColor DarkYellow\n      Write-PSFHostColor -String \"Welcome, said the deep voice, come on in\" -DefaultColor DarkRed\n      Write-PSFHostColor -String \"4 - SnapShots\"  -DefaultColor DarkMagenta\n      Write-PSFHostColor -String \"Narrator - The Tests are running\" -DefaultColor Blue\n      Assert-Correct -chapter SnapShots\n      Get-GameTimeRemaining\n    }\n    6 {\n      cls\n      code /workspace/Demos/06-AvailabilityGroups.ps1\n      Write-PSFHostColor -String \"The noise was getting louder\" -DefaultColor DarkCyan\n      Write-PSFHostColor -String \"This machine can no longer take the strain of the app and the reporting\" -DefaultColor DarkYellow\n      Write-PSFHostColor -String \"I need many copies of this data the voice shouted and quickly now\" -DefaultColor DarkRed\n      Write-PSFHostColor -String \"6 - Availability Groups\"  -DefaultColor DarkMagenta\n      Write-PSFHostColor -String \"Narrator - The Tests are running\" -DefaultColor Blue\n      Assert-Correct -chapter Ags\n      Get-GameTimeRemaining\n    }\n    5 {\n      cls\n      code /workspace/Demos/05-Export.ps1\n      Write-PSFHostColor -String \"As they stomped through the swamp\" -DefaultColor DarkCyan\n      Write-PSFHostColor -String \"They wished the path was easier\" -DefaultColor DarkYellow\n      Write-PSFHostColor -String \"If only someone had written it all down where it could be found..........\" -DefaultColor DarkRed\n      Write-PSFHostColor -String \"5 - Export\"  -DefaultColor DarkMagenta\n      Write-PSFHostColor -String \"Narrator - The Tests are running\" -DefaultColor Blue\n      Assert-Correct -chapter Export\n      Get-GameTimeRemaining\n    }\n    7 {\n      cls\n      code /workspace/Demos/07-FindingThings.ps1\n      Write-PSFHostColor -String \"Lost, said the wispy voices\" -DefaultColor DarkCyan\n      Write-PSFHostColor -String \"and unless you can locate the right things\" -DefaultColor DarkYellow\n      Write-PSFHostColor -String \"~~~~~~~  YOU SHALL BE LOST FOREVER  ~~~~~~~\" -DefaultColor DarkRed\n      Write-PSFHostColor -String \"7 - Finding Things\"  -DefaultColor DarkMagenta\n      Write-PSFHostColor -String \"Narrator - The Tests are running\" -DefaultColor Blue\n\n      Assert-Correct -chapter Found\n      Get-GameTimeRemaining\n    }\n    8 {\n      cls\n      code /workspace/Demos/08-DataMasking.ps1\n      Write-PSFHostColor -String \"They could hear them rushing towards them\" -DefaultColor DarkCyan\n      Write-PSFHostColor -String \"shouting and hollering in a dreadful manner\" -DefaultColor DarkYellow\n      Write-PSFHostColor -String \"But what was on those faces? Are those ....... Masks?\" -DefaultColor DarkRed\n      Write-PSFHostColor -String \"8 - Data Masking\"  -DefaultColor DarkMagenta\n      Write-PSFHostColor -String \"Narrator - The Tests are running\" -DefaultColor Blue\n      Assert-Correct -chapter Masking\n      Get-GameTimeRemaining\n    }\n    9 {\n      cls\n      code /workspace/Demos/09-Logins.ps1\n      Write-PSFHostColor -String \"They saw a house in the distance and picked up speed\" -DefaultColor DarkCyan\n      Write-PSFHostColor -String \"A massive wooden door faced them, they rang the bell\" -DefaultColor DarkYellow\n      Write-PSFHostColor -String \"The monsters were close though ~~~ LET US IN\" -DefaultColor DarkRed\n      Write-PSFHostColor -String \"PLEASE ~~~ LET US IN\" -DefaultColor DarkRed\n      Write-PSFHostColor -String \"9 - Logins\"  -DefaultColor DarkMagenta\n      Write-PSFHostColor -String \"Narrator - The Tests are running\" -DefaultColor Blue\n      Assert-Correct -chapter Logins\n      Get-GameTimeRemaining\n    }\n    #even though you choose M\n    10 {\n      cls\n      Write-Output \"10 - Advanced Migrations\"\n      code /workspace/Demos/10-AdvancedMigrations.ps1\n\n      Write-PSFHostColor -String \"Just running some tests a mo\" -DefaultColor Green\n      Assert-Correct -chapter AdvMigration\n      Get-GameTimeRemaining\n\n      Write-PSFHostColor -String \"we also need an app to run in the background\" -DefaultColor Green\n      Write-PSFHostColor -String \"In a new session run Invoke-PubsApplication\" -DefaultColor Green\n    }\n    #even though you choose R\n    11 {\n      cls\n      Write-Output \"11 - Registered Servers\"\n      code /workspace/Demos/11-RegisteredServers.ps1\n\n      Write-PSFHostColor -String \"Just running some tests a mo\" -DefaultColor Green\n      # Assert-Correct -chapter RegisterdServers\n      Get-GameTimeRemaining\n    }\n    #even though you choose C\n    12 {\n      cls\n      Write-Output \"12 - Estate Validation\"\n      code /workspace/Demos/12-EstateValidation.ps1\n\n      Write-PSFHostColor -String \"Just running some tests a mo\" -DefaultColor Green\n      # Assert-Correct -chapter RegisterdServers\n      Get-GameTimeRemaining\n    }\n    # even though you choose G\n    14 {\n      cls\n      $Message = ' GREETINGS PROFESSOR FALKEN\n\n      HELLO\n\n      A STRANGE GAME.\n      THE ONLY WINNING MOVE IS NOT TO PLAY.\n\n      HOW ABOUT A NICE GAME OF CHESS?\n                                                                       '\n      Write-Host $message -BackgroundColor 03fcf4 -ForegroundColor Black\n    }\n    # even though you choose T\n    13 {\n      Start-TicTacToe\n    }\n    'q' {\n      cls\n    }\n    Default {\n      cls\n      Write-Output $wrongChoice\n      Start-Sleep -Seconds 1\n      cls\n      Start-Sleep -Milliseconds 250\n      Write-Output $OhNo2\n      $message = \"You chose - {0}\" -f $IndexChoice\n      Write-Output $message\n    }\n  }\n}\n\nfunction Set-ConnectionInfo {\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Justification = 'Dont tell me what to do')]\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'Clear-Host', Justification = 'Dont tell me what to do')]\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'cls', Justification = 'Dont tell me what to do')]\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingCmdletAliases', 'cls', Justification = 'Dont tell me what to do')]\n  [CmdletBinding()]\n  param()\n  #region Set up connection\n  $securePassword = ('dbatools.IO' | ConvertTo-SecureString -AsPlainText -Force)\n  $containercredential = New-Object System.Management.Automation.PSCredential('sqladmin', $securePassword)\n\n  #$Global:PSDefaultParameterValues = @{\n  #  \"*dba*:SqlCredential\"            = $containercredential\n  #  \"*dba*:SourceSqlCredential\"      = $containercredential\n  #  \"*dba*:DestinationSqlCredential\" = $containercredential\n  #  \"*dba*:DestinationCredential\"    = $containercredential\n  #  \"*dba*:PrimarySqlCredential\"     = $containercredential\n  #  \"*dba*:SecondarySqlCredential\"   = $containercredential\n  #}\n\n\n  $containers = $SQLInstances = $dbachecks1, $dbachecks2, $dbachecks3 = 'dbachecks1', 'dbachecks2', 'dbachecks3'\n  #endregion\n}\n\nSet-ConnectionInfo\n\nfunction Set-FailedTestMessage {\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Justification = 'Dont tell me what to do')]\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'Clear-Host', Justification = 'Dont tell me what to do')]\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'Out-GridView', Justification = 'Dont tell me what to do')]\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'cls', Justification = 'Dont tell me what to do')]\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingCmdletAliases', 'cls', Justification = 'Dont tell me what to do')]\n  [CmdletBinding()]\n  param()\n  $FailedTests = ($results.FailedCount | Measure-Object -Sum).Sum\n  if ($FailedTests -gt 0) {\n    Write-PSFHostColor -String \"NARRATOR - A thing went wrong\" -DefaultColor DarkMagenta\n    Write-PSFHostColor -String \"NARRATOR - It MUST be fixed before we can continue\" -DefaultColor DarkMagenta\n    $Failures = $results.TestResult | Where-Object Result -EQ 'Failed' | Select-Object Describe, Context, Name, FailureMessage\n    $Failures.ForEach{\n      $Message = '{0} at {1} in {2}' -f $_.FailureMessage, $_.Name, $_.Describe\n      Write-PSFHostColor -String $Message -DefaultColor DarkCyan\n    }\n  }\n}\nfunction Assert-Correct {\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Justification = 'Dont tell me what to do')]\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'Clear-Host', Justification = 'Dont tell me what to do')]\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'cls', Justification = 'Dont tell me what to do')]\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingCmdletAliases', 'cls', Justification = 'Dont tell me what to do')]\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'results', Justification = 'Because it is a global variable used later')]\n\n  [CmdletBinding()]\n  param (\n    # Parameter help description\n    [Parameter()]\n    [ValidateSet(\n      'initial',\n      'Intro' ,\n      'Backup',\n      'Copy',\n      'SnapShots',\n      'Export',\n      'Ags',\n      'Found',\n      'Masking',\n      'Logins',\n      'AdvMigration'\n    )]\n    [string]\n    $chapter = 'initial'\n  )\n  # $Global:PSDefaultParameterValues.CLear()\n  switch ($chapter) {\n    'initial' {\n      # Valid estate is as we expect\n\n      $null = Reset-DbcConfig\n      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $true  # so we dont get silly output from convert-dbcresult\n\n      Set-DbcConfig -Name app.sqlinstance -Value $containers\n      Set-DbcConfig -Name policy.connection.authscheme -Value 'SQL'\n      Set-DbcConfig -Name skip.connection.remoting -Value $true\n      Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection -Verbose\n\n      Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks2'\n      Invoke-DbcCheck -SqlCredential $containercredential -Check DatabaseExists\n\n      Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks1'\n      Set-DbcConfig -Name database.exists -Value 'pubs', 'NorthWind' -Append\n      Invoke-DbcCheck -SqlCredential $containercredential -Check DatabaseExists\n\n      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $false  # reset\n    }\n    'Intro' {\n      # Valid estate is as we expect\n\n      $null = Reset-DbcConfig\n      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $true  # so we dont get silly output from convert-dbcresult\n      $null = Set-DbcConfig -Name app.sqlinstance -Value $containers\n      $null = Set-DbcConfig -Name policy.connection.authscheme -Value 'SQL'\n      $null = Set-DbcConfig -Name skip.connection.remoting -Value $true\n      $check1 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection -Show Summary -PassThru\n      $check1 | Convert-DbcResult -Label Intro -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation\n\n      $null = Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks2'\n      $check2 = Invoke-DbcCheck -SqlCredential $containercredential -Check DatabaseExists -Show Summary -PassThru\n      $check2 | Convert-DbcResult -Label Intro -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation\n\n      $null = Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks1'\n      $null = Set-DbcConfig -Name database.exists -Value 'pubs', 'NorthWind' -Append\n      $check3 = Invoke-DbcCheck -SqlCredential $containercredential -Check DatabaseExists -Show Summary -PassThru\n      $check3 | Convert-DbcResult -Label Intro -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation\n\n      $results = @($check1, $check2, $check3)\n      Set-FailedTestMessage\n\n      Write-PSFHostColor -String \"Are you ready to begin your adventure?\" -DefaultColor Blue\n      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $false  # reset\n    }\n    'Backup' {\n      # Valid estate is as we expect\n\n      $null = Reset-DbcConfig\n      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $true  # so we dont get silly output from convert-dbcresult\n      $null = Set-DbcConfig -Name app.checkrepos -Value '/workspace/Demos/dbachecksconfigs' -Append\n      $null = Set-DbcConfig -Name app.sqlinstance -Value $containers\n      $null = Set-DbcConfig -Name policy.connection.authscheme -Value 'SQL'\n      $null = Set-DbcConfig -Name skip.connection.remoting -Value $true\n      $null = Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks2'\n\n      $check1 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection, DatabaseExists -Show Summary -PassThru\n      $check1 | Convert-DbcResult -Label Backup -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation\n\n      $null = Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks1'\n      $null = Set-DbcConfig -Name database.exists -Value 'master', 'model', 'msdb', 'Northwind', 'pubs', 'tempdb'\n\n      $check2 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection, DatabaseExists, NoDatabasesOn1, NoBackupFiles -Show Summary -PassThru\n      $check2 | Convert-DbcResult -Label Backup -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation\n\n      $results = @($check1, $check2)\n      Set-FailedTestMessage\n      Write-PSFHostColor -String \"Should you create a save point before this chapter?\" -DefaultColor Blue\n      Start-Sleep -Seconds 5\n      Write-PSFHostColor -String \"Or can you make it to the end?\" -DefaultColor DarkRed\n      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $false # reset\n\n    }\n    'Copy' {\n      # Valid estate is as we expect\n\n      $null = Reset-DbcConfig\n      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $true  # so we dont get silly output from convert-dbcresult\n      $null = Set-DbcConfig -Name app.checkrepos -Value '/workspace/Demos/dbachecksconfigs' -Append\n      Set-DbcConfig -Name app.sqlinstance -Value $containers | Out-Null\n      Set-DbcConfig -Name policy.connection.authscheme -Value 'SQL' | Out-Null\n      Set-DbcConfig -Name skip.connection.remoting -Value $true | Out-Null\n      Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks2' | Out-Null\n      Set-DbcConfig -Name database.exists -Value 'master', 'model', 'msdb', 'tempdb' | Out-Null\n\n      $check1 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection, DatabaseExists, NoDatabasesOn2, NeedNoLogins -Show Summary -PassThru\n      $check1 | Convert-DbcResult -Label Copy -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation\n\n      Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks1' | Out-Null\n      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\n      $check2 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection, DatabaseExists -Show Summary -PassThru\n      $check2 | Convert-DbcResult -Label Copy -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation\n\n      $results = @($check1, $check2)\n      Set-FailedTestMessage\n      Write-PSFHostColor -String \"If you get database missing failures - Chapter 2 will be your friend\" -DefaultColor Magenta\n      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $false # reset\n    }\n    'Snapshots' {\n      # Valid estate is as we expect\n      Write-PSFHostColor -String \"Running the SnapShot Chapter checks\" -DefaultColor Green\n      $null = Reset-DbcConfig\n      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $true  # so we dont get silly output from convert-dbcresult\n      Set-DbcConfig -Name app.checkrepos -Value '/workspace/Demos/dbachecksconfigs' -Append | Out-Null\n      Set-DbcConfig -Name app.sqlinstance -Value $containers | Out-Null\n      Set-DbcConfig -Name policy.connection.authscheme -Value 'SQL' | Out-Null\n      Set-DbcConfig -Name skip.connection.remoting -Value $true | Out-Null\n      Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks2' | Out-Null\n      Set-DbcConfig -Name database.exists -Value 'master', 'model', 'msdb', 'tempdb' | Out-Null\n      $check1 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection, DatabaseExists, NoDatabasesOn2, DatabaseStatus, NoSnapshots -Show Summary -PassThru\n      $check1 | Convert-DbcResult -Label SnapShots -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation\n\n      Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks1' | Out-Null\n      Set-DbcConfig -Name database.exists -Value 'master', 'model', 'msdb', 'Northwind', 'pubs', 'tempdb' | Out-Null\n      $check2 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection, DatabaseExists, DatabaseStatus -Show Summary -PassThru\n      $check1 | Convert-DbcResult -Label SnapShots -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation\n      $results = @($check1, $check2)\n      Set-FailedTestMessage\n      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $false # reset\n    }\n    'Export' {\n      # Valid estate is as we expect\n\n      $null = Reset-DbcConfig\n      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $true  # so we dont get silly output from convert-dbcresult\n      $null = Set-DbcConfig -Name app.sqlinstance -Value $containers\n      $null = Set-DbcConfig -Name policy.connection.authscheme -Value 'SQL'\n      $null = Set-DbcConfig -Name skip.connection.remoting -Value $true\n      $check1 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection -Show Summary -PassThru\n      $check1 | Convert-DbcResult -Label Export -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation\n\n      $null = Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks2'\n      $check2 = Invoke-DbcCheck -SqlCredential $containercredential -Check DatabaseExists -Show Summary -PassThru\n      $check2 | Convert-DbcResult -Label Export -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation\n\n      $null = Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks1'\n      $null = Set-DbcConfig -Name database.exists -Value 'pubs', 'NorthWind' -Append\n      $check3 = Invoke-DbcCheck -SqlCredential $containercredential -Check DatabaseExists -Show Summary -PassThru\n      $check3 | Convert-DbcResult -Label Export -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation\n      $results = @($check1, $check2, $check3)\n      Set-FailedTestMessage\n      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $false\n    }\n    'Ags' {\n      # Valid estate is as we expect\n\n      $null = Reset-DbcConfig\n      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $true  # so we dont get silly output from convert-dbcresult\n      $null = Set-DbcConfig -Name app.checkrepos -Value '/workspace/Demos/dbachecksconfigs' -Append | Out-Null\n      $null = Set-DbcConfig -Name app.sqlinstance -Value $containers\n      $null = Set-DbcConfig -Name policy.connection.authscheme -Value 'SQL'\n      $null = Set-DbcConfig -Name skip.connection.remoting -Value $true\n      $check1 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection -Show Summary -PassThru\n      $check1 | Convert-DbcResult -Label AvailabilityGroups -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation\n\n      Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks2' | Out-Null\n      Set-DbcConfig -Name database.exists -Value 'master', 'model', 'msdb', 'tempdb' | Out-Null\n      $check2 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection, DatabaseExists, NoDatabasesOn2, DatabaseStatus, NoSnapshots, NoAgs -Show Summary -PassThru\n      $check2 | Convert-DbcResult -Label AvailabilityGroups -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation\n\n      Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks1' | Out-Null\n      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\n      $check3 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection, DatabaseExists, DatabaseStatus -Show Summary -PassThru\n      $check3 | Convert-DbcResult -Label AvailabilityGroups -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation\n      $results = @($check1, $check2, $check3)\n      Set-FailedTestMessage\n      Write-PSFHostColor -String \"If you get database missing failures - Chapter 2 will be your friend\" -DefaultColor Magenta\n      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $false\n    }\n    'AdvMigration' {\n      # Valid estate is as we expect\n\n      $null = Reset-DbcConfig\n      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $true  # so we dont get silly output from convert-dbcresult\n      Set-DbcConfig -Name app.checkrepos -Value '/workspace/Demos/dbachecksconfigs' -Append | Out-Null\n      $null = Set-DbcConfig -Name app.sqlinstance -Value $containers\n      $null = Set-DbcConfig -Name policy.connection.authscheme -Value 'SQL'\n      $null = Set-DbcConfig -Name skip.connection.remoting -Value $true\n      $check1 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection -Show Summary -PassThru\n      $check1 | Convert-DbcResult -Label AdvancedMigration -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation\n\n      Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks2' | Out-Null\n      Set-DbcConfig -Name database.exists -Value 'master', 'model', 'msdb', 'tempdb' | Out-Null\n      $check2 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection, DatabaseExists, NoDatabasesOn2, DatabaseStatus, NoSnapshots, NoAgs -Show Summary -PassThru\n      $check2 | Convert-DbcResult -Label AdvancedMigration -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation\n\n      Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks1' | Out-Null\n      Set-DbcConfig -Name database.exists -Value 'master', 'model', 'msdb', 'Northwind', 'pubs', 'tempdb' | Out-Null\n      $check3 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection, DatabaseExists, DatabaseStatus -Show Summary -PassThru\n      $check3 | Convert-DbcResult -Label AdvancedMigration -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation\n\n      $results = @($check1, $check2, $check3)\n      Set-FailedTestMessage\n      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $false\n    }\n    'Found' {\n      # Valid estate is as we expect\n\n      $null = Reset-DbcConfig\n      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $true  # so we dont get silly output from convert-dbcresult\n      Set-DbcConfig -Name app.checkrepos -Value '/workspace/Demos/dbachecksconfigs' -Append | Out-Null\n      $null = Set-DbcConfig -Name app.sqlinstance -Value $containers\n      $null = Set-DbcConfig -Name policy.connection.authscheme -Value 'SQL'\n      $null = Set-DbcConfig -Name skip.connection.remoting -Value $true\n      $check1 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection -Show Summary -PassThru\n      $check1 | Convert-DbcResult -Label Found -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation\n\n      Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks2' | Out-Null\n      Set-DbcConfig -Name database.exists -Value 'master', 'model', 'msdb', 'tempdb' | Out-Null\n      $check2 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection, DatabaseExists, NeedJobs, NeedFailedJobs  -Show Summary -PassThru\n      $check2 | Convert-DbcResult -Label Found -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation\n\n      Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks1' | Out-Null\n      Set-DbcConfig -Name database.exists -Value 'master', 'model', 'msdb', 'Northwind', 'pubs', 'tempdb' | Out-Null\n      $check3 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection, DatabaseExists, DatabaseStatus, NeedSps, NeedUDfs, NeedTriggers, NeedLogins -Show Summary -PassThru\n      $check3 | Convert-DbcResult -Label Found -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation\n\n      $results = @($check1, $check2, $check3)\n      Set-FailedTestMessage\n      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $false\n    }\n    'Masking' {\n      # Valid estate is as we expect\n\n      $null = Reset-DbcConfig\n      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $true  # so we dont get silly output from convert-dbcresult\n      Set-DbcConfig -Name app.checkrepos -Value '/workspace/Demos/dbachecksconfigs' -Append | Out-Null\n      $null = Set-DbcConfig -Name app.sqlinstance -Value $containers\n      $null = Set-DbcConfig -Name policy.connection.authscheme -Value 'SQL'\n      $null = Set-DbcConfig -Name skip.connection.remoting -Value $true\n      $check1 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection -Show Summary -PassThru\n      $check1 | Convert-DbcResult -Label Masking -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation\n\n      Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks2' | Out-Null\n      Set-DbcConfig -Name database.exists -Value 'master', 'model', 'msdb', 'tempdb' | Out-Null\n      $check2 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection, DatabaseExists -Show Summary -PassThru\n      $check2 | Convert-DbcResult -Label Masking -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation\n\n      Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks1' | Out-Null\n      Set-DbcConfig -Name database.exists -Value 'master', 'model', 'msdb', 'Northwind', 'pubs', 'tempdb' | Out-Null\n      $check3 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection, DatabaseExists, DatabaseStatus -Show Summary -PassThru\n      $check3 | Convert-DbcResult -Label Masking -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation\n\n      $results = @($check1, $check2, $check3)\n      Set-FailedTestMessage\n      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $false\n    }\n    'Logins' {\n      # Valid estate is as we expect\n\n      $null = Reset-DbcConfig\n      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $true  # so we dont get silly output from convert-dbcresult\n      Set-DbcConfig -Name app.checkrepos -Value '/workspace/Demos/dbachecksconfigs' -Append | Out-Null\n      $null = Set-DbcConfig -Name app.sqlinstance -Value $containers\n      $null = Set-DbcConfig -Name policy.connection.authscheme -Value 'SQL'\n      $null = Set-DbcConfig -Name skip.connection.remoting -Value $true\n      $check1 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection -Show Summary -PassThru\n      $check1 | Convert-DbcResult -Label Logins -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation\n\n      Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks2' | Out-Null\n      Set-DbcConfig -Name database.exists -Value 'master', 'model', 'msdb', 'tempdb' | Out-Null\n      $check2 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection, DatabaseExists -Show Summary -PassThru\n      $check2 | Convert-DbcResult -Label Logins -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation\n\n      Set-DbcConfig -Name app.sqlinstance -Value 'dbachecks1' | Out-Null\n      Set-DbcConfig -Name database.exists -Value 'master', 'model', 'msdb', 'Northwind', 'pubs', 'tempdb' | Out-Null\n      $check3 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection, DatabaseExists, DatabaseStatus -Show Summary -PassThru\n      $check3 | Convert-DbcResult -Label Logins -warningaction SilentlyContinue | Write-DbcTable -SqlInstance $dbachecks1 -SqlCredential $containercredential  -Database Validation\n\n      $results = @($check1, $check2, $check3)\n      Set-FailedTestMessage\n      $null = Set-PSFConfig -FullName PSFramework.Message.ConsoleOutput.Disable -Value $false\n    }\n    Default {\n      # Valid estate is as we expect\n\n      $null = Reset-DbcConfig\n\n      $null = Import-DbcConfig /workspace/Demos/dbachecksconfigs/initial-config.json\n      $check3 = Invoke-DbcCheck -SqlCredential $containercredential -Check InstanceConnection  -Show Summary -PassThru\n\n      $null = Reset-DbcConfig\n\n      $null = Import-DbcConfig /workspace/Demos/dbachecksconfigs/initial-dbachecks1-config.json\n      $check2 = Invoke-DbcCheck -SqlCredential $containercredential -Check DatabaseExists -Show Summary -PassThru\n\n      $null = Reset-DbcConfig\n\n      $null = Import-DbcConfig /workspace/Demos/dbachecksconfigs/initial-dbachecks2-config.json\n      $check1 = Invoke-DbcCheck -SqlCredential $containercredential -Check DatabaseExists -Show Summary -PassThru\n      $results = @($check1, $check2, $check3)\n      Set-FailedTestMessage\n    }\n  }\n  #$Global:PSDefaultParameterValues = @{\n  #  \"*dba*:SqlCredential\"            = $containercredential\n  #  \"*dba*:SourceSqlCredential\"      = $containercredential\n  #  \"*dba*:DestinationSqlCredential\" = $containercredential\n  #  \"*dba*:DestinationCredential\"    = $containercredential\n  #  \"*dba*:PrimarySqlCredential\"     = $containercredential\n  #  \"*dba*:SecondarySqlCredential\"   = $containercredential\n  #}\n}\n\nFunction Compare-SPConfig {\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Justification = 'Dont tell me what to do')]\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'Clear-Host', Justification = 'Dont tell me what to do')]\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'Out-GridView', Justification = 'Dont tell me what to do')]\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'cls', Justification = 'Dont tell me what to do')]\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingCmdletAliases', 'cls', Justification = 'Dont tell me what to do')]\n  [CmdletBinding()]\n  Param(\n    $Source,\n    $Destination\n  )\n  $SourceSpConfigure = Get-DbaSpConfigure  -SqlInstance $Source -SqlCredential $containercredential\n  $DestSPConfigure = Get-DbaSpConfigure -SqlInstance $Destination -SqlCredential  $containercredential\n\n  $propcompare = foreach ($prop in $SourceSpConfigure) {\n    [pscustomobject]@{\n      Config                = $prop.DisplayName\n      'Source setting'      = $prop.RunningValue\n      'Destination Setting' = $DestSPConfigure | Where-Object DisplayName -EQ $prop.DisplayName | Select-Object -ExpandProperty RunningValue\n    }\n  }\n\n  if ($IsCoreCLR) {\n    $propcompare | Out-ConsoleGridView -Title \"Comparing Sp_configure Settings Source - $Source With Destination $Destination\"\n  } else {\n    $propcompare | Out-GridView -Title \"Comparing Sp_configure Settings Source - $SourceWith Destination $Destination\"\n\n  }\n\n\n}\n\nfunction Invoke-PubsApplication {\n  # This will randomly insert rows into the pubs.dbo.sales table on dbachecks1 to simulate sales activity\n  # It'll run until you kill it\n\n\n  # app connection\n  $securePassword = ('PubsAdmin' | ConvertTo-SecureString -AsPlainText -Force)\n  $appCred = New-Object System.Management.Automation.PSCredential('PubsAdmin', $securePassword)\n  $appConnection = Connect-DbaInstance -SqlInstance $dbachecks1 -SqlCredential $appCred -ClientName 'PubsApplication'\n\n  while ($true) {\n    Write-PSFHostColor -String \"Pubs application is running...forever... Ctrl+C to get out of here\" -DefaultColor Green\n\n    $newOrder = [PSCustomObject]@{\n      stor_id  = Get-Random (Invoke-DbaQuery -SqlInstance $appConnection -Database pubs -Query 'select stor_id from stores').stor_id\n      ord_num  = Get-DbaRandomizedValue -DataType int -Min 1000 -Max 99999\n      ord_date = Get-Date\n      qty      = Get-Random -Minimum 1 -Maximum 30\n      payterms = Get-Random (Invoke-DbaQuery -SqlInstance $appConnection -Database pubs -Query 'select distinct payterms from pubs.dbo.sales').payterms\n      title_id = Get-Random (Invoke-DbaQuery -SqlInstance $appConnection -Database pubs -Query 'select title_id from titles').title_id\n    }\n    Write-DbaDataTable -SqlInstance $appConnection -Database pubs -InputObject $newOrder -Table sales\n\n    Start-Sleep -Seconds (Get-Random -Maximum 10)\n  }\n}\n\nfunction Get-GameTimeRemaining {\n  $StartDate = Get-Date -Hour 9 -Minute 00 -Second 0\n  $Date = Get-Date\n  $Diff = $Date - $StartDate\n\n  $MorningBreak = Get-Date -Hour 10 -Minute 30 -Second 0\n  $Lunch = Get-Date -Hour 12 -Minute 30 -Second 0\n  $AfternoonBreak = Get-Date -Hour 15 -Minute 00 -Second 0\n  $TheEnd = Get-Date -Hour 17 -Minute 00 -Second 0\n\n  switch ($Date) {\n    { $Date -lt $TheEnd } {\n      $Remaining = $TheEnd - $Date\n      $Reason = 'THE END'\n    }\n    { $Date -lt $AfternoonBreak } {\n      $Remaining = $AfternoonBreak - $Date\n      $Reason = 'AFTERNOON BREAK'\n    }\n    { $Date -lt $Lunch } {\n      $Remaining = $Lunch - $Date\n      $Reason = 'LUNCH BREAK'\n    }\n    { $Date -lt $MorningBreak } {\n      $Remaining = $MorningBreak - $Date\n      $Reason = 'MORNING BREAK'\n    }\n    Default {}\n  }\n  $message = '\n_______________________   _______________________\n| GAME TIME ELAPSED    |  | GAME TIME REMAINING  |\n|        {0}  HRS        |  |       {3} HRS          |\n|  {1} MINS  {2} SECS    |  |  {4} MINS  {5} SECS    |\n|                      |  | UNTIL {6}\n|______________________|  |______________________|\n\n' -f $Diff.Hours , (\"{0:D2}\" -f $diff.Minutes) , (\"{0:D2}\" -f $diff.Seconds), $Remaining.Hours , (\"{0:D2}\" -f $Remaining.Minutes) , (\"{0:D2}\" -f $Remaining.Seconds), $Reason\n\n  Write-Host $message -BackgroundColor 03fcf4 -ForegroundColor Black\n\n}\n\nFunction TicTacToe {\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Justification = 'Dont tell me what to do')]\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'Clear-Host', Justification = 'Dont tell me what to do')]\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'Out-GridView', Justification = 'Dont tell me what to do')]\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'cls', Justification = 'Dont tell me what to do')]\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingCmdletAliases', 'cls', Justification = 'Dont tell me what to do')]\n  [CmdletBinding()]\n  Param(\n    $Sleep\n  )\n  $message = '\n         |         |\n         |         |\n         |         |\n         |         |\n         |         |\n------------------------------\n         |         |\n         |         |\n         |         |\n         |         |\n         |         |\n------------------------------\n         |         |\n         |         |\n         |         |\n         |         |\n         |         |\n'\n  Clear-Host\n  Write-Host $message\n\n  Start-Sleep -Milliseconds $Sleep\n  $message = '\n         |         |\n         |         |\n         |         |\n         |         |\n         |         |\n------------------------------\n         |         |\n         |  X   X  |\n         |    X    |\n         |  X   X  |\n         |         |\n------------------------------\n         |         |\n         |         |\n         |         |\n         |         |\n         |         |\n'\n  Clear-Host\n  Write-Host $message\n\n  Start-Sleep -Milliseconds $Sleep\n  $message = '\n         |         |\n    O    |         |\n  O   O  |         |\n    O    |         |\n         |         |\n------------------------------\n         |         |\n         |  X   X  |\n         |    X    |\n         |  X   X  |\n         |         |\n------------------------------\n         |         |\n         |         |\n         |         |\n         |         |\n         |         |\n'\n  Clear-Host\n  Write-Host $message\n\n  Start-Sleep -Milliseconds $Sleep\n  $message = '\n         |         |\n    O    |         |\n  O   O  |         |\n    O    |         |\n         |         |\n------------------------------\n         |         |\n         |  X   X  |\n         |    X    |\n         |  X   X  |\n         |         |\n------------------------------\n         |         |\n         |  X   X  |\n         |    X    |\n         |  X   X  |\n         |         |\n'\n  Clear-Host\n  Write-Host $message\n\n  Start-Sleep -Milliseconds $Sleep\n  $message = '\n         |         |\n    O    |    O    |\n  O   O  |  O   O  |\n    O    |    O    |\n         |         |\n------------------------------\n         |         |\n         |  X   X  |\n         |    X    |\n         |  X   X  |\n         |         |\n------------------------------\n         |         |\n         |  X   X  |\n         |    X    |\n         |  X   X  |\n         |         |\n'\n  Clear-Host\n  Write-Host $message\n\n  Start-Sleep -Milliseconds $Sleep\n\n  $message = '\n         |         |\n    O    |    O    |  X   X\n  O   O  |  O   O  |    X\n    O    |    O    |  X   X\n         |         |\n------------------------------\n         |         |\n         |  X   X  |\n         |    X    |\n         |  X   X  |\n         |         |\n------------------------------\n         |         |\n         |  X   X  |\n         |    X    |\n         |  X   X  |\n         |         |\n'\n  Clear-Host\n  Write-Host $message\n\n  Start-Sleep -Milliseconds $Sleep\n  $message = '\n         |         |\n    O    |    O    |  X   X\n  O   O  |  O   O  |    X\n    O    |    O    |  X   X\n         |         |\n------------------------------\n         |         |\n         |  X   X  |\n         |    X    |\n         |  X   X  |\n         |         |\n------------------------------\n         |         |\n    O    |  X   X  |\n  O   O  |    X    |\n    O    |  X   X  |\n         |         |\n'\n  Clear-Host\n  Write-Host $message\n\n  Start-Sleep -Milliseconds $Sleep\n  $message = '\n         |         |\n    O    |    O    |  X   X\n  O   O  |  O   O  |    X\n    O    |    O    |  X   X\n         |         |\n------------------------------\n         |         |\n  X   X  |  X   X  |\n    X    |    X    |\n  X   X  |  X   X  |\n         |         |\n------------------------------\n         |         |\n    O    |  X   X  |\n  O   O  |    X    |\n    O    |  X   X  |\n         |         |\n'\n  Clear-Host\n  Write-Host $message\n\n  Start-Sleep -Milliseconds $Sleep\n  $message = '\n         |         |\n    O    |    O    |  X   X\n  O   O  |  O   O  |    X\n    O    |    O    |  X   X\n         |         |\n------------------------------\n         |         |\n  X   X  |  X   X  |    O\n    X    |    X    |  O   O\n  X   X  |  X   X  |    O\n         |         |\n------------------------------\n         |         |\n    O    |  X   X  |\n  O   O  |    X    |\n    O    |  X   X  |\n         |         |\n'\n  Clear-Host\n  Write-Host $message\n\n  Start-Sleep -Milliseconds $Sleep\n  $message = '\n         |         |\n    O    |    O    |  X   X\n  O   O  |  O   O  |    X\n    O    |    O    |  X   X\n         |         |\n------------------------------\n         |         |\n  X   X  |  X   X  |    O\n    X    |    X    |  O   O\n  X   X  |  X   X  |    O\n         |         |\n------------------------------\n         |         |\n    O    |  X   X  |  X   X\n  O   O  |    X    |    X\n    O    |  X   X  |  X   X\n         |         |\n'\n  Clear-Host\n  Write-Host $message\n\n\n  Start-Sleep -Milliseconds $Sleep\n}\n\nfunction Start-TicTacToe {\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Justification = 'Dont tell me what to do')]\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'Clear-Host', Justification = 'Dont tell me what to do')]\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'Out-GridView', Justification = 'Dont tell me what to do')]\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'cls', Justification = 'Dont tell me what to do')]\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingCmdletAliases', 'cls', Justification = 'Dont tell me what to do')]\n  [CmdletBinding()]\n  param()\n  $Options = 500, 200, 200, 100, 100, 100, 50, 50, 50, 50, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10\n  $Options | ForEach-Object {\n    TicTacToe -Sleep $_\n  }\n  Clear-Host\n  $Message = ' GREETINGS PROFESSOR FALKEN\n\n  HELLO\n\n  A STRANGE GAME.\n  THE ONLY WINNING MOVE IS NOT TO PLAY.\n\n  HOW ABOUT A NICE GAME OF CHESS?\n                                                                   '\n  Write-Host $message -BackgroundColor 03fcf4 -ForegroundColor Black\n}\n\nfunction pacman {\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Justification = 'Dont tell me what to do')]\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'Clear-Host', Justification = 'Dont tell me what to do')]\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'Out-GridView', Justification = 'Dont tell me what to do')]\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'cls', Justification = 'Dont tell me what to do')]\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingCmdletAliases', 'cls', Justification = 'Dont tell me what to do')]\n  [CmdletBinding()]\n  param()\n  Clear-Host\n\n  $sleep = 15\n\n  $pac = \"\n   .-.      .--.\n  | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .\n  |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '\n  '^^^'    '--'\n  \"\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n  $pac = \"\n    .-.      .--.\n   | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.\n   |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'\n   '^^^'    '--'\n  \"\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n     .-.      .--.\n    | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.\n    |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'\n    '^^^'    '--'\n  \"\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n      .-.      .--.\n     | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.\n     |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'\n     '^^^'    '--'\n  \"\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n       .-.      .--.\n      | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.\n      |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'\n      '^^^'    '--'\n  \"\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n        .-.      .--.\n       | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-\n       |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-\n       '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n         .-.      .--.\n        | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.\n        |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'\n        '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n          .-.      .--.\n         | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.\n         |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'\n         '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n           .-.      .--.\n          | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.\n          |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'\n          '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n            .-.      .--.\n           | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.\n           |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'\n           '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n             .-.      .--.\n            | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-\n            |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-\n            '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n\n  $pac = \"\n              .-.      .--.\n             | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-\n             |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-\n             '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n               .-.      .--.\n              | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .\n              |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '\n              '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                .-.      .--.\n               | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.\n               |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'\n               '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n  $pac = \"\n                 .-.      .--.\n                | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.\n                |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'\n                '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                  .-.      .--.\n                 | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.\n                 |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'\n                 '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n\n  $pac = \"\n                   .-.      .--.\n                  | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.\n                  |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'\n                  '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                    .-.      .--.\n                   | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-\n                   |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-\n                   '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                     .-.      .--.\n                    | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .\n                    |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '\n                    '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                      .-.      .--.\n                     | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.\n                     |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'\n                     '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                       .-.      .--.\n                      | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.\n                      |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'\n                      '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                        .-.      .--.\n                       | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.\n                       |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'\n                       '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                         .-.      .--.\n                        | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.\n                        |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'\n                        '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n\n  $pac = \"\n                          .-.      .--.\n                         | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-\n                         |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-\n                         '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                           .-.      .--.\n                          | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .\n                          |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'   '\n                          '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n\n  $pac = \"\n                            .-.      .--.\n                           | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.\n                           |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'\n                           '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                             .-.      .--.\n                            | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.\n                            |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'\n                            '^^^'    '--'\n  \"\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                              .-.      .--.\n                             | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.\n                             |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'\n                             '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                               .-.      .--.\n                              | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.\n                              |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-'\n                              '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                .-.      .--.\n                               | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-\n                               |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'   '-'   '-\n                               '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                 .-.      .--.\n                                | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.   .-.   .\n                                |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'   '-'   '\n                                '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                  .-.      .--.\n                                 | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.   .-.\n                                 |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'   '-'\n                                 '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                   .-.      .--.\n                                  | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.   .-.\n                                  |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'   '-'\n                                  '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                    .-.      .--.\n                                   | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.   .-.\n                                   |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'   '-'\n                                   '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                     .-.      .--.\n                                    | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.   .-.\n                                    |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'   '-'\n                                    '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                      .-.      .--.\n                                     | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.   .-\n                                     |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'   '-\n                                     '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n\n  $pac = \"\n                                       .-.      .--.\n                                      | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.   .\n                                      |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'   '\n                                      '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                        .-.      .--.\n                                       | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.\n                                       |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'\n                                       '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                         .-.      .--.\n                                        | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.\n                                        |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'\n                                        '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                          .-.      .--.\n                                         | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.\n                                         |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'\n                                         '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                           .-.      .--.\n                                          | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-.\n                                          |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-'\n                                          '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                            .-.      .--.\n                                           | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .-\n                                           |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '-\n                                           '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                             .-.      .--.\n                                            | OO|   / _.-' .-.   .-.   .-.   .-.   .-.   .\n                                            |   |   \\  '-. '-'   '-'   '-'   '-'   '-'   '\n                                            '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                              .-.      .--.\n                                             | OO|   / _.-' .-.   .-.   .-.   .-.   .-.\n                                             |   |   \\  '-. '-'   '-'   '-'   '-'   '-'\n                                             '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                               .-.      .--.\n                                              | OO|   / _.-' .-.   .-.   .-.   .-.   .-.\n                                              |   |   \\  '-. '-'   '-'   '-'   '-'   '-'\n                                              '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                                .-.      .--.\n                                               | OO|   / _.-' .-.   .-.   .-.   .-.   .-.\n                                               |   |   \\  '-. '-'   '-'   '-'   '-'   '-'\n                                               '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                                 .-.      .--.\n                                                | OO|   / _.-' .-.   .-.   .-.   .-.   .-.\n                                                |   |   \\  '-. '-'   '-'   '-'   '-'   '-'\n                                                '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                                   .-.      .--.\n                                                 | OO|   / _.-' .-.   .-.   .-.   .-.   .-\n                                                 |   |   \\  '-. '-'   '-'   '-'   '-'   '-\n                                                 '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                                   .-.      .--.\n                                                  | OO|   / _.-' .-.   .-.   .-.   .-.   .\n                                                  |   |   \\  '-. '-'   '-'   '-'   '-'   '\n                                                  '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                                    .-.      .--.\n                                                   | OO|   / _.-' .-.   .-.   .-.   .-.\n                                                   |   |   \\  '-. '-'   '-'   '-'   '-'\n                                                   '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n\n  $pac = \"\n                                                     .-.      .--.\n                                                    | OO|   / _.-' .-.   .-.   .-.   .-.\n                                                    |   |   \\  '-. '-'   '-'   '-'   '-'\n                                                    '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n\n  $pac = \"\n                                                      .-.      .--.\n                                                     | OO|   / _.-' .-.   .-.   .-.   .-.\n                                                     |   |   \\  '-. '-'   '-'   '-'   '-'\n                                                     '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n\n  $pac = \"\n                                                       .-.      .--.\n                                                      | OO|   / _.-' .-.   .-.   .-.   .-.\n                                                      |   |   \\  '-. '-'   '-'   '-'   '-'\n                                                      '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                                        .-.      .--.\n                                                       | OO|   / _.-' .-.   .-.   .-.   .-\n                                                       |   |   \\  '-. '-'   '-'   '-'   '-\n                                                       '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                                         .-.      .--.\n                                                        | OO|   / _.-' .-.   .-.   .-.   .\n                                                        |   |   \\  '-. '-'   '-'   '-'   '\n                                                        '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                                          .-.      .--.\n                                                         | OO|   / _.-' .-.   .-.   .-.\n                                                         |   |   \\  '-. '-'   '-'   '-'\n                                                         '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n\n  $pac = \"\n                                                           .-.      .--.\n                                                          | OO|   / _.-' .-.   .-.   .-.\n                                                          |   |   \\  '-. '-'   '-'   '-'\n                                                          '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                                            .-.      .--.\n                                                           | OO|   / _.-' .-.   .-.   .-.\n                                                           |   |   \\  '-. '-'   '-'   '-'\n                                                           '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n\n  $pac = \"\n                                                             .-.      .--.\n                                                            | OO|   / _.-' .-.   .-.   .-.\n                                                            |   |   \\  '-. '-'   '-'   '-'\n                                                            '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n\n  $pac = \"\n                                                              .-.      .--.\n                                                             | OO|   / _.-' .-.   .-.   .-\n                                                             |   |   \\  '-. '-'   '-'   '-\n                                                             '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                                               .-.      .--.\n                                                              | OO|   / _.-' .-.   .-.   .\n                                                              |   |   \\  '-. '-'   '-'   '\n                                                              '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n\n  $pac = \"\n                                                                .-.      .--.\n                                                               | OO|   / _.-' .-.   .-.\n                                                               |   |   \\  '-. '-'   '-'\n                                                               '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                                                 .-.      .--.\n                                                                | OO|   / _.-' .-.   .-.\n                                                                |   |   \\  '-. '-'   '-'\n                                                                '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n\n  $pac = \"\n                                                                  .-.      .--.\n                                                                 | OO|   / _.-' .-.   .-.\n                                                                 |   |   \\  '-. '-'   '-'\n                                                                 '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n\n\n  $pac = \"\n                                                                   .-.      .--.\n                                                                  | OO|   / _.-' .-.   .-.\n                                                                  |   |   \\  '-. '-'   '-'\n                                                                  '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                                                    .-.      .--.\n                                                                   | OO|   / _.-' .-.   .-\n                                                                   |   |   \\  '-. '-'   '-\n                                                                   '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                                                     .-.      .--.\n                                                                    | OO|   / _.-' .-.   .\n                                                                    |   |   \\  '-. '-'   '\n                                                                    '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                                                      .-.      .--.\n                                                                     | OO|   / _.-' .-.\n                                                                     |   |   \\  '-. '-'\n                                                                     '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                                                       .-.      .--.\n                                                                      | OO|   / _.-' .-.\n                                                                      |   |   \\  '-. '-'\n                                                                      '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                                                        .-.      .--.\n                                                                       | OO|   / _.-' .-.\n                                                                       |   |   \\  '-. '-'\n                                                                       '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n\n  $pac = \"\n                                                                         .-.      .--.\n                                                                        | OO|   / _.-' .-.\n                                                                        |   |   \\  '-. '-'\n                                                                        '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                                                          .-.      .--.\n                                                                         | OO|   / _.-' .-\n                                                                         |   |   \\  '-. '-\n                                                                         '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                                                           .-.      .--.\n                                                                          | OO|   / _.-' .\n                                                                          |   |   \\  '-. '\n                                                                          '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                                                            .-.      .--.\n                                                                           | OO|   / _.-'\n                                                                           |   |   \\  '-.\n                                                                           '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                                                             .-.      .--.\n                                                                            | OO|   / _.-'\n                                                                            |   |   \\  '-.\n                                                                            '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                                                              .-.      .--\n                                                                             | OO|   / _.-\n                                                                             |   |   \\  '-\n                                                                             '^^^'    '--'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                                                               .-.      .-\n                                                                              | OO|   / _.\n                                                                              |   |   \\  '\n                                                                              '^^^'    '--\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                                                                .-.      .\n                                                                               | OO|   / _\n                                                                               |   |   \\\n                                                                               '^^^'    '-\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                                                                 .-.\n                                                                                | OO|   /\n                                                                                |   |   \\\n                                                                                '^^^'    '\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                                                                  .-.\n                                                                                 | OO|   /\n                                                                                 |   |   \\\n                                                                                 '^^^'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                                                                   .-.\n                                                                                  | OO|\n                                                                                  |   |\n                                                                                  '^^^'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                                                                    .-.\n                                                                                   | OO|\n                                                                                   |   |\n                                                                                   '^^^'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                                                                     .-.\n                                                                                    | OO|\n                                                                                    |   |\n                                                                                    '^^^'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                                                                      .-.\n                                                                                     | OO|\n                                                                                     |   |\n                                                                                     '^^^'\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                                                                       .-.\n                                                                                      | OO\n                                                                                      |\n                                                                                      '^^^\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                                                                        .-\n                                                                                       | O\n                                                                                       |\n                                                                                       '^^\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n                                                                                         .\n                                                                                        |\n                                                                                        |\n                                                                                        '^\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n  $pac = \"\n\n                                                                                         |\n                                                                                         |\n                                                                                         '\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n\n  $pac = \"\n\n\n\n\n  \"\n\n  Write-Host $pac -ForegroundColor Yellow\n  Start-Sleep -Milliseconds $sleep\n  Clear-Host\n\n\n}\nNew-Alias -Name cls -Value pacman -Force\n\nfunction Invoke-PerfAndValidateCheck {\n  <#\n  .SYNOPSIS\n  Function to help test that the v5 and v4 tests are doing the same thing & get the performance stats\n\n  .DESCRIPTION\n  Function to help test that the v5 and v4 tests are doing the same thing & get the performance stats\n\n  .PARAMETER Checks\n  Which checks shall we test\n\n  .PARAMETER PerfDetails\n  Shall we show the performance output from profiler\n\n  .PARAMETER SQLInstances\n  Which SQL Instances shall we test.\n\n  Defaults ($dbachecks1, $dbachecks2, $dbachecks3 = 'dbachecks1', 'dbachecks2', 'dbachecks3')\n\n  .EXAMPLE\n  Invoke-PerfAndValidateCheck -Check InvalidDatabaseOwner\n\n  Check validity and performance for InvalidDatabaseOwner test\n\n  .EXAMPLE\n  Invoke-PerfAndValidateCheck -Check ValidDatabaseOwner, InvalidDatabaseOwner\n\n  Check validity and performance for both the ValidDatabaseOwner and InvalidDatabaseOwner tests\n\n  .EXAMPLE\n  Invoke-PerfAndValidateCheck -Check ValidDatabaseOwner, InvalidDatabaseOwner -PerfDetails\n\n  Check validity and performance for both the ValidDatabaseOwner and InvalidDatabaseOwner tests and show the top 50 slowest lines\n\n  .EXAMPLE\n  Invoke-PerfAndValidateCheck -SqlInstances 'localhost,7401' -Check ValidDatabaseOwner, InvalidDatabaseOwner\n\n  Check validity and performance for both the ValidDatabaseOwner and InvalidDatabaseOwner tests aganinst one container.\n\n  #>\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Justification = 'Dont tell me what to do')]\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'Clear-Host', Justification = 'Dont tell me what to do')]\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'Out-GridView', Justification = 'Dont tell me what to do')]\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseCompatibleCommands', 'cls', Justification = 'Dont tell me what to do')]\n  [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingCmdletAliases', 'cls', Justification = 'Dont tell me what to do')]\n  [CmdletBinding()]\n  param(\n    $Checks,\n    [switch]$PerfDetail,\n    [switch]$showTestResults,\n    $SQLInstances = ($dbachecks1, $dbachecks2, $dbachecks3 = 'dbachecks1', 'dbachecks2', 'dbachecks3')\n  )\n\n  $password = ConvertTo-SecureString \"dbatools.IO\" -AsPlainText -Force\n  $cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"sqladmin\", $password\n  if ($showTestResults) {\n      $show = 'All'\n  } else {\n      $show = 'None'\n  }\n\n  $originalCode = {\n      $global:v4code = Invoke-DbcCheck -SqlInstance $Sqlinstances -Check $Checks -SqlCredential $cred  -legacy $true -Show $show -PassThru\n  }\n\n  $NewCode = {\n      $global:v5code = Invoke-DbcCheck -SqlInstance $Sqlinstances -Check $Checks -SqlCredential $cred -legacy $false  -Show $show -PassThru\n  }\n\n  $originalCodetrace = Trace-Script -ScriptBlock $originalCode\n  Remove-Module Pester\n  Import-Module Pester -MinimumVersion 5.0.0 -Global\n  $NewCodetrace = Trace-Script -ScriptBlock $NewCode\n\n  $originalCodeMessage = \"With original Code it takes {0} MilliSeconds\" -f $originalCodetrace.StopwatchDuration.TotalMilliseconds\n\n  $savingMessage = \"\nRunning with\n\n{3}\n\nChecks against $($Sqlinstances.Count) SQL Containers\n\nWith original Code it takes {1} Seconds\nWith New Code it takes {4} Seconds\n\nNew Code for these {5} checks\nis saving {0} seconds\nfrom a run of {1} seconds\nNew Code runs in {2} % of the time\n\" -f ('{0:N2}' -f ($originalCodetrace.StopwatchDuration.TotalSeconds - $NewCodetrace.StopwatchDuration.TotalSeconds)), ('{0:N2}' -f $originalCodetrace.StopwatchDuration.TotalSeconds), ('{0:N2}' -f (($NewCodetrace.StopwatchDuration.TotalSeconds / $originalCodetrace.StopwatchDuration.TotalSeconds) * 100)), ($Checks -split ',' -join ',') , ('{0:N2}' -f $NewCodetrace.StopwatchDuration.TotalSeconds), $Checks.Count\n\n  Write-PSFMessage -Message $savingMessage -Level Output\n\n  ##validate we got the right answers too\n[System.Collections.ArrayList]$v5CodeTags = $v5code.Configuration.Filter.Tag.Value\n$v5CodeTags.Remove('FailedConnections')\n  If (Compare-Object $v5CodeTags $v4code.TagFilter) {\n      $Message = \"\nUh-Oh - The Tag filters between v4 and v5 are not the same somehow.\nFor v4 We returned\n{0}\nand\nfor v4 we returned\n{1}\n\" -f ($v4code.TagFilter | Out-String), ($v5code.Configuration.Filter.Tag.Value | Out-String)\n      Write-PSFMessage -Message $Message -Level Warning\n  } else {\n      $message = \"\nThe Tags are the same\"\n      Write-PSFMessage -Message $Message -Level Output\n  }\n\n  $changedTags = @(\n      @{\n          Name          = 'TraceFlagsExpected'\n          RunChange     = 3 # + or - the number of tests run for v4\n          PassedChange  = 3 # + or - the number of tests passed for v4\n          FailedChange  = 0 # + or - the number of tests failed for v4\n          SkippedChange = 0 # + or - the number of tests skipped for v4\n\n      },\n      @{\n          Name          = 'TraceFlagsNotExpected'\n          RunChange     = 3 # + or - the number of tests for v4\n          PassedChange  = 3 # + or - the number of tests passed for v4\n          FailedChange  = 0 # + or - the number of tests failed for v4\n          SkippedChange = 0 # + or - the number of tests skipped for v4\n      },\n      @{\n          Name          = 'XESessionRunningAllowed'\n          RunChange     = -12 # + or - the number of tests for v4\n          PassedChange  = 0 # + or - the number of tests passed for v4\n          FailedChange  = -12 # + or - the number of tests failed for v4\n          SkippedChange = 0 # + or - the number of tests skipped for v4\n      },\n      @{\n          Name          = 'LinkedServerConnection'\n          RunChange     = -3 # + or - the number of tests for v4\n          PassedChange  = -3 # + or - the number of tests passed for v4\n          FailedChange  = 0 # + or - the number of tests failed for v4\n          SkippedChange = 0 # + or - the number of tests skipped for v4\n      },\n      @{\n          Name          = 'SupportedBuild'\n          RunChange     = -3 # + or - the number of tests run for v4\n          PassedChange  = -3 # + or - the number of tests passed for v4\n          FailedChange  = 0 # + or - the number of tests failed for v4\n          SkippedChange = 0 # + or - the number of tests skipped for v4\n      },\n      @{\n          Name          = 'GuestUserConnect'\n          RunChange     = 0 # + or - the number of tests run for v4\n          PassedChange  = +2 # + or - the number of tests passed for v4\n          FailedChange  = -2 # + or - the number of tests failed for v4\n          SkippedChange = 0 # + or - the number of tests skipped for v4\n      },\n      @{\n          Name          = 'AgentServiceAccount'\n          RunChange     = -3 # + or - the number of tests run for v4\n          PassedChange  = -5 # + or - the number of tests passed for v4\n          FailedChange  = -1 # + or - the number of tests failed for v4\n          SkippedChange = +3 # + or - the number of tests skipped for v4\n          },\n      @{\n          Name          = 'SqlEngineServiceAccount'\n          RunChange     = -3 # + or - the number of tests run for v5\n          PassedChange  = 0 # + or - the number of tests passed for v5\n          FailedChange  = 0 # + or - the number of tests failed for v5\n          SkippedChange = -3 # + or - the number of tests skipped for v5\n      }\n  )\n  $runchange = 0\n  $passedchange = 0\n  $failedchange = 0\n  $skippedchange = 0\n  $tagNameMessageAppend = $null\n  foreach ($changedTag in $changedTags) {\n      if ($v5code.Configuration.Filter.Tag.Value -contains $changedTag.Name) {\n          $runchange += $changedTag.RunChange\n          $passedchange += $changedTag.PassedChange\n          $failedchange += $changedTag.FailedChange\n          $skippedchange += $changedTag.SkippedChange\n          $tagNameMessageAppend += \"tag {0} with:\n      - run change {1}\n      - passed change {2}\n      - failed change {3}\n      - skipped change {4}\n      \" -f $changedTag.Name, $changedTag.RunChange, $changedTag.PassedChange, $changedTag.FailedChange, $changedTag.SkippedChange\n      }\n  }\n  $messageAppend = if ($tagNameMessageAppend) { \"although this includes {0}\" -f $tagNameMessageAppend } else { '' }\n\n  $v5run = $v5code.TotalCount - $v5code.NotRunCount + $runchange\n  $v5Passed = $v5code.PassedCount + $passedchange\n  $v5failed = $v5code.FailedCount + $failedchange\n  $v5skipped = $v5code.SkippedCount + $skippedchange\n\n  #total checks\n  If ($v5run -ne $v4code.TotalCount) {\n      $Message = \"\nUh-Oh - The total tests run between v4 and v5 are not the same somehow.\nFor v4 We ran\n{0} tests\nand\nfor v5 we ran\n{1} tests\nThe MOST COMMON REASON IS you have used Tags instead of Tag in your Describe block {2}\n\" -f $v4code.TotalCount, $v5run, $messageAppend\n      Write-PSFMessage -Message $Message -Level Warning\n  } else {\n      $message = \"\nThe Total Tests Run are the same {0} {1}\n{2}\" -f $v4code.TotalCount, $v5run, $messageAppend\n      Write-PSFMessage -Message $Message -Level Output\n  }\n\n  #total passed checks\n  If ($v5Passed -ne $v4code.PassedCount) {\n\n      $Message = \"\nUh-Oh - The total tests Passed between v4 and v5 are not the same somehow.\nFor v4 We Passed\n{0} tests\nand\nfor v5 we Passed\n{1} tests\n{2}\n\n\" -f $v4code.PassedCount, $v5Passed, $messageAppend\n        if($MessageAppend){\n          $Message += \"\nv4 TestNames\n{0}\nv5 TestNames\n{1}\n          \" -f ($v4code.TestResult.Where{$_.Result -eq 'Passed'}.Name |Out-String),($v5code.Passed.ExpandedName |Out-String)\n        }\n      Write-PSFMessage -Message $Message -Level Warning\n  } else {\n      $message = \"\nThe Total Tests Passed are the same {0} {1}\n{2}\" -f $v4code.PassedCount, $v5Passed, $messageAppend\n      Write-PSFMessage -Message $Message -Level Output\n  }\n  # total failed\n  If ($v5failed -ne $v4code.FailedCount) {\n      $Message = \"\nUh-Oh - The total tests Failed between v4 and v5 are not the same somehow.\nFor v4 We Failed\n{0} tests\nand\nfor v5 we Failed\n{1} tests\n\n\" -f $v4code.FailedCount, $v5Failed, $messageAppend\n        if($MessageAppend){\n          $Message += \"\nv4 TestNames\n{0}\nv5 TestNames\n{1}\n          \" -f ($v4code.TestResult.Where{$_.Result -eq 'Failed'}.Name |Out-String),($v5code.Failed.ExpandedName |Out-String)\n        }\n      Write-PSFMessage -Message $Message -Level Warning\n  } else {\n      $message = \"\nThe Total Tests Failed are the same {0} {1}\n{2}\" -f $v4code.FailedCount, $v5failed, $messageAppend\n      Write-PSFMessage -Message $Message -Level Output\n  }\n\n  If ($v5skipped -ne $v4code.SkippedCount) {\n      $Message = \"\nUh-Oh - The total tests Skipped between v4 and v5 are not the same somehow.\nFor v4 We Skipped\n{0} tests\nand\nFor v5 we Skipped\n{1}\n\n\" -f $v4code.SkippedCount, $v5Skipped, $messageAppend\n        if($MessageAppend){\n          $Message += \"\nv4 TestNames\n{0}\nv5 TestNames\n{1}\n          \" -f ($v4code.TestResult.Where{$_.Result -eq 'Skipped'}.Name |Out-String),($v5code.Skipped.ExpandedName |Out-String)\n        }\n      Write-PSFMessage -Message $Message -Level Warning\n  } else {\n      $message = \"\nThe Total Tests Skipped are the same {0} {1}\n{2}\"-f $v4code.SkippedCount, $v5skipped, $messageAppend\n      Write-PSFMessage -Message $Message -Level Output\n  }\n  if ($PerfDetail) {\n      $message = \"\n    Let's take a look at the slowest code as well \"\n      Write-PSFMessage -Message $Message -Level Output\n      $NewCodetrace.Top50SelfDuration| Select SelfPercent,HitCount,Line,Function, Text }\n}\n\nSet-PSFConfig -Module JessAndBeard -Name shallweplayagame -Value $true -Initialize -Description \"Whether to ask or not\" -ModuleExport\n"
  },
  {
    "path": "containers/base/dockerfile",
    "content": "FROM dbachecks/sqlinstance1\n\nUSER root\n\n# remove old dbatools directory so 2.0 will import\nRUN rm -rf /usr/local/share/powershell/Modules/dbatools/1.1.145\n\n# Copy Profile\n\nADD profile.ps1 /root/.config/powershell/\n\n# Install PowerShell latest please\nRUN apt-get update && apt install -y powershell\n"
  },
  {
    "path": "containers/base/profile.ps1",
    "content": "[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '', Justification = 'Because this is just for testing and developing')]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingWriteHost', '', Justification = 'Because this is for the prompt and it is required')]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'containers', Justification = 'Because it is a global variable used later')]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'SQLInstances', Justification = 'Because it is a global variable used later')]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'currentAccountName', Justification = 'Because silly script analyuser cant see it is used')]\n[CmdletBinding()]\nparam()\n\n# Set these defaults for all future sessions on this machine\nSet-DbatoolsConfig -FullName sql.connection.trustcert -Value $true -Register\nSet-DbatoolsConfig -FullName sql.connection.encrypt -Value $false -Register\n\nif (Test-Path /workspace/containers -ErrorAction SilentlyContinue) {\n    Import-Module /workspace/containers/JessAndBeard.psm1\n} else {\n    Import-Module /workspaces/dbachecks/containers/JessAndBeard.psm1\n}\n\n\nRemove-Item '/var/opt/backups/dbachecks1' -Recurse -Force -ErrorAction SilentlyContinue\nRemove-Item '/shared' -Recurse -Force -ErrorAction SilentlyContinue\nfunction Load-Profile {\n    Import-Module posh-git\n    # Import-Module oh-my-posh\n    # Set-PoshPrompt -Theme atomic\n\n    $env:POSH_THEMES_PATH = '~/.poshthemes'\n\n    function global:Set-PoshPrompt {\n        param(\n            $theme\n        )\n        & oh-my-posh init pwsh --config \"$env:POSH_THEMES_PATH\\$theme.omp.json\" | Invoke-Expression\n    }\n    # Create scriptblock that collects information and name it\n    Register-PSFTeppScriptblock -Name \"poshthemes\" -ScriptBlock { Get-ChildItem $env:POSH_THEMES_PATH | Select-Object -ExpandProperty Name -Unique | ForEach-Object { $_ -replace '\\.omp\\.json$', '' } }\n    #Assign scriptblock to function\n    Register-PSFTeppArgumentCompleter -Command Set-PoshPrompt -Parameter theme -Name poshthemes\n    $themes = @(\n        'neko',\n        'sonicboom_dark',\n        'neko',\n        'easy-term',\n        'if_tea',\n        'neko',\n        'kushal'\n        'nigfht-owl',\n        'neko',\n        'powerlevel10k_rainbow',\n        'quick-term',\n        'neko',\n        'stelbent.minimal',\n        'tokyo',\n        'neko',\n        'unicorn',\n        'wholespace',\n        'sonicboom_dark',\n        'lambdageneration'\n    )\n    $global:__currentTheme = (Get-Random -InputObject $themes)\n    function global:Get-CurrentPoshTheme { $__currentTheme }\n    # Set-PoshPrompt -Theme $__currentTheme\n    Set-PoshPrompt -Theme 'chips'\n    if ($psstyle) {\n        $psstyle.FileInfo.Directory = $psstyle.FileInfo.Executable = $psstyle.FileInfo.SymbolicLink = \"\"\n        $PSStyle.FileInfo.Extension.Clear()\n        $PSStyle.Formatting.TableHeader = \"\"\n        $PsStyle.Formatting.FormatAccent = \"\"\n    }\n}\n\"Load-Profile for full profile\"\nfunction prompt {\n    #Load-Profile\n    \"PS > \"\n}\n\nfunction whatsmyip {\n    [CmdletBinding()]\n    param (\n        [Parameter()]\n        [switch]\n        $clip\n    )\n    if ($clip) {\n            (Invoke-WebRequest -Uri 'http://ifconfig.me/ip').Content | Set-Clipboard\n    } else {\n            (Invoke-WebRequest -Uri 'http://ifconfig.me/ip').Content\n    }\n}\n\nfunction whatsmyip {\n    [CmdletBinding()]\n    param (\n        [Parameter()]\n        [switch]\n        $clip\n    )\n    if ($clip) {\n            (Invoke-WebRequest -Uri 'http://ifconfig.me/ip').Content | Set-Clipboard\n    } else {\n            (Invoke-WebRequest -Uri 'http://ifconfig.me/ip').Content\n    }\n}\n\n"
  },
  {
    "path": "containers/second/dockerfile",
    "content": "FROM dbachecks/sqlinstance2\nUSER root\n# Install PowerShell\nRUN apt-get update && apt install -y powershell\n# install git\nRUN apt install -y git\n\n# some cleanup\nRUN apt-get autoremove -y \\\n    && apt-get clean -y"
  },
  {
    "path": "containers/third/dockerfile",
    "content": "FROM dbachecks/sqlinstance3\nUSER root\n# Install PowerShell  \nRUN apt-get update && apt install -y powershell\n# install git  \nRUN apt install -y git\n\n# some cleanup\nRUN apt-get autoremove -y \\\n    && apt-get clean -y"
  },
  {
    "path": "dbachecksdevcontainer.code-workspace",
    "content": "{\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\": \"PSScriptAnalyzerSettings.psd1\",\n\t\t\"mssql.connections\": [\n            {\n                \"server\": \"dbachecks1\",\n                \"database\": \"Northwind\",\n                \"authenticationType\": \"SqlLogin\",\n                \"user\": \"sqladmin\",\n                \"password\": \"dbatools.IO\",\n                \"emptyPasswordInput\": false,\n                \"savePassword\": true,\n                \"profileName\": \"dbachecks1-Northwind\",\n                \"connectTimeout\": 15,\n                \"encrypt\": false,\n                \"applicationName\": \"vscode-mssql\"\n            },\n            {\n                \"server\": \"dbachecks1\",\n                \"database\": \"pubs\",\n                \"authenticationType\": \"SqlLogin\",\n                \"user\": \"sqladmin\",\n                \"password\": \"dbatools.IO\",\n                \"emptyPasswordInput\": false,\n                \"savePassword\": true,\n                \"profileName\": \"dbachecks1-pubs\",\n                \"connectTimeout\": 15,\n                \"encrypt\": false,\n                \"applicationName\": \"vscode-mssql\"\n            },\n            {\n                \"server\": \"dbachecks1\",\n                \"database\": \"master\",\n                \"authenticationType\": \"SqlLogin\",\n                \"user\": \"sqladmin\",\n                \"password\": \"dbatools.IO\",\n                \"emptyPasswordInput\": false,\n                \"savePassword\": true,\n                \"profileName\": \"dbachecks1-master\",\n                \"connectTimeout\": 15,\n                \"encrypt\": false,\n                \"applicationName\": \"vscode-mssql\"\n            },\n            {\n                \"server\": \"dbachecks1\",\n                \"database\": \"msdb\",\n                \"authenticationType\": \"SqlLogin\",\n                \"user\": \"sqladmin\",\n                \"password\": \"dbatools.IO\",\n                \"emptyPasswordInput\": false,\n                \"savePassword\": true,\n                \"profileName\": \"dbachecks1-msdb\",\n                \"connectTimeout\": 15,\n                \"encrypt\": false,\n                \"applicationName\": \"vscode-mssql\"\n            },\n            {\n                \"server\": \"dbachecks2\",\n                \"database\": \"master\",\n                \"authenticationType\": \"SqlLogin\",\n                \"user\": \"sqladmin\",\n                \"password\": \"dbatools.IO\",\n                \"emptyPasswordInput\": false,\n                \"savePassword\": true,\n                \"profileName\": \"dbachecks2-master\",\n                \"connectTimeout\": 15,\n                \"encrypt\": false,\n                \"applicationName\": \"vscode-mssql\"\n            },\n            {\n                \"server\": \"dbachecks2\",\n                \"database\": \"msdb\",\n                \"authenticationType\": \"SqlLogin\",\n                \"user\": \"sqladmin\",\n                \"password\": \"dbatools.IO\",\n                \"emptyPasswordInput\": false,\n                \"savePassword\": true,\n                \"profileName\": \"dbachecks2-msdb\",\n                \"connectTimeout\": 15,\n                \"encrypt\": false,\n                \"applicationName\": \"vscode-mssql\"\n            },\n            {\n                \"server\": \"dbachecks3\",\n                \"database\": \"Northwind\",\n                \"authenticationType\": \"SqlLogin\",\n                \"user\": \"sqladmin\",\n                \"password\": \"dbatools.IO\",\n                \"emptyPasswordInput\": false,\n                \"savePassword\": true,\n                \"profileName\": \"dbachecks3-Northwind\",\n                \"connectTimeout\": 15,\n                \"encrypt\": false,\n                \"applicationName\": \"vscode-mssql\"\n            },\n            {\n                \"server\": \"dbachecks3\",\n                \"database\": \"pubs\",\n                \"authenticationType\": \"SqlLogin\",\n                \"user\": \"sqladmin\",\n                \"password\": \"dbatools.IO\",\n                \"emptyPasswordInput\": false,\n                \"savePassword\": true,\n                \"profileName\": \"dbachecks3-pubs\",\n                \"connectTimeout\": 15,\n                \"encrypt\": false,\n                \"applicationName\": \"vscode-mssql\"\n            },\n            {\n                \"server\": \"dbachecks3\",\n                \"database\": \"master\",\n                \"authenticationType\": \"SqlLogin\",\n                \"user\": \"sqladmin\",\n                \"password\": \"dbatools.IO\",\n                \"emptyPasswordInput\": false,\n                \"savePassword\": true,\n                \"profileName\": \"dbachecks3-master\",\n                \"connectTimeout\": 15,\n                \"encrypt\": false,\n                \"applicationName\": \"vscode-mssql\"\n            },\n            {\n                \"server\": \"dbachecks3\",\n                \"database\": \"msdb\",\n                \"authenticationType\": \"SqlLogin\",\n                \"user\": \"sqladmin\",\n                \"password\": \"dbatools.IO\",\n                \"emptyPasswordInput\": false,\n                \"savePassword\": true,\n                \"profileName\": \"dbachecks3-msdb\",\n                \"connectTimeout\": 15,\n                \"encrypt\": false,\n                \"applicationName\": \"vscode-mssql\"\n            }\n        ]\n\t}\n}"
  },
  {
    "path": "developing/Archive/Get-AllInstanceInfo testing.ps1",
    "content": "# Get-AllInstanceInfo testing \n\n# so the initial load doesnt skew the figures\nipmo dbatools\nipmo ./dbachecks.psd1\nfunction prompt { Write-Host \"pwsh >\" -NoNewline; ' ' }\ncls\n# load the original function\n. .\\originalGet-AllInstanceInfo.ps1\n. .\\internal\\functions\\NewGet-AllInstanceInfo.ps1\n\n$Checks = 'TwoDigitYearCutoff','MaxDopInstance','ErrorLogCount','ModelDbGrowth','DefaultBackupCompression','SaExist','SaDisabled','SaRenamed','DefaultFilePath','AdHocDistributedQueriesEnabled','AdHocWorkload',  'DefaultTrace', 'OleAutomationProceduresDisabled', 'CrossDBOwnershipChaining', 'ScanForStartupProceduresDisabled', 'RemoteAccessDisabled', 'SQLMailXPsDisabled', 'DAC', 'OLEAutomation'\n$Checks = 'TwoDigitYearCutoff'\n\nCompare-GetAllInstanceInfoPerf -Checks $Checks\n\nfunction Compare-GetAllInstanceInfoPerf {\n    Param($Checks)\n    $originalCode = {\n        $password = ConvertTo-SecureString \"dbatools.IO\" -AsPlainText -Force\n        $cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"sqladmin\", $password\n        \n        $Sqlinstances = 'localhost,7401', 'localhost,7402', 'localhost,7403'\n        $smos = Connect-DbaInstance -SqlInstance $Sqlinstances -SqlCredential $cred\n    \n        foreach ($smo in $smos) {\n            Get-AllInstanceInfo -Instance $smo -Tags $Checks -There $true\n        }\n    }\n    $NewCode = {\n        $password = ConvertTo-SecureString \"dbatools.IO\" -AsPlainText -Force\n        $cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"sqladmin\", $password\n        \n        $Sqlinstances = 'localhost,7401', 'localhost,7402', 'localhost,7403'\n        $smos = Connect-DbaInstance -SqlInstance $Sqlinstances -SqlCredential $cred\n    \n        foreach ($smo in $smos) {\n            NewGet-AllInstanceInfo -Instance $smo -Tags  $SPConfigureChecks -There $true\n        }\n    }\n    $originalCodetrace = Trace-Script -ScriptBlock $originalCode\n    $NewCodetrace = Trace-Script -ScriptBlock $NewCode\n\n    $originalCodeMessage = \"With original Code it takes {0} MilliSeconds\" -f $originalCodetrace.StopwatchDuration.TotalMilliseconds\n    $NewCodeMessage = \"With New Code it takes {0} MilliSeconds\" -f $NewCodetrace.StopwatchDuration.TotalMilliseconds\n    $savingMessage = \"\nRunning with \n\n{3} \n\nChecks against 3 SQL Containers\n\nWith original Code it takes {1} Seconds\nWith New Code it takes {4} Seconds\n\nNew Code for these {5} checks \nis saving {0} seconds\nfrom a run of {1} seconds\nNew Code runs in {2} % of the time\n\" -f ('{0:N2}' -f ($originalCodetrace.StopwatchDuration.TotalSeconds - $NewCodetrace.StopwatchDuration.TotalSeconds)),('{0:N2}' -f $originalCodetrace.StopwatchDuration.TotalSeconds),('{0:N2}' -f (($NewCodetrace.StopwatchDuration.TotalSeconds/$originalCodetrace.StopwatchDuration.TotalSeconds) * 100)),($Checks -split ',' -join ',') ,('{0:N2}' -f $NewCodetrace.StopwatchDuration.TotalSeconds), $Checks.Count\ncls\nWrite-PSFMessage -Message $originalCodeMessage -Level Significant\nWrite-PSFMessage -Message $NewCodeMessage -Level Significant\nWrite-PSFMessage -Message $savingMessage -Level Output\n\n}\n"
  },
  {
    "path": "developing/Archive/Perf Testing pesterv5.ps1",
    "content": "## To Test performance - I pull the dbatools docker repo and cd to the samples/stackoverflow Directory\n\n## I changed the ports because I have some of them already running SQL\n\n##     line 17   - \"7401:1433\"\n##     line 34   - \"7402:1433\"\n##     line 52   - \"7403:1433\"\n\n#then docker compose up -d\n\n# cd to the root of dbachecks and checkout the pesterv5 branch\n\nipmo ./dbachecks.psd1\n\n#\n\n$Checks = 'XpCmdShellDisabled','WhoIsActiveInstalled','CLREnabled','TraceFlagsNotExpected','TraceFlagsExpected','TwoDigitYearCutoff','MaxDopInstance','ErrorLogCount','ModelDbGrowth','DefaultBackupCompression','SaExist','SaDisabled','SaRenamed','DefaultFilePath','AdHocDistributedQueriesEnabled','AdHocWorkload',  'DefaultTrace', 'OleAutomationProceduresDisabled', 'CrossDBOwnershipChaining', 'ScanForStartupProceduresDisabled', 'RemoteAccessDisabled', 'SQLMailXPsDisabled', 'DAC', 'OLEAutomation'\n$Checks = 'XpCmdShellDisabled'\n\n<#\nWhen there are default skips (some of the CIS checks) we need to set the configs and check\n\nSet-DbcConfig skip.security.sadisabled -Value $false\nSet-DbcConfig skip.security.sadisabled -Value $true\nGet-DbcConfigValue skip.security.sadisabled\n\nSet-DbcConfig skip.security.saexist -Value $false\nSet-DbcConfig skip.security.saexist -Value $true\nGet-DbcConfigValue skip.security.saexist\n\n\nGet-DbcConfigValue policy.instancemaxdop.userecommended\nGet-DbcConfigValue policy.instancemaxdop.maxdop\nGet-DbcConfigValue policy.instancemaxdop.excludeinstance\n\nSet-DbcConfig policy.instancemaxdop.userecommended -Value $false\nSet-DbcConfig policy.instancemaxdop.userecommended -Value $true\nSet-DbcConfig policy.instancemaxdop.maxdop -Value 0\nSet-DbcConfig policy.instancemaxdop.excludeinstance -Value $null\nSet-DbcConfig policy.instancemaxdop.excludeinstance -Value 'localhost,7401'\n\nGet-DbcConfigValue policy.traceflags.expected\nGet-DbaTraceFlag -SqlInstance $Sqlinstances -SqlCredential $cred\nSet-DbcConfig policy.traceflags.expected -Value 1117,1118\nSet-DbcConfig policy.traceflags.expected -Value $null\n\nEnable-DbaTraceFlag -SqlInstance $Sqlinstances -SqlCredential $cred -TraceFlag 1117,1118\nDisable-DbaTraceFlag -SqlInstance $Sqlinstances -SqlCredential $cred -TraceFlag 1117,1118\nDisable-DbaTraceFlag -SqlInstance $Sqlinstances -SqlCredential $cred -TraceFlag 1118\n\n#>\n\n# Load the function below and then you can keep running the checks defined above in v4 and v5 and compare the performance\n# You can keep updating the .Tests.ps1 files and rerunning the function without needing to re-import hte module\n\n# If you change any of the functions you WILL need to re-import or better still use a new session\n\n# If you get odd results - or you dont get any checks run\n\n# run the import module and the Invoke Dbc Check with Verbose and that might show you New-Json messing\n# with your files or that you are looking in PSMOdulePath instead of Git Repo path (run Reset-dbcConfig to fix that)\n\nfunction Compare-CheckRuns {\nparam($Checks)\n$password = ConvertTo-SecureString \"dbatools.IO\" -AsPlainText -Force\n$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"sqladmin\", $password\n$Sqlinstances = 'localhost,7401', 'localhost,7402', 'localhost,7403'\n\n$originalCode = {\n    Invoke-DbcCheck -SqlInstance $Sqlinstances -Check $Checks -SqlCredential $cred -legacy $true -Show None\n}\n\n$NewCode = {\n    Invoke-DbcCheck -SqlInstance $Sqlinstances -Check $Checks -SqlCredential $cred -legacy $false  -Show None\n}\n\n$originalCodetrace = Trace-Script -ScriptBlock $originalCode\n$NewCodetrace = Trace-Script -ScriptBlock $NewCode\n\n$originalCodeMessage = \"With original Code it takes {0} MilliSeconds\" -f $originalCodetrace.StopwatchDuration.TotalMilliseconds\n\n\n$savingMessage = \"\nRunning with\n\n{3}\n\nChecks against $($Sqlinstances.Count) SQL Containers\n\nWith original Code it takes {1} Seconds\nWith New Code it takes {4} Seconds\n\nNew Code for these {5} checks\nis saving {0} seconds\nfrom a run of {1} seconds\nNew Code runs in {2} % of the time\n\" -f ('{0:N2}' -f ($originalCodetrace.StopwatchDuration.TotalSeconds - $NewCodetrace.StopwatchDuration.TotalSeconds)),('{0:N2}' -f $originalCodetrace.StopwatchDuration.TotalSeconds),('{0:N2}' -f (($NewCodetrace.StopwatchDuration.TotalSeconds/$originalCodetrace.StopwatchDuration.TotalSeconds) * 100)),($Checks -split ',' -join ',') ,('{0:N2}' -f $NewCodetrace.StopwatchDuration.TotalSeconds), $Checks.Count\ncls\n\nWrite-PSFMessage -Message $savingMessage -Level Output\n}\n\n\n# $Checks = 'DbaOperator'\nCompare-CheckRuns -Checks $checks"
  },
  {
    "path": "developing/Archive/PerfAndValidate-Checks.ps1",
    "content": "## To Test performance - I pull the dbatools docker repo and cd to the samples/stackoverflow Directory\n\n## I changed the ports because I have some of them already running SQL\n\n##     line 17   - \"7401:1433\"\n##     line 34   - \"7402:1433\"\n##     line 52   - \"7403:1433\"\n\n#then docker compose up -d\n\n# cd to the root of dbachecks and checkout the pesterv5 branch\n\nipmo ./dbachecks.psd1\n\n#\n\n#$Checks = 'XpCmdShellDisabled','WhoIsActiveInstalled','CLREnabled','TraceFlagsNotExpected','TraceFlagsExpected','TwoDigitYearCutoff','MaxDopInstance','ErrorLogCount','ModelDbGrowth','DefaultBackupCompression','SaExist','SaDisabled','SaRenamed','DefaultFilePath','AdHocDistributedQueriesEnabled','AdHocWorkload',  'DefaultTrace', 'OleAutomationProceduresDisabled', 'CrossDBOwnershipChaining', 'ScanForStartupProceduresDisabled', 'RemoteAccessDisabled', 'SQLMailXPsDisabled', 'DAC', 'OLEAutomation'\n$Checks = 'AsymmetricKeySize'\n\n<#\nWhen there are default skips (some of the CIS checks) we need to set the configs and check\n\nSet-DbcConfig skip.security.sadisabled -Value $false\nSet-DbcConfig skip.security.sadisabled -Value $true\nGet-DbcConfigValue skip.security.sadisabled\n\nSet-DbcConfig skip.security.saexist -Value $false\nSet-DbcConfig skip.security.saexist -Value $true\nGet-DbcConfigValue skip.security.saexist\n\n\nGet-DbcConfigValue policy.instancemaxdop.userecommended\nGet-DbcConfigValue policy.instancemaxdop.maxdop\nGet-DbcConfigValue policy.instancemaxdop.excludeinstance\n\nSet-DbcConfig policy.instancemaxdop.userecommended -Value $false\nSet-DbcConfig policy.instancemaxdop.userecommended -Value $true\nSet-DbcConfig policy.instancemaxdop.maxdop -Value 0\nSet-DbcConfig policy.instancemaxdop.excludeinstance -Value $null\nSet-DbcConfig policy.instancemaxdop.excludeinstance -Value 'localhost,7401'\n\nGet-DbcConfigValue policy.traceflags.expected\nGet-DbaTraceFlag -SqlInstance $Sqlinstances -SqlCredential $cred\nSet-DbcConfig policy.traceflags.expected -Value 1117,1118\nSet-DbcConfig policy.traceflags.expected -Value $null\n\nEnable-DbaTraceFlag -SqlInstance $Sqlinstances -SqlCredential $cred -TraceFlag 1117,1118\nDisable-DbaTraceFlag -SqlInstance $Sqlinstances -SqlCredential $cred -TraceFlag 1117,1118\nDisable-DbaTraceFlag -SqlInstance $Sqlinstances -SqlCredential $cred -TraceFlag 1118\n\n#>\n\n# Load the function below and then you can keep running the checks defined above in v4 and v5 and compare the performance\n# You can keep updating the .Tests.ps1 files and rerunning the function without needing to re-import hte module\n\n# If you change any of the functions you WILL need to re-import or better still use a new session\n\n# If you get odd results - or you dont get any checks run\n\n# run the import module and the Invoke Dbc Check with Verbose and that might show you New-Json messing\n# with your files or that you are looking in PSMOdulePath instead of Git Repo path (run Reset-dbcConfig to fix that)\n\nfunction Invoke-PerfAndValidateChecks {\n    param($Checks)\n    $password = ConvertTo-SecureString \"dbatools.IO\" -AsPlainText -Force\n    $cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"sqladmin\", $password\n    $Sqlinstances = 'localhost,7401', 'localhost,7402', 'localhost,7403'\n\n    $originalCode = {\n        $global:v4code = Invoke-DbcCheck -SqlInstance $Sqlinstances -Check $Checks -SqlCredential $cred -legacy $true -Show None -PassThru\n    }\n\n    $NewCode = {\n        $global:v5code = Invoke-DbcCheck -SqlInstance $Sqlinstances -Check $Checks -SqlCredential $cred -legacy $false  -Show None -PassThru\n    }\n\n    $originalCodetrace = Trace-Script -ScriptBlock $originalCode\n    $NewCodetrace = Trace-Script -ScriptBlock $NewCode\n\n    $originalCodeMessage = \"With original Code it takes {0} MilliSeconds\" -f $originalCodetrace.StopwatchDuration.TotalMilliseconds\n\n\n$savingMessage = \"\nRunning with\n\n{3}\n\nChecks against $($Sqlinstances.Count) SQL Containers\n\nWith original Code it takes {1} Seconds\nWith New Code it takes {4} Seconds\n\nNew Code for these {5} checks\nis saving {0} seconds\nfrom a run of {1} seconds\nNew Code runs in {2} % of the time\n\" -f ('{0:N2}' -f ($originalCodetrace.StopwatchDuration.TotalSeconds - $NewCodetrace.StopwatchDuration.TotalSeconds)),('{0:N2}' -f $originalCodetrace.StopwatchDuration.TotalSeconds),('{0:N2}' -f (($NewCodetrace.StopwatchDuration.TotalSeconds/$originalCodetrace.StopwatchDuration.TotalSeconds) * 100)),($Checks -split ',' -join ',') ,('{0:N2}' -f $NewCodetrace.StopwatchDuration.TotalSeconds), $Checks.Count\n\nWrite-PSFMessage -Message $savingMessage -Level Output\n\n\n##validate we got the right answers too\n\nIf (Compare-Object $v5code.Configuration.Filter.Tag.Value $v4code.TagFilter) {\n    $Message = \"\nUh-Oh - The Tag filters between v4 and v5 are not the same somehow.\nFor v4 We returned\n{0}\nand\nFor v5 we returned\n{1}\n\" -f ($v4code.TagFilter | Out-String), ($v5code.Configuration.Filter.Tag.Value | Out-String)\n    Write-PSFMessage -Message $Message -Level Warning\n}\nelse {\n    $message = \"\nThe Tags are the same\"\n    Write-PSFMessage -Message $Message -Level Output\n}\n\nIf (($v5code.TotalCount - $v5code.NotRunCount) -ne $v4code.TotalCount) {\n    $Message = \"\nUh-Oh - The total tests run between v4 and v5 are not the same somehow.\nFor v4 We ran\n{0} tests\nand\nFor v5 we ran\n{1} tests\nThe MOST COMMON REASON IS you have used Tags instead of Tag in your Describe block\nbut TraceFlagsNotExpected will change that also\n\" -f $v4code.TotalCount, ($v5code.TotalCount - $v5code.NotRunCount)\n    Write-PSFMessage -Message $Message -Level Warning\n}\nelse {\n    $message = \"\nThe Total Tests Run are the same {0} {1} \" -f $v4code.TotalCount, ($v5code.TotalCount - $v5code.NotRunCount)\n    Write-PSFMessage -Message $Message -Level Output\n}\n\nIf ($v5code.PassedCount -ne $v4code.PassedCount) {\n    $Message = \"\nUh-Oh - The total tests Passed between v4 and v5 are not the same somehow.\nFor v4 We Passed \n{0} tests\nand\nFor v5 we Passed \n{1} tests\n\" -f $v4code.PassedCount, $v5code.PassedCount\n    Write-PSFMessage -Message $Message -Level Warning\n}\nelse {\n    $message = \"\nThe Total Tests Passed are the same {0} {1} \" -f $v4code.PassedCount, $v5code.PassedCount\n    Write-PSFMessage -Message $Message -Level Output\n}\n\n\nIf ($v5code.FailedCount -ne $v4code.FailedCount) {\n    $Message = \"\nUh-Oh - The total tests Failed between v4 and v5 are not the same somehow.\nFor v4 We Failed \n{0} tests\nand\nFor v5 we Failed \n{1} tests\n\" -f $v4code.FailedCount, $v5code.FailedCount\n    Write-PSFMessage -Message $Message -Level Warning\n}\nelse {\n    $message = \"\nThe Total Tests Failed are the same {0} {1} \" -f $v4code.FailedCount, $v5code.FailedCount\n    Write-PSFMessage -Message $Message -Level Output\n}\n\nIf ($v5code.SkippedCount -ne $v4code.SkippedCount) {\n    $Message = \"\nUh-Oh - The total tests Skipped between v4 and v5 are not the same somehow.\nFor v4 We Skipped \n{0} tests\nand\nFor v5 we Skipped \n{1} tests\n\" -f $v4code.SkippedCount, $v5code.SkippedCount\n    Write-PSFMessage -Message $Message -Level Warning\n}\nelse {\n    $message = \"\nThe Total Tests Skipped are the same {0} {1} \"-f $v4code.SkippedCount, $v5code.SkippedCount\n    Write-PSFMessage -Message $Message -Level Output\n}\n\n\n}\n\n\n# $Checks = 'DbaOperator'\nInvoke-PerfAndValidateChecks -Checks 'VirtualLogFile'"
  },
  {
    "path": "developing/Archive/Validate v4 adn v5.ps1",
    "content": "## To Test performance - I pull the dbatools docker repo and cd to the samples/stackoverflow Directory\n\n## I changed the ports because I have some of them already running SQL\n\n##     line 17   - \"7401:1433\"\n##     line 34   - \"7402:1433\"\n##     line 52   - \"7403:1433\"\n\n#then docker compose up -d\n\n# cd to the root of dbachecks and checkout the pesterv5 branch\n<#\n\nRUN THIS SECTION MANUALLY IF YOU JUST IMPORT THE FUNCTION BELOW!\n\n    ipmo ./dbachecks.psd1\n\n$Checks = 'XESessionExists','XESessionStopped','XpCmdShellDisabled','WhoIsActiveInstalled','CLREnabled','TraceFlagsNotExpected','TraceFlagsExpected','TwoDigitYearCutoff','MaxDopInstance','ErrorLogCount','ModelDbGrowth','DefaultBackupCompression','SaExist','SaDisabled','SaRenamed','DefaultFilePath','AdHocDistributedQueriesEnabled','AdHocWorkload',  'DefaultTrace', 'OleAutomationProceduresDisabled', 'CrossDBOwnershipChaining', 'ScanForStartupProceduresDisabled', 'RemoteAccessDisabled', 'SQLMailXPsDisabled', 'DAC', 'OLEAutomation'\n$Checks = 'XESessionExists'\nCompare-v4andv5Results -Checks $Checks \n\n# if you need to see the details to see why the results are different\nCompare-v4andv5Results -Checks $Checks -Details\n\n#>\n<#\nWhen there are default skips (some of the CIS checks) we need to set the configs and check\n\nSet-DbcConfig skip.security.sadisabled -Value $false\nSet-DbcConfig skip.security.sadisabled -Value $true\nGet-DbcConfigValue skip.security.sadisabled\n\nSet-DbcConfig skip.security.saexist -Value $false\nSet-DbcConfig skip.security.saexist -Value $true\nGet-DbcConfigValue skip.security.saexist\n\n\nGet-DbcConfigValue policy.instancemaxdop.userecommended\nGet-DbcConfigValue policy.instancemaxdop.maxdop\nGet-DbcConfigValue policy.instancemaxdop.excludeinstance\n\nSet-DbcConfig policy.instancemaxdop.userecommended -Value $false\nSet-DbcConfig policy.instancemaxdop.userecommended -Value $true\nSet-DbcConfig policy.instancemaxdop.maxdop -Value 0\nSet-DbcConfig policy.instancemaxdop.excludeinstance -Value $null\nSet-DbcConfig policy.instancemaxdop.excludeinstance -Value 'localhost,7402'\n\nGet-DbcConfigValue policy.traceflags.expected\nGet-DbaTraceFlag -SqlInstance $Sqlinstances -SqlCredential $cred\nSet-DbcConfig policy.traceflags.expected -Value 1117,1118\nSet-DbcConfig policy.traceflags.expected -Value $null\n\nEnable-DbaTraceFlag -SqlInstance $Sqlinstances -SqlCredential $cred -TraceFlag 1117,1118\nDisable-DbaTraceFlag -SqlInstance $Sqlinstances -SqlCredential $cred -TraceFlag 1117,1118\nDisable-DbaTraceFlag -SqlInstance $Sqlinstances -SqlCredential $cred -TraceFlag 1118\n\nGet-DbcConfigValue policy.traceflags.expected\nGet-DbcConfigValue policy.traceflags.notexpected\nGet-DbaTraceFlag -SqlInstance $Sqlinstances -SqlCredential $cred\nSet-DbcConfig policy.traceflags.expected -Value 1117,1118\nSet-DbcConfig policy.traceflags.notexpected -Value 1117,1118\nSet-DbcConfig policy.traceflags.expected -Value $null\nSet-DbcConfig policy.traceflags.notexpected -Value $null\n\nEnable-DbaTraceFlag -SqlInstance $Sqlinstances -SqlCredential $cred -TraceFlag 1117,1118\nDisable-DbaTraceFlag -SqlInstance $Sqlinstances -SqlCredential $cred -TraceFlag 1117,1118\nDisable-DbaTraceFlag -SqlInstance $Sqlinstances -SqlCredential $cred -TraceFlag 1118\n\n#>\n\n# Load the function below and then you can keep running the checks defined above in v4 and v5 and compare the performance\n# You can keep updating the .Tests.ps1 files and rerunning the function without needing to re-import hte module\n\n# You can keep updating the .Tests.ps1 files and rerunning  without needing to re-import hte module\n\n# If you change any of the functions you WILL need to re-import or better still use a new session\n\n# If you get odd results - or you dont get any checks run\n\n# run the import module and the Invoke Dbc Check with Verbose and that might show you New-Json messing \n# with your files or that you are looking in PSModulePath instead of Git Repo path (run Reset-dbcConfig to fix that)\n\n\nfunction Compare-v4andv5Results {\n    param(\n        $Checks, \n        [switch]$details\n    )\n\n\n    $password = ConvertTo-SecureString \"dbatools.IO\" -AsPlainText -Force\n    $cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"sqladmin\", $password\n    $Sqlinstances = 'localhost,7401', 'localhost,7402', 'localhost,7403'\n\n    if ($details) {\n        $show = 'all'\n    } else {\n        $show = 'none'\n    }\n    \n    # Run v4 checks\n    $v4code = Invoke-DbcCheck -SqlInstance $Sqlinstances -SqlCredential $cred -Check $Checks -legacy $true -Show $show -PassThru\n    # Run v5 checks\n    $v5code = Invoke-DbcCheck -SqlInstance $Sqlinstances -SqlCredential $cred -Check $Checks -legacy $false -Show $show -PassThru\n\n    If (Compare-Object $v5code.Configuration.Filter.Tag.Value $v4code.TagFilter) {\n        $Message = \"\nUh-Oh - The Tag filters between v4 and v5 are not the same somehow.\nFor v4 We returned\n{0}\nand\nFor v5 we returned\n{1}\n    \" -f ($v4code.TagFilter | Out-String), ($v5code.Configuration.Filter.Tag.Value | Out-String)\n        Write-PSFMessage -Message $Message -Level Warning\n    }\n    else {\n        $message = \"\n    The Tags are the same\"\n        Write-PSFMessage -Message $Message -Level Output\n    }\n\n    If (($v5code.TotalCount - $v5code.NotRunCount) -ne $v4code.TotalCount) {\n        $Message = \"\nUh-Oh - The total tests run between v4 and v5 are not the same somehow.\nFor v4 We ran\n{0} tests\nand\nFor v5 we ran\n{1} tests\nThe MOST COMMON REASON IS you have used Tags instead of Tag in your Describe block\nbut TraceFlagsNotExpected will change that also\n    \" -f $v4code.TotalCount, ($v5code.TotalCount - $v5code.NotRunCount)\n        Write-PSFMessage -Message $Message -Level Warning\n    }\n    else {\n        $message = \"\n    The Total Tests Run are the same {0} {1} \" -f $v4code.TotalCount, ($v5code.TotalCount - $v5code.NotRunCount)\n        Write-PSFMessage -Message $Message -Level Output\n    }\n\n    If ($v5code.PassedCount -ne $v4code.PassedCount) {\n        $Message = \"\nUh-Oh - The total tests Passed between v4 and v5 are not the same somehow.\nFor v4 We Passed \n{0} tests\nand\nFor v5 we Passed \n{1} tests\n    \" -f $v4code.PassedCount, $v5code.PassedCount\n        Write-PSFMessage -Message $Message -Level Warning\n    }\n    else {\n        $message = \"\n    The Total Tests Passed are the same {0} {1} \" -f $v4code.PassedCount, $v5code.PassedCount\n        Write-PSFMessage -Message $Message -Level Output\n    }\n \n\n    If ($v5code.FailedCount -ne $v4code.FailedCount) {\n        $Message = \"\nUh-Oh - The total tests Failed between v4 and v5 are not the same somehow.\nFor v4 We Failed \n{0} tests\nand\nFor v5 we Failed \n{1} tests\n    \" -f $v4code.FailedCount, $v5code.FailedCount\n        Write-PSFMessage -Message $Message -Level Warning\n    }\n    else {\n        $message = \"\n    The Total Tests Failed are the same {0} {1} \" -f $v4code.FailedCount, $v5code.FailedCount\n        Write-PSFMessage -Message $Message -Level Output\n    }\n\n    If ($v5code.SkippedCount -ne $v4code.SkippedCount) {\n        $Message = \"\nUh-Oh - The total tests Skipped between v4 and v5 are not the same somehow.\nFor v4 We Skipped \n{0} tests\nand\nFor v5 we Skipped \n{1} tests\n    \" -f $v4code.SkippedCount, $v5code.SkippedCount\n        Write-PSFMessage -Message $Message -Level Warning\n    }\n    else {\n        $message = \"\n    The Total Tests Skipped are the same {0} {1} \"-f $v4code.SkippedCount, $v5code.SkippedCount\n        Write-PSFMessage -Message $Message -Level Output\n    }\n \n}\n\n<#e\n$password = ConvertTo-SecureString \"dbatools.IO\" -AsPlainText -Force\n$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"sqladmin\", $password\n$Sqlinstances = 'localhost,7401', 'localhost,7402', 'localhost,7403'\nInvoke-DbcCheck -SqlInstance $Sqlinstances -SqlCredential $cred -Check $Checks -legacy $false\nInvoke-DbcCheck -SqlInstance $Sqlinstances -SqlCredential $cred -Check $Checks -legacy $true \n\n$smo = $Instance = Connect-DbaInstance -Sqlinstance $SqlInstances[0] -SqlCredential $cred\n#>"
  },
  {
    "path": "developing/Archive/initfields.ps1",
    "content": "# uses Jakubs Profiler Module - Install-Module Profiler\n$withinitFIeldsSMO = {\n    $password = ConvertTo-SecureString \"dbatools.IO\" -AsPlainText -Force\n    $cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"sqladmin\", $password\n    \n    $Sqlinstances = 'localhost,7401', 'localhost,7402', 'localhost,7403'\n    $smos = Connect-DbaInstance -SqlInstance $Sqlinstances -SqlCredential $cred \n    \n    foreach ($smo in $smos) {\n        $smo.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Server], $false)\n        $smo.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Database], $false)\n        $smo.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Login], $false)\n        $smo.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Agent.Job], $false)\n        $initfields = $smo.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Server])\n        $initfields.Add(\"Collation\")\n        $smo.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Server], $initfields)\n        $dbinitfields = $smo.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Database])\n        $dbinitfields.Add(\"Collation\")\n        $smo.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Database], $initfields)\n    \n        [PSCustomObject]@{\n            ComputerName = $smo.ComputerName\n            InstanceName = $smo.DbaInstanceName\n            Collation    = $smo.Collation\n            Databases    = $Smo.Databases.ForEach{\n                [PSCustomObject]@{\n                    Name      = $_.Name\n                    Collation = $_.Collation\n                }\n            \n            }\n        }\n    }\n}\n\n$WithoutInitFieldsSMO = {\n    $password = ConvertTo-SecureString \"dbatools.IO\" -AsPlainText -Force\n    $cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"sqladmin\", $password\n    \n    $Sqlinstances = 'localhost,7401', 'localhost,7402', 'localhost,7403'\n    $smos = Connect-DbaInstance -SqlInstance $Sqlinstances -SqlCredential $cred\n    foreach ($smo in $smos) {\n        [PSCustomObject]@{\n            ComputerName = $smo.ComputerName\n            InstanceName = $smo.DbaInstanceName\n            Collation    = $smo.Collation\n            Databases    = $Smo.Databases.ForEach{\n                [PSCustomObject]@{\n                    Name      = $_.Name\n                    Collation = $_.Collation\n                }\n            \n            }\n        }\n    }\n}\n\n$justdbatools = {\n    $password = ConvertTo-SecureString \"dbatools.IO\" -AsPlainText -Force\n    $cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"sqladmin\", $password\n    \n    $Sqlinstances = 'localhost,7401', 'localhost,7402', 'localhost,7403'\n    $smos = Connect-DbaInstance -SqlInstance $Sqlinstances -SqlCredential $cred\n\n    foreach($smo in $smos){\n        $collation = Test-DbaDbCollation -SqlInstance $smo\n\n        [PSCustomObject]@{\n            ComputerName = $smo.ComputerName\n            InstanceName = $smo.DbaInstanceName\n            Collation    = $collation[0].ServerCollation\n            Databases    = $collation.ForEach{\n                [PSCustomObject]@{\n                    Name      = $_.Database\n                    Collation = $_.DatabaseCollation\n                }\n            }\n        }\n    }\n    \n}\n\n# so the initial load doesnt skew the figures\nipmo dbatools\nfunction prompt { Write-Host \"pwsh >\" -NoNewline; ' '}\n\n$justdbatoolstrace = Trace-Script -ScriptBlock $justdbatools\n$WithoutInittrace = Trace-Script -ScriptBlock $WithoutInitFieldsSMO \n$withinittrace = Trace-Script -ScriptBlock $withinitFIeldsSMO \n\n\n$dbatoolsMessage = \"With dbatools it takes {0} MilliSeconds\" -f $justdbatoolstrace.StopwatchDuration.TotalMilliseconds\n$withinittMessage = \"With initfields and SMO it takes {0} MilliSeconds\" -f $withinittrace.StopwatchDuration.TotalMilliseconds\n$WithoutInitMessage = \"Without initfields and SMO it takes {0} MilliSeconds\" -f $WithoutInittrace.StopwatchDuration.TotalMilliseconds\n\nWrite-PSFMessage -Message $dbatoolsMessage -Level Significant\nWrite-PSFMessage -Message $WithoutInitMessage -Level Significant\nWrite-PSFMessage -Message $withinittMessage -Level Significant\n\n<#\npwsh > Write-PSFMessage -Message $dbatoolsMessage -Level Significant\n[10:36:20][<ScriptBlock>] With dbatools it takes 308.9962 MilliSeconds\npwsh > Write-PSFMessage -Message $WithoutInitMessage -Level Significant\n[10:36:20][<ScriptBlock>] Without initfields and SMO it takes 270.5188 MilliSeconds\npwsh > Write-PSFMessage -Message $withinittMessage -Level Significant\n[10:36:20][<ScriptBlock>] With initfields and SMO it takes 117.5935 MilliSeconds\n\n#>\n\n\n$10timesWithInit = Invoke-Script -ScriptBlock $withinitFIeldsSMO -Preheat 0 -Repeat 10 \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n# We run Pester V4 here because the -legacy parameter of Invoke-DbcCheck is set to true by default\n$password = ConvertTo-SecureString \"dbatools.IO\" -AsPlainText -Force\n$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"sqladmin\", $password\n\n$Sqlinstances = 'localhost,7401', 'localhost,7402', 'localhost,7403'\n$smos = Connect-DbaInstance -SqlInstance $Sqlinstances -SqlCredential $cred \n\n$Fields2000_Db = 'Collation', 'CompatibilityLevel', 'CreateDate', 'ID', 'IsAccessible', 'IsFullTextEnabled', 'IsSystemObject', 'IsUpdateable', 'LastBackupDate', 'LastDifferentialBackupDate', 'LastLogBackupDate', 'Name', 'Owner', 'ReadOnly', 'RecoveryModel', 'ReplicationOptions', 'Status', 'Version'\n$Fields200x_Db = $Fields2000_Db + @('BrokerEnabled', 'DatabaseSnapshotBaseName', 'IsMirroringEnabled', 'Trustworthy')\n$Fields201x_Db = $Fields200x_Db + @('ActiveConnections', 'AvailabilityDatabaseSynchronizationState', 'AvailabilityGroupName', 'ContainmentType', 'EncryptionEnabled')\n\n$Fields2000_Login = 'CreateDate', 'DateLastModified', 'DefaultDatabase', 'DenyWindowsLogin', 'IsSystemObject', 'Language', 'LanguageAlias', 'LoginType', 'Name', 'Sid', 'WindowsLoginAccessType'\n$Fields200x_Login = $Fields2000_Login + @('AsymmetricKey', 'Certificate', 'Credential', 'ID', 'IsDisabled', 'IsLocked', 'IsPasswordExpired', 'MustChangePassword', 'PasswordExpirationEnabled', 'PasswordPolicyEnforced')\n$Fields201x_Login = $Fields200x_Login + @('PasswordHashAlgorithm')\n\n#see #7753\n$Fields_Job = 'LastRunOutcome', 'CurrentRunStatus', 'CurrentRunStep', 'CurrentRunRetryAttempt', 'NextRunScheduleID', 'NextRunDate', 'LastRunDate', 'JobType', 'HasStep', 'HasServer', 'CurrentRunRetryAttempt', 'HasSchedule', 'Category', 'CategoryID', 'CategoryType', 'OperatorToEmail', 'OperatorToNetSend', 'OperatorToPage'\n\n\n$initFieldsDb = New-Object System.Collections.Specialized.StringCollection\n$initFieldsLogin = New-Object System.Collections.Specialized.StringCollection\n$initFieldsJob = New-Object System.Collections.Specialized.StringCollection\n\n"
  },
  {
    "path": "developing/Archive/originalGet-AllInstanceInfo.ps1",
    "content": "function Get-AllInstanceInfo {\n    # Using the unique tags gather the information required\n    Param($Instance, $Tags, $There)\n    # Using there so that if the instance is not contactable, no point carrying on with gathering more information\n    switch ($tags) {\n        'ErrorLog' {\n            if ($There) {\n                try {\n                    $logWindow = Get-DbcConfigValue -Name policy.errorlog.warningwindow\n                    # so that it can be mocked\n                    function Get-ErrorLogEntry {\n                        # get the number of the first error log that was created after the log window config\n                        $OldestErrorLogNumber = ($InstanceSMO.EnumErrorLogs() | Where-Object { $psitem.CreateDate -gt (Get-Date).AddDays( - $LogWindow) } | Sort-Object ArchiveNo -Descending | Select-Object -First 1).ArchiveNo + 1\n                        # Get the Error Log entries for each one\n                        (0..$OldestErrorLogNumber).ForEach{\n                            $InstanceSMO.ReadErrorLog($psitem).Where{ $_.Text -match \"Severity: 1[7-9]|Severity: 2[0-4]\" }\n                        }\n                    }\n                    # It is not enough to check the CreateDate on the log, you must check the LogDate on every error record as well.\n                    $ErrorLog = @(Get-ErrorLogEntry).ForEach{\n                        [PSCustomObject]@{\n                            LogDate     = $psitem.LogDate\n                            ProcessInfo = $Psitem.ProcessInfo\n                            Text        = $Psitem.Text\n                        } | Where-Object { $psitem.LogDate -gt (Get-Date).AddDays( - $LogWindow) }\n                    }\n                }\n                catch {\n                    $There = $false\n                    $ErrorLog = [PSCustomObject]@{\n                        LogDate      = 'Do not know the Date'\n                        ProcessInfo  = 'Do not know the Process'\n                        Text         = 'Do not know the Test'\n                        InstanceName = 'An Error occurred ' + $Instance\n                    }\n                }\n            }\n            else {\n                $There = $false\n                $ErrorLog = [PSCustomObject]@{\n                    LogDate      = 'Do not know the Date'\n                    ProcessInfo  = 'Do not know the Process'\n                    Text         = 'Do not know the Test'\n                    InstanceName = 'An Error occurred ' + $Instance\n                }\n            }\n        }\n        'DefaultTrace' {\n            if ($There) {\n                try {\n                    $SpConfig = Get-DbaSpConfigure -SqlInstance $Instance -ConfigName 'DefaultTraceEnabled'\n                    $DefaultTrace = [pscustomobject] @{\n                        ConfiguredValue = $SpConfig.ConfiguredValue\n                    }\n                }\n                catch {\n                    $There = $false\n                    $DefaultTrace = [pscustomobject] @{\n                        ConfiguredValue = 'We Could not Connect to $Instance'\n                    }\n                }\n            }\n            else {\n                $There = $false\n                $DefaultTrace = [pscustomobject] @{\n                    ConfiguredValue = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n\n        'OleAutomationProceduresDisabled' {\n            if ($There) {\n                try {\n                    $SpConfig = Get-DbaSpConfigure -SqlInstance $Instance -ConfigName 'OleAutomationProceduresEnabled'\n                    $OleAutomationProceduresDisabled = [pscustomobject] @{\n                        ConfiguredValue = $SpConfig.ConfiguredValue\n                    }\n                }\n                catch {\n                    $There = $false\n                    $OleAutomationProceduresDisabled = [pscustomobject] @{\n                        ConfiguredValue = 'We Could not Connect to $Instance'\n                    }\n                }\n            }\n            else {\n                $There = $false\n                $OleAutomationProceduresDisabled = [pscustomobject] @{\n                    ConfiguredValue = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n\n        'CrossDBOwnershipChaining' {\n            if ($There) {\n                try {\n                    $SpConfig = Get-DbaSpConfigure -SqlInstance $Instance -ConfigName 'CrossDBOwnershipChaining'\n                    $CrossDBOwnershipChaining = [pscustomobject] @{\n                        ConfiguredValue = $SpConfig.ConfiguredValue\n                    }\n                }\n                catch {\n                    $There = $false\n                    $CrossDBOwnershipChaining = [pscustomobject] @{\n                        ConfiguredValue = 'We Could not Connect to $Instance'\n                    }\n                }\n            }\n            else {\n                $There = $false\n                $CrossDBOwnershipChaining = [pscustomobject] @{\n                    ConfiguredValue = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n\n        'ScanForStartupProceduresDisabled' {\n            if ($There) {\n                try {\n                    $SpConfig = Get-DbaSpConfigure -SqlInstance $Instance -ConfigName 'ScanForStartupProcedures'\n\n                    $query = \"\n                        SELECT name\n                        FROM sys.procedures\n                        WHERE OBJECTPROPERTY(OBJECT_ID, 'ExecIsStartup') = 1\n                            AND name <> 'sp_MSrepl_startup'\"\n                    $results = Invoke-DbaQuery -SqlInstance $Instance -Query $query\n\n                    if ($null -eq $results)  {\n                        $Value = 0\n                    } else {\n                        $Value = $SpConfig.ConfiguredValue\n                    }\n\n                    $ScanForStartupProceduresDisabled = [pscustomobject] @{\n                        ConfiguredValue = $Value\n                    }\n                }\n                catch {\n                    $There = $false\n                    $ScanForStartupProceduresDisabled = [pscustomobject] @{\n                        ConfiguredValue = 'We Could not Connect to $Instance'\n                    }\n                }\n            }\n            else {\n                $There = $false\n                $ScanForStartupProceduresDisabled = [pscustomobject] @{\n                    ConfiguredValue = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n        'MemoryDump' {\n            if ($There) {\n                try {\n                    $daystocheck = Get-DbcConfigValue policy.instance.memorydumpsdaystocheck\n                    if ($null -eq $daystocheck) {\n                        $datetocheckfrom = '0001-01-01'\n                    }\n                    else {\n                        $datetocheckfrom = (Get-Date).ToUniversalTime().AddDays( - $daystocheck )\n                    }\n                    $MaxDump = [pscustomobject] @{\n                        # Warning Action removes dbatools output for version too low from test results\n                        # Skip on the it will show in the results\n                        Count = (@(Get-DbaDump -SqlInstance $Instance -WarningAction SilentlyContinue).Where{ $_.CreationTime -gt $datetocheckfrom}).Count\n                    }\n                }\n                catch {\n                    $There = $false\n                    $MaxDump = [pscustomobject] @{\n                        Count = 'We Could not Connect to $Instance'\n                    }\n                }\n            }\n            else {\n                $There = $false\n                $MaxDump = [pscustomobject] @{\n                    Count = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n\n        'RemoteAccessDisabled' {\n            if ($There) {\n                try {\n                    $SpConfig = Get-DbaSpConfigure -SqlInstance $Instance -ConfigName 'RemoteAccess'\n                    $RemoteAccessDisabled = [pscustomobject] @{\n                        ConfiguredValue = $SpConfig.ConfiguredValue\n                    }\n                }\n                catch {\n                    $There = $false\n                    $RemoteAccessDisabled = [pscustomobject] @{\n                        ConfiguredValue = 'We Could not Connect to $Instance'\n                    }\n                }\n            }\n            else {\n                $There = $false\n                $RemoteAccessDisabled = [pscustomobject] @{\n                    ConfiguredValue = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n\n        'LatestBuild' {\n            if ($There) {\n                try {\n                    $results = Test-DbaBuild -SqlInstance $Instance -Latest\n                    $LatestBuild = [pscustomobject] @{\n                        Compliant = $results.Compliant\n                    }\n                }\n                catch {\n                    $There = $false\n                    $LatestBuild = [pscustomobject] @{\n                        Compliant = 'We Could not Connect to $Instance'\n                    }\n                }\n            }\n            else {\n                $There = $false\n                $LatestBuild = [pscustomobject] @{\n                    Compliant = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n        'SaDisabled' {\n            if ($There) {\n                try {\n                    #This needs to be done in query just in case the account had already been renamed\n                    $login = Get-DbaLogin -SqlInstance $Instance | Where-Object Id -eq 1\n                    $SaDisabled = [pscustomobject] @{\n                        Disabled = $login.IsDisabled\n                    }\n                }\n                catch {\n                    $There = $false\n                    $SaDisabled = [pscustomobject] @{\n                        Disabled = 'We Could not Connect to $Instance'\n                    }\n                }\n            }\n            else {\n                $There = $false\n                $SaDisabled = [pscustomobject] @{\n                    Disabled = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n        'SaExist' {\n            if ($There) {\n                try {\n                    $SaExist = [pscustomobject] @{\n                        Exist = @(Get-DbaLogin -SqlInstance $Instance -Login sa).Count\n                    }\n                }\n                catch {\n                    $There = $false\n                    $SaExist = [pscustomobject] @{\n                        Exist = 'We Could not Connect to $Instance'\n                    }\n                }\n            }\n            else {\n                $There = $false\n                $SaExist = [pscustomobject] @{\n                    Exist = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n        'SqlEngineServiceAccount' {\n            if ($There) {\n                try {\n                    $ComputerName , $InstanceName = $Instance.Name.Split('\\')\n                    if ($null -eq $InstanceName) {\n                        $InstanceName = 'MSSQLSERVER'\n                    }\n                    $SqlEngineService = Get-DbaService -ComputerName $ComputerName -InstanceName $instanceName -Type Engine -ErrorAction SilentlyContinue\n                    $EngineService = [pscustomobject] @{\n                        State     = $SqlEngineService.State\n                        StartType = $SqlEngineService.StartMode\n                    }\n                }\n                catch {\n                    $There = $false\n                    $EngineService = [pscustomobject] @{\n                        State     = 'We Could not Connect to $Instance $ComputerName , $InstanceName from catch'\n                        StartType = 'We Could not Connect to $Instance $ComputerName , $InstanceName from catch'\n                    }\n                }\n            }\n            else {\n                $There = $false\n                $EngineService = [pscustomobject] @{\n                    State     = 'We Could not Connect to $Instance'\n                    StartType = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n        'PublicRolePermission' {\n            if ($There) {\n                try {\n                    #This needs to be done in query just in case the account had already been renamed\n                    $query = \"\n                        SELECT Count(*) AS [RowCount]\n                        FROM master.sys.server_permissions\n                        WHERE (grantee_principal_id = SUSER_SID(N'public') and state_desc LIKE 'GRANT%')\n                            AND NOT (state_desc = 'GRANT' and [permission_name] = 'VIEW ANY DATABASE' and class_desc = 'SERVER')\n                            AND NOT (state_desc = 'GRANT' and [permission_name] = 'CONNECT' and class_desc = 'ENDPOINT' and major_id = 2)\n                            AND NOT (state_desc = 'GRANT' and [permission_name] = 'CONNECT' and class_desc = 'ENDPOINT' and major_id = 3)\n                            AND NOT (state_desc = 'GRANT' and [permission_name] = 'CONNECT' and class_desc = 'ENDPOINT' and major_id = 4)\n                            AND NOT (state_desc = 'GRANT' and [permission_name] = 'CONNECT' and class_desc = 'ENDPOINT' and major_id = 5);\n                        \"\n                    $results = Invoke-DbaQuery -SqlInstance $Instance -Query $query\n\n                    $PublicRolePermission = [pscustomobject] @{\n                        Count = $results.RowCount\n                    }\n                }\n                catch {\n                    $There = $false\n                    $PublicRolePermission = [pscustomobject] @{\n                        Count = 'We Could not Connect to $Instance'\n                    }\n                }\n            }\n            else {\n                $There = $false\n                $PublicRolePermission = [pscustomobject] @{\n                    Count = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n        'BuiltInAdmin' {\n            if ($There) {\n                try {\n                    $BuiltInAdmin = [pscustomobject] @{\n                        Exist = @(Get-DbaLogin -SqlInstance $Instance -Login \"BUILTIN\\Administrators\").Count\n                    }\n                }\n                catch {\n                    $There = $false\n                    $BuiltInAdmin = [pscustomobject] @{\n                        Exist = 'We Could not Connect to $Instance'\n                    }\n                }\n            }\n            else {\n                $There = $false\n                $BuiltInAdmin = [pscustomobject] @{\n                    Exist = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n        'LocalWindowsGroup' {\n            if ($There) {\n                try {\n                    $ComputerName, $InstanceName = $Instance.Name.Split('\\')\n                    if ($null -eq $InstanceName){\n                        $InstanceName = 'MSSQLSERVER'\n                    }\n                    $logins = Get-DbaLogin -SqlInstance $Instance | Where-Object {$_.LoginType -eq 'WindowsGroup' -and $_.Name.Split('\\') -eq $ComputerName}\n                    if ($null -ne $logins) {\n                        $LocalWindowsGroup = [pscustomobject] @{\n                            Exist = $true\n                        }\n                    }\n                    else {\n                        $LocalWindowsGroup = [pscustomobject] @{\n                            Exist = $false\n                        }\n                    }\n                }\n                catch {\n                    $There = $false\n                    $LocalWindowsGroup = [pscustomobject] @{\n                        Exist = 'We Could not Connect to $Instance'\n                    }\n                }\n            }\n            else {\n                $There = $false\n                $LocalWindowsGroup = [pscustomobject] @{\n                    Exist = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n        'LoginAuditFailed' {\n            if ($There) {\n                try {\n                    $results = Get-DbaInstanceProperty -SQLInstance $instance -InstanceProperty AuditLevel\n                    $LoginAuditFailed = [pscustomobject] @{\n                        AuditLevel = $results.Value\n                    }\n                }\n                catch {\n                    $There = $false\n                    $LoginAuditFailed = [pscustomobject] @{\n                        AuditLevel = 'We Could not Connect to $Instance'\n                    }\n                }\n            }\n            else {\n                $There = $false\n                $LoginAuditFailed = [pscustomobject] @{\n                    AuditLevel = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n\n        'LoginAuditSuccessful' {\n            if ($There) {\n                try {\n                    $results = Get-DbaInstanceProperty -SQLInstance $instance -InstanceProperty AuditLevel\n                    $LoginAuditSuccessful = [pscustomobject] @{\n                        AuditLevel = $results.Value\n                    }\n                }\n                catch {\n                    $There = $false\n                    $LoginAuditSuccessful = [pscustomobject] @{\n                        AuditLevel = 'We Could not Connect to $Instance'\n                    }\n                }\n            }\n            else {\n                $There = $false\n                $LoginAuditSuccessful = [pscustomobject] @{\n                    AuditLevel = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n\n        'SqlAgentProxiesNoPublicRole' {\n            if ($There) {\n                try {\n                    $SqlAgentProxiesWithPublicRole = @()\n\n                    Get-DbaAgentProxy -SqlInstance $Instance | ForEach-Object {\n                        if ($psitem.EnumMsdbRoles().Name -contains 'public') {\n                            $SqlAgentProxyWithPublicRole = [pscustomobject] @{\n                                Name               = $psitem.Name\n                                CredentialName     = $psitem.CredentialName\n                                CredentialIdentity = $psitem.CredentialIdentity\n                            }\n                            $SqlAgentProxiesWithPublicRole += $SqlAgentProxyWithPublicRole\n                        }\n                    }\n                }\n                catch {\n                    $There = $false\n                    $SqlAgentProxiesWithPublicRole = [pscustomobject] @{\n                        Name               = 'We Could not Connect to $Instance'\n                        CredentialName     = $null\n                        CredentialIdentity = $null\n                    }\n                }\n            }\n            else {\n                $There = $false\n                $SqlAgentProxiesWithPublicRole = [pscustomobject] @{\n                    Name               = 'We Could not Connect to $Instance'\n                    CredentialName     = $null\n                    CredentialIdentity = $null\n                }\n            }\n        }\n        'HideInstance' {\n            if ($There) {\n                try {\n                    $results = Get-DbaHideInstance -SqlInstance $Instance\n\n                    $HideInstance = [pscustomobject] @{\n                        HideInstance = $results.HideInstance\n                    }\n                }\n                catch {\n                    $There = $false\n                    $HideInstance = [pscustomobject] @{\n                        HideInstance = 'We Could not Connect to $Instance'\n                    }\n                }\n            }\n            else {\n                $There = $false\n                $HideInstance = [pscustomobject] @{\n                    HideInstance = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n\n        'EngineServiceAdmin' {\n            if ($There) {\n                if ($IsLinux) {\n                    $EngineServiceAdmin = [pscustomobject] @{\n                        Exist = 'We Cant Check running on Linux'\n                    }\n                }\n                else {\n                    try {\n                        $ComputerName , $InstanceName = $Instance.Name.Split('\\')\n                        if ($null -eq $InstanceName) {\n                            $InstanceName = 'MSSQLSERVER'\n                        }\n                        $SqlEngineService = Get-DbaService -ComputerName $ComputerName -InstanceName $instanceName -Type Engine -ErrorAction SilentlyContinue\n                        $LocalAdmins = Invoke-Command -ComputerName $ComputerName -ScriptBlock { Get-LocalGroupMember -Group \"Administrators\" } -ErrorAction SilentlyContinue\n\n                        $EngineServiceAdmin = [pscustomobject] @{\n                            Exist = $localAdmins.Name.Contains($SqlEngineService.StartName)\n                        }\n                    }\n                    catch [System.Exception] {\n                        if ($_.Exception.Message -like '*No services found in relevant namespaces*') {\n                            $EngineServiceAdmin = [pscustomobject] @{\n                                Exist = $false\n                            }\n                        }\n                        else {\n                            $EngineServiceAdmin = [pscustomobject] @{\n                                Exist = 'Some sort of failure'\n                            }\n                        }\n                    }\n                    catch {\n                        $There = $false\n                        $EngineServiceAdmin = [pscustomobject] @{\n                            Exist = 'We Could not Connect to $Instance $ComputerName , $InstanceName from catch'\n                        }\n                    }\n                }\n            }\n            else {\n                $There = $false\n                $EngineServiceAdmin = [pscustomobject] @{\n                    Exist = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n\n        'AgentServiceAdmin' {\n            if ($There) {\n                if ($IsLinux) {\n                    $AgentServiceAdmin = [pscustomobject] @{\n                        Exist = 'We Cant Check running on Linux'\n                    }\n                }\n                else {\n                    try {\n                        $ComputerName , $InstanceName = $Instance.Name.Split('\\')\n                        if ($null -eq $InstanceName) {\n                            $InstanceName = 'MSSQLSERVER'\n                        }\n                        $SqlAgentService = Get-DbaService -ComputerName $ComputerName -InstanceName $instanceName -Type Agent -ErrorAction SilentlyContinue\n                        $LocalAdmins = Invoke-Command -ComputerName $ComputerName -ScriptBlock { Get-LocalGroupMember -Group \"Administrators\" } -ErrorAction SilentlyContinue\n\n                        $AgentServiceAdmin = [pscustomobject] @{\n                            Exist = $localAdmins.Name.Contains($SqlAgentService.StartName)\n                        }\n                    }\n                    catch [System.Exception] {\n                        if ($_.Exception.Message -like '*No services found in relevant namespaces*') {\n                            $AgentServiceAdmin = [pscustomobject] @{\n                                Exist = $false\n                            }\n                        }\n                        else {\n                            $AgentServiceAdmin = [pscustomobject] @{\n                                Exist = 'Some sort of failure'\n                            }\n                        }\n                    }\n                    catch {\n                        $There = $false\n                        $AgentServiceAdmin = [pscustomobject] @{\n                            Exist = 'We Could not Connect to $Instance $ComputerName , $InstanceName from catch'\n                        }\n                    }\n                }\n            }\n            else {\n                $There = $false\n                $AgentServiceAdmin = [pscustomobject] @{\n                    Exist = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n\n        'FullTextServiceAdmin' {\n            if ($There) {\n                if ($IsLinux) {\n                    $FullTextServiceAdmin = [pscustomobject] @{\n                        Exist = 'We Cant Check running on Linux'\n                    }\n                }\n                else {\n                    try {\n                        $ComputerName , $InstanceName = $Instance.Name.Split('\\')\n                        if ($null -eq $InstanceName) {\n                            $InstanceName = 'MSSQLSERVER'\n                        }\n                        $SqlFullTextService = Get-DbaService -ComputerName $ComputerName -InstanceName $instanceName -Type FullText -ErrorAction SilentlyContinue -WarningAction SilentlyContinue -WarningVariable WarVar\n                        $LocalAdmins = Invoke-Command -ComputerName $ComputerName -ScriptBlock { Get-LocalGroupMember -Group \"Administrators\" } -ErrorAction SilentlyContinue\n                        $FullTextServiceAdmin = [pscustomobject] @{\n                            Exist = $localAdmins.Name.Contains($SqlFullTextService.StartName)\n                        }\n                    }\n                    catch [System.Exception] {\n                        if ($_.Exception.Message -like '*No services found in relevant namespaces*') {\n                            $FullTextServiceAdmin = [pscustomobject] @{\n                                Exist = $false\n                            }\n                        }\n                        else {\n                            $FullTextServiceAdmin = [pscustomobject] @{\n                                Exist = 'Some sort of failure'\n                            }\n                        }\n                    }\n                    catch {\n                        $There = $false\n                        $FullTextServiceAdmin = [pscustomobject] @{\n                            Exist = \"We Could not Connect to $Instance $ComputerName , $InstanceName from catch\"\n                        }\n                    }\n                }\n\n            }\n            else {\n                $There = $false\n                $FullTextServiceAdmin = [pscustomobject] @{\n                    Exist = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n\n        'LoginCheckPolicy' {\n            if ($There) {\n                try {\n                    $LoginCheckPolicy = [pscustomobject] @{\n                        Count = @(Get-DbaLogin -SQLInstance $instance -Type SQL | Where-Object { $_.PasswordPolicyEnforced -eq $false -and $_.IsDisabled -eq $false}).Count\n                    }\n                }\n                catch {\n                    $There = $false\n                    $LoginCheckPolicy = [pscustomobject] @{\n                        Count = 'We Could not Connect to $Instance'\n                    }\n                }\n            }\n            else {\n                $There = $false\n                $LoginCheckPolicy = [pscustomobject] @{\n                    Count = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n\n        'LoginPasswordExpiration' {\n            if ($There) {\n                try {\n                    $role = Get-DbaServerRole -SQLInstance $instance -ServerRole \"sysadmin\"\n\n                    $LoginPasswordExpiration = [pscustomobject] @{\n                        Count = @(Get-DbaLogin -SQLInstance $instance -Login @($role.Login) -Type SQL | Where-Object { $_.PasswordExpirationEnabled -eq $false -and $_.IsDisabled -eq $false}).Count\n                    }\n                }\n                catch {\n                    $There = $false\n                    $LoginPasswordExpiration = [pscustomobject] @{\n                        Count = 'We Could not Connect to $Instance'\n                    }\n                }\n            }\n            else {\n                $There = $false\n                $LoginPasswordExpiration = [pscustomobject] @{\n                    Count = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n        'LoginMustChange' {\n            if ($There) {\n                try {\n                    $role = Get-DbaServerRole -SQLInstance $instance -ServerRole \"sysadmin\"\n\n                    $LoginMustChange = [pscustomobject] @{\n                        Count = @(Get-DbaLogin -SQLInstance $instance -Login @($role.Login) -Type SQL | Where-Object { $_.IsMustChange -eq $false -and $_.IsDisabled -eq $false -and $null -eq $_LastLogin }).Count\n                    }\n                }\n                catch {\n                    $There = $false\n                    $LoginMustChange = [pscustomobject] @{\n                        Count = 'We Could not Connect to $Instance'\n                    }\n                }\n            }\n            else {\n                $There = $false\n                $LoginMustChange = [pscustomobject] @{\n                    Count = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n\n        'SQLMailXPsDisabled' {\n            if ($There) {\n                try {\n                    $SpConfig = Get-DbaSpConfigure -SqlInstance $Instance -ConfigName 'SqlMailXPsEnabled'\n                    $SQLMailXPsDisabled = [pscustomobject] @{\n                        ConfiguredValue = $SpConfig.ConfiguredValue\n                    }\n                }\n                catch {\n                    $There = $false\n                    $SQLMailXPsDisabled = [pscustomobject] @{\n                        ConfiguredValue = 'We Could not Connect to $Instance'\n                    }\n                }\n            }\n            else {\n                $There = $false\n                $SQLMailXPsDisabled = [pscustomobject] @{\n                    ConfiguredValue = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n\n        Default { }\n    }\n    [PSCustomObject]@{\n        ErrorLog                         = $ErrorLog\n        DefaultTrace                     = $DefaultTrace\n        MaxDump                          = $MaxDump\n        CrossDBOwnershipChaining         = $CrossDBOwnershipChaining\n        ScanForStartupProceduresDisabled = $ScanForStartupProceduresDisabled\n        RemoteAccess                     = $RemoteAccessDisabled\n        OleAutomationProceduresDisabled  = $OleAutomationProceduresDisabled\n        LatestBuild                      = $LatestBuild\n        SaExist                          = $SaExist\n        SaDisabled                       = $SaDisabled\n        EngineService                    = $EngineService\n        SqlAgentProxiesWithPublicRole    = $SqlAgentProxiesWithPublicRole\n        HideInstance                     = $HideInstance\n        LoginAuditFailed                 = $LoginAuditFailed\n        LoginAuditSuccessful             = $LoginAuditSuccessful\n        EngineServiceAdmin               = $EngineServiceAdmin\n        AgentServiceAdmin                = $AgentServiceAdmin\n        FullTextServiceAdmin             = $FullTextServiceAdmin\n        LocalWindowsGroup                = $LocalWindowsGroup\n        BuiltInAdmin                     = $BuiltInAdmin\n        PublicRolePermission             = $PublicRolePermission\n        LoginCheckPolicy                 = $LoginCheckPolicy\n        LoginPasswordExpiration          = $LoginPasswordExpiration\n        LoginMustChange                  = $LoginMustChange\n        SQLMailXPsDisabled = $SQLMailXPsDisabled\n    }\n}"
  },
  {
    "path": "developing/Archive/pesterv5testing.ps1",
    "content": "## To Test pull the dbatools docker repo and cd to the samples/stackoverflow Directory\n\n## I changed the ports because I have some of them already running SQL\n\n##     line 17   - \"7401:1433\"\n##     line 34   - \"7402:1433\"\n##     line 52   - \"7403:1433\"\n\n#then docker compose up -d\n\n# cd to the root of dbachecks and checkout the pesterv5 branch\n\n\n<#\nWhat Is here\nSo I have removed the check for Pester v5 from the psm1 load\n\nand created 2 internal functions Invoke-DbcCheckv4 and Invoke-DbcCheckv5\n\nand added a legacy param to Invoke-DbcCheck\nby default it passes everything on to Invoke-DbcCheckv4 which is still the same as the original Invoke-DbcCheck so it shouldnt break anything\n\nSo If you can test original work with Pester v4 that would be great.\n\n#>\n\n ipmo ./dbachecks.psd1  -Verbose\n\n # We run Pester V4 here because the -legacy parameter of Invoke-DbcCheck is set to true by default\n$password = ConvertTo-SecureString \"dbatools.IO\" -AsPlainText -Force\n$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"sqladmin\", $password\n\n$PSDefaultParameterValues = @{\n\n    \"Invoke-DbcCheck:SqlInstance\" = 'localhost,7401','localhost,7409'\n    \"Invoke-DbcCheck:SqlCredential\" = $cred\n}\n\n$Sqlinstances = 'localhost,7401','localhost,7402','localhost,7403'\n\n$broken = 'localhost,7401','localhost,7409'\n\n# check not contactable instances\nInvoke-DbcCheck -SqlInstance $broken  -Check ValidJobOwner -SqlCredential $cred  -Verbose\nInvoke-DbcCheck -Check DatabaseCollation -SqlCredential $cred\n# especially check both default params and specified - also need to check config too\nInvoke-DbcCheck -SqlInstance $broken -Check DatabaseCollation -SqlCredential $cred  \nInvoke-DbcCheck -SqlInstance $Sqlinstances[0] -Check DatabaseCollation -SqlCredential $cred  \nInvoke-DbcCheck -SqlInstance $Sqlinstances -Check DatabaseCollation -SqlCredential $cred  \nInvoke-DbcCheck -SqlInstance $Sqlinstances[0] -Check DatabaseStatus -SqlCredential $cred  \nInvoke-DbcCheck -SqlInstance $Sqlinstances[0] -Check AdHocDistributedQueriesEnabled -SqlCredential $cred\nInvoke-DbcCheck -SqlInstance $Sqlinstances[0] -Check AgentAlert -SqlCredential $cred\nInvoke-DbcCheck -SqlInstance $Sqlinstances[0] -Check AgentServiceAccount -SqlCredential $cred\nInvoke-DbcCheck -SqlInstance $Sqlinstances[0] -Check Backup -SqlCredential $cred\nInvoke-DbcCheck -SqlInstance $Sqlinstances[0] -Check CIS -SqlCredential $cred\nInvoke-DbcCheck -SqlInstance $Sqlinstances[0] -Check ExtendedEvent -SqlCredential $cred\nInvoke-DbcCheck -SqlInstance $Sqlinstances[0] -Check VirtualLogFile -SqlCredential $cred\nInvoke-DbcCheck -SqlInstance $Sqlinstances[0] -Check TempDbConfiguration -SqlCredential $cred\nInvoke-DbcCheck -SqlInstance $Sqlinstances[0] -Check InstanceConnection -SqlCredential $cred\n\n###############################\n\n # We run Pester V5 here because the -legacy parameter of Invoke-DbcCheck is set to false as a default param\n\n\n ## NOt working\n\n # AutoClose, AutoSHrink\n # You dont have to reimport \n\nipmo ./dbachecks.psd1 # -Verbose\nReset-DbcConfig\n\n$password = ConvertTo-SecureString \"dbatools.IO\" -AsPlainText -Force\n$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"sqladmin\", $password\n\n$Sqlinstances = 'localhost,7401','localhost,7402','localhost,7403'\n\n$PSDefaultParameterValues.Clear()\n# set default params for single instance and v5\n\n$PSDefaultParameterValues = @{\n    \"Invoke-DbcCheck:legacy\" = $false\n    \"Invoke-DbcCheck:SqlInstance\" = $Sqlinstances[0]\n    \"Invoke-DbcCheck:SqlCredential\" = $cred\n}\n\n# set default params for multiple instances\n\n$PSDefaultParameterValues = @{\n    \"Invoke-DbcCheck:legacy\" = $false\n    \"Invoke-DbcCheck:SqlInstance\" = $Sqlinstances[0..1]\n    \"Invoke-DbcCheck:SqlCredential\" = $cred\n}\n\n# set default params for multiple instances with a broken one\n\n$PSDefaultParameterValues = @{\n    \"Invoke-DbcCheck:legacy\" = $false\n    \"Invoke-DbcCheck:SqlInstance\" = 'localhost,7401','localhost,7409'\n    \"Invoke-DbcCheck:SqlCredential\" = $cred\n}\n\n\n# a single tag from each of the groups\n\n<#\n$Code = Get-DbcCheck -Group Instance | ForEach-Object {\n     \"Invoke-DbcCheck -Check {0} -Show Detailed\" -f $_.UniqueTag \n}\n$code | scb\n$Code = Get-DbcCheck -Group Database | ForEach-Object {\n     \"Invoke-DbcCheck -Check {0} -Show Detailed\" -f $_.UniqueTag \n}\n$code | scb\n$Code = Get-DbcCheck -Group Agent | ForEach-Object {\n     \"Invoke-DbcCheck -Check {0} -Show Detailed\" -f $_.UniqueTag \n}\n$code | scb\n#>\n#region Instance\n\nInvoke-DbcCheck -Check InstanceConnection -Show Detailed\nInvoke-DbcCheck -Check SqlEngineServiceAccount -Show Detailed\nInvoke-DbcCheck -Check TempDbConfiguration -Show Detailed\nInvoke-DbcCheck -Check AdHocWorkload -Show Detailed\nInvoke-DbcCheck -Check BackupPathAccess -Show Detailed\nInvoke-DbcCheck -Check DefaultFilePath -Show Detailed\nInvoke-DbcCheck -Check DAC -Show Detailed\nInvoke-DbcCheck -Check NetworkLatency -Show Detailed\nInvoke-DbcCheck -Check LinkedServerConnection -Show Detailed\nInvoke-DbcCheck -Check MaxMemory -Show Detailed\nInvoke-DbcCheck -Check OrphanedFile -Show Detailed\nInvoke-DbcCheck -Check ServerNameMatch -Show Detailed\nInvoke-DbcCheck -Check MemoryDump -Show Detailed\nInvoke-DbcCheck -Check SupportedBuild -Show Detailed\nInvoke-DbcCheck -Check SaRenamed -Show Detailed\nInvoke-DbcCheck -Check SaDisabled -Show Detailed\nInvoke-DbcCheck -Check SaExist -Show Detailed\nInvoke-DbcCheck -Check DefaultBackupCompression -Show Detailed\nInvoke-DbcCheck -Check XESessionStopped -Show Detailed\nInvoke-DbcCheck -Check XESessionRunning -Show Detailed\nInvoke-DbcCheck -Check XESessionRunningAllowed -Show Detailed\nInvoke-DbcCheck -Check OLEAutomation -Show Detailed\nInvoke-DbcCheck -Check WhoIsActiveInstalled -Show Detailed\nInvoke-DbcCheck -Check ModelDbGrowth -Show Detailed\nInvoke-DbcCheck -Check ADUser -Show Detailed\nInvoke-DbcCheck -Check ErrorLog -Show Detailed\nInvoke-DbcCheck -Check ErrorLogCount -Show Detailed\nInvoke-DbcCheck -Check MaxDopInstance -Show Detailed\nInvoke-DbcCheck -Check TwoDigitYearCutoff -Show Detailed\nInvoke-DbcCheck -Check TraceFlagsExpected -Show Detailed\nInvoke-DbcCheck -Check TraceFlagsNotExpected -Show Detailed\nInvoke-DbcCheck -Check CLREnabled -Show Detailed\nInvoke-DbcCheck -Check CrossDBOwnershipChaining -Show Detailed\nInvoke-DbcCheck -Check AdHocDistributedQueriesEnabled -Show Detailed\nInvoke-DbcCheck -Check XpCmdShellDisabled -Show Detailed\nInvoke-DbcCheck -Check ScanForStartupProceduresDisabled -Show Detailed\nInvoke-DbcCheck -Check DefaultTrace -Show Detailed\nInvoke-DbcCheck -Check OLEAutomationProceduresDisabled -Show Detailed\nInvoke-DbcCheck -Check RemoteAccessDisabled -Show Detailed\nInvoke-DbcCheck -Check LatestBuild -Show Detailed\nInvoke-DbcCheck -Check BuiltInAdmin -Show Detailed\nInvoke-DbcCheck -Check LocalWindowsGroup -Show Detailed\nInvoke-DbcCheck -Check LoginAuditFailed -Show Detailed\nInvoke-DbcCheck -Check LoginAuditSuccessful -Show Detailed\nInvoke-DbcCheck -Check SqlAgentProxiesNoPublicRole -Show Detailed\nInvoke-DbcCheck -Check HideInstance -Show Detailed\nInvoke-DbcCheck -Check EngineServiceAdmin -Show Detailed\nInvoke-DbcCheck -Check AgentServiceAdmin -Show Detailed\nInvoke-DbcCheck -Check FullTextServiceAdmin -Show Detailed\nInvoke-DbcCheck -Check LoginCheckPolicy -Show Detailed\nInvoke-DbcCheck -Check LoginPasswordExpiration -Show Detailed\nInvoke-DbcCheck -Check LoginMustChange -Show Detailed\nInvoke-DbcCheck -Check SuspectPageLimit -Show Detailed\nInvoke-DbcCheck -Check SQLMailXPsDisabled -Show Detailed\nInvoke-DbcCheck -Check PublicPermission -Show Detailed\nInvoke-DbcCheck -Check SqlBrowserServiceAccount -Show Detailed\n#endregion\n#region Database\n\nInvoke-DbcCheck -Check Database -Show Detailed -Verbose\nInvoke-DbcCheck -Check DatabaseCollation,SuspectPage\nInvoke-DbcCheck -Check SuspectPage -Show Detailed\nInvoke-DbcCheck -Check TestLastBackup -Show Detailed\nInvoke-DbcCheck -Check TestLastBackupVerifyOnly -Show Detailed\nInvoke-DbcCheck -Check ValidDatabaseOwner -Show Detailed\nInvoke-DbcCheck -Check InvalidDatabaseOwner -Show Detailed\nInvoke-DbcCheck -Check LastGoodCheckDb -Show Detailed\nInvoke-DbcCheck -Check IdentityUsage -Show Detailed\nInvoke-DbcCheck -Check RecoveryModel -Show Detailed\nInvoke-DbcCheck -Check DuplicateIndex -Show Detailed\nInvoke-DbcCheck -Check UnusedIndex -Show Detailed\nInvoke-DbcCheck -Check DisabledIndex -Show Detailed\nInvoke-DbcCheck -Check DatabaseGrowthEvent -Show Detailed\nInvoke-DbcCheck -Check PageVerify -Show Detailed\nInvoke-DbcCheck -Check AutoClose -Show Detailed\nInvoke-DbcCheck -Check AutoShrink -Show Detailed\nInvoke-DbcCheck -Check LastFullBackup -Show Detailed\nInvoke-DbcCheck -Check LastDiffBackup -Show Detailed\nInvoke-DbcCheck -Check LastLogBackup -Show Detailed\nInvoke-DbcCheck -Check LogfilePercentUsed -Show Detailed\nInvoke-DbcCheck -Check VirtualLogFile -Show Detailed\nInvoke-DbcCheck -Check LogfileCount -Show Detailed\nInvoke-DbcCheck -Check LogfileSize -Show Detailed\nInvoke-DbcCheck -Check FutureFileGrowth -Show Detailed\nInvoke-DbcCheck -Check FileGroupBalanced -Show Detailed\nInvoke-DbcCheck -Check CertificateExpiration -Show Detailed\nInvoke-DbcCheck -Check AutoCreateStatistics -Show Detailed\nInvoke-DbcCheck -Check AutoUpdateStatistics -Show Detailed\nInvoke-DbcCheck -Check AutoUpdateStatisticsAsynchronously -Show Detailed\nInvoke-DbcCheck -Check DatafileAutoGrowthType -Show Detailed\nInvoke-DbcCheck -Check Trustworthy -Show Detailed\nInvoke-DbcCheck -Check OrphanedUser -Show Detailed\nInvoke-DbcCheck -Check PseudoSimple -Show Detailed\nInvoke-DbcCheck -Check CompatibilityLevel -Show Detailed\nInvoke-DbcCheck -Check FKCKTrusted -Show Detailed\nInvoke-DbcCheck -Check MaxDopDatabase -Show Detailed\nInvoke-DbcCheck -Check DatabaseStatus -Show Detailed\nInvoke-DbcCheck -Check DatabaseExists -Show Detailed\nInvoke-DbcCheck -Check ContainedDBAutoClose -Show Detailed\nInvoke-DbcCheck -Check CLRAssembliesSafe -Show Detailed\nInvoke-DbcCheck -Check GuestUserConnect -Show Detailed\nInvoke-DbcCheck -Check AsymmetricKeySize -Show Detailed\nInvoke-DbcCheck -Check SymmetricKeyEncryptionLevel -Show Detailed\nInvoke-DbcCheck -Check ContainedDBSQLAuth -Show Detailed\nInvoke-DbcCheck -Check QueryStoreEnabled -Show Detailed\nInvoke-DbcCheck -Check QueryStoreDisabled -Show Detailed\n#endregion\n#region Agent\nInvoke-DbcCheck -Check DatabaseMailEnabled -Show Detailed\nInvoke-DbcCheck -Check AgentServiceAccount -Show Detailed\nInvoke-DbcCheck -Check DbaOperator -Show Detailed\nInvoke-DbcCheck -Check FailsafeOperator -Show Detailed\nInvoke-DbcCheck -Check DatabaseMailProfile -Show Detailed\nInvoke-DbcCheck -Check AgentMailProfile -Show Detailed\nInvoke-DbcCheck -Check FailedJob -Show Detailed\nInvoke-DbcCheck -Check ValidJobOwner -Show Detailed\nInvoke-DbcCheck -Check AgentAlert -Show Detailed\nInvoke-DbcCheck -Check JobHistory -Show Detailed\nInvoke-DbcCheck -Check LongRunningJob -Show Detailed\nInvoke-DbcCheck -Check LastJobRunTime -Show Detailed\n#endregion\n\n# multiple tags same group\n\nInvoke-DbcCheck -Check AutoClose -Show All\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n$password = ConvertTo-SecureString \"dbatools.IO\" -AsPlainText -Force\n$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"sqladmin\", $password\n\n\n$Sqlinstances = 'localhost,7401','localhost,7402','localhost,7403'\n\n$sql1 = Connect-DbaInstance -SqlInstance $Sqlinstances[0] -SqlCredential $cred\n$sql2 = Connect-DbaInstance -SqlInstance $Sqlinstances[1] -SqlCredential $cred\n$sql3 = Connect-DbaInstance -SqlInstance $Sqlinstances[2] -SqlCredential $cred\n\n\nGet-DbcConfig -Name agent.validjobowner.name \nSet-DbcConfig -Name agent.validjobowner.name -Value 'NotRob','NotGrilliam','ProperJobOwnerAccount','OldNamingConventionJobAccount'\nInvoke-DbcCheck -SqlInstance $sql1 -Check ValidJobOwner -SqlCredential $cred\n\nNew-DbaLogin $sql1,$sql2,$sql3 -Login Monica \nNew-DbaLogin $sql1,$sql2,$sql3 -Login 'ProperJobOwnerAccount'\nSet-DbaAgentJobOwner -SqlInstance $sql1,$sql2,$sql3 -Job 'IndexOptimize - USER_DATABASES' -Login Monica\nSet-DbaAgentJobOwner -SqlInstance $sql1,$sql2,$sql3  -Login 'NotGrilliam'\n\n# Dirks Bye, I am leaving script\nSet-DbaAgentJobOwner -SqlInstance $sql1 -Login 'ProperJobOwnerAccount'\nInvoke-DbcCheck -SqlInstance $Sqlinstances[0] -Check ValidJobOwner -SqlCredential $cred\n"
  },
  {
    "path": "developing/Archive/tests/Help.Exceptions.ps1",
    "content": "\n\n\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQURIsqjzNuCvaywTsb60Hh+CAY\n# Y4qgggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz\n# c3VyZWQgSUQgQ29kZSBTaWduaW5nIENBMB4XDTE3MDUwOTAwMDAwMFoXDTIwMDUx\n# MzEyMDAwMFowVzELMAkGA1UEBhMCVVMxETAPBgNVBAgTCFZpcmdpbmlhMQ8wDQYD\n# VQQHEwZWaWVubmExETAPBgNVBAoTCGRiYXRvb2xzMREwDwYDVQQDEwhkYmF0b29s\n# czCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAI8ng7JxnekL0AO4qQgt\n# Kr6p3q3SNOPh+SUZH+SyY8EA2I3wR7BMoT7rnZNolTwGjUXn7bRC6vISWg16N202\n# 1RBWdTGW2rVPBVLF4HA46jle4hcpEVquXdj3yGYa99ko1w2FOWzLjKvtLqj4tzOh\n# K7wa/Gbmv0Si/FU6oOmctzYMI0QXtEG7lR1HsJT5kywwmgcjyuiN28iB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yhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgQ29kZSBTaWduaW5nIENBAhACwXUo\n# dNXChDGFKtigZGnKMAkGBSsOAwIaBQCgeDAYBgorBgEEAYI3AgEMMQowCKACgACh\n# AoAAMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcCAQsxDjAM\n# BgorBgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBTFUYzHsE17PItd1Khf0qg2Dqat\n# 9jANBgkqhkiG9w0BAQEFAASCAQAPdXXxD4YAvhd8nAB7d7SWo7VQrWSjvcJRaLFk\n# iuH9VepbSVt1kv2FGKtnKalps+vdeELzRXZRnAuBRfN5wv6UDaD8dCAhiEK0IIf2\n# NIGvdGS9h0NXE72y/Hvu43Pxt/IP561v6Fg/9XDkpiWixjlNxxeviFjz3xvRBUH6\n# Fy2qndHhkUy7bsk9L9VJNxdvgq9ntGik+wo0InpBs2u4WxlDKaDWAUJWWit3F3CA\n# /l7L8r0YPyx1SDJy7vp3doHfwDBXyFFXtgF1feB4jXPtoOIkTxw91Ocsoz1/3mcR\n# meUXyjJ6SaZAha9WiiVvgbwbKy+ulVMff77Rn4DEKjpntovl\n# SIG # End signature block\n"
  },
  {
    "path": "developing/Archive/tests/InModule.Help.Exceptions.ps1",
    "content": "﻿[cmdletbinding()]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidGlobalVars', '', Justification='Because scoping is hard')]\nParam()\n\n$global:FunctionHelpTestExceptions = @(\n    \"TabExpansion2\"\n)\n\n$global:HelpTestEnumeratedArrays = @(\n    \"Sqlcollaborative.Dbatools.Connection.ManagementConnectionType[]\"\n)\n\n$global:HelpTestSkipParameterType = @{\n    \"Get-DbaCmObject\"      = @(\"DoNotUse\")\n    \"Test-DbaCmConnection\" = @(\"Type\")\n    \"Get-DbaService\"       = @(\"DoNotUse\")\n}\n\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCz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Gtmz1bk+d\n# IzANBgkqhkiG9w0BAQEFAASCAQAm/TbPQzhs+uJgI6y3GFK/IwC7E6Llai9KErbT\n# eDHP7rRtHKC0mHBXskco8xG6qnNYGq02jB9zBbbRHyJ6IVPAZoFCa1J1yzNYK9RV\n# 8T3Fy4/PbEpmB3QrmlD0BDVePYofI1CIDaX21+FiGPCKe6awT4J0c/RbUjpe7Ftc\n# nGzdhWdrXzir6DDG3zIIIyEzBcRrRPRBw+deNcU8BhqpjswHncbpZVutCs/9yuxQ\n# 2yOus5rRm5cbPZJHo7spdc18Cn8+cvz6dusa/OOrXhtVspZ3QiQMmlQVY5kZbmzs\n# fuCoDFIc6gr/O7pIfaCQmX5GpgxVvGBRYXPxCuvz/pS8GFc9\n# SIG # End signature block\n"
  },
  {
    "path": "developing/Archive/tests/InModule.Help.Tests.ps1",
    "content": "[cmdletbinding()]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidGlobalVars', '', Justification='Because scoping is hard')]\nParam()\n<#\n    .NOTES\n        ===========================================================================\n        Created with: \tSAPIEN Technologies, Inc., PowerShell Studio 2016 v5.2.119\n        Created on:   \t4/12/2016 1:11 PM\n        Created by:   \tJune Blender\n        Organization: \tSAPIEN Technologies, Inc\n        Filename:\t\t*.Help.Tests.ps1\n        ===========================================================================\n    .DESCRIPTION\n    To test help for the commands in a module, place this file in the module folder.\n    To test any module from any path, use https://github.com/juneb/PesterTDD/Module.Help.Tests.ps1\n#>\nif ($SkipHelpTest) { return }\n. \"$PSScriptRoot\\InModule.Help.Exceptions.ps1\"\n\n$ModuleBase = Split-Path -Parent $MyInvocation.MyCommand.Path\n\n# This should stop people making breaking changes to the tests without first altering the test\nRemove-Module dbachecks -Force -ErrorAction SilentlyContinue\nImport-Module $ModuleBase\\..\\dbachecks.psd1\n\n$includedNames = (Get-ChildItem \"$PSScriptRoot\\..\\functions\" | Where-Object Name -like \"*.ps1\" ).BaseName\n$commands = Get-Command -Module (Get-Module dbachecks) -CommandType Cmdlet, Function | Where-Object Name -in $includedNames\n\n## When testing help, remember that help is cached at the beginning of each session.\n## To test, restart session.\n\n\nforeach ($command in $commands) {\n    $commandName = $command.Name\n\n    # Skip all functions that are on the exclusions list\n    if ($global:FunctionHelpTestExceptions -contains $commandName) { continue }\n\n    # The module-qualified command fails on Microsoft.PowerShell.Archive cmdlets\n    $Help = Get-Help $commandName -ErrorAction SilentlyContinue\n    $testhelperrors = 0\n    $testhelpall = 0\n    Describe \"Test help for $commandName\" -Tag Help{\n\n        $testhelpall += 1\n        if ($Help.Synopsis -like '*`[`<CommonParameters`>`]*') {\n            # If help is not found, synopsis in auto-generated help is the syntax diagram\n            It \"should not be auto-generated\" {\n                $Help.Synopsis | Should Not BeLike '*`[`<CommonParameters`>`]*'\n            }\n            $testhelperrors += 1\n        }\n\n        $testhelpall += 1\n        if ([String]::IsNullOrEmpty($Help.Description.Text)) {\n            # Should -Be a description for every function\n            It \"gets description for $commandName\" {\n                $Help.Description | Should Not BeNullOrEmpty\n            }\n            $testhelperrors += 1\n        }\n\n        $testhelpall += 1\n        if ([String]::IsNullOrEmpty(($Help.Examples.Example | Select-Object -First 1).Code)) {\n            # Should -Be at least one example\n            It \"gets example code from $commandName\" {\n                ($Help.Examples.Example | Select-Object -First 1).Code | Should Not BeNullOrEmpty\n            }\n            $testhelperrors += 1\n        }\n\n        $testhelpall += 1\n        if ([String]::IsNullOrEmpty(($Help.Examples.Example.Remarks | Select-Object -First 1).Text)) {\n            # Should -Be at least one example description\n            It \"gets example help from $commandName\" {\n                ($Help.Examples.Example.Remarks | Select-Object -First 1).Text | Should Not BeNullOrEmpty\n            }\n            $testhelperrors += 1\n        }\n\n        if ($testhelperrors -eq 0) {\n            It \"Ran silently $testhelpall tests\" {\n                $testhelperrors | Should -Be 0\n            }\n        }\n\n        $testparamsall = 0\n        $testparamserrors = 0\n        Context \"Test parameter help for $commandName\" {\n\n            $Common = 'Debug', 'ErrorAction', 'ErrorVariable', 'InformationAction', 'InformationVariable', 'OutBuffer', 'OutVariable', 'PipelineVariable', 'Verbose', 'WarningAction', 'WarningVariable', 'Confirm', 'WhatIf'\n\n            $parameters = $command.ParameterSets.Parameters | Where-Object {$psitem.IsDynamic -eq $false} | Sort-Object -Property Name -Unique | Where-Object Name -notin $common\n            $parameterNames = $parameters.Name\n            $HelpParameterNames = ($Help.Parameters.Parameter | Sort-Object -Unique | Where-Object Name -notin $common).Name\n            foreach ($parameter in $parameters) {\n                $parameterName = $parameter.Name\n                $parameterHelp = $Help.parameters.parameter | Where-Object Name -EQ $parameterName\n\n                $testparamsall += 1\n                if ([String]::IsNullOrEmpty($parameterHelp.Description.Text)) {\n                    # Should -Be a description for every parameter\n                    It \"gets help for parameter: $parameterName : in $commandName\" {\n                        $parameterHelp.Description.Text | Should Not BeNullOrEmpty\n                    }\n                    $testparamserrors += 1\n                }\n\n                $testparamsall += 1\n                $codeMandatory = $parameter.IsMandatory.toString()\n                if ($parameterHelp.Required -ne $codeMandatory) {\n                    # Required value in Help should match IsMandatory property of parameter\n                    It \"help for $parameterName parameter in $commandName has correct Mandatory value\" {\n                        $parameterHelp.Required | Should -Be $codeMandatory\n                    }\n                    $testparamserrors += 1\n                }\n\n                if ($HelpTestSkipParameterType[$commandName] -contains $parameterName) { continue }\n\n                $codeType = $parameter.ParameterType.Name\n\n                $testparamsall += 1\n                if ($parameter.ParameterType.IsEnum) {\n                    # Enumerations often have issues with the typename not being reliably available\n                    $names = $parameter.ParameterType::GetNames($parameter.ParameterType)\n                    if ($parameterHelp.parameterValueGroup.parameterValue -ne $names) {\n                        # Parameter type in Help should match code\n                        It \"help for $commandName has correct parameter type for $parameterName\" {\n                            $parameterHelp.parameterValueGroup.parameterValue | Should -Be $names\n                        }\n                        $testparamserrors += 1\n                    }\n                }\n                elseif ($parameter.ParameterType.FullName -in $HelpTestEnumeratedArrays) {\n                    # Enumerations often have issues with the typename not being reliably available\n                    $names = [Enum]::GetNames($parameter.ParameterType.DeclaredMembers[0].ReturnType)\n                    if ($parameterHelp.parameterValueGroup.parameterValue -ne $names) {\n                        # Parameter type in Help should match code\n                        It \"help for $commandName has correct parameter type for $parameterName\" {\n                            $parameterHelp.parameterValueGroup.parameterValue | Should -Be $names\n                        }\n                        $testparamserrors += 1\n                    }\n                }\n                else {\n                    # To avoid calling Trim method on a null object.\n                    $helpType = if ($parameterHelp.parameterValue) { $parameterHelp.parameterValue.Trim() }\n                    if ($helpType -ne $codeType ) {\n                        # Parameter type in Help should match code\n                        It \"help for $commandName has correct parameter type for $parameterName\" {\n                            $helpType | Should -Be $codeType\n                        }\n                        $testparamserrors += 1\n                    }\n                }\n            }\n            foreach ($helpParm in $HelpParameterNames) {\n                $testparamsall += 1\n                if ($helpParm -notin $parameterNames) {\n                    # Shouldn't find extra parameters in help.\n                    It \"finds help parameter in code: $helpParm\" {\n                        $helpParm -in $parameterNames | Should -BeTrue\n                    }\n                    $testparamserrors += 1\n                }\n            }\n            if ($testparamserrors -eq 0) {\n                It \"Ran silently $testparamsall tests\" {\n                    $testparamserrors | Should -Be 0\n                }\n            }\n        }\n    }\n}\n\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUOQn6XAVOZu8FeBq7y4vF/V80\n# Ql+gggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz\n# c3VyZWQgSUQgQ29kZSBTaWduaW5nIENBMB4XDTE3MDUwOTAwMDAwMFoXDTIwMDUx\n# MzE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jmMOE0ut119EefM2FAaK95xGTlz/kLEbBw6RFfu6r7VRwo0k\n# riTGxycqoSkoGjpxKAI8LpGjwCUR4pwUR6F6aGivm6dcIFzZcbEMj7uo+MUSaJ/P\n# QMtARKUT8OZkDCUIQjKyNookAv4vcn4c10lFluhZHen6dGRrsutmQ9qzsIzV6Q3d\n# 9gEgzpkxYz0IGhizgZtPxpMQBvwHgfqL2vmCSfdibqFT+hKUGIUukpHqaGxEMrJm\n# oecYpJpkUe8xggIoMIICJAIBATCBhjByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMM\n# RGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQD\n# EyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgQ29kZSBTaWduaW5nIENBAhACwXUo\n# dNXChDGFKtigZGnKMAkGBSsOAwIaBQCgeDAYBgorBgEEAYI3AgEMMQowCKACgACh\n# AoAAMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcCAQsxDjAM\n# BgorBgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBSpQbpEdfnW1M5JjD64yU8Znowk\n# wDANBgkqhkiG9w0BAQEFAASCAQAoX/M2RgLM/kBzs2Xur4w685CT6/OQDx62w/zb\n# 3xAswvDioABnxZmhjIbszBFRjn7rTxtoPa67GlPl2BI4OD+LZNv8aTVkep+PxrZW\n# ZzJ4XcYQHgdIlT3AGmLVYQseeLNbJBaeWNNuxTFkRhvk6lGHT30K/jMBjYr776LX\n# 2qJxNeGLQP/JZxjLWRTalPZxxanrG+hsnM3n+soVhLnLZndIJ6CP+JLzDti9U4+z\n# j5XoyG1wIIEL1gbqAplNc6g/2xbqburtmZVhkG/4mczp7FWyhIWnSaNG/aX8Z+1G\n# O8Q4dkiV7eMLQgeMopXUJWxVNBv/dVVL31QaQu76S77SI4jX\n# SIG # End signature block\n"
  },
  {
    "path": "developing/Archive/tests/Integration/DockerTests.ps1",
    "content": "[cmdletbinding()]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', '', Justification='Because they are used just parsed')]\nParam()\n<#\n    # Need to create a credential to be saved using user sa and password Password0! by running\n    Get-Credential | Export-Clixml -Path $CredentialPath\n#>\n$CredentailPath = 'C:\\MSSQL\\BACKUP\\KEEP\\sacred.xml'\n$dbacheckslocalpath = 'GIT:\\dbachecks\\'\n\n#region setup\nWrite-PSFMessage \"Removing Modules\" -Level Significant\nRemove-Module dbatools, dbachecks, PSFramework -ErrorAction SilentlyContinue\nWrite-PSFMessage \"Importing from source control\" -Level Significant\nImport-Module $dbacheckslocalpath\\dbachecks.psd1\nWrite-PSFMessage \"Resetting dbachecks config\"  -Level Significant\n$null = Reset-DbcConfig\n\n$PSDefaultParameterValues += @{ 'Write-PSFMessage:Level' = 'Output'} # setting for messages to screen\nSet-Location $dbacheckslocalpath\\tests\\Integration\n\nWrite-PSFMessage \"resetting docker-compose to save Rob from troubleshooting for hours because the containers already existed\"\ndocker-compose down\nWrite-PSFMessage \"Starting containers\"\ntry {\n    $ErrorActionPreference = 'Stop'\n    docker-compose up -d\n    $ErrorActionPreference = 'Continue'\n}\ncatch {\n    $ErrorActionPreference = 'Continue'\n    Return\n}\n\n$containers = 'localhost,15589', 'localhost,15588', 'localhost,15587', 'localhost,15586'\n$cred = Import-Clixml $CredentailPath\n\nWrite-PSFMessage \"Setting default configs\"\n$null = Set-DbcConfig -Name app.sqlinstance $containers\n$null = Set-DbcConfig -Name policy.connection.authscheme -Value SQL\n$null = Set-DbcConfig -Name policy.network.latencymaxms -Value 150 # because the containers run a bit slow!\n$null = Set-DbcConfig -Name skip.connection.auth -Value $true\n\n## Ensure that SQLAgent is started - SQL2014 agent wont start in container\nWrite-PSFMessage \"Starting SQL Agent on all containers except SQL2014\"\ndocker exec -ti integration_sql2012_1 powershell start-service SQLSERVERAGENT\ndocker exec -ti integration_sql2016_1 powershell start-service SQLSERVERAGENT\ndocker exec -ti integration_sql2017_1 powershell start-service SQLSERVERAGENT\n\n#endregion\n\n#region Pester Functions\nfunction Invoke-DefaultCheck {\n    It \"All Checks should pass with default for $Check\" {\n        $Tests = get-variable \"$($Check)default\"  -ValueOnly\n        $Tests.FailedCount | Should -Be 0 -Because \"We expect all of the checks to run and pass with default setting (Yes we may set some values before but you get my drift)\"\n    }\n}\nfunction Invoke-ConfigCheck {\n    It \"All Checks should fail when config changed for $Check\" {\n        $Tests = get-variable \"$($Check)configchanged\"  -ValueOnly\n        $Tests.PassedCount | Should -Be 0 -Because \"We expect all of the checks to run and fail when we have changed the config values\"\n    }\n}\nfunction Invoke-ValueCheck {\n    It \"All Checks should pass when setting changed for $Check\" {\n        $Tests = get-variable \"$($Check)valuechanged\"  -ValueOnly\n        $Tests.FailedCount | Should -Be 0 -Because \"We expect all of the checks to run and pass when we have changed the settings to match the config values\"\n    }\n}\n#endregion\n\n# make sure the containers are up and running\nWrite-PSFMessage \"Default connectivity check\"\n$ConnectivityTests = Invoke-DbcCheck -SqlCredential $cred -Check Connectivity -Show None -PassThru\n\n#region error Log Count - PR 583\n# default test\nWrite-PSFMessage \"Checking ErrorLogCount default\"\n$errorlogscountdefault = Invoke-DbcCheck -SqlCredential $cred -Check ErrorLogCount -Show None  -PassThru\n# set a value and then it will fail\nWrite-PSFMessage \"Checking ErrorLogCount config changed\"\n$null = Set-DbcConfig -Name policy.errorlog.logcount -Value 10\n$errorlogscountconfigchanged = Invoke-DbcCheck -SqlCredential $cred -Check ErrorLogCount -Show None  -PassThru\n\n# set the value and then it will pass\nWrite-PSFMessage \"Checking ErrorLogCount value changed\"\n$null = Set-DbaErrorLogConfig -SqlInstance $containers -SqlCredential $cred -LogCount 10\n$errorlogscountvaluechanged = Invoke-DbcCheck -SqlCredential $cred -Check ErrorLogCount -Show None  -PassThru\n#endregion\n\n#region Job History Count PR 582\n\n# run the checks against these instances (SQL2014 agent wont start :-( ))\nWrite-PSFMessage \"Checking JobHistory default\"\n$null = Set-DbcConfig -Name app.sqlinstance $containers.Where{$_ -ne 'localhost,15588'}\n# by default all tests should pass on default instance settings\n$jobhistorydefault = Invoke-DbcCheck -SqlCredential $cred -Check JobHistory -Show None  -PassThru\n\n#Change the configuration to test that the checks fail\nWrite-PSFMessage \"Checking JobHistory config changed\"\n$null = Set-DbcConfig -Name agent.history.maximumjobhistoryrows -value 1000\n$null = Set-DbcConfig -Name agent.history.maximumhistoryrows -value 10000\n$jobhistoryconfigchanged = Invoke-DbcCheck -SqlCredential $cred -Check JobHistory -Show None  -PassThru\nWrite-PSFMessage \"Checking JobHistory value changed\"\n$setDbaAgentServerSplat = @{\n    MaximumJobHistoryRows = 1000\n    MaximumHistoryRows    = 10000\n    SqlInstance           = $containers.Where{$_ -ne 'localhost,15588'}\n    SqlCredential         = $cred\n}\n$null = Set-DbaAgentServer @setDbaAgentServerSplat\n$jobhistoryvaluechanged = Invoke-DbcCheck -SqlCredential $cred -Check JobHistory -Show None  -PassThru\n\n#endregion\n\n#region BackupPathAccess\n\n# run the checks against these instances\nWrite-PSFMessage \"Checking BackupPathAccess default\"\n$null = Set-DbcConfig -Name app.sqlinstance $containers\n# by default all tests should pass on default instance settings\n$BackupPathAccessdefault = Invoke-DbcCheck -SqlCredential $cred -Check BackupPathAccess -Show None  -PassThru\n\n#Change the configuration to test that the checks fail\nWrite-PSFMessage \"Checking BackupPathAccess config changed\"\n$null = Set-DbcConfig -Name policy.storage.backuppath -value 'C:\\Windows\\temp\\a' ## Setting to an invalid unaccessible folder\n$BackupPathAccessconfigchanged = Invoke-DbcCheck -SqlCredential $cred -Check BackupPathAccess -Show None  -PassThru\nWrite-PSFMessage \"Checking BackupPathAccess value changed\"\n\nforeach ($container in $containers) {\n    $Instance = Connect-DbaInstance -SqlInstance $container -SqlCredential $cred\n    $Instance.BackupDirectory = 'C:\\Windows\\temp\\'\n    $Instance.Alter()\n}\n\n$null = Set-DbcConfig -Name policy.storage.backuppath -value 'C:\\Windows\\temp\\'\n\n$BackupPathAccessvaluechanged = Invoke-DbcCheck -SqlCredential $cred -Check BackupPathAccess -Show None  -PassThru\n\n\n#endregion\n\n#region DAC\n\n# run the checks against these instances\nWrite-PSFMessage \"Checking DAC default\"\n$null = Set-DbcConfig -Name app.sqlinstance $containers\nforeach($container in $containers){\n    $null = Set-DbaSpConfigure -SqlInstance $container -SqlCredential $cred -Name RemoteDACConnectionsEnabled -Value 1 ## because it is set to false by default but dbachecks uses true as default\n    }\n# by default all tests should pass on default instance settings\n$DACdefault = Invoke-DbcCheck -SqlCredential $cred -Check DAC -Show None  -PassThru\n\n#Change the configuration to test that the checks fail\nWrite-PSFMessage \"Checking DAC config changed\"\n$null = Set-DbcConfig -Name policy.dacallowed -value $false\n$DACconfigchanged = Invoke-DbcCheck -SqlCredential $cred -Check DAC -Show None  -PassThru\nWrite-PSFMessage \"Checking DAC value changed\"\n\nforeach($container in $containers){\n    $null = Set-DbaSpConfigure -SqlInstance $container -SqlCredential $cred -Name RemoteDACConnectionsEnabled -Value 0\n    }\n\n$DACvaluechanged = Invoke-DbcCheck -SqlCredential $cred -Check DAC -Show None  -PassThru\n\n\n#endregion\n\nWrite-PSFMessage \"Running Pester Tests .........\"\nDescribe \"Testing the checks are running as expected\" -Tag Integration {\n    Context \"Connectivity Checks\" {\n        It \"All Tests should pass\" {\n            $ConnectivityTests.FailedCount | Should -Be 0 -Because \"We expect all of the checks to run and pass with default settings\"\n        }\n    }\n\n    $TestingTheChecks = @('errorlogscount', 'jobhistory', 'BackupPathAccess', 'DAC')\n    Foreach ($Check in $TestingTheChecks) {\n        Context \"$Check Checks\" {\n            Invoke-DefaultCheck\n            Invoke-ConfigCheck\n            INvoke-ValueCheck\n        }\n    }\n}\n\nWrite-PSFMessage \"Finished running Pester Tests\"\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgI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zewS4iyx5HYrN8\n# /RAVu8JCx5SgRScDYgTQt35k4VpmDMF2fPXnPnpGjmg+VmghYKNFVXE+h+l+3Ale\n# bKQb7pnLVkPqjtU2JMdSvJd1rKHePV7PBNIHTtsyM19c4tVH3CGupUzGrRWL09CZ\n# K2K8FmSU9cPypWrNcuzHA4fAqxuBRecps48NIdEWtjKxFmwXUo6pPOTpwRSL3hxU\n# 0eDp8woA0JrH0ao4JcJ2/epKewiOb9XQKV0GdhAIJUczK7jA9lA5U083INMIf4jc\n# jx2+VHF4IAtbrA+q78L9MEjfLHqmdHMS9jTdvGbFyFH/plce\n# SIG # End signature block\n"
  },
  {
    "path": "developing/Archive/tests/Integration/docker-compose.yml",
    "content": "version: '3.7'\n\nservices:\n    sql2012:\n        image: dbafromthecold/sqlserver2012dev:sp4\n        ports:  \n          - \"15589:1433\"\n        environment:\n          SA_PASSWORD: \"Password0!\"\n          ACCEPT_EULA: \"Y\"\n    sql2014:\n        image: dbafromthecold/sqlserver2014dev:sp2\n        ports:  \n          - \"15588:1433\"\n        environment:\n          SA_PASSWORD: \"Password0!\"\n          ACCEPT_EULA: \"Y\"\n    sql2016:\n        image: dbafromthecold/sqlserver2016dev:sp2\n        ports:  \n          - \"15587:1433\"\n        environment:\n          SA_PASSWORD: \"Password0!\"\n          ACCEPT_EULA: \"Y\"\n    sql2017:\n        image: microsoft/mssql-server-windows-developer:2017-latest\n        ports:  \n          - \"15586:1433\"\n        environment:\n          SA_PASSWORD: \"Password0!\"\n          ACCEPT_EULA: \"Y\""
  },
  {
    "path": "developing/Archive/tests/Project.Tests.ps1",
    "content": "$packages = get-package\nif ($packages.Name  -contains \"PSScriptAnalyzer\") {\n    #PSScriptAnalyzer is installed on the system\n} else {\n    Write-Output \"Installing latest version of PSScriptAnalyzer\"\n\n    #install PSScriptAnalyzer\n    Install-Package PSScriptAnalyzer -Force -Scope CurrentUser\n}\n$script:ModuleName = 'dbachecks'\n# Removes all versions of the module from the session before importing\nGet-Module $ModuleName | Remove-Module\n$ModuleBase = Split-Path -Parent $MyInvocation.MyCommand.Path\n$FunctionHelpTestExceptions = Get-Content -Path \"$ModuleBase\\Help.Exceptions.ps1\"\n# For tests in .\\Tests subdirectory\nif ((Split-Path $ModuleBase -Leaf) -eq 'Tests') {\n    $ModuleBase = Split-Path $ModuleBase -Parent\n}\nImport-Module $ModuleBase\\$ModuleName.psd1 -PassThru -ErrorAction Stop | Out-Null\nDescribe \"PSScriptAnalyzer rule-sets\" -Tag Build , ScriptAnalyzer {\n\n    $Rules = Get-ScriptAnalyzerRule\n    $scripts = Get-ChildItem $ModuleBase -Include *.ps1, *.psm1, *.psd1 -Recurse | Where-Object fullname -notmatch 'classes'\n    # Get last commit that was merged from master\n    $lastCommit = git log --grep=\"Updated Version Number and docs from master\" -1  --format='%H'\n    # Get the files that have been altered in since the last merge from master\n    $scripts= git diff --name-only $lastCommit HEAD | Where-Object {$psitem.EndsWith('ps1')}\n\n    foreach ( $Script in $scripts )\n    {\n       if (-not (Test-Path \"$ModuleBase\\$script\")){continue}\n        Context \"Checking PSScriptAnalyzer on Script '$script'\" {\n\n            foreach ( $rule in $rules )\n            {\n                                # Skip all rules that are on the exclusions list\n                if ($FunctionHelpTestExceptions -contains $rule.RuleName) { continue }\n                It \"The Script Analyzer Rule [$rule] Should not fail\" {\n                    $rulefailures = Invoke-ScriptAnalyzer -Path \"$ModuleBase\\$script\" -IncludeRule $rule.RuleName -Settings $ModuleBase\\PSScriptAnalyzerSettings.psd1\n                    $message = ($rulefailures | Select-Object Message -Unique).Message\n                    $lines = $rulefailures.Line -join ','\n                    $rulefailures.Count | Should -Be 0 -Because \"Script Analyzer says the rules have been broken on lines $lines with Message '$message' Check in VSCode Problems tab or Run Invoke-ScriptAnalyzer -Script $ModuleBase\\$script -Settings $ModuleBase\\PSScriptAnalyzerSettings.psd1\"\n                }\n            }\n        }\n    }\n}\n\n\nDescribe \"General project validation: $moduleName\" -Tags Build {\n    BeforeAll {\n        Get-Module $ModuleName | Remove-Module\n    }\n    It \"Module '$moduleName' can import cleanly\" {\n        {Import-Module $ModuleBase\\$ModuleName.psd1 -force } | Should Not Throw\n    }\n}\n\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUxwL6BlbCJrUPKh9/064YSyLQ\n# bH6gggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz\n# c3VyZWQgSUQgQ29kZSBTaWduaW5nIENBMB4XDTE3MDUwOTAwMDAwMFoXDTIwMDUx\n# MzEyMDAwMFowVzELMAkGA1UEBhMCVVMxETAPBgNVBAgTCFZpcmdpbmlhMQ8wDQYD\n# VQQHEwZWaWVubmExETAPBgNVBAoTCGRiYXRvb2xzMREwDwYDVQQDEwhkYmF0b29s\n# czCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAI8ng7JxnekL0AO4qQgt\n# Kr6p3q3SNOPh+SUZH+SyY8EA2I3wR7BMoT7rnZNolTwGjUXn7bRC6vISWg16N202\n# 1RBWdTGW2rVPBVLF4HA46jle4hcpEVquXdj3yGYa99ko1w2FOWzLjKvtLqj4tzOh\n# K7wa/Gbmv0Si/FU6oOmctzYMI0QXtEG7lR1HsJT5kywwmgcjyuiN28iBIhT6man0\n# Ib6xKDv40PblKq5c9AFVldXUGVeBJbLhcEAA1nSPSLGdc7j4J2SulGISYY7ocuX3\n# tkv01te72Mv2KkqqpfkLEAQjXgtM0hlgwuc8/A4if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EMMQowCKACgACh\n# AoAAMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcCAQsxDjAM\n# BgorBgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBTyAuclgIYUbsmTj2tRBEmsq+b5\n# fDANBgkqhkiG9w0BAQEFAASCAQB8n0L9j9FDdOLpm+9ydGQ7GwDoJNHKMn8xBpqm\n# HPfgeDJM6BRq1l6FErFjOqd7iDh2fFn+5OAii9WrYRq3gOl4dmwiTS0pKPo4xeq5\n# +jWt12+CRtWjFKfQW3XPLsVi7cmKivVLdSzzU6Uu59V42sCARQSIDyJ4ggiV1TLh\n# baZduC65AZhvauATaLUfId0zKOih5f3RXtLoNqUgXYhyZNlHzWUXJ48mXiBMz4nu\n# Q2nmbpYhfBx8bmapW5p9VFj3bcTUR9hvLQNRH2/+7NA7UQJ89szX3oQS29P1tcuC\n# Qp9Kwel0cjYJrSqmvEa7kS3VDAKjzBuarTlr1L/M1MNGPrKN\n# SIG # End signature block\n"
  },
  {
    "path": "developing/Archive/tests/Reset-DbcConfig.Tests.ps1",
    "content": "[cmdletbinding()]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingInvokeExpression', '', Justification='because rightnow I cant be bothered to look at it')]\nParam()\n$testSettingsDefinition = '\n# config needed for testing\nSet-PSFConfig -Module dbachecks -Name testing.samplesettingforunittest.a -Value \"DefaultValueA\" -Initialize -Description \"This setting is only to validate Reset-DbcConfig\"\nSet-PSFConfig -Module dbachecks -Name testing.samplesettingforunittest.b -Value \"DefaultValueB\" -Initialize -Description \"This setting is only to validate Reset-DbcConfig\"\nSet-PSFConfig -Module dbachecks -Name testing.samplesettingforunittest.group.a -Value \"DefaultValueA\" -Initialize -Description \"This setting is only to validate Reset-DbcConfig\"\nSet-PSFConfig -Module dbachecks -Name testing.samplesettingforunittest.group.b -Value \"DefaultValueB\" -Initialize -Description \"This setting is only to validate Reset-DbcConfig\"\n'\n\nInvoke-Expression $testSettingsDefinition\n\nDescribe \"Testing Reset-DbcConfig\" {\n    InModuleScope -Module dbachecks {\n        Mock Invoke-ConfigurationScript {\n            Invoke-Expression '\n\n            # config needed for testing\n            Set-PSFConfig -Module dbachecks -Name testing.samplesettingforunittest.a -Value \"DefaultValueA\" -Initialize -Description \"This setting is only to validate Reset-DbcConfig\"\n            Set-PSFConfig -Module dbachecks -Name testing.samplesettingforunittest.b -Value \"DefaultValueB\" -Initialize -Description \"This setting is only to validate Reset-DbcConfig\"\n            Set-PSFConfig -Module dbachecks -Name testing.samplesettingforunittest.group.a -Value \"DefaultValueA\" -Initialize -Description \"This setting is only to validate Reset-DbcConfig\"\n            Set-PSFConfig -Module dbachecks -Name testing.samplesettingforunittest.group.b -Value \"DefaultValueB\" -Initialize -Description \"This setting is only to validate Reset-DbcConfig\"\n            '\n        }\n\n        It \"Resetting specific setting works\" {\n            Set-DbcConfig -Name testing.samplesettingforunittest.a -Value \"newvalue\"\n            (Get-DbcConfigValue -Name testing.samplesettingforunittest.a) | Should -Be \"newvalue\"\n            Reset-DbcConfig -Name testing.samplesettingforunittest.a\n            (Get-DbcConfigValue -Name testing.samplesettingforunittest.a) | Should -Be \"DefaultValueA\"\n        }\n\n        It \"Resetting specific setting doesn't change anything else\" {\n            Set-DbcConfig -Name testing.samplesettingforunittest.a -Value \"newvalue\"\n            Set-DbcConfig -Name testing.samplesettingforunittest.b -Value \"customvalue\"\n            (Get-DbcConfigValue -Name testing.samplesettingforunittest.b) | Should -Be \"customvalue\"\n            Reset-DbcConfig -Name testing.samplesettingforunittest.a\n            (Get-DbcConfigValue -Name testing.samplesettingforunittest.a) | Should -Be \"DefaultValueA\"\n            (Get-DbcConfigValue -Name testing.samplesettingforunittest.b) | Should -Be \"customvalue\"\n        }\n\n        It \"Resetting with wildcard resets all matching settings\" {\n            Set-DbcConfig -Name testing.samplesettingforunittest.group.a -Value \"newvalue1\"\n            Set-DbcConfig -Name testing.samplesettingforunittest.group.b -Value \"newvalue2\"\n            Set-DbcConfig -Name testing.samplesettingforunittest.b -Value \"customvalue\"\n            (Get-DbcConfigValue -Name testing.samplesettingforunittest.group.a) | Should -Be \"newvalue1\"\n            (Get-DbcConfigValue -Name testing.samplesettingforunittest.group.b) | Should -Be \"newvalue2\"\n            (Get-DbcConfigValue -Name testing.samplesettingforunittest.b) | Should -Be \"customvalue\"\n            Reset-DbcConfig -Name \"testing.samplesettingforunittest.group.*\"\n            (Get-DbcConfigValue -Name testing.samplesettingforunittest.group.a) | Should -Be \"DefaultValueA\"\n            (Get-DbcConfigValue -Name testing.samplesettingforunittest.group.b) | Should -Be \"DefaultValueB\"\n            (Get-DbcConfigValue -Name testing.samplesettingforunittest.b) | Should -Be \"customvalue\"\n        }\n\n        It \"Resetting with wildcard resets only matching settings\" {\n            Set-DbcConfig -Name testing.samplesettingforunittest.b -Value \"customvalue\"\n            (Get-DbcConfigValue -Name testing.samplesettingforunittest.b) | Should -Be \"customvalue\"\n            Reset-DbcConfig -Name testing.samplesettingforunittest.group.*\n            (Get-DbcConfigValue -Name testing.samplesettingforunittest.b) | Should -Be \"customvalue\"\n        }\n\n        Mock Get-DbcConfig {\n            param([string]$Name = \"*\")\n            process {\n                $results = [PSFramework.Configuration.ConfigurationHost]::Configurations.Values |\n                    Where-Object { ($_.Name.startswith(\"testing.samplesettingforunittest.\")) -and ($_.Name -like $Name) -and ($_.Module -like \"dbachecks\") } |\n                    Sort-Object Module, Name\n                return $results | Select-Object Name, Value, Description\n            }\n        }\n\n        It \"Resetting all resets really all\" {\n            Set-DbcConfig -Name testing.samplesettingforunittest.group.a -Value \"newvalue1\"\n            Set-DbcConfig -Name testing.samplesettingforunittest.group.b -Value \"newvalue2\"\n            Set-DbcConfig -Name testing.samplesettingforunittest.b -Value \"customvalue\"\n            (Get-DbcConfigValue -Name testing.samplesettingforunittest.group.a) | Should -Be \"newvalue1\"\n            (Get-DbcConfigValue -Name testing.samplesettingforunittest.group.b) | Should -Be \"newvalue2\"\n            (Get-DbcConfigValue -Name testing.samplesettingforunittest.b) | Should -Be \"customvalue\"\n            Reset-DbcConfig\n            (Get-DbcConfigValue -Name testing.samplesettingforunittest.group.a) | Should -Be \"DefaultValueA\"\n            (Get-DbcConfigValue -Name testing.samplesettingforunittest.group.b) | Should -Be \"DefaultValueB\"\n            (Get-DbcConfigValue -Name testing.samplesettingforunittest.b) | Should -Be \"DefaultValueB\"\n        }\n    }\n}\n\n# cleanup, we don't want those test configuration options left in the system\n# the cleanup from within AfterAll did not work, so it is here\nReset-DbcConfig -Name testing.samplesettingforunittest.a\nReset-DbcConfig -Name testing.samplesettingforunittest.b\nReset-DbcConfig -Name testing.samplesettingforunittest.group.a\nReset-DbcConfig -Name testing.samplesettingforunittest.group.b\n\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQU3hbO6CI8W/M1qcw++tNBCLs0\n# vnOgggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz\n# c3VyZWQgSUQgQ29kZSBTaWduaW5nIENBMB4XDTE3MDUwOTAwMDAwMFoXDTIwMDUx\n# MzEyMDAwMFowVzELMAkGA1UEBhMCVVMxETAPBgNVBAgTCFZpcmdpbmlhMQ8wDQYD\n# VQQHEwZWaWVubmExETAPBgNVBAoTCGRiYXRvb2xzMREwDwYDVQQDEwhkYmF0b29s\n# czCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAI8ng7JxnekL0AO4qQg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pkxYz0IGhizgZtPxpMQBvwHgfqL2vmCSfdibqFT+hKUGIUukpHqaGxEMrJm\n# oecYpJpkUe8xggIoMIICJAIBATCBhjByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMM\n# RGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQD\n# EyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgQ29kZSBTaWduaW5nIENBAhACwXUo\n# dNXChDGFKtigZGnKMAkGBSsOAwIaBQCgeDAYBgorBgEEAYI3AgEMMQowCKACgACh\n# AoAAMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcCAQsxDjAM\n# BgorBgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBSXgbRjet+5yJGfXYhbhMNZOBK2\n# jzANBgkqhkiG9w0BAQEFAASCAQAzbYMqyxH8pyY80OhG5yhxH1F0G1YABQR+agNM\n# ZDlwgakLEornYun9zdbxFOI4e3S3PiK3upnN8Cf0tDOCETqgS6Dmkj6SFPfXoGn+\n# 2mWGtQjZjpD3mrO6s2YgvWozshBP1o5tJEL0S/JrEeXIqfo8aM9TEjIC8lcLMzSl\n# XYbBsja49DYbVMqEXDoWoGqF/mErfnSoA6aNJiY8Zw2quN+occ0RpSycTG3iOeLd\n# t/bdzOSB5qfAGuY/eSJ9ir6ApAAsXyOsjTqJihU9zpcVYzdRmi8ps4OPbFT0xEwD\n# uhdTxdncViT4yprsk1mKg8ESh5q3p2gEsRayDWOu9ybkrTtJ\n# SIG # End signature block\n"
  },
  {
    "path": "developing/Archive/tests/Test-SingleFile.ps1",
    "content": "param(\n    [Parameter(Mandatory = $true)]\n    [string]\n    $FileToTest\n)\n\n$FileToTest = Resolve-Path $FileToTest\n$fileName = Split-Path $FileToTest -leaf\nWrite-Verbose \"File to test = $FileToTest\"\n\nif ($FileName -like \"*.tests.ps1\")\n{\n    $filename = $fileName -replace \"tests\\.ps1$\", \"ps1\"\n    $sourceDir = Join-Path $PSScriptRoot \"Source\"\n    $functionFile = Get-ChildItem $sourceDir -Filter $fileName -Recurse | Select-Object -First 1 -ExpandProperty FullName\n    $testFile = $FileToTest\n}\nelse\n{\n    $fileName = $fileName -replace \".ps1$\", \".tests.ps1\"\n    $testFile = (Join-Path $PSScriptRoot \"../Tests/functions/$fileName\")\n    $functionFile = $FileToTest\n}\n\nInvoke-Pester -Script $testFile -ExcludeTag Integration -CodeCoverage $functionFile -CodeCoverageOutputFile \"$PSScriptRoot\\cov.xml\"\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUpB5aqYqtq9Xdt7AI7hSp9/E1\n# UFygggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz\n# c3VyZWQgSUQgQ29kZSBTaWduaW5nIENBMB4XDTE3MDUwOTAwMDAwMFoXDTIwMDUx\n# MzEyMDAwMFowVzELMAkGA1UEBhMCVVMxETAPBgNVBAgTCFZpcmdpbmlhMQ8wDQYD\n# VQQHEwZWaWVubmExETAPBgNVBAoTCGRiYXRvb2xzMREwDwYDVQQDEwhkYmF0b29s\n# czCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAI8ng7JxnekL0AO4qQgt\n# Kr6p3q3SNOPh+SUZH+SyY8EA2I3wR7BMoT7rnZNolTwGjUXn7bRC6vISWg16N202\n# 1RBWdTGW2rVPBVLF4HA46jle4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YDVQQGEwJVUzEVMBMGA1UEChMM\n# RGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQD\n# EyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgQ29kZSBTaWduaW5nIENBAhACwXUo\n# dNXChDGFKtigZGnKMAkGBSsOAwIaBQCgeDAYBgorBgEEAYI3AgEMMQowCKACgACh\n# AoAAMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcCAQsxDjAM\n# BgorBgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBQigsELcdjhHQ3tbsquYEBMa/ni\n# qjANBgkqhkiG9w0BAQEFAASCAQCIbziIa15P9j/f52eqbXeA56/aPRMgfQaPIhl0\n# pYOD22oW2MPTiTFroNc7XjBYu+T3d6FEryO6H7OBxAs2rVsYf9vKbVcPyfrE0v39\n# /3xRAvhhlEV2+4VLHbE+YCnSayJnMJgXxruqqmVIXWcJKKmKKDlAFWTDzXMeA852\n# f95wZ/r7Kd7styOrqn+JgKUTE9iqHdwDl04zJSVbau1AxD8JRw8MTcoNnDXdTuzK\n# qDj94G+fETrQQbvQ+tdMWHVqQ0IGD4sdrKFzt+BVOyBFfrsOR92MX05FEpK3UQuS\n# Tve0ZN+52pNYmlCic8zUxQbb5l3VrIa7BYHvy9+JPFOdDzOJ\n# SIG # End signature block\n"
  },
  {
    "path": "developing/Archive/tests/Unit.Tests.ps1",
    "content": "﻿$ModuleBase = Split-Path -Parent $MyInvocation.MyCommand.Path\n# For tests in .\\Tests subdirectory\nif ((Split-Path $ModuleBase -Leaf) -eq 'Tests') {\n    $ModuleBase = Split-Path $ModuleBase -Parent\n}\n\n# This should stop people making breaking changes to the tests without first altering the test\nRemove-Module dbachecks -Force -ErrorAction SilentlyContinue\nImport-Module $ModuleBase\\dbachecks.psd1\n\n$tokens = $null\n$errors = $null\nDescribe \"Checking that each dbachecks Pester test is correctly formatted for Power Bi and Coded correctly\" -Tags UnitTest {\n    $Checks = (Get-ChildItem $ModuleBase\\checks) #.Where{$PSItem.Name -eq 'Agent.Tests.ps1'}\n    $Checks.ForEach{\n        $CheckName = $psitem.Name\n        $Check = Get-Content $PSItem.FullName -Raw\n        Context \"$($PSItem.Name) - Checking Describes titles and tags\" {\n            $UniqueTags = (Get-DbcCheck).UniqueTag\n            ## This gets all of the code with a describe\n            $Describes = [Management.Automation.Language.Parser]::ParseInput($check, [ref]$tokens, [ref]$errors).\n            FindAll([Func[Management.Automation.Language.Ast, bool]] {\n                    param ($ast)\n                    $ast.CommandElements -and\n                    $ast.CommandElements[0].Value -eq 'describe'\n                }, $true) |\n            ForEach-Object {\n                $CE = $PSItem.CommandElements\n                $secondString = ($CE | Where-Object { $PSItem.StaticType.name -eq 'string' })[1]\n                $tagIdx = $CE.IndexOf(($CE | Where-Object ParameterName -eq 'Tags')) + 1\n                $tags = if ($tagIdx -and $tagIdx -lt $CE.Count) {\n                    $CE[$tagIdx].Extent\n                }\n                New-Object PSCustomObject -Property @{\n                    Name = $secondString\n                    Tags = $tags\n                }\n            }\n            @($describes).ForEach{\n                $title = $PSItem.Name.ToString().Trim('\"').Trim('''')\n                It \"The Describe Title - $title - Should Use a double quote after the Describe\" {\n                    $PSItem.Name.ToString().Startswith('\"') | Should -BeTrue -Because 'You need to alter the title of the Describe - We need use double quotes for titles'\n                    $PSItem.Name.ToString().Endswith('\"') | Should -BeTrue -Because 'You need to alter the title of the Describe - We need use double quotes for titles'\n                }\n                It \"The Describe Title - $title - should use a plural for tags\" {\n                    $PSItem.Tags | Should -Not -BeNullOrEmpty -Because 'You need to alter the tags parameter of the Describe - We use the plural of Tags'\n                }\n                # a simple test for no esses apart from statistics and Access!!\n                if ($null -ne $PSItem.Tags) {\n                    $PSItem.Tags.Text.Split(',').Trim().Where{ ($PSItem -ne '$filename') -and ($PSItem -notlike '*statistics*') -and ($PSItem -notlike '*BackupPathAccess*') -and ($PSItem -notlike '*OlaJobs*') -and ($PSItem -notlike '*status*') -and ($PSItem -notlike '*exists') -and ($PSItem -notlike '*Ops') }.ForEach{\n                        It \"The Describe Title - $title - Tags parameter $PSItem should be Singular\" {\n                            $PSItem.ToString().Endswith('s') | Should -BeFalse -Because 'You need to alter the tags for this Describe OR alter this test if the tag makes sense - Our coding standards say tags should be singular'\n                        }\n                    }\n                    It \"The Describe Title - $title - The first Tag $($PSItem.Tags.Text.Split(',')[0]) should be in the unique Tags returned from Get-DbcCheck\" {\n                        $UniqueTags | Should -Contain $PSItem.Tags.Text.Split(',')[0].ToString() -Because 'We need a unique tag for each test - Format should be -Tags space UniqueTag comma - Also if you are running this on a machine where dbachecks has already been imported previously try running reset-dbcconfig, which will create a new checks.json for Get-DbcCheck'\n                    }\n                }\n                else {\n                    It \"The Describe Title - $title - You haven't used the Tags Parameter so we can't check the tags\" {\n                        $false | Should -BeTrue -Because 'You need to alter the Describe - We use the Tags parameter'\n                    }\n                }\n            }\n        }\n        Context \"$($PSItem.Name) - Checking Contexts\" {\n            ## Find the Contexts\n            $Contexts = [Management.Automation.Language.Parser]::ParseInput($check, [ref]$tokens, [ref]$errors).\n            FindAll([Func[Management.Automation.Language.Ast, bool]] {\n                    param ($ast)\n                    $ast.CommandElements -and\n                    $ast.CommandElements[0].Value -eq 'Context'\n                }, $true) |\n            ForEach-Object {\n                $CE = $PSItem.CommandElements\n                $secondString = ($CE | Where-Object { $PSItem.StaticType.name -eq 'string' })[1]\n                New-Object PSCustomObject -Property @{\n                    Name = $secondString\n                }\n            }\n\n            @($Contexts).ForEach{\n                $title = $PSItem.Name.ToString().Trim('\"').Trim('''')\n                It \"The Context Title - $Title - Should end with `$PSItem (or `$clustername) So that the PowerBi will work correctly\" {\n                    $PSItem.Name.ToString().Endswith('psitem\"') -or $PSItem.Name.ToString().Endswith('clustername\"')  -or $PSItem.Name.ToString().Endswith('SqlInstance\"')  | Should -BeTrue -Because 'You need to alter the title of the Context - This helps the PowerBi to parse the data'\n                }\n            }\n        }\n        Context \"$($PSItem.Name) - Checking the Its\" {\n            $CheckName = $psitem.Name\n            ## Find the Its\n            $Its = [Management.Automation.Language.Parser]::ParseInput($check, [ref]$tokens, [ref]$errors).\n            FindAll([Func[Management.Automation.Language.Ast, bool]] {\n                    param ($ast)\n                    $ast.CommandElements -and\n                    $ast.CommandElements[0].Value -eq 'It'\n                }, $true) |\n            ForEach-Object {\n                $CE = $PSItem.CommandElements\n                $secondString = ($CE | Where-Object { $PSItem.StaticType.name -eq 'string' })[1]\n                New-Object PSCustomObject -Property @{\n                    Name = $secondString\n                }\n            }\n\n\n            @($Its).ForEach{\n                $title = $PSItem.Name.ToString().Trim('\"').Trim('''')\n                It \"The It Title - $Title - Should end with the right ending so that the PowerBi will work correctly\" {\n                    $Lower = $PSItem.Name.ToString().ToLower()\n                    $Lower.Endswith('psitem\"') -or $Lower.Endswith('clustername\"') -or $Lower.EndsWith('server)\"') -or $Lower.EndsWith('name)\"') -or $Lower.EndsWith('name\"') -or $Lower.EndsWith('instance\"') -or $Lower.EndsWith('instance)\"') -or $Lower.EndsWith('domain)\"') -or $Lower.EndsWith('domain\"') -or $Lower.EndsWith('replica)\"') | Should -BeTrue -Because 'You need to alter the title of the It, it should end with the instance name or computername - This helps the PowerBi to parse the data'\n                }\n                if ($CheckName -eq 'Database.Tests.ps1') {\n                    It \"The It Title - $Title - Should begin with - Database\" {\n                        $PSItem.Name.ToString().StartsWith('\"Database') -or $PSItem.Name.ToString().StartsWith('\"Can') | Should -BeTrue -Because 'You need to alter the It Title to start with Database (or Can t Connect) - For the database checks we can parse them and make magic'\n                    }\n                }\n            }\n        }\n        Context \"$($PSItem.Name) - Checking Code\" {\n            $CheckName = $psitem.Name\n            ## This just grabs all the code\n            $AST = [System.Management.Automation.Language.Parser]::ParseInput($Check, [ref]$null, [ref]$null)\n            $Statements = $AST.EndBlock.statements.Extent\n            ## Ignore the filename line\n            @($Statements.Where{ $PSItem.StartLineNumber -ne 1 }).ForEach{\n                # make sure we only regex if the title contains a describe\n                if ($PSItem.Text -match 'Describe') {\n                    $title = [regex]::matches($PSItem.text, \"Describe(.*)-Tag\").groups[1].value.Replace('\"', '').Replace('''', '').trim()\n                    if ($title -ne 'Cluster $clustername Health using Node $clustervm') {\n                        It \"Describe - $title - Should Use Get-Instance or Get-ComputerName\" {\n                            ($PSItem.text -Match 'Get-Instance') -or ($PSItem.text -match 'Get-ComputerName') | Should -BeTrue -Because 'These are the commands to use to get Instances or Computers'\n                        }\n                    }\n                    if ($title -ne 'Cluster $clustername Health using Node $clustervm') {\n                        It \"Describe - $title Should use the ForEach Method\" {\n                            ($PSItem.text -match 'Get-Instance\\).ForEach{' ) -or ($Psitem.text -match 'Get-ComputerName\\).ForEach{' ) | Should -BeTrue # use the \\ to escape the ) -Because 'We use the ForEach method in our coding standards'\n                        }\n                    }\n                    It \"Describe - $title Should not use `$_\" {\n                        ($PSItem.text -match '$_' ) | Should -BeFalse -Because '¬$psitem is the correct one to use'\n                    }\n                    if ($CheckName -ne 'Agent.Tests.ps1') {\n                        It \"Describe - $title Should Contain a Context Block\" {\n                            $PSItem.text -match 'Context' | Should -BeTrue -Because 'This helps the Power BI'\n                        }\n                    }\n                    else {\n                        $Contexts = [Management.Automation.Language.Parser]::ParseInput($check, [ref]$tokens, [ref]$errors).\n                        FindAll([Func[Management.Automation.Language.Ast, bool]] {\n                                param ($ast)\n                                $ast.CommandElements -and\n                                $ast.CommandElements[0].Value -eq 'Context'\n                            }, $true) |\n                        ForEach-Object {\n                            $CE = $PSItem.CommandElements\n                            $secondString = ($CE | Where-Object { $PSItem.StaticType.name -eq 'string' })[1]\n                            New-Object PSCustomObject -Property @{\n                                Name = $secondString\n                            }\n                        }\n                        It \"$CheckName should have the right number of Context blocks as the AST doesnt parse how I like and I cant be bothered to fix it right now\"{\n                            $Contexts.Count | Should -Be 27 -Because \"There should be 27 context blocks in the Agent checks file\"\n                        }\n                    }\n                }\n            }\n        }\n    }\n    (Get-DbcCheck).ForEach{\n        It \"Should have one Unique Tag for each check\" {\n            $psitem.UniqueTag.Count | Should -Be 1 -Because \"You need to check that the tags for this check -  We want to only have one Unique Tag per test and we got $($psitem.UniqueTag) instead\"\n        }\n    }\n}\n\nDescribe \"Checking that there is a description for each check\" -Tags UnitTest {\n    (Get-DbcCheck).ForEach{\n        It \"$($psitem.UniqueTag) Should have a description in the DbcCheckDescriptions.json\" {\n            $psitem.description | Should -Not -BeNullOrEmpty -Because \"We need a description in the .\\internal\\configurations\\DbcCheckDescriptions.json for $($psitem.uniquetag) so that Get-DbcCheck shows it\"\n        }\n    }\n}\n\nDescribe \"Each Config referenced in a check should exist\" -Tags UnitTest {\n    $dbcConfig = (Get-DbcConfig).Name\n    ((Get-DbcCheck).Config.Split(' ') | Sort-Object -Unique).Where{ $Psitem -ne '' }.ForEach{\n        It \"Config Value $psitem Should exist in Get-DbcConfig\" {\n            $Psitem | Should -BeIn $dbcConfig -Because \"You need to look at the configurations as there appears to not be a unique tag\"\n        }\n    }\n}\n\nDescribe \"Database Tests Exclusions\" {\n    $DbChecks = (Get-ChildItem $ModuleBase\\checks).Where{ $PSItem.Name -eq 'Database.Tests.ps1' }\n    $Check = Get-Content $DbChecks.FullName -Raw\n\n    $Describes = [Management.Automation.Language.Parser]::ParseInput($check, [ref]$tokens, [ref]$errors).\n    FindAll([Func[Management.Automation.Language.Ast, bool]] {\n            param ($ast)\n            $ast.CommandElements -and\n            $ast.CommandElements[0].Value -eq 'describe'\n        }, $true) |\n    ForEach-Object {\n        $CE = $PSItem.CommandElements\n        $secondString = ($CE | Where-Object { $PSItem.StaticType.name -eq 'string' })[1]\n        [PSCustomObject] @{\n            Name   = $secondString.Value\n            Extent = $secondString.Parent.Extent.Text\n        }\n    }\n\n    $Describes.ForEach{\n        It \"$($Psitem.Name) should reference the global exclude configuration\" {\n            $psitem.Extent -like \"*`$ExcludedDatabases*\" | Should -BeTrue -Because \"We need to exclude the databases specified in the config command.invokedbccheck.excludedatabases\"\n        }\n    }\n}\n\n# SIG # Begin signature block\n#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MCMGCSqGSIb3DQEJBDEWBBRJ2yB4Tm6Zaxb+gZab7tFGYsxW\n# 9TANBgkqhkiG9w0BAQEFAASCAQCCIcStyAb/yxOlY9t7GWaqEVgSZydVqjfbx/9O\n# m0TxalifwzRAVoMFufzivmRJdC4eCEHwa52JRQuFil0Ucmu0H/ITZk44NkhNjZk3\n# FmV0EHKtkhhuMyEObzeVqzz4htjDobLbjfsu/IvP7NEAznq5MrDRgfFz/L4Ndyyt\n# wD53mmsQtGoX9OWgL14gKxQZhxbzNJV72f9VFfBWcZ5Zcxh4foerG2jikAtyeH93\n# vfeEiPewVvTtR9NzKQmRz9nqKtRTUaZCPHeYIoGX0Sq2HdCfY6fRNt/cSOhrOr1N\n# JdrpoTCNdFA6oeEN7GMQ056XIjQCcYwaFWExQrqridnObxYu\n# SIG # End signature block\n"
  },
  {
    "path": "developing/Archive/tests/build/Initialize-VstsAgentOnWindowsServerCoreContainer.ps1",
    "content": "##################################################################################################################\n# Script Disclaimer\n##################################################################################################################\n# This script is not supported under any Microsoft standard support program or service.\n# This script is provided AS IS without warranty of any kind.\n# Microsoft disclaims all implied warranties including, without limitation, any implied warranties of\n# merchantability or of fitness for a particular purpose. The entire risk arising out of the use or\n# performance of this script and documentation remains with you. In no event shall Microsoft, its authors,\n# or anyone else involved in the creation, production, or delivery of this script be liable for any damages\n# whatsoever (including, without limitation, damages for loss of business profits, business interruption,\n# loss of business information, or other pecuniary loss) arising out of the use of or inability to use\n# this script or documentation, even if Microsoft has been advised of the possibility of such damages.\n\n<#\n.SYNOPSIS\n    This script creates ACI container instance(s) which run the Azure DevOps (formerly VSTS) Agent, alongside with the requested\n    PowerShell modules, json2hcl and Terraform to enable Azure resource build automation from Azure DevOps CI/CD pipelines.\n.DESCRIPTION\n    This script is used as a wrapper of the container configuration script\n    (\"Install-VstsAgentOnWindowsServerCoreContainer.ps1\") to create ACI container instance(s) which run\n    the Azure DevOps Agent, alongside with the requested PowerShell modules, json2hcl and Terraform to enable Azure resource build\n    automation from Azure DevOps CI/CD pipelines.\n\n    It copies the container configuration script to a publicly available storage container of the requested\n    Storage Account, it creates a new Resource Group (if one doesn't exist with the provided name), removes\n    any pre-existing ACI containers with the same name, within the same Resource Group, then creates new ACI\n    container instance(s) based on the provided names and invokes the container configuration script inside the\n    container(s).\n\n    This script is designed and tested to be run from Azure Cloud Shell.\n    Prerequisites:\n    - Azure Subscription, with an existing Storage Account\n    - You need to have **admin rights** :\n    - to create a storage container within the already existing Storage Account *- OR -*  you need to have\n      a storage container which has its public access type configured to the type of \"Blob\",\n    - to create a new Resource Group *- OR -*  an existing Resource Group for the Azure Container Instances,\n    - to create resources in the selected Resource Group.\n    - Azure DevOps account with the requested Agent Pool has to exist.\n    - Permission in the Azure DevOps account to add Agents to the chosen Agent Pool.\n    - A PAT token.\n.PARAMETER SubscriptionName\n    Name of the Subscription.\n.PARAMETER ResourceGroupName\n    Name of the Resource Group.\n.PARAMETER ContainerName\n    Name of the ACI container(s).\n.PARAMETER ReplaceExistingContainer\n    Switch to replace existing container(s) with the same name(s) provided.\n.PARAMETER MemoryInGB\n    Amount of memory in GBs.\n.PARAMETER Cpu\n    Number of CPU cores.\n.PARAMETER Location\n    Region of the Azure resources.\n.PARAMETER StorageAccountName\n    Name of the Storage Account to upload the script file to, which is then invoke by this wrapper.\n.PARAMETER StorageContainerName\n    Name of the storage container to upload the script file to be invoked by this wrapper.\n.PARAMETER ScriptPublicUrl\n    Publicly available URL of the internal script file to be invoked by this wrapper. This can be used optionally, instead of defining the Storage Account name. You need to make the internal script available on this URL as a prerequisite.\n.PARAMETER ScriptFileName\n    Name of the script file to invoke by this wrapper.\n.PARAMETER VSTSAccountName\n    Name of the Azure Devops account - formerly Visual Studio Team Services (VSTS) account, e.g. https://<Azure DevOps Account Name>.visualstudio.com - OR - https://dev.azure.com/<Azure DevOps Account Name>/\n.PARAMETER PATToken\n    PPAT token generated by the user who is configuring the container to be used by Azure Devops.\n.PARAMETER PoolName\n    Name of the Agent pool. It defaults to the \"Default\" pool when not defined.\n.PARAMETER RequiredPowerShellModules\n    List of the required PowerShell modules, e.g. Az, AzureAD, Pester\n.PARAMETER ContainerImage\n    Fully qualified name of the container image, optionally including tags.\n.PARAMETER AcrPassword\n    Access password to the Azure Container Registry (ACR)\n.PARAMETER InstallAzureCli\n    Switch to define whether or not you want to install the Azure CLI on your container.\n.PARAMETER InstallPowerShellCore\n    Switch to define whether or not you want to install Azure PowerShell Core on your container.\n.PARAMETER UseChocolatey\n    Switch to define whether or not Chocolatey should be used to install the supported components\n.EXAMPLE\n    .\\Initialize-VstsAgentOnWindowsServerCoreContainer.ps1 -SubscriptionName \"<subscription name>\" -ResourceGroupName \"<resource group name>\" -ContainerName \"<container 1 name>\", \"<container 2 name>\" -Location \"<azure region>\" -StorageAccountName \"<storage account name>\" -VSTSAccountName \"<azure devops account name>\" -PATToken \"<PAT token>\"\n    This uploads the container configuration script to the default \"publicvstsscript\" storage container of the requested Storage Account and then creates 2 Azure Container Instances, with the default settings (Default Agent Pool 1 GB RAM, 1 CPU core, PowerShell modules installed: \"Az\", \"AzureAD\", \"Pester\").\n.EXAMPLE\n    .\\Initialize-VstsAgentOnWindowsServerCoreContainer.ps1 -SubscriptionName \"<subscription name>\" -ResourceGroupName \"<resource group name>\" -ContainerName \"<container 1 name>\", \"<container 2 name>\" -Location \"<azure region>\" -VSTSAccountName \"<azure devops account name>\" -PATToken \"<PAT token>\"\n    This downloads the container configuration script directly from its default location on GitHub, and then creates 2 Azure Container Instances, with the default settings (Default Agent Pool 1 GB RAM, 1 CPU core, PowerShell modules installed: \"Az\", \"AzureAD\", \"Pester\").\n.EXAMPLE\n    .\\Initialize-VstsAgentOnWindowsServerCoreContainer.ps1 -SubscriptionName \"<subscription name>\" -ResourceGroupName \"<resource group name>\" -ContainerName \"<container 1 name>\", \"<container 2 name>\" -Location \"<azure region>\" -VSTSAccountName \"<azure devops account name>\" -PATToken \"<PAT token>\" -ScriptPublicUrl \"<public URL of the internal config script>\"\n    This downloads the container configuration script directly from the provided location (this can be anything, e.g. GitHub, a public Storage Account, or any publicly available URL), and then creates 2 Azure Container Instances, with the default settings (Default Agent Pool 1 GB RAM, 1 CPU core, PowerShell modules installed: \"Az\", \"AzureAD\", \"Pester\").\n.EXAMPLE\n    .\\Initialize-VstsAgentOnWindowsServerCoreContainer.ps1 -SubscriptionName \"<subscription name>\" -ResourceGroupName \"<resource group name>\" -ContainerName \"<container 1 name>\", \"<container 2 name>\" -Location \"<azure region>\" -StorageAccountName \"<storage account name>\" -StorageContainerName \"publicvstsscript\" -MemoryInGB 1 -Cpu 1 -ScriptFileName \"Install-VstsAgentOnWindowsServerCoreContainer.ps1\" -VSTSAccountName \"<Azure DevOps Account name>\" -PATToken \"<PAT token>\" -PoolName \"<Azure DevOps Agent Pool name>\" -RequiredPowerShellModules \"Az\", \"AzureAD\", \"Pester\"\n    This installs 2 Azure Container Instances with all the possible values manually defined.\n.EXAMPLE\n    .\\Initialize-VstsAgentOnWindowsServerCoreContainer.ps1 -SubscriptionName \"<subscription name>\" -ResourceGroupName \"<resource group name>\" -ContainerName \"<container 1 name>\", \"<container 2 name>\" -Location \"<azure region 2>\" -StorageAccountName \"<storage account name>\" -VSTSAccountName \"<azure devops account name>\" -PATToken \"<PAT token>\" -PoolName \"<agent pool name>\" -ReplaceExistingContainer\n    This removes any existing ACI containers with the provided names, then creates new ones with the requested values.\n.EXAMPLE\n    .\\Initialize-VstsAgentOnWindowsServerCoreContainer.ps1 -SubscriptionName \"<subscription name>\" -ResourceGroupName \"<resource group name>\" -ContainerName \"<container 1 name>\", \"<container 2 name>\" -Location \"<azure region>\" -StorageAccountName \"<storage account name>\" -VSTSAccountName \"<azure devops account name>\" -PATToken \"<PAT token>\" -ContainerImage <myacr.azurecr.io/myrepo/myimage:v1> -AcrPassword <ACR password>\n    This uploads the container configuration script to the default \"publicvstsscript\" storage container of the requested Storage Account and then creates 2 Azure Container Instances, based on the custom image provided, with the default settings (Default Agent Pool 1 GB RAM, 1 CPU core, PowerShell modules installed: \"Az\", \"AzureAD\", \"Pester\").\n\n.INPUTS\n    <none>\n.OUTPUTS\n    <none>\n.NOTES\n    Version:        1.0\n    Author:         Mate Barabas\n    Creation Date:  2018-08-29\n#>\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSAvoidUsingPlainTextForPassword\", \"\")]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSUseShouldProcessForStateChangingFunctions\", \"\")]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSAvoidUsingConvertToSecureStringWithPlainText\", \"\")]\n[CmdletBinding()]\nparam(\n\n    [Parameter(Mandatory = $true,\n        HelpMessage = \"Name of the Subscription.\")]\n    [ValidateNotNullOrEmpty()]\n    [string]$SubscriptionName,\n\n    [Parameter(Mandatory = $true,\n        HelpMessage = \"Name of the Resource Group.\")]\n    [ValidateNotNullOrEmpty()]\n    [string]$ResourceGroupName,\n\n    [Parameter(Mandatory = $false,\n        HelpMessage = \"Name of the ACI container(s).\")]\n    [ValidateNotNullOrEmpty()]\n    [array]$ContainerName,\n\n    [Parameter(Mandatory = $false,\n        HelpMessage = \"Switch to replace existing container(s) with the same name(s) provided.\")]\n    [ValidateNotNullOrEmpty()]\n    [switch]$ReplaceExistingContainer,\n\n    [Parameter(Mandatory = $false,\n        HelpMessage = \"Amount of memory in GBs.\")]\n    [ValidateNotNullOrEmpty()]\n    [int]$MemoryInGB = 1,\n\n    [Parameter(Mandatory = $false,\n        HelpMessage = \"Number of CPU cores.\")]\n    [ValidateNotNullOrEmpty()]\n    [int]$Cpu = 1,\n\n    [Parameter(Mandatory = $true,\n        HelpMessage = \"Region of the Azure resources.\")]\n    [ValidateNotNullOrEmpty()]\n    [string]$Location,\n\n    [Parameter(Mandatory = $false,\n        HelpMessage = \"Name of the Storage Account to upload the script file to, which is then invoke by this wrapper.\")]\n    [ValidateNotNullOrEmpty()]\n    [string]$StorageAccountName,\n\n    [Parameter(Mandatory = $false,\n        HelpMessage = \"Name of the Storage Account Resource Group\")]\n    [ValidateNotNullOrEmpty()]\n    [string]$StorageAccountResourceGroupName,\n\n    [Parameter(Mandatory = $false,\n        HelpMessage = \"Name of the storage container to upload the scriptfile to be invoked by this wrapper.\")]\n    [ValidateNotNullOrEmpty()]\n    [string]$StorageContainerName = \"publicvstsscript\",\n\n    [Parameter(Mandatory = $false,\n        HelpMessage = \"Publicly available URL of the internal script file to be invoked by this wrapper. This can be used optionally, instead of defining the Storage Account name. You need to make the internal script available on this URL as a prerequisite.\")]\n    [ValidateNotNullOrEmpty()]\n    [string]$ScriptPublicUrl = \"https://raw.githubusercontent.com/matebarabas/azure/master/scripts/AzureDevOpsAgentOnACI/Install-VstsAgentOnWindowsServerCoreContainer.ps1\",\n\n    [Parameter(Mandatory = $false,\n        HelpMessage = \"Name of the script file to invoke by this wrapper.\")]\n    [ValidateNotNullOrEmpty()]\n    [string]$ScriptFileName = \"Install-VstsAgentOnWindowsServerCoreContainer.ps1\",\n\n    [Parameter(Mandatory = $false,\n        HelpMessage = \"Path to the file - if script not running in same directory\")]\n    [ValidateNotNullOrEmpty()]\n    [string]$ScriptFilePath = \".\\\",\n\n    [Parameter(Mandatory = $true,\n        HelpMessage = \"Name of the Visual Studio Team Services Account (VSTS), e.g. https://<VSTSAccountName>.visualstudio.com\")]\n    [ValidateNotNullOrEmpty()]\n    [string]$VSTSAccountName,\n\n    [Parameter(Mandatory = $true,\n        HelpMessage = \"PAT token generated by the user who is configuring the container to be used by VSTS.\")]\n    [ValidateNotNullOrEmpty()]\n    [string]$PATToken,\n\n    [Parameter(Mandatory = $false,\n        HelpMessage = \"Name of the Agent pool. It defaults to the \"\"Default\"\" pool when not defined.\")]\n    [ValidateNotNullOrEmpty()]\n    [string]$PoolName = \"Default\",\n\n    [Parameter(Mandatory = $false,\n        HelpMessage = \"List of the required PowerShell modules, e.g. Az, AzureAD, Pester\")]\n    [ValidateNotNullOrEmpty()]\n    [array]$RequiredPowerShellModules = @(\"Az\", \"AzureAD\", \"Pester\"),\n\n    [Parameter(Mandatory = $false,\n        HelpMessage = \"Access password to the Azure Container Registry (ACR)\")]\n    [ValidateNotNullOrEmpty()]\n    [string]$AcrPassword,\n\n    [Parameter(Mandatory = $false,\n        HelpMessage = \"Fully qualified name of the container image, optionally including tags.\")]\n    [ValidateNotNullOrEmpty()]\n    [string]$ContainerImage, # e.g. \"microsoft/dotnet-framework:4.7.2-runtime-20190212-windowsservercore-ltsc2016\" or \"microsoft/windowsservercore:10.0.14393.2791\" or \"mcr.microsoft.com/windows/servercore:ltsc2016\"\n\n    [Parameter(Mandatory = $false,\n        HelpMessage = \"Switch to define whether or not you want to install the Azure CLI on your container.\")]\n    [ValidateNotNullOrEmpty()]\n    [bool]$InstallAzureCli = $false,\n\n    [Parameter(Mandatory = $false,\n        HelpMessage = \"Switch to define whether or not you want to install Azure PowerShell Core on your container.\")]\n    [ValidateNotNullOrEmpty()]\n    [bool]$InstallPowerShellCore = $false,\n\n    [Parameter(Mandatory = $false,\n        HelpMessage = \"Switch to define whether or not Chocolatey should be used to install the supported components\")]\n    [ValidateNotNullOrEmpty()]\n    [bool]$UseChocolatey = $false\n\n)\n\n#region Functions\nfunction Set-AzureContext {\n    [Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSUseShouldProcessForStateChangingFunctions\", \"\")]\n    [CmdletBinding()]\n    param (\n\n        [Parameter(Mandatory = $false)][string]$SubscriptionName\n\n    )\n\n    # Select the desired Subscription based on the Subscription name provided\n    if ($SubscriptionName) {\n        $Subscription = (Get-AzureRmSubscription | Where-Object { $_.Name -eq $SubscriptionName })\n\n        if (-not $Subscription) {\n            Write-Error \"There's no Subscription available with the provided name.\"\n            return\n        }\n        else {\n            $SubscriptionId = $Subscription.Id\n            Select-AzureRmSubscription -SubscriptionId $SubscriptionId | Out-Null\n            Write-Output \"The following subscription was selected: \"\"$SubscriptionName\"\"\"\n        }\n    }\n    # If no Subscription name was provided select the active Subscription based on the existing context\n    else {\n        $SubscriptionName = (Get-AzureRmContext).Subscription.Name\n        $Subscription = (Get-AzureRmSubscription | Where-Object { $_.Name -eq $SubscriptionName })\n        Write-Output \"The following subscription was selected: \"\"$SubscriptionName\"\"\"\n    }\n\n    if ($Subscription.Count -gt 1) {\n        Write-Error \"You have more then 1 Subscription with the same name. Exiting...\"\n        return\n    }\n}\n\nif (-not $StorageAccountResourceGroupName) {\n    $StorageAccountResourceGroupName = $ResourceGroupName\n}\n\nfunction Copy-ScriptToStorageAccount {\n\n    param (\n\n        [Parameter(Mandatory = $true)][string]$StorageAccountName,\n        [Parameter(Mandatory = $true)][string]$StorageAccountResourceGroupName,\n        [Parameter(Mandatory = $false)][string]$StorageContainerName = \"publicvstsscript\",\n        [Parameter(Mandatory = $false)][string]$ScriptFileName = \"Install-VstsAgentOnWindowsServerCoreContainer.ps1\"\n\n    )\n\n    # Check if the Install-VstsAgentOnWindowsServerCoreContainer.ps1 script exists within the same folder\n    if (-not (Get-Item -Path \"$ScriptFilePath\\$ScriptFileName\" -ErrorAction SilentlyContinue)) {\n        Write-Error \"The script to be uploaded to the Storage Account ($ScriptFilePath\\$ScriptFileName) does not exist in the same folder. Make sure that it is copied to the same folder along with the Initialize-VstsAgentOnWindowsServerCoreContainer.ps1 script. Exiting...\"\n\n        break\n    }\n\n    if (-not (Get-AzureRmStorageAccount -ResourceGroupName $StorageAccountResourceGroupName -Name $StorageAccountName -ErrorAction SilentlyContinue)) {\n        New-AzureRmStorageAccount -ResourceGroupName $StorageAccountResourceGroupName -Name $StorageAccountName -Location \"West Europe\" -SkuName \"Standard_GRS\"\n    }\n\n    # Getting Storage Account Key\n    Write-Output \"Getting Storage Account Key...\"\n    $StorageKey = Get-AzureRmStorageAccountKey -ResourceGroupName $StorageAccountResourceGroupName -Name $StorageAccountName\n\n    # Setting storage context\n    Write-Output \"Setting storage context...\"\n    $ctx = New-AzureStorageContext -StorageAccountName  $StorageAccountName -StorageAccountKey $StorageKey[0].Value\n\n    # Checking if the container exists, creating if it doesn't\n    $StorageContainer = Get-AzureStorageContainer -Context $ctx -Name $StorageContainerName -ErrorAction SilentlyContinue\n    if (-not $StorageContainer) {\n        Write-Output \"Storage container \"\"$StorageContainerName\"\" does not exist in the \"\"$StorageAccountName\"\" Storage Account. Creating storage container with public access...\"\n        New-AzureStorageContainer -Context $ctx -Name $StorageContainerName -Permission Blob | Out-Null\n        Write-Output \"Wait 10 seconds...\"\n        Start-Sleep -Seconds 10\n    }\n    else {\n        Write-Output \"Storage container \"\"$StorageContainerName\"\" exists in the \"\"$StorageAccountName\"\" Storage Account.\"\n        $PublicAccess = (Get-AzureStorageContainerAcl -Name $StorageContainerName -Context $ctx).PublicAccess\n        if ($PublicAccess -ne \"Blob\") {\n            Write-Output \"Public Access was configured to $PublicAccess. Resetting it to \"\"Blob\"\" (public access).\"\n            Set-AzureStorageContainerAcl -Name $StorageContainerName -Permission Blob\n            Write-Output \"Wait 10 seconds...\"\n            Start-Sleep -Seconds 10\n        }\n    }\n\n    # Check if container creation was successful\n    $StorageContainer = Get-AzureStorageContainer -Context $ctx -Name $StorageContainerName -ErrorAction SilentlyContinue\n    if (-not $StorageContainer) {\n        Write-Error \"Storage container ($StorageContainerName) could not be created in the $StorageAccountName Storage Account. Exiting...\"\n        break\n    }\n\n    # Uploading CSV file\n    Write-Output \"Uploading the Install-VstsAgentOnWindowsServerCoreContainer.ps1 script to the Storage Account...\"\n    Set-AzureStorageBlobContent -Container $StorageContainerName -File \"$ScriptFilePath\\$ScriptFileName\" -Blob $ScriptFileName -context $ctx -Force | Out-Null\n\n    # Checking success\n    $Blob = Get-AzureStorageBlob -Context $ctx -Container $StorageContainerName -Blob $ScriptFileName -ErrorAction SilentlyContinue\n    if ($Blob) {\n        Write-Output \"The script file ($ScriptFileName) was successfully uploaded to the \"\"$StorageContainerName\"\" container of the \"\"$StorageAccountName\"\" Storage Account in the \"\"$StorageAccountResourceGroupName\"\" Resource Group.\"\n    }\n    else {\n        Write-Error \"The script file ($ScriptFileName) could not be uploaded to the \"\"$StorageContainerName\"\" container of the \"\"$StorageAccountName\"\" Storage Account in the \"\"$StorageAccountResourceGroupName\"\" Resource Group. Exiting...\"\n        break\n    }\n\n}\n\nfunction New-Container {\n    [Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSAvoidUsingPlainTextForPassword\", \"\")]\n    [Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSUseShouldProcessForStateChangingFunctions\", \"\")]\n    [CmdletBinding()]\n    param (\n        [Parameter(Mandatory = $false)][string]$AcrPassword,\n        [Parameter(Mandatory = $true)][string]$ContainerImage\n    )\n\n    # Create & Install containers\n\n    if ($StorageAccountName) { #if you want to upload the internal script to a Storage Account\n        $ScriptURL = \"https://$StorageAccountName.blob.core.windows.net/$StorageContainerName/$ScriptFileName\"\n    }\n    else { # if you want to use the internal script from a public location (e.g. GitHub)\n        $ScriptURL = $ScriptPublicUrl\n    }\n\n    foreach ($Name in $ContainerName) {\n\n        $CanCreateContainerWithProvidedName = $true\n        $ExistingContainer = Get-AzureRmContainerGroup -ResourceGroupName $ResourceGroupName -Name $Name -ErrorAction SilentlyContinue\n        if ($ExistingContainer) {\n            Write-Warning \"ACI container with the requested name ($Name) already exists in the given Resource Group ($ResourceGroupName).\"\n            $CanCreateContainerWithProvidedName = $false\n            if ($ReplaceExistingContainer.IsPresent) {\n                Write-Warning \"Deleting the existing container instance ($Name)...\"\n                Remove-AzureRmContainerGroup -ResourceGroupName $ResourceGroupName -Name $Name -Confirm:$false\n                Write-Warning \"Unregistering existing container instance ($Name) from Agent pool ($PoolName)...\"\n                Remove-AzureDevOpsAgentFromPool -PatToken $PatToken -AzureDevOpsAccountName $VSTSAccountName -AgentPoolName $PoolName -ContainerName $ContainerName\n\n                $ContainerDeletetionWasRequired = $true\n                $CanCreateContainerWithProvidedName = $true\n                Write-Output \"Waiting 10 seconds...\"\n                Start-Sleep -Seconds 10\n            }\n            else {\n                Write-Output \"Existing container with the name of $Name is being kept.\"\n            }\n        }\n        if ($CanCreateContainerWithProvidedName) {\n            $CreateAtLeastOneContainer = $true\n            Write-Output \"Creating ACI container ($Name) with the image of $ContainerImage...\"\n            Write-Output \"Instantiating a container can take a few minutes, depending on the image size and whether or not the container image is cached in the ACI platform.\"\n\n            if ($RequiredPowerShellModules.Count -gt 1) {\n                $RequiredPowerShellModules = $RequiredPowerShellModules -join \",\"\n            }\n\n            if ($AcrPassword) {\n                $SecPasswd = ConvertTo-SecureString $AcrPassword -AsPlainText -Force\n                $RegistryName = $ContainerImage.Split(\".\")[0]\n                $MyCred = New-Object System.Management.Automation.PSCredential ($RegistryName, $SecPasswd)\n\n                if ($PSVersionTable.PSEdition -eq \"Core\") {\n                    # The AZ CLI has to be used, as the required -Command parameter is not available in the core version of the related AzureRM PowerShell module in Azure Cloud Shell.\n                    # When running in Cloud Shell, login is not required (has already happened)\n                    if ($null -ne $env:ACC_CLOUD) {\n                        az container create --resource-group $ResourceGroupName --name $Name --image $ContainerImage --registry-password $AcrPassword --location $Location --os-type Windows --cpu $Cpu --memory $MemoryInGB --restart-policy Always --command-line \"powershell Start-Sleep -Seconds 20; Invoke-WebRequest -Uri $ScriptURL -OutFile $ScriptFileName -UseBasicParsing; & .\\\\$ScriptFileName -VSTSAccountName $VSTSAccountName -PATToken $PATToken -AgentNamePrefix $Name -PoolName $PoolName -InstallPowerShellCore $InstallPowerShellCore -InstallAzureCli $InstallAzureCli -UseChocolatey $UseChocolatey -RequiredPowerShellModules $RequiredPowerShellModules\" --subscription $SubscriptionName --output none\n                    }\n                }\n                elseif ($PSVersionTable.PSEdition -eq \"Desktop\") {\n                    # Alternative option, using AzureRM PowerShell commandlet (this doesn't work in Azure Cloud Shell, as the -Command parameter is not available in the core version of this cmdlet)\n                    New-AzureRmContainerGroup -ResourceGroupName $ResourceGroupName `\n                        -Name $Name `\n                        -Image $ContainerImage `\n                        -Location $Location `\n                        -OsType Windows `\n                        -Cpu $Cpu `\n                        -MemoryInGB $MemoryInGB `\n                        -RestartPolicy Always `\n                        -RegistryCredential $MyCred `\n                        -Command \"powershell Start-Sleep -Seconds 20; Invoke-WebRequest -Uri $ScriptURL -OutFile $ScriptFileName -UseBasicParsing; & .\\$ScriptFileName -VSTSAccountName $VSTSAccountName -PATToken $PATToken -AgentNamePrefix $Name -PoolName $PoolName -RequiredPowerShellModules $RequiredPowerShellModules -InstallAzureCli $InstallAzureCli -UseChocolatey $UseChocolatey -InstallPowerShellCore $InstallPowerShellCore\" | Out-null\n                }\n                else {\n                    Write-Error \"PowerShell version could not be defined. Exiting...\"\n                    return\n                }\n            }\n            else {\n                if ($PSVersionTable.PSEdition -eq \"Core\") {\n                    # The AZ CLI has to be used, as the required -Command parameter is note available in the core version of the related AzureRM PowerShell module in Azure Cloud Shell.\n                    # When running in Cloud Shell, login is not required (has already happened)\n                    if ($null -ne $env:ACC_CLOUD) {\n                        az container create --resource-group $ResourceGroupName --name $Name --image $ContainerImage --location $Location --os-type Windows --cpu $Cpu --memory $MemoryInGB --restart-policy Always --command-line \"powershell Start-Sleep -Seconds 20; Invoke-WebRequest -Uri $ScriptURL -OutFile $ScriptFileName -UseBasicParsing; & .\\\\$ScriptFileName -VSTSAccountName $VSTSAccountName -PATToken $PATToken -AgentNamePrefix $Name -PoolName $PoolName -RequiredPowerShellModules $RequiredPowerShellModules -InstallAzureCli $InstallAzureCli -UseChocolatey $UseChocolatey -InstallPowerShellCore $InstallPowerShellCore\" --subscription $SubscriptionName --output none\n                    }\n                }\n                elseif ($PSVersionTable.PSEdition -eq \"Desktop\") {\n                    # Alternative option, using AzureRM PowerShell commandlet (this doesn't work in Azure Cloud Shell, as the -Command parameter is not available in the core version of this cmdlet)\n                    New-AzureRmContainerGroup -ResourceGroupName $ResourceGroupName `\n                        -Name $Name `\n                        -Image $ContainerImage `\n                        -Location $Location `\n                        -OsType Windows `\n                        -Cpu $Cpu `\n                        -MemoryInGB $MemoryInGB `\n                        -RestartPolicy Always `\n                        -Command \"powershell Start-Sleep -Seconds 20; Invoke-WebRequest -Uri $ScriptURL -OutFile $ScriptFileName -UseBasicParsing; & .\\$ScriptFileName -VSTSAccountName $VSTSAccountName -PATToken $PATToken -AgentNamePrefix $Name -PoolName $PoolName -RequiredPowerShellModules $RequiredPowerShellModules -InstallAzureCli $InstallAzureCli -UseChocolatey $UseChocolatey -InstallPowerShellCore $InstallPowerShellCore\" | Out-null\n                }\n                else {\n                    Write-Error \"PowerShell version could not be defined. Exiting...\"\n                    return\n                }\n            }\n        }\n        else {\n            Write-Warning \"ACI container could not be created, as there's another container instance with the same name in the same Resource Group. If you want to remove the existing intance first, run the script again by using the -ReplaceExistingContainer switch.\"\n        }\n    }\n\n    if ($CreateAtLeastOneContainer) {\n        Write-Output \"ACI container creation tasks have been submitted. When using a cached image, it usually takes about 10 minutes to fully provision a container.\"\n        Write-Output \"New ACI container(s) are being built...\"\n\n        # Periodically check if all containers have been configured\n        $ConfiguredContainers = @()\n        $NotificationTracker = @{ }\n        while ($ConfiguredContainers.Count -ne $ContainerName.Count) {\n            Start-Sleep -Seconds 10\n            foreach ($Name in $ContainerName) {\n                if ($ConfiguredContainers -notcontains $Name) {\n                    $LogEntries = Get-AzureRmContainerInstanceLog -ResourceGroupName $ResourceGroupName -ContainerGroupName $Name -ErrorAction SilentlyContinue\n                    $RestartCount = (Get-AzureRmContainerGroup -ResourceGroupName $ResourceGroupName -Name $Name).Containers.restartcount\n                    # Show restart counts, avoid repeating the same entry\n                    if ($RestartCount -gt 0) {\n                        $Key = \"$Name-$RestartCount\"\n                        if ($NotificationTracker[$Key] -ne \"MessageAlreadyShown\") {\n                            Write-Output \"The creation of the ACI container \"\"$Name\"\" was restarted $RestartCount time(s). Note that a few retries are acceptable, however each iteration increases the overall creation time.\"\n                            $NotificationTracker.Add($Key, \"MessageAlreadyShown\")\n                        }\n                    }\n\n                    # Trigger on success\n                    if ($LogEntries) {\n                        # Check if the last line of the log is \"Container successfully configured.\"\n                        $Success = $LogEntries.Split(\"`n\")[-4] -eq \"Container successfully configured.\" # Do NOT change this value, as the wrapper script is triggered based on this.\n                        if ($Success) {\n                            $ConfiguredContainers += $Name\n                            Write-Output \"ACI container \"\"$Name\"\" successfully configured\"\n                        }\n                    }\n                }\n            }\n        }\n\n        # Print results\n        if ($ConfiguredContainers.Count -eq $ContainerName.Count) {\n            Write-Output \"All requested containers have been successfully deployed and configured.\"\n            Write-Output \"Check if VSTS agents have been registered under the requested Agent Pool on the VSTS portal.\"\n            $TimeSpan = (New-TimeSpan -Start $StartDate -End (Get-Date))\n            Write-Output \"Finished at $(Get-Date)\"\n            Write-Output \"It took $($TimeSpan.Minutes) minutes and $($TimeSpan.Seconds) seconds to initialize the requested containers.\"\n            if ($ContainerDeletetionWasRequired) {\n                Write-Warning \"One or more containers have been deleted. \"\n            }\n        }\n    }\n    else {\n        Write-Output \"No ACI containers have been created, as there were conflicts with existing intances and the -ReplaceExistingContainer was not used.\"\n    }\n}\n\nfunction Get-LatestCachedImageVersion {\n    # This function returns the name of the latest version of the\n    # microsoft/windowsservercore image that is cached in the ACI platform\n    # This is needed, because Microsoft no longer uses the \":latest\" tag on their images\n    # See more details here: https://techcommunity.microsoft.com/t5/Containers/Removing-the-latest-Tag-An-Update-on-MCR/ba-p/393045\n\n    # Authenticate to invoke Azure REST API\n    $azProfile = [Microsoft.Azure.Commands.Common.Authentication.Abstractions.AzureRmProfileProvider]::Instance.Profile\n    $currentAzureContext = Get-AzureRmContext\n    $profileClient = New-Object Microsoft.Azure.Commands.ResourceManager.Common.RMProfileClient($azProfile)\n    $token = $profileClient.AcquireAccessToken($currentAzureContext.Tenant.TenantId)\n    $accessToken = $token.AccessToken\n\n    $RestCall = @{\n        Method  = \"Get\"\n        Uri     = \"https://management.azure.com/subscriptions/$($currentAzureContext.Subscription)/providers/Microsoft.ContainerInstance/locations/$Location/cachedImages?api-version=2018-10-01\"\n        Headers = @{\n            Authorization = \"Bearer \" + $AccessToken\n        }\n    }\n\n    $result = Invoke-RestMethod @RestCall\n\n    $LatestCachedImage = (($result.value | Where-Object { $_.image -like \"microsoft/*dotnet*windowsservercore*\" } | Sort-Object image)[-1]).image\n    return $LatestCachedImage\n}\n\nfunction Remove-AzureDevOpsAgentFromPool {\n    [Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSUseShouldProcessForStateChangingFunctions\", \"\")]\n    [CmdletBinding()]\n    Param(\n        [string]$PatToken, #Personal access token\n        [string]$AzureDevOpsAccountName, #Azure DevOps account name\n        [string]$AgentPoolName, #Azure DevOps Agent pool name\n        [array]$ContainerName  #Azure DevOps Agent pool name\n    )\n\n    $base64AuthInfo = [System.Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(\":$($PatToken)\"))\n    $Header = @{Authorization = (\"Basic $base64AuthInfo\") }\n\n    # Get Agent Pool\n    Write-Output \"Getting Agent Pool ($AgentPoolName)...\"\n    $uri = \"https://dev.azure.com/$AzureDevOpsAccountName/_apis/distributedtask/pools\"\n    $result = Invoke-RestMethod -Uri $uri -Method GET -ContentType \"application/json\" -Headers $Header\n    $AgentPool = $result.value | Where-Object { $_.Name -eq \"$AgentPoolName\" }\n    $AgentPoolId = $AgentPool.id\n\n    if (-not $AgentPoolId) {\n        Write-Error \"The Agent Pool ($AgentPoolName) doesn't exist!\"\n    }\n    else {\n        # Get Agents\n        Write-Output \"Getting Agents from Pool...\"\n        $uri = \"https://dev.azure.com/$AzureDevOpsAccountName/_apis/distributedtask/pools/$AgentPoolId/agents?includeCapabilities=false&includeAssignedRequest=true\"\n        $result = Invoke-RestMethod -Uri $uri -Method GET -ContentType \"application/json\" -Headers $Header\n        $Agents = $result.value\n\n        if (-not $Agents) {\n            Write-Output \"There are no Agents in this Agent Pool\"\n        }\n        else {\n            Write-Output \"The following agents were found:\"\n            foreach ($Agent in $Agents) {\n                $AgentName = $Agent.name\n                $AgentStatus = $Agent.status\n                Write-Output \"$AgentName ($AgentStatus)\"\n            }\n\n            # Delete Agent(s) from Pool\n            foreach ($Name in $ContainerName) {\n                Write-Output \"Attempting to remove any Agent(s) that belonged to this ACI container: $Name...\"\n                foreach ($Agent in $Agents) {\n                    $AgentName = $Agent.name\n\n                    if ($AgentName -match \"^$Name-\") {\n                        # Delete Agent\n                        $AgentIds = $Agent.id\n                        foreach ($AgentId in $AgentIds) {\n                            Write-Output \"Deleting Agent ($AgentName) - (Agent ID: $AgentId)...\"\n                            $uri = \"https://dev.azure.com/$AzureDevOpsAccountName/_apis/distributedtask/pools/$AgentPoolId/agents/$($AgentId)?api-version=5.0\"\n                            $result = Invoke-RestMethod -Uri $uri -Method DELETE -ContentType \"application/json\" -Headers $Header\n\n                            # Check success\n                            Write-Output \"Checking if the Agent ($AgentName) - (Agent ID: $AgentId) is still there...\"\n                            $uri = \"https://dev.azure.com/$AzureDevOpsAccountName/_apis/distributedtask/pools/$AgentPoolId/agents?includeCapabilities=false&includeAssignedRequest=true\"\n                            $result = Invoke-RestMethod -Uri $uri -Method GET -ContentType \"application/json\" -Headers $Header\n                            $AgentStillThere = $result.value.id -contains $AgentId\n                            if ($AgentStillThere) {\n                                Write-Warning \"Agent ($AgentName) could not be deleted. Don't forget to clean your Agent pool in Azure Devops (remove any agents that were created in a previous iteration and are now offline)!\"\n                            }\n                            else {\n                                Write-Output \"Agent ($AgentName) successfully deleted.\"\n                            }\n                        }\n                    }\n                }\n            }\n        }\n    }\n}\n\n#endregion\n\n#region Main\n# Report start time\n$StartDate = Get-Date\nWrite-Output \"Started at $StartDate...\"\n\n# Login to Azure and select Subscription\nSet-AzureContext -SubscriptionName $SubscriptionName\n\nif ($StorageAccountName) {\n    # Upload the configuration script to a Storage Account\n    Copy-ScriptToStorageAccount -StorageAccountResourceGroupName $ResourceGroupName -StorageAccountName $StorageAccountName -StorageContainerName $StorageContainerName -ScriptFileName $ScriptFileName\n}\n\nWrite-Output \"Ready For creating Resource Group for containers\"\n\n<#\n# Create Resource Group for containers\nif (-not (Get-AzureRmResourceGroup -Name $ResourceGroupName -ErrorAction SilentlyContinue))\n{\n    Write-Output \"Resource Group \"\"$ResourceGroupName\"\" does not exist for ACI containers. Creating...\"\n    New-AzureRmResourceGroup -Name $ResourceGroupName -Location $Location | Out-Null\n}\n#>\nWrite-Output \"Ready For creating containers\"\n# Create containers\nif (-not $ContainerImage) {\n    $ContainerImage = Get-LatestCachedImageVersion\n    Write-Output \"Container Image = $ContainerImage\"\n}\nNew-Container -ContainerImage $ContainerImage\n\n#endregion\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUag+tQogpqd0EKtkbuuzLmtQU\n# xrSgggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz\n# c3VyZWQgSUQgQ29kZSBTaWduaW5nIENBMB4XDTE3MDUwOTAwMDAwMFoXDTIwMDUx\n# MzEyMDAwMFowVzELMAkGA1UEBhMCVVMxETAPBgNVBAgTCFZpcmdpbmlhMQ8wDQYD\n# VQQHEwZWaWVubmExETAPBgNVBAoTCGRiYXRvb2xzMREwDwYDVQQDEwhkYmF0b29s\n# czCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAI8ng7JxnekL0AO4qQgt\n# Kr6p3q3SNOPh+SUZH+SyY8EA2I3wR7BMoT7rnZNolTwGjUXn7bRC6vISWg16N202\n# 1RBWdTGW2rVPBVLF4HA46jle4hcpEVquXdj3yGYa99ko1w2FOWzLjKvtLqj4tzOh\n# K7wa/Gbmv0Si/FU6oOmctzYMI0QXtEG7lR1HsJT5kywwmgcjyuiN28iBIhT6man0\n# Ib6xK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SEEyIEFzc3VyZWQgSUQgQ29kZSBTaWduaW5nIENBAhACwXUo\n# dNXChDGFKtigZGnKMAkGBSsOAwIaBQCgeDAYBgorBgEEAYI3AgEMMQowCKACgACh\n# AoAAMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcCAQsxDjAM\n# BgorBgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBQodToNMwK9wGq1pq5gEafK/pkI\n# 6TANBgkqhkiG9w0BAQEFAASCAQA1cWGaoOtYK7Aj0+voFm8NBPFXUyBfFFFMBUBK\n# np8giAMSvASbzXSUPR/hae6LR/UzZFdXqH3ZhAbA//BItAjM5EC8fhbZMHGzqXmx\n# IxU7YxzuXJvrLd7yVjLRRhu+kclMVGSGELBFIfEAm8nMtrhWAKGhXPlzFTJtwOiD\n# qREulLuvtEBb/LBk/mT/vw8499Jzj9fE5oXYkqcJiodToaagGEpe2fZC03s8rbm9\n# kl3n3H39/j7y4PwJHt0BEhtT4koNVod5d3Jx42hpJIN77vLCmJ3DtVhckArrkftc\n# UPdWInKb/H47AJCuP3+chRgiGmEGdlnVVM13FJfzIkHxDxpA\n# SIG # End signature block\n"
  },
  {
    "path": "developing/Archive/tests/build/Install-VstsAgentOnWindowsServerCoreContainer.ps1",
    "content": "########################################################################################################################\n# Script Disclaimer\n########################################################################################################################\n# This script is not supported under any Microsoft standard support program or service.\n# This script is provided AS IS without warranty of any kind.\n# Microsoft disclaims all implied warranties including, without limitation, any implied warranties of\n# merchantability or of fitness for a particular purpose. The entire risk arising out of the use or\n# performance of this script and documentation remains with you. In no event shall Microsoft, its authors,\n# or anyone else involved in the creation, production, or delivery of this script be liable for any damages\n# whatsoever (including, without limitation, damages for loss of business profits, business interruption,\n# loss of business information, or other pecuniary loss) arising out of the use of or inability to use\n# this script or documentation, even if Microsoft has been advised of the possibility of such damages.\n\n<#\n.SYNOPSIS\n    This scripts configures a Windows Server Core based container with Terraform, json2hcl, the selected PowerShell modules and \n    installs and configures the Visual Studio Team Services build agent on it.\n.DESCRIPTION\n    This scripts configures a Windows Server Core based container (with the latest version of the \n    microsoft/windowsservercore LTSC image available on Docker Hub),\n    with the latest version of the Azure DevOps agent, Terraform, json2hcl and the selected PowerShell modules (by default Az, AzureAD, Pester). \n    This container is intended to be run as an Azure Container Instance.\n    After the successfully configuration, it prints the available disk space, and keeps periodically checking of the \n    vstsagent service is in a running state, keeping the container alive by that.\n.PARAMETER VSTSAccountName\n    Name of the Azure DevOps account - formerly Visual Studio Team Services (VSTS) account, e.g. https://<Azure DevOps Account Name>.visualstudio.com - OR - https://dev.azure.com/<Azure DevOps Account Name>/\n.PARAMETER PATToken\n    PAT token generated by the user who is configuring the container to be used by VSTS.\n.PARAMETER AgentNamePrefix\n    Prefix of the name of the agent shown on the Azure DevOps (VSTS) portal.\n.PARAMETER PoolName\n    Name of the Agent pool. It defaults to the \"Default\" pool when not defined.\n.PARAMETER RequiredPowerShellModules\n    List of the required PowerShell modules, e.g. Az, AzureAD, Pester\n.PARAMETER InstallAzureCli\n    Switch to define whether or not you want to install the Azure CLI on your container.\n.PARAMETER InstallPowerShellCore\n    Switch to define whether or not you want to install Azure PowerShell Core on your container.\n.PARAMETER UseChocolatey\n    Switch to define whether or not Chocolatey should be used to install the supported components\n.EXAMPLE\n    .\\Install-VstsAgentWindowsServerCoreContainer.ps1 -VSTSAccountName \"<Azure DevOps account Name>\" -PATToken \"<PAT Token value>\"\n    This installs all the components with the default configuration (Default Agent Pool, \"Az\", \"AzureAD\", \"Pester\" PowerShell modules, randomly generated agent name).\n.EXAMPLE\n    .\\Install-VstsAgentWindowsServerCoreContainer.ps1 -VSTSAccountName \"<Azure DevOps account Name>\" -PATToken \"<PAT Token value>\" -AgentNamePrefix \"<prefix of the Azure DevOps agent's name>\" -PoolName \"CoreContainers\"\n    This installs all the components with the defined Agent name, and Pool name, with the default PowerShell modules.\n.EXAMPLE\n    .\\Install-VstsAgentWindowsServerCoreContainer.ps1 -VSTSAccountName \"<Azure DevOps account Name>\" -PATToken \"<PAT Token value>\" -AgentNamePrefix \"<prefix of the Azure DevOps agent's name>\" -PoolName \"CoreContainers\" -RequiredPowerShellModules \"Az\", \"AzureAD\", \"Pester\"\n    This installs all the components with the defined Agent name, Pool name, and PowerShell modules.\n.INPUTS\n    <none>\n.OUTPUTS\n    <none>\n.NOTES\n    Version:        1.0\n    Author:         Mate Barabas, Andrew Auret\n    Creation Date:  2018-08-23\n    References:     The Install-VstsAgent function is a slightly modified version of the provisioning script available as part of Azure DevTest Labs (available in August 2018).\n#>\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSAvoidUsingUsernameAndPasswordParams\", \"\")]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSAvoidUsingPlainTextForPassword\", \"\")]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSUseShouldProcessForStateChangingFunctions\", \"\")]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSAvoidUsingConvertToSecureStringWithPlainText\", \"\")]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSUseCompatibleCommands\", \"\")]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSAvoidUsingWMICmdlet\", \"\")]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSAvoidUsingWriteHost\", \"\")]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSAvoidTrailingWhiteSpace\", \"\")]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSUseDeclaredVarsMoreThanAssignments\", \"\")]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSUseSingularNouns\", \"\")]\n[CmdletBinding()]\nparam (\n\n    [Parameter(Mandatory = $true,\n        HelpMessage = \"Name of the Visual Studio Team Services Account (VSTS), e.g. https://<VSTSAccountName>.visualstudio.com\")]\n    [ValidateNotNullOrEmpty()]\n    [string]$VSTSAccountName,\n\n    [Parameter(Mandatory = $true,\n        HelpMessage = \"PAT token generated by the user who is configuring the container to be used by VSTS.\")]\n    [ValidateNotNullOrEmpty()]\n    [string]$PATToken,\n\n    [Parameter(Mandatory = $false,\n        HelpMessage = \"Prefix of the name of the agent shown on the VSTS portal.\")]\n    [ValidateNotNullOrEmpty()]\n    [string]$AgentNamePrefix,\n\n    [Parameter(Mandatory = $false,\n        HelpMessage = \"Name of the Agent pool. It defaults to the \"\"Default\"\" pool when not defined.\")]\n    [ValidateNotNullOrEmpty()]\n    [string]$PoolName = \"Default\",\n\n    [Parameter(Mandatory = $false,\n        HelpMessage = \"List of the required PowerShell modules, e.g. Az, AzureAD, Pester\")]\n    [ValidateNotNullOrEmpty()]\n    [array]$RequiredPowerShellModules = @(\"Az\", \"AzureAD\", \"Pester\"),\n\n    [Parameter(Mandatory = $false,\n        HelpMessage = \"Switch to define whether or not you want to install the Azure CLI on your container.\")]\n    [ValidateNotNullOrEmpty()]\n    [string]$InstallAzureCli,\n\n    [Parameter(Mandatory = $false,\n        HelpMessage = \"Switch to define whether or not you want to install Azure PowerShell Core on your container.\")]\n    [ValidateNotNullOrEmpty()]\n    [string]$InstallPowerShellCore,\n\n    [Parameter(Mandatory = $false,\n        HelpMessage = \"Switch to define whether or not Chocolatey should be used to install the supported components\")]\n    [ValidateNotNullOrEmpty()]\n    [string]$UseChocolatey\n\n)\n\n#region Variable conversion (from text to boolean)\n\n$InstallAzureCli = switch ($InstallAzureCli)\n{\n    '1' { $true }\n    'true' { $true }\n    '$true' { $true }\n    '0' { $false }\n    'false' { $false }\n    '$false' { $false }\n    Default { $false }\n}\n\n$InstallPowerShellCore = switch ($InstallPowerShellCore)\n{\n    '1' { $true }\n    'true' { $true }\n    '$true' { $true }\n    '0' { $false }\n    'false' { $false }\n    '$false' { $false }\n    Default { $false }\n}\n\n$UseChocolatey = switch ($UseChocolatey)\n{\n    '1' { $true }\n    'true' { $true }\n    '$true' { $true }\n    '0' { $false }\n    'false' { $false }\n    '$false' { $false }\n    Default { $false }\n}\n\n#endregion\n\n#region Functions\n\nfunction Install-Nuget\n{\n    if (-not (Get-PackageProvider -Name \"Nuget\" -ListAvailable -ErrorAction SilentlyContinue))\n    {\n        Write-Output \"-----------------------------------------------------------------------------------\"\n        $NewPackageProvider = Find-PackageProvider -Name \"Nuget\"\n        $NewPackageProviderVersion = $NewPackageProvider.Version.ToString()\n        Write-Output \"Installing Nuget package provider ($NewPackageProviderVersion)...\"\n        Install-PackageProvider -Name \"Nuget\" -Force -Confirm:$false | Out-Null\n\n        if (Get-PackageProvider \"Nuget\")\n        {\n            Write-Output \"Nuget package provider ($NewPackageProviderVersion) successfully installed.\"\n        }\n        else\n        {\n            Write-Error \"Nuget package provider ($NewPackageProviderVersion) installation failed.\"\n        }\n        Write-Output \"Waiting 10 seconds...\"\n        Start-Sleep -Seconds 10\n    }\n}\n\nfunction Install-PowerShellModules\n{\n    param (\n        [array]$RequiredModules\n    )\n\n    Write-Output \"-----------------------------------------------------------------------------------\"\n    Write-Output \"PowerShell modules to install: $($RequiredModules -join \", \")\"\n        \n    foreach ($Module in $RequiredModules)\n    {\n        if (-not (Get-Module $Module -ErrorAction SilentlyContinue))\n        {\n            Write-Output \"-----------------------------------------------------------------------------------\"\n            Write-Output \"Getting $Module module...\"\n\n            $NewModule = Find-Module $Module\n            $NewModuleVersion = $NewModule.Version.ToString()\n\n            Write-Output \"Installing $Module ($NewModuleVersion) module...\"\n                \n            Install-Module -Name $Module -Force -Confirm:$false -SkipPublisherCheck -AllowClobber\n        }\n    }\n    if (Get-Module -ListAvailable | Where-Object { $_.Name -eq \"Az.Accounts\" })\n    {\n        Write-Output \"Enabling AzureRm compatibility mode\"\n        Enable-AzureRmAlias -Scope LocalMachine -Confirm:$false\n    }\n\n}\n\nfunction Install-Choco\n{\n    Write-Output \"-----------------------------------------------------------------------------------\"\n    Write-Output \"Installing Chocolatey...\"\n    Invoke-WebRequest  -Uri \"https://chocolatey.org/install.ps1\" -OutFile \"c:\\chochoinstall.ps1\"\n    .\\chochoinstall.ps1 | Out-Null\n}\n\nfunction Install-ChocoTerraform\n{\n    Write-Output \"-----------------------------------------------------------------------------------\"\n    Write-Output \"Installing Terraform with Chocolatey...\"\n    choco install terraform -y --limit-output --no-progress\n}\n\nfunction Install-Terraform\n{\n\n    param (\n\n        [Parameter(Mandatory = $false,\n            HelpMessage = \"Use this parameter to decide if the absolute latest or the latest stable Terraform release should be installed.\")]\n        [ValidateNotNullOrEmpty()]\n        [bool]$SkipNonStableReleases = $true\n\n    )\n\n    # Get the list of available Terraform versions\n    $Response = Invoke-WebRequest -Uri \"https://releases.hashicorp.com/terraform\" -UseBasicParsing\n\n    # Find the latest version\n    if ($SkipNonStableReleases -eq $true)\n    {\n        $Links = $Response.Links | Where-Object { $_.href.Split(\"/\")[2] -match \"^(\\d|\\d\\d)\\.(\\d|\\d\\d)\\.(\\d|\\d\\d)$\" }\n        $LatestTerraformVersion = $Links[0].href.Split(\"/\")[2]\n    }\n    else\n    {\n        $LatestTerraformVersion = $Response.Links[1].href.Split(\"/\")[2]\n    }\n\n    $Version = $LatestTerraformVersion\n\n    # Find the download URL for the latest version\n    $Response = Invoke-WebRequest -Uri \"https://releases.hashicorp.com/terraform/$Version\" -UseBasicParsing\n    $RelativePath = ($Response.Links | Where-Object { $_.href -like \"*windows_amd64*\" }).href\n\n    # URL will be similar to this: \"https://releases.hashicorp.com/terraform/0.11.8/terraform_0.11.8_windows_amd64.zip\"\n    $URL = \"https://releases.hashicorp.com$RelativePath\"\n\n    # Create folder\n    $FileName = Split-Path $url -Leaf\n    $FolderPath = \"C:\\terraform\"\n    $FilePath = \"$FolderPath\\$FileName\"\n    New-Item -ItemType Directory -Path $FolderPath -ErrorAction SilentlyContinue | Out-Null\n\n    # Download and extract Terraform, remove the temporary zip file\n    Write-Output \"-----------------------------------------------------------------------------------\"\n    Write-Output \"Downloading Terraform ($Version) to $FolderPath...\"\n    Start-BitsTransfer -Source $URL -Destination $FilePath\n    Expand-Archive -LiteralPath $FilePath -DestinationPath $FolderPath\n    Remove-Item -Path $FilePath\n\n    # Setting PATH environmental variable for Terraform\n    Write-Output \"Setting PATH environmental variable for Terraform...\"\n    # Get the PATH environmental Variable\n    $Path = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name PATH).Path\n    # Create New PATH environmental Variable\n    $NewPath = $Path + \";\" + $FolderPath\n    # Set the New PATH environmental Variable\n    Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name PATH -Value $NewPath\n    $env:Path += $NewPath\n\n    # Verify the Path\n    # (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name PATH).Path\n\n}\n\nfunction Install-Json2Hcl\n{\n\n    # Get the list of available Terraform versions\n    $Response = Invoke-WebRequest -Uri \"https://github.com/kvz/json2hcl/releases\" -UseBasicParsing\n\n    # Find the latest version\n    $RelativePathToLatestVersion = (($Response.Links | Where-Object { $_.href -like \"*windows_amd64*\" }).href)[0]\n    $Version = $RelativePathToLatestVersion.Split(\"/\")[-2]\n\n    # URL will be similar to this: \"https://github.com/kvz/json2hcl/releases/download/v0.0.6/json2hcl_v0.0.6_windows_amd64.exe\"\n    $URL = \"https://github.com/$RelativePathToLatestVersion\"\n\n    # Create folder\n    $FileName = Split-Path $url -Leaf\n    $FolderPath = \"C:\\json2hcl\"\n    $FilePath = \"$FolderPath\\$FileName\"\n    New-Item -ItemType Directory -Path $FolderPath -ErrorAction SilentlyContinue | Out-Null\n\n    # Download and extract Json2HCL\n    Write-Output \"-----------------------------------------------------------------------------------\"\n    Write-Output \"Downloading Json2HCL ($Version) to $FolderPath...\"\n    $WebClient = New-Object System.Net.WebClient\n    $WebClient.DownloadFile($URL, $FilePath)\n    Rename-Item -Path $FolderPath\\$FileName -NewName \"json2hcl.exe\"\n\n    # Setting PATH environmental variable\n    Write-Output \"Setting PATH environmental variable for Json2HCL...\"\n    # Get the PATH environmental Variable\n    $Path = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name PATH).Path\n    # Create New PATH environmental Variable\n    $NewPath = $Path + \";\" + $FolderPath\n    # Set the New PATH environmental Variable\n    Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name PATH -Value $NewPath\n    $env:Path += $NewPath\n    \n}\n\n\nfunction Install-ChocoAzureCli \n{\n    Write-Output \"-----------------------------------------------------------------------------------\"\n    Write-Output \"Installing Azure CLI with Chocolatey...\"\n    choco install azure-cli -y --limit-output --no-progress\n}\nfunction Install-AzureCli\n{\n    Write-Output \"-----------------------------------------------------------------------------------\"\n    Write-Output \"Searching for the latest version of Azure CLI\"\n    $AzureCliUrl = \"https://aka.ms/installazurecliwindows\"\n    $AzureCliInstallerFullPath = \"C:\\azurecli.msi\"\n    $response = Invoke-WebRequest -UseBasicParsing -Uri $AzureCliUrl -Method Head\n    $AzureCliInstallerFileName = $response.BaseResponse.ResponseUri.AbsolutePath.Split(\"/\")[-1]\n\n    Write-Output \"Downloading Azure CLI installer ($AzureCliInstallerFileName)\"\n    $WebClient = New-Object System.Net.WebClient\n    $WebClient.DownloadFile($AzureCliUrl, $AzureCliInstallerFullPath)\n    \n    if (Test-Path $AzureCliInstallerFullPath)\n    {\n        Write-Output \"Installing Azure CLI ($AzureCliInstallerFileName)\"\n        Start-Process msiexec.exe -Wait -ArgumentList \"/i $AzureCliInstallerFullPath /quiet /passive /qn\"\n        $AzureCli = (Get-WmiObject -Class win32_product) | Where-Object { $_.name -like \"*Microsoft Azure CLI*\" }\n        if ($AzureCli)\n        {\n            Write-Output \"Azure CLI (version $($AzureCli.Version)) was successfully installed\"\n            Remove-Item -Path $AzureCliInstallerFullPath -Force -Confirm:$false\n\n            # Setting PATH environmental variable\n            Write-Output \"Setting PATH environmental variable for Azure CLI...\"\n            # Get the PATH environmental Variable\n            $Path = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name PATH).Path\n            # Create New PATH environmental Variable\n            $NewPath = $Path + \";\" + \"C:\\Program Files (x86)\\Microsoft SDKs\\Azure\\CLI2\\wbin\"\n            # Set the New PATH environmental Variable\n            Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name PATH -Value $NewPath\n            $env:Path += $NewPath\n        }\n        else\n        {\n            Write-Error \"Azure CLI could not be installed\"\n        }\n    }\n}\n\nfunction Install-ChocoPowerShellCore\n{\n    Write-Output \"-----------------------------------------------------------------------------------\"\n    Write-Output \"Installing PowerShell Core with Chocolatey...\"\n    choco install pwsh -y --limit-output --no-progress\n}\nfunction Install-PowerShellCore\n{\n    Write-Output \"-----------------------------------------------------------------------------------\"\n    Write-Output \"Searching for the latest version of PowerShell Core\"\n    $PwshInstallerFullPath = \"c:\\pwsh.msi\"\n    $response = Invoke-WebRequest -UseBasicParsing -Uri \"https://github.com/PowerShell/PowerShell/releases\"\n    $PwshInstallerRelativeUrl = ($response.Links.href | Where-Object { $_ -like \"*win-x64.msi\" -and $_ -notlike \"*preview*\" -and $_ -notlike \"*rc*\" })[0]\n    $PwshInstallerFileName = $PwshInstallerRelativeUrl.Split(\"/\")[-1]\n    Write-Output \"Downloading PowerShell Core ($PwshInstallerFileName)\"\n    $PwshInstallerUrl = \"https://github.com\" + $PwshInstallerRelativeUrl\n\n    # Download PowerShell Core\n    $WebClient = New-Object System.Net.WebClient\n    $WebClient.DownloadFile($PwshInstallerUrl, $PwshInstallerFullPath)\n\n    if (Test-Path $PwshInstallerFullPath)\n    {\n        Write-Output \"Installing PowerShell Core ($PwshInstallerFileName)\"\n        Start-Process msiexec.exe -Wait -ArgumentList \"/i $PwshInstallerFullPath /quiet /passive /qn\"\n        \n        $Pwsh = (Get-WmiObject -Class win32_product) | Where-Object { $_.name -like \"*PowerShell*-x64\" }\n        if ($Pwsh)\n        {\n            Write-Output \"PowerShell Core (version $($Pwsh.Version) was successfully installed)\"\n            Remove-Item -Path $PwshInstallerFullPath -Force -Confirm:$false\n\n            # Setting PATH environmental variable\n            Write-Output \"Setting PATH environmental variable for Azure CLI...\"\n            # Get the PATH environmental Variable\n            $Path = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name PATH).Path\n            # Create New PATH environmental Variable\n            $NewPath = $Path + \";\" + \"c:\\Program Files\\PowerShell\\6\\\"\n            # Set the New PATH environmental Variable\n            Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name PATH -Value $NewPath\n            $env:Path += $NewPath\n        }\n        else\n        {\n            Write-Error \"PowerShell Core could not be installed\"\n        }\n    }\n}\n\nfunction Install-ChocoVstsAgent\n{\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSAvoidUsingUsernameAndPasswordParams\", \"\")]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSAvoidUsingPlainTextForPassword\", \"\")]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSUseShouldProcessForStateChangingFunctions\", \"\")]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSAvoidUsingConvertToSecureStringWithPlainText\", \"\")]\n    # Downloads the Visual Studio Online Build Agent, installs on the new machine, registers with the Visual\n    # Studio Online account, and adds to the specified build agent pool\n    [CmdletBinding()]\n    param(\n        [Parameter(Mandatory = $true)][string]$vstsAccount,\n        [Parameter(Mandatory = $true)][string]$vstsUserPassword,\n        [Parameter(Mandatory = $true)][string]$agentName,\n        [Parameter(Mandatory = $false)][string]$agentNameSuffix,\n        [Parameter(Mandatory = $true)][string]$poolName,\n        [Parameter(Mandatory = $true)][string]$windowsLogonAccount,\n        [Parameter(Mandatory = $false)][string]$windowsLogonPassword,\n        [Parameter(Mandatory = $true)][ValidatePattern(\"[c-zC-Z]\")][ValidateLength(1, 1)][string]$driveLetter,\n        [Parameter(Mandatory = $false)][string]$workDirectory,\n        [Parameter(Mandatory = $true)][boolean]$runAsAutoLogon\n    )\n\n    $AgentPreparationStartTime = Get-Date\n    Write-Output \"-----------------------------------------------------------------------------------\"\n    Write-Output \"Installing Azure Devops Agent with Chocolatey...\"\n    choco install azure-pipelines-agent -y --limit-output --no-progress\n\n    ###################################################################################################\n\n    # if the agentName is empty, use %COMPUTERNAME% as the value\n    if ([String]::IsNullOrWhiteSpace($agentName))\n    {\n        $agentName = $env:COMPUTERNAME\n    }\n\n    # if the agentNameSuffix has a value, add this to the end of the agent name\n    if (![String]::IsNullOrWhiteSpace($agentNameSuffix))\n    {\n        $agentName = $agentName + $agentNameSuffix\n    }\n\n    #\n    # PowerShell configurations\n    #\n\n    # NOTE: Because the $ErrorActionPreference is \"Stop\", this script will stop on first failure.\n    #       This is necessary to ensure we capture errors inside the try-catch-finally block.\n    $ErrorActionPreference = \"Stop\"\n\n    # Ensure we set the working directory to that of the script.\n    Push-Location $PSScriptRoot\n\n    # Configure strict debugging.\n    Set-PSDebug -Strict\n\n    ###################################################################################################\n\n    #\n    # Functions used in this script.\n    #\n\n    function Show-LastError\n    {\n        [CmdletBinding()]\n        param(\n        )\n\n        $message = $error[0].Exception.Message\n        if ($message)\n        {\n            Write-Host -Object \"ERROR: $message\" -ForegroundColor Red\n        }\n\n        # IMPORTANT NOTE: Throwing a terminating error (using $ErrorActionPreference = \"Stop\") still\n        # returns exit code zero from the PowerShell script when using -File. The workaround is to\n        # NOT use -File when calling this script and leverage the try-catch-finally block and return\n        # a non-zero exit code from the catch block.\n        exit -1\n    }\n\n    function Test-Parameters\n    {\n        [CmdletBinding()]\n        param(\n            [string] $VstsAccount,\n            [string] $WorkDirectory\n        )\n\n        if ($VstsAccount -match \"https*://\" -or $VstsAccount -match \"visualstudio.com\")\n        {\n            Write-Error \"Azure DevOps account '$VstsAccount' should not be the URL, just the account name.\"\n        }\n\n        if (![string]::IsNullOrWhiteSpace($WorkDirectory) -and !(Test-ValidPath -Path $WorkDirectory))\n        {\n            Write-Error \"Work directory '$WorkDirectory' is not a valid path.\"\n        }\n    }\n\n    function Test-ValidPath\n    {\n        param(\n            [string] $Path\n        )\n\n        $isValid = Test-Path -Path $Path -IsValid -PathType Container\n\n        try\n        {\n            [IO.Path]::GetFullPath($Path) | Out-Null\n        }\n        catch\n        {\n            $isValid = $false\n        }\n\n        return $isValid\n    }\n\n    function Test-AgentExists\n    {\n        [CmdletBinding()]\n        param(\n            [string] $InstallPath,\n            [string] $AgentName\n        )\n\n        $agentConfigFile = Join-Path $InstallPath '.agent'\n\n        if (Test-Path $agentConfigFile)\n        {\n            Write-Error \"Agent $AgentName is already configured in this machine\"\n        }\n    }\n\n    function New-AgentInstallPath\n    {\n        [CmdletBinding()]\n        param(\n            [string] $DriveLetter,\n            [string] $AgentName\n        )\n\n        [string] $agentInstallPath = $null\n\n        # Construct the agent folder under the specified drive.\n        $agentInstallDir = $DriveLetter + \":\"\n        try\n        {\n            # Create the directory for this agent.\n            $agentInstallPath = Join-Path -Path $agentInstallDir -ChildPath $AgentName\n            New-Item -ItemType Directory -Force -Path $agentInstallPath | Out-Null\n        }\n        catch\n        {\n            $agentInstallPath = $null\n            Write-Error \"Failed to create the agent directory at $installPathDir.\"\n        }\n\n        return $agentInstallPath\n    }\n\n    function Get-AgentInstaller\n    {\n        param(\n            [string] $InstallPath\n        )\n\n        $agentTempFolderName = \"C:\\agent\"\n        if (!(Test-Path $InstallPath))\n        {\n            Write-Error \"Agent install path doesn't exist: $InstallPath\"\n        }\n        else \n        {\n            $agentExePath = Join-Path $agentTempFolderName \"config.cmd\"\n            if (!(Test-Path $agentExePath))\n            {\n                Write-Error \"Agent installer file not found: $agentExePath\"\n            }   \n        }\n\n        return $agentExePath\n    }\n\n\n    function Set-MachineForAutologon\n    {\n        param(\n            $Config\n        )\n\n        if ([string]::IsNullOrWhiteSpace($Config.WindowsLogonPassword))\n        {\n            Write-Error \"Windows logon password was not provided. Please retry by providing a valid windows logon password to enable autologon.\"\n        }\n\n        # Create a PS session for the user to trigger the creation of the registry entries required for autologon\n        $computerName = \"localhost\"\n        $password = ConvertTo-SecureString $Config.WindowsLogonPassword -AsPlainText -Force\n\n        if ($Config.WindowsLogonAccount.Split(\"\\\").Count -eq 2)\n        {\n            $domain = $Config.WindowsLogonAccount.Split(\"\\\")[0]\n            $userName = $Config.WindowsLogonAccount.Split('\\')[1]\n        }\n        else\n        {\n            $domain = $Env:ComputerName\n            $userName = $Config.WindowsLogonAccount\n        }\n\n        $credentials = New-Object System.Management.Automation.PSCredential(\"$domain\\\\$userName\", $password)\n        Enter-PSSession -ComputerName $computerName -Credential $credentials\n        Exit-PSSession\n\n        try\n        {\n            # Check if the HKU drive already exists\n            Get-PSDrive -PSProvider Registry -Name HKU | Out-Null\n            $canCheckRegistry = $true\n        }\n        catch [System.Management.Automation.DriveNotFoundException]\n        {\n            try\n            {\n                # Create the HKU drive\n                New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS | Out-Null\n                $canCheckRegistry = $true\n            }\n            catch\n            {\n                # Ignore the failure to create the drive and go ahead with trying to set the agent up\n                Write-Warning \"Moving ahead with agent setup as the script failed to create HKU drive necessary for checking if the registry entry for the user's SId exists.\\n$_\"\n            }\n        }\n\n        # 120 seconds timeout\n        $timeout = 120\n\n        # Check if the registry key required for enabling autologon is present on the machine, if not wait for 120 seconds in case the user profile is still getting created\n        while ($timeout -ge 0 -and $canCheckRegistry)\n        {\n            $objUser = New-Object System.Security.Principal.NTAccount($Config.WindowsLogonAccount)\n            $securityId = $objUser.Translate([System.Security.Principal.SecurityIdentifier])\n            $securityId = $securityId.Value\n\n            if (Test-Path \"HKU:\\\\$securityId\")\n            {\n                if (!(Test-Path \"HKU:\\\\$securityId\\\\SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Run\"))\n                {\n                    New-Item -Path \"HKU:\\\\$securityId\\\\SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Run\" -Force\n                    Write-Host \"Created the registry entry path required to enable autologon.\"\n                }\n\n                break\n            }\n            else\n            {\n                $timeout -= 10\n                Start-Sleep(10)\n            }\n        }\n\n        if ($timeout -lt 0)\n        {\n            Write-Warning \"Failed to find the registry entry for the SId of the user, this is required to enable autologon. Trying to start the agent anyway.\"\n        }\n    }\n\n    function Install-Agent\n    {\n        param(\n            $Config\n        )\n\n        try\n        {\n            # Set the current directory to the agent dedicated one previously created.\n            Push-Location -Path $Config.AgentInstallPath\n\n            if ($Config.RunAsAutoLogon)\n            {\n                Set-MachineForAutologon -Config $Config\n\n                # Arguements to run agent with autologon enabled\n                $agentConfigArgs = \"--unattended\", \"--url\", $Config.ServerUrl, \"--auth\", \"PAT\", \"--token\", $Config.VstsUserPassword, \"--pool\", $Config.PoolName, \"--agent\", $Config.AgentName, \"--runAsAutoLogon\", \"--overwriteAutoLogon\", \"--windowslogonaccount\", $Config.WindowsLogonAccount\n            }\n            else\n            {\n                # Arguements to run agent as a service\n                $agentConfigArgs = \"--unattended\", \"--url\", $Config.ServerUrl, \"--auth\", \"PAT\", \"--token\", $Config.VstsUserPassword, \"--pool\", $Config.PoolName, \"--agent\", $Config.AgentName, \"--runasservice\", \"--windowslogonaccount\", $Config.WindowsLogonAccount\n            }\n\n            if (-not [string]::IsNullOrWhiteSpace($Config.WindowsLogonPassword))\n            {\n                $agentConfigArgs += \"--windowslogonpassword\", $Config.WindowsLogonPassword\n            }\n            if (-not [string]::IsNullOrWhiteSpace($Config.WorkDirectory))\n            {\n                $agentConfigArgs += \"--work\", $Config.WorkDirectory\n            }\n            & $Config.AgentExePath $agentConfigArgs\n            if ($LASTEXITCODE -ne 0)\n            {\n                Write-Error \"Agent configuration failed with exit code: $LASTEXITCODE\"\n            }\n        }\n        finally\n        {\n            Pop-Location\n        }\n    }\n\n    ###################################################################################################\n    #\n    # Handle all errors in this script.\n    #\n    trap\n    {\n        # NOTE: This trap will handle all errors. There should be no need to use a catch below in this\n        #       script, unless you want to ignore a specific error.\n        Show-LastError\n    }\n\n    ###################################################################################################\n    #\n    # Main execution block.\n    #\n    try\n    {\n        Write-Host 'Validating agent parameters'\n        Test-Parameters -VstsAccount $vstsAccount -WorkDirectory $workDirectory\n\n        Write-Host 'Preparing agent installation location'\n        $agentInstallPath = New-AgentInstallPath -DriveLetter $driveLetter -AgentName $agentName\n\n        Write-Host 'Checking for previously configured agent'\n        Test-AgentExists -InstallPath $agentInstallPath -AgentName $agentName\n\n        Write-Host \"Getting agent installer path $agentInstallPath\"\n        $agentExePath = Get-AgentInstaller -InstallPath $agentInstallPath\n\n        # Call the agent with the configure command and all the options (this creates the settings file)\n        # without prompting the user or blocking the cmd execution.\n        Write-Host 'Installing agent'\n        $config = @{\n            AgentExePath         = $agentExePath\n            AgentInstallPath     = $agentInstallPath\n            AgentName            = $agentName\n            PoolName             = $poolName\n            ServerUrl            = \"https://$VstsAccount.visualstudio.com\"\n            VstsUserPassword     = $vstsUserPassword\n            RunAsAutoLogon       = $runAsAutoLogon\n            WindowsLogonAccount  = $windowsLogonAccount\n            WindowsLogonPassword = $windowsLogonPassword\n            WorkDirectory        = $workDirectory\n        }\n        Install-Agent -Config $config\n        Write-Host 'Done'\n    }\n    finally\n    {\n        Pop-Location\n    }\n\n}\n\n\nfunction Install-VstsAgent\n{\n    # Downloads the Visual Studio Online Build Agent, installs on the new machine, registers with the Visual\n    # Studio Online account, and adds to the specified build agent pool\n    [CmdletBinding()]\n    param(\n        [Parameter(Mandatory = $true)][string]$vstsAccount,\n        [Parameter(Mandatory = $true)][string]$vstsUserPassword,\n        [Parameter(Mandatory = $true)][string]$agentName,\n        [Parameter(Mandatory = $false)][string]$agentNameSuffix,\n        [Parameter(Mandatory = $true)][string]$poolName,\n        [Parameter(Mandatory = $true)][string]$windowsLogonAccount,\n        [Parameter(Mandatory = $false)][string]$windowsLogonPassword,\n        [Parameter(Mandatory = $true)][ValidatePattern(\"[c-zC-Z]\")][ValidateLength(1, 1)][string]$driveLetter,\n        [Parameter(Mandatory = $false)][string]$workDirectory,\n        [Parameter(Mandatory = $true)][boolean]$runAsAutoLogon\n    )\n\n    Write-Output \"-----------------------------------------------------------------------------------\"\n    Write-Output \"Installing VSTS Agent...\"\n\n    ###################################################################################################\n\n    # if the agentName is empty, use %COMPUTERNAME% as the value\n    if ([String]::IsNullOrWhiteSpace($agentName))\n    {\n        $agentName = $env:COMPUTERNAME\n    }\n\n    # if the agentNameSuffix has a value, add this to the end of the agent name\n    if (![String]::IsNullOrWhiteSpace($agentNameSuffix))\n    {\n        $agentName = $agentName + $agentNameSuffix\n    }\n\n    #\n    # PowerShell configurations\n    #\n\n    # NOTE: Because the $ErrorActionPreference is \"Stop\", this script will stop on first failure.\n    #       This is necessary to ensure we capture errors inside the try-catch-finally block.\n    $ErrorActionPreference = \"Stop\"\n\n    # Ensure we set the working directory to that of the script.\n    Push-Location $PSScriptRoot\n\n    # Configure strict debugging.\n    Set-PSDebug -Strict\n\n    ###################################################################################################\n\n    #\n    # Functions used in this script.\n    #\n\n    function Show-LastError\n    {\n        [CmdletBinding()]\n        param(\n        )\n\n        $message = $error[0].Exception.Message\n        if ($message)\n        {\n            Write-Host -Object \"ERROR: $message\" -ForegroundColor Red\n        }\n\n        # IMPORTANT NOTE: Throwing a terminating error (using $ErrorActionPreference = \"Stop\") still\n        # returns exit code zero from the PowerShell script when using -File. The workaround is to\n        # NOT use -File when calling this script and leverage the try-catch-finally block and return\n        # a non-zero exit code from the catch block.\n        exit -1\n    }\n\n    function Test-Parameters\n    {\n        [CmdletBinding()]\n        param(\n            [string] $VstsAccount,\n            [string] $WorkDirectory\n        )\n\n        if ($VstsAccount -match \"https*://\" -or $VstsAccount -match \"visualstudio.com\")\n        {\n            Write-Error \"VSTS account '$VstsAccount' should not be the URL, just the account name.\"\n        }\n\n        if (![string]::IsNullOrWhiteSpace($WorkDirectory) -and !(Test-ValidPath -Path $WorkDirectory))\n        {\n            Write-Error \"Work directory '$WorkDirectory' is not a valid path.\"\n        }\n    }\n\n    function Test-ValidPath\n    {\n        param(\n            [string] $Path\n        )\n\n        $isValid = Test-Path -Path $Path -IsValid -PathType Container\n\n        try\n        {\n            [IO.Path]::GetFullPath($Path) | Out-Null\n        }\n        catch\n        {\n            $isValid = $false\n        }\n\n        return $isValid\n    }\n\n    function Test-AgentExists\n    {\n        [CmdletBinding()]\n        param(\n            [string] $InstallPath,\n            [string] $AgentName\n        )\n\n        $agentConfigFile = Join-Path $InstallPath '.agent'\n\n        if (Test-Path $agentConfigFile)\n        {\n            Write-Error \"Agent $AgentName is already configured in this machine\"\n        }\n    }\n\n    function Get-AgentPackage\n    {\n        [Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSAvoidUsingUsernameAndPasswordParams\", \"\")]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSAvoidUsingPlainTextForPassword\", \"\")]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSUseShouldProcessForStateChangingFunctions\", \"\")]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSAvoidUsingConvertToSecureStringWithPlainText\", \"\")]\n        [CmdletBinding()]\n        param(\n            [string] $VstsAccount,\n            [string] $VstsUserPassword\n        )\n\n        # Create a temporary directory where to download from VSTS the agent package (agent.zip).\n        $agentTempFolderName = Join-Path $env:temp ([System.IO.Path]::GetRandomFileName())\n        New-Item -ItemType Directory -Force -Path $agentTempFolderName | Out-Null\n\n        $agentPackagePath = \"$agentTempFolderName\\agent.zip\"\n        $serverUrl = \"https://$VstsAccount.visualstudio.com\"\n        $vstsAgentUrl = \"$serverUrl/_apis/distributedtask/packages/agent/win-x64?`$top=1&api-version=3.0\"\n        $vstsUser = \"AzureDevTestLabs\"\n\n        $maxRetries = 3\n        $retries = 0\n        do\n        {\n            try\n            {\n                $basicAuth = (\"{0}:{1}\" -f $vstsUser, $vstsUserPassword)\n                $basicAuth = [System.Text.Encoding]::UTF8.GetBytes($basicAuth)\n                $basicAuth = [System.Convert]::ToBase64String($basicAuth)\n                $headers = @{ Authorization = (\"Basic {0}\" -f $basicAuth) }\n\n                $agentList = Invoke-RestMethod -Uri $vstsAgentUrl -Headers $headers -Method Get -ContentType application/json\n                $agent = $agentList.value\n                if ($agent -is [Array])\n                {\n                    $agent = $agentList.value[0]\n                }\n                Invoke-WebRequest -Uri $agent.downloadUrl -Headers $headers -Method Get -OutFile \"$agentPackagePath\" -UseBasicParsing | Out-Null\n                break\n            }\n            catch\n            {\n                $exceptionText = ($_ | Out-String).Trim()\n\n                if (++$retries -gt $maxRetries)\n                {\n                    Write-Error \"Failed to download agent due to $exceptionText\"\n                }\n\n                Start-Sleep -Seconds 1\n            }\n        }\n        while ($retries -le $maxRetries)\n\n        return $agentPackagePath\n    }\n\n    function New-AgentInstallPath\n    {\n        [CmdletBinding()]\n        param(\n            [string] $DriveLetter,\n            [string] $AgentName\n        )\n\n        [string] $agentInstallPath = $null\n\n        # Construct the agent folder under the specified drive.\n        $agentInstallDir = $DriveLetter + \":\"\n        try\n        {\n            # Create the directory for this agent.\n            $agentInstallPath = Join-Path -Path $agentInstallDir -ChildPath $AgentName\n            New-Item -ItemType Directory -Force -Path $agentInstallPath | Out-Null\n        }\n        catch\n        {\n            $agentInstallPath = $null\n            Write-Error \"Failed to create the agent directory at $installPathDir.\"\n        }\n\n        return $agentInstallPath\n    }\n\n    function Get-AgentInstaller\n    {\n        param(\n            [string] $InstallPath\n        )\n\n        $agentExePath = [System.IO.Path]::Combine($InstallPath, 'config.cmd')\n\n        if (![System.IO.File]::Exists($agentExePath))\n        {\n            Write-Error \"Agent installer file not found: $agentExePath\"\n        }\n\n        return $agentExePath\n    }\n\n\n    function Set-MachineForAutologon\n    {\n        [Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSAvoidUsingUsernameAndPasswordParams\", \"\")]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSAvoidUsingPlainTextForPassword\", \"\")]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSUseShouldProcessForStateChangingFunctions\", \"\")]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSAvoidUsingConvertToSecureStringWithPlainText\", \"\")]\n[cmdletbinding()]\n        param(\n            $Config\n        )\n\n        if ([string]::IsNullOrWhiteSpace($Config.WindowsLogonPassword))\n        {\n            Write-Error \"Windows logon password was not provided. Please retry by providing a valid windows logon password to enable autologon.\"\n        }\n\n        # Create a PS session for the user to trigger the creation of the registry entries required for autologon\n        $computerName = \"localhost\"\n        $password = ConvertTo-SecureString $Config.WindowsLogonPassword -AsPlainText -Force\n\n        if ($Config.WindowsLogonAccount.Split(\"\\\").Count -eq 2)\n        {\n            $domain = $Config.WindowsLogonAccount.Split(\"\\\")[0]\n            $userName = $Config.WindowsLogonAccount.Split('\\')[1]\n        }\n        else\n        {\n            $domain = $Env:ComputerName\n            $userName = $Config.WindowsLogonAccount\n        }\n\n        $credentials = New-Object System.Management.Automation.PSCredential(\"$domain\\\\$userName\", $password)\n        Enter-PSSession -ComputerName $computerName -Credential $credentials\n        Exit-PSSession\n\n        try\n        {\n            # Check if the HKU drive already exists\n            Get-PSDrive -PSProvider Registry -Name HKU | Out-Null\n            $canCheckRegistry = $true\n        }\n        catch [System.Management.Automation.DriveNotFoundException]\n        {\n            try\n            {\n                # Create the HKU drive\n                New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS | Out-Null\n                $canCheckRegistry = $true\n            }\n            catch\n            {\n                # Ignore the failure to create the drive and go ahead with trying to set the agent up\n                Write-Warning \"Moving ahead with agent setup as the script failed to create HKU drive necessary for checking if the registry entry for the user's SId exists.\\n$_\"\n            }\n        }\n\n        # 120 seconds timeout\n        $timeout = 120\n\n        # Check if the registry key required for enabling autologon is present on the machine, if not wait for 120 seconds in case the user profile is still getting created\n        while ($timeout -ge 0 -and $canCheckRegistry)\n        {\n            $objUser = New-Object System.Security.Principal.NTAccount($Config.WindowsLogonAccount)\n            $securityId = $objUser.Translate([System.Security.Principal.SecurityIdentifier])\n            $securityId = $securityId.Value\n\n            if (Test-Path \"HKU:\\\\$securityId\")\n            {\n                if (!(Test-Path \"HKU:\\\\$securityId\\\\SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Run\"))\n                {\n                    New-Item -Path \"HKU:\\\\$securityId\\\\SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Run\" -Force\n                    Write-Host \"Created the registry entry path required to enable autologon.\"\n                }\n\n                break\n            }\n            else\n            {\n                $timeout -= 10\n                Start-Sleep(10)\n            }\n        }\n\n        if ($timeout -lt 0)\n        {\n            Write-Warning \"Failed to find the registry entry for the SId of the user, this is required to enable autologon. Trying to start the agent anyway.\"\n        }\n    }\n\n    function Install-Agent\n    {\n        param(\n            $Config\n        )\n\n        try\n        {\n            # Set the current directory to the agent dedicated one previously created.\n            Push-Location -Path $Config.AgentInstallPath\n\n            if ($Config.RunAsAutoLogon)\n            {\n                Set-MachineForAutologon -Config $Config\n\n                # Arguements to run agent with autologon enabled\n                $agentConfigArgs = \"--unattended\", \"--url\", $Config.ServerUrl, \"--auth\", \"PAT\", \"--token\", $Config.VstsUserPassword, \"--pool\", $Config.PoolName, \"--agent\", $Config.AgentName, \"--runAsAutoLogon\", \"--overwriteAutoLogon\", \"--windowslogonaccount\", $Config.WindowsLogonAccount\n            }\n            else\n            {\n                # Arguements to run agent as a service\n                $agentConfigArgs = \"--unattended\", \"--url\", $Config.ServerUrl, \"--auth\", \"PAT\", \"--token\", $Config.VstsUserPassword, \"--pool\", $Config.PoolName, \"--agent\", $Config.AgentName, \"--runasservice\", \"--windowslogonaccount\", $Config.WindowsLogonAccount\n            }\n\n            if (-not [string]::IsNullOrWhiteSpace($Config.WindowsLogonPassword))\n            {\n                $agentConfigArgs += \"--windowslogonpassword\", $Config.WindowsLogonPassword\n            }\n            if (-not [string]::IsNullOrWhiteSpace($Config.WorkDirectory))\n            {\n                $agentConfigArgs += \"--work\", $Config.WorkDirectory\n            }\n            & $Config.AgentExePath $agentConfigArgs\n            if ($LASTEXITCODE -ne 0)\n            {\n                Write-Error \"Agent configuration failed with exit code: $LASTEXITCODE\"\n            }\n        }\n        finally\n        {\n            Pop-Location\n        }\n    }\n\n    ###################################################################################################\n\n    #\n    # Handle all errors in this script.\n    #\n\n    trap\n    {\n        # NOTE: This trap will handle all errors. There should be no need to use a catch below in this\n        #       script, unless you want to ignore a specific error.\n        Show-LastError\n    }\n\n    ###################################################################################################\n\n    #\n    # Main execution block.\n    #\n\n    try\n    {\n        Write-Host 'Validating agent parameters'\n        Test-Parameters -VstsAccount $vstsAccount -WorkDirectory $workDirectory\n\n        Write-Host 'Preparing agent installation location'\n        $agentInstallPath = New-AgentInstallPath -DriveLetter $driveLetter -AgentName $agentName\n\n        Write-Host 'Checking for previously configured agent'\n        Test-AgentExists -InstallPath $agentInstallPath -AgentName $agentName\n\n        Write-Host 'Downloading agent package'\n        $agentPackagePath = Get-AgentPackage -VstsAccount $vstsAccount -VstsUserPassword $vstsUserPassword\n\n        Write-Host 'Extracting agent package contents'\n        Expand-Archive -LiteralPath $agentPackagePath -DestinationPath $agentInstallPath\n\n        Write-Host 'Getting agent installer path'\n        $agentExePath = Get-AgentInstaller -InstallPath $agentInstallPath\n\n        # Call the agent with the configure command and all the options (this creates the settings file)\n        # without prompting the user or blocking the cmd execution.\n        Write-Host 'Installing agent'\n        $config = @{\n            AgentExePath         = $agentExePath\n            AgentInstallPath     = $agentInstallPath\n            AgentName            = $agentName\n            PoolName             = $poolName\n            ServerUrl            = \"https://$VstsAccount.visualstudio.com\"\n            VstsUserPassword     = $vstsUserPassword\n            RunAsAutoLogon       = $runAsAutoLogon\n            WindowsLogonAccount  = $windowsLogonAccount\n            WindowsLogonPassword = $windowsLogonPassword\n            WorkDirectory        = $workDirectory\n        }\n        Install-Agent -Config $config\n        Write-Host 'Done'\n    }\n    finally\n    {\n        Pop-Location\n    }\n\n}\n\nfunction Get-SystemData\n{\n    # Get available Volume size\n    $LogicalDisk = Get-WmiObject -Class win32_logicaldisk -Property *\n    $FreeSpace = $LogicalDisk.FreeSpace / 1GB\n    $Size = $LogicalDisk.Size / 1GB\n    Write-Output \"$($FreeSpace.ToString(\"#.##\")) of $($Size.ToString(\"#.##\")) GB disk space available\"\n}\n\nfunction Watch-VstsAgentService\n{\n    Write-Output \"This container will keep running as long as the Azure DevOps agent (vstsagent) service in it is not interrupted for longer than 3 minutes.\"\n    $TryCount = 0\n    while ($true)\n    {\n        if ((Get-Service \"vstsagent*\").Status -eq \"Running\")\n        {\n            Start-Sleep -Seconds 60 | Out-Null\n            # Test-Connection -ComputerName localhost -Quiet -Delay 60 | Out-Null\n        }\n        else\n        {\n            $TryCount++\n        }\n        if ($TryCount -gt 3)\n        {\n            break\n        }\n    }\n}\n#endregion\n\n#region Main\n\n# Record start time\n$StartDate = Get-Date\nWrite-Output \"-----------------------------------------------------------------------------------\"\nWrite-Host \"Configuration started at $StartDate\"\n\n# Set SSL version preference\n[Net.ServicePointManager]::SecurityProtocol = \"Tls12, Tls11, Tls\" # Original: Ssl3, Tls\n\n# Install Chocolatey\n$ChocoInstallStart = Get-Date\nif ($UseChocolatey -eq $true)\n{\n    Install-Choco\n    $ChocoInstallEnd = Get-Date\n    $ChocoInstallDuration = New-TimeSpan -Start $ChocoInstallStart -End $ChocoInstallEnd\n    Write-Host \"Chocolatey installation took $($ChocoInstallDuration.Hours.ToString(\"00\")):$($ChocoInstallDuration.Minutes.ToString(\"00\")):$($ChocoInstallDuration.Seconds.ToString(\"00\")) (HH:mm:ss)\"\n}\n\n# Install Terraform\n$TerraformInstallStart = Get-Date\nif ($UseChocolatey -eq $true)\n{\n    Install-ChocoTerraform\n}\nelse\n{\n    Install-Terraform    \n}\n$TerraformInstallEnd = Get-Date\n$TerraformInstallDuration = New-TimeSpan -Start $TerraformInstallStart -End $TerraformInstallEnd\nWrite-Host \"Terraform installation took $($TerraformInstallDuration.Hours.ToString(\"00\")):$($TerraformInstallDuration.Minutes.ToString(\"00\")):$($TerraformInstallDuration.Seconds.ToString(\"00\")) (HH:mm:ss)\"\n\n# Install Json2HCL\n$Json2HclInstallStart = Get-Date\nInstall-Json2Hcl\n$Json2HclInstallEnd = Get-Date\n$Json2HclInstallDuration = New-TimeSpan -Start $Json2HclInstallStart -End $Json2HclInstallEnd\nWrite-Host \"Json2HCL installation took $($Json2HclInstallDuration.Hours.ToString(\"00\")):$($Json2HclInstallDuration.Minutes.ToString(\"00\")):$($Json2HclInstallDuration.Seconds.ToString(\"00\")) (HH:mm:ss)\"\n\n# Install Nuget\n$NugetInstallStart = Get-Date\nInstall-Nuget\n$NugetInstallEnd = Get-Date\n$NugetInstallDuration = New-TimeSpan -Start $NugetInstallStart -End $NugetInstallEnd\nWrite-Host \"Nuget installation took $($NugetInstallDuration.Hours.ToString(\"00\")):$($NugetInstallDuration.Minutes.ToString(\"00\")):$($NugetInstallDuration.Seconds.ToString(\"00\")) (HH:mm:ss)\"\n\n# Install Powershell Modules\n$PoShModuleInstallStart = Get-Date\nInstall-PowerShellModules -RequiredModules $RequiredPowerShellModules\n$PoShModuleInstallEnd = Get-Date\n$PoShModuleInstallDuration = New-TimeSpan -Start $PoShModuleInstallStart -End $PoShModuleInstallEnd\nWrite-Host \"PowerShell module installation took $($PoShModuleInstallDuration.Hours.ToString(\"00\")):$($PoShModuleInstallDuration.Minutes.ToString(\"00\")):$($PoShModuleInstallDuration.Seconds.ToString(\"00\")) (HH:mm:ss)\"\n\n# Install Azure CLI\n$AzureCliInstallStart = Get-Date\nif ($InstallAzureCli -eq $true) \n{\n    if ($UseChocolatey -eq $true)\n    {\n        Install-ChocoAzureCli\n    }\n    else\n    {\n        Install-AzureCli    \n    }\n    $AzureCliInstallEnd = Get-Date\n    $AzureCliInstallDuration = New-TimeSpan -Start $AzureCliInstallStart -End $AzureCliInstallEnd\n    Write-Output \"Azure CLI installation took $($AzureCliInstallDuration.Hours.ToString(\"00\")):$($AzureCliInstallDuration.Minutes.ToString(\"00\")):$($AzureCliInstallDuration.Seconds.ToString(\"00\")) (HH:mm:ss)\"\n}\n\n# Install PowerShell Core\n$PoShCoreInstallStart = Get-Date\n\nif ($InstallPowerShellCore -eq $true)\n{\n    if ($UseChocolatey -eq $true)\n    {\n        Install-ChocoPowerShellCore\n    }\n    else\n    {\n        Install-PowerShellCore    \n    }\n    $PoShCoreInstallEnd = Get-Date\n    $PoShCoreInstallDuration = New-TimeSpan -Start $PoShCoreInstallStart -End $PoShCoreInstallEnd\n    Write-Output \"PowerShell Core installation took $($PoShCoreInstallDuration.Hours.ToString(\"00\")):$($PoShCoreInstallDuration.Minutes.ToString(\"00\")):$($PoShCoreInstallDuration.Seconds.ToString(\"00\")) (HH:mm:ss)\"\n}\n\n# Install VSTS Agent\n$AgentInstallStart = Get-Date\n$AgentName = \"$AgentNamePrefix-$(Get-Date -Format yyyyMMdd-HHmmss)\"\nif ($UseChocolatey -eq $true)\n{\n    Install-ChocoVstsAgent  -vstsAccount $VSTSAccountName -vstsUserPassword $PATToken  -agentName $AgentName -poolName $PoolName -windowsLogonAccount \"NT AUTHORITY\\NetworkService\" -driveLetter \"C\" -runAsAutoLogon:$false    \n}\nelse\n{\n    Install-VstsAgent -vstsAccount $VSTSAccountName -vstsUserPassword $PATToken  -agentName $AgentName -poolName $PoolName -windowsLogonAccount \"NT AUTHORITY\\NetworkService\" -driveLetter \"C\" -runAsAutoLogon:$false\n}\n\n$AgentInstallEnd = Get-Date\n$AgentInstallDuration = New-TimeSpan -Start $AgentInstallStart -End $AgentInstallEnd\nWrite-Host \"Agent installation took $($AgentInstallDuration.Hours.ToString(\"00\")):$($AgentInstallDuration.Minutes.ToString(\"00\")):$($AgentInstallDuration.Seconds.ToString(\"00\")) (HH:mm:ss)\"\n\n# Get available Volume size, RAM\nWrite-Output \"-----------------------------------------------------------------------------------\"\nGet-SystemData\n\n# Calculate duration\n$OverallDuration = New-TimeSpan -Start $StartDate -End (Get-Date)\nWrite-Output \"-----------------------------------------------------------------------------------\"\nWrite-Host \"It took $($OverallDuration.Hours.ToString(\"00\")):$($OverallDuration.Minutes.ToString(\"00\")):$($OverallDuration.Seconds.ToString(\"00\")) (HH:mm:ss) to install the required components.\"\nWrite-Host \"Installation finished at $(Get-Date)\"\nWrite-Host \"Container successfully configured.\" # Do NOT change this text, as this is the success criteria for the wrapper script.\n\n# Keep the container running by checking if the VSTS service is up\nWrite-Output \"-----------------------------------------------------------------------------------\"\nWatch-VstsAgentService\n\n#endregion\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUu1cpQ9vh4J+hzFU/c3YW9C4J\n# flugggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz\n# c3VyZWQgSUQgQ29kZSBTaWduaW5nIENBMB4XDTE3MDUwOTAwMDAwMFoXDTIwMDUx\n# MzEyMDAwMFowVzELMAkGA1UEBhMCVVMxETAPBgNVBAgTCFZpcmdpbmlhMQ8wDQYD\n# VQQHEwZWaWVubmExETAPBgNVBAoTCGRiYXRvb2xzMREwDwYDVQQDEwhkYmF0b29s\n# czCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAI8ng7JxnekL0AO4qQgt\n# Kr6p3q3SNOPh+SUZH+SyY8EA2I3wR7BMoT7rnZNolTwGjUXn7bRC6vISWg16N202\n# 1RBWdTGW2rVPBV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BhjByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMM\n# RGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQD\n# EyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgQ29kZSBTaWduaW5nIENBAhACwXUo\n# dNXChDGFKtigZGnKMAkGBSsOAwIaBQCgeDAYBgorBgEEAYI3AgEMMQowCKACgACh\n# AoAAMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcCAQsxDjAM\n# BgorBgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBR53uHcZr/UgRVwXu6uR9unXJ4R\n# CzANBgkqhkiG9w0BAQEFAASCAQCNRzZa1SvIfzZvGCNW5Q5mwByTNfEwWIQsJ4Wc\n# 2uOc3opBj4QNotkaVi+isoR6Kco+SeRJ6XNmrf3G/GDkfwhSCaFw8Gu7TnTHAR29\n# LXeHbRSl1ibDgygrlX+Ag6E7VMS2E5STqDleLzsx2XUK0tenV4p7MKs9hHja1kev\n# HUHcAMbKR3OOsLPi1laI1vCwWroECRk3SLIzh5CUg+9zPKzDsQ2IA3qfW70ES6p4\n# 3bg++PAN4SC/2D5LfrUUlpieZlMEfVuOcUCRPuPMiIon/+zcWB7JKjmD4sh5sXDB\n# AkGUPvm0VR2GzeD+PkwZYM97lIt1ID8V6+e/bTWTwiT1INdf\n# SIG # End signature block\n"
  },
  {
    "path": "developing/Archive/tests/build/Remove-VstsAgentOnWindowsServerCoreContainer.ps1",
    "content": "########################################################################################################################\n# Script Disclaimer\n########################################################################################################################\n# This script is not supported under any Microsoft standard support program or service.\n# This script is provided AS IS without warranty of any kind.\n# Microsoft disclaims all implied warranties including, without limitation, any implied warranties of\n# merchantability or of fitness for a particular purpose. The entire risk arising out of the use or\n# performance of this script and documentation remains with you. In no event shall Microsoft, its authors,\n# or anyone else involved in the creation, production, or delivery of this script be liable for any damages\n# whatsoever (including, without limitation, damages for loss of business profits, business interruption,\n# loss of business information, or other pecuniary loss) arising out of the use of or inability to use\n# this script or documentation, even if Microsoft has been advised of the possibility of such damages.\n\n<#\n.SYNOPSIS\n    This script removes the selected Azure Container Instance(s).\n.DESCRIPTION\n    This script removes the selected Azure Container Instance(s). It leaves the Resource Group (and other resources\n     within it) intact. This script is designed and tested to be run from Azure Cloud Shell.\n.PARAMETER SubscriptionName\n    Name of the Subscription.\n.PARAMETER ResourceGroupName\n    Name of the Resource Group.\n.PARAMETER ContainerName\n    Name of the ACI container(s).\n.PARAMETER PatToken\n    PAT token required to log in to Azure DevOps to delete the Agent's registration from the pool.\n.PARAMETER AzureDevOpsAccountName\n    Name of the Azure DevOps account that the Agent is registered to.\n.PARAMETER AgentPoolName\n    Name of the Agent Pool that holds the Agent to delete.\n.EXAMPLE\n    .\\Remove-VstsAgentOnWindowsServerCoreContainer.ps1 -SubscriptionName \"<subscription name>\" -ResourceGroupName \"<resource group name>\" -ContainerName \"<container 1 name>\", \"<container 2 name>\" -PatToken \"<pat token to log in>\" -AzureDevOpsAccountName \"<ADOS account name>\" -AgentPoolName \"<name of the Agent Pool>\"\n    This removes the 2 requested containers and their registrations from Azure DevOps. It leaves the Resource Group (and other resources within) intact.\n.INPUTS\n    <none>\n.OUTPUTS\n    <none>\n.NOTES\n    Version:        1.1\n    Author:         Mate Barabas\n    Creation Date:  2018-08-29\n    Change log:\n    - v1.1 (2019-04-06): the script now removes the Agent's registration from the Agent pool\n#>\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSAvoidUsingUsernameAndPasswordParams\", \"\")]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSAvoidUsingPlainTextForPassword\", \"\")]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSUseShouldProcessForStateChangingFunctions\", \"\")]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSAvoidUsingConvertToSecureStringWithPlainText\", \"\")]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSAvoidTrailingWhiteSpace\", \"\")]\nparam(\n\n    [Parameter(Mandatory = $true)][string]$SubscriptionName,\n    [Parameter(Mandatory = $true)][string]$ResourceGroupName,\n    [Parameter(Mandatory = $true)][array]$ContainerName,\n    [Parameter(Mandatory = $true)][string]$PatToken, #Personal access token\n    [Parameter(Mandatory = $true)][string]$AzureDevOpsAccountName, #Azure DevOps account name\n    [Parameter(Mandatory = $true)][string]$AgentPoolName #Azure DevOps Agent pool name\n\n)\n\n\n#region Functions\n\nfunction Set-AzureContext\n{\n\n    param (\n\n        [Parameter(Mandatory = $false)][string]$SubscriptionName\n\n    )\n\n\n    # Select the desired Subscription based on the Subscription name provided\n    if ($SubscriptionName)\n    {\n        $Subscription = (Get-AzureRmSubscription | Where-Object { $_.Name -eq $SubscriptionName })\n            \n        if (-not $Subscription)\n        {\n            Write-Error \"There's no Subscription available with the provided name.\"\n            return\n        }\n        else\n        {\n            $SubscriptionId = $Subscription.Id\n            Select-AzureRmSubscription -SubscriptionId $SubscriptionId | Out-Null\n            Write-Output \"The following subscription was selected: \"\"$SubscriptionName\"\"\"\n        }\n    }\n    # If no Subscription name was provided select the active Subscription based on the existing context\n    else\n    {\n        $SubscriptionName = (Get-AzureRmContext).Subscription.Name\n        $Subscription = (Get-AzureRmSubscription | Where-Object { $_.Name -eq $SubscriptionName })\n        Write-Output \"The following subscription was selected: \"\"$SubscriptionName\"\"\"\n    }\n\n    if ($Subscription.Count -gt 1)\n    {\n        Write-Error \"You have more then 1 Subscription with the same name. Exiting...\"\n        return\n    }\n}\n\nfunction Remove-Container\n{\n\n    param (\n\n        [Parameter(Mandatory = $true)][array]$ContainerName\n\n    )\n\n    foreach ($Name in $ContainerName)\n    {\n        $Container = Get-AzureRmContainerGroup -ResourceGroupName $ResourceGroupName -Name $Name -ErrorAction SilentlyContinue\n        if (-not $Container)\n        {\n            Write-Warning \"No ACI container exists with the provided name ($Name).\"\n        }\n        else \n        {\n            Write-Warning \"Removing selected ACI container ($Name)...\"    \n            Remove-AzureRmContainerGroup -ResourceGroupName $ResourceGroupName -Name $Name -Confirm:$false\n\n            # Check success\n            $Container = Get-AzureRmContainerGroup -ResourceGroupName $ResourceGroupName -Name $Name -ErrorAction SilentlyContinue\n            if ($null -eq $Container)\n            {\n                Write-Output \"ACI container \"\"$Name\"\" successfully deleted.\"\n                if (-not ($PatToken -and $AgentPoolName -and $AzureDevOpsAccountName))\n                {\n                    Write-Warning \"One or more containers have been deleted. Don't forget to clean your Agent pool in Azure DevOps (remove any agents that were created in a previous iteration and are now offline)!\"\n                }\n            }\n        }\n    }\n\n}\n\nfunction Remove-AzureDevOpsAgentFromPool\n{\n    Param(\n        [string]$PatToken, #Personal access token\n        [string]$AzureDevOpsAccountName, #Azure DevOps account name\n        [string]$AgentPoolName, #Azure DevOps Agent pool name\n        [array]$ContainerName  #Azure DevOps Agent pool name\n    )\n        \n    $base64AuthInfo = [System.Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(\":$($PatToken)\"))\n    $Header = @{Authorization = (\"Basic $base64AuthInfo\") }\n\n    # Get Agent Pool\n    Write-Output \"Getting Agent Pool ($AgentPoolName)...\"\n    $uri = \"https://dev.azure.com/$AzureDevOpsAccountName/_apis/distributedtask/pools\"\n    $result = Invoke-RestMethod -Uri $uri -Method GET -ContentType \"application/json\" -Headers $Header\n    $AgentPool = $result.value | Where-Object { $_.Name -eq \"$AgentPoolName\" }\n    $AgentPoolId = $AgentPool.id\n\n    if (-not $AgentPoolId)\n    {\n        Write-Error \"The Agent Pool ($AgentPoolName) doesn't exist!\"\n    }\n    else\n    {\n        # Get Agents\n        Write-Output \"Getting Agents from Pool...\"\n        $uri = \"https://dev.azure.com/$AzureDevOpsAccountName/_apis/distributedtask/pools/$AgentPoolId/agents?includeCapabilities=false&includeAssignedRequest=true\"\n        $result = Invoke-RestMethod -Uri $uri -Method GET -ContentType \"application/json\" -Headers $Header\n        $Agents = $result.value\n\n        if (-not $Agents)\n        {\n            Write-Output \"There are no Agents in this Agent Pool\"\n        }\n        else\n        {\n            Write-Output \"The following agents were found:\"\n            foreach ($Agent in $Agents)\n            {\n                $AgentName = $Agent.name\n                $AgentStatus = $Agent.status\n                Write-Output \"$AgentName ($AgentStatus)\"\n            }\n\n            # Delete Agent(s) from Pool\n            foreach ($Name in $ContainerName)\n            {\n                Write-Output \"Attempting to remove any Agent(s) that belonged to this ACI container: $Name...\"\n                foreach ($Agent in $Agents)\n                {\n                    $AgentName = $Agent.name\n\n                    if ($AgentName -match \"^$Name-\")\n                    {\n                        # Delete Agent\n                        $AgentIds = $Agent.id\n                        foreach ($AgentId in $AgentIds)\n                        {\n                            Write-Output \"Deleting Agent ($AgentName) - (Agent ID: $AgentId)...\"\n                            $uri = \"https://dev.azure.com/$AzureDevOpsAccountName/_apis/distributedtask/pools/$AgentPoolId/agents/$($AgentId)?api-version=5.0\"\n                            $result = Invoke-RestMethod -Uri $uri -Method DELETE -ContentType \"application/json\" -Headers $Header\n\n                            # Check success\n                            Write-Output \"Checking if the Agent ($AgentName) - (Agent ID: $AgentId) is still there...\"\n                            $uri = \"https://dev.azure.com/$AzureDevOpsAccountName/_apis/distributedtask/pools/$AgentPoolId/agents?includeCapabilities=false&includeAssignedRequest=true\"\n                            $result = Invoke-RestMethod -Uri $uri -Method GET -ContentType \"application/json\" -Headers $Header\n                            $AgentStillThere = $result.value.id -contains $AgentId\n                            if ($AgentStillThere)\n                            {\n                                Write-Warning \"Agent ($AgentName) could not be deleted. Don't forget to clean your Agent pool in Azure Devops (remove any agents that were created in a previous iteration and are now offline)!\"\n                            }\n                            else\n                            {\n                                Write-Output \"Agent ($AgentName) successfully deleted.\"    \n                            }\n                        }\n                    }\n                }\n            }\n        }\n    }\n}\n\n#endregion\n\n\n#region Main\n\n# Login to Azure and select Subscription\nSet-AzureContext -SubscriptionName $SubscriptionName\n\n# Delete selected containers\nRemove-Container -ContainerName $ContainerName\n\n# Delete Agent registration from Azure DevOps Agent pool\nRemove-AzureDevOpsAgentFromPool -PatToken $PatToken -AzureDevOpsAccountName $AzureDevOpsAccountName -AgentPoolName $AgentPoolName -ContainerName $ContainerName\n\n#endregion\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUqnC17MmjLJIModmCDDzDSlmd\n# OEGgggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz\n# c3VyZWQgSUQgQ29kZSBTaWduaW5nIENBMB4XDTE3MDUwOTAwMDAwMFoXDTIwMDUx\n# MzEyMDAwMFowVzELMAkGA1UEBhMCVVMxETAPBgNVBAgTCFZpcmdpbmlhMQ8wDQYD\n# VQQHEwZWaWVubmExETAPBgNVBAoTCGRiYXRvb2xzMREwDwYDVQQDEwhkYmF0b29s\n# czCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAI8ng7JxnekL0AO4qQgt\n# Kr6p3q3SNOPh+SUZH+SyY8EA2I3wR7BMoT7rnZNolTwGjUXn7bRC6vISWg16N202\n# 1RBWdTGW2rVPBVLF4HA46jle4hcpEVquXdj3yGYa99ko1w2FOWzLjKvtLqj4tzOh\n# K7wa/Gbmv0Si/FU6oOmctzYMI0QXtEG7lR1HsJT5kywwmgcjyuiN28iBIhT6man0\n# Ib6xKDv40PblKq5c9AFVldXUGVeBJbLhcEAA1nSPSLGdc7j4J2SulGISYY7ocuX3\n# tkv01te72Mv2KkqqpfkLEAQjXgtM0hlgwuc8/A4if+I0YtboCMkVQu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n# AoAAMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcCAQsxDjAM\n# BgorBgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBTRWXL978E8G0Ad7rqqqhCDE2a2\n# WDANBgkqhkiG9w0BAQEFAASCAQAJLXwSjpFXNvsRTGaJCps/BdPTa4vslCLFIiqk\n# Hnk9YAdT4avJIEWFJeYPtNG9YYMueEQ778aigPyvFDwdIormXm5ECfm3Ijfo2Pn2\n# RXd8zBwb/bNnAYsnmBLw1J9nCz0umVVqv2gGGDZWykclyZXFd4C+qZihRoRS6bUi\n# rDUDkSN61nPtcv3naa2a99NV8qcZeXEvXhivDxz7gqGSTqWCEDzt868q4dAN81gi\n# sWbrsiUCrNL313euZRW5zH6DICgmXLacqKam1gvIdWqLpYVX/OSfZh1DIR7UG/xm\n# CFMzSSJ0SeOYYEGQd6vzv9qz2woDmsQcsbnHqZjimWzEIeJa\n# SIG # End signature block\n"
  },
  {
    "path": "developing/Archive/tests/checks/AgentChecks.Tests.ps1",
    "content": "# load all of the assertion functions\n(Get-ChildItem $PSScriptRoot/../../internal/assertions/).ForEach{. $Psitem.FullName}\n\nDescribe \"Checking Agent.Tests.ps1 checks\" -Tag UnitTest, AgentAssertions {\n    Context \"Checking Database Mail XPs\" {\n        # Mock the version check for running tests\n        Mock Connect-DbaInstance {}\n        # Define test cases for the results to fail test and fill expected message\n        # So the results of SPConfigure is 1, we expect $false but the result is true and the results of SPConfigure is 0, we expect $true but the result is false\n        $TestCases = @{spconfig = 1; expected = $false; actual = $true}, @{spconfig = 0; expected = $true; actual = $false}\n        It \"Fails Check Correctly for Config <spconfig> and expected value <expected>\" -TestCases $TestCases {\n            Param($spconfig, $actual, $expected)\n            Mock Get-DbaSpConfigure {@{\"ConfiguredValue\" = $spconfig}}\n            {Assert-DatabaseMailEnabled -SQLInstance 'Dummy' -DatabaseMailEnabled $expected} | Should -Throw -ExpectedMessage \"Expected `$$expected, because The Database Mail XPs setting should be set correctly, but got `$$actual\"\n        }\n        $TestCases = @{spconfig = 0; expected = $false}, @{spconfig = 1; expected = $true; }\n        It \"Passes Check Correctly for Config <spconfig> and expected value <expected>\" -TestCases $TestCases {\n            Param($spconfig, $expected)\n            Mock Get-DbaSpConfigure {@{\"ConfiguredValue\" = $spconfig}}\n            Assert-DatabaseMailEnabled -SQLInstance 'Dummy' -DatabaseMailEnabled $expected\n        }\n        # Validate we have called the mock the correct number of times\n        It \"Should call the mocks\" {\n            $assertMockParams = @{\n                'CommandName' = 'Get-DbaSpConfigure'\n                'Times'       = 4\n                'Exactly'     = $true\n            }\n            Assert-MockCalled @assertMockParams\n        }\n    }\n\n    Context \"Checking Job History\" {\n        # if configured value for MaximumHistoryRows is -1 and test value -1 it will pass\n        It \"Passes Check Correctly with Maximum History Rows disabled (-1)\" {\n            # Mock to pass\n            Mock Get-DbaAgentServer {\n                [PSCustomObject]@{\n                    MaximumHistoryRows = -1;\n                    MaximumJobHistoryRows = 0;\n                }\n            }\n            $AgentServer = Get-DbaAgentServer -SqlInstance \"Dummy\" -EnableException:$false\n            Assert-JobHistoryRowsDisabled -AgentServer $AgentServer -minimumJobHistoryRows -1\n        }\n        # if configured value for MaximumHistoryRows is -1 and test value -1 it will pass\n        It \"Fails Check Correctly with Maximum History Rows disabled (-1) but configured value is 1000\" {\n            # Mock to fail\n            Mock Get-DbaAgentServer {\n                [PSCustomObject]@{\n                    MaximumHistoryRows = 1000;\n                    MaximumJobHistoryRows = 0;\n                }\n            }\n            $AgentServer = Get-DbaAgentServer -SqlInstance \"Dummy\" -EnableException:$false\n            { Assert-JobHistoryRowsDisabled -AgentServer $AgentServer -minimumJobHistoryRows -1 } | Should -Throw -ExpectedMessage \"Expected '-1', because Maximum job history configuration should be disabled, but got 1000.\"\n        }\n        # if configured value for MaximumHistoryRows is 10000 and test value 10000 it will pass\n        It \"Passes Check Correctly with Maximum History Rows being 10000\" {\n            # Mock to pass\n            Mock Get-DbaAgentServer {\n                [PSCustomObject]@{\n                    MaximumHistoryRows = 10000;\n                    MaximumJobHistoryRows = 0;\n                }\n            }\n            $AgentServer = Get-DbaAgentServer -SqlInstance \"Dummy\" -EnableException:$false\n            Assert-JobHistoryRows -AgentServer $AgentServer -minimumJobHistoryRows 10000\n        }\n        # if configured value for MaximumHistoryRows is -1 and test value -1 it will pass\n        It \"Fails Check Correctly with Maximum History Rows being less than 10000\" {\n            # Mock to fail\n            Mock Get-DbaAgentServer {\n                [PSCustomObject]@{\n                    MaximumHistoryRows = 1000;\n                    MaximumJobHistoryRows = 0;\n                }\n            }\n            $AgentServer = Get-DbaAgentServer -SqlInstance \"Dummy\" -EnableException:$false\n            { Assert-JobHistoryRows -AgentServer $AgentServer -minimumJobHistoryRows 10000 } | Should -Throw -ExpectedMessage \"Expected the actual value to be greater than or equal to 10000, because We expect the maximum job history row configuration to be greater than the configured setting 10000, but got 1000.\"\n        }\n        # if configured value is 100 and test value 100 it will pass\n        It \"Passes Check Correctly with Maximum History Rows per job being 100\" {\n            # Mock to pass\n            Mock Get-DbaAgentServer {\n                [PSCustomObject]@{\n                    MaximumHistoryRows = 1000;\n                    MaximumJobHistoryRows = 100;\n                }\n            }\n            $AgentServer = Get-DbaAgentServer -SqlInstance \"Dummy\" -EnableException:$false\n            Assert-JobHistoryRowsPerJob -AgentServer $AgentServer -minimumJobHistoryRowsPerJob 100\n        }\n        # if configured value is -1 and test value -1 it will pass\n        It \"Fails Check Correctly with Maximum History Rows per job being less than 100\" {\n            # Mock to fail\n            Mock Get-DbaAgentServer {\n                [PSCustomObject]@{\n                    MaximumHistoryRows = 100;\n                    MaximumJobHistoryRows = 50;\n                }\n            }\n            $AgentServer = Get-DbaAgentServer -SqlInstance \"Dummy\" -EnableException:$false\n            { Assert-JobHistoryRowsPerJob -AgentServer $AgentServer -minimumJobHistoryRowsPerJob 100 } | Should -Throw -ExpectedMessage \"Expected the actual value to be greater than or equal to 100, because We expect the maximum job history row configuration per agent job to be greater than the configured setting 100, but got 50.\"\n        }\n        # Validate we have called the mock the correct number of times\n        It \"Should call the mocks\" {\n            $assertMockParams = @{\n                'CommandName' = 'Get-DbaAgentServer'\n                'Times'       = 6\n                'Exactly'     = $true\n            }\n            Assert-MockCalled @assertMockParams\n        }\n    }\n\n    Context \"Checking running jobs\"{\n        It \"Should pass when the running job duration is less than the average job duration\" {\n            # Mock to pass\n            $runningjob = @{\n                JobName        = 'Waiting for 5 seconds'\n                AvgSec         = 38\n                StartDate      = '30/07/2019 12:17:25'\n                RunningSeconds = 24\n                Diff           = -14\n            }\n            $runningjobpercentage = 50\n            Assert-LongRunningJobs -runningjob $runningjob -runningjobpercentage $runningjobpercentage\n        }\n\n        It \"Should pass when the running job duration is the same as the average job duration\" {\n            # Mock to pass\n            $runningjob = @{\n                JobName        = 'Waiting for 5 seconds'\n                AvgSec         = 38\n                StartDate      = '30/07/2019 12:17:25'\n                RunningSeconds = 38\n                Diff           = 0\n            }\n            $runningjobpercentage = 50\n            Assert-LongRunningJobs -runningjob $runningjob -runningjobpercentage $runningjobpercentage\n        }\n\n        It \"Should pass when the running job duration is more than the average job duration but the percentage difference is less than the specified\" {\n            # Mock to pass\n            $runningjob = @{\n                JobName        = 'Waiting for 5 seconds'\n                AvgSec         = 38\n                StartDate      = '30/07/2019 12:17:25'\n                RunningSeconds = 50\n                Diff           = 12\n            }\n            $runningjobpercentage = 50\n            Assert-LongRunningJobs -runningjob $runningjob -runningjobpercentage $runningjobpercentage\n        }\n\n        It \"Should fail when the running job duration is more than the average job duration and the percentage difference is more than the specified\" {\n            # Mock to fail\n            $runningjob = @{\n                JobName        = 'Waiting for 5 seconds'\n                AvgSec         = 38\n                StartDate      = '30/07/2019 12:17:25'\n                RunningSeconds = 78\n                Diff           = 40\n            }\n            $runningjobpercentage = 50\n            {Assert-LongRunningJobs -runningjob $runningjob -runningjobpercentage $runningjobpercentage} | Should -Throw -ExpectedMessage \"Expected the actual value to be less than 50, because The current running job Waiting for 5 seconds has been running for 40 seconds longer than the average run time. This is more than the 50 % specified as the maximum, but got 105\"\n        }\n    }\n    Context \"Checking last run time\"{\n        It \"Should pass when the last job run duration is less than the average job duration\" {\n            # Mock to pass\n            $lastagentjobrun  = @{\n                JobName        = 'Waiting for 5 seconds'\n                AvgSec         = 38\n                Duration       = 25\n                Diff           = -13\n            }\n            $runningjobpercentage = 50\n            Assert-LastJobRun -lastagentjobrun $lastagentjobrun -runningjobpercentage $runningjobpercentage\n        }\n\n        It \"Should pass when the last job run duration is the same as the average job duration\" {\n            # Mock to pass\n            $lastagentjobrun  = @{\n                JobName        = 'Waiting for 5 seconds'\n                AvgSec         = 38\n                Duration       = 38\n                Diff           = 0\n            }\n            $runningjobpercentage = 50\n            Assert-LastJobRun -lastagentjobrun $lastagentjobrun -runningjobpercentage $runningjobpercentage\n        }\n\n        It \"Should pass when the last job run duration is more than the average job duration but the percentage difference is less than the specified\" {\n            # Mock to pass\n            $lastagentjobrun  = @{\n                JobName        = 'Waiting for 5 seconds'\n                AvgSec         = 38\n                Duration       = 48\n                Diff           = 10\n            }\n            $runningjobpercentage = 50\n            Assert-LastJobRun -lastagentjobrun $lastagentjobrun -runningjobpercentage $runningjobpercentage\n        }\n\n        It \"Should fail when the last job run duration is more than the average job duration and the percentage difference is more than the specified\" {\n            # Mock to fail\n            $lastagentjobrun  = @{\n                JobName        = 'Waiting for 5 seconds'\n                AvgSec         = 38\n                Duration       = 68\n                Diff           = 30\n            }\n            $runningjobpercentage = 50\n            {Assert-LastJobRun -lastagentjobrun $lastagentjobrun -runningjobpercentage $runningjobpercentage} | Should -Throw -ExpectedMessage \"Expected the actual value to be less than 50, because The last run of job Waiting for 5 seconds was 68 seconds. This is more than the 50 % specified as the maximum variance, but got 79\"\n        }\n    }\n}\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0s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Mxy6CvCqVcl/JRsIzeUAI77ENcACimQ10ZU+MCoekM96etiLQgrh/d2DKK37REk\n# EVISOtdWAbMnaR0LJklQxBDekSIwW325gL14Y3+UmaZeaT53hrX1xR28YtCRKoUm\n# Z3ERnfgS3FveVS8XPkKNA1YbkZzkmk4RhISinT4urcE7f/mxxDnvwiHra9N0+YSz\n# fKIpJHvLyyqvyatEuR94raYmXeZPZjX2SCCTOfz5VJAGhqzkhHnLbQVZLzpcEExq\n# qtzPMo00dgZOFmeObTxJytfN5EMaBr4XBr4ojbq5ID1FFcgy\n# SIG # End signature block\n"
  },
  {
    "path": "developing/Archive/tests/checks/DatabaseChecks.Tests.ps1",
    "content": "[cmdletbinding()]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingCmdletAliases', '', Justification='stupid implicit aliasing')]\nParam()\n# load all of the assertion functions\n. /../internal/assertions/Database.Assertions.ps1\nDescribe \"Checking Database.Assertions.ps1 assertions\" -Tag UnitTest, Assertions, DatabaseAssertions {\n    Context \"Testing Get-Database\" {\n        It \"Should have a Instance parameter\" {\n            (Get-Command Get-Database).Parameters['Instance'] | Should -Not -BeNullOrEmpty -Because \"We Need to pass the instance in\"\n        }\n        It \"Should have a ExcludedDbs parameter\" {\n            (Get-Command Get-Database).Parameters['ExcludedDbs'] | Should -Not -BeNullOrEmpty -Because \"We need to pass in the Excluded Databases - Don't forget that the ExcludedDatabases parameter is set by default so dont use that\"\n        }\n        It \"Should have a Requiredinfo parameter\" {\n            (Get-Command Get-Database).Parameters['Requiredinfo'] | Should -Not -BeNullOrEmpty -Because \"We want to be able to choose the information we return\"\n        }\n        It \"Should have a Exclusions parameter\" {\n            (Get-Command Get-Database).Parameters['Exclusions'] | Should -Not -BeNullOrEmpty -Because \"We need to be able to excluded databases for various reasons like readonly etc\"\n        }\n        Mock Connect-DbaInstance {\n            [PSCustomObject]@{\n                Databases = @(\n                    [PSCustomObject]@{\n                        Name         = 'Dummy1';\n                        ReadOnly     = $False;\n                        Status       = 'Normal';\n                        IsAccessible = $True;\n                    },\n                    [PSCustomObject]@{\n                        Name         = 'Dummy2';\n                        ReadOnly     = $False;\n                        Status       = 'Normal';\n                        IsAccessible = $false;\n                    }\n                );\n            }\n        }\n        It \"Should return the Database Names with the Requiredinfo switch parameter value Name\" {\n            Get-Database -Instance Dummy -Requiredinfo Name | Should -Be 'Dummy1', 'Dummy2'\n        }\n        It \"Should Exclude Databases that are specified for the Name  Required Info\" {\n            Get-Database -Instance Dummy -Requiredinfo Name -ExcludedDbs Dummy1 | Should -Be 'Dummy2'\n        }\n        It \"Should Exclude none accessible databases if the NotAccessible value for Exclusions parameter is used\" {\n            Get-Database -Instance Dummy -Requiredinfo Name -Exclusions NotAccessible | Should -Be 'Dummy1'\n\n        }\n        It \"Should call the Mocks\" {\n            $assertMockParams = @{\n                'CommandName' = 'Connect-DbaInstance'\n                'Times'       = 3\n                'Exactly'     = $true\n            }\n            Assert-MockCalled @assertMockParams\n        }\n    }\n    Context \"Testing Assert-DatabaseMaxDop \" {\n        ## Mock for Passing\n        Mock Test-DbaMaxDop {\n            @{Database = 'N/A'; DatabaseMaxDop = 'N/A'},\n            @{Database = 'Dummy1'; DatabaseMaxDop = '1'}\n        }\n        @(Test-DbaMaxDop -SqlInstance Dummy).Where{$_.Database -ne 'N/A'}.ForEach{\n            It \"Passes the test successfully\" {\n                Assert-DatabaseMaxDop -MaxDop $PsItem -MaxDopValue 1\n            }\n        }\n        ## Mock for Failing\n        Mock Test-DbaMaxDop {\n            @{Database = 'N/A'; DatabaseMaxDop = 'N/A'},\n            @{Database = 'Dummy1'; DatabaseMaxDop = '5'}\n        }\n        @(Test-DbaMaxDop -SqlInstance Dummy).Where{$_.Database -ne 'N/A'}.ForEach{\n            It \"Fails the test successfully\" {\n                {Assert-DatabaseMaxDop -MaxDop $PsItem -MaxDopValue 4} | Should -Throw -ExpectedMessage \"Expected 4, because We expect the Database MaxDop Value to be the specified value 4, but got '5'.\"\n            }\n        }\n\n        It \"Calls the Mocks successfully\" {\n            $assertMockParams = @{\n                'CommandName' = 'Test-DbaMaxDop'\n                'Times'       = 2\n                'Exactly'     = $true\n            }\n            Assert-MockCalled @assertMockParams\n        }\n    }\n    Context \"Testing Assert-DatabaseStatus \" {\n        #mock for passing\n        Mock Connect-DbaInstance {\n            [PSCustomObject]@{\n                Databases = @(\n                    [PSCustomObject]@{\n                        Name     = 'Dummy1';\n                        ReadOnly = $False;\n                        Status   = 'Normal';\n                    },\n                    [PSCustomObject]@{\n                        Name     = 'Dummy2';\n                        ReadOnly = $False;\n                        Status   = 'Normal';\n                    }\n                );\n            }\n        }\n        It \"It Should Pass when all databases are ok\" {\n            Assert-DatabaseStatus Dummy\n        }\n        # Mock for readonly failing\n        Mock Connect-DbaInstance {\n            [PSCustomObject]@{\n                Databases = @(\n                    [PSCustomObject]@{\n                        Name     = 'Dummy1';\n                        ReadOnly = $False;\n                        Status   = 'Normal';\n                        IsDatabaseSnapshot = $false;\n                    },\n                    [PSCustomObject]@{\n                        Name     = 'Dummy2';\n                        ReadOnly = $True;\n                        Status   = 'Normal';\n                        IsDatabaseSnapshot = $false;\n                    }\n                );\n            }\n        }\n        It \"It Should Fail for a database that is readonly\" {\n            { Assert-DatabaseStatus Dummy} | Should -Throw -ExpectedMessage \"Expected 'True' to not be found in collection @(`$false, `$true), because We expect that there will be no Read-Only databases except for those specified, but it was found.\"\n        }\n        It \"It Should Not Fail for a database that is readonly when it is excluded\" {\n            Assert-DatabaseStatus -Instance Dummy -ExcludeReadOnly 'Dummy2'\n        }\n        It \"It Should Not Fail for a snapshots\" {\n\n            Mock Connect-DbaInstance {\n                [PSCustomObject]@{\n                    Databases = @(\n                        [PSCustomObject]@{\n                            Name     = 'Dummy1';\n                            ReadOnly = $False;\n                            Status   = 'Normal';\n                            IsDatabaseSnapshot = $false;\n                        },\n                        [PSCustomObject]@{\n                            Name     = 'Dummy2';\n                            ReadOnly = $True;\n                            Status   = 'Normal';\n                            IsDatabaseSnapshot = $true;\n                        }\n                    );\n                }\n            }\n            Assert-DatabaseStatus -Instance Dummy\n        }\n        # Mock for offline failing\n        Mock Connect-DbaInstance {\n            [PSCustomObject]@{\n                Databases = @(\n                    [PSCustomObject]@{\n                        Name     = 'Dummy1';\n                        ReadOnly = $False;\n                        Status   = 'Offline, AutoClosed';\n                    },\n                    [PSCustomObject]@{\n                        Name     = 'Dummy2';\n                        ReadOnly = $False;\n                        Status   = 'Normal';\n                    }\n                );\n            }\n        }\n        It \"It Should Fail for a database that is offline\" {\n            { Assert-DatabaseStatus Dummy} | Should -Throw -ExpectedMessage \"Expected regular expression 'Offline' to not match 'Offline, AutoClosed', because We expect that there will be no offline databases except for those specified, but it did match.\"\n        }\n        It \"It Should Not Fail for a database that is offline when it is excluded\" {\n            Assert-DatabaseStatus Dummy -ExcludeOffline 'Dummy1'\n        }\n        # Mock for restoring failing\n        Mock Connect-DbaInstance {\n            [PSCustomObject]@{\n                Databases = @(\n                    [PSCustomObject]@{\n                        Name     = 'Dummy1';\n                        ReadOnly = $False;\n                        Status   = 'Restoring';\n                    },\n                    [PSCustomObject]@{\n                        Name     = 'Dummy2';\n                        ReadOnly = $False;\n                        Status   = 'Normal';\n                    }\n                );\n            }\n        }\n        It \"It Should Fail for a database that is restoring\" {\n            { Assert-DatabaseStatus Dummy} | Should -Throw -ExpectedMessage \"Expected regular expression 'Restoring' to not match 'Restoring', because We expect that there will be no databases in a restoring state except for those specified, but it did match.\"\n        }\n        It \"It Should Not Fail for a database that is restoring when it is excluded\" {\n            Assert-DatabaseStatus Dummy -ExcludeRestoring 'Dummy1'\n        }\n        # Mock for recovery failing\n        Mock Connect-DbaInstance {\n            [PSCustomObject]@{\n                Databases = @(\n                    [PSCustomObject]@{\n                        Name     = 'Dummy1';\n                        ReadOnly = $False;\n                        Status   = 'Recovering';\n                    },\n                    [PSCustomObject]@{\n                        Name     = 'Dummy2';\n                        ReadOnly = $False;\n                        Status   = 'Normal';\n                    }\n                );\n            }\n        }\n        It \"It Should Fail for a database that is Recovering\" {\n            { Assert-DatabaseStatus Dummy} | Should -Throw -ExpectedMessage \"Expected regular expression 'Recover' to not match 'Recovering', because We expect that there will be no databases going through the recovery process or in a recovery pending state, but it did match.\"\n        }\n        # Mock for recovery pending failing\n        Mock Connect-DbaInstance {\n            [PSCustomObject]@{\n                Databases = @(\n                    [PSCustomObject]@{\n                        Name     = 'Dummy1';\n                        ReadOnly = $False;\n                        Status   = 'RecoveryPending';\n                    },\n                    [PSCustomObject]@{\n                        Name     = 'Dummy2';\n                        ReadOnly = $False;\n                        Status   = 'Normal';\n                    }\n                );\n            }\n        }\n        It \"It Should Fail for a database that is Recovery pending\" {\n            { Assert-DatabaseStatus Dummy} | Should -Throw -ExpectedMessage \"Expected regular expression 'Recover' to not match 'RecoveryPending', because We expect that there will be no databases going through the recovery process or in a recovery pending state, but it did match.\"\n        }\n        # Mock for autoclosed failing\n        Mock Connect-DbaInstance {\n            [PSCustomObject]@{\n                Databases = @(\n                    [PSCustomObject]@{\n                        Name     = 'Dummy1';\n                        ReadOnly = $False;\n                        Status   = 'AutoClosed';\n                    },\n                    [PSCustomObject]@{\n                        Name     = 'Dummy2';\n                        ReadOnly = $False;\n                        Status   = 'Normal';\n                    }\n                );\n            }\n        }\n        It \"It Should Fail for a database that is AutoClosed\" {\n            { Assert-DatabaseStatus Dummy} | Should -Throw -ExpectedMessage \"Expected regular expression 'AutoClosed' to not match 'AutoClosed', because We expect that there will be no databases that have been auto closed, but it did match.\"\n        }\n\n        # Mock for EmergencyMode failing\n        Mock Connect-DbaInstance {\n            [PSCustomObject]@{\n                Databases = @(\n                    [PSCustomObject]@{\n                        Name     = 'Dummy1';\n                        ReadOnly = $False;\n                        Status   = 'EmergencyMode';\n                    },\n                    [PSCustomObject]@{\n                        Name     = 'Dummy2';\n                        ReadOnly = $False;\n                        Status   = 'Normal';\n                    }\n                );\n            }\n        }\n        It \"It Should Fail for a database that is EmergencyMode\" {\n            { Assert-DatabaseStatus Dummy} | Should -Throw -ExpectedMessage \"Expected regular expression 'Emergency' to not match 'EmergencyMode', because We expect that there will be no databases in EmergencyMode, but it did match.\"\n        }\n\n        # Mock for Suspect failing\n        Mock Connect-DbaInstance {\n            [PSCustomObject]@{\n                Databases = @(\n                    [PSCustomObject]@{\n                        Name     = 'Dummy1';\n                        ReadOnly = $False;\n                        Status   = 'Suspect';\n                    },\n                    [PSCustomObject]@{\n                        Name     = 'Dummy2';\n                        ReadOnly = $False;\n                        Status   = 'Normal';\n                    }\n                );\n            }\n        }\n        It \"It Should Fail for a database that is Suspect\" {\n            { Assert-DatabaseStatus Dummy} | Should -Throw -ExpectedMessage \"Expected regular expression 'Suspect' to not match 'Suspect', because We expect that there will be no databases in a Suspect state, but it did match.\"\n        }\n\n        # Mock for Standby failing\n        Mock Connect-DbaInstance {\n            [PSCustomObject]@{\n                Databases = @(\n                    [PSCustomObject]@{\n                        Name     = 'Dummy1';\n                        ReadOnly = $False;\n                        Status   = 'Standby';\n                    },\n                    [PSCustomObject]@{\n                        Name     = 'Dummy2';\n                        ReadOnly = $False;\n                        Status   = 'Normal';\n                    }\n                );\n            }\n        }\n        It \"It Should Fail for a database that is Standby\" {\n            { Assert-DatabaseStatus Dummy} | Should -Throw -ExpectedMessage \"Expected regular expression 'Standby' to not match 'Standby', because We expect that there will be no databases in Standby, but it did match.\"\n        }\n\n        It \"Should Not Fail for databases that are excluded\" {\n            Assert-DatabaseStatus Dummy -Excludedbs 'Dummy1'\n        }\n        It \"Should call the Mocks successfully\" {\n            $assertMockParams = @{\n                'CommandName' = 'Connect-DbaInstance'\n                'Times'       = 15\n                'Exactly'     = $true\n            }\n            Assert-MockCalled @assertMockParams\n        }\n    }\n    Context \"Testing Assert-DatabaseDuplicateIndex\" {\n        #Mock for passing\n        Mock Find-DbaDbDuplicateIndex {}\n        It \"Should pass when there are no Duplicate Indexes\" {\n            Assert-DatabaseDuplicateIndex -Instance Dummy -Database Dummy1\n        }\n        # Mock for failing for 1 index\n        Mock Find-DbaDbDuplicateIndex {\n            [PSCustomObject]@{\n                DatabaseName           = \"msdb\"\n                TableName              = \"dbo.log_shipping_primary_databases\"\n                IndexName              = \"UQ__log_ship__2A5EF6DCB9BFAE2F\"\n                KeyColumns             = \"primary_database ASC\"\n                IncludedColumns        = \"\"\n                IndexType              = \"NONCLUSTERED\"\n                IndexSizeMB            = \"0.000000\"\n                CompressionDescription = \"NONE\"\n                RowCount               = \"0\"\n                IsDisabled             = \"False\"\n                IsFiltered             = \"False\"\n            }\n        }\n        It \"Should fail for one duplicate index\" {\n            {Assert-DatabaseDuplicateIndex -Instance Dummy -Database Dummy1 } | Should -Throw -ExpectedMessage 'Expected 0, because Duplicate indexes waste disk space and cost you extra IO, CPU, and Memory - Use Find-DbaDbDuplicateIndex to find them, but got 1.'\n        }\n        #Mock for failing for 2 indexes\n        Mock Find-DbaDbDuplicateIndex {\n            @([PSCustomObject]@{\n                    DatabaseName           = \"msdb\"\n                    TableName              = \"dbo.log_shipping_primary_databases\"\n                    IndexName              = \"UQ__log_ship__2A5EF6DCB9BFAE2F\"\n                    KeyColumns             = \"primary_database ASC\"\n                    IncludedColumns        = \"\"\n                    IndexType              = \"NONCLUSTERED\"\n                    IndexSizeMB            = \"0.000000\"\n                    CompressionDescription = \"NONE\"\n                    RowCount               = \"0\"\n                    IsDisabled             = \"False\"\n                    IsFiltered             = \"False\"\n                },\n                [PSCustomObject]@{\n                    DatabaseName           = \"msdb\"\n                    TableName              = \"dbo.log_shipping_primary_databases\"\n                    IndexName              = \"UQ__log_ship__2A5EF6DCB9BFAE2F\"\n                    KeyColumns             = \"primary_database ASC\"\n                    IncludedColumns        = \"\"\n                    IndexType              = \"NONCLUSTERED\"\n                    IndexSizeMB            = \"0.000000\"\n                    CompressionDescription = \"NONE\"\n                    RowCount               = \"0\"\n                    IsDisabled             = \"False\"\n                    IsFiltered             = \"False\"\n                }\n            )\n        }\n\n        It \"Should fail for more than one duplicate index\" {\n            {Assert-DatabaseDuplicateIndex -Instance Dummy -Database Dummy1 } | Should -Throw -ExpectedMessage 'Expected 0, because Duplicate indexes waste disk space and cost you extra IO, CPU, and Memory - Use Find-DbaDbDuplicateIndex to find them, but got 2.'\n        }\n    }\n    Context \"Testing Assert-DatabaseExists\" {\n        It \"Should have a Instance parameter\" {\n            (Get-Command Assert-DatabaseExists).Parameters['Instance'] | Should -Not -BeNullOrEmpty -Because \"We Need to pass the instance in\"\n        }\n        It \"Should have a ExpectedDB parameter\" {\n            (Get-Command Assert-DatabaseExists).Parameters['ExpectedDB'] | Should -Not -BeNullOrEmpty -Because \"We Need to pass the Expected DB in\"\n        }\n\n        # Mock for Passing\n        Mock Get-Database {\n             @('Expected1','Expected2','Expected3','Expected4')\n        }\n        @('Expected1', 'Expected2', 'Expected3', 'Expected4').ForEach{\n            It \"Should Pass when the database exists\" {\n                Assert-DatabaseExists -Instance Instance -ExpectedDb $psitem\n            }\n        }\n\n        It \"Should Fail when the database does not exist\" {\n            {Assert-DatabaseExists -Instance Instance -ExpectedDb NotThere} | Should -Throw -ExpectedMessage \"We expect NotThere to be on Instance\"\n        }\n    }\n}\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUPgcaRfnImNd3g22AxhoOTA7s\n# s/2gggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz\n# c3VyZWQgSUQgQ29kZSBTaWduaW5nIENBMB4XDTE3MDUwOTAwMDAwMFoXDTIwMDUx\n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7j9xjmMOE0ut119EefM2FAaK95xGTlz/kLEbBw6RFfu6r7VRwo0k\n# riTGxycqoSkoGjpxKAI8LpGjwCUR4pwUR6F6aGivm6dcIFzZcbEMj7uo+MUSaJ/P\n# QMtARKUT8OZkDCUIQjKyNookAv4vcn4c10lFluhZHen6dGRrsutmQ9qzsIzV6Q3d\n# 9gEgzpkxYz0IGhizgZtPxpMQBvwHgfqL2vmCSfdibqFT+hKUGIUukpHqaGxEMrJm\n# oecYpJpkUe8xggIoMIICJAIBATCBhjByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMM\n# RGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQD\n# EyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgQ29kZSBTaWduaW5nIENBAhACwXUo\n# dNXChDGFKtigZGnKMAkGBSsOAwIaBQCgeDAYBgorBgEEAYI3AgEMMQowCKACgACh\n# AoAAMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcCAQsxDjAM\n# BgorBgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBQvONhty9MasvcoHTA4QqQhp6X4\n# WDANBgkqhkiG9w0BAQEFAASCAQAFBW2/JsbUG6TudyVtS3mAXLNSNfCSpWM17WrG\n# q0SndYWvx8xeduvDlH3Zv1tmHzhX6TM2uVOG2UXGP7Q91T4KH082bkDYEMZPcDA7\n# NwmDZl6GF60zH3uIajno0xHXALZAiCWW/jvWpkb4fseed0k3WWZKl3st2L+Sa9Yw\n# X0+/1gcPJoqXLKujEM4yl5zyz2hh/0k8Di7MTSiifD47wpUwfuttJAprDybX52eV\n# pTbO0iEE8BLgkkK6CsvYY4c3DrlXTKalKEPdzKUGIAVh9TmFFrrE5wXu7BD90qqE\n# 2paTerM1+6VRveN01QC9xltlfijUxMDh/jXJ/jnztcJvyDG1\n# SIG # End signature block\n"
  },
  {
    "path": "developing/Archive/tests/checks/InstanceChecks.Tests.ps1",
    "content": "# load all of the assertion functions\n(Get-ChildItem $PSScriptRoot/../../internal/assertions/).ForEach{ . $Psitem.FullName }\n\nDescribe \"Checking Instance.Tests.ps1 checks\" -Tag UnitTest {\n    Context \"Checking Backup Compression\" {\n        # Mock the version check for running tests\n        Mock Connect-DbaInstance { @{Version = @{Major = 14 } } }\n        # Define test cases for the results to fail test and fill expected message\n        # So the results of SPConfigure is 1, we expect $false but the result is true and the results of SPConfigure is 0, we expect $true but the result is false\n        $TestCases = @{spconfig = 1; expected = $false; actual = $true }, @{spconfig = 0; expected = $true; actual = $false }\n        It \"Fails Check Correctly for Config <spconfig> and expected value <expected>\" -TestCases $TestCases {\n            Param($spconfig, $actual, $expected)\n            Mock Get-DbaSpConfigure { @{\"ConfiguredValue\" = $spconfig } }\n            { Assert-BackupCompression -Instance 'Dummy' -defaultbackupcompression $expected } | Should -Throw -ExpectedMessage \"Expected `$$expected, because The default backup compression should be set correctly, but got `$$actual\"\n        }\n        $TestCases = @{spconfig = 0; expected = $false }, @{spconfig = 1; expected = $true; }\n        It \"Passes Check Correctly for Config <spconfig> and expected value <expected>\" -TestCases $TestCases {\n            Param($spconfig, $expected)\n            Mock Get-DbaSpConfigure { @{\"ConfiguredValue\" = $spconfig } }\n            Assert-BackupCompression -Instance 'Dummy' -defaultbackupcompression $expected\n        }\n        # Validate we have called the mock the correct number of times\n        It \"Should call the mocks\" {\n            $assertMockParams = @{\n                'CommandName' = 'Get-DbaSpConfigure'\n                'Times'       = 4\n                'Exactly'     = $true\n            }\n            Assert-MockCalled @assertMockParams\n        }\n        <#\n\t\t\t\tIt \"Should not run for SQL 2005 and below\"{\n\t\t\t\t\t# Mock Get-Version\n\t\t\t\t\tfunction Get-Version {}\n\t\t\t\t\tMock Get-Version {9}\n\t\t\t\t# Mock the version check for not running the tests\n\t\t\t\tMock Get-DbaSpConfigure {@{\"ConfiguredValue\" = 1}}\n\t\t\t\t$Pester = Invoke-DbcCheck -SQLInstance Dummy -Check DefaultBackupCompression -PassThru -Show None\n\t\t\t   # $Pester.TotalCount | Should -Be 1\n\t\t\t   # $Pester.SkippedCount | Should -Be 1\n\t\t\t\t$assertMockParams = @{\n\t\t\t\t\t'CommandName' = 'Get-Version'\n\t\t\t\t\t'Times'\t\t  = 1\n\t\t\t\t\t'Exactly'\t  = $true\n\t\t\t\t\t}\n\t\t\t\t\tAssert-MockCalled @assertMockParams\n\t\t\t}\n\t\t#>\n\n    }\n    Context \"Checking Instance MaxDop\" {\n        # if Userecommended it should pass if CurrentInstanceMaxDop property returned from Test-DbaMaxDop matches the RecommendedMaxDop property\n        It \"Passes Check Correctly with the use recommended parameter set to true\" {\n            # Mock to pass\n            Mock Test-DbaMaxDop { @{\"CurrentInstanceMaxDop\" = 0; \"RecommendedMaxDop\" = 0 } }\n            Assert-InstanceMaxDop  -Instance 'Dummy' -UseRecommended\n        }\n        # if Userecommended it should fail if CurrentInstanceMaxDop property returned from Test-DbaMaxDop does not match the RecommendedMaxDop property\n        It \"Fails Check Correctly with the use recommended parameter set to true\" {\n            # Mock to fail\n            Mock Test-DbaMaxDop { @{\"CurrentInstanceMaxDop\" = 0; \"RecommendedMaxDop\" = 5 } }\n            { Assert-InstanceMaxDop -Instance 'Dummy' -UseRecommended } | Should -Throw -ExpectedMessage \"Expected 5, because We expect the MaxDop Setting to be the recommended value 5\"\n        }\n        $TestCases = @{\"MaxDopValue\" = 5 }\n        # if not UseRecommended - it should pass if the CurrentInstanceMaxDop property returned from Test-DbaMaxDop matches the MaxDopValue parameter\n        It \"Passes Check Correctly with a specified value <MaxDopValue>\" -TestCases $TestCases {\n            Param($MaxDopValue)\n            # Mock to pass\n            Mock Test-DbaMaxDop { @{\"CurrentInstanceMaxDop\" = 5; \"RecommendedMaxDop\" = $MaxDopValue } }\n            Assert-InstanceMaxDop -Instance 'Dummy' -MaxDopValue $MaxDopValue\n        }\n        $TestCases = @{\"MaxDopValue\" = 5 }, @{\"MaxDopValue\" = 0 }\n        # if not UseRecommended - it should fail if the CurrentInstanceMaxDop property returned from Test-DbaMaxDop does not match the MaxDopValue parameter\n        It \"Fails Check Correctly with with a specified value <MaxDopValue>\" -TestCases $TestCases {\n            Param($MaxDopValue)\n            # Mock to fail\n            Mock Test-DbaMaxDop { @{\"CurrentInstanceMaxDop\" = 4; \"RecommendedMaxDop\" = 73 } }\n            { Assert-InstanceMaxDop -Instance 'Dummy' -MaxDopValue $MaxDopValue } | Should -Throw -ExpectedMessage \"Expected $MaxDopValue, because We expect the MaxDop Setting to be $MaxDopValue\"\n        }\n        # Validate we have called the mock the correct number of times\n        It \"Should call the mocks\" {\n            $assertMockParams = @{\n                'CommandName' = 'Test-DbaMaxDop'\n                'Times'       = 5\n                'Exactly'     = $true\n            }\n            Assert-MockCalled @assertMockParams\n        }\n    }\n    Context \"Checking tempdb size\" {\n        Mock Get-DbaDbFile { @(\n                [PSCustomObject]@{\n                    Type = 0\n                    Size = [PSCustomObject]@{\n                        Megabyte = 8\n                    }\n                },\n                [PSCustomObject]@{\n                    Type = 0\n                    Size = [PSCustomObject]@{\n                        Megabyte = 8\n                    }\n                },\n                [PSCustomObject]@{\n                    Type = 0\n                    Size = [PSCustomObject]@{\n                        Megabyte = 8\n                    }\n                },\n                [PSCustomObject]@{\n                    Type = 0\n                    Size = [PSCustomObject]@{\n                        Megabyte = 8\n                    }\n                }\n            ) }\n\n        It \"Should pass the test when all tempdb files are the same size\" {\n            Assert-TempDBSize -Instance Dummy\n        }\n\n        Mock Get-DbaDbFile { @(\n                [PSCustomObject]@{\n                    Type = 0\n                    Size = [PSCustomObject]@{\n                        Megabyte = 8\n                    }\n                },\n                [PSCustomObject]@{\n                    Type = 0\n                    Size = [PSCustomObject]@{\n                        Megabyte = 6\n                    }\n                },\n                [PSCustomObject]@{\n                    Type = 0\n                    Size = [PSCustomObject]@{\n                        Megabyte = 8\n                    }\n                },\n                [PSCustomObject]@{\n                    Type = 0\n                    Size = [PSCustomObject]@{\n                        Megabyte = 7\n                    }\n                }\n            ) }\n\n        It \"Should fail when all of the tempdb files are not the same size\" {\n            { Assert-TempDBSize -Instance Dummy } | Should -Throw -ExpectedMessage \"We want all the tempdb data files to be the same size - See https://blogs.sentryone.com/aaronbertrand/sql-server-2016-tempdb-fixes/ and https://www.brentozar.com/blitz/tempdb-data-files/ for more information\"\n        }\n    }\n    Context \"Checking Supported Build\" {\n        [DateTime]$Date = Get-Date -Format O\n\n        $TestCases = @{\"Date\" = $Date; \"BuildBehind\" = \"1SP\"; },\n        @{\"Date\" = $Date; \"BuildBehind\" = \"1CU\"; }\n        #if BuildBehind it should pass if build is >= SP/CU specified & Support Dates are valid\n        It \"Passed check correctly when the current build is not behind the BuildBehind value of <BuildBehind>\" -TestCases $TestCases {\n            Param($BuildBehind, $Date)\n            #Mock to pass\n            Mock Test-DbaBuild { @{\"SPLevel\" = \"{SP4, LATEST}\"; \"CULevel\" = \"CU4\"; \"Compliant\" = $true; \"SupportedUntil\" = $Date.AddMonths(1) } }\n            Assert-InstanceSupportedBuild -Instance 'Dummy' -BuildBehind $BuildBehind -Date $Date\n        }\n        $TestCases = @{\"Date\" = $Date; \"BuildBehind\" = \"1SP\"; \"BuildWarning\" = 6; \"expected\" = $true; \"actual\" = $false },\n        @{\"Date\" = $Date; \"BuildBehind\" = \"1CU\"; \"BuildWarning\" = 6; \"expected\" = $true; \"actual\" = $false }\n        #if BuildBehind it should fail if build is <= SP/CU specified & Support dates are valid\n        It \"Failed check correctly when the current build is behind the BuildBehind value of <BuildBehind>\" -TestCases $TestCases {\n            Param($BuildBehind, $Date, $expected, $actual)\n            #Mock to fail\n            Mock Test-DbaBuild { @{\"SPLevel\" = \"{SP2}\"; \"CULevel\" = \"CU2\"; \"SPTarget\" = \"SP4\"; \"CUTarget\" = \"CU4\"; \"Compliant\" = $false; \"SupportedUntil\" = $Date.AddMonths(1); \"Build\" = 42 } }\n            { Assert-InstanceSupportedBuild -Instance 'Dummy' -BuildBehind $BuildBehind -Date $Date } | Should -Throw -ExpectedMessage \"Expected `$$expected, because this build 42 should not be behind the required build, but got `$$actual\"\n        }\n        $TestCases = @{\"Date\" = $Date }\n        #if neither BuildBehind nor BuildWarning it should pass if support dates are valid\n        It \"Passed check correctly with a SupportedUntil date > today\" -TestCases $TestCases {\n            Param($Date)\n            #Mock to pass\n            Mock Test-DbaBuild { @{\"SupportedUntil\" = $Date.AddMonths(1) } }\n            Assert-InstanceSupportedBuild -Instance 'Dummy' -Date $Date\n        }\n        $TestCases = @{\"Date\" = $Date }\n        #if neither BuildBehind nor BuildWarning it should fail if support date is out of the support window\n        It \"Failed check correctly with a SupportedUntil date < today\" -TestCases $TestCases {\n            Param($Date)\n            #Mock to fail\n            Mock Test-DbaBuild { @{\"SupportedUntil\" = $Date.AddMonths(-1); \"Build\" = 42 } }\n            $SupportedUntil = Get-Date $Date.AddMonths(-1) -Format O\n            $Date = Get-Date $Date -Format O\n            { Assert-InstanceSupportedBuild -Instance 'Dummy' -Date $Date } | Should -Throw -ExpectedMessage \"Expected the actual value to be greater than $Date, because this build 42 is now unsupported by Microsoft, but got $SupportedUntil\"\n        }\n        $TestCases = @{\"Date\" = $Date; \"BuildWarning\" = 6 }\n        #if BuildWarning it should fail if support date is in the warning window\n        It \"Passed check correctly with the BuildWarning window > today\" -TestCases $TestCases {\n            Param($Date, $BuildWarning)\n            #Mock to pass\n            Mock Test-DbaBuild { @{\"SupportedUntil\" = $Date.AddMonths(9); \"Build\" = 42 } }\n            { Assert-InstanceSupportedBuild -Instance 'Dummy' -Date $Date -BuildWarning $BuildWarning }\n        }\n        $TestCases = @{\"Date\" = $Date; \"BuildWarning\" = 6 }\n        #if BuildWarning it should fail if support date is in the warning window\n        It \"Failed check correctly with the BuildWarning window < today\" -TestCases $TestCases {\n            Param($Date, $BuildWarning)\n            #Mock to fail\n            Mock Test-DbaBuild { @{\"SupportedUntil\" = $Date.AddMonths(3); \"Build\" = 42 } }\n            $SupportedUntil = Get-Date $Date.AddMonths(3) -Format O\n            $expected = Get-Date $Date.AddMonths($BuildWarning) -Format O\n            { Assert-InstanceSupportedBuild -Instance 'Dummy' -Date $Date -BuildWarning $BuildWarning } | Should -Throw -ExpectedMessage \"Expected the actual value to be greater than $expected, because this build 42 will be unsupported by Microsoft on $SupportedUntil which is less than $BuildWarning months away, but got $SupportedUntil\"\n        }\n\n    }\n    Context \"Checking Trace Flags\" {\n        ## Mock for one trace flag\n        Mock Get-DbaTraceFlag {\n\n            [PSObject]@{\n                'ComputerName' = 'ComputerName'\n                'Global'       = 1\n                'InstanceName' = 'MSSQLSERVER'\n                'Session'      = 0\n                'SqlInstance'  = 'SQLInstance'\n                'Status'       = 1\n                'TraceFlag'    = 118\n            }\n        }\n        It \"Should pass correctly when the trace flag exists and it is the only one\" {\n            Assert-TraceFlag -SQLInstance Dummy -ExpectedTraceFlag 118\n        }\n        It \"Should fail correctly when the trace flag does not exist but there is a different trace flag\" {\n            { Assert-TraceFlag -SQLInstance Dummy -ExpectedTraceFlag 117 } | Should -Throw -ExpectedMessage  \"Expected 117 to be found in collection 118, because We expect that Trace Flag 117 will be set on Dummy, but it was not found.\"\n        }\n        It \"Should fail correctly when the trace flag does not exist and there is no trace flag\" {\n            Mock Get-DbaTraceFlag {\n\n                [PSObject]@{\n                    'ComputerName' = 'ComputerName'\n                    'Global'       = 1\n                    'InstanceName' = 'MSSQLSERVER'\n                    'Session'      = 0\n                    'SqlInstance'  = 'SQLInstance'\n                    'Status'       = 1\n                    'TraceFlag'    = 118\n                }\n            }\n            { Assert-TraceFlag -SQLInstance Dummy -ExpectedTraceFlag 117 } | Should -Throw -ExpectedMessage  \"Expected 117 to be found in collection 118, because We expect that Trace Flag 117 will be set on Dummy, but it was not found.\"\n        }\n        It \"Should Pass Correctly for more than one trace flag when they all exist\" {\n            Mock Get-DbaTraceFlag {\n                [PSObject]@{\n                    'ComputerName' = 'ComputerName'\n                    'Global'       = 1\n                    'InstanceName' = 'MSSQLSERVER'\n                    'Session'      = 0\n                    'SqlInstance'  = 'SQLInstance'\n                    'Status'       = 1\n                    'TraceFlag'    = 117\n                },\n                [PSObject]@{\n                    'ComputerName' = 'ComputerName'\n                    'Global'       = 1\n                    'InstanceName' = 'MSSQLSERVER'\n                    'Session'      = 0\n                    'SqlInstance'  = 'SQLInstance'\n                    'Status'       = 1\n                    'TraceFlag'    = 118\n                },\n                [PSObject]@{\n                    'ComputerName' = 'ComputerName'\n                    'Global'       = 1\n                    'InstanceName' = 'MSSQLSERVER'\n                    'Session'      = 0\n                    'SqlInstance'  = 'SQLInstance'\n                    'Status'       = 1\n                    'TraceFlag'    = 3604\n                },\n                [PSObject]@{\n                    'ComputerName' = 'ComputerName'\n                    'Global'       = 1\n                    'InstanceName' = 'MSSQLSERVER'\n                    'Session'      = 0\n                    'SqlInstance'  = 'SQLInstance'\n                    'Status'       = 1\n                    'TraceFlag'    = 3605\n                }\n            }\n            Assert-TraceFlag -SQLInstance Dummy -ExpectedTraceFlag 118, 117, 3604, 3605\n        }\n        It \"Should Pass Correctly for more than one trace flag when they exist but there are extra trace flags\" {\n            Mock Get-DbaTraceFlag {\n                [PSObject]@{\n                    'ComputerName' = 'ComputerName'\n                    'Global'       = 1\n                    'InstanceName' = 'MSSQLSERVER'\n                    'Session'      = 0\n                    'SqlInstance'  = 'SQLInstance'\n                    'Status'       = 1\n                    'TraceFlag'    = 117\n                },\n                [PSObject]@{\n                    'ComputerName' = 'ComputerName'\n                    'Global'       = 1\n                    'InstanceName' = 'MSSQLSERVER'\n                    'Session'      = 0\n                    'SqlInstance'  = 'SQLInstance'\n                    'Status'       = 1\n                    'TraceFlag'    = 118\n                },\n                [PSObject]@{\n                    'ComputerName' = 'ComputerName'\n                    'Global'       = 1\n                    'InstanceName' = 'MSSQLSERVER'\n                    'Session'      = 0\n                    'SqlInstance'  = 'SQLInstance'\n                    'Status'       = 1\n                    'TraceFlag'    = 3604\n                },\n                [PSObject]@{\n                    'ComputerName' = 'ComputerName'\n                    'Global'       = 1\n                    'InstanceName' = 'MSSQLSERVER'\n                    'Session'      = 0\n                    'SqlInstance'  = 'SQLInstance'\n                    'Status'       = 1\n                    'TraceFlag'    = 3605\n                }\n            }\n            Assert-TraceFlag -SQLInstance Dummy -ExpectedTraceFlag 118, 117, 3604\n        }\n        It \"Should Fail Correctly when checking more than one trace flag when 1 is missing\" {\n            Mock Get-DbaTraceFlag {\n                [PSObject]@{\n                    'ComputerName' = 'ComputerName'\n                    'Global'       = 1\n                    'InstanceName' = 'MSSQLSERVER'\n                    'Session'      = 0\n                    'SqlInstance'  = 'SQLInstance'\n                    'Status'       = 1\n                    'TraceFlag'    = 117\n                },\n                [PSObject]@{\n                    'ComputerName' = 'ComputerName'\n                    'Global'       = 1\n                    'InstanceName' = 'MSSQLSERVER'\n                    'Session'      = 0\n                    'SqlInstance'  = 'SQLInstance'\n                    'Status'       = 1\n                    'TraceFlag'    = 118\n                },\n                [PSObject]@{\n                    'ComputerName' = 'ComputerName'\n                    'Global'       = 1\n                    'InstanceName' = 'MSSQLSERVER'\n                    'Session'      = 0\n                    'SqlInstance'  = 'SQLInstance'\n                    'Status'       = 1\n                    'TraceFlag'    = 3604\n                }\n            }\n            { Assert-TraceFlag -SQLInstance Dummy -ExpectedTraceFlag 118, 117, 3604, 3605 } | Should -Throw -ExpectedMessage \"Expected 3605 to be found in collection @(117, 118, 3604), because We expect that Trace Flag 3605 will be set on Dummy, but it was not found.\"\n        }\n        It \"Should Fail Correctly when checking more than one trace flag when 2 are missing\" {\n            Mock Get-DbaTraceFlag {\n                [PSObject]@{\n                    'ComputerName' = 'ComputerName'\n                    'Global'       = 1\n                    'InstanceName' = 'MSSQLSERVER'\n                    'Session'      = 0\n                    'SqlInstance'  = 'SQLInstance'\n                    'Status'       = 1\n                    'TraceFlag'    = 117\n                },\n                [PSObject]@{\n                    'ComputerName' = 'ComputerName'\n                    'Global'       = 1\n                    'InstanceName' = 'MSSQLSERVER'\n                    'Session'      = 0\n                    'SqlInstance'  = 'SQLInstance'\n                    'Status'       = 1\n                    'TraceFlag'    = 118\n                }\n            }\n            { Assert-TraceFlag -SQLInstance Dummy -ExpectedTraceFlag 118, 117, 3604, 3605 } | Should -Throw -ExpectedMessage \"Expected 3604 to be found in collection @(117, 118), because We expect that Trace Flag 3604 will be set on Dummy, but it was not found\"\n        }\n        It \"Should pass correctly when no trace flag exists and none expected\" {\n            Mock Get-DbaTraceFlag {\n            }\n            Assert-TraceFlag -SQLInstance Dummy -ExpectedTraceFlag $null\n        }\n        It \"Should fail correctly when a trace flag exists and none expected\" {\n            Mock Get-DbaTraceFlag {\n                [PSObject]@{\n                    'ComputerName' = 'ComputerName'\n                    'Global'       = 1\n                    'InstanceName' = 'MSSQLSERVER'\n                    'Session'      = 0\n                    'SqlInstance'  = 'SQLInstance'\n                    'Status'       = 1\n                    'TraceFlag'    = 117\n                }\n            }\n            { Assert-TraceFlag -SQLInstance Dummy -ExpectedTraceFlag $null } | Should -Throw -ExpectedMessage \"Expected `$null or empty, because We expect that there will be no Trace Flags set on Dummy, but got 117\"\n        }\n    }\n    Context \"Checking Trace Flags Not Expected\" {\n        ## Mock for one trace flag\n        Mock Get-DbaTraceFlag {\n            [PSObject]@{\n                'ComputerName' = 'ComputerName'\n                'Global'       = 1\n                'InstanceName' = 'MSSQLSERVER'\n                'Session'      = 0\n                'SqlInstance'  = 'SQLInstance'\n                'Status'       = 1\n                'TraceFlag'    = 118\n            }\n        }\n        It \"Should pass correctly when the trace flag exists and it is not the one expected to be running\" {\n            Assert-NotTraceFlag -SQLInstance Dummy -NotExpectedTraceFlag 117\n        }\n        It \"Should pass correctly when no trace flag is running\" {\n            Mock Get-DbaTraceFlag { }\n            Assert-NotTraceFlag -SQLInstance Dummy -NotExpectedTraceFlag 117\n        }\n        It \"Should fail correctly when the trace flag is running and is the only one\" {\n            Mock Get-DbaTraceFlag {\n                [PSObject]@{\n                    'ComputerName' = 'ComputerName'\n                    'Global'       = 1\n                    'InstanceName' = 'MSSQLSERVER'\n                    'Session'      = 0\n                    'SqlInstance'  = 'SQLInstance'\n                    'Status'       = 1\n                    'TraceFlag'    = 118\n                }\n            }\n            { Assert-NotTraceFlag -SQLInstance Dummy -NotExpectedTraceFlag 118 } | Should -Throw -ExpectedMessage \"Expected 118 to not be found in collection 118, because We expect that Trace Flag 118 will not be set on Dummy, but it was found.\"\n        }\n        It \"Should fail correctly for one trace flag when the trace flag is running but there is another one running as well\" {\n            Mock Get-DbaTraceFlag {\n                [PSObject]@{\n                    'ComputerName' = 'ComputerName'\n                    'Global'       = 1\n                    'InstanceName' = 'MSSQLSERVER'\n                    'Session'      = 0\n                    'SqlInstance'  = 'SQLInstance'\n                    'Status'       = 1\n                    'TraceFlag'    = 117\n                },\n                [PSObject]@{\n                    'ComputerName' = 'ComputerName'\n                    'Global'       = 1\n                    'InstanceName' = 'MSSQLSERVER'\n                    'Session'      = 0\n                    'SqlInstance'  = 'SQLInstance'\n                    'Status'       = 1\n                    'TraceFlag'    = 118\n                }\n            }\n            { Assert-NotTraceFlag -SQLInstance Dummy -NotExpectedTraceFlag 117 } | Should -Throw -ExpectedMessage  \"Expected 117 to not be found in collection @(117, 118), because We expect that Trace Flag 117 will not be set on Dummy, but it was found.\"\n        }\n        It \"Should Pass Correctly for more than one trace flag when no trace flag is set\" {\n            Mock Get-DbaTraceFlag { }\n            Assert-NotTraceFlag -SQLInstance Dummy -NotExpectedTraceFlag 118, 117, 3604, 3605\n        }\n        It \"Should Pass Correctly for more than one trace flag when a different one is running\" {\n            Mock Get-DbaTraceFlag {\n                [PSObject]@{\n                    'ComputerName' = 'ComputerName'\n                    'Global'       = 1\n                    'InstanceName' = 'MSSQLSERVER'\n                    'Session'      = 0\n                    'SqlInstance'  = 'SQLInstance'\n                    'Status'       = 1\n                    'TraceFlag'    = 117\n                },\n                [PSObject]@{\n                    'ComputerName' = 'ComputerName'\n                    'Global'       = 1\n                    'InstanceName' = 'MSSQLSERVER'\n                    'Session'      = 0\n                    'SqlInstance'  = 'SQLInstance'\n                    'Status'       = 1\n                    'TraceFlag'    = 118\n                }\n            }\n            Assert-NotTraceFlag -SQLInstance Dummy -NotExpectedTraceFlag  3604, 3605\n        }\n        It \"Should Fail Correctly for more than one trace flag when one is running\" {\n            Mock Get-DbaTraceFlag {\n                [PSObject]@{\n                    'ComputerName' = 'ComputerName'\n                    'Global'       = 1\n                    'InstanceName' = 'MSSQLSERVER'\n                    'Session'      = 0\n                    'SqlInstance'  = 'SQLInstance'\n                    'Status'       = 1\n                    'TraceFlag'    = 117\n                },\n                [PSObject]@{\n                    'ComputerName' = 'ComputerName'\n                    'Global'       = 1\n                    'InstanceName' = 'MSSQLSERVER'\n                    'Session'      = 0\n                    'SqlInstance'  = 'SQLInstance'\n                    'Status'       = 1\n                    'TraceFlag'    = 118\n                }\n            }\n            { Assert-NotTraceFlag -SQLInstance Dummy -NotExpectedTraceFlag  117, 3604, 3605 } | Should -Throw -ExpectedMessage  \"Expected 117 to not be found in collection @(117, 118), because We expect that Trace Flag 117 will not be set on Dummy, but it was found.\"\n        }\n    }\n    Context \"Checking CLR Enabled\" {\n        # Mock the version check for running tests\n        Mock Connect-DbaInstance { }\n        # Define test cases for the results to fail test and fill expected message\n        # So the results of SPConfigure is 1, we expect $false but the result is true and the results of SPConfigure is 0, we expect $true but the result is false\n        $TestCases = @{spconfig = 1; expected = $false; actual = $true }, @{spconfig = 0; expected = $true; actual = $false }\n        It \"Fails Check Correctly for Config <spconfig> and expected value <expected>\" -TestCases $TestCases {\n            Param($spconfig, $actual, $expected)\n            Mock Get-DbaSpConfigure { @{\"ConfiguredValue\" = $spconfig } }\n            { Assert-CLREnabled -SQLInstance 'Dummy' -CLREnabled $expected } | Should -Throw -ExpectedMessage \"Expected `$$expected, because The CLR Enabled should be set correctly, but got `$$actual\"\n        }\n        $TestCases = @{spconfig = 0; expected = $false }, @{spconfig = 1; expected = $true; }\n        It \"Passes Check Correctly for Config <spconfig> and expected value <expected>\" -TestCases $TestCases {\n            Param($spconfig, $expected)\n            Mock Get-DbaSpConfigure { @{\"ConfiguredValue\" = $spconfig } }\n            Assert-CLREnabled -SQLInstance 'Dummy' -CLREnabled $expected\n        }\n        # Validate we have called the mock the correct number of times\n        It \"Should call the mocks\" {\n            $assertMockParams = @{\n                'CommandName' = 'Get-DbaSpConfigure'\n                'Times'       = 4\n                'Exactly'     = $true\n            }\n            Assert-MockCalled @assertMockParams\n        }\n    }\n    Context \"Checking AdHoc Distributed Queries Enabled\" {\n        # Mock the version check for running tests\n        Mock Connect-DbaInstance { }\n        # Define test cases for the results to fail test and fill expected message\n        # So the results of SPConfigure is 1, we expect $false but the result is true and the results of SPConfigure is 0, we expect $true but the result is false\n        $TestCases = @{spconfig = 1; expected = $false; actual = $true }, @{spconfig = 0; expected = $true; actual = $false }\n        It \"Fails Check Correctly for Config <spconfig> and expected value <expected>\" -TestCases $TestCases {\n            Param($spconfig, $actual, $expected)\n            Mock Get-DbaSpConfigure { @{\"ConfiguredValue\" = $spconfig } }\n            { Assert-AdHocDistributedQueriesEnabled -SQLInstance 'Dummy' -AdHocDistributedQueriesEnabled $expected } | Should -Throw -ExpectedMessage \"Expected `$$expected, because The AdHoc Distributed Queries Enabled setting should be set correctly, but got `$$actual\"\n        }\n        $TestCases = @{spconfig = 0; expected = $false }, @{spconfig = 1; expected = $true; }\n        It \"Passes Check Correctly for Config <spconfig> and expected value <expected>\" -TestCases $TestCases {\n            Param($spconfig, $expected)\n            Mock Get-DbaSpConfigure { @{\"ConfiguredValue\" = $spconfig } }\n            Assert-AdHocDistributedQueriesEnabled -SQLInstance 'Dummy' -AdHocDistributedQueriesEnabled $expected\n        }\n        # Validate we have called the mock the correct number of times\n        It \"Should call the mocks\" {\n            $assertMockParams = @{\n                'CommandName' = 'Get-DbaSpConfigure'\n                'Times'       = 4\n                'Exactly'     = $true\n            }\n            Assert-MockCalled @assertMockParams\n        }\n    }\n    Context \"Checking XPCmdShell is disabled\" {\n        # Mock the version check for running tests\n        Mock Connect-DbaInstance { }\n        # Define test cases for the results to fail test and fill expected message\n        # This one is different from the others as we are checking for disabled !!\n        # So the results of SPConfigure is 1, we expect $true but the result is false and the results of SPConfigure is 0, we expect $false but the result is true\n        $TestCases = @{spconfig = 1; expected = $true; actual = $false }, @{spconfig = 0; expected = $false; actual = $true }\n        It \"Fails Check Correctly for Config <spconfig> and expected value <expected>\" -TestCases $TestCases {\n            Param($spconfig, $actual, $expected)\n            Mock Get-DbaSpConfigure { @{\"ConfiguredValue\" = $spconfig } }\n            { Assert-XpCmdShellDisabled -SQLInstance 'Dummy' -XpCmdShellDisabled $expected } | Should -Throw -ExpectedMessage \"Expected `$$expected, because The XP CmdShell setting should be set correctly, but got `$$actual\"\n        }\n        # again this one is different from the others as we are checking for disabled\n        $TestCases = @{spconfig = 1; expected = $false }, @{spconfig = 0; expected = $true; }\n        It \"Passes Check Correctly for Config <spconfig> and expected value <expected>\" -TestCases $TestCases {\n            Param($spconfig, $expected)\n            Mock Get-DbaSpConfigure { @{\"ConfiguredValue\" = $spconfig } }\n            Assert-XpCmdShellDisabled -SQLInstance 'Dummy' -XpCmdShellDisabled $expected\n        }\n        # Validate we have called the mock the correct number of times\n        It \"Should call the mocks\" {\n            $assertMockParams = @{\n                'CommandName' = 'Get-DbaSpConfigure'\n                'Times'       = 4\n                'Exactly'     = $true\n            }\n            Assert-MockCalled @assertMockParams\n        }\n    }\n    Context \"Checking ErrorLog Count\" {\n        # if configured value is 30 and test value 30 it will pass\n        It \"Passes Check Correctly with the number of error log files set to 30\" {\n            # Mock to pass\n            Mock Get-DbaErrorLogConfig { @{\"LogCount\" = 30 } }\n            Assert-ErrorLogCount -SQLInstance 'Dummy' -errorLogCount 30\n        }\n\n        # if configured value is less than the current value it fails\n        It \"Fails Check Correctly with the number of error log files being 10 instead of 30 or higher\" {\n            # Mock to fail\n            Mock Get-DbaErrorLogConfig { @{\"LogCount\" = 10 } }\n            { Assert-ErrorLogCount -SQLInstance 'Dummy' -errorLogCount 30 } | Should -Throw -ExpectedMessage \"Expected the actual value to be greater than or equal to 30, because We expect to have at least 30 number of error log files, but got 10.\"\n        }\n\n        # if configured value is higher than the current value it fails\n        It \"Passes Check Correctly with the number of error log files being 40 and test of 30 or higher\" {\n            # Mock to Pass\n            Mock Get-DbaErrorLogConfig { @{\"LogCount\" = 40 } }\n            Assert-ErrorLogCount -SQLInstance 'Dummy' -errorLogCount 30\n        }\n\n        # Validate we have called the mock the correct number of times\n        It \"Should call the mocks\" {\n            $assertMockParams = @{\n                'CommandName' = 'Get-DbaErrorLogConfig'\n                'Times'       = 3\n                'Exactly'     = $true\n            }\n            Assert-MockCalled @assertMockParams\n        }\n    }\n}\n\nInModuleScope dbachecks {\n    (Get-ChildItem $PSScriptRoot/../../internal/assertions/).ForEach{ . $Psitem.FullName }\n    Describe \"Testing AllInstanceInfo and Relevant Assertions\" -Tag AllInstanceInfo {\n        function Get-ErrorLogEntry { }\n        Mock Get-DbcConfigValue { } -ParameterFilter { $Name -and $Name -eq 'policy.errorlog.warningwindow' }\n        Context \"Checking Get-AllInstanceInfo\" {\n            Mock Get-ErrorLogEntry { }\n\n            It \"Should return the correct results for ErrorLog Entries when there are no severities\" {\n                (Get-AllInstanceInfo -Instance Dummy -Tags ErrorLog -There $true).ErrorLog | Should -BeNullOrEmpty -Because \"We need no entries when we have no sev 17 to 24 errors\"\n            }\n\n            It \"Should return the correct results for ErrorLog Entries when there are severities\" {\n                Mock Get-ErrorLogEntry { [PSCustomObject]@{\n                        LogDate     = '2019-02-14 23:00'\n                        ProcessInfo = 'spid55'\n                        Text        = 'Error: 50000, Severity: 18, State: 1.'\n                    }\n                }\n                (Get-AllInstanceInfo -Instance Dummy -Tags ErrorLog -There $true).ErrorLog | Should -BeOfType PSCustomObject -Because \"We need entries when we have sev 17 to 24 errors\"\n            }\n\n            It \"Should return the correct results for Default Trace when it is enabled\" {\n                Mock Get-DbaSpConfigure { @{\n                        'ConfiguredValue' = 1\n                    } }\n                (Get-AllInstanceInfo -Instance Dummy -Tags DefaultTrace -There $true).DefaultTrace.ConfiguredValue | Should -Be 1 -Because \"We need to return one when we have default trace enabled\"\n            }\n\n            It \"Should return the correct results for Default Trace when it is disabled\" {\n                Mock Get-DbaSpConfigure { [pscustomobject]@{\n                        ConfiguredValue = 0\n                    } }\n\n                (Get-AllInstanceInfo -Instance Dummy -Tags DefaultTrace -There $true).DefaultTrace.ConfiguredValue | Should -Be 0 -Because \"We need to return zero when default trace is not enabled\"\n            }\n        }\n        Context \"Checking ErrorLog Entries\" {\n\n            It \"Should pass the test successfully when there are no Severity Errors\" {\n                # Mock for success\n                Mock Get-AllInstanceInfo { }\n                Assert-ErrorLogEntry -AllInstanceInfo (Get-AllInstanceInfo)\n            }\n\n            It \"Should fail the test successfully when there are Severity Errors\" {\n                # MOck for failing test\n                Mock Get-AllInstanceInfo { [PSCustomObject]@{\n                        ErrorLog = [PSCustomObject]@{\n                            LogDate     = '2019-02-14 23:00'\n                            ProcessInfo = 'spid55'\n                            Text        = 'Error: 50000, Severity: 18, State: 1.'\n                        }\n                    } }\n                { Assert-ErrorLogEntry -AllInstanceInfo (Get-AllInstanceInfo) } | Should -Throw -ExpectedMessage \"Expected `$null or empty, because these severities indicate serious problems, but got @(@{LogDate=2019-02-14 23:00; ProcessInfo=spid55; Text=Error: 50000, Severity: 18, State: 1.}).\"\n            }\n        }\n        Context \"Checking Cross DB Ownership Chaining\" {\n            It \"Should pass the test successfully when cross db ownership chaining is disabled\" {\n                # Mock for success\n                Mock Get-AllInstanceInfo { [PSCustomObject]@{\n                        CrossDBOwnershipChaining = [PSCustomObject]@{\n                            ConfiguredValue = 0\n                        }\n                    } }\n\n                Assert-CrossDBOwnershipChaining -AllInstanceInfo (Get-AllInstanceInfo)\n            }\n\n            It \"Should fail the test successfully when cross db ownership chaining is enabled\" {\n                # Mock for failing test\n                Mock Get-AllInstanceInfo { [PSCustomObject]@{\n                        CrossDBOwnershipChaining = [PSCustomObject]@{\n                            ConfiguredValue = 1\n                        }\n                    } }\n\n                { Assert-CrossDBOwnershipChaining -AllInstanceInfo (Get-AllInstanceInfo) } | Should -Throw -ExpectedMessage \"Expected 0, because We expected the Cross DB Ownership Chaining to be disabled, but got 1.\"\n            }\n        }\n\n        Context \"Checking Default Trace Entries\" {\n\n            It \"Should pass the test successfully when default trace is enabled\" {\n                # Mock for success\n                Mock Get-AllInstanceInfo { [PSCustomObject]@{\n                        DefaultTrace = [PSCustomObject]@{\n                            ConfiguredValue = 1\n                        }\n                    } }\n                Assert-DefaultTrace -AllInstanceInfo (Get-AllInstanceInfo)\n            }\n\n            It \"Should fail the test successfully when when default trace is disabled\" {\n                # Mock for failing test\n                Mock Get-AllInstanceInfo { [PSCustomObject]@{\n                        DefaultTrace = [PSCustomObject]@{\n                            ConfiguredValue = 0\n                        }\n                    }\n                }\n                { Assert-DefaultTrace -AllInstanceInfo (Get-AllInstanceInfo) } | Should -Throw -ExpectedMessage \"Expected 1, because We expected the Default Trace to be enabled, but got 0.\"\n            }\n        }\n        Context \"Checking OLE Automation Procedures Entries\" {\n\n            It \"Should pass the test successfully when OLE Automation Procedures is disabled\" {\n                # Mock for success\n                # This should pass when the configured value for OleAutomationProcedures enabled is 0 (ie disabled)\n                Mock Get-AllInstanceInfo { [PSCustomObject]@{\n                        OleAutomationProceduresDisabled = [PSCustomObject]@{\n                            ConfiguredValue = 0\n                        }\n                    }\n                }\n                Assert-OLEAutomationProcedures -AllInstanceInfo (Get-AllInstanceInfo)\n            }\n\n            It \"Should fail the test successfully when when OLE Automation Procedures is enabled\" {\n                # Mock for failing test\n                # This should pass when the configured value for OleAutomationProcedures enabled is 1 (ie enabled)\n                Mock Get-AllInstanceInfo { [PSCustomObject]@{\n                        OleAutomationProceduresDisabled = [PSCustomObject]@{\n                            ConfiguredValue = 1\n                        }\n                    }\n                }\n                { Assert-OLEAutomationProcedures -AllInstanceInfo (Get-AllInstanceInfo) } | Should -Throw -ExpectedMessage \"Expected 0, because we expect the OLE Automation Procedures to be disabled, but got 1.\"\n            }\n        }\n        Context \"Checking Remote Access Entries\" {\n\n            It \"Should pass the test successfully when remote access is disabled\" {\n                # Mock for success\n                Mock Get-AllInstanceInfo { [PSCustomObject]@{\n                        RemoteAccess = [PSCustomObject]@{\n                            ConfiguredValue = 0\n                        }\n                    }\n                }\n                Assert-RemoteAccess -AllInstanceInfo (Get-AllInstanceInfo)\n            }\n\n            It \"Should fail the test successfully when remote access is enabled\" {\n                # Mock for failing test\n                Mock Get-AllInstanceInfo { [PSCustomObject]@{\n                        RemoteAccess = [PSCustomObject]@{\n                            ConfiguredValue = 1\n                        }\n                    }\n                }\n\n                { Assert-RemoteAccess -AllInstanceInfo (Get-AllInstanceInfo) } | Should -Throw -ExpectedMessage \"Expected 0, because we expected Remote Access to be disabled, but got 1.\"\n            }\n        }\n        Context \"Checking Scan For Startup Procedures Entries\" {\n\n            It \"Should pass the test successfully when scan for startup procedures is disabled and config is true\" {\n                # Mock for success\n                Mock Get-AllInstanceInfo { [PSCustomObject]@{\n                        ScanForStartupProceduresDisabled = [PSCustomObject]@{\n                            ConfiguredValue = 0\n                        }\n                    }\n                }\n                Assert-ScanForStartupProcedures -AllInstanceInfo (Get-AllInstanceInfo) -ScanForStartupProcsDisabled $true\n            }\n\n            It \"Should fail the test successfully when scan for startup procedures is disabled and config is false\" {\n                # Mock for failing test\n                Mock Get-AllInstanceInfo { [PSCustomObject]@{\n                        ScanForStartupProceduresDisabled = [PSCustomObject]@{\n                            ConfiguredValue = 0\n                        }\n                    } }\n                { Assert-ScanForStartupProcedures -AllInstanceInfo (Get-AllInstanceInfo) -ScanForStartupProcsDisabled $false } | Should -Throw -ExpectedMessage \"Expected `$false, because We expected the scan for startup procedures to be configured correctly, but got `$true.\"\n            }\n\n            It \"Should pass the test successfully when scan for startup procedures is enabled and config is false\" {\n                # Mock for success\n                Mock Get-AllInstanceInfo { [PSCustomObject]@{\n                        ScanForStartupProceduresDisabled = [PSCustomObject]@{\n                            ConfiguredValue = 1\n                        }\n                    }\n                }\n                Assert-ScanForStartupProcedures -AllInstanceInfo (Get-AllInstanceInfo) -ScanForStartupProcsDisabled $false\n            }\n\n            It \"Should fail the test successfully when scan for startup procedures is enabled and config is true\" {\n                # Mock for failing test\n                Mock Get-AllInstanceInfo { [PSCustomObject]@{\n                        ScanForStartupProceduresDisabled = [PSCustomObject]@{\n                            ConfiguredValue = 1\n                        }\n                    } }\n                { Assert-ScanForStartupProcedures -AllInstanceInfo (Get-AllInstanceInfo) -ScanForStartupProcsDisabled $true } | Should -Throw -ExpectedMessage \"Expected `$true, because We expected the scan for startup procedures to be configured correctly, but got `$false.\"\n            }\n        }\n        Context \"Checking Cross DB Ownership Chaining\" {\n            It \"Should pass the test successfully when cross db ownership chaining is disabled\" {\n                # Mock for success\n                Mock Get-AllInstanceInfo { [PSCustomObject]@{\n                        CrossDBOwnershipChaining = [PSCustomObject]@{\n                            ConfiguredValue = 0\n                        }\n                    } }\n                Assert-CrossDBOwnershipChaining -AllInstanceInfo (Get-AllInstanceInfo)\n            }\n\n            It \"Should fail the test successfully when cross db ownership chaining is enabled\" {\n                # Mock for failing test\n                Mock Get-AllInstanceInfo { [PSCustomObject]@{\n                        CrossDBOwnershipChaining = [PSCustomObject]@{\n                            ConfiguredValue = 1\n                        }\n                    } }\n                { Assert-CrossDBOwnershipChaining -AllInstanceInfo (Get-AllInstanceInfo) } | Should -Throw -ExpectedMessage \"Expected 0, because we expected the cross db ownership chaining to be disabled, but got 1.\"\n            }\n        }\n        Context \"Checking Max Dump Entries\" {\n\n            It \"Should pass the test successfully when the number of dumps is less than config\" {\n                # Mock for success\n                Mock Get-AllInstanceInfo { [PSCustomObject]@{\n                        MaxDump = [PSCustomObject]@{\n                            Count = 0\n                        }\n                    }\n                }\n                $maxdumps = 1\n                Assert-MaxDump  -AllInstanceInfo (Get-AllInstanceInfo)  -maxdumps $maxdumps\n            }\n\n            It \"Should fail the test successfully when the number of dumps is more than config\" {\n                # Mock for failing test\n                Mock Get-AllInstanceInfo {\n                    [PSCustomObject]@{\n                        MaxDump = [PSCustomObject]@{\n                            Count = 7\n                        }\n                    }\n                }\n                $maxdumps = 4\n                { Assert-MaxDump  -AllInstanceInfo (Get-AllInstanceInfo) -maxdumps $maxdumps } | Should -Throw -ExpectedMessage \"Expected the actual value to be less than 4, because We expected less than 4 dumps but found 7. Memory dumps often suggest issues with the SQL Server instance, but got 7\"\n            }\n        }\n        Context \"Checking Latest Build of SQL Server\" {\n\n            It \"Should pass the test successfully when scan for latest build of SQL passes\" {\n                # Mock for success\n                Mock Get-AllInstanceInfo { [PSCustomObject]@{\n                        LatestBuild = [PSCustomObject]@{\n                            Compliant = $true\n                        }\n                    }\n                }\n                Assert-LatestBuild -AllInstanceInfo (Get-AllInstanceInfo)\n            }\n\n            It \"Should fail the test successfully when scan for latest build of SQL fails\" {\n                # Mock for failing test\n                Mock Get-AllInstanceInfo { [PSCustomObject]@{\n                        LatestBuild = [PSCustomObject]@{\n                            Compliant = $false\n                        }\n                    } }\n                { Assert-LatestBuild -AllInstanceInfo (Get-AllInstanceInfo) } | Should -Throw -ExpectedMessage \"Expected `$true, because We expected the SQL Server to be on the newest SQL Server Packs/CUs, but got `$false.\"\n            }\n        }\n        Context \"Checking SQL Engine\" {\n\n            It \"Should pass the test successfully when the sql engine is running and the config is set to running\" {\n                # Mock for success\n                Mock Get-AllInstanceInfo { [PSCustomObject]@{\n                        EngineService = [pscustomobject] @{\n                            State     = 'Running'\n                            StartType = 'Automatic'\n                        }\n                    }\n                }\n                Assert-EngineState  -AllInstanceInfo (Get-AllInstanceInfo) -state 'Running'\n            }\n\n            It \"Should fail the test successfully successfully when the sql engine is stopped and the config is set to running\" {\n                # Mock for failure\n                Mock Get-AllInstanceInfo { [PSCustomObject]@{\n                        EngineService = [pscustomobject] @{\n                            State     = 'Stopped'\n                            StartType = 'Automatic'\n                        }\n                    }\n                }\n                { Assert-EngineState  -AllInstanceInfo (Get-AllInstanceInfo) -state 'Running' } | Should -Throw -ExpectedMessage \"Expected strings to be the same, because The SQL Service was expected to be Running, but they were different.\"\n            }\n            It \"Should pass the test successfully when the sql engine is stopped and the config is set to stopped\" {\n                # Mock for success\n                Mock Get-AllInstanceInfo { [PSCustomObject]@{\n                        EngineService = [pscustomobject] @{\n                            State     = 'Running'\n                            StartType = 'Automatic'\n                        }\n                    }\n                }\n                Assert-EngineState  -AllInstanceInfo (Get-AllInstanceInfo) -state 'Running'\n            }\n\n            It \"Should fail the test successfully successfully when the sql engine is running and the config is set to stopped\" {\n                # Mock for failure\n                Mock Get-AllInstanceInfo { [PSCustomObject]@{\n                        EngineService = [pscustomobject] @{\n                            State     = 'Stopped'\n                            StartType = 'Automatic'\n                        }\n                    }\n                }\n                { Assert-EngineState  -AllInstanceInfo (Get-AllInstanceInfo) -state 'Running' } | Should -Throw -ExpectedMessage \"Expected strings to be the same, because The SQL Service was expected to be Running, but they were different.\"\n            }\n\n            It \"Should pass the test successfully when the sql engine is set to Automatic and the config is set to Automatic and it is not a cluster\" {\n                # Mock for success\n                Mock Get-AllInstanceInfo { [PSCustomObject]@{\n                        EngineService = [pscustomobject] @{\n                            State     = 'Running'\n                            StartType = 'Automatic'\n                        }\n                    }\n                }\n                Assert-EngineStartType  -AllInstanceInfo (Get-AllInstanceInfo) -StartType 'Automatic'\n            }\n\n            It \"Should fail the test successfully when the sql engine is set to Manual and the config is set to Automatic and it is not a cluster\" {\n                # Mock for failure\n                Mock Get-AllInstanceInfo { [PSCustomObject]@{\n                        EngineService = [pscustomobject] @{\n                            State     = 'Stopped'\n                            StartType = 'Manual'\n                        }\n                    }\n                }\n                { Assert-EngineStartType  -AllInstanceInfo (Get-AllInstanceInfo) -StartType 'Automatic' } | Should -Throw -ExpectedMessage \"Expected strings to be the same, because The SQL Service Start Type was expected to be Automatic, but they were different.\"\n            }\n            It \"Should fail the test successfully when the sql engine is set to Disabled and the config is set to Automatic and it is not a cluster\" {\n                # Mock for failure\n                Mock Get-AllInstanceInfo { [PSCustomObject]@{\n                        EngineService = [pscustomobject] @{\n                            State     = 'Stopped'\n                            StartType = 'Disabled'\n                        }\n                    }\n                }\n                { Assert-EngineStartType  -AllInstanceInfo (Get-AllInstanceInfo) -StartType 'Automatic' } | Should -Throw -ExpectedMessage \"Expected strings to be the same, because The SQL Service Start Type was expected to be Automatic, but they were different.\"\n            }\n            It \"Should pass the test successfully when the sql engine is set to Manual and the config is set to Manual and it is not a cluster\" {\n                # Mock for success\n                Mock Get-AllInstanceInfo { [PSCustomObject]@{\n                        EngineService = [pscustomobject] @{\n                            State     = 'Running'\n                            StartType = 'Manual'\n                        }\n                    }\n                }\n                Assert-EngineStartType  -AllInstanceInfo (Get-AllInstanceInfo) -StartType 'Manual'\n            }\n\n            It \"Should fail the test successfully when the sql engine is set to Automatic and the config is set to Manual and it is not a cluster\" {\n                # Mock for failure\n                Mock Get-AllInstanceInfo { [PSCustomObject]@{\n                        EngineService = [pscustomobject] @{\n                            State     = 'Stopped'\n                            StartType = 'Automatic'\n                        }\n                    }\n                }\n                { Assert-EngineStartType  -AllInstanceInfo (Get-AllInstanceInfo) -StartType 'Manual' } | Should -Throw -ExpectedMessage \"Expected strings to be the same, because The SQL Service Start Type was expected to be Manual, but they were different.\"\n            }\n            It \"Should fail the test successfully when the sql engine is set to Disabled and the config is set to Manual and it is not a cluster\" {\n                # Mock for failure\n                Mock Get-AllInstanceInfo { [PSCustomObject]@{\n                        EngineService = [pscustomobject] @{\n                            State     = 'Stopped'\n                            StartType = 'Disabled'\n                        }\n                    }\n                }\n                { Assert-EngineStartType  -AllInstanceInfo (Get-AllInstanceInfo) -StartType 'Manual' } | Should -Throw -ExpectedMessage \"Expected strings to be the same, because The SQL Service Start Type was expected to be Manual, but they were different.\"\n            }\n            It \"Should pass the test successfully when the sql engine is set to Disabled and the config is set to Disabled and it is not a cluster\" {\n                # Mock for success\n                Mock Get-AllInstanceInfo { [PSCustomObject]@{\n                        EngineService = [pscustomobject] @{\n                            State     = 'Running'\n                            StartType = 'Disabled'\n                        }\n                    }\n                }\n                Assert-EngineStartType  -AllInstanceInfo (Get-AllInstanceInfo) -StartType 'Disabled'\n            }\n            It \"Should fail the test successfully when the sql engine is set to Manual and the config is set to Disabled and it is not a cluster\" {\n                # Mock for failure\n                Mock Get-AllInstanceInfo { [PSCustomObject]@{\n                        EngineService = [pscustomobject] @{\n                            State     = 'Stopped'\n                            StartType = 'Manual'\n                        }\n                    }\n                }\n                { Assert-EngineStartType  -AllInstanceInfo (Get-AllInstanceInfo) -StartType 'Disabled' } | Should -Throw -ExpectedMessage \"Expected strings to be the same, because The SQL Service Start Type was expected to be Disabled, but they were different.\"\n            }\n            It \"Should fail the test successfully when the sql engine is set to Automatic and the config is set to Disabled and it is not a cluster\" {\n                # Mock for failure\n                Mock Get-AllInstanceInfo { [PSCustomObject]@{\n                        EngineService = [pscustomobject] @{\n                            State     = 'Stopped'\n                            StartType = 'Automatic'\n                        }\n                    }\n                }\n                { Assert-EngineStartType  -AllInstanceInfo (Get-AllInstanceInfo) -StartType 'Disabled' } | Should -Throw -ExpectedMessage \"Expected strings to be the same, because The SQL Service Start Type was expected to be Disabled, but they were different.\"\n            }\n            It \"Should pass the test successfully when the sql engine is set to Manual and it is a cluster\" {\n                # Mock for success\n                Mock Get-AllInstanceInfo { [PSCustomObject]@{\n                        EngineService = [pscustomobject] @{\n                            State     = 'Running'\n                            StartType = 'Manual'\n                        }\n                    }\n                }\n                Assert-EngineStartTypeCluster  -AllInstanceInfo (Get-AllInstanceInfo)\n            }\n            It \"Should fail the test successfully when the sql engine is set to Automatic and it is a cluster\" {\n                # Mock for failure\n                Mock Get-AllInstanceInfo { [PSCustomObject]@{\n                        EngineService = [pscustomobject] @{\n                            State     = 'Stopped'\n                            StartType = 'Automatic'\n                        }\n                    }\n                }\n                { Assert-EngineStartTypeCluster  -AllInstanceInfo (Get-AllInstanceInfo) } | Should -Throw -ExpectedMessage \"Expected strings to be the same, because Clustered Instances required that the SQL engine service is set to manual, but they were different.\"\n            }\n            It \"Should fail the test successfully when the sql engine is set to Disabled and it is a cluster\" {\n                # Mock for failure\n                Mock Get-AllInstanceInfo { [PSCustomObject]@{\n                        EngineService = [pscustomobject] @{\n                            State     = 'Stopped'\n                            StartType = 'Disabled'\n                        }\n                    }\n                }\n                { Assert-EngineStartTypeCluster  -AllInstanceInfo (Get-AllInstanceInfo) } | Should -Throw -ExpectedMessage \"Expected strings to be the same, because Clustered Instances required that the SQL engine service is set to manual, but they were different.\"\n            }\n        }\n        Context \"Checking sa login disabled\" {\n\n            It \"Should pass the test successfully when the original sa account is disabled\" {\n                # Mock for success\n                Mock Get-AllInstanceInfo {[PSCustomObject]@{\n                    SaDisabled = [PSCustomObject]@{\n                        Disabled = $true\n                    }\n                }\n            }\n                Assert-SaDisabled -AllInstanceInfo (Get-AllInstanceInfo)\n            }\n\n            It \"Should fail the test successfully when the original sa account is enabled\" {\n                # Mock for failing test\n                Mock Get-AllInstanceInfo {[PSCustomObject]@{\n                    SaDisabled = [PSCustomObject]@{\n                        Disabled = $false\n                        }\n                    }}\n                {Assert-SaDisabled -AllInstanceInfo (Get-AllInstanceInfo)} | Should -Throw -ExpectedMessage \"Expected `$true, because We expected the original sa login to be disabled, but got `$false.\"\n            }\n        }\n        Context \"Checking no sa login exist\" {\n\n            It \"Should pass the test successfully when no sa login exist\" {\n                # Mock for success\n                Mock Get-AllInstanceInfo {[PSCustomObject]@{\n                    SaExist = [PSCustomObject]@{\n                        Exist = 0\n                    }\n                }\n            }\n                Assert-SaExist -AllInstanceInfo (Get-AllInstanceInfo)\n            }\n\n            It \"Should fail the test successfully when a sa login doesn't exist\" {\n                # Mock for failing test\n                Mock Get-AllInstanceInfo {[PSCustomObject]@{\n                    SaExist = [PSCustomObject]@{\n                        Exist = 1\n                        }\n                    }}\n                {Assert-SaExist -AllInstanceInfo (Get-AllInstanceInfo)} | Should -Throw -ExpectedMessage \"Expected 0, because We expected no login to exist with the name sa, but got 1.\"\n            }\n        }\n    }\n}\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzB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z2mbycV6Q4ns38NGrSqedo4pV0TmWpQ7oxr\n# IpZQisFu095UwNQQ+dmWlwjT411VBlvw0ud0Njt+EFGt458CvvVU9T6nqkkmK2OG\n# JLkJOkzwDLrFG7H92LdJRq8LtREnBBz488xz/Tpb4HJs/Drgwi0muC99mug9Cv9C\n# ffTv69G9bf7C9yDuGHfftArerPIg+c3OVLOLuEYPgGQb84yb7k5UmtSQmRwI+puw\n# H88Byh7MRR5sTHhwSMlla0ESvTSnks/XJwWYXw/IyqyCyD9PwPJejccwiI+pC1Os\n# TKVpI+AhTilaojWO0qr5jYawjd1JndKREFl5MtrsIdUX5PVM\n# SIG # End signature block\n"
  },
  {
    "path": "developing/Archive/tests/checks/ServerChecks.Tests.ps1",
    "content": "[Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSAvoidUsingComputerNameHardcoded\", \"\")]\n[CmdletBinding()]\nparam ()\n# load all of the assertion functions\n(Get-ChildItem $PSScriptRoot/../../internal/assertions/).ForEach{. $Psitem.FullName}\n\nDescribe \"Checking ServerChecks.Tests\" {\n    Context \"Testing Assert-CPUPrioritisation\" {\n        #Mock for passing\n        function Get-RemoteRegistryValue {}\n        Mock Get-RemoteRegistryValue {\n            24\n        }\n        It \"Should Pass When value set correctly\" {\n            Assert-CPUPrioritisation\n        }\n        #Mock for failing\n        function Get-RemoteRegistryValue {}\n        Mock Get-RemoteRegistryValue {\n            2\n        }\n        It \"Should fail When value set incorrectly\" {\n            {Assert-CPUPrioritisation} | Should -Throw -ExpectedMessage \"Expected exactly 24, because a server should prioritise CPU to it's Services, not to the user experience when someone logs on, but got 2.\"\n        }\n    }\n    Context \"Testing Assert-DiskAllocationUnit\" {\n        it \"Should pass when all SQLDisks are formatted with the 65536b (64kb) block allocation unit size\" {\n            Mock Test-DbaDiskAllocation {\n                @(\n                    [PSObject]@{\n                        'BlockSize'      = 4096\n                        'IsBestPractice' = $True\n                        'IsSqlDisk'      = $True\n                        'Label'          = $Null\n                        'Name'           = 'C:\\'\n                        'Server'         = 'DummyServer'\n                    },\n                    [PSObject]@{\n                        'BlockSize'      = 65536\n                        'IsBestPractice' = $True\n                        'IsSqlDisk'      = $True\n                        'Label'          = 'SQL Data'\n                        'Name'           = 'D:\\'\n                        'Server'         = 'DummyServer'\n                    },\n                    [PSObject]@{\n                        'BlockSize'      = 65536\n                        'IsBestPractice' = $True\n                        'IsSqlDisk'      = $False\n                        'Label'          = 'SQL Archive'\n                        'Name'           = 'F:\\'\n                        'Server'         = 'DummyServer'\n                    },\n                    [PSObject]@{\n                        'BlockSize'      = 65536\n                        'IsBestPractice' = $True\n                        'IsSqlDisk'      = $True\n                        'Label'          = 'SQL Logs'\n                        'Name'           = 'L:\\'\n                        'Server'         = 'DummyServer'\n                    },\n                    [PSObject]@{\n                        'BlockSize'      = 65536\n                        'IsBestPractice' = $True\n                        'IsSqlDisk'      = $True\n                        'Label'          = 'SQL Performance'\n                        'Name'           = 'P:\\'\n                        'Server'         = 'DummyServer'\n                    }\n                )\n            }\n\n            $DiskAllocationObjects = Test-DbaDiskAllocation -ComputerName Dummy\n            $DiskAllocationObjects.ForEach{\n                Assert-DiskAllocationUnit -DiskAllocationObject $PSItem\n            }\n        }\n\n        it \"Should fail when any SQLDisks is formatted with a block allocation unit size that isn't 65536b (64KB)\" {\n            Mock Test-DbaDiskAllocation {\n                @(\n                    [PSObject]@{\n                        'BlockSize'      = 4096\n                        'IsBestPractice' = $True\n                        'IsSqlDisk'      = $True\n                        'Label'          = $Null\n                        'Name'           = 'C:\\'\n                        'Server'         = 'DummyServer'\n                    },\n                    [PSObject]@{\n                        'BlockSize'      = 65536\n                        'IsBestPractice' = $True\n                        'IsSqlDisk'      = $True\n                        'Label'          = 'SQL Data'\n                        'Name'           = 'D:\\'\n                        'Server'         = 'DummyServer'\n                    },\n                    [PSObject]@{\n                        'BlockSize'      = 65536\n                        'IsBestPractice' = $True\n                        'IsSqlDisk'      = $False\n                        'Label'          = 'SQL Archive'\n                        'Name'           = 'F:\\'\n                        'Server'         = 'DummyServer'\n                    },\n                    [PSObject]@{\n                        'BlockSize'      = 65536\n                        'IsBestPractice' = $True\n                        'IsSqlDisk'      = $True\n                        'Label'          = 'SQL Logs'\n                        'Name'           = 'L:\\'\n                        'Server'         = 'DummyServer'\n                    },\n                    [PSObject]@{\n                        'BlockSize'      = 65536\n                        'IsBestPractice' = $false # changed this to make it fail\n                        'IsSqlDisk'      = $True\n                        'Label'          = 'SQL Performance'\n                        'Name'           = 'P:\\'\n                        'Server'         = 'DummyServer'\n                    }\n                )\n            }\n            $DiskAllocationObjects = Test-DbaDiskAllocation -ComputerName Dummy\n            {Assert-DiskAllocationUnit -DiskAllocationObject $DiskAllocationObjects[4] } | should -Throw -ExpectedMessage \"Expected `$true, because SQL Server performance will be better when accessing data from a disk that is formatted with 64Kb block allocation unit, but got `$false.\"\n        }\n    }\n    Context \"Testing Get-AllServerInfo for Tags Server with a server that exists\" {\n        Mock Test-Connection {\n            @(\n                [PSObject]@{\n                    'Address'                        = 'DummyServer'\n                    'BufferSize'                     = 32\n                    'NoFragmentation'                = $False\n                    'PrimaryAddressResolutionStatus' = 0\n                    'ProtocolAddress'                = '10.10.10.10'\n                    'ProtocolAddressResolved'        = ''\n                    'RecordRoute'                    = 0\n                    'ReplyInconsistency'             = $False\n                    'ReplySize'                      = 32\n                    'ResolveAddressNames'            = $False\n                    'ResponseTime'                   = 1\n                    'ResponseTimeToLive'             = 128\n                    'RouteRecord'                    = $Null\n                    'RouteRecordResolved'            = $Null\n                    'SourceRoute'                    = ''\n                    'SourceRouteType'                = 0\n                    'StatusCode'                     = 0\n                    'Timeout'                        = 4000\n                    'TimeStampRecord'                = $Null\n                    'TimeStampRecordAddress'         = $Null\n                    'TimeStampRecordAddressResolved' = $Null\n                    'TimestampRoute'                 = 0\n                    'TimeToLive'                     = 80\n                    'TypeofService'                  = 0\n                    '__CLASS'                        = 'Win32_PingStatus'\n                    '__DERIVATION'                   = @()\n                    '__DYNASTY'                      = 'Win32_PingStatus'\n                    '__GENUS'                        = 2\n                    '__NAMESPACE'                    = 'root\\cimv2'\n                    '__PATH'                         = '\\\\SourceServer\\root\\cimv2:Win32_PingStatus.Address=\"DummyServer\",BufferSize=32,NoFragmentation=FALSE,RecordRoute=0,ResolveAddressNames=FALSE,SourceRoute=\"\",SourceRouteType=0,Ti\n            meout=4000,TimestampRoute=0,TimeToLive=80,TypeofService=0'\n                    '__PROPERTY_COUNT'               = 24\n                    '__RELPATH'                      = 'Win32_PingStatus.Address=\"DummyServer\",BufferSize=32,NoFragmentation=FALSE,RecordRoute=0,ResolveAddressNames=FALSE,SourceRoute=\"\",SourceRouteType=0,Timeout=4000,TimestampRoute=\n            0,TimeToLive=80,TypeofService=0'\n                    '__SERVER'                       = 'SourceServer'\n                    '__SUPERCLASS'                   = $Null\n                },\n                [PSObject]@{\n                    'Address'                        = 'DummyServer'\n                    'BufferSize'                     = 32\n                    'NoFragmentation'                = $False\n                    'PrimaryAddressResolutionStatus' = 0\n                    'ProtocolAddress'                = '10.10.10.10'\n                    'ProtocolAddressResolved'        = ''\n                    'RecordRoute'                    = 0\n                    'ReplyInconsistency'             = $False\n                    'ReplySize'                      = 32\n                    'ResolveAddressNames'            = $False\n                    'ResponseTime'                   = 0\n                    'ResponseTimeToLive'             = 128\n                    'RouteRecord'                    = $Null\n                    'RouteRecordResolved'            = $Null\n                    'SourceRoute'                    = ''\n                    'SourceRouteType'                = 0\n                    'StatusCode'                     = 0\n                    'Timeout'                        = 4000\n                    'TimeStampRecord'                = $Null\n                    'TimeStampRecordAddress'         = $Null\n                    'TimeStampRecordAddressResolved' = $Null\n                    'TimestampRoute'                 = 0\n                    'TimeToLive'                     = 80\n                    'TypeofService'                  = 0\n                    '__CLASS'                        = 'Win32_PingStatus'\n                    '__DERIVATION'                   = @()\n                    '__DYNASTY'                      = 'Win32_PingStatus'\n                    '__GENUS'                        = 2\n                    '__NAMESPACE'                    = 'root\\cimv2'\n                    '__PATH'                         = '\\\\SourceServer\\root\\cimv2:Win32_PingStatus.Address=\"DummyServer\",BufferSize=32,NoFragmentation=FALSE,RecordRoute=0,ResolveAddressNames=FALSE,SourceRoute=\"\",SourceRouteType=0,Ti\n            meout=4000,TimestampRoute=0,TimeToLive=80,TypeofService=0'\n                    '__PROPERTY_COUNT'               = 24\n                    '__RELPATH'                      = 'Win32_PingStatus.Address=\"DummyServer\",BufferSize=32,NoFragmentation=FALSE,RecordRoute=0,ResolveAddressNames=FALSE,SourceRoute=\"\",SourceRouteType=0,Timeout=4000,TimestampRoute=\n            0,TimeToLive=80,TypeofService=0'\n                    '__SERVER'                       = 'SourceServer'\n                    '__SUPERCLASS'                   = $Null\n                },\n                [PSObject]@{\n                    'Address'                        = 'DummyServer'\n                    'BufferSize'                     = 32\n                    'NoFragmentation'                = $False\n                    'PrimaryAddressResolutionStatus' = 0\n                    'ProtocolAddress'                = '10.10.10.10'\n                    'ProtocolAddressResolved'        = ''\n                    'RecordRoute'                    = 0\n                    'ReplyInconsistency'             = $False\n                    'ReplySize'                      = 32\n                    'ResolveAddressNames'            = $False\n                    'ResponseTime'                   = 0\n                    'ResponseTimeToLive'             = 128\n                    'RouteRecord'                    = $Null\n                    'RouteRecordResolved'            = $Null\n                    'SourceRoute'                    = ''\n                    'SourceRouteType'                = 0\n                    'StatusCode'                     = 0\n                    'Timeout'                        = 4000\n                    'TimeStampRecord'                = $Null\n                    'TimeStampRecordAddress'         = $Null\n                    'TimeStampRecordAddressResolved' = $Null\n                    'TimestampRoute'                 = 0\n                    'TimeToLive'                     = 80\n                    'TypeofService'                  = 0\n                    '__CLASS'                        = 'Win32_PingStatus'\n                    '__DERIVATION'                   = @()\n                    '__DYNASTY'                      = 'Win32_PingStatus'\n                    '__GENUS'                        = 2\n                    '__NAMESPACE'                    = 'root\\cimv2'\n                    '__PATH'                         = '\\\\SourceServer\\root\\cimv2:Win32_PingStatus.Address=\"DummyServer\",BufferSize=32,NoFragmentation=FALSE,RecordRoute=0,ResolveAddressNames=FALSE,SourceRoute=\"\",SourceRouteType=0,Ti\n            meout=4000,TimestampRoute=0,TimeToLive=80,TypeofService=0'\n                    '__PROPERTY_COUNT'               = 24\n                    '__RELPATH'                      = 'Win32_PingStatus.Address=\"DummyServer\",BufferSize=32,NoFragmentation=FALSE,RecordRoute=0,ResolveAddressNames=FALSE,SourceRoute=\"\",SourceRouteType=0,Timeout=4000,TimestampRoute=\n            0,TimeToLive=80,TypeofService=0'\n                    '__SERVER'                       = 'SourceServer'\n                    '__SUPERCLASS'                   = $Null\n                }\n            )\n        }\n\n        Mock Test-DbaDiskAllocation {\n            @(\n                [PSObject]@{\n                    'BlockSize'      = 4096\n                    'IsBestPractice' = $False\n                    'IsSqlDisk'      = $True\n                    'Label'          = $Null\n                    'Name'           = 'C:\\'\n                    'Server'         = 'DummyServer'\n                },\n                [PSObject]@{\n                    'BlockSize'      = 65536\n                    'IsBestPractice' = $True\n                    'IsSqlDisk'      = $True\n                    'Label'          = 'SQL Data'\n                    'Name'           = 'D:\\'\n                    'Server'         = 'DummyServer'\n                },\n                [PSObject]@{\n                    'BlockSize'      = 65536\n                    'IsBestPractice' = $True\n                    'IsSqlDisk'      = $False\n                    'Label'          = 'SQL Archive'\n                    'Name'           = 'F:\\'\n                    'Server'         = 'DummyServer'\n                },\n                [PSObject]@{\n                    'BlockSize'      = 65536\n                    'IsBestPractice' = $True\n                    'IsSqlDisk'      = $True\n                    'Label'          = 'SQL Logs'\n                    'Name'           = 'L:\\'\n                    'Server'         = 'DummyServer'\n                },\n                [PSObject]@{\n                    'BlockSize'      = 65536\n                    'IsBestPractice' = $True\n                    'IsSqlDisk'      = $True\n                    'Label'          = 'SQL Performance'\n                    'Name'           = 'P:\\'\n                    'Server'         = 'DummyServer'\n                }\n            )\n        }\n\n        Mock Test-DbaPowerPlan {\n            [PSObject]@{\n                'ActivePowerPlan'      = 'High performance'\n                'ComputerName'         = [PSObject]@{\n                    'ComputerName'       = 'DummyServer'\n                    'FullName'           = 'DummyServer'\n                    'FullSmoName'        = 'DummyServer'\n                    'InputObject'        = 'DummyServer'\n                    'InstanceName'       = 'MSSQLSERVER'\n                    'IsConnectionString' = $False\n                    'IsLocalHost'        = $False\n                    'LinkedLive'         = $False\n                    'LinkedServer'       = $Null\n                    'NetworkProtocol'    = [Sqlcollaborative.Dbatools.Connection.SqlConnectionProtocol]'Any'\n                    'Port'               = 1433\n                    'SqlComputerName'    = '[DummyServer]'\n                    'SqlFullName'        = '[DummyServer]'\n                    'SqlInstanceName'    = '[MSSQLSERVER]'\n                    'Type'               = [Sqlcollaborative.Dbatools.Parameter.DbaInstanceInputType]'Default'\n                }\n                'isBestPractice'       = $True\n                'RecommendedPowerPlan' = 'High performance'\n            }\n        }\n\n        Mock Test-DbaSpn {\n            @(\n                [PSObject]@{\n                    'Cluster'                = $False\n                    'ComputerName'           = 'DummyServer'\n                    'Credential'             = $Null\n                    'DynamicPort'            = $False\n                    'Error'                  = 'SPN missing'\n                    'InstanceName'           = 'MSSQLSERVER'\n                    'InstanceServiceAccount' = 'Domain\\Account'\n                    'IsSet'                  = $False\n                    'Port'                   = $Null\n                    'RequiredSPN'            = 'MSSQLSvc/DummyServer'\n                    'SqlProduct'             = 'SQL Server 2017 Enterprise Edition: Core-based Licensing (64-bit)'\n                    'TcpEnabled'             = $True\n                    'Warning'                = 'None'\n                },\n                [PSObject]@{\n                    'Cluster'                = $False\n                    'ComputerName'           = 'DummyServer'\n                    'Credential'             = $Null\n                    'DynamicPort'            = $False\n                    'Error'                  = 'SPN missing'\n                    'InstanceName'           = 'NoneDefaultInstance'\n                    'InstanceServiceAccount' = 'Domain\\Account'\n                    'IsSet'                  = $False\n                    'Port'                   = $Null\n                    'RequiredSPN'            = 'MSSQLSvc/DummyServer:NoneDefaultInstance'\n                    'SqlProduct'             = 'SQL Server 2016 Enterprise Edition: Core-based Licensing (64-bit)'\n                    'TcpEnabled'             = $True\n                    'Warning'                = 'None'\n                },\n                [PSObject]@{\n                    'Cluster'                = $False\n                    'ComputerName'           = 'DummyServer'\n                    'Credential'             = $Null\n                    'DynamicPort'            = $False\n                    'Error'                  = 'SPN missing'\n                    'InstanceName'           = 'MSSQLSERVER'\n                    'InstanceServiceAccount' = 'Domain\\Account'\n                    'IsSet'                  = $False\n                    'Port'                   = '1433'\n                    'RequiredSPN'            = 'MSSQLSvc/DummyServer:1433'\n                    'SqlProduct'             = 'SQL Server 2017 Enterprise Edition: Core-based Licensing (64-bit)'\n                    'TcpEnabled'             = $True\n                    'Warning'                = 'None'\n                },\n                [PSObject]@{\n                    'Cluster'                = $False\n                    'ComputerName'           = 'DummyServer'\n                    'Credential'             = $Null\n                    'DynamicPort'            = $False\n                    'Error'                  = 'SPN missing'\n                    'InstanceName'           = 'NoneDefaultInstance'\n                    'InstanceServiceAccount' = 'Domain\\Account'\n                    'IsSet'                  = $False\n                    'Port'                   = '1437'\n                    'RequiredSPN'            = 'MSSQLSvc/DummyServer:1437'\n                    'SqlProduct'             = 'SQL Server 2016 Enterprise Edition: Core-based Licensing (64-bit)'\n                    'TcpEnabled'             = $True\n                    'Warning'                = 'None'\n                }\n            )\n\n        }\n\n        Mock Get-DbaDiskSpace {\n            @(\n                [PSObject]@{\n                    'BlockSize'    = 4096\n                    'Capacity'     = [PSObject]@{\n                        'Byte'     = 42355126272\n                        'Digits'   = 2\n                        'Gigabyte' = 39.4462852478027\n                        'Kilobyte' = 41362428\n                        'Megabyte' = 40392.99609375\n                        'Style'    = [Sqlcollaborative.Dbatools.Utility.SizeStyle]'Dynamic'\n                        'Terabyte' = 0.0385217629373074\n                    }\n                    'ComputerName' = 'DummyServer'\n                    'DriveType'    = 'Local Disk'\n                    'FileSystem'   = 'NTFS'\n                    'Free'         = [PSObject]@{\n                        'Byte'     = 19814010880\n                        'Digits'   = 2\n                        'Gigabyte' = 18.4532356262207\n                        'Kilobyte' = 19349620\n                        'Megabyte' = 18896.11328125\n                        'Style'    = [Sqlcollaborative.Dbatools.Utility.SizeStyle]'Dynamic'\n                        'Terabyte' = 0.0180207379162312\n                    }\n                    'FreeInBytes'  = 19814010880\n                    'FreeInGB'     = 18.45\n                    'FreeInKB'     = 19349620\n                    'FreeInMB'     = 18896.11\n                    'FreeInPB'     = 0\n                    'FreeInTB'     = 0.02\n                    'IsSqlDisk'    = $Null\n                    'Label'        = ''\n                    'Name'         = 'C:\\'\n                    'PercentFree'  = 46.78\n                    'Server'       = 'DummyServer'\n                    'SizeInBytes'  = 42355126272\n                    'SizeInGB'     = 39.45\n                    'SizeInKB'     = 41362428\n                    'SizeInMB'     = 40393\n                    'SizeInPB'     = 0\n                    'SizeInTB'     = 0.04\n                    'Type'         = [Sqlcollaborative.Dbatools.Computer.DriveType]'LocalDisk'\n                },\n                [PSObject]@{\n                    'BlockSize'    = 65536\n                    'Capacity'     = [PSObject]@{\n                        'Byte'     = 153408700416\n                        'Digits'   = 2\n                        'Gigabyte' = 142.872985839844\n                        'Kilobyte' = 149813184\n                        'Megabyte' = 146301.9375\n                        'Style'    = [Sqlcollaborative.Dbatools.Utility.SizeStyle]'Dynamic'\n                        'Terabyte' = 0.139524400234222\n                    }\n                    'ComputerName' = 'DummyServer'\n                    'DriveType'    = 'Local Disk'\n                    'FileSystem'   = 'NTFS'\n                    'Free'         = [PSObject]@{\n                        'Byte'     = 82363809792\n                        'Digits'   = 2\n                        'Gigabyte' = 76.707275390625\n                        'Kilobyte' = 80433408\n                        'Megabyte' = 78548.25\n                        'Style'    = [Sqlcollaborative.Dbatools.Utility.SizeStyle]'Dynamic'\n                        'Terabyte' = 0.0749094486236572\n                    }\n                    'FreeInBytes'  = 82363809792\n                    'FreeInGB'     = 76.71\n                    'FreeInKB'     = 80433408\n                    'FreeInMB'     = 78548.25\n                    'FreeInPB'     = 0\n                    'FreeInTB'     = 0.07\n                    'IsSqlDisk'    = $Null\n                    'Label'        = 'SQL Logs'\n                    'Name'         = 'L:\\'\n                    'PercentFree'  = 53.69\n                    'Server'       = 'DummyServer'\n                    'SizeInBytes'  = 153408700416\n                    'SizeInGB'     = 142.87\n                    'SizeInKB'     = 149813184\n                    'SizeInMB'     = 146301.94\n                    'SizeInPB'     = 0\n                    'SizeInTB'     = 0.14\n                    'Type'         = [Sqlcollaborative.Dbatools.Computer.DriveType]'LocalDisk'\n                },\n                [PSObject]@{\n                    'BlockSize'    = 65536\n                    'Capacity'     = [PSObject]@{\n                        'Byte'     = 382116757504\n                        'Digits'   = 2\n                        'Gigabyte' = 355.873962402344\n                        'Kilobyte' = 373160896\n                        'Megabyte' = 364414.9375\n                        'Style'    = [Sqlcollaborative.Dbatools.Utility.SizeStyle]'Dynamic'\n                        'Terabyte' = 0.347533166408539\n                    }\n                    'ComputerName' = 'DummyServer'\n                    'DriveType'    = 'Local Disk'\n                    'FileSystem'   = 'NTFS'\n                    'Free'         = [PSObject]@{\n                        'Byte'     = 84496482304\n                        'Digits'   = 2\n                        'Gigabyte' = 78.6934814453125\n                        'Kilobyte' = 82516096\n                        'Megabyte' = 80582.125\n                        'Style'    = [Sqlcollaborative.Dbatools.Utility.SizeStyle]'Dynamic'\n                        'Terabyte' = 0.076849102973938\n                    }\n                    'FreeInBytes'  = 84496482304\n                    'FreeInGB'     = 78.69\n                    'FreeInKB'     = 82516096\n                    'FreeInMB'     = 80582.12\n                    'FreeInPB'     = 0\n                    'FreeInTB'     = 0.08\n                    'IsSqlDisk'    = $Null\n                    'Label'        = 'SQL Performance'\n                    'Name'         = 'P:\\'\n                    'PercentFree'  = 22.11\n                    'Server'       = 'DummyServer'\n                    'SizeInBytes'  = 382116757504\n                    'SizeInGB'     = 355.87\n                    'SizeInKB'     = 373160896\n                    'SizeInMB'     = 364414.94\n                    'SizeInPB'     = 0\n                    'SizeInTB'     = 0.35\n                    'Type'         = [Sqlcollaborative.Dbatools.Computer.DriveType]'LocalDisk'\n                },\n                [PSObject]@{\n                    'BlockSize'    = 65536\n                    'Capacity'     = [PSObject]@{\n                        'Byte'     = 42813292544\n                        'Digits'   = 2\n                        'Gigabyte' = 39.8729858398438\n                        'Kilobyte' = 41809856\n                        'Megabyte' = 40829.9375\n                        'Style'    = [Sqlcollaborative.Dbatools.Utility.SizeStyle]'Dynamic'\n                        'Terabyte' = 0.0389384627342224\n                    }\n                    'ComputerName' = 'DummyServer'\n                    'DriveType'    = 'Local Disk'\n                    'FileSystem'   = 'NTFS'\n                    'Free'         = [PSObject]@{\n                        'Byte'     = 42719117312\n                        'Digits'   = 2\n                        'Gigabyte' = 39.7852783203125\n                        'Kilobyte' = 41717888\n                        'Megabyte' = 40740.125\n                        'Style'    = [Sqlcollaborative.Dbatools.Utility.SizeStyle]'Dynamic'\n                        'Terabyte' = 0.0388528108596802\n                    }\n                    'FreeInBytes'  = 42719117312\n                    'FreeInGB'     = 39.79\n                    'FreeInKB'     = 41717888\n                    'FreeInMB'     = 40740.12\n                    'FreeInPB'     = 0\n                    'FreeInTB'     = 0.04\n                    'IsSqlDisk'    = $Null\n                    'Label'        = 'Archive Data (SLOW!)'\n                    'Name'         = 'F:\\'\n                    'PercentFree'  = 99.78\n                    'Server'       = 'DummyServer'\n                    'SizeInBytes'  = 42813292544\n                    'SizeInGB'     = 39.87\n                    'SizeInKB'     = 41809856\n                    'SizeInMB'     = 40829.94\n                    'SizeInPB'     = 0\n                    'SizeInTB'     = 0.04\n                    'Type'         = [Sqlcollaborative.Dbatools.Computer.DriveType]'LocalDisk'\n                },\n                [PSObject]@{\n                    'BlockSize'    = 65536\n                    'Capacity'     = [PSObject]@{\n                        'Byte'     = 580757946368\n                        'Digits'   = 2\n                        'Gigabyte' = 540.872985839844\n                        'Kilobyte' = 567146432\n                        'Megabyte' = 553853.9375\n                        'Style'    = [Sqlcollaborative.Dbatools.Utility.SizeStyle]'Dynamic'\n                        'Terabyte' = 0.528196275234222\n                    }\n                    'ComputerName' = 'DummyServer'\n                    'DriveType'    = 'Local Disk'\n                    'FileSystem'   = 'NTFS'\n                    'Free'         = [PSObject]@{\n                        'Byte'     = 580605968384\n                        'Digits'   = 2\n                        'Gigabyte' = 540.7314453125\n                        'Kilobyte' = 566998016\n                        'Megabyte' = 553709\n                        'Style'    = [Sqlcollaborative.Dbatools.Utility.SizeStyle]'Dynamic'\n                        'Terabyte' = 0.528058052062988\n                    }\n                    'FreeInBytes'  = 580605968384\n                    'FreeInGB'     = 540.73\n                    'FreeInKB'     = 566998016\n                    'FreeInMB'     = 553709\n                    'FreeInPB'     = 0\n                    'FreeInTB'     = 0.53\n                    'IsSqlDisk'    = $Null\n                    'Label'        = 'SQL Data'\n                    'Name'         = 'D:\\'\n                    'PercentFree'  = 99.97\n                    'Server'       = 'DummyServer'\n                    'SizeInBytes'  = 580757946368\n                    'SizeInGB'     = 540.87\n                    'SizeInKB'     = 567146432\n                    'SizeInMB'     = 553853.94\n                    'SizeInPB'     = 0\n                    'SizeInTB'     = 0.53\n                    'Type'         = [Sqlcollaborative.Dbatools.Computer.DriveType]'LocalDisk'\n                }\n            )\n\n        }\n\n        $tags = 'PowerPlan', 'SPN', 'DiskCapacity', 'PingComputer', 'CPUPrioritisation', 'DiskAllocationUnit', 'InstanceConnection'\n\n        $ServerInfo = Get-AllServerInfo -ComputerName Dummy -Tags $tags\n        It \"Should get the right results for PingComputer\" {\n            $serverInfo.PingComputer.Count | Should -Be 3\n            $serverInfo.PingComputer[0].Address | Should -Be 'DummyServer'\n            $serverInfo.PingComputer[0].ProtocolAddress | Should -Be '10.10.10.10'\n            $serverInfo.PingComputer[0].ProtocolAddress | Should -Be '10.10.10.10'\n            $serverInfo.PingComputer[0].ResponseTime | Should -Be 1\n        }\n        It \"Should get the right results for DiskAllocationUnit\" {\n            $serverInfo.DiskAllocation[0].Name | Should -Be 'C:\\'\n            $serverInfo.DiskAllocation[0].isBestPractice| Should -BeFalse\n            $serverInfo.DiskAllocation[0].isSqlDisk| Should -BeTrue\n        }\n        It \"Should get the right results for PowerPlan\" {\n            $serverInfo.PowerPlan | Should -BeTrue\n        }\n        It \"Should get the right results for SPN\" {\n            $serverInfo.SPNs[0].ComputerName | Should -Be 'DummyServer'\n            $serverInfo.SPNs[0].Error | Should -Be 'SPN missing'\n            $serverInfo.SPNs[0].RequiredSPN | Should -Be 'MSSQLSvc/DummyServer'\n        }\n        It \"Should get the right results for DiskCapacity\" {\n            $serverInfo.DiskSpace[0].ComputerName | Should -Be 'DummyServer'\n            $serverInfo.DiskSpace[0].Name | Should -Be 'C:\\'\n            $serverInfo.DiskSpace[0].PercentFree | Should -Be 46.78\n        }\n    }\n\n    Context \"Testing Get-AllServerInfo for Tags Server with a server that doesn't exist\" {\n        Mock Test-Connection {Throw}\n\n        Mock Test-DbaDiskAllocation {Throw}\n\n        Mock Test-DbaPowerPlan {Throw}\n\n        Mock Test-DbaSpn {Throw}\n\n        Mock Get-DbaDiskSpace {Throw}\n\n        $tags = 'PowerPlan', 'SPN', 'DiskCapacity', 'PingComputer', 'CPUPrioritisation', 'DiskAllocationUnit', 'InstanceConnection'\n\n        $ServerInfo = Get-AllServerInfo -ComputerName Dummy -Tags $tags\n        It \"Should get the right results for PingComputer\" {\n            $serverInfo.PingComputer.Count | Should -Be -1 -Because \"This is what the function should return for no server\"\n            $serverInfo.PingComputer[0].Address | Should -BeNullOrEmpty -Because \"This is what the function should return for no server\"\n            $serverInfo.PingComputer[0].ResponseTime  | Should -Be 50000000  -Because \"This is what the function should return for no server\"\n        }\n        It \"Should get the right results for DiskAllocationUnit\" {\n            $serverInfo.DiskAllocation[0].Name | Should -Be '? '  # Yes there is a space for formatting the PowerBi\n            $serverInfo.DiskAllocation[0].isBestPractice| Should -BeFalse\n            $serverInfo.DiskAllocation[0].isSqlDisk| Should -BeTrue\n        }\n        It \"Should get the right results for PowerPlan\" {\n            $serverInfo.PowerPlan | Should -BeFalse\n        }\n        It \"Should get the right results for SPN\" {\n            $serverInfo.SPNs[0].Error | Should -Be 'An Error occurred'\n            $serverInfo.SPNs[0].RequiredSPN | Should -Be 'Dont know the SPN'\n        }\n        It \"Should get the right results for DiskCapacity\" {\n            $serverInfo.DiskSpace.ComputerName| Should -Be 'An Error occurred Dummy'\n            $serverInfo.DiskSpace.Name | Should -Be 'Do not know the Name'\n            $serverInfo.DiskSpace.PercentFree | Should -Be -1\n        }\n    }\n\n    # There is probably a way of using test cases for this and making it dynamic\n    # Some bearded fellow wrote about it!!\n    # https://sqldbawithabeard.com/2017/07/06/writing-dynamic-and-random-tests-cases-for-pester/\n    # But right now I cant see it so this will do\n\n    Context \"Testing Get-AllServerInfo for Tags PowerPlan with a server that exists\" {\n\n        Mock Test-DbaPowerPlan {\n            [PSObject]@{\n                'ActivePowerPlan'      = 'High performance'\n                'ComputerName'         = [PSObject]@{\n                    'ComputerName'       = 'DummyServer'\n                    'FullName'           = 'DummyServer'\n                    'FullSmoName'        = 'DummyServer'\n                    'InputObject'        = 'DummyServer'\n                    'InstanceName'       = 'MSSQLSERVER'\n                    'IsConnectionString' = $False\n                    'IsLocalHost'        = $False\n                    'LinkedLive'         = $False\n                    'LinkedServer'       = $Null\n                    'NetworkProtocol'    = [Sqlcollaborative.Dbatools.Connection.SqlConnectionProtocol]'Any'\n                    'Port'               = 1433\n                    'SqlComputerName'    = '[DummyServer]'\n                    'SqlFullName'        = '[DummyServer]'\n                    'SqlInstanceName'    = '[MSSQLSERVER]'\n                    'Type'               = [Sqlcollaborative.Dbatools.Parameter.DbaInstanceInputType]'Default'\n                }\n                'isBestPractice'       = $True\n                'RecommendedPowerPlan' = 'High performance'\n            }\n        }\n\n        Mock Test-Connection {}\n\n        Mock Test-DbaDiskAllocation {}\n\n        Mock Test-DbaSpn {}\n\n        Mock Get-DbaDiskSpace {}\n\n        $tags = 'PowerPlan'\n\n        $ServerInfo = Get-AllServerInfo -ComputerName Dummy -Tags $tags\n        It \"Should have no results for PingComputer\" {\n            $serverInfo.PingComputer| Should -BeNullOrEmpty\n            $assertMockParams = @{\n                'CommandName' = 'Test-Connection'\n                'Times'       = 0\n                'Exactly'     = $true\n            }\n            Assert-MockCalled @assertMockParams\n        }\n        It \"Should have no results for DiskAllocationUnit\" {\n            $serverInfo.DiskAllocation | Should -BeNullOrEmpty\n\n            $assertMockParams = @{\n                'CommandName' = 'Test-DbaDiskAllocation'\n                'Times'       = 0\n                'Exactly'     = $true\n            }\n            Assert-MockCalled @assertMockParams\n        }\n        It \"Should get the right results for PowerPlan\" {\n            $serverInfo.PowerPlan | Should -BeTrue\n        }\n        It \"Should have no results for SPN\" {\n            $serverInfo.SPNs | Should -BeNullOrEmpty\n            $assertMockParams = @{\n                'CommandName' = 'Test-DbaSPN'\n                'Times'       = 0\n                'Exactly'     = $true\n            }\n            Assert-MockCalled @assertMockParams\n        }\n        It \"Should have no results for DiskCapacity\" {\n            $serverInfo.DiskSpace | Should -BeNullOrEmpty\n            $assertMockParams = @{\n                'CommandName' = 'Get-DbaDiskSpace'\n                'Times'       = 0\n                'Exactly'     = $true\n            }\n            Assert-MockCalled @assertMockParams\n        }\n    }\n\n    Context \"Testing Get-AllServerInfo for Tags PowerPlan with a server that doesn't exist\" {\n        Mock Test-Connection {}\n\n        Mock Test-DbaDiskAllocation {}\n\n        Mock Test-DbaPowerPlan {Throw}\n\n        Mock Test-DbaSpn {}\n\n        Mock Get-DbaDiskSpace {}\n\n        $tags = 'PowerPlan'\n\n        $ServerInfo = Get-AllServerInfo -ComputerName Dummy -Tags $tags\n        It \"Should have no results for PingComputer\" {\n            $serverInfo.PingComputer| Should -BeNullOrEmpty\n        }\n        It \"Should have no results for DiskAllocationUnit\" {\n            $serverInfo.DiskAllocation | Should -BeNullOrEmpty\n        }\n        It \"Should get the right results for PowerPlan\" {\n            $serverInfo.PowerPlan | Should -BeFalse\n        }\n        It \"Should have no results for SPN\" {\n            $serverInfo.SPNs | Should -BeNullOrEmpty\n        }\n        It \"Should have no results for DiskCapacity\" {\n            $serverInfo.DiskSpace | Should -BeNullOrEmpty\n        }\n    }\n\n    Context \"Testing Get-AllServerInfo for Tags PingComputer with a server that exists\" {\n\n        Mock Test-Connection {\n            @(\n                [PSObject]@{\n                    'Address'                        = 'DummyServer'\n                    'BufferSize'                     = 32\n                    'NoFragmentation'                = $False\n                    'PrimaryAddressResolutionStatus' = 0\n                    'ProtocolAddress'                = '10.10.10.10'\n                    'ProtocolAddressResolved'        = ''\n                    'RecordRoute'                    = 0\n                    'ReplyInconsistency'             = $False\n                    'ReplySize'                      = 32\n                    'ResolveAddressNames'            = $False\n                    'ResponseTime'                   = 1\n                    'ResponseTimeToLive'             = 128\n                    'RouteRecord'                    = $Null\n                    'RouteRecordResolved'            = $Null\n                    'SourceRoute'                    = ''\n                    'SourceRouteType'                = 0\n                    'StatusCode'                     = 0\n                    'Timeout'                        = 4000\n                    'TimeStampRecord'                = $Null\n                    'TimeStampRecordAddress'         = $Null\n                    'TimeStampRecordAddressResolved' = $Null\n                    'TimestampRoute'                 = 0\n                    'TimeToLive'                     = 80\n                    'TypeofService'                  = 0\n                    '__CLASS'                        = 'Win32_PingStatus'\n                    '__DERIVATION'                   = @()\n                    '__DYNASTY'                      = 'Win32_PingStatus'\n                    '__GENUS'                        = 2\n                    '__NAMESPACE'                    = 'root\\cimv2'\n                    '__PATH'                         = '\\\\SourceServer\\root\\cimv2:Win32_PingStatus.Address=\"DummyServer\",BufferSize=32,NoFragmentation=FALSE,RecordRoute=0,ResolveAddressNames=FALSE,SourceRoute=\"\",SourceRouteType=0,Ti\n            meout=4000,TimestampRoute=0,TimeToLive=80,TypeofService=0'\n                    '__PROPERTY_COUNT'               = 24\n                    '__RELPATH'                      = 'Win32_PingStatus.Address=\"DummyServer\",BufferSize=32,NoFragmentation=FALSE,RecordRoute=0,ResolveAddressNames=FALSE,SourceRoute=\"\",SourceRouteType=0,Timeout=4000,TimestampRoute=\n            0,TimeToLive=80,TypeofService=0'\n                    '__SERVER'                       = 'SourceServer'\n                    '__SUPERCLASS'                   = $Null\n                },\n                [PSObject]@{\n                    'Address'                        = 'DummyServer'\n                    'BufferSize'                     = 32\n                    'NoFragmentation'                = $False\n                    'PrimaryAddressResolutionStatus' = 0\n                    'ProtocolAddress'                = '10.10.10.10'\n                    'ProtocolAddressResolved'        = ''\n                    'RecordRoute'                    = 0\n                    'ReplyInconsistency'             = $False\n                    'ReplySize'                      = 32\n                    'ResolveAddressNames'            = $False\n                    'ResponseTime'                   = 0\n                    'ResponseTimeToLive'             = 128\n                    'RouteRecord'                    = $Null\n                    'RouteRecordResolved'            = $Null\n                    'SourceRoute'                    = ''\n                    'SourceRouteType'                = 0\n                    'StatusCode'                     = 0\n                    'Timeout'                        = 4000\n                    'TimeStampRecord'                = $Null\n                    'TimeStampRecordAddress'         = $Null\n                    'TimeStampRecordAddressResolved' = $Null\n                    'TimestampRoute'                 = 0\n                    'TimeToLive'                     = 80\n                    'TypeofService'                  = 0\n                    '__CLASS'                        = 'Win32_PingStatus'\n                    '__DERIVATION'                   = @()\n                    '__DYNASTY'                      = 'Win32_PingStatus'\n                    '__GENUS'                        = 2\n                    '__NAMESPACE'                    = 'root\\cimv2'\n                    '__PATH'                         = '\\\\SourceServer\\root\\cimv2:Win32_PingStatus.Address=\"DummyServer\",BufferSize=32,NoFragmentation=FALSE,RecordRoute=0,ResolveAddressNames=FALSE,SourceRoute=\"\",SourceRouteType=0,Ti\n            meout=4000,TimestampRoute=0,TimeToLive=80,TypeofService=0'\n                    '__PROPERTY_COUNT'               = 24\n                    '__RELPATH'                      = 'Win32_PingStatus.Address=\"DummyServer\",BufferSize=32,NoFragmentation=FALSE,RecordRoute=0,ResolveAddressNames=FALSE,SourceRoute=\"\",SourceRouteType=0,Timeout=4000,TimestampRoute=\n            0,TimeToLive=80,TypeofService=0'\n                    '__SERVER'                       = 'SourceServer'\n                    '__SUPERCLASS'                   = $Null\n                },\n                [PSObject]@{\n                    'Address'                        = 'DummyServer'\n                    'BufferSize'                     = 32\n                    'NoFragmentation'                = $False\n                    'PrimaryAddressResolutionStatus' = 0\n                    'ProtocolAddress'                = '10.10.10.10'\n                    'ProtocolAddressResolved'        = ''\n                    'RecordRoute'                    = 0\n                    'ReplyInconsistency'             = $False\n                    'ReplySize'                      = 32\n                    'ResolveAddressNames'            = $False\n                    'ResponseTime'                   = 0\n                    'ResponseTimeToLive'             = 128\n                    'RouteRecord'                    = $Null\n                    'RouteRecordResolved'            = $Null\n                    'SourceRoute'                    = ''\n                    'SourceRouteType'                = 0\n                    'StatusCode'                     = 0\n                    'Timeout'                        = 4000\n                    'TimeStampRecord'                = $Null\n                    'TimeStampRecordAddress'         = $Null\n                    'TimeStampRecordAddressResolved' = $Null\n                    'TimestampRoute'                 = 0\n                    'TimeToLive'                     = 80\n                    'TypeofService'                  = 0\n                    '__CLASS'                        = 'Win32_PingStatus'\n                    '__DERIVATION'                   = @()\n                    '__DYNASTY'                      = 'Win32_PingStatus'\n                    '__GENUS'                        = 2\n                    '__NAMESPACE'                    = 'root\\cimv2'\n                    '__PATH'                         = '\\\\SourceServer\\root\\cimv2:Win32_PingStatus.Address=\"DummyServer\",BufferSize=32,NoFragmentation=FALSE,RecordRoute=0,ResolveAddressNames=FALSE,SourceRoute=\"\",SourceRouteType=0,Ti\n            meout=4000,TimestampRoute=0,TimeToLive=80,TypeofService=0'\n                    '__PROPERTY_COUNT'               = 24\n                    '__RELPATH'                      = 'Win32_PingStatus.Address=\"DummyServer\",BufferSize=32,NoFragmentation=FALSE,RecordRoute=0,ResolveAddressNames=FALSE,SourceRoute=\"\",SourceRouteType=0,Timeout=4000,TimestampRoute=\n            0,TimeToLive=80,TypeofService=0'\n                    '__SERVER'                       = 'SourceServer'\n                    '__SUPERCLASS'                   = $Null\n                }\n            )\n        }\n\n        Mock Test-DbaDiskAllocation {}\n\n        Mock Test-DbaSpn {}\n\n        Mock Get-DbaDiskSpace {}\n\n        $tags = 'PingComputer'\n\n        $ServerInfo = Get-AllServerInfo -ComputerName Dummy -Tags $tags\n        It \"Should have the right  results for PingComputer\" {\n            $serverInfo.PingComputer.Count | Should -Be 3\n            $serverInfo.PingComputer[0].Address | Should -Be 'DummyServer'\n            $serverInfo.PingComputer[0].ProtocolAddress | Should -Be '10.10.10.10'\n            $serverInfo.PingComputer[0].ProtocolAddress | Should -Be '10.10.10.10'\n            $serverInfo.PingComputer[0].ResponseTime | Should -Be 1\n            $assertMockParams = @{\n                'CommandName' = 'Test-Connection'\n                'Times'       = 1\n                'Exactly'     = $true\n            }\n            Assert-MockCalled @assertMockParams\n        }\n        It \"Should have no results for DiskAllocationUnit\" {\n            $serverInfo.DiskAllocation | Should -BeNullOrEmpty\n\n            $assertMockParams = @{\n                'CommandName' = 'Test-DbaDiskAllocation'\n                'Times'       = 0\n                'Exactly'     = $true\n            }\n            Assert-MockCalled @assertMockParams\n        }\n        It \"Should have no results results for PowerPlan\" {\n            $serverInfo.PowerPlan | Should -BeNullOrEmpty\n        }\n        It \"Should have no results for SPN\" {\n            $serverInfo.SPNs | Should -BeNullOrEmpty\n            $assertMockParams = @{\n                'CommandName' = 'Test-DbaSPN'\n                'Times'       = 0\n                'Exactly'     = $true\n            }\n            Assert-MockCalled @assertMockParams\n        }\n        It \"Should have no results for DiskCapacity\" {\n            $serverInfo.DiskSpace | Should -BeNullOrEmpty\n            $assertMockParams = @{\n                'CommandName' = 'Get-DbaDiskSpace'\n                'Times'       = 0\n                'Exactly'     = $true\n            }\n            Assert-MockCalled @assertMockParams\n        }\n    }\n\n    Context \"Testing Get-AllServerInfo for Tags PingComputer with a server that doesn't exist\" {\n        Mock Test-Connection {Throw}\n\n        Mock Test-DbaDiskAllocation {}\n\n        Mock Test-DbaPowerPlan {}\n\n        Mock Test-DbaSpn {}\n\n        Mock Get-DbaDiskSpace {}\n\n        $tags = 'PingComputer'\n\n        $ServerInfo = Get-AllServerInfo -ComputerName Dummy -Tags $tags\n        It \"Should get the right results for PingComputer\" {\n            $serverInfo.PingComputer.Count | Should -Be -1 -Because \"This is what the function should return for no server\"\n            $serverInfo.PingComputer[0].Address | Should -BeNullOrEmpty -Because \"This is what the function should return for no server\"\n            $serverInfo.PingComputer[0].ResponseTime  | Should -Be 50000000  -Because \"This is what the function should return for no server\"\n        }\n        It \"Should have no results for DiskAllocationUnit\" {\n            $serverInfo.DiskAllocation | Should -BeNullOrEmpty\n        }\n        It \"Should have no results for PowerPlan\" {\n            $serverInfo.PowerPlan | Should -BeNullOrEmpty\n        }\n        It \"Should have no results for SPN\" {\n            $serverInfo.SPNs | Should -BeNullOrEmpty\n        }\n        It \"Should have no results for DiskCapacity\" {\n            $serverInfo.DiskSpace | Should -BeNullOrEmpty\n        }\n    }\n\n    Context \"Testing Get-AllServerInfo for Tags DiskAllocationUnit with a server that exists\" {\n\n        Mock Test-Connection { }\n\n        Mock Test-DbaDiskAllocation {\n            @(\n                [PSObject]@{\n                    'BlockSize'      = 4096\n                    'IsBestPractice' = $False\n                    'IsSqlDisk'      = $True\n                    'Label'          = $Null\n                    'Name'           = 'C:\\'\n                    'Server'         = 'DummyServer'\n                },\n                [PSObject]@{\n                    'BlockSize'      = 65536\n                    'IsBestPractice' = $True\n                    'IsSqlDisk'      = $True\n                    'Label'          = 'SQL Data'\n                    'Name'           = 'D:\\'\n                    'Server'         = 'DummyServer'\n                },\n                [PSObject]@{\n                    'BlockSize'      = 65536\n                    'IsBestPractice' = $True\n                    'IsSqlDisk'      = $False\n                    'Label'          = 'SQL Archive'\n                    'Name'           = 'F:\\'\n                    'Server'         = 'DummyServer'\n                },\n                [PSObject]@{\n                    'BlockSize'      = 65536\n                    'IsBestPractice' = $True\n                    'IsSqlDisk'      = $True\n                    'Label'          = 'SQL Logs'\n                    'Name'           = 'L:\\'\n                    'Server'         = 'DummyServer'\n                },\n                [PSObject]@{\n                    'BlockSize'      = 65536\n                    'IsBestPractice' = $True\n                    'IsSqlDisk'      = $True\n                    'Label'          = 'SQL Performance'\n                    'Name'           = 'P:\\'\n                    'Server'         = 'DummyServer'\n                }\n            )\n        }\n\n        Mock Test-DbaSpn {}\n\n        Mock Get-DbaDiskSpace {}\n\n        $tags = 'DiskAllocationUnit'\n\n        $ServerInfo = Get-AllServerInfo -ComputerName Dummy -Tags $tags\n        It \"Should have no results for PingComputer\" {\n            $serverInfo.PingComputer| Should -BeNullOrEmpty\n            $assertMockParams = @{\n                'CommandName' = 'Test-Connection'\n                'Times'       = 0\n                'Exactly'     = $true\n            }\n            Assert-MockCalled @assertMockParams\n        }\n        It \"Should have the right results for DiskAllocationUnit\" {\n            $serverInfo.DiskAllocation[0].Name | Should -Be 'C:\\'\n            $serverInfo.DiskAllocation[0].isBestPractice| Should -BeFalse\n            $serverInfo.DiskAllocation[0].isSqlDisk| Should -BeTrue\n\n            $assertMockParams = @{\n                'CommandName' = 'Test-DbaDiskAllocation'\n                'Times'       = 1\n                'Exactly'     = $true\n            }\n            Assert-MockCalled @assertMockParams\n        }\n        It \"Should have no results results for PowerPlan\" {\n            $serverInfo.PowerPlan | Should -BeNullOrEmpty\n        }\n        It \"Should have no results for SPN\" {\n            $serverInfo.SPNs | Should -BeNullOrEmpty\n            $assertMockParams = @{\n                'CommandName' = 'Test-DbaSPN'\n                'Times'       = 0\n                'Exactly'     = $true\n            }\n            Assert-MockCalled @assertMockParams\n        }\n        It \"Should have no results for DiskCapacity\" {\n            $serverInfo.DiskSpace | Should -BeNullOrEmpty\n            $assertMockParams = @{\n                'CommandName' = 'Get-DbaDiskSpace'\n                'Times'       = 0\n                'Exactly'     = $true\n            }\n            Assert-MockCalled @assertMockParams\n        }\n    }\n\n    Context \"Testing Get-AllServerInfo for Tags DiskAllocationUnit with a server that doesn't exist\" {\n        Mock Test-Connection {}\n\n        Mock Test-DbaDiskAllocation {Throw}\n\n        Mock Test-DbaPowerPlan {}\n\n        Mock Test-DbaSpn {}\n\n        Mock Get-DbaDiskSpace {}\n\n        $tags = 'DiskAllocationUnit'\n\n        $ServerInfo = Get-AllServerInfo -ComputerName Dummy -Tags $tags\n        It \"Should have no results for PingComputer\" {\n            $serverInfo.PingComputer| Should -BeNullOrEmpty\n        }\n        It \"Should have the right results for DiskAllocationUnit\" {\n            $serverInfo.DiskAllocation[0].Name | Should -Be '? '  # Yes there is a space for formatting the PowerBi\n            $serverInfo.DiskAllocation[0].isBestPractice| Should -BeFalse\n            $serverInfo.DiskAllocation[0].isSqlDisk| Should -BeTrue\n        }\n        It \"Should have no results for PowerPlan\" {\n            $serverInfo.PowerPlan | Should -BeNullOrEmpty\n        }\n        It \"Should have no results for SPN\" {\n            $serverInfo.SPNs | Should -BeNullOrEmpty\n        }\n        It \"Should have no results for DiskCapacity\" {\n            $serverInfo.DiskSpace | Should -BeNullOrEmpty\n        }\n    }\n\n    Context \"Testing Get-AllServerInfo for Tags SPN with a server that exists\" {\n\n        Mock Test-Connection { }\n\n        Mock Test-DbaDiskAllocation { }\n\n        Mock Test-DbaSpn {\n            @(\n                [PSObject]@{\n                    'Cluster'                = $False\n                    'ComputerName'           = 'DummyServer'\n                    'Credential'             = $Null\n                    'DynamicPort'            = $False\n                    'Error'                  = 'SPN missing'\n                    'InstanceName'           = 'MSSQLSERVER'\n                    'InstanceServiceAccount' = 'Domain\\Account'\n                    'IsSet'                  = $False\n                    'Port'                   = $Null\n                    'RequiredSPN'            = 'MSSQLSvc/DummyServer'\n                    'SqlProduct'             = 'SQL Server 2017 Enterprise Edition: Core-based Licensing (64-bit)'\n                    'TcpEnabled'             = $True\n                    'Warning'                = 'None'\n                },\n                [PSObject]@{\n                    'Cluster'                = $False\n                    'ComputerName'           = 'DummyServer'\n                    'Credential'             = $Null\n                    'DynamicPort'            = $False\n                    'Error'                  = 'SPN missing'\n                    'InstanceName'           = 'NoneDefaultInstance'\n                    'InstanceServiceAccount' = 'Domain\\Account'\n                    'IsSet'                  = $False\n                    'Port'                   = $Null\n                    'RequiredSPN'            = 'MSSQLSvc/DummyServer:NoneDefaultInstance'\n                    'SqlProduct'             = 'SQL Server 2016 Enterprise Edition: Core-based Licensing (64-bit)'\n                    'TcpEnabled'             = $True\n                    'Warning'                = 'None'\n                },\n                [PSObject]@{\n                    'Cluster'                = $False\n                    'ComputerName'           = 'DummyServer'\n                    'Credential'             = $Null\n                    'DynamicPort'            = $False\n                    'Error'                  = 'SPN missing'\n                    'InstanceName'           = 'MSSQLSERVER'\n                    'InstanceServiceAccount' = 'Domain\\Account'\n                    'IsSet'                  = $False\n                    'Port'                   = '1433'\n                    'RequiredSPN'            = 'MSSQLSvc/DummyServer:1433'\n                    'SqlProduct'             = 'SQL Server 2017 Enterprise Edition: Core-based Licensing (64-bit)'\n                    'TcpEnabled'             = $True\n                    'Warning'                = 'None'\n                },\n                [PSObject]@{\n                    'Cluster'                = $False\n                    'ComputerName'           = 'DummyServer'\n                    'Credential'             = $Null\n                    'DynamicPort'            = $False\n                    'Error'                  = 'SPN missing'\n                    'InstanceName'           = 'NoneDefaultInstance'\n                    'InstanceServiceAccount' = 'Domain\\Account'\n                    'IsSet'                  = $False\n                    'Port'                   = '1437'\n                    'RequiredSPN'            = 'MSSQLSvc/DummyServer:1437'\n                    'SqlProduct'             = 'SQL Server 2016 Enterprise Edition: Core-based Licensing (64-bit)'\n                    'TcpEnabled'             = $True\n                    'Warning'                = 'None'\n                }\n            )\n        }\n\n        Mock Get-DbaDiskSpace {}\n\n        $tags = 'SPN'\n\n        $ServerInfo = Get-AllServerInfo -ComputerName Dummy -Tags $tags\n        It \"Should have no results for PingComputer\" {\n            $serverInfo.PingComputer| Should -BeNullOrEmpty\n            $assertMockParams = @{\n                'CommandName' = 'Test-Connection'\n                'Times'       = 0\n                'Exactly'     = $true\n            }\n            Assert-MockCalled @assertMockParams\n        }\n        It \"Should have no results for DiskAllocationUnit\" {\n            $serverInfo.DiskAllocation | Should -BeNullOrEmpty\n\n            $assertMockParams = @{\n                'CommandName' = 'Test-DbaDiskAllocation'\n                'Times'       = 0\n                'Exactly'     = $true\n            }\n            Assert-MockCalled @assertMockParams\n        }\n        It \"Should have no results results for PowerPlan\" {\n            $serverInfo.PowerPlan | Should -BeNullOrEmpty\n        }\n        It \"Should have the right results for SPN\" {\n            $serverInfo.SPNs[0].ComputerName | Should -Be 'DummyServer'\n            $serverInfo.SPNs[0].Error | Should -Be 'SPN missing'\n            $serverInfo.SPNs[0].RequiredSPN | Should -Be 'MSSQLSvc/DummyServer'\n\n            $assertMockParams = @{\n                'CommandName' = 'Test-DbaSPN'\n                'Times'       = 1\n                'Exactly'     = $true\n            }\n            Assert-MockCalled @assertMockParams\n        }\n        It \"Should have no results for DiskCapacity\" {\n            $serverInfo.DiskSpace | Should -BeNullOrEmpty\n            $assertMockParams = @{\n                'CommandName' = 'Get-DbaDiskSpace'\n                'Times'       = 0\n                'Exactly'     = $true\n            }\n            Assert-MockCalled @assertMockParams\n        }\n    }\n\n    Context \"Testing Get-AllServerInfo for Tags SPN with a server that doesn't exist\" {\n        Mock Test-Connection {}\n\n        Mock Test-DbaDiskAllocation {}\n\n        Mock Test-DbaPowerPlan {}\n\n        Mock Test-DbaSpn {Throw}\n\n        Mock Get-DbaDiskSpace {}\n\n        $tags = 'SPN'\n\n        $ServerInfo = Get-AllServerInfo -ComputerName Dummy -Tags $tags\n        It \"Should have no results for PingComputer\" {\n            $serverInfo.PingComputer| Should -BeNullOrEmpty\n        }\n        It \"Should have no results for DiskAllocationUnit\" {\n            $serverInfo.DiskAllocation| Should -BeNullOrEmpty\n        }\n        It \"Should have no results for PowerPlan\" {\n            $serverInfo.PowerPlan | Should -BeNullOrEmpty\n        }\n        It \"Should have the right results for SPN\" {\n            $serverInfo.SPNs[0].Error | Should -Be 'An Error occurred'\n            $serverInfo.SPNs[0].RequiredSPN | Should -Be 'Dont know the SPN'\n        }\n        It \"Should have no results for DiskCapacity\" {\n            $serverInfo.DiskSpace | Should -BeNullOrEmpty\n        }\n    }\n\n    Context \"Testing Get-AllServerInfo for Tags DiskCapacity with a server that exists\" {\n\n        Mock Test-Connection { }\n\n        Mock Test-DbaDiskAllocation { }\n\n        Mock Test-DbaSpn { }\n\n        Mock Get-DbaDiskSpace {\n            @(\n                [PSObject]@{\n                    'BlockSize'    = 4096\n                    'Capacity'     = [PSObject]@{\n                        'Byte'     = 42355126272\n                        'Digits'   = 2\n                        'Gigabyte' = 39.4462852478027\n                        'Kilobyte' = 41362428\n                        'Megabyte' = 40392.99609375\n                        'Style'    = [Sqlcollaborative.Dbatools.Utility.SizeStyle]'Dynamic'\n                        'Terabyte' = 0.0385217629373074\n                    }\n                    'ComputerName' = 'DummyServer'\n                    'DriveType'    = 'Local Disk'\n                    'FileSystem'   = 'NTFS'\n                    'Free'         = [PSObject]@{\n                        'Byte'     = 19814010880\n                        'Digits'   = 2\n                        'Gigabyte' = 18.4532356262207\n                        'Kilobyte' = 19349620\n                        'Megabyte' = 18896.11328125\n                        'Style'    = [Sqlcollaborative.Dbatools.Utility.SizeStyle]'Dynamic'\n                        'Terabyte' = 0.0180207379162312\n                    }\n                    'FreeInBytes'  = 19814010880\n                    'FreeInGB'     = 18.45\n                    'FreeInKB'     = 19349620\n                    'FreeInMB'     = 18896.11\n                    'FreeInPB'     = 0\n                    'FreeInTB'     = 0.02\n                    'IsSqlDisk'    = $Null\n                    'Label'        = ''\n                    'Name'         = 'C:\\'\n                    'PercentFree'  = 46.78\n                    'Server'       = 'DummyServer'\n                    'SizeInBytes'  = 42355126272\n                    'SizeInGB'     = 39.45\n                    'SizeInKB'     = 41362428\n                    'SizeInMB'     = 40393\n                    'SizeInPB'     = 0\n                    'SizeInTB'     = 0.04\n                    'Type'         = [Sqlcollaborative.Dbatools.Computer.DriveType]'LocalDisk'\n                },\n                [PSObject]@{\n                    'BlockSize'    = 65536\n                    'Capacity'     = [PSObject]@{\n                        'Byte'     = 153408700416\n                        'Digits'   = 2\n                        'Gigabyte' = 142.872985839844\n                        'Kilobyte' = 149813184\n                        'Megabyte' = 146301.9375\n                        'Style'    = [Sqlcollaborative.Dbatools.Utility.SizeStyle]'Dynamic'\n                        'Terabyte' = 0.139524400234222\n                    }\n                    'ComputerName' = 'DummyServer'\n                    'DriveType'    = 'Local Disk'\n                    'FileSystem'   = 'NTFS'\n                    'Free'         = [PSObject]@{\n                        'Byte'     = 82363809792\n                        'Digits'   = 2\n                        'Gigabyte' = 76.707275390625\n                        'Kilobyte' = 80433408\n                        'Megabyte' = 78548.25\n                        'Style'    = [Sqlcollaborative.Dbatools.Utility.SizeStyle]'Dynamic'\n                        'Terabyte' = 0.0749094486236572\n                    }\n                    'FreeInBytes'  = 82363809792\n                    'FreeInGB'     = 76.71\n                    'FreeInKB'     = 80433408\n                    'FreeInMB'     = 78548.25\n                    'FreeInPB'     = 0\n                    'FreeInTB'     = 0.07\n                    'IsSqlDisk'    = $Null\n                    'Label'        = 'SQL Logs'\n                    'Name'         = 'L:\\'\n                    'PercentFree'  = 53.69\n                    'Server'       = 'DummyServer'\n                    'SizeInBytes'  = 153408700416\n                    'SizeInGB'     = 142.87\n                    'SizeInKB'     = 149813184\n                    'SizeInMB'     = 146301.94\n                    'SizeInPB'     = 0\n                    'SizeInTB'     = 0.14\n                    'Type'         = [Sqlcollaborative.Dbatools.Computer.DriveType]'LocalDisk'\n                },\n                [PSObject]@{\n                    'BlockSize'    = 65536\n                    'Capacity'     = [PSObject]@{\n                        'Byte'     = 382116757504\n                        'Digits'   = 2\n                        'Gigabyte' = 355.873962402344\n                        'Kilobyte' = 373160896\n                        'Megabyte' = 364414.9375\n                        'Style'    = [Sqlcollaborative.Dbatools.Utility.SizeStyle]'Dynamic'\n                        'Terabyte' = 0.347533166408539\n                    }\n                    'ComputerName' = 'DummyServer'\n                    'DriveType'    = 'Local Disk'\n                    'FileSystem'   = 'NTFS'\n                    'Free'         = [PSObject]@{\n                        'Byte'     = 84496482304\n                        'Digits'   = 2\n                        'Gigabyte' = 78.6934814453125\n                        'Kilobyte' = 82516096\n                        'Megabyte' = 80582.125\n                        'Style'    = [Sqlcollaborative.Dbatools.Utility.SizeStyle]'Dynamic'\n                        'Terabyte' = 0.076849102973938\n                    }\n                    'FreeInBytes'  = 84496482304\n                    'FreeInGB'     = 78.69\n                    'FreeInKB'     = 82516096\n                    'FreeInMB'     = 80582.12\n                    'FreeInPB'     = 0\n                    'FreeInTB'     = 0.08\n                    'IsSqlDisk'    = $Null\n                    'Label'        = 'SQL Performance'\n                    'Name'         = 'P:\\'\n                    'PercentFree'  = 22.11\n                    'Server'       = 'DummyServer'\n                    'SizeInBytes'  = 382116757504\n                    'SizeInGB'     = 355.87\n                    'SizeInKB'     = 373160896\n                    'SizeInMB'     = 364414.94\n                    'SizeInPB'     = 0\n                    'SizeInTB'     = 0.35\n                    'Type'         = [Sqlcollaborative.Dbatools.Computer.DriveType]'LocalDisk'\n                },\n                [PSObject]@{\n                    'BlockSize'    = 65536\n                    'Capacity'     = [PSObject]@{\n                        'Byte'     = 42813292544\n                        'Digits'   = 2\n                        'Gigabyte' = 39.8729858398438\n                        'Kilobyte' = 41809856\n                        'Megabyte' = 40829.9375\n                        'Style'    = [Sqlcollaborative.Dbatools.Utility.SizeStyle]'Dynamic'\n                        'Terabyte' = 0.0389384627342224\n                    }\n                    'ComputerName' = 'DummyServer'\n                    'DriveType'    = 'Local Disk'\n                    'FileSystem'   = 'NTFS'\n                    'Free'         = [PSObject]@{\n                        'Byte'     = 42719117312\n                        'Digits'   = 2\n                        'Gigabyte' = 39.7852783203125\n                        'Kilobyte' = 41717888\n                        'Megabyte' = 40740.125\n                        'Style'    = [Sqlcollaborative.Dbatools.Utility.SizeStyle]'Dynamic'\n                        'Terabyte' = 0.0388528108596802\n                    }\n                    'FreeInBytes'  = 42719117312\n                    'FreeInGB'     = 39.79\n                    'FreeInKB'     = 41717888\n                    'FreeInMB'     = 40740.12\n                    'FreeInPB'     = 0\n                    'FreeInTB'     = 0.04\n                    'IsSqlDisk'    = $Null\n                    'Label'        = 'Archive Data (SLOW!)'\n                    'Name'         = 'F:\\'\n                    'PercentFree'  = 99.78\n                    'Server'       = 'DummyServer'\n                    'SizeInBytes'  = 42813292544\n                    'SizeInGB'     = 39.87\n                    'SizeInKB'     = 41809856\n                    'SizeInMB'     = 40829.94\n                    'SizeInPB'     = 0\n                    'SizeInTB'     = 0.04\n                    'Type'         = [Sqlcollaborative.Dbatools.Computer.DriveType]'LocalDisk'\n                },\n                [PSObject]@{\n                    'BlockSize'    = 65536\n                    'Capacity'     = [PSObject]@{\n                        'Byte'     = 580757946368\n                        'Digits'   = 2\n                        'Gigabyte' = 540.872985839844\n                        'Kilobyte' = 567146432\n                        'Megabyte' = 553853.9375\n                        'Style'    = [Sqlcollaborative.Dbatools.Utility.SizeStyle]'Dynamic'\n                        'Terabyte' = 0.528196275234222\n                    }\n                    'ComputerName' = 'DummyServer'\n                    'DriveType'    = 'Local Disk'\n                    'FileSystem'   = 'NTFS'\n                    'Free'         = [PSObject]@{\n                        'Byte'     = 580605968384\n                        'Digits'   = 2\n                        'Gigabyte' = 540.7314453125\n                        'Kilobyte' = 566998016\n                        'Megabyte' = 553709\n                        'Style'    = [Sqlcollaborative.Dbatools.Utility.SizeStyle]'Dynamic'\n                        'Terabyte' = 0.528058052062988\n                    }\n                    'FreeInBytes'  = 580605968384\n                    'FreeInGB'     = 540.73\n                    'FreeInKB'     = 566998016\n                    'FreeInMB'     = 553709\n                    'FreeInPB'     = 0\n                    'FreeInTB'     = 0.53\n                    'IsSqlDisk'    = $Null\n                    'Label'        = 'SQL Data'\n                    'Name'         = 'D:\\'\n                    'PercentFree'  = 99.97\n                    'Server'       = 'DummyServer'\n                    'SizeInBytes'  = 580757946368\n                    'SizeInGB'     = 540.87\n                    'SizeInKB'     = 567146432\n                    'SizeInMB'     = 553853.94\n                    'SizeInPB'     = 0\n                    'SizeInTB'     = 0.53\n                    'Type'         = [Sqlcollaborative.Dbatools.Computer.DriveType]'LocalDisk'\n                }\n            )\n\n        }\n\n        $tags = 'DiskCapacity'\n\n        $ServerInfo = Get-AllServerInfo -ComputerName Dummy -Tags $tags\n        It \"Should have no results for PingComputer\" {\n            $serverInfo.PingComputer| Should -BeNullOrEmpty\n            $assertMockParams = @{\n                'CommandName' = 'Test-Connection'\n                'Times'       = 0\n                'Exactly'     = $true\n            }\n            Assert-MockCalled @assertMockParams\n        }\n        It \"Should have no results for DiskAllocationUnit\" {\n            $serverInfo.DiskAllocation | Should -BeNullOrEmpty\n\n            $assertMockParams = @{\n                'CommandName' = 'Test-DbaDiskAllocation'\n                'Times'       = 0\n                'Exactly'     = $true\n            }\n            Assert-MockCalled @assertMockParams\n        }\n        It \"Should have no results results for PowerPlan\" {\n            $serverInfo.PowerPlan | Should -BeNullOrEmpty\n        }\n        It \"Should have no results for SPN\" {\n            $serverInfo.SPNs|Should -BeNullOrEmpty\n            $assertMockParams = @{\n                'CommandName' = 'Test-DbaSPN'\n                'Times'       = 0\n                'Exactly'     = $true\n            }\n            Assert-MockCalled @assertMockParams\n        }\n        It \"Should have the right results for DiskCapacity\" {\n            $serverInfo.DiskSpace[0].ComputerName | Should -Be 'DummyServer'\n            $serverInfo.DiskSpace[0].Name | Should -Be 'C:\\'\n            $serverInfo.DiskSpace[0].PercentFree | Should -Be 46.78\n            $assertMockParams = @{\n                'CommandName' = 'Get-DbaDiskSpace'\n                'Times'       = 1\n                'Exactly'     = $true\n            }\n            Assert-MockCalled @assertMockParams\n        }\n    }\n\n    Context \"Testing Get-AllServerInfo for Tags DiskCapacity with a server that doesn't exist\" {\n        Mock Test-Connection {}\n\n        Mock Test-DbaDiskAllocation {}\n\n        Mock Test-DbaPowerPlan {}\n\n        Mock Test-DbaSpn {}\n\n        Mock Get-DbaDiskSpace {Throw}\n\n        $tags = 'DiskCapacity'\n\n        $ServerInfo = Get-AllServerInfo -ComputerName Dummy -Tags $tags\n        It \"Should have no results for PingComputer\" {\n            $serverInfo.PingComputer| Should -BeNullOrEmpty\n        }\n        It \"Should have no results for DiskAllocationUnit\" {\n            $serverInfo.DiskAllocation| Should -BeNullOrEmpty\n        }\n        It \"Should have no results for PowerPlan\" {\n            $serverInfo.PowerPlan | Should -BeNullOrEmpty\n        }\n        It \"Should have no results for SPN\" {\n            $serverInfo.SPNs| Should -BeNullOrEmpty\n        }\n        It \"Should have the right results for DiskCapacity\" {\n            $serverInfo.DiskSpace.ComputerName| Should -Be 'An Error occurred Dummy'\n            $serverInfo.DiskSpace.Name | Should -Be 'Do not know the Name'\n            $serverInfo.DiskSpace.PercentFree | Should -Be -1\n        }\n    }\n\n    Context \"Testing Get-AllServerInfo for Tags DiskCapacity,SPN,DiskAllocationUnit with a server that exists\" {\n\n        Mock Test-Connection { }\n\n        Mock Test-DbaDiskAllocation {\n            @(\n                [PSObject]@{\n                    'BlockSize'      = 4096\n                    'IsBestPractice' = $False\n                    'IsSqlDisk'      = $True\n                    'Label'          = $Null\n                    'Name'           = 'C:\\'\n                    'Server'         = 'DummyServer'\n                },\n                [PSObject]@{\n                    'BlockSize'      = 65536\n                    'IsBestPractice' = $True\n                    'IsSqlDisk'      = $True\n                    'Label'          = 'SQL Data'\n                    'Name'           = 'D:\\'\n                    'Server'         = 'DummyServer'\n                },\n                [PSObject]@{\n                    'BlockSize'      = 65536\n                    'IsBestPractice' = $True\n                    'IsSqlDisk'      = $False\n                    'Label'          = 'SQL Archive'\n                    'Name'           = 'F:\\'\n                    'Server'         = 'DummyServer'\n                },\n                [PSObject]@{\n                    'BlockSize'      = 65536\n                    'IsBestPractice' = $True\n                    'IsSqlDisk'      = $True\n                    'Label'          = 'SQL Logs'\n                    'Name'           = 'L:\\'\n                    'Server'         = 'DummyServer'\n                },\n                [PSObject]@{\n                    'BlockSize'      = 65536\n                    'IsBestPractice' = $True\n                    'IsSqlDisk'      = $True\n                    'Label'          = 'SQL Performance'\n                    'Name'           = 'P:\\'\n                    'Server'         = 'DummyServer'\n                }\n            )\n        }\n\n        Mock Test-DbaSpn {\n            @(\n                [PSObject]@{\n                    'Cluster'                = $False\n                    'ComputerName'           = 'DummyServer'\n                    'Credential'             = $Null\n                    'DynamicPort'            = $False\n                    'Error'                  = 'SPN missing'\n                    'InstanceName'           = 'MSSQLSERVER'\n                    'InstanceServiceAccount' = 'Domain\\Account'\n                    'IsSet'                  = $False\n                    'Port'                   = $Null\n                    'RequiredSPN'            = 'MSSQLSvc/DummyServer'\n                    'SqlProduct'             = 'SQL Server 2017 Enterprise Edition: Core-based Licensing (64-bit)'\n                    'TcpEnabled'             = $True\n                    'Warning'                = 'None'\n                },\n                [PSObject]@{\n                    'Cluster'                = $False\n                    'ComputerName'           = 'DummyServer'\n                    'Credential'             = $Null\n                    'DynamicPort'            = $False\n                    'Error'                  = 'SPN missing'\n                    'InstanceName'           = 'NoneDefaultInstance'\n                    'InstanceServiceAccount' = 'Domain\\Account'\n                    'IsSet'                  = $False\n                    'Port'                   = $Null\n                    'RequiredSPN'            = 'MSSQLSvc/DummyServer:NoneDefaultInstance'\n                    'SqlProduct'             = 'SQL Server 2016 Enterprise Edition: Core-based Licensing (64-bit)'\n                    'TcpEnabled'             = $True\n                    'Warning'                = 'None'\n                },\n                [PSObject]@{\n                    'Cluster'                = $False\n                    'ComputerName'           = 'DummyServer'\n                    'Credential'             = $Null\n                    'DynamicPort'            = $False\n                    'Error'                  = 'SPN missing'\n                    'InstanceName'           = 'MSSQLSERVER'\n                    'InstanceServiceAccount' = 'Domain\\Account'\n                    'IsSet'                  = $False\n                    'Port'                   = '1433'\n                    'RequiredSPN'            = 'MSSQLSvc/DummyServer:1433'\n                    'SqlProduct'             = 'SQL Server 2017 Enterprise Edition: Core-based Licensing (64-bit)'\n                    'TcpEnabled'             = $True\n                    'Warning'                = 'None'\n                },\n                [PSObject]@{\n                    'Cluster'                = $False\n                    'ComputerName'           = 'DummyServer'\n                    'Credential'             = $Null\n                    'DynamicPort'            = $False\n                    'Error'                  = 'SPN missing'\n                    'InstanceName'           = 'NoneDefaultInstance'\n                    'InstanceServiceAccount' = 'Domain\\Account'\n                    'IsSet'                  = $False\n                    'Port'                   = '1437'\n                    'RequiredSPN'            = 'MSSQLSvc/DummyServer:1437'\n                    'SqlProduct'             = 'SQL Server 2016 Enterprise Edition: Core-based Licensing (64-bit)'\n                    'TcpEnabled'             = $True\n                    'Warning'                = 'None'\n                }\n            )\n\n        }\n\n        Mock Get-DbaDiskSpace {\n            @(\n                [PSObject]@{\n                    'BlockSize'    = 4096\n                    'Capacity'     = [PSObject]@{\n                        'Byte'     = 42355126272\n                        'Digits'   = 2\n                        'Gigabyte' = 39.4462852478027\n                        'Kilobyte' = 41362428\n                        'Megabyte' = 40392.99609375\n                        'Style'    = [Sqlcollaborative.Dbatools.Utility.SizeStyle]'Dynamic'\n                        'Terabyte' = 0.0385217629373074\n                    }\n                    'ComputerName' = 'DummyServer'\n                    'DriveType'    = 'Local Disk'\n                    'FileSystem'   = 'NTFS'\n                    'Free'         = [PSObject]@{\n                        'Byte'     = 19814010880\n                        'Digits'   = 2\n                        'Gigabyte' = 18.4532356262207\n                        'Kilobyte' = 19349620\n                        'Megabyte' = 18896.11328125\n                        'Style'    = [Sqlcollaborative.Dbatools.Utility.SizeStyle]'Dynamic'\n                        'Terabyte' = 0.0180207379162312\n                    }\n                    'FreeInBytes'  = 19814010880\n                    'FreeInGB'     = 18.45\n                    'FreeInKB'     = 19349620\n                    'FreeInMB'     = 18896.11\n                    'FreeInPB'     = 0\n                    'FreeInTB'     = 0.02\n                    'IsSqlDisk'    = $Null\n                    'Label'        = ''\n                    'Name'         = 'C:\\'\n                    'PercentFree'  = 46.78\n                    'Server'       = 'DummyServer'\n                    'SizeInBytes'  = 42355126272\n                    'SizeInGB'     = 39.45\n                    'SizeInKB'     = 41362428\n                    'SizeInMB'     = 40393\n                    'SizeInPB'     = 0\n                    'SizeInTB'     = 0.04\n                    'Type'         = [Sqlcollaborative.Dbatools.Computer.DriveType]'LocalDisk'\n                },\n                [PSObject]@{\n                    'BlockSize'    = 65536\n                    'Capacity'     = [PSObject]@{\n                        'Byte'     = 153408700416\n                        'Digits'   = 2\n                        'Gigabyte' = 142.872985839844\n                        'Kilobyte' = 149813184\n                        'Megabyte' = 146301.9375\n                        'Style'    = [Sqlcollaborative.Dbatools.Utility.SizeStyle]'Dynamic'\n                        'Terabyte' = 0.139524400234222\n                    }\n                    'ComputerName' = 'DummyServer'\n                    'DriveType'    = 'Local Disk'\n                    'FileSystem'   = 'NTFS'\n                    'Free'         = [PSObject]@{\n                        'Byte'     = 82363809792\n                        'Digits'   = 2\n                        'Gigabyte' = 76.707275390625\n                        'Kilobyte' = 80433408\n                        'Megabyte' = 78548.25\n                        'Style'    = [Sqlcollaborative.Dbatools.Utility.SizeStyle]'Dynamic'\n                        'Terabyte' = 0.0749094486236572\n                    }\n                    'FreeInBytes'  = 82363809792\n                    'FreeInGB'     = 76.71\n                    'FreeInKB'     = 80433408\n                    'FreeInMB'     = 78548.25\n                    'FreeInPB'     = 0\n                    'FreeInTB'     = 0.07\n                    'IsSqlDisk'    = $Null\n                    'Label'        = 'SQL Logs'\n                    'Name'         = 'L:\\'\n                    'PercentFree'  = 53.69\n                    'Server'       = 'DummyServer'\n                    'SizeInBytes'  = 153408700416\n                    'SizeInGB'     = 142.87\n                    'SizeInKB'     = 149813184\n                    'SizeInMB'     = 146301.94\n                    'SizeInPB'     = 0\n                    'SizeInTB'     = 0.14\n                    'Type'         = [Sqlcollaborative.Dbatools.Computer.DriveType]'LocalDisk'\n                },\n                [PSObject]@{\n                    'BlockSize'    = 65536\n                    'Capacity'     = [PSObject]@{\n                        'Byte'     = 382116757504\n                        'Digits'   = 2\n                        'Gigabyte' = 355.873962402344\n                        'Kilobyte' = 373160896\n                        'Megabyte' = 364414.9375\n                        'Style'    = [Sqlcollaborative.Dbatools.Utility.SizeStyle]'Dynamic'\n                        'Terabyte' = 0.347533166408539\n                    }\n                    'ComputerName' = 'DummyServer'\n                    'DriveType'    = 'Local Disk'\n                    'FileSystem'   = 'NTFS'\n                    'Free'         = [PSObject]@{\n                        'Byte'     = 84496482304\n                        'Digits'   = 2\n                        'Gigabyte' = 78.6934814453125\n                        'Kilobyte' = 82516096\n                        'Megabyte' = 80582.125\n                        'Style'    = [Sqlcollaborative.Dbatools.Utility.SizeStyle]'Dynamic'\n                        'Terabyte' = 0.076849102973938\n                    }\n                    'FreeInBytes'  = 84496482304\n                    'FreeInGB'     = 78.69\n                    'FreeInKB'     = 82516096\n                    'FreeInMB'     = 80582.12\n                    'FreeInPB'     = 0\n                    'FreeInTB'     = 0.08\n                    'IsSqlDisk'    = $Null\n                    'Label'        = 'SQL Performance'\n                    'Name'         = 'P:\\'\n                    'PercentFree'  = 22.11\n                    'Server'       = 'DummyServer'\n                    'SizeInBytes'  = 382116757504\n                    'SizeInGB'     = 355.87\n                    'SizeInKB'     = 373160896\n                    'SizeInMB'     = 364414.94\n                    'SizeInPB'     = 0\n                    'SizeInTB'     = 0.35\n                    'Type'         = [Sqlcollaborative.Dbatools.Computer.DriveType]'LocalDisk'\n                },\n                [PSObject]@{\n                    'BlockSize'    = 65536\n                    'Capacity'     = [PSObject]@{\n                        'Byte'     = 42813292544\n                        'Digits'   = 2\n                        'Gigabyte' = 39.8729858398438\n                        'Kilobyte' = 41809856\n                        'Megabyte' = 40829.9375\n                        'Style'    = [Sqlcollaborative.Dbatools.Utility.SizeStyle]'Dynamic'\n                        'Terabyte' = 0.0389384627342224\n                    }\n                    'ComputerName' = 'DummyServer'\n                    'DriveType'    = 'Local Disk'\n                    'FileSystem'   = 'NTFS'\n                    'Free'         = [PSObject]@{\n                        'Byte'     = 42719117312\n                        'Digits'   = 2\n                        'Gigabyte' = 39.7852783203125\n                        'Kilobyte' = 41717888\n                        'Megabyte' = 40740.125\n                        'Style'    = [Sqlcollaborative.Dbatools.Utility.SizeStyle]'Dynamic'\n                        'Terabyte' = 0.0388528108596802\n                    }\n                    'FreeInBytes'  = 42719117312\n                    'FreeInGB'     = 39.79\n                    'FreeInKB'     = 41717888\n                    'FreeInMB'     = 40740.12\n                    'FreeInPB'     = 0\n                    'FreeInTB'     = 0.04\n                    'IsSqlDisk'    = $Null\n                    'Label'        = 'Archive Data (SLOW!)'\n                    'Name'         = 'F:\\'\n                    'PercentFree'  = 99.78\n                    'Server'       = 'DummyServer'\n                    'SizeInBytes'  = 42813292544\n                    'SizeInGB'     = 39.87\n                    'SizeInKB'     = 41809856\n                    'SizeInMB'     = 40829.94\n                    'SizeInPB'     = 0\n                    'SizeInTB'     = 0.04\n                    'Type'         = [Sqlcollaborative.Dbatools.Computer.DriveType]'LocalDisk'\n                },\n                [PSObject]@{\n                    'BlockSize'    = 65536\n                    'Capacity'     = [PSObject]@{\n                        'Byte'     = 580757946368\n                        'Digits'   = 2\n                        'Gigabyte' = 540.872985839844\n                        'Kilobyte' = 567146432\n                        'Megabyte' = 553853.9375\n                        'Style'    = [Sqlcollaborative.Dbatools.Utility.SizeStyle]'Dynamic'\n                        'Terabyte' = 0.528196275234222\n                    }\n                    'ComputerName' = 'DummyServer'\n                    'DriveType'    = 'Local Disk'\n                    'FileSystem'   = 'NTFS'\n                    'Free'         = [PSObject]@{\n                        'Byte'     = 580605968384\n                        'Digits'   = 2\n                        'Gigabyte' = 540.7314453125\n                        'Kilobyte' = 566998016\n                        'Megabyte' = 553709\n                        'Style'    = [Sqlcollaborative.Dbatools.Utility.SizeStyle]'Dynamic'\n                        'Terabyte' = 0.528058052062988\n                    }\n                    'FreeInBytes'  = 580605968384\n                    'FreeInGB'     = 540.73\n                    'FreeInKB'     = 566998016\n                    'FreeInMB'     = 553709\n                    'FreeInPB'     = 0\n                    'FreeInTB'     = 0.53\n                    'IsSqlDisk'    = $Null\n                    'Label'        = 'SQL Data'\n                    'Name'         = 'D:\\'\n                    'PercentFree'  = 99.97\n                    'Server'       = 'DummyServer'\n                    'SizeInBytes'  = 580757946368\n                    'SizeInGB'     = 540.87\n                    'SizeInKB'     = 567146432\n                    'SizeInMB'     = 553853.94\n                    'SizeInPB'     = 0\n                    'SizeInTB'     = 0.53\n                    'Type'         = [Sqlcollaborative.Dbatools.Computer.DriveType]'LocalDisk'\n                }\n            )\n\n        }\n\n\n        $tags = 'DiskCapacity', 'SPN', 'DiskAllocationUnit'\n\n        $ServerInfo = Get-AllServerInfo -ComputerName Dummy -Tags $tags\n        It \"Should have no results for PingComputer\" {\n            $serverInfo.PingComputer| Should -BeNullOrEmpty\n            $assertMockParams = @{\n                'CommandName' = 'Test-Connection'\n                'Times'       = 0\n                'Exactly'     = $true\n            }\n            Assert-MockCalled @assertMockParams\n        }\n        It \"Should get the right results for DiskAllocationUnit\" {\n            $serverInfo.DiskAllocation[0].Name | Should -Be 'C:\\'\n            $serverInfo.DiskAllocation[0].isBestPractice| Should -BeFalse\n            $serverInfo.DiskAllocation[0].isSqlDisk| Should -BeTrue\n        }\n        It \"Should have no results results for PowerPlan\" {\n            $serverInfo.PowerPlan | Should -BeNullOrEmpty\n        }\n        It \"Should get the right results for SPN\" {\n            $serverInfo.SPNs[0].ComputerName | Should -Be 'DummyServer'\n            $serverInfo.SPNs[0].Error | Should -Be 'SPN missing'\n            $serverInfo.SPNs[0].RequiredSPN | Should -Be 'MSSQLSvc/DummyServer'\n        }\n        It \"Should have the right results for DiskCapacity\" {\n            $serverInfo.DiskSpace[0].ComputerName | Should -Be 'DummyServer'\n            $serverInfo.DiskSpace[0].Name | Should -Be 'C:\\'\n            $serverInfo.DiskSpace[0].PercentFree | Should -Be 46.78\n        }\n    }\n    Context \"Testing Get-AllServerInfo for Tags DiskCapacity,SPN,DiskAllocationUnit with a server that doesn't exist\" {\n        Mock Test-Connection {}\n\n        Mock Test-DbaDiskAllocation {Throw}\n\n        Mock Test-DbaPowerPlan {}\n\n        Mock Test-DbaSpn {Throw}\n\n        Mock Get-DbaDiskSpace {Throw}\n\n        $tags = 'DiskCapacity', 'SPN', 'DiskAllocationUnit'\n\n        $ServerInfo = Get-AllServerInfo -ComputerName Dummy -Tags $tags\n        It \"Should have no results for PingComputer\" {\n            $serverInfo.PingComputer| Should -BeNullOrEmpty\n        }\n        It \"Should get the right results for DiskAllocationUnit\" {\n            $serverInfo.DiskAllocation[0].Name | Should -Be '? '  # Yes there is a space for formatting the PowerBi\n            $serverInfo.DiskAllocation[0].isBestPractice| Should -BeFalse\n            $serverInfo.DiskAllocation[0].isSqlDisk| Should -BeTrue\n        }\n        It \"Should have no results for PowerPlan\" {\n            $serverInfo.PowerPlan | Should -BeNullOrEmpty\n        }\n        It \"Should get the right results for SPN\" {\n            $serverInfo.SPNs[0].Error | Should -Be 'An Error occurred'\n            $serverInfo.SPNs[0].RequiredSPN | Should -Be 'Dont know the SPN'\n        }\n        It \"Should have the right results for DiskCapacity\" {\n            $serverInfo.DiskSpace.ComputerName| Should -Be 'An Error occurred Dummy'\n            $serverInfo.DiskSpace.Name | Should -Be 'Do not know the Name'\n            $serverInfo.DiskSpace.PercentFree | Should -Be -1\n        }\n    }\n\n}\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUL01THUaCV9L44n0ZH2D2uzfl\n# cN6gggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz\n# c3VyZWQgSUQgQ29kZSBTaWduaW5nIENBMB4XDTE3MDUwOTAwMDAwMFoXDTIwMDUx\n# MzEyMDAwMFowVzELMAkGA1UEBhMCVVMxETAPBgNVBAgTCFZpcmdpbmlhMQ8wDQYD\n# VQQHEwZWaWVubmExETAPBgNVBAoTCGRiYXRvb2xzMREwDwYDVQQDEwhkYmF0b29s\n# czCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAI8ng7JxnekL0AO4qQgt\n# Kr6p3q3SNOPh+SUZH+SyY8EA2I3wR7BMoT7rnZNolTwGjUXn7bRC6vISWg16N202\n# 1RBWdTGW2rVPBVLF4HA46jle4hcpEVquXdj3yGYa99ko1w2FOWzLjKvtLqj4tzOh\n# K7wa/Gbmv0Si/FU6oOmctzYMI0QXtEG7lR1HsJT5kywwmgcjyuiN28iBIhT6man0\n# Ib6xKDv40PblKq5c9AFVldXUGVeBJbLhcEA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TaWduaW5nIENBAhACwXUo\n# dNXChDGFKtigZGnKMAkGBSsOAwIaBQCgeDAYBgorBgEEAYI3AgEMMQowCKACgACh\n# AoAAMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcCAQsxDjAM\n# BgorBgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBTH7zwJAi7gLC7ht/hzywWrAI8H\n# cDANBgkqhkiG9w0BAQEFAASCAQA7vsLJAEpmYk85S0thhFFsVVMBVLC1dWqUxjkG\n# uy/xOG1cpn0yuHjYvil/CaLcXt1N+paOl0iLk1kI165x+OZ2BC9zw8gbAg/+J/YG\n# 0c0GUOxl03d4ZrqnGapviKWYbPpbADS3UIk5MzdM10g50VTk6ODrQDaJWOZJZ2nS\n# CMJZ9xb7pGVtFYnv6uhK3nv3BquRsyGnRGLSZlBFUQ3GCs535GFkWoyniXuua8Gq\n# rNgI9B5pds9sPJTpMz1OXEgRGbVzI69OIdL39uERVdRIAvETFtAABjs24zQ8R9G6\n# zgjk/thuvbppWavKt8dq691e5ka/NpFN+tgTIZez5zHTCl7c\n# SIG # End signature block\n"
  },
  {
    "path": "developing/Archive/tests/constants.ps1",
    "content": "$script:ModuleRoot = $PSScriptRoot\n$script:localapp = \"$env:localappdata\\dbachecks\"\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUXavwZZOsmcFz+/gLFVZI9FZc\n# xBmgggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQ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uSTNn6n0DIhQqk18aSsq/4pV3CJwdMZ4\n# /WQzYPRjMRtwfU71Jrxzmz5vQlRJYKWOLMq11kza3ia7w5c5\n# SIG # End signature block\n"
  },
  {
    "path": "developing/Archive/tests/functions/Export-DbcConfig.Tests.ps1",
    "content": "﻿\nDescribe \"Export-DbcConfig Unit Tests\" -Tags \"IntegrationTests\" {\n    Context \"Command executes properly and returns proper info\" {\n        BeforeAll {\n            Remove-Item \"$script:localapp\\config.json\" -ErrorAction SilentlyContinue\n            Export-DbcConfig -Path 'TestDrive:\\config.json'\n        }\n        AfterAll {\n            Remove-Item \"$script:localapp\\config.json\" -ErrorAction SilentlyContinue\n        }\n        It \"Should not throw\" {\n            { Export-DbcConfig } | Should -Not -Throw\n        }\n\n        It \"outputs default file without errors\" {\n            (Get-ChildItem \"$script:localapp\\config.json\" -ErrorAction SilentlyContinue) -ne $null | Should -BeTrue\n        }\n\n        It \"outputs a named file without errors\" {\n            Test-Path 'TestDrive:\\config.json' | Should -BeTrue\n        }\n\n        It \"outputs an object\" {\n            $o = Export-DbcConfig -Force\n            $o | Get-Member -Name Open | Should -Not -BeNullOrEmpty\n        }\n    }\n}"
  },
  {
    "path": "developing/Archive/tests/functions/Get-CheckFile.Tests.ps1",
    "content": "Remove-Module dbachecks -ErrorAction SilentlyContinue\nImport-Module \"$PSScriptRoot\\..\\..\\dbachecks.psd1\"\n\n. \"$PSScriptRoot/../../internal/functions/Get-CheckFile.ps1\"\n\nDescribe \"Testing Get-CheckFile function\" {\n    Mock Get-ChildItem {\n        return @(\n            @{ Name = \"One.Tests.ps1\"; FullName = \"C:\\Checks\\One.Tests.ps1\" },\n            @{ Name = \"Two.Tests.ps1\"; FullName = \"C:\\Checks\\Two.Tests.ps1\" },\n            @{ Name = \"Three.Tests.ps1\"; FullName = \"C:\\Checks\\Three.Tests.ps1\" }\n        )\n    } -ParameterFilter { $Path }\n\n    Mock Get-Content {\n        return \"\n# some comments to start with\n\nDescribe `\"First fake check`\" -Tags FirstCheck {\n    Context `\"Some context`\" {\n    }\n}\n\nDescribe `\"Second fake check`\" -Tags SecondCheck, `$filename {\n    Context `\"Some context`\" {\n    }\n}\n\nDescribe `\"Third fake check`\" -Tags ThirdCheck, `$filename {\n    Context `\"Some context`\" {\n    }\n}\n        \".Split([Environment]::NewLine)\n    } -ParameterFilter { $Path -eq \"C:\\Checks\\One.Tests.ps1\" }\n\n    Mock Get-Content {\n        return \"\n`$filename = `$MyInvocation.MyCommand.Name.Replace(`\".Tests.ps1`\", `\"`\")\n\nDescribe `\"Fourth fake check`\" -Tags FourthCheck, CommonTag, `$filename {\n    Context `\"Some context`\" {\n    }\n}\n\nDescribe `\"Fifth fake check`\" -Tags FifthCheck,CommonTag,`$filename {\n    Context `\"Some context`\" {\n    }\n}\n\n# some comments at the end of a file, perhaps a function definition\nfunction Get-MeSomeStuff {\n    param([string]`$whatToGet)\n    process { }\n}\n        \".Split([Environment]::NewLine)\n    } -ParameterFilter { $Path -eq \"C:\\Checks\\Two.Tests.ps1\" }\n\n    Mock Get-Content {\n        return \"\nDescribe `\"Sixth fake check`\" -Tags `\"SixthCheck`\" {\n    Context `\"Some context`\" {\n    }\n}\n        \".Split([Environment]::NewLine)\n    } -ParameterFilter { $Path -eq \"C:\\Checks\\Three.Tests.ps1\" }\n\n    Context \"Testing with files matching by name\" {\n        $cases = @(\n            @{ CheckValue = \"One\"; MatchingFile = \"C:\\Checks\\One.Tests.ps1\" }\n            @{ CheckValue = \"Two\"; MatchingFile = \"C:\\Checks\\Two.Tests.ps1\" }\n            @{ CheckValue = \"Three\"; MatchingFile = \"C:\\Checks\\Three.Tests.ps1\" }\n        )\n\n        It \"<MatchingFile> is found when Check is <CheckValue>\" -TestCases $cases {\n            param([String]$CheckValue, [String]$MatchingFile)\n            $result = @(Get-CheckFile -Repo \"FakeRepo\" -Check $CheckValue)\n            $result.Count | Should -Be 1 -Because \"we expect exactly one file\"\n            $result[0] | Should -Be $MatchingFile -Because \"we expect specific file\"\n        }\n\n        It \"When two files match, both should be returned\" {\n            $result = @(Get-CheckFile -Repo \"FakeRepo\" -Check One,three)\n            $result.Count | Should -Be 2 -Because \"we expect exactly two files, one and three\"\n        }\n    }\n\n    Context \"Testing with files matching by tag\" {\n        $cases = @(\n            @{ CheckValue = \"FirstCheck\"; MatchingFile = \"C:\\Checks\\One.Tests.ps1\" }\n            @{ CheckValue = \"SecondCheck\"; MatchingFile = \"C:\\Checks\\One.Tests.ps1\" }\n            @{ CheckValue = \"ThirdCheck\"; MatchingFile = \"C:\\Checks\\One.Tests.ps1\" }\n            @{ CheckValue = \"FourthCheck\"; MatchingFile = \"C:\\Checks\\Two.Tests.ps1\" }\n            @{ CheckValue = \"FifthCheck\"; MatchingFile = \"C:\\Checks\\Two.Tests.ps1\" }\n            @{ CheckValue = \"SixthCheck\"; MatchingFile = \"C:\\Checks\\Three.Tests.ps1\" }\n        )\n\n        It \"<MatchingFile> is found when Check is <CheckValue>\" -TestCases $cases {\n            param([String]$CheckValue, [String]$MatchingFile)\n            $result = @(Get-CheckFile -Repo \"FakeRepo\" -Check $CheckValue)\n            $result.Count | Should -Be 1 -Because \"we expect exactly one file\"\n        }\n\n        It \"When two files match, both should be returned\" {\n            $result = @(Get-CheckFile -Repo \"FakeRepo\" -Check SecondCheck,SixthCheck)\n            $result.Count | Should -Be 2 -Because \"we expect exactly two files, one and three\"\n        }\n    }\n\n    Context \"Testing to make sure duplicates are not returned\" {\n        $cases = @(\n            @{ CheckValue = \"One,FirstCheck\"; MatchingFile = \"C:\\Checks\\One.Tests.ps1\" }\n            @{ CheckValue = \"One,FirstCheck,SecondCheck\"; MatchingFile = \"C:\\Checks\\One.Tests.ps1\" }\n            @{ CheckValue = \"Two,FourthCheck,InvalidCheck\"; MatchingFile = \"C:\\Checks\\Two.Tests.ps1\" }\n            @{ CheckValue = \"Three,Three,Three\"; MatchingFile = \"C:\\Checks\\Three.Tests.ps1\" }\n        )\n\n        It \"<MatchingFile> is found when Check is <CheckValue>\" -TestCases $cases {\n            param([String]$CheckValue, [String]$MatchingFile)\n            $result = @(Get-CheckFile -Repo \"FakeRepo\" -Check $CheckValue.Split(\",\"))\n            $result.Count | Should -Be 1 -Because \"we expect exactly one file\"\n        }\n    }\n    # test for duplicates\n\n\n    Context \"Testing things that don't match\" {\n        It \"If there is no match, no file should be returned\" {\n            $result = @(Get-CheckFile -Repo \"FakeRepo\" -Check \"NotMatchingAnything\")\n            $result.Count | Should -Be 0 -Because \"we don't expect any matches to NotMatchingAnything\"\n        }\n    }\n}\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUEvVWSy+gQvt0tsmQfwVbN135\n# wU+gggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz\n# c3VyZWQgSUQgQ29kZSBTaWduaW5nIENBMB4XDTE3MDUwOTAwMDAwMFoXDTIwMDUx\n# MzEyMDAwMFowVzELMAkGA1UEBhMCVVMxETAPBgNVBAgTCFZpcmdpbmlhMQ8wDQYD\n# VQQHEwZWaWVubmExETAPBgNVBAoTCGRiYXRvb2xzMREwDwYDVQQDEwhkYmF0b29s\n# czCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAI8ng7JxnekL0AO4qQgt\n# Kr6p3q3SNOPh+SUZH+SyY8EA2I3wR7BMoT7rnZNolTwGjUXn7bRC6vISWg16N202\n# 1RBWdTGW2rVPBVLF4HA46jle4hcpEVquXdj3yGYa99ko1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A1UEChMM\n# RGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQD\n# EyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgQ29kZSBTaWduaW5nIENBAhACwXUo\n# dNXChDGFKtigZGnKMAkGBSsOAwIaBQCgeDAYBgorBgEEAYI3AgEMMQowCKACgACh\n# AoAAMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcCAQsxDjAM\n# BgorBgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBRTTyU4WE6SB0PPxqULWt3QOzSe\n# vDANBgkqhkiG9w0BAQEFAASCAQAcVYWr9PB+SwhN9enLdr2/knqP/NvEi7cId6bK\n# luTaPcx+JeM0Hwjk15Ct4ilpoVq321ITl9CmCZLGc6c+OC0F6PrAiWsf40LQX3h2\n# ytNN0oHDZTlw2EwO83zXwnFVPR1QjyyD+S7A6sN+Vx0ft5oRFF8pZPdK1STZB/h3\n# 80TDP5y2MyeAV9DXfu5NXCtElYiRxwWXzHwQU9CNn2MBEyIVWXo9D7/dxt+AxJ6Z\n# e+ClrTCh8vwEvSgrpJ5Oa3bH0oVFg6u03oavCe/iWMm/oMHuzjLjdTvDE/PpM2Wh\n# FkZhF5aifj++Ptxpv0I4HifhX5RMlUT/mX5qLpJeplVY9Yes\n# SIG # End signature block\n"
  },
  {
    "path": "developing/Archive/tests/functions/Get-CheckInformation.tests.ps1",
    "content": "$ModuleBase = Split-Path -Parent $MyInvocation.MyCommand.Path\nRemove-Module dbachecks -ErrorAction SilentlyContinue\nImport-Module \"$PSScriptRoot\\..\\..\\dbachecks.psd1\"\n. $ModuleBase\\..\\..\\internal\\functions\\Get-CheckInformation.ps1\nDescribe \"Testing Get-CheckInformation\" -Tag Get-CheckInformation, Unittest {\n    Context \"Input\" {\n        It \"Should have a Group Parameter\"{\n        (Get-Command Get-CheckInformation).Parameters['group'] | Should -Not -BeNullOrEmpty -Because 'We are using this parameter'\n        }\n        It \"Should have a Check Parameter\"{\n        (Get-Command Get-CheckInformation).Parameters['Check'] | Should -Not -BeNullOrEmpty -Because 'We are using this parameter'\n        }\n        It \"Should have a AllChecks Parameter\"{\n        (Get-Command Get-CheckInformation).Parameters['AllChecks'] | Should -Not -BeNullOrEmpty -Because 'We are using this parameter'\n        }\n        It \"Should have a ExcludeCheck Parameter\"{\n        (Get-Command Get-CheckInformation).Parameters['ExcludeCheck'] | Should -Not -BeNullOrEmpty -Because 'We are using this parameter'\n        }\n    }\n    Context \"Output\" {\n        $results = (Get-Content $ModuleBase\\get-check.json) -join \"`n\"| ConvertFrom-Json\n        Mock Get-DbcCheck {$results.Where{$_.Group -eq $Group}} -ParameterFilter {$Group -and $Group -in ('Server','Database')}\n        It \"Should Return All of the checks for a group when the Check equals the group and nothing excluded\" {\n            Get-CheckInformation -Group Server -Check Server | Should -Be 'PowerPlan', 'InstanceConnection', 'Connectivity', 'SPN', 'DiskCapacity', 'Storage', 'DISA', 'PingComputer', 'CPUPrioritisation', 'DiskAllocationUnit' -Because 'When the Check is specified and is a group it should return all of the tags for that group and not the groupname if nothing is exclueded'\n        }\n        It \"Should Return All of the checks for a group When AllChecks is specified and nothing excluded\" {\n            Get-CheckInformation -Group Server -AllChecks $true | Should -Be 'PowerPlan', 'InstanceConnection', 'Connectivity', 'SPN', 'DiskCapacity', 'Storage', 'DISA', 'PingComputer', 'CPUPrioritisation', 'DiskAllocationUnit' -Because 'When AllChecks is specified  it should return all of the tags for that group and not the groupname if nothing is excluded'\n        }\n        It \"Should Return one check for a group when one unique tag is specified and nothing excluded\" {\n            Get-CheckInformation -Group Server -Check SPN | Should -Be  'SPN' -Because 'When a Check is specified it should return just that check'\n        }\n        It \"Should Return two checks for a group when two unique tags are specified and nothing excluded\" {\n            Get-CheckInformation -Group Server -Check SPN,InstanceConnection | Should -Be  'SPN', 'InstanceConnection' -Because 'When a Check is specified it should return just that check'\n        }\n        It \"Should return a the unique tags for the none-unique tag if a none-unique tag is specified and nothing is excluded\"{\n            Get-CheckInformation -Group Database -Check LastBackup | Should -Be 'TestLastBackup', 'TestLastBackupVerifyOnly', 'LastFullBackup', 'LastDiffBackup', 'LastLogBackup' -Because 'When a none-unique tag is specified it should return all of the unique tags'\n        }\n        It \"Should return the unique tags for the none-unique tags if two none-unique tags are specified and nothing is excluded\"{\n            Get-CheckInformation -Group Database -Check LastBackup, MaxDop  | Should -Be 'TestLastBackup', 'TestLastBackupVerifyOnly', 'LastFullBackup', 'LastDiffBackup', 'LastLogBackup', 'MaxDopDatabase', 'MaxDopInstance' -Because 'When a none-unique tag is specified it should return all of the unique tags'\n        }\n        It \"Should Return All of the checks for a group except the excluded ones when the Check equals the group and one check is excluded\" {\n            Get-CheckInformation -Group Server -Check Server -ExcludeCheck PowerPlan | Should -Be  'InstanceConnection', 'Connectivity', 'SPN', 'DiskCapacity', 'Storage', 'DISA', 'PingComputer', 'CPUPrioritisation', 'DiskAllocationUnit' -Because 'When the Check is specified and is a group it should return all of the tags for that group except the excluded one and not the groupname'\n        }\n        It \"Should Return All of the checks for a group except the excluded ones when the Check equals the group and two checks are excluded\" {\n            Get-CheckInformation -Group Server -Check Server -ExcludeCheck PowerPlan, CPUPrioritisation | Should -Be  'InstanceConnection', 'Connectivity', 'SPN', 'DiskCapacity', 'Storage', 'DISA', 'PingComputer', 'DiskAllocationUnit' -Because 'When the Check is specified and is a group it should return all of the tags for that group except the excluded ones and not the groupname'\n        }\n        It \"Should Return All of the checks for a group except the excluded ones when AllChecks is specified and one check is excluded\" {\n            Get-CheckInformation -Group Server -AllChecks $true -ExcludeCheck PowerPlan | Should -Be  'InstanceConnection', 'Connectivity', 'SPN', 'DiskCapacity', 'Storage', 'DISA', 'PingComputer', 'CPUPrioritisation', 'DiskAllocationUnit' -Because 'When the Check is specified and is a group it should return all of the tags for that group except the excluded one and not the groupname'\n        }\n        It \"Should Return All of the checks for a group except the excluded ones when AllChecks is specified and two checks are excluded\" {\n            Get-CheckInformation -Group Server --AllChecks $true -ExcludeCheck PowerPlan, CPUPrioritisation | Should -Be  'InstanceConnection', 'Connectivity', 'SPN', 'DiskCapacity', 'Storage', 'DISA', 'PingComputer', 'DiskAllocationUnit' -Because 'When the Check is specified and is a group it should return all of the tags for that group except the excluded ones and not the groupname'\n        }\n        It \"Mocks Get-DbcCheck\"{\n            $assertMockParams = @{\n                'CommandName' = 'Get-DbcCheck'\n                'Times'       = 10\n                'Exactly'     = $true\n                }\n                Assert-MockCalled @assertMockParams\n        }\n    }\n}\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQU/QO1w1t2IvaGC48k1oxNvLTw\n# ihugggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz\n# c3VyZWQgSUQgQ29kZSBTaWduaW5nIENBMB4XDTE3MDUwOTAwMDAwMFoXDTIwMDUx\n# MzEyMDAwMFowVzELMAkGA1UEBhMCVVMxETAPBgNVBAgTCFZpcmdpbmlhMQ8wDQYD\n# VQQHEwZWaWVubmExETAPBgNVBAoTCGRiYXRvb2xzMREwDwYDVQQDEwhkYmF0b29s\n# czCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAI8ng7JxnekL0AO4qQgt\n# Kr6p3q3SNOPh+SUZH+SyY8EA2I3wR7BMoT7rnZNolTwGjUXn7bRC6vISWg16N202\n# 1RBWdTGW2rVPBVLF4HA46jle4hcpEVquXdj3yGYa99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MGA1UEChMM\n# RGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQD\n# EyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgQ29kZSBTaWduaW5nIENBAhACwXUo\n# dNXChDGFKtigZGnKMAkGBSsOAwIaBQCgeDAYBgorBgEEAYI3AgEMMQowCKACgACh\n# AoAAMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcCAQsxDjAM\n# BgorBgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBT/f5aMZz9Q/1Idd5KPTcOMvSRj\n# vzANBgkqhkiG9w0BAQEFAASCAQBig6LSjIhmtoxk9Aaz3f5L7LibHHQf5Nht8xZ1\n# ear+piGGYvKCA9oYQ9JgMlKaljsIBDyzLHp+61I3dDx+id/a52tOz382xZY011wv\n# mzx5S+fgkUCwQFdF4V93C1T8o+GH6IABFUl97gDyZDiBM+YS6xwr6mQvkAkM6bUh\n# 5I4+34W3+PwKZE+BSXV9vwaSlTpM7J5WQ48pkuhx5Y9G9QqKwhTnABj8lyvewjlt\n# G6EUcZhgLJVOkFpEJdUz6pcgkYwx/9m7j1uG5MDMOdRS0Nhw8EXoVvZZdvyN9Tdf\n# M2y2sO4xvt8ScdWvV0kzZ2PhEUhK793AgcTJWOrRVDc5HNJM\n# SIG # End signature block\n"
  },
  {
    "path": "developing/Archive/tests/functions/Get-DatabaseDetail.Tests.ps1",
    "content": "[cmdletbinding()]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', '', Justification='Because they are used just doesnt see them')]\nParam()\n$commandname = $MyInvocation.MyCommand.Name.Replace(\".Tests.ps1\", \"\")\nRemove-Module dbachecks -ErrorAction SilentlyContinue\nRemove-Module dbatools  -ErrorAction SilentlyContinue\nImport-Module \"$PSScriptRoot\\..\\..\\dbachecks.psd1\"\n\n. \"$PSScriptRoot/../../internal/functions/Get-DatabaseDetail.ps1\"\n\nDescribe \"Integration testing of $commandname\" -Tags SqlIntegrationTests,IntegrationTests, Integration {\n    @(Get-DbcConfigValue testing.integration.instance).ForEach{\n        Context \"Collecting database details for checks from $psitem\" {\n            BeforeAll {\n                $expectedProperties = @{\n                    ServerCollation = [string]\n                    SqlInstance = [string]\n                    SqlVersion = [int]\n                    DatabaseCollation = [string]\n                    CurrentOwner = [string]\n                    AutoShrink = [bool]\n                    AutoClose = [bool]\n                    AutoCreateStatisticsEnabled = [bool]\n                    AutoUpdateStatisticsEnabled = [bool]\n                    AutoUpdateStatisticsAsync = [bool]\n                    Trustworthy = [bool]\n                    PageVerify = [string]\n                    SuspectPages = [int]\n                    Status = [string]\n                }\n\n                $script:databases = (Get-DatabaseDetail -SqlInstance $psitem)\n            }\n\n            It \"Execution of Get-DatabaseDetail should not throw exceptions\" {\n                { Get-DatabaseDetail -SqlInstance $psitem } | Should -Not -Throw -Because \"we expect data not exceptions\"\n            }\n\n            It \"Get-DatabaseDetail should return at least the system databases\" {\n                $script:databases.Count | Should -BeGreaterOrEqual 4 -Because \"we expect at least to have the system databases on any instance\"\n            }\n\n            foreach($property in $expectedProperties.Keys) {\n                It \"Each database has $property which is not null or empty\" {\n                    $script:databases.\"$property\".ForEach{\n                        $psitem | Should -Not -BeNullOrEmpty\n                    }\n                }\n            }\n\n            foreach($property in $expectedProperties.Keys) {\n                if ($expectedProperties[$property] -eq $null) {\n                    continue\n                }\n\n                It \"$property property should be of type $($expectedProperties[$property].ToString())\" {\n                    $script:databases.\"$property\".ForEach{\n                        $psitem | Should -BeOfType ($expectedProperties[$property])\n                    }\n                }\n            }\n        }\n    }\n}\n\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFK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zs6BqiermaBjyU0S+VvRCbZ\n# uvUSOnLzgIRpxsYPGY+jzZhi7nhhkouLJoQXH7wR8VWtaCjQLkrdKkrrzLYmjD0y\n# 1l1j0MDrd8Dy0vsgRcEoxbGBIjAN1PINP0oH5LyFqNPmDf3vnM3M79bmqTZT41d1\n# UlG6Y6kd+AXzCkXJr3+bqknOanggaEUxqTKoYamkHvZz+5dVvu6eLhXMyJVTuyRo\n# hCOA5PM2+GIvos5ZJ1LfXRq1nM1BsO5H0UKkyAemFZr2KV9X\n# SIG # End signature block\n"
  },
  {
    "path": "developing/Archive/tests/functions/Get-DbcCheck.Tests.ps1",
    "content": "﻿Remove-Module dbachecks -ErrorAction SilentlyContinue\nImport-Module \"$PSScriptRoot\\..\\..\\dbachecks.psd1\"\n. \"$PSScriptRoot\\..\\constants.ps1\"\n\nDescribe \"Testing Get-DbCCheck\" -Tag Get-DbCCheck, Unittest {\n    Context \"Input\" {\n        It \"Should have a Tag Parameter\"{\n        (Get-Command Get-DbCCheck).Parameters['Tag'] | Should -Not -BeNullOrEmpty -Because 'We are using this parameter'\n        }\n        It \"Should have a Pattern Parameter\"{\n        (Get-Command Get-DbCCheck).Parameters['Pattern'] | Should -Not -BeNullOrEmpty -Because 'We are using this parameter'\n        }\n        It \"Should have a Group Parameter\"{\n        (Get-Command Get-DbCCheck).Parameters['Group'] | Should -Not -BeNullOrEmpty -Because 'We are using this parameter'\n        }\n    }\n}\n\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQU+aKL5ZgO2MPUE6cSCTGF7Ejo\n# E1+gggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQ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f5C3u6P33N/bYAxJhd188L/Vhoww722J2\n# tKFJiyCWgqE0G+OCqVj63z1JDlT+k382htuWtfUZDehEsJlWvScmzq1i1QevkwlN\n# iiiDPc0RPhFLvJOhEXdG3YpqZva6xxdEWZyumFp3xjsT5xHX\n# SIG # End signature block\n"
  },
  {
    "path": "developing/Archive/tests/functions/Get-DbcConfig.Tests.ps1",
    "content": "﻿[cmdletbinding()]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', '', Justification='Because they are used just doesnt see them')]\nParam()\n$commandname = $MyInvocation.MyCommand.Name.Replace(\".Tests.ps1\", \"\")\n\n. \"$PSScriptRoot\\..\\constants.ps1\"\n\nDescribe \"$commandname Unit Tests\" -Tags UnitTest {\n    Context \"Command executes properly and returns proper info\" {\n        BeforeAll {\n            $results = Get-DbcConfig\n            $specific = Get-DbcConfig -Name policy.database.autoclose\n            $multiple = Get-DbcConfig -Name skip.tempdb1118,skip.tempdbfilecount\n        }\n\n        It \"returns a number of configs\" {\n            ($results).Count -gt 10 | Should -BeTrue\n        }\n\n        It \"returns a single bool\" {\n            $specific.Value -eq $true -or $specific.Value -eq $false | Should -BeTrue\n        }\n\n        It \"returns results for each config provided\" {\n            $multiple.Count -eq 2 | Should -BeTrue\n        }\n    }\n}\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUjnpD6usDE2Ytxn6EjA6yBB0a\n# LWGgggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGln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AjUTZiW2VSUnM7vLfKvy798ZoV487G\n# 4PFgKfsZ1kSckUbDwgZtC03hCToprsh4vYIDcy9+PYxSB663\n# SIG # End signature block\n"
  },
  {
    "path": "developing/Archive/tests/functions/Get-DbcConfigValue.Tests.ps1",
    "content": "﻿[cmdletbinding()]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', '', Justification='Because they are used just doesnt see them')]\nParam()\n\n$commandname = $MyInvocation.MyCommand.Name.Replace(\".Tests.ps1\", \"\")\n\n. \"$PSScriptRoot\\..\\constants.ps1\"\n\nDescribe \"$commandname Unit Tests\" -Tags UnitTest {\n    Context \"Command executes properly and returns proper info\" {\n        BeforeAll {\n            $results = Get-DbcConfigValue -Name policy.database.autoclose\n        }\n        It \"returns a single bool\" {\n            $results -eq $true -or $results -eq $false | Should -BeTrue\n        }\n    }\n}\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUnPTLzEcDXLdmsE97pKgEZRYy\n# EaegggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz\n# c3VyZWQgSUQgQ29kZSBTaWduaW5nIENBMB4XDTE3MDUwOTAwMDAwMFoXDTIwMDUx\n# MzEyMDAwMFowVzELMAkGA1UEBhMCVVMxETAPBgNVBAgTCFZpcmdpbmlhMQ8wDQYD\n# VQQHEwZWaWVubmExETAPBgNVBAoTCGRiYXRvb2xzMREw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USaJ/P\n# QMtARKUT8OZkDCUIQjKyNookAv4vcn4c10lFluhZHen6dGRrsutmQ9qzsIzV6Q3d\n# 9gEgzpkxYz0IGhizgZtPxpMQBvwHgfqL2vmCSfdibqFT+hKUGIUukpHqaGxEMrJm\n# oecYpJpkUe8xggIoMIICJAIBATCBhjByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMM\n# RGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQD\n# EyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgQ29kZSBTaWduaW5nIENBAhACwXUo\n# dNXChDGFKtigZGnKMAkGBSsOAwIaBQCgeDAYBgorBgEEAYI3AgEMMQowCKACgACh\n# AoAAMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcCAQsxDjAM\n# BgorBgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBTk8IOjDoRx1m1KaMdWf2fkb7vY\n# mjANBgkqhkiG9w0BAQEFAASCAQBeVLVjcjOCGGmoqQHqB/Vdpn9HPtsP7rQNCFg6\n# tEGpaqO7BHBbPZOcLWvJPd6G8zK4o1M54O7xqaY8X43mA9WMvk4LZCD/zdPa6LWR\n# C/yRZcyQf9Ca3h2QFB4+LrHa3WXBf2fhsX3NhFFoiqFYVmrt1Nkq489O0e0fy0v3\n# IPCRgbmX2D2gUV2IUpmA19Nd1z0MtPLLPncU2x+bFMQgToLCYxf6cN8Koeuytgj8\n# 9lWZ1Q2umbwtWzeRiW/PA7JJ5h539F+iGKXGomCfHgBzTAqWoABN405VXAo4FX/7\n# Jib9WtDIqdp1wDAzyjCG5uMc8F4KI1LldZQdHruOlll5waUX\n# SIG # End signature block\n"
  },
  {
    "path": "developing/Archive/tests/functions/Get-DbcTagCollection.Tests.ps1",
    "content": "﻿$commandname = $MyInvocation.MyCommand.Name.Replace(\".Tests.ps1\", \"\")\n. \"$PSScriptRoot\\..\\constants.ps1\"\n\nDescribe \"$commandname Unit Tests\" -Tags UnitTest {\n    Context \"Command executes properly and returns proper info\" {\n        $results = Get-DbcTagCollection\n        $count = ($results).Count\n\n        It \"returns a number of tags\" {\n            $count -gt 10 | Should -BeTrue\n        }\n\n        It \"returns a unique number of tags\" {\n            ($results | Sort-Object | Select-Object -Unique).Count | Should -Be $count\n        }\n    }\n}\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUFv2FO6gM4Xos6qAixAoES6/J\n# pbagggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz\n# c3VyZWQgSUQgQ29kZSBTaWduaW5nIENBMB4XDTE3MDUwOTAwMDAwMFoXDTIwMDUx\n# MzEyMDAwMFowVzELMAkGA1UEBhMCVVMxETAPBgNVBAgTCFZpcmdpbmlhMQ8wDQYD\n# VQQHEwZWaWVubmExETAPBgNVBAoTCGRiYXRvb2xzMREwDwYDVQQDEwhkYmF0b29s\n# czCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAI8ng7JxnekL0AO4qQgt\n# Kr6p3q3SNOPh+SUZH+SyY8EA2I3wR7BMoT7rnZNolTwGjUXn7bRC6vISWg16N202\n# 1RBWdTGW2rVPBVLF4HA46jle4hcpEVquXdj3yGYa99ko1w2FOWzLjKvtLqj4tzOh\n# K7wa/Gbmv0Si/FU6oOmctzYMI0QXtEG7lR1HsJT5kywwmgcjyuiN28iBIhT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aWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgQ29kZSBTaWduaW5nIENBAhACwXUo\n# dNXChDGFKtigZGnKMAkGBSsOAwIaBQCgeDAYBgorBgEEAYI3AgEMMQowCKACgACh\n# AoAAMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcCAQsxDjAM\n# BgorBgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBT9q4/nFgZ5r0wQADWLmPLiIJz8\n# DzANBgkqhkiG9w0BAQEFAASCAQBOFBNJRbyDKiBWm+aYnb2Cm+4LUvc0RTdhspSh\n# MEwx/bAaI0esvYw4BJhOoCBllrtc7pJW+/1cGhTvvx/HaAfGQPqp7dSHHTYsRj8Q\n# 4OK7ornRm8rmPKiOY5AC83+g7ZSuTZ+cUukYEOmieoiEtoC2mNnpBv+Xg9N852PN\n# 79WX806uWf7bJTXbX5nCIvd9oqgALIVcsbQ8TEkGQgC5tt4VVBat5ZZh4sm1eKSD\n# AvcZ0Sb/zi5EQQVXbyv4LuuuU8E1bmpWKrvfS16HdW7yg31XGwm5VJ8D92W2WWKm\n# CTZFHyfdF8cp1RvDIwS/E4odFRWP66w+vijnSzE3CLcAjptH\n# SIG # End signature block\n"
  },
  {
    "path": "developing/Archive/tests/functions/Import-DbcConfig.Tests.ps1",
    "content": "﻿$commandname = $MyInvocation.MyCommand.Name.Replace(\".Tests.ps1\", \"\")\n. \"$PSScriptRoot\\..\\constants.ps1\"\n\nDescribe \"$commandname Unit Tests\" -Tags UnitTest {\n    Context \"Command executes properly and returns proper info\" {\n        BeforeAll {\n            Export-DbcConfig -Force *>$null\n        }\n        AfterAll {\n            Remove-Item \"$script:localapp\\config.json\" -ErrorAction SilentlyContinue\n        }\n\n        It \"returns a bunch of results\" {\n            $results = Import-DbcConfig -Path \"$script:localapp\\config.json\" -WarningAction SilentlyContinue -WarningVariable warns 3>$null\n            ($results).Count -gt 10 | Should -BeTrue\n        }\n        It -Skip \"returns some results for app.checkrepos\" { #skip till I get the syntax right\n            ($results | Where-Object name -eq app.checkrepos) -ne $null | Should -BeTrue\n        }\n    }\n}\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUVEfB09qwuaqHyqMsj0slnnWS\n# lfmgggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz\n# c3VyZWQgSUQgQ29kZSBTaWduaW5nIENBMB4XDTE3MDUwOTAwMDAwMFoXDTIwMDUx\n# MzEyMDAwMFowVzELMAkGA1UEBhMCVVMxETAPBgNVBAgTCFZpcmdpbmlhMQ8wDQYD\n# VQQHEwZWaWVubmExETAPBgNVBAoTCGRiYXRvb2xzMREwDwYDVQQDEwhkYmF0b29s\n# czCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAI8ng7JxnekL0AO4qQgt\n# Kr6p3q3SNOPh+SUZH+SyY8EA2I3wR7BMoT7rnZNolTwGjUXn7bRC6vISWg16N202\n# 1RBWdTGW2rVPBVLF4HA46jle4hcpEVquXdj3yGYa99ko1w2FOWzLjKvtLqj4tzOh\n# K7wa/Gbmv0Si/FU6oOmctzYMI0QXtEG7lR1HsJT5kywwmgcjyuiN28iBIhT6man0\n# Ib6xKDv40PblKq5c9AFVldXUGVeBJbLhcEAA1nSPSLGdc7j4J2SulGISYY7ocuX3\n# tkv01te72Mv2KkqqpfkLEAQjXgtM0hlgwuc8/A4if+I0YtboCMkVQuwBpb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AAMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcCAQsxDjAM\n# BgorBgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBT+oFRIiIegkkfrxXRlG9rfdb81\n# 9zANBgkqhkiG9w0BAQEFAASCAQBbrHQR4MBOQk2mL/lmHG8buO1xVjGiVs1vAl0W\n# lKKvIrJ7QUjz2iO7hUu3PKARtBxBS1CWB3mUjMgxtgF3wpHsf/sgCgdWQygLIaXq\n# IaO9TcJGjclC7Kmle/hD8pMhVN2/Mua7cX5pq0lHGQKsu/0Jj4LoVwXMu7W9sLAg\n# GdAf1xKOgW6/FSTzi9A5n1EHdEI+DK/7lTYKUgTq/Xtkavlm6WVSeq4vaB73cdGf\n# tdlMBHm2vnJPYnyseNxprfQLw90XzjSCYFXE0H+MvUJ6twpwG3kz6jvw0SUDSLMw\n# 1DErBUaYfILccZKqI13zATBD2pRN7scq1CwZFm6bXIPK7UsQ\n# SIG # End signature block\n"
  },
  {
    "path": "developing/Archive/tests/functions/Invoke-DbcCheck.Tests.ps1",
    "content": "﻿$commandname = $MyInvocation.MyCommand.Name.Replace(\".Tests.ps1\", \"\")\n. \"$PSScriptRoot\\..\\constants.ps1\"\n\nDescribe \"$commandname Unit Tests\" -Tags IntegrationTests, Integration {\n    @(Get-DbcConfigValue testing.integration.instance).ForEach{\n        Context \"Command executes properly and returns proper info on $psitem\" {\n            It \"runs a check\" {\n                $results = Invoke-DbcCheck -ComputerName $psitem -Tag DiskCapacity -Passthru -Show None\n                $results.TestResult | Should Not Be $null # Because nothing else works right now\n            }\n        }\n    }\n}\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQU1zYGWWVD6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BIcK1lsV6f09KRD4h+jDtNrinkUCAQ9+lpOvX+6bEaWPCZjH9XIsYvKqEN0I\n# Z9IzqSxt5/3KED7GV2Z314YlW6TZ79vhghv5Sp4fPDUwvQqVwGOR6SdS5QM3VoE4\n# NiimNswl8+nlIlHqpKtDkF353/lWHVCnuG5tBWn+FhX0V7N0I1nU/0RfhLjHsDWS\n# IEsNhD+cd6Zhi1yBrgHTBO5uMG44TCoCtNNjo3Mr8hBDG9bU\n# SIG # End signature block\n"
  },
  {
    "path": "developing/Archive/tests/functions/Invoke-DbcConfigFile.Tests.ps1",
    "content": "﻿$commandname = $MyInvocation.MyCommand.Name.Replace(\".Tests.ps1\", \"\")\n. \"$PSScriptRoot\\..\\constants.ps1\"\n\nDescribe \"$commandname Unit Tests\" -Tags UnitTest {\n    Context \"Command executes properly and returns proper info\" {\n        BeforeAll {\n            Remove-Item \"$script:localapp\\config.json\" -ErrorAction SilentlyContinue\n        }\n\n        It \"returns a warning\" {\n            Invoke-DbcConfigFile -Path \"$script:localapp\\config.json\" -WarningAction SilentlyContinue -WarningVariable warning *>$null\n            $warning | Should not be $null\n        }\n    }\n}\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQU5hKAnOebIWwtzECQ3CmorRbt\n# KXigggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz\n# c3VyZWQgSUQgQ29kZSBTaWduaW5nIENBMB4XDTE3MD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  },
  {
    "path": "developing/Archive/tests/functions/Set-DbcConfig.Tests.ps1",
    "content": "﻿[cmdletbinding()]\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', '', Justification='Because they are used just doesnt see them')]\nParam()\n\n$commandname = $MyInvocation.MyCommand.Name.Replace(\".Tests.ps1\", \"\")\n. \"$PSScriptRoot\\..\\constants.ps1\"\n\nDescribe \"$commandname Unit Tests\" -Tags UnitTest {\n    Context \"Command executes properly and returns proper info\" {\n        BeforeAll {\n            $config = Get-DbcConfig -Name policy.dump.maxcount\n        }\n        AfterAll {\n            $result = Set-DbcConfig -Name policy.dump.maxcount -Value $config.Value\n        }\n        $result = Set-DbcConfig -Name policy.dump.maxcount -Value ($config.Value + 1)\n        It \"sets a config\" {\n            $result.Value | Should -Be ($config.Value + 1)\n        }\n    }\n}\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUMXfFTmifTVD5Eg3faOsEEtqo\n# +cigggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz\n# c3VyZWQgSUQgQ29kZSBTaWduaW5nIENBMB4XDTE3MDUwOTAwMDAwMFoXDTIwMDUx\n# MzEyMDAwMFowVzELMAkGA1UEBhMCVVMxETAPBgNVBAgTCFZpcmdpbmlhMQ8wDQYD\n# VQQHEwZWaWVubmExETAPBgNVBAoTCGRiYXRvb2xzMREwDwYDVQQDEw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QMtARKUT8OZkDCUIQjKyNookAv4vcn4c10lFluhZHen6dGRrsutmQ9qzsIzV6Q3d\n# 9gEgzpkxYz0IGhizgZtPxpMQBvwHgfqL2vmCSfdibqFT+hKUGIUukpHqaGxEMrJm\n# oecYpJpkUe8xggIoMIICJAIBATCBhjByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMM\n# RGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQD\n# EyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgQ29kZSBTaWduaW5nIENBAhACwXUo\n# dNXChDGFKtigZGnKMAkGBSsOAwIaBQCgeDAYBgorBgEEAYI3AgEMMQowCKACgACh\n# AoAAMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcCAQsxDjAM\n# BgorBgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBS7zyZiTlxogVd75omcLLLzMhst\n# OTANBgkqhkiG9w0BAQEFAASCAQBheoVEIkczFmUzxFlBCDktW1jVFsx4SFezYm/t\n# Ex9du3WxDalP5Q43Ymcuw3ajbWMTmkXVvt3ueE89LFP0dbf7d9PYTJTLaOB1wYJH\n# OaCVedX4Xmjf3DnS2WtKAHKcnlhZ/vrUS3Hpwdk+bh/B/JxHmz07y/yr6mgR7eeb\n# qSuN3xXPQJDmvc6iYCRy20N4WCnTsjr+fh40YeqeE3fL6F9fJfanqa/WA2JxKebj\n# 8ltnlt78MLB48FAYiTBF7ib2kotO6H0ZDpWwIYb6gxjHffpIjMoJsJyakR/AQ90C\n# LmYVm5h+MO5PogKBCDqPtR6RhQQkRmmI5zOtnBv0U4JF1n1N\n# SIG # End signature block\n"
  },
  {
    "path": "developing/Archive/tests/functions/Set-DbcFile.Tests.ps1",
    "content": "$commandname = $MyInvocation.MyCommand.Name.Replace(\".Tests.ps1\", \"\")\nRemove-Module dbachecks -ErrorAction SilentlyContinue\n# Import-Module \"$PSScriptRoot\\..\\..\\dbachecks.psd1\"\n. \"$PSScriptRoot\\..\\..\\functions\\Set-DbcFile.ps1\"\n. \"$PSScriptRoot\\..\\..\\functions\\Convert-DbcResult.ps1\"\n. \"$PSScriptRoot\\..\\constants.ps1\"\n\n\nDescribe \"$commandname Unit Tests\" -Tags UnitTest, Set-DbcFile {\n    Context \"Parameters and parameter sets\" {\n        $ParametersList =  'InputObject','FilePath', 'FileName', 'FileType', 'Append', 'Force'\n\n        $ParametersList.ForEach{\n            It \"$commandname Should have a mandatory parameter $psitem\" {\n                (Get-Command $commandname ).Parameters[$psitem].Attributes.Mandatory | Should -BeTrue -Because \"These parameters need to be mandatory because of the Parameter Sets\"\n            }\n            It \"$commandname Should have a parameter $psitem\" {\n                (Get-Command $commandname ).Parameters[$psitem].Count | Should -Be 1 -Because \"This parameter should exist\"\n            }\n        }\n        $ParameterSets = 'Default', 'Append', 'Force'\n        $ParameterSets.ForEach{\n            It \"$commandname should have a parameter set named $psitem\" {\n                (Get-Command Set-DbcFile).ParameterSets.Name | Should -Contain $psitem -Because \"We need these parameter sets so users cannot run with force and append\"\n            }\n        }\n    }\n}\n\nDescribe \"$commandname Unit Tests - Execution\" -Tags UnitTest, Set-DbcFile {\n    Context \"Execution\" {\n        # So that we dont get any output in the tests but can test for It\n        Mock Write-PSFMessage { } -ParameterFilter { $Level -and $Level -eq 'Significant' }\n        Mock Write-PSFMessage { } -ParameterFilter { $Level -and $Level -eq 'Verbose' }\n        Mock Write-PSFMessage { } -ParameterFilter { $Level -and $Level -eq 'Output' }\n        Mock Write-PSFMessage { } -ParameterFilter { $Level -and $Level -eq 'Warning' }\n        # So that we dont create files\n        Mock Export-Csv { }\n        Mock ConvertTo-Json {'dummy'}\n        Mock Out-File { }\n        Mock Export-Clixml { }\n\n        $TheTestResults = Get-Content $PSScriptRoot\\results.json -raw | ConvertFrom-Json\n        It \"Should produce an error message if test results are not passed via pipeline and stop\" {\n            # mock for test-path to fail\n            Mock Test-Path {}\n            $Nothing | Set-DbcFile -FilePath DummyDirectory -FileName DummyFileName -FileType CSV  -ErrorAction SilentlyContinue\n\n            #Check that Test-Path mock was not called\n            $assertMockParams = @{\n                'CommandName'     = 'Test-Path'\n                'Times'           = 0\n                'Exactly'         = $true\n                'Scope'           = 'It'\n            }\n            { Assert-MockCalled @assertMockParams } | Should -Not -Throw -Because \"Did we check for directory - we should not have - Because we need to know that the Mocks are working\"\n\n            #Check that correct Write-PsfMessage mock was called\n            $assertMockParams = @{\n                'CommandName'     = 'Write-PsfMessage'\n                'Times'           = 1\n                'Exactly'         = $true\n                'ParameterFilter' = { $Level -and $Level -eq 'Significant' }\n                'Scope'           = 'It'\n            }\n            { Assert-MockCalled @assertMockParams } | Should -Not -Throw -Because \"Did we provide Significant output - Because we need to know that the Mocks are working\"\n            #Check that correct Write-PsfMessage mock was called\n            $assertMockParams = @{\n                'CommandName'     = 'Write-PsfMessage'\n                'Times'           = 1\n                'Exactly'         = $true\n                'ParameterFilter' = { $Level -and $Level -eq 'Verbose' }\n                'Scope'           = 'It'\n            }\n            { Assert-MockCalled @assertMockParams } | Should -Not -Throw -Because \"Did we provide Verbose output - Because we need to know that the Mocks are working\"\n\n            #Check that correct Write-PsfMessage mock was called\n            $assertMockParams = @{\n                'CommandName'     = 'Write-PsfMessage'\n                'Times'           = 1\n                'Exactly'         = $true\n                'ParameterFilter' = { $Level -and $Level -eq 'Warning' }\n                'Scope'           = 'It'\n            }\n            { Assert-MockCalled @assertMockParams } | Should -Not -Throw -Because \"Did we provide Warning output - Because we need to know that the Mocks are working\"\n        }\n        It \"Should produce an error message if the path does not exist or we cannot access it\" {\n            # mock for test-path to fail\n            Mock Test-Path { $false } -ParameterFilter { $Path -and $Path -eq 'DummyDirectory' }\n            Mock Test-Path { $false } -ParameterFilter { $Path -and $Path -eq 'DummyDirectory\\DummyFileName' }\n\n            Set-DbcFile -InputObject $TheTestResults -FilePath DummyDirectory -FileName DummyFileName -FileType CSV  -verbose\n\n            #Check that Test-Path mock was called\n            $assertMockParams = @{\n                'CommandName'     = 'Test-Path'\n                'Times'           = 1\n                'Exactly'         = $true\n                'ParameterFilter' = { $Path -and $Path -eq 'DummyDirectory' }\n                'Scope'           = 'It'\n            }\n            { Assert-MockCalled @assertMockParams } | Should -Not -Throw -Because \"Did we check for directory - Because we need to know that the Mocks are working\"\n\n            #Check that Test-Path mock was not called\n            $assertMockParams = @{\n                'CommandName'     = 'Test-Path'\n                'Times'           = 0\n                'Exactly'         = $true\n                'ParameterFilter' = { $Path -and $Path -eq 'DummyDirectory\\DummyFileName' }\n                'Scope'           = 'It'\n            }\n            { Assert-MockCalled @assertMockParams } | Should -Not -Throw -Because \"Did we check for file - Because we need to know that the Mocks are working\"\n\n            #Check that correct Write-PsfMessage mock was called\n            $assertMockParams = @{\n                'CommandName'     = 'Write-PsfMessage'\n                'Times'           = 1\n                'Exactly'         = $true\n                'ParameterFilter' = { $Level -and $Level -eq 'Significant' }\n                'Scope'           = 'It'\n            }\n            { Assert-MockCalled @assertMockParams } | Should -Not -Throw -Because \"Did we provide Significant output - Because we need to know that the Mocks are working\"\n            #Check that correct Write-PsfMessage mock was called\n            $assertMockParams = @{\n                'CommandName'     = 'Write-PsfMessage'\n                'Times'           = 2\n                'Exactly'         = $true\n                'ParameterFilter' = { $Level -and $Level -eq 'Verbose' }\n                'Scope'           = 'It'\n            }\n            { Assert-MockCalled @assertMockParams } | Should -Not -Throw -Because \"Did we provide Verbose output - Because we need to know that the Mocks are working\"\n        }\n        It \"Should produce a message if the file exists and Force and Append were not specified\" {\n            # mock for test-path to fail\n            Mock Test-Path { $true } -ParameterFilter { $Path -and $Path -eq 'DummyDirectory' }\n            Mock Test-Path { $true } -ParameterFilter { $Path -and $Path -eq 'DummyDirectory\\DummyFileName' }\n\n            Set-DbcFile -InputObject $TheTestResults -FilePath DummyDirectory -FileName DummyFileName -FileType CSV -Verbose\n\n            #Check that Test-Path mock was called\n            $assertMockParams = @{\n                'CommandName'     = 'Test-Path'\n                'Times'           = 1\n                'Exactly'         = $true\n                'ParameterFilter' = { $Path -and $Path -eq 'DummyDirectory' }\n                'Scope'           = 'It'\n            }\n            { Assert-MockCalled @assertMockParams } | Should -Not -Throw -Because \"Did we check for directory - Because we need to know that the Mocks are working\"\n\n            #Check that Test-Path mock was not called\n            $assertMockParams = @{\n                'CommandName'     = 'Test-Path'\n                'Times'           = 1\n                'Exactly'         = $true\n                'ParameterFilter' = { $Path -and $Path -eq 'DummyDirectory\\DummyFileName' }\n                'Scope'           = 'It'\n            }\n            { Assert-MockCalled @assertMockParams } | Should -Not -Throw -Because \"Did we check for file - Because we need to know that the Mocks are working\"\n            #Check that correct Write-PsfMessage mock was called\n            $assertMockParams = @{\n                'CommandName'     = 'Write-PsfMessage'\n                'Times'           = 1\n                'Exactly'         = $true\n                'ParameterFilter' = { $Level -and $Level -eq 'Significant' }\n                'Scope'           = 'It'\n            }\n            { Assert-MockCalled @assertMockParams } | Should -Not -Throw -Because \"Did we provide Significant output - Because we need to know that the Mocks are working\"\n            #Check that correct Write-PsfMessage mock was called\n            $assertMockParams = @{\n                'CommandName'     = 'Write-PsfMessage'\n                'Times'           = 3\n                'Exactly'         = $true\n                'ParameterFilter' = { $Level -and $Level -eq 'Verbose' }\n                'Scope'           = 'It'\n            }\n            { Assert-MockCalled @assertMockParams } | Should -Not -Throw -Because \"Did we provide Verbose output - Because we need to know that the Mocks are working\"\n        }\n        It \"Should produce a verbose message if the file exists and Force was specified\" {\n            # mock for test-path to fail\n            Mock Test-Path { $true } -ParameterFilter { $Path -and $Path -eq 'DummyDirectory' }\n            Mock Test-Path { $true } -ParameterFilter { $Path -and $Path -eq 'DummyDirectory\\DummyFileName' }\n\n            Set-DbcFile -InputObject $TheTestResults -FilePath DummyDirectory -FileName DummyFileName -Force -FileType CSV\n\n            #Check that Test-Path mock was called\n            $assertMockParams = @{\n                'CommandName'     = 'Test-Path'\n                'Times'           = 1\n                'Exactly'         = $true\n                'ParameterFilter' = { $Path -and $Path -eq 'DummyDirectory' }\n                'Scope'           = 'It'\n            }\n            { Assert-MockCalled @assertMockParams } | Should -Not -Throw -Because \"Did we check for directory - Because we need to know that the Mocks are working\"\n\n            #Check that Test-Path mock was not called\n            $assertMockParams = @{\n                'CommandName'     = 'Test-Path'\n                'Times'           = 1\n                'Exactly'         = $true\n                'ParameterFilter' = { $Path -and $Path -eq 'DummyDirectory\\DummyFileName' }\n                'Scope'           = 'It'\n            }\n            { Assert-MockCalled @assertMockParams } | Should -Not -Throw -Because \"Did we check for file - Because we need to know that the Mocks are working\"\n            #Check that correct Write-PsfMessage mock was called\n            $assertMockParams = @{\n                'CommandName'     = 'Write-PsfMessage'\n                'Times'           = 5\n                'Exactly'         = $true\n                'ParameterFilter' = { $Level -and $Level -eq 'Verbose' }\n                'Scope'           = 'It'\n            }\n            { Assert-MockCalled @assertMockParams } | Should -Not -Throw -Because \"Did we provide Verbose output - Because we need to know that the Mocks are working\"\n            #Check that correct Write-PsfMessage mock was called\n            $assertMockParams = @{\n                'CommandName'     = 'Write-PsfMessage'\n                'Times'           = 0\n                'Exactly'         = $true\n                'ParameterFilter' = { $Level -and $Level -eq 'Significant' }\n                'Scope'           = 'It'\n            }\n            { Assert-MockCalled @assertMockParams } | Should -Not -Throw -Because \"Did we provide Significant output - Because we need to know that the Mocks are working\"\n        }\n\n        It \"Should produce a verbose message if the file exists and Append was specified and the filetype is not XML\" {\n            # mock for test-path to fail\n            Mock Test-Path { $true } -ParameterFilter { $Path -and $Path -eq 'DummyDirectory' }\n            Mock Test-Path { $true } -ParameterFilter { $Path -and $Path -eq 'DummyDirectory\\DummyFileName' }\n\n            Set-DbcFile -InputObject $TheTestResults -FilePath DummyDirectory -FileName DummyFileName -FileType CSV -Verbose\n\n            #Check that Test-Path mock was called\n            $assertMockParams = @{\n                'CommandName'     = 'Test-Path'\n                'Times'           = 1\n                'Exactly'         = $true\n                'ParameterFilter' = { $Path -and $Path -eq 'DummyDirectory' }\n                'Scope'           = 'It'\n            }\n            { Assert-MockCalled @assertMockParams } | Should -Not -Throw -Because \"Did we check for directory - Because we need to know that the Mocks are working\"\n\n            #Check that Test-Path mock was not called\n            $assertMockParams = @{\n                'CommandName'     = 'Test-Path'\n                'Times'           = 1\n                'Exactly'         = $true\n                'ParameterFilter' = { $Path -and $Path -eq 'DummyDirectory\\DummyFileName' }\n                'Scope'           = 'It'\n            }\n            { Assert-MockCalled @assertMockParams } | Should -Not -Throw -Because \"Did we check for file - Because we need to know that the Mocks are working\"\n            #Check that correct Write-PsfMessage mock was called\n            $assertMockParams = @{\n                'CommandName'     = 'Write-PsfMessage'\n                'Times'           = 3\n                'Exactly'         = $true\n                'ParameterFilter' = { $Level -and $Level -eq 'Verbose' }\n                'Scope'           = 'It'\n            }\n            { Assert-MockCalled @assertMockParams } | Should -Not -Throw -Because \"Did we provide Verbose output - Because we need to know that the Mocks are working\"\n            #Check that correct Write-PsfMessage mock was called\n            $assertMockParams = @{\n                'CommandName'     = 'Write-PsfMessage'\n                'Times'           = 1\n                'Exactly'         = $true\n                'ParameterFilter' = { $Level -and $Level -eq 'Significant' }\n                'Scope'           = 'It'\n            }\n            { Assert-MockCalled @assertMockParams } | Should -Not -Throw -Because \"Did we provide Significant output - Because we need to know that the Mocks are working\"\n        }\n\n        It \"Should produce a significant message if the file exists and Append was specified and the filetype is XML\" {\n            # mock for test-path to suceed\n            Mock Test-Path { $true } -ParameterFilter { $Path -and $Path -eq 'DummyDirectory' }\n            Mock Test-Path { $true } -ParameterFilter { $Path -and $Path -eq 'DummyDirectory\\DummyFileName' }\n\n            Set-DbcFile -InputObject $TheTestResults -FilePath DummyDirectory -FileName DummyFileName -FileType XML\n\n            #Check that Test-Path mock was called\n            $assertMockParams = @{\n                'CommandName'     = 'Test-Path'\n                'Times'           = 1\n                'Exactly'         = $true\n                'ParameterFilter' = { $Path -and $Path -eq 'DummyDirectory' }\n                'Scope'           = 'It'\n            }\n            { Assert-MockCalled @assertMockParams } | Should -Not -Throw -Because \"Did we check for directory - Because we need to know that the Mocks are working\"\n\n            #Check that Test-Path mock was not called\n            $assertMockParams = @{\n                'CommandName'     = 'Test-Path'\n                'Times'           = 1\n                'Exactly'         = $true\n                'ParameterFilter' = { $Path -and $Path -eq 'DummyDirectory\\DummyFileName' }\n                'Scope'           = 'It'\n            }\n            { Assert-MockCalled @assertMockParams } | Should -Not -Throw -Because \"Did we check for file - Because we need to know that the Mocks are working\"\n            #Check that correct Write-PsfMessage mock was called\n            $assertMockParams = @{\n                'CommandName'     = 'Write-PsfMessage'\n                'Times'           = 3\n                'Exactly'         = $true\n                'ParameterFilter' = { $Level -and $Level -eq 'Verbose' }\n                'Scope'           = 'It'\n            }\n            { Assert-MockCalled @assertMockParams } | Should -Not -Throw -Because \"Did we provide Verbose output - Because we need to know that the Mocks are working\"\n\n            #Check that correct Write-PsfMessage mock was called\n            $assertMockParams = @{\n                'CommandName'     = 'Write-PsfMessage'\n                'Times'           = 1\n                'Exactly'         = $true\n                'ParameterFilter' = { $Level -and $Level -eq 'Significant' }\n                'Scope'           = 'It'\n            }\n            { Assert-MockCalled @assertMockParams } | Should -Not -Throw -Because \"Did we provide Signicificant output - Because we need to know that the Mocks are working\"\n        }\n\n        It \"Should export to csv when called with filetype csv\"{\n    # mock for test-path to suceed\n    Mock Test-Path { $true } -ParameterFilter { $Path -and $Path -eq 'DummyDirectory' }\n    Mock Test-Path { $false } -ParameterFilter { $Path -and $Path -eq 'DummyDirectory\\DummyFileName' }\n    Set-DbcFile -InputObject $TheTestResults -FilePath DummyDirectory -FileName DummyFileName -FileType CSV\n      #Check that correct Export-Csv mock was called\n      $assertMockParams = @{\n        'CommandName'     = 'Export-Csv'\n        'Times'           = 1\n        'Exactly'         = $true\n        'Scope'           = 'It'\n    }\n    { Assert-MockCalled @assertMockParams } | Should -Not -Throw -Because \"Did we output a csv - Because we need to know that the Mocks are working\"\n        }\n        It \"Should export to json when called with filetype json\"{\n    # mock for test-path to suceed\n    Mock Test-Path { $true } -ParameterFilter { $Path -and $Path -eq 'DummyDirectory' }\n    Mock Test-Path { $false } -ParameterFilter { $Path -and $Path -eq 'DummyDirectory\\DummyFileName' }\n    Set-DbcFile -InputObject $TheTestResults -FilePath DummyDirectory -FileName DummyFileName -FileType json\n      #Check that ConvertTo-Json mock was called\n      $assertMockParams = @{\n        'CommandName'     = 'ConvertTo-Json'\n        'Times'           = 1\n        'Exactly'         = $true\n        'Scope'           = 'It'\n    }\n    { Assert-MockCalled @assertMockParams } | Should -Not -Throw -Because \"Did we output a json - Because we need to know that the Mocks are working\"\n      #Check that correct Out-File mock was called\n      $assertMockParams = @{\n        'CommandName'     = 'Out-File'\n        'Times'           = 1\n        'Exactly'         = $true\n        'Scope'           = 'It'\n    }\n    { Assert-MockCalled @assertMockParams } | Should -Not -Throw -Because \"Did we output a json - Because we need to know that the Mocks are working\"\n        }\n        It \"Should export to XML when called with filetype xml\"{\n    # mock for test-path to suceed\n    Mock Test-Path { $true } -ParameterFilter { $Path -and $Path -eq 'DummyDirectory' }\n    Mock Test-Path { $false } -ParameterFilter { $Path -and $Path -eq 'DummyDirectory\\DummyFileName' }\n    Set-DbcFile -InputObject $TheTestResults -FilePath DummyDirectory -FileName DummyFileName -FileType xml\n      #Check that Export-Clixml  mock was called\n      $assertMockParams = @{\n        'CommandName'     = 'Export-Clixml'\n        'Times'           = 1\n        'Exactly'         = $true\n        'Scope'           = 'It'\n    }\n    { Assert-MockCalled @assertMockParams } | Should -Not -Throw -Because \"Did we output a XML - Because we need to know that the Mocks are working\"\n        }\n    }\n}\n\nDescribe \"$commandname integration tests\" -Tag UnitTest ,Set-DbcFile {\n    $TheTestResults = Get-Content $PSScriptRoot\\results.json -raw | ConvertFrom-Json | Convert-DbcResult -Label 'Testing'\n     # So that we dont get any output in the tests but can test for It\n     Mock Write-PSFMessage { } -ParameterFilter { $Level -and $Level -eq 'Output' }\n    Context \"File Creation\"{\n        $TestCases = @{\n            FileName1 = 'DummyFileName'\n            FileName2= 'DummyFileName1.csv'\n            Filetype = 'csv'\n        },\n         @{\n            FileName1 = 'DummyFileName'\n            FileName2= 'DummyFileName1.json'\n            Filetype = 'json'\n        },\n         @{\n            FileName1 = 'DummyFileName'\n            FileName2= 'DummyFileName1.xml'\n            Filetype = 'xml'\n        }\n        It \"Should create a file with an extension .<Filetype> even if the extension is not specified\" -TestCases $TestCases{\n            Param($FileName1,$FileType)\n            Set-DbcFile -InputObject $TheTestResults -FilePath $TestDrive -FileName $FileName1 -FileType $Filetype\n            $FileName = \"$TestDrive\\$filename1\" + '.' + $FileType\n            $FileName| Should -Exist\n        }\n        It \"Should create a file with an extension .<Filetype> if the extension is specified\"-TestCases $TestCases{\n            Param($FileName2,$FileType)\n            Set-DbcFile -InputObject $TheTestResults -FilePath $TestDrive -FileName $FileName2 -FileType $Filetype\n            $FileName = \"$TestDrive\\$FileName2\"\n            $FileName| Should -Exist\n        }\n    }\n\n# Need ot have .* whereveer there is a date as the date is dynamic\n$JsonFileContent = @\"\n    [\n        {\n            \"Date\":  \".*\",\n            \"Label\":  \"Testing\",\n            \"Describe\":  \"Last Good DBCC CHECKDB\",\n            \"Context\":  \"Testing Last Good DBCC CHECKDB\",\n            \"Name\":  \"Database master has Data Purity Enabled\",\n            \"Database\":  \"master\",\n            \"ComputerName\":  \"localhost,15592\",\n            \"Instance\":  \"localhost,15592\",\n            \"Result\":  \"Passed\",\n            \"FailureMessage\":  \"\"\n        },\n        {\n            \"Date\":  \".*\",\n            \"Label\":  \"Testing\",\n            \"Describe\":  \"Last Good DBCC CHECKDB\",\n            \"Context\":  \"Testing Last Good DBCC CHECKDB\",\n            \"Name\":  \"Database master last good integrity check should be less than 3 days old\",\n            \"Database\":  \"master\",\n            \"ComputerName\":  \"localhost,15592\",\n            \"Instance\":  \"localhost,15592\",\n            \"Result\":  \"Failed\",\n            \"FailureMessage\":  \"Expected the actual value to be greater than .*, because You should have run a DBCC CheckDB inside that time, but got .*\"\n        },\n    ]\n\"@\n$CSVFileContent = @\"\n\"Date\",\"Label\",\"Describe\",\"Context\",\"Name\",\"Database\",\"ComputerName\",\"Instance\",\"Result\",\"FailureMessage\"\n\".*\",\"Testing\",\"Last Good DBCC CHECKDB\",\"Testing Last Good DBCC CHECKDB\",\"Database master last good integrity check should be less than 3 days old\",\"master\",\"localhost,15592\",\"localhost,15592\",\"Failed\",\"Expected the actual value to be greater than 2019-12-21T15:21:38.3892727Z, because You should have run a DBCC CheckDB inside that time, but got 2019-12-21T14:41:58.0230000.\"\n\".*\",\"Testing\",\"Last Good DBCC CHECKDB\",\"Testing Last Good DBCC CHECKDB\",\"Database master has Data Purity Enabled\",\"master\",\"localhost,15592\",\"localhost,15592\",\"Passed\",\"\"\n\"@\n$XMLFileContent = @\"\n<Objs Version=\"1.1.0.1\" xmlns=\"http://schemas.microsoft.com/powershell/2004/04\">\n  <Obj RefId=\"0\">\n    <TN RefId=\"0\">\n      <T>Selected.System.Data.DataRow</T>\n      <T>System.Management.Automation.PSCustomObject</T>\n      <T>System.Object</T>\n    </TN>\n    <MS>\n      <DT N=\"Date\">.*</DT>\n      <S N=\"Label\">Testing</S>\n      <S N=\"Describe\">Last Good DBCC CHECKDB</S>\n      <S N=\"Context\">Testing Last Good DBCC CHECKDB</S>\n      <S N=\"Name\">Database master last good integrity check should be less than 3 days old</S>\n      <S N=\"Database\">master</S>\n      <S N=\"ComputerName\">localhost,15592</S>\n      <S N=\"Instance\">localhost,15592</S>\n      <S N=\"Result\">Failed</S>\n      <S N=\"FailureMessage\">Expected the actual value to be greater than .*, because You should have run a DBCC CheckDB inside that time, but got .*</S>\n    </MS>\n  </Obj>\n  <Obj RefId=\"1\">\n    <TNRef RefId=\"0\" />\n    <MS>\n      <DT N=\"Date\">.*</DT>\n      <S N=\"Label\">Testing</S>\n      <S N=\"Describe\">Last Good DBCC CHECKDB</S>\n      <S N=\"Context\">Testing Last Good DBCC CHECKDB</S>\n      <S N=\"Name\">Database master has Data Purity Enabled</S>\n      <S N=\"Database\">master</S>\n      <S N=\"ComputerName\">localhost,15592</S>\n      <S N=\"Instance\">localhost,15592</S>\n      <S N=\"Result\">Passed</S>\n      <S N=\"FailureMessage\"></S>\n    </MS>\n  </Obj>\n</Objs>\n\"@\n\n    Context \"File Content\"{\n        $TestCases = @{\n            FileName1 = 'DummyFileName'\n            FileName2= 'DummyFileName1.csv'\n            Filetype = 'csv'\n            FileContent = $CSVFileContent\n        },\n         @{\n            FileName1 = 'DummyFileName'\n            FileName2= 'DummyFileName1.json'\n            Filetype = 'json'\n            FileContent = $JsonFileContent\n        },\n         @{\n            FileName1 = 'DummyFileName'\n            FileName2= 'DummyFileName1.xml'\n            Filetype = 'xml'\n            FileContent = $XMLFileContent\n        }\n        It \"<FileType> File should have the correct contents\" -TestCases $TestCases{\n            Param($FileName1,$FileType, $FileContent)\n            $FileName = \"$TestDrive\\$filename1\" + '.' + $FileType\n            $TheTestResults | Set-DbcFile -FilePath $TestDrive -FileName $FileName1 -FileType $Filetype -Verbose\n            $FileName5 = \"c:\\temp\\$filename1\" + '.' + $FileType\n            Get-Content $FileName |Set-Content $FileName5\n            $FileName | Should -FileContentMatchMultiline $FileContent\n        }\n    }\n}\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUaU2PiV/2/Zd/mivp1JQkfU0h\n# 64+gggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz\n# c3VyZWQgSUQgQ29kZSBTaWduaW5nIENBMB4XDTE3MDUwOTAwMDAwMFoXDTIw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iSBThCk7j9xjmMOE0ut119EefM2FAaK95xGTlz/kLEbBw6RFfu6r7VRwo0k\n# riTGxycqoSkoGjpxKAI8LpGjwCUR4pwUR6F6aGivm6dcIFzZcbEMj7uo+MUSaJ/P\n# QMtARKUT8OZkDCUIQjKyNookAv4vcn4c10lFluhZHen6dGRrsutmQ9qzsIzV6Q3d\n# 9gEgzpkxYz0IGhizgZtPxpMQBvwHgfqL2vmCSfdibqFT+hKUGIUukpHqaGxEMrJm\n# oecYpJpkUe8xggIoMIICJAIBATCBhjByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMM\n# RGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQD\n# EyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgQ29kZSBTaWduaW5nIENBAhACwXUo\n# dNXChDGFKtigZGnKMAkGBSsOAwIaBQCgeDAYBgorBgEEAYI3AgEMMQowCKACgACh\n# AoAAMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcCAQsxDjAM\n# BgorBgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBTfRSlwVrEIKMwGmYGY7sPFIXAv\n# ojANBgkqhkiG9w0BAQEFAASCAQA37CSp24Izu7mKVjXGuNLdR74HI1OrzEgxyBtM\n# Y1R9g8CHU8KWJrPkkhiPO3MKghookjZVCW/IbELw/l/um7wjG0Rak13Ka+YGEyvN\n# /3EzzcaH55vA+wMsR3eBQCO/sNi1r8lorzw/jxsROgupEL3jzrYmHZXkbGikOe2V\n# BYSE6/Ln/uaw35VXujiJ/Ln7QbyedlccM6WfyCk38IUxttF0Ms3oUVqIrMV/3nkR\n# ofBdzULzyaS2iSHS/ZQ/A5XHgqhJhJz3D22LI74Jo2QAeueEhrRNNz/pVLd59z4i\n# 5G9PgBvGtRhVetWd6hsZW+ysKqXFZ1TxW50Fx3G604ejXnV9\n# SIG # End signature block\n"
  },
  {
    "path": "developing/Archive/tests/functions/get-check.json",
    "content": "[\n    {\n        \"Group\":  \"Agent\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"AgentServiceAccount\",\n        \"AllTags\":  \"AgentServiceAccount, ServiceAccount, Agent\",\n        \"Config\":  \"app.sqlinstance \",\n        \"Description\":  \"Tests that the SQL Agent Account is running and set to automatic\",\n        \"Describe\":  \"SQL Agent Account\"\n    },\n    {\n        \"Group\":  \"Agent\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"DbaOperator\",\n        \"AllTags\":  \"DbaOperator, Operator, Agent\",\n        \"Config\":  \"app.sqlinstance agent.dbaoperatorname agent.dbaoperatoremail \",\n        \"Description\":  \"Tests that the specified (default blank) DBA Operators exist and have the correct email address\",\n        \"Describe\":  \"DBA Operators\"\n    },\n    {\n        \"Group\":  \"Agent\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"FailsafeOperator\",\n        \"AllTags\":  \"FailsafeOperator, Operator, Agent\",\n        \"Config\":  \"app.sqlinstance agent.failsafeoperator \",\n        \"Description\":  \"Tests that the specified (default blank) Failsafe Operator exists\",\n        \"Describe\":  \"Failsafe Operator\"\n    },\n    {\n        \"Group\":  \"Agent\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"DatabaseMailProfile\",\n        \"AllTags\":  \"DatabaseMailProfile, Agent\",\n        \"Config\":  \"app.sqlinstance  agent.databasemailprofile \",\n        \"Description\":  \"Tests that the specified (default blank) Database Mail Profile exists\",\n        \"Describe\":  \"Database Mail Profile\"\n    },\n    {\n        \"Group\":  \"Agent\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"FailedJob\",\n        \"AllTags\":  \"FailedJob, Agent\",\n        \"Config\":  \"app.sqlinstance \",\n        \"Description\":  \"Tests that enabled Agent Jobs last outcome was succeeded\",\n        \"Describe\":  \"Failed Jobs\"\n    },\n    {\n        \"Group\":  \"Agent\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"ValidJobOwner\",\n        \"AllTags\":  \"ValidJobOwner, Agent\",\n        \"Config\":  \"app.sqlinstance agent.validjobowner.name \",\n        \"Description\":  \"Tests that all Agent Jobs have a Job Owner in the list specified (default sa)\",\n        \"Describe\":  \"Valid Job Owner\"\n    },\n    {\n        \"Group\":  \"Agent\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"AgentAlert\",\n        \"AllTags\":  \"AgentAlert, Agent\",\n        \"Config\":  \"app.sqlinstance agent.alert.Severity agent.alert.messageid agent.alert.Job agent.alert.Notification \",\n        \"Description\":  \"Tests that there are Agent Alerts set up for the specified (default 16-25) alert severities and ids (default 823-825) and if specified Agent Jobs and/or notifications\",\n        \"Describe\":  \"Agent Alerts\"\n    },\n    {\n        \"Group\":  \"Database\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"DatabaseCollation\",\n        \"AllTags\":  \"DatabaseCollation, Database\",\n        \"Config\":  \"app.sqlinstance policy.database.wrongcollation \",\n        \"Description\":  \"Tests that the Database Collation matches the instance collation except for specified databases\",\n        \"Describe\":  \"Database Collation\"\n    },\n    {\n        \"Group\":  \"Database\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"SuspectPage\",\n        \"AllTags\":  \"SuspectPage, Database\",\n        \"Config\":  \"app.sqlinstance \",\n        \"Description\":  \"Tests that there are 0 Suspect Pages for the database\",\n        \"Describe\":  \"Suspect Page\"\n    },\n    {\n        \"Group\":  \"Database\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"TestLastBackup\",\n        \"AllTags\":  \"TestLastBackup, Backup, Database\",\n        \"Config\":  \"app.sqlinstance skip.backup.testing policy.backup.testserver policy.backup.datadir policy.backup.logdir \",\n        \"Description\":  \"Restores the last backup of a database onto a specified (default blank so will use the same instance) restore instance and checks if the DBCC result was successful as well as the DBCC result. This can obviously take some time for large databases!\",\n        \"Describe\":  \"Last Backup Restore Test\"\n    },\n    {\n        \"Group\":  \"Database\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"TestLastBackupVerifyOnly\",\n        \"AllTags\":  \"TestLastBackupVerifyOnly, Backup, Database\",\n        \"Config\":  \"app.sqlinstance policy.backup.newdbgraceperiod \",\n        \"Description\":  \"Does a verify only restore of the last backup of the database and test the result\",\n        \"Describe\":  \"Last Backup VerifyOnly\"\n    },\n    {\n        \"Group\":  \"Database\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"ValidDatabaseOwner\",\n        \"AllTags\":  \"ValidDatabaseOwner, Database\",\n        \"Config\":  \"app.sqlinstance policy.validdbowner.name policy.validdbowner.excludedb \",\n        \"Description\":  \"Tests that the database owner is in the specified (default blank) list\",\n        \"Describe\":  \"Valid Database Owner\"\n    },\n    {\n        \"Group\":  \"Database\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"InvalidDatabaseOwner\",\n        \"AllTags\":  \"InvalidDatabaseOwner, Database\",\n        \"Config\":  \"app.sqlinstance policy.invaliddbowner.name policy.invaliddbowner.excludedb \",\n        \"Description\":  \"Tests that the Database Owner is NOT in the specified (default blank) list\",\n        \"Describe\":  \"Invalid Database Owner\"\n    },\n    {\n        \"Group\":  \"Database\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"LastGoodCheckDb\",\n        \"AllTags\":  \"LastGoodCheckDb, Database\",\n        \"Config\":  \"app.sqlinstance policy.dbcc.maxdays skip.dbcc.datapuritycheck policy.backup.newdbgraceperiod \",\n        \"Description\":  \"Tests that there was a Last Good DBCC CHECKDB within the specified limit (default blank) and if specified that the DATA_PURITY flag is set\",\n        \"Describe\":  \"Last Good DBCC CHECKDB\"\n    },\n    {\n        \"Group\":  \"Database\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"IdentityUsage\",\n        \"AllTags\":  \"IdentityUsage, Database\",\n        \"Config\":  \"app.sqlinstance policy.identity.usagepercent \",\n        \"Description\":  \"Tests that identity columns values are not above the specified percentage (default blank) of the maximum value for that data type\",\n        \"Describe\":  \"Column Identity Usage\"\n    },\n    {\n        \"Group\":  \"Database\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"RecoveryModel\",\n        \"AllTags\":  \"RecoveryModel, DISA, Database\",\n        \"Config\":  \"app.sqlinstance policy.recoverymodel.type policy.recoverymodel.excludedb \",\n        \"Description\":  \"Tests that the Recovery model for all of the databases is set as specified (default blank) except for any specified\",\n        \"Describe\":  \"Recovery Model\"\n    },\n    {\n        \"Group\":  \"Database\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"DuplicateIndex\",\n        \"AllTags\":  \"DuplicateIndex, Database\",\n        \"Config\":  \"app.sqlinstance \",\n        \"Description\":  \"Tests for any duplicate indexes\",\n        \"Describe\":  \"Duplicate Index\"\n    },\n    {\n        \"Group\":  \"Database\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"UnusedIndex\",\n        \"AllTags\":  \"UnusedIndex, Database\",\n        \"Config\":  \"app.sqlinstance \",\n        \"Description\":  \"Tests for any unused indexes\",\n        \"Describe\":  \"Unused Index\"\n    },\n    {\n        \"Group\":  \"Database\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"DisabledIndex\",\n        \"AllTags\":  \"DisabledIndex, Database\",\n        \"Config\":  \"app.sqlinstance \",\n        \"Description\":  \"Tests for any disabled indexes\",\n        \"Describe\":  \"Disabled Index\"\n    },\n    {\n        \"Group\":  \"Database\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"DatabaseGrowthEvent\",\n        \"AllTags\":  \"DatabaseGrowthEvent, Database\",\n        \"Config\":  \"app.sqlinstance policy.database.filegrowthexcludedb \",\n        \"Description\":  \"Tests for any database growth events in the default system trace\",\n        \"Describe\":  \"Database Growth Event\"\n    },\n    {\n        \"Group\":  \"Database\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"PageVerify\",\n        \"AllTags\":  \"PageVerify, Database\",\n        \"Config\":  \"app.sqlinstance policy.pageverify \",\n        \"Description\":  \"Tests the page verify settings\",\n        \"Describe\":  \"Page Verify\"\n    },\n    {\n        \"Group\":  \"Database\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"AutoClose\",\n        \"AllTags\":  \"AutoClose, Database\",\n        \"Config\":  \"app.sqlinstance policy.database.autoclose \",\n        \"Description\":  \"Tests the auto-close setting\",\n        \"Describe\":  \"Auto Close\"\n    },\n    {\n        \"Group\":  \"Database\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"AutoShrink\",\n        \"AllTags\":  \"AutoShrink, Database\",\n        \"Config\":  \"app.sqlinstance policy.database.autoshrink \",\n        \"Description\":  \"Tests the Auto Shrink setting\",\n        \"Describe\":  \"Auto Shrink\"\n    },\n    {\n        \"Group\":  \"Database\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"LastFullBackup\",\n        \"AllTags\":  \"LastFullBackup, LastBackup, Backup, DISA, Database\",\n        \"Config\":  \"app.sqlinstance policy.backup.fullmaxdays policy.backup.newdbgraceperiod skip.backup.readonly \",\n        \"Description\":  \"Tests if the last full backup of a database is less than the specified number of days (default 7) except for offline databases and read-only databases (read-only if specified) and databases created recently (if specified)\",\n        \"Describe\":  \"Last Full Backup Times\"\n    },\n    {\n        \"Group\":  \"Database\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"LastDiffBackup\",\n        \"AllTags\":  \"LastDiffBackup, LastBackup, Backup, DISA, Database\",\n        \"Config\":  \"app.sqlinstance skip.diffbackuptest policy.backup.diffmaxhours policy.backup.newdbgraceperiod skip.backup.readonly \",\n        \"Description\":  \"Tests if the last diff backup of a database is less than the specified number of hours (default 24) except for offline databases and read-only databases (read-only if specified) and databases created recently (if specified)\",\n        \"Describe\":  \"Last Diff Backup Times\"\n    },\n    {\n        \"Group\":  \"Database\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"LastLogBackup\",\n        \"AllTags\":  \"LastLogBackup, LastBackup, Backup, DISA, Database\",\n        \"Config\":  \"app.sqlinstance policy.backup.logmaxminutes policy.backup.newdbgraceperiod skip.backup.readonly \",\n        \"Description\":  \"Tests if the last log backup of a database is less than the specified number of minutes (default 30) except for simple databases, offline databases and read-only databases (read-only if specified) and databases created recently (if specified)\",\n        \"Describe\":  \"Last Log Backup Times\"\n    },\n    {\n        \"Group\":  \"Database\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"VirtualLogFile\",\n        \"AllTags\":  \"VirtualLogFile, Database\",\n        \"Config\":  \"app.sqlinstance policy.database.maxvlf \",\n        \"Description\":  \"Tests the number of the Virtual Log Files are less than the specified number\",\n        \"Describe\":  \"Virtual Log Files\"\n    },\n    {\n        \"Group\":  \"Database\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"LogfileCount\",\n        \"AllTags\":  \"LogfileCount, Database\",\n        \"Config\":  \"app.sqlinstance skip.database.logfilecounttest policy.database.logfilecount \",\n        \"Description\":  \"Tests that the number of log files are less than the specified amount (default is 1) in all databases except those specified to be skipped by default\",\n        \"Describe\":  \"Log File Count Checks\"\n    },\n    {\n        \"Group\":  \"Database\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"LogfileSize\",\n        \"AllTags\":  \"LogfileSize, Database\",\n        \"Config\":  \"app.sqlinstance policy.database.logfilesizepercentage policy.database.logfilesizecomparison \",\n        \"Description\":  \"Tests that the database log files are less than the specified percentage of the specified comparison (maximum size or average - default is average) of the data file size (default 100)\",\n        \"Describe\":  \"Log File Size Checks\"\n    },\n    {\n        \"Group\":  \"Database\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"FutureFileGrowth\",\n        \"AllTags\":  \"FutureFileGrowth, Database\",\n        \"Config\":  \"app.sqlinstance policy.database.filegrowthfreespacethreshold policy.database.filegrowthexcludedb skip.database.filegrowthdisabled \",\n        \"Description\":  \"Tests if a database (except for those specified to be skipped explicitly) has free space less than the specified percentage (default 20)\",\n        \"Describe\":  \"Future File Growth\"\n    },\n    {\n        \"Group\":  \"Database\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"FileGroupBalanced\",\n        \"AllTags\":  \"FileGroupBalanced, Database\",\n        \"Config\":  \"app.sqlinstance policy.database.filebalancetolerance \",\n        \"Description\":  \"Tests that all of the files within each filegroup are sized within the specified percentage (default 5) of the average\",\n        \"Describe\":  \"Correctly sized Filegroup members\"\n    },\n    {\n        \"Group\":  \"Database\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"CertificateExpiration\",\n        \"AllTags\":  \"CertificateExpiration, Database\",\n        \"Config\":  \"app.sqlinstance policy.certificateexpiration.warningwindow policy.certificateexpiration.excludedb \",\n        \"Description\":  \"Tests that all certificates have not expired and are not due to expire within the specified (default 1) number of months\",\n        \"Describe\":  \"Certificate Expiration\"\n    },\n    {\n        \"Group\":  \"Database\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"AutoCreateStatistics\",\n        \"AllTags\":  \"AutoCreateStatistics, Database\",\n        \"Config\":  \"app.sqlinstance policy.database.autocreatestatistics \",\n        \"Description\":  \"Tests the Auto Create Statistics property on each database is set to the specified (default false) value\",\n        \"Describe\":  \"Auto Create Statistics\"\n    },\n    {\n        \"Group\":  \"Database\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"AutoUpdateStatistics\",\n        \"AllTags\":  \"AutoUpdateStatistics, Database\",\n        \"Config\":  \"app.sqlinstance policy.database.autoupdatestatistics \",\n        \"Description\":  \"Tests the Auto Update Statistics property on each database is set to the specified (default true) value\",\n        \"Describe\":  \"Auto Update Statistics\"\n    },\n    {\n        \"Group\":  \"Database\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"AutoUpdateStatisticsAsynchronously\",\n        \"AllTags\":  \"AutoUpdateStatisticsAsynchronously, Database\",\n        \"Config\":  \"app.sqlinstance policy.database.autoupdatestatisticsasynchronously \",\n        \"Description\":  \"Tests the Auto Update Statistics Asynchronously property on each database is set to the specified (default false) value\",\n        \"Describe\":  \"Auto Update Statistics Asynchronously\"\n    },\n    {\n        \"Group\":  \"Database\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"DatafileAutoGrowthType\",\n        \"AllTags\":  \"DatafileAutoGrowthType, Database\",\n        \"Config\":  \"app.sqlinstance policy.database.filegrowthtype policy.database.filegrowthvalue policy.database.filegrowthexcludedb skip.database.filegrowthdisabled \",\n        \"Description\":  \"Tests that the Datafile Auto Growth type and value on each database except those specified is set to the specified (default type = kb, value = 65535) values\",\n        \"Describe\":  \"Datafile Auto Growth Configuration\"\n    },\n    {\n        \"Group\":  \"Database\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"Trustworthy\",\n        \"AllTags\":  \"Trustworthy, DISA, Database\",\n        \"Config\":  \"app.sqlinstance \",\n        \"Description\":  \"Tests that the Trustworthy Option for each database is set to false\",\n        \"Describe\":  \"Trustworthy Option\"\n    },\n    {\n        \"Group\":  \"Database\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"OrphanedUser\",\n        \"AllTags\":  \"OrphanedUser, Database\",\n        \"Config\":  \"app.sqlinstance \",\n        \"Description\":  \"Tests that each database has 0 orphaned users\",\n        \"Describe\":  \"Database Orphaned User\"\n    },\n    {\n        \"Group\":  \"Database\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"PseudoSimple\",\n        \"AllTags\":  \"PseudoSimple, Database\",\n        \"Config\":  \"app.sqlinstance \",\n        \"Description\":  \"Tests that databases are not in PseudoSimple Recovery Model\",\n        \"Describe\":  \"PseudoSimple Recovery Model\"\n    },\n    {\n        \"Group\":  \"Database\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"CompatibilityLevel\",\n        \"AllTags\":  \"CompatibilityLevel, Database\",\n        \"Config\":  \"app.sqlinstance \",\n        \"Description\":  \"tests that the servers compatibility level matches the compatibility level\",\n        \"Describe\":  \"Compatibility Level\"\n    },\n    {\n        \"Group\":  \"Database\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"FKCKTrusted\",\n        \"AllTags\":  \"FKCKTrusted, Database\",\n        \"Config\":  \"app.sqlinstance \",\n        \"Description\":  \"Tests that each foreign key and each constraint is trusted\",\n        \"Describe\":  \"Foreign keys and check constraints not trusted\"\n    },\n    {\n        \"Group\":  \"Database\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"MaxDopDatabase\",\n        \"AllTags\":  \"MaxDopDatabase, MaxDop, Database\",\n        \"Config\":  \"app.sqlinstance policy.database.maxdop policy.database.maxdopexcludedb \",\n        \"Description\":  \"Tests that the database level MaxDop settings for all databases on all instances from version 2016 up are set to the specified value (default 0)\",\n        \"Describe\":  \"Database MaxDop\"\n    },\n    {\n        \"Group\":  \"Database\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"DatabaseStatus\",\n        \"AllTags\":  \"DatabaseStatus, Database\",\n        \"Config\":  \"app.sqlinstance command.invokedbccheck.excludedatabases policy.database.status.excludereadonly policy.database.status.excludeoffline policy.database.status.excluderestoring \",\n        \"Description\":  \"Tests that there are no databases on an instance that are in a state of AutoClose, Offline, ReadOnly, Restoring, Recovery, Recovery Pending, EmergencyMode, Suspect or StandBy. Databases that are in ReadOnly,Offline and Restoring mode can be specified (default none)\",\n        \"Describe\":  \"Database Status\"\n    },\n    {\n        \"Group\":  \"Database\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"DatabaseExists\",\n        \"AllTags\":  \"DatabaseExists, Database\",\n        \"Config\":  \"app.sqlinstance database.exists \",\n        \"Description\":  \"Tests that the databases are specified are on the instance (Note - Does not check if they are available - Use DatabaseStatus for that))\",\n        \"Describe\":  \"Database Exists\"\n    },\n    {\n        \"Group\":  \"Domain\",\n        \"Type\":  \"ComputerName\",\n        \"UniqueTag\":  \"DomainName\",\n        \"AllTags\":  \"DomainName, Domain\",\n        \"Config\":  \"app.computername domain.name \",\n        \"Description\":  \"Uses WMI Win32_ComputerSystem to check that the host machine is on the correct domain\",\n        \"Describe\":  \"Active Directory Domain Name\"\n    },\n    {\n        \"Group\":  \"Domain\",\n        \"Type\":  \"ComputerName\",\n        \"UniqueTag\":  \"OrganizationalUnit\",\n        \"AllTags\":  \"OrganizationalUnit, Domain\",\n        \"Config\":  \"app.computername domain.domaincontroller domain.organizationalunit \",\n        \"Description\":  \"Currently skipped - Active Directory OU\",\n        \"Describe\":  \"Active Directory OU\"\n    },\n    {\n        \"Group\":  \"HADR\",\n        \"Type\":  \"ClusterNode\",\n        \"UniqueTag\":  \"ClusterHealth\",\n        \"AllTags\":  \"ClusterHealth, HADR\",\n        \"Config\":  \"app.cluster skip.hadr.listener.pingcheck domain.name policy.hadr.tcpport \",\n        \"Description\":  \"Runs a suite of tests against an Availability Group on a Windows cluster to ensure that everything is as it should be. Tests cluster resources are online, cluster nodes are up, at least one IP Address for the AG listener is available, that each replica and listener are pingable (listener ping check can be skipped), can be connected to via T-SQL, have the correct domain name and TCP port, that each replica is synchronised/ing, is connected, is not in an unknown state, each database is synchronised/ing, failover ready and joined to the domain and that the Always On Health Extended Event sessions are running and set to auto-start\",\n        \"Describe\":  \"Cluster $clustername Health using Node $clustervm\"\n    },\n    {\n        \"Group\":  \"Instance\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"SqlEngineServiceAccount\",\n        \"AllTags\":  \"SqlEngineServiceAccount, ServiceAccount, Instance\",\n        \"Config\":  \"app.sqlinstance \",\n        \"Description\":  \"Tests that the SQL Engine Service is started and set to auto-start\",\n        \"Describe\":  \"SQL Engine Service\"\n    },\n    {\n        \"Group\":  \"Instance\",\n        \"Type\":  \"ComputerName\",\n        \"UniqueTag\":  \"SqlBrowserServiceAccount\",\n        \"AllTags\":  \"SqlBrowserServiceAccount, ServiceAccount, Instance\",\n        \"Config\":  \"app.computername \",\n        \"Description\":  \"Tests that the SQL Browser Service is started and set to auto-start if there are multiple instances and stopped and set to disabled if there is only one \",\n        \"Describe\":  \"SQL Browser Service\"\n    },\n    {\n        \"Group\":  \"Instance\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"TempDbConfiguration\",\n        \"AllTags\":  \"TempDbConfiguration, Instance\",\n        \"Config\":  \"app.sqlinstance skip.TempDb1118 skip.tempdbfileCount skip.TempDbFileGrowthPercent skip.TempDbFilesonC skip.TempDbFileSizeMax \",\n        \"Description\":  \"Tests that the TempDB Configuration is correct, that TF118 is enabled, there are the recommended number of files, autogrowth is not set to percent, that the files can grow and that they are not located on the C drive (each of these tests can be configured individually to be skipped\",\n        \"Describe\":  \"TempDB Configuration\"\n    },\n    {\n        \"Group\":  \"Instance\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"AdHocWorkload\",\n        \"AllTags\":  \"AdHocWorkload, Instance\",\n        \"Config\":  \"app.sqlinstance \",\n        \"Description\":  \"Tests that the AAd Hoc Workload Optimization is enabled\",\n        \"Describe\":  \"Ad Hoc Workload Optimization\"\n    },\n    {\n        \"Group\":  \"Instance\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"BackupPathAccess\",\n        \"AllTags\":  \"BackupPathAccess, Storage, DISA, Instance\",\n        \"Config\":  \"app.sqlinstance policy.storage.backuppath \",\n        \"Description\":  \"Tests that the SQL Service account has access to the default backup path or the specified folder path\",\n        \"Describe\":  \"Backup Path Access\"\n    },\n    {\n        \"Group\":  \"Instance\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"DAC\",\n        \"AllTags\":  \"DAC, Instance\",\n        \"Config\":  \"app.sqlinstance policy.dacallowed \",\n        \"Description\":  \"Tests that the Dedicated Administrator Connection configuration setting matches the specified value (default true)\",\n        \"Describe\":  \"Dedicated Administrator Connection\"\n    },\n    {\n        \"Group\":  \"Instance\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"NetworkLatency\",\n        \"AllTags\":  \"NetworkLatency, Connectivity, Instance\",\n        \"Config\":  \"app.sqlinstance policy.network.latencymaxms \",\n        \"Description\":  \"Tests that the Network Latency is less than the specified (default 40) ms\",\n        \"Describe\":  \"Network Latency\"\n    },\n    {\n        \"Group\":  \"Instance\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"LinkedServerConnection\",\n        \"AllTags\":  \"LinkedServerConnection, Connectivity, Instance\",\n        \"Config\":  \"app.sqlinstance \",\n        \"Description\":  \"Tests for successful connection to all Linked Servers\",\n        \"Describe\":  \"Linked Servers\"\n    },\n    {\n        \"Group\":  \"Instance\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"MaxMemory\",\n        \"AllTags\":  \"MaxMemory, Instance\",\n        \"Config\":  \"app.sqlinstance \",\n        \"Description\":  \"Tests an instances Max Memory\",\n        \"Describe\":  \"Max Memory\"\n    },\n    {\n        \"Group\":  \"Instance\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"OrphanedFile\",\n        \"AllTags\":  \"OrphanedFile, Instance\",\n        \"Config\":  \"app.sqlinstance \",\n        \"Description\":  \"Tests that there are 0 orphaned data files\",\n        \"Describe\":  \"Orphaned Files\"\n    },\n    {\n        \"Group\":  \"Instance\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"ServerNameMatch\",\n        \"AllTags\":  \"ServerNameMatch, Instance\",\n        \"Config\":  \"app.sqlinstance \",\n        \"Description\":  \"Tests that the SQL + Windows names match\",\n        \"Describe\":  \"SQL + Windows names match\"\n    },\n    {\n        \"Group\":  \"Instance\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"MemoryDump\",\n        \"AllTags\":  \"MemoryDump, Instance\",\n        \"Config\":  \"app.sqlinstance  policy.dump.maxcount \",\n        \"Description\":  \"Tests that there are less than the specified (default 1) number of SQL Memory Dumps\",\n        \"Describe\":  \"SQL Memory Dumps\"\n    },\n    {\n        \"Group\":  \"Instance\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"SupportedBuild\",\n        \"AllTags\":  \"SupportedBuild, DISA, Instance\",\n        \"Config\":  \"app.sqlinstance policy.build.warningwindow \",\n        \"Description\":  \"Tests that the instance is still under Microsoft support and that it will still be under support in a specified (default 6) months\",\n        \"Describe\":  \"Supported Build\"\n    },\n    {\n        \"Group\":  \"Instance\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"SaRenamed\",\n        \"AllTags\":  \"SaRenamed, DISA, Instance\",\n        \"Config\":  \"app.sqlinstance \",\n        \"Description\":  \"Tests that the SA Login has been renamed\",\n        \"Describe\":  \"SA Login Renamed\"\n    },\n    {\n        \"Group\":  \"Instance\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"DefaultBackupCompression\",\n        \"AllTags\":  \"DefaultBackupCompression, Instance\",\n        \"Config\":  \"app.sqlinstance policy.backup.defaultbackupcompression \",\n        \"Description\":  \"Tests that an instances Default Backup Compression is set to the specified (default true) setting\",\n        \"Describe\":  \"Default Backup Compression\"\n    },\n    {\n        \"Group\":  \"Instance\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"XESessionStopped\",\n        \"AllTags\":  \"XESessionStopped, ExtendedEvent, Instance\",\n        \"Config\":  \"app.sqlinstance policy.xevent.requiredstoppedsession \",\n        \"Description\":  \"Tests that the specified (default blank) XE Sessions are stopped\",\n        \"Describe\":  \"XE Sessions That should be Stopped\"\n    },\n    {\n        \"Group\":  \"Instance\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"XESessionRunning\",\n        \"AllTags\":  \"XESessionRunning, ExtendedEvent, Instance\",\n        \"Config\":  \"app.sqlinstance policy.xevent.requiredrunningsession \",\n        \"Description\":  \"Tests that the specified (default blank) XE Sessions that are expected to be running are running\",\n        \"Describe\":  \"XE Sessions That should be Running\"\n    },\n    {\n        \"Group\":  \"Instance\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"XESessionRunningAllowed\",\n        \"AllTags\":  \"XESessionRunningAllowed, ExtendedEvent, Instance\",\n        \"Config\":  \"app.sqlinstance policy.xevent.validrunningsession \",\n        \"Description\":  \"Tests that the specified (default blank) XE Sessions that are allowed to be running are running\",\n        \"Describe\":  \"XE Sessions That Are Allowed to Be Running\"\n    },\n    {\n        \"Group\":  \"Instance\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"OLEAutomation\",\n        \"AllTags\":  \"OLEAutomation, Instance\",\n        \"Config\":  \"app.sqlinstance policy.oleautomation \",\n        \"Description\":  \"Tests that OLE Automation is set to the specified (default false) setting\",\n        \"Describe\":  \"OLE Automation\"\n    },\n    {\n        \"Group\":  \"Instance\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"WhoIsActiveInstalled\",\n        \"AllTags\":  \"WhoIsActiveInstalled, Instance\",\n        \"Config\":  \"app.sqlinstance policy.whoisactive.database \",\n        \"Description\":  \"Tests that sp_whoisactive is Installed by testing the specified (default master) database for the stored procedure\",\n        \"Describe\":  \"sp_whoisactive is Installed\"\n    },\n    {\n        \"Group\":  \"Instance\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"ModelDbGrowth\",\n        \"AllTags\":  \"ModelDbGrowth, Instance\",\n        \"Config\":  \"app.sqlinstance skip.instance.modeldbgrowth \",\n        \"Description\":  \"Tests that the Model Database Growth settings are not set to default\",\n        \"Describe\":  \"Model Database Growth\"\n    },\n    {\n        \"Group\":  \"Instance\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"ADUser\",\n        \"AllTags\":  \"ADUser, Domain, Instance\",\n        \"Config\":  \"app.sqlinstance policy.adloginuser.excludecheck policy.adlogingroup.excludecheck \",\n        \"Description\":  \"Tests that Ad Users and Groups, except those specified, that are logins on a SQL Server exist in Active Directory, do not have an expired password, are not locked out, are enabled in AD and on the SQL Server \",\n        \"Describe\":  \"Ad Users and Groups \"\n    },\n    {\n        \"Group\":  \"Instance\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"ErrorLog\",\n        \"AllTags\":  \"ErrorLog, Instance\",\n        \"Config\":  \"app.sqlinstance policy.errorlog.warningwindow \",\n        \"Description\":  \"Tests that the SQL Server Error Log does not have any Severity 17-24 level entries within the specified (default 2) days\",\n        \"Describe\":  \"Error Log Entries\"\n    },\n    {\n        \"Group\":  \"Instance\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"MaxDopInstance\",\n        \"AllTags\":  \"MaxDopInstance, MaxDop, Instance\",\n        \"Config\":  \"app.sqlinstance policy.instancemaxdop.userecommended policy.instancemaxdop.maxdop policy.instancemaxdop.excludeinstance \",\n        \"Description\":  \"Tests that the instance level MaxDop settings on all instances (except those specified default blank) are set to the recommended value if specified (default false) or to the specified value (default 0)\",\n        \"Describe\":  \"Instance MaxDop\"\n    },\n    {\n        \"Group\":  \"LogShipping\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"LogShippingPrimary\",\n        \"AllTags\":  \"LogShippingPrimary, LogShipping\",\n        \"Config\":  \"app.sqlinstance \",\n        \"Description\":  \"Tests that the Log Shipping Primary status is ok\",\n        \"Describe\":  \"Log Shipping Status Primary\"\n    },\n    {\n        \"Group\":  \"LogShipping\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"LogShippingSecondary\",\n        \"AllTags\":  \"LogShippingSecondary, LogShipping\",\n        \"Config\":  \"app.sqlinstance \",\n        \"Description\":  \"Tests that the Log Shipping Secondary status is ok\",\n        \"Describe\":  \"Log Shipping Status Secondary\"\n    },\n    {\n        \"Group\":  \"MaintenanceSolution\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"OlaInstalled\",\n        \"AllTags\":  \"OlaInstalled, MaintenanceSolution\",\n        \"Config\":  \"app.sqlinstance policy.ola.database \",\n        \"Description\":  \"Tests that Ola maintenance solution is installed by testing the specified (default master) database for the command log table and the stored procedures\",\n        \"Describe\":  \"Ola maintenance solution installed\"\n    },\n    {\n        \"Group\":  \"MaintenanceSolution\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"SystemFull\",\n        \"AllTags\":  \"SystemFull, OlaJobs, MaintenanceSolution\",\n        \"Config\":  \"app.sqlinstance ola.JobName.SystemFull policy.ola.SystemFullenabled policy.ola.SystemFullscheduled policy.ola.SystemFullretention \",\n        \"Description\":  \"Tests that the Ola - System Full Agent Job (using the specified name defaults to Olas default naming) enabled setting is set as specified (default true), the schedules are set as specified (default true) and enabled and that the backup retention setting for the job is set as specified (default 192 (hours))\",\n        \"Describe\":  \"Ola - $SysFullJobName\"\n    },\n    {\n        \"Group\":  \"MaintenanceSolution\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"UserFull\",\n        \"AllTags\":  \"UserFull, OlaJobs, MaintenanceSolution\",\n        \"Config\":  \"app.sqlinstance ola.JobName.UserFull policy.ola.UserFullenabled policy.ola.UserFullscheduled policy.ola.UserFullretention \",\n        \"Description\":  \"Tests that the Ola - User Full Agent Job (using the specified name defaults to Olas default naming) enabled setting is set as specified (default true), the schedules are set as specified (default true) and enabled and that the backup retention setting for the job is set as specified (default 192 (hours))\",\n        \"Describe\":  \"Ola - $UserFullJobName\"\n    },\n    {\n        \"Group\":  \"MaintenanceSolution\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"UserDiff\",\n        \"AllTags\":  \"UserDiff, OlaJobs, MaintenanceSolution\",\n        \"Config\":  \"app.sqlinstance ola.JobName.UserDiff policy.ola.UserDiffenabled policy.ola.UserDiffscheduled policy.ola.UserDiffretention \",\n        \"Description\":  \"Tests that the Ola - User Diff Agent Job (using the specified name defaults to Olas default naming) enabled setting is set as specified (default true), the schedules are set as specified (default true) and enabled and that the backup retention setting for the job is set as specified (default 192 (hours))\",\n        \"Describe\":  \"Ola - $UserDiffJobName\"\n    },\n    {\n        \"Group\":  \"MaintenanceSolution\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"UserLog\",\n        \"AllTags\":  \"UserLog, OlaJobs, MaintenanceSolution\",\n        \"Config\":  \"app.sqlinstance ola.JobName.UserLog policy.ola.UserLogenabled policy.ola.UserLogscheduled policy.ola.UserLogretention \",\n        \"Description\":  \"Tests that the Ola - User Log Agent Job (using the specified name defaults to Olas default naming) enabled setting is set as specified (default true), the schedules are set as specified (default true) and enabled and that the backup retention setting for the job is set as specified (default 192 (hours))\",\n        \"Describe\":  \"Ola - $UserLogJobName\"\n    },\n    {\n        \"Group\":  \"MaintenanceSolution\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"CommandLog\",\n        \"AllTags\":  \"CommandLog, OlaJobs, MaintenanceSolution\",\n        \"Config\":  \"app.sqlinstance ola.JobName.CommandLogCleanup policy.ola.CommandLogenabled policy.ola.CommandLogscheduled policy.ola.CommandLogCleanUp \",\n        \"Description\":  \"Tests that the Ola - Command Log Cleanup Job (using the specified name defaults to Olas default naming) enabled setting is set as specified (default true), the schedules are set as specified (default true) and enabled and that the clean up setting for the job is set as specified (default 30 (days))\",\n        \"Describe\":  \"Ola - $CommandLogJobName\"\n    },\n    {\n        \"Group\":  \"MaintenanceSolution\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"SystemIntegrityCheck\",\n        \"AllTags\":  \"SystemIntegrityCheck, OlaJobs, MaintenanceSolution\",\n        \"Config\":  \"app.sqlinstance ola.JobName.SystemIntegrity policy.ola.SystemIntegrityCheckenabled policy.ola.SystemIntegrityCheckscheduled \",\n        \"Description\":  \"Tests that the Ola - System Integrity Check Agent Job (using the specified name defaults to Olas default naming) enabled setting is set as specified (default true), the schedules are set as specified (default true) and enabled\",\n        \"Describe\":  \"Ola - $SysIntegrityJobName\"\n    },\n    {\n        \"Group\":  \"MaintenanceSolution\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"UserIntegrityCheck\",\n        \"AllTags\":  \"UserIntegrityCheck, OlaJobs, MaintenanceSolution\",\n        \"Config\":  \"app.sqlinstance ola.JobName.UserIntegrity policy.ola.UserIntegrityCheckenabled policy.ola.UserIntegrityCheckscheduled \",\n        \"Description\":  \"Tests that the Ola - User Integrity Check Agent Job (using the specified name defaults to Olas default naming) enabled setting is set as specified (default true), the schedules are set as specified (default true) and enabled\",\n        \"Describe\":  \"Ola - $UserIntegrityJobName\"\n    },\n    {\n        \"Group\":  \"MaintenanceSolution\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"UserIndexOptimize\",\n        \"AllTags\":  \"UserIndexOptimize, OlaJobs, MaintenanceSolution\",\n        \"Config\":  \"app.sqlinstance ola.JobName.UserIndex policy.ola.UserIndexOptimizeenabled policy.ola.UserIndexOptimizescheduled \",\n        \"Description\":  \"Tests that the Ola - User Index Optimise Agent Job (using the specified name defaults to Olas default naming) enabled setting is set as specified (default true), the schedules are set as specified (default true) and enabled\",\n        \"Describe\":  \"Ola - $UserIndexJobName\"\n    },\n    {\n        \"Group\":  \"MaintenanceSolution\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"OutputFileCleanup\",\n        \"AllTags\":  \"OutputFileCleanup, OlaJobs, MaintenanceSolution\",\n        \"Config\":  \"app.sqlinstance ola.JobName.OutputFileCleanup policy.ola.OutputFileCleanupenabled policy.ola.OutputFileCleanupscheduled policy.ola.OutputFileCleanUp \",\n        \"Description\":  \"Tests that the Ola - Output File Cleanup Job (using the specified name defaults to Olas default naming) enabled setting is set as specified (default true), the schedules are set as specified (default true) and enabled and that the clean up setting for the job is set as specified (default 30 (days))\",\n        \"Describe\":  \"Ola - $OutputFileJobName\"\n    },\n    {\n        \"Group\":  \"MaintenanceSolution\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"DeleteBackupHistory\",\n        \"AllTags\":  \"DeleteBackupHistory, OlaJobs, MaintenanceSolution\",\n        \"Config\":  \"app.sqlinstance ola.JobName.DeleteBackupHistory policy.ola.DeleteBackupHistoryenabled policy.ola.DeleteBackupHistoryscheduled policy.ola.DeleteBackupHistoryCleanUp \",\n        \"Description\":  \"Tests that the Ola - Delete Backup History Job (using the specified name defaults to Olas default naming) enabled setting is set as specified (default true), the schedules are set as specified (default true) and enabled and that the clean up setting for the job is set as specified (default 30 (days))\",\n        \"Describe\":  \"Ola - $DeleteBackupJobName\"\n    },\n    {\n        \"Group\":  \"MaintenanceSolution\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"PurgeJobHistory\",\n        \"AllTags\":  \"PurgeJobHistory, OlaJobs, MaintenanceSolution\",\n        \"Config\":  \"app.sqlinstance ola.JobName.PurgeBackupHistory policy.ola.PurgeJobHistoryenabled policy.ola.PurgeJobHistoryscheduled policy.ola.PurgeJobHistoryCleanUp \",\n        \"Description\":  \"Tests that the Ola - Purge Job History Job (using the specified name defaults to Olas default naming) enabled setting is set as specified (default true), the schedules are set as specified (default true) and enabled and that the clean up setting for the job is set as specified (default 30 (days))\",\n        \"Describe\":  \"Ola - $PurgeBackupJobName\"\n    },\n    {\n        \"Group\":  \"Server\",\n        \"Type\":  \"ComputerName\",\n        \"UniqueTag\":  \"PowerPlan\",\n        \"AllTags\":  \"PowerPlan, Server\",\n        \"Config\":  \"app.computername \",\n        \"Description\":  \"Tests that the Server Power Plan is set to High Performance\",\n        \"Describe\":  \"Server Power Plan Configuration\"\n    },\n    {\n        \"Group\":  \"Server\",\n        \"Type\":  \"Sqlinstance\",\n        \"UniqueTag\":  \"InstanceConnection\",\n        \"AllTags\":  \"InstanceConnection, Connectivity, Server\",\n        \"Config\":  \"app.sqlinstance skip.connection.remoting skip.connection.ping policy.connection.authscheme \",\n        \"Description\":  \"Tests that a SQL query can be run, that the specified authentication scheme (default kerboros) is being used, that the host responds to one ping and that the host supports PS Remoting\",\n        \"Describe\":  \"Instance Connection\"\n    },\n    {\n        \"Group\":  \"Server\",\n        \"Type\":  \"ComputerName\",\n        \"UniqueTag\":  \"SPN\",\n        \"AllTags\":  \"SPN, Server\",\n        \"Config\":  \"app.computername \",\n        \"Description\":  \"Tests that all default SQL SPNs have been correctly registered\",\n        \"Describe\":  \"SPNs\"\n    },\n    {\n        \"Group\":  \"Server\",\n        \"Type\":  \"ComputerName\",\n        \"UniqueTag\":  \"DiskCapacity\",\n        \"AllTags\":  \"DiskCapacity, Storage, DISA, Server\",\n        \"Config\":  \"app.computername policy.diskspace.percentfree \",\n        \"Description\":  \"Tests that each drive has at least the specified percentage (default 20) free space\",\n        \"Describe\":  \"Disk Space\"\n    },\n    {\n        \"Group\":  \"Server\",\n        \"Type\":  \"ComputerName\",\n        \"UniqueTag\":  \"PingComputer\",\n        \"AllTags\":  \"PingComputer, Server\",\n        \"Config\":  \"app.computername policy.connection.pingmaxms policy.connection.pingcount skip.connection.ping \",\n        \"Description\":  \"Tests that a host has been pinged a specified number of times (default 3) and that the average response time is less than specified (default 10ms)\",\n        \"Describe\":  \"Ping Computer\"\n    },\n    {\n        \"Group\":  \"Server\",\n        \"Type\":  \"ComputerName\",\n        \"UniqueTag\":  \"CPUPrioritisation\",\n        \"AllTags\":  \"CPUPrioritisation, Server\",\n        \"Config\":  \"app.computername policy.server.cpuprioritisation \",\n        \"Description\":  \"Tests that the CPU is prioritised for background activity over user UI experience. unless specified to ignore (default true)\",\n        \"Describe\":  \"CPUPrioritisation\"\n    },\n    {\n        \"Group\":  \"Server\",\n        \"Type\":  \"ComputerName\",\n        \"UniqueTag\":  \"DiskAllocationUnit\",\n        \"AllTags\":  \"DiskAllocationUnit, Server\",\n        \"Config\":  \"app.computername \",\n        \"Description\":  \"Tests that the disks available to the server are formatted for optimum performance (64KB allocation unit)\",\n        \"Describe\":  \"Disk Allocation Unit\"\n    }\n]\n"
  },
  {
    "path": "developing/Archive/tests/functions/results.json",
    "content": "{\n  \"TagFilter\": [\n    \"AutoClose\",\n    \"lastgoodcheckdb\",\n    \"BackupPathAccess\",\n    \"FailedJob\"\n  ],\n  \"ExcludeTagFilter\": [\n    \"FailsafeOperator\",\n    \"DatabaseMailEnabled\",\n    \"DatabaseMailProfile\",\n    \"SqlEngineServiceAccount\",\n    \"OrphanedFile\",\n    \"ServerNameMatch\",\n    \"SqlBrowserServiceAccount\"\n  ],\n  \"TestNameFilter\": null,\n  \"ScriptBlockFilter\": null,\n  \"TotalCount\": 20,\n  \"PassedCount\": 14,\n  \"FailedCount\": 6,\n  \"SkippedCount\": 0,\n  \"PendingCount\": 0,\n  \"InconclusiveCount\": 0,\n  \"Time\": {\n    \"Ticks\": 47923307,\n    \"Days\": 0,\n    \"Hours\": 0,\n    \"Milliseconds\": 792,\n    \"Minutes\": 0,\n    \"Seconds\": 4,\n    \"TotalDays\": 5.5466790509259256E-05,\n    \"TotalHours\": 0.0013312029722222221,\n    \"TotalMilliseconds\": 4792.3307,\n    \"TotalMinutes\": 0.079872178333333335,\n    \"TotalSeconds\": 4.7923307\n  },\n  \"TestResult\": [\n    {\n      \"FailureMessage\": \"Expected the actual value to be greater than 2019-12-21T15:21:38.3892727Z, because You should have run a DBCC CheckDB inside that time, but got 2019-12-21T14:41:58.0230000.\",\n      \"Result\": \"Failed\",\n      \"Describe\": \"Last Good DBCC CHECKDB\",\n      \"Time\": \"00:00:00.0056746\",\n      \"Show\": 1023,\n      \"StackTrace\": \"at <ScriptBlock>, D:\\\\OneDrive\\\\Documents\\\\GitHub\\\\dbachecks\\\\checks\\\\Database.Tests.ps1: line 200\\r\\n200:                                 $psitem.LastGoodCheckDb | Should -BeGreaterThan (Get-Date).ToUniversalTime().AddDays( - ($maxdays)) -Because \\\"You should have run a DBCC CheckDB inside that time\\\"\",\n      \"Passed\": false,\n      \"Parameters\": \"System.Collections.Specialized.OrderedDictionary\",\n      \"Context\": \"Testing Last Good DBCC CHECKDB on localhost,15592\",\n      \"Name\": \"Database master last good integrity check should be less than 3 days old on a37085985dc6\",\n      \"ErrorRecord\": \"Expected the actual value to be greater than 2019-12-21T15:21:38.3892727Z, because You should have run a DBCC CheckDB inside that time, but got 2019-12-21T14:41:58.0230000.\",\n      \"ParameterizedSuiteName\": \"\"\n    },\n    {\n      \"FailureMessage\": \"\",\n      \"Result\": \"Passed\",\n      \"Describe\": \"Last Good DBCC CHECKDB\",\n      \"Time\": \"00:00:00.0032216\",\n      \"Show\": 1023,\n      \"StackTrace\": \"\",\n      \"Passed\": true,\n      \"Parameters\": \"System.Collections.Specialized.OrderedDictionary\",\n      \"Context\": \"Testing Last Good DBCC CHECKDB on localhost,15592\",\n      \"Name\": \"Database master has Data Purity Enabled on a37085985dc6\",\n      \"ErrorRecord\": null,\n      \"ParameterizedSuiteName\": \"\"\n    }\n  ]\n}"
  },
  {
    "path": "developing/Archive/tests/readme.md",
    "content": "# Tests Folder\n\n## Description\n\nThis folder holds the Unit and integration tests for the dbachecks module\n\n## assertions\n\nThis holds the functions to be able to run the unit tests for the checks\n\n## checks\n\nThis holds the Pester Tests for the checks\n\n## functions\n\nThis holds the Pester Tests for the external adn internal functions\n\n## This folder\n\nholds the generic tests for the module, the help, the script analyzer, the generic unit tests for the checks layout "
  },
  {
    "path": "developing/Howto.md",
    "content": "# Developing with Sampler set up\n\nSuper quick introduction. I have altered the project to use Sampler by Gael to scaffold and later to improve the CI/CD pipeline.\n\nI have also updated the devcontainer so that we have 3 containers 2 based on dbatools/sqlinstance and dbatools/sqlinstance2 but also a SQL2022 container with the sqlinstance objects copied into it. The default container also has GitVersion and Sampler installed as well as few other bits to make thigns easier and to save having to do the build everytime (as installing gitversion was a PITA and lengthy)\n\nThe containers are all now hosted in the dbachecks docker hub account.\n\nWhat does this mean?\n\nIt means that as well as using a dev container to develop in, thus ensuring that everyone is using the same environment, we will also be using the Sampler build and test process to ensure that we are __always__ using a clean build of the code we are writing and testing. :-)\n\nSo to develop you need to understand the following:\n\nThe code in the source directory is the code that will be built and deployed to the PowerShell Gallery. This is the directory that you will be changing the code in.\n\nNOTE - You will get really frustrated if you alter the code in the output directory and then build it again and find it doesnt work and the code all vanished. ASK ME HOW I KNOW !!!\n\nThe code in the output directory is the code that is built by Sampler. It is in the gitignore file so that it is not committed to the repo. This is the code that you can test with the 3 SQL instances. The advantage is that the Sampler build process will create a clean environment and add the built module into the PSModulePath.\n\n# Workflow\n\n## Once in a session\n- Run `.\\build.ps1 -ResolveDependency -Tasks noop` to download all required dependencies and set up the environment.\n\n## Coding\n\n- Code in the source directory\n- Save the files\n- Run the build.ps1 script\n    - with Tasks build `./build.ps1 -Tasks build`\n    - This will build the code and copy it to the output directory.\n    <img width=\"741\" alt=\"image\" src=\"https://user-images.githubusercontent.com/6729780/204135400-c324ef33-c7c2-4031-a408-d70d174fecd5.png\">\n\n<img width=\"588\" alt=\"image\" src=\"https://user-images.githubusercontent.com/6729780/204135445-9f071e4e-ef36-4e15-8357-9da7d541285f.png\">\n\n<img width=\"259\" alt=\"image\" src=\"https://user-images.githubusercontent.com/6729780/204135493-2f51c768-51b1-440a-9e2b-1559dd854f22.png\">\n\nOnce you have finished doing some coding and want to test\n    - With Tasks build test `./build.ps1 -Tasks build,test`\n    - This will build the code and run the Pester Tests.\n    <img width=\"854\" alt=\"image\" src=\"https://user-images.githubusercontent.com/6729780/204135632-e3918657-60b0-4f8b-9c29-65beb4c5a391.png\">\n    - if you have failed tests, you can\n        - Run Pester manually `Invoke-Pester tests`\n        <img width=\"922\" alt=\"image\" src=\"https://user-images.githubusercontent.com/6729780/204135673-78751e7b-cb5c-46c8-961d-07e5f25652c0.png\">\n        - You can check the test results in the browser by creating a html page\n        `.\\tests\\extent.exe -i .\\output\\testResults\\NUnitXml_dbachecks_v2.0.18.Linux.PSv.7.3.0.xml -o .\\output\\testResults\\reports -r v3html` and then __outside of the container__ `ii .\\output\\testResults\\reports\\index.html # outside of container`\n        <img width=\"1172\" alt=\"image\" src=\"https://user-images.githubusercontent.com/6729780/204135720-775f4932-05a1-464a-9323-e0d5fe8a2210.png\">\n    - Fix the broken tests or add more code and rinse and repeat."
  },
  {
    "path": "developing/Oslo Demo.ps1",
    "content": "# Oslo Demo\n\n./build.ps1 -tasks build\n\n#region setup\n$containers = $SQLInstances = $dbachecks1, $dbachecks2, $dbachecks3 = 'dbachecks1', 'dbachecks2', 'dbachecks3'\n$password = ConvertTo-SecureString \"dbatools.IO\" -AsPlainText -Force\n$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"sqladmin\", $password\n$show = 'All'\n\n$PSDefaultParameterValues = @{\n    \"*:SQlInstance\"   = $SQLInstances\n    \"*:SqlCredential\" = $cred\n}\n#endregion\n\n#region What do we have?\n\nGet-DbaDatabase | Select-Object Sqlinstance, Name, Status\n\nGet-DbaAgentJob | Select-Object Sqlinstance, Name, Enabled\n#end region\n\nGet-DbaLastBackup | Select-Object Sqlinstance, Database, LastFullBackup | Format-Table\n\n# lets run a couple of tests\n\n# this one shows that the old existing code will work\n# the legacy switch is set to true by default\n\nInvoke-DbcCheck -Check InstanceConnection, DatabaseStatus -Show $show\n\n# So lets show the shiny new faster code - legacy switch set to false\n\nInvoke-DbcCheck -Check InstanceConnection, DatabaseStatus -Show $show -legacy $false\n\n\n# The Authentication check failed but we  would like to pass  - lets  set config\nSet-DbcConfig -Name policy.connection.authscheme -Value SQL\n\n# run again\n\nInvoke-DbcCheck -Check InstanceConnection, DatabaseStatus -Show $show -legacy $false\n\n# Hmmm, we know that we will never be able to remote onto these containers so let talk about skipping. No Claudio not that sort of skipping!!\nSet-DbcConfig -Name skip.connection.remoting -Value $true\n\n# run again\n\nInvoke-DbcCheck -Check InstanceConnection, DatabaseStatus -Show $show -legacy $false\n\n# So much quicker !!! OK for one check it will be slower. For two it will probably be about the same but for 3 or more it will be quicker. Much quicket. Exrapolate that to 100 checks and a 1000 instances you can see the difference.\n\n# This is how we know - We perf test our PowerShell code\n# This will take about 80-100 seconds to run so run first then talk!\n\n$Checks = 'ErrorLogCount', 'XpCmdShellDisabled', 'WhoIsActiveInstalled', 'CLREnabled', 'TwoDigitYearCutoff', 'MaxDopInstance', 'ErrorLogCount', 'ModelDbGrowth', 'DefaultBackupCompression', 'SaExist', 'SaDisabled', 'SaRenamed', 'DefaultFilePath', 'AdHocDistributedQueriesEnabled', 'AdHocWorkload', 'DefaultTrace', 'OleAutomationProceduresDisabled', 'CrossDBOwnershipChaining', 'ScanForStartupProceduresDisabled', 'RemoteAccessDisabled', 'SQLMailXPsDisabled', 'DAC', 'OLEAutomation', 'ServerNameMatch', 'OrphanedFile', 'MaxMemory', 'PublicPermission'\n\nInvoke-PerfAndValidateCheck -Checks $Checks\n\n# I want to use the results in a different way\n\n# ok lets run the checks and save the out put to a variable so that we can show you what happens. Notice we need the -PassThru switch\n\n$CheckResults = Invoke-DbcCheck -Check InstanceConnection, DatabaseStatus -Show $show -legacy $false -PassThru\n\n# this is our base results object\n$CheckResults\n\n# lets convert it to something useful\n\n$SomethingUseful = $CheckResults | Convert-DbcResult\n\n$SomethingUseful\n$SomethingUseful | Format-Table\n#TODO: fix this Checking Instance Connection on on dbachecks3\n\n$SomethingUseful | Select-Object -First 1\n\n# Label huh - what is that?\n# label these results so that they can be filtered later\n\n$Coffee = $CheckResults | Convert-DbcResult -Label 'CoffeeFilter'\n\n$Coffee | Select-Object -First 1\n\n# Now we can set those to a file if we want\n\n$CheckResults | Convert-DbcResult -Label 'CoffeeFilter' | Set-DbcFile -FileType Json -FilePath . -FileName oslo -Verbose\n$CheckResults | Convert-DbcResult -Label 'Whiskey' | Set-DbcFile -FileType Json -FilePath . -FileName oslo -Append\n\ncode ./oslo.json\n\n# or put them into a database table\n\n$CheckResults | Convert-DbcResult -Label 'claudiodidthis' | Write-DbcTable -SqlInstance dbachecks1 -SqlCredential $cred -Database tempdb\n\nInvoke-DbaQuery -SqlInstance dbachecks1 -SqlCredential $cred -Database tempdb -Query 'SELECT COUNT(*) FROM CheckResults'\n\n# AUDIENCE AND OTHER PRESENTERS - WE NEED REMINDERS HERE !!!\n# YOU CANT DO THIS FROM HERE - Open Windows terminal on the host and run\n\nStart-DbcPowerBi -FromDatabase\n\n# AUDIENCE AND OTHER PRESENTERS - WE NEED REMINDERS HERE !!!\n# then use localhost,7401 tempdb and u:sqladmin p:dbatools.IO\n\n# question turn off a container and talk about the fails?\n\n\n## made some funky results for the Power Bi\n\n$CheckResults = Invoke-DbcCheck -Check Instance, Database -Show $show -legacy $false -PassThru\n\n$CheckResults | Convert-DbcResult -Label 'DatabaseInstance' | Write-DbcTable -SqlInstance dbachecks1 -SqlCredential $cred -Database tempdb -Verbose\n\n$CheckResults = Invoke-DbcCheck -Check compatibilitylevel -Show $show -legacy $false -PassThru"
  },
  {
    "path": "developing/PSConfEU demo.md",
    "content": "# PSConfEU demo\n\n1. Develop in the source repository\n  - copy existing check & rewrite - add check to `source/checks/Databasev5.Tests.ps1`\n  - add configuration to `source/internal/configurations/configuration.ps1`\n    - `skip.database.pseudosimple`\n    - `policy.database.pseudosimpleexcludedb`\n  - add object info to `source/internal/functions/Get-AllDatabaseInfo.ps1`\n\n\n2. Build the module\n    ```PowerShell\n    ./build.ps1 -Tasks build\n    ```\n\n3. Sampler automatically adds the new version to your path\n    ```PowerShell\n    get-module dbachecks -ListAvailable | select name, modulebase\n    ```\n\n4. Import new version of the module (if you get a bogus error the first time retry it)\n    ```PowerShell\n    Import-Module dbachecks -force\n    ```\n\n5. Test out the new code\n\n    ```PowerShell\n    # save the password to make for easy connections\n    $password = ConvertTo-SecureString \"dbatools.IO\" -AsPlainText -Force\n    $cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"sqladmin\", $password\n\n    $show = 'All'\n    $checks = 'RecoveryModel'\n\n    #$sqlinstances = 'localhost,7401', 'localhost,7402', 'localhost,7403'\n    $sqlinstances = 'dbachecks1', 'dbachecks2', 'dbachecks3' # need client aliases for this to work New-DbaClientAlias\n\n    # Run v4 checks\n    $v4code = Invoke-DbcCheck -SqlInstance $Sqlinstances -SqlCredential $cred -Check $Checks -legacy $true -Show $show -PassThru\n    # Run v5 checks\n    $v5code = Invoke-DbcCheck -SqlInstance $Sqlinstances -SqlCredential $cred -Check $Checks -legacy $false -Show $show -PassThru -Verbose\n\n    Invoke-PerfAndValidateCheck -SQLInstances $sqlinstances -Checks $Checks\n    Invoke-PerfAndValidateCheck -SQLInstances $sqlinstances -Checks $Checks -PerfDetail\n    Invoke-PerfAndValidateCheck -SQLInstances $sqlinstances -Checks $Checks -showTestResults\n    ```\n\n"
  },
  {
    "path": "developing/Robs-Instance.ps1",
    "content": "./build.ps1 -Tasks build\n\n$Checks = 'ErrorLogCount', 'XESessionExists', 'XESessionStopped', 'XpCmdShellDisabled', 'WhoIsActiveInstalled', 'CLREnabled', 'TwoDigitYearCutoff', 'MaxDopInstance', 'ErrorLogCount', 'ModelDbGrowth', 'DefaultBackupCompression', 'SaExist', 'SaDisabled', 'SaRenamed', 'DefaultFilePath', 'AdHocDistributedQueriesEnabled', 'AdHocWorkload', 'DefaultTrace', 'OleAutomationProceduresDisabled', 'CrossDBOwnershipChaining', 'ScanForStartupProceduresDisabled', 'RemoteAccessDisabled', 'SQLMailXPsDisabled', 'DAC', 'OLEAutomation', 'ServerNameMatch', 'OrphanedFile', 'MaxMemory', 'NetworkLatency', 'PublicPermission'\n\n$Checks = 'XESessionRunningAllowed', 'XESessionRunning', 'XESessionRunningAllowed', 'XESessionExists', 'XESessionStopped', 'XpCmdShellDisabled'\n$Checks = 'TraceFlagsNotExpected', 'TraceFlagsExpected'\n$Checks = 'ServerNameMatch'\n$Checks = 'BackupPathAccess'\n$Checks = 'LatestBuild'\n$Checks = 'NetworkLatency'\n$Checks = 'LinkedServerConnection'\n$Checks = 'MaxMemory'\n$Checks = 'OrphanedFile'\n$Checks = 'MemoryDump'\n$Checks = 'HideInstance'\n$Checks = 'LoginAuditFailed'\n$Checks = 'LoginAuditSuccessful'\n$Checks = 'LoginCheckPolicy'\n$Checks = 'SuspectPageLimit'\n$Checks = 'SupportedBuild'\n$Checks = 'LoginMustChange'\n$Checks = 'LoginAuditSuccessful', 'LoginAuditFailed'\nSet-DbcConfig -Name skip.security.PublicPermission -Value $false\n$Checks = 'PublicRolePermission'\n$Checks = 'PUblicPermission'\n$Checks = 'Database'\n$Checks = 'AgentServiceAccount', 'DbaOperator', 'DatabaseMailProfile', 'AgentMailProfile'\n\n$DatabaseTags = (Get-DbcCheck -Group Database).UniqueTag\n\n$Checks = $DatabaseTags[1..5]\n\n\nInvoke-PerfAndValidateCheck -Checks $Checks\nInvoke-PerfAndValidateCheck -Checks $Checks -PerfDetail\n$containers = $SQLInstances = $dbachecks1, $dbachecks2, $dbachecks3 = 'dbachecks1', 'dbachecks2', 'dbachecks3'\n$password = ConvertTo-SecureString \"dbatools.IO\" -AsPlainText -Force\n$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"sqladmin\", $password\n$show = 'All'\n\n$v4code = Invoke-DbcCheck -SqlInstance $Sqlinstances -SqlCredential $cred -Check $Checks -legacy $true -Show $show -PassThru -verbose\n# Run v5 checks\n$v5code = Invoke-DbcCheck -SqlInstance $Sqlinstances -SqlCredential $cred -Check $Checks -legacy $false -Show $show -PassThru -Verbose\n\nSet-DbcConfig -Name policy.xevent.requiredrunningsession -Value system_health\nSet-DbcConfig -Name policy.xevent.requiredrunningsession -Value system_health , AlwaysOn_health\nSet-DbcConfig -Name policy.xevent.requiredrunningsession -Value system_health , AlwaysOn_health, QuickSessionStandard\n\nSet-DbcConfig -Name policy.xevent.validrunningsession -Value system_health , AlwaysOn_health\nSet-DbcConfig -Name policy.xevent.validrunningsession -Value AlwaysOn_health\n\n\n$SQLInstances = $dbachecks1, $dbachecks2, $dbachecks3 = 'dbachecks1', 'dbachecks2', 'dbachecks3'\n$password = ConvertTo-SecureString \"dbatools.IO\" -AsPlainText -Force\n$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"sqladmin\", $password\n$show = 'All'\n\n$traci = Trace-Script -ScriptBlock {\n    $v5code = Invoke-DbcCheck -SqlInstance $Sqlinstances -SqlCredential $cred -Check $Checks -legacy $false -Show $show -PassThru\n}\n$traci1 = Trace-Script -ScriptBlock {\n    $v5code = Invoke-DbcCheck -SqlInstance $Sqlinstances -SqlCredential $cred -Check $Checks -legacy $false -Show $show -PassThru\n}\n$traci = Trace-Script -ScriptBlock {\n    $v4code = Invoke-DbcCheck -SqlInstance $Sqlinstances -SqlCredential $cred -Check $Checks -legacy $true -Show $show -PassThru\n}\n\nInvoke-DbcCheck -SqlInstance $Sqlinstances -SqlCredential $cred -Check failsafeoperator -legacy $false -Show $show -verbose"
  },
  {
    "path": "developing/Setting up for Sampler.ps1",
    "content": "# Setting up for Sampler\n\nInstall-Module -Name 'Sampler' -Scope 'CurrentUser' -AllowPrerelease\n$samplerModule = Import-Module -Name Sampler -PassThru\n\n$invokePlasterParameters = @{\n    TemplatePath    = Join-Path -Path $samplerModule.ModuleBase -ChildPath 'Templates/Sampler'\n    DestinationPath = '..\\'\n    ModuleType      = 'CompleteSample'\n    ModuleName      = Split-Path -Leaf $PWD\n    SourceDirectory = 'source'\n}\n     \n\nInvoke-Plaster @invokePlasterParameters -Verbose\n\n\n\n.\\build.ps1 -ResolveDependency -Tasks noop\n\n./build.ps1 -Tasks ?\n\n./build.ps1 -Tasks build\n./build.ps1 -Tasks build, tests\n\n# If we get test failures whilst developing, we can check the test results in the browser by creating a html page\n\n.\\tests\\extent.exe -i .\\output\\testResults\\NUnitXml_dbachecks_v2.0.18.Linux.PSv.7.3.0.xml -o .\\output\\testResults\\reports -r v3html\n\nii .\\output\\testResults\\reports\\index.html # outside of container\n\n# the other option is to the tests with Invoke-Pester\n\nInvoke-Pester ./tests \n"
  },
  {
    "path": "developing/settingupfor2022.ps1",
    "content": "docker run -p 52001:1433 dbatools/sqlinstance2 \ndocker run -p 52000:1433 -v sqlserver:/var/opt/sqlserver  -d dbatools/sqlinstance --name mssql1\ndocker run -e \"ACCEPT_EULA=Y\" -e \"MSSQL_SA_PASSWORD=dbatools.IO\" -p 52002:1433 --name mssql3 --hostname mssql3 -v sqlserver:/var/opt/sqlserver -d  mcr.microsoft.com/mssql/server:2022-latest\n\n# thank you Andrew\n\ndocker exec -u 0 mssql1  bash -c \"chown mssql /var/opt/sqlserver\"\ndocker exec -u 0 mssql3  bash -c \"chown mssql /var/opt/sqlserver\"\n\n$mssql1cred = Get-Credential\n$mssql2cred = Get-Credential\n$mssql3cred = Get-Credential\n\n$sql1 = Connect-DbaInstance -SqlInstance 'localhost,52000' -SqlCredential $mssql2cred\n$sql2 = Connect-DbaInstance -SqlInstance 'localhost,52001' -SqlCredential $mssql2cred\n$sql3 = Connect-DbaInstance -SqlInstance 'localhost,52002' -SqlCredential $mssql3cred\n\nGet-DbaLogin -SqlInstance $sql1,$sql2,$sql3  | ft\nGet-DbaDatabase -SqlInstance $sql1,$sql2,$sql3  | ft\nGet-DbaAgentJob -SqlInstance $sql1,$sql2,$sql3  | ft\nGet-DbaDbCertificate -SqlInstance $sql1,$sql2,$sql3  | ft\n\ndocker run -p 52000:1433 -v sqlserver:/var/opt/sqlserver  -d dbatools/sqlinstance --name mssql1\ndocker run -e \"ACCEPT_EULA=Y\" -e \"MSSQL_SA_PASSWORD=dbatools.IO\" -p 52002:1433 --name mssql3 --hostname mssql3 -v sqlserver:/var/opt/sqlserver -d  mcr.microsoft.com/mssql/server:2022-latest\n\nBackup-DbaDatabase -SqlInstance $sql1 -BackupDirectory /var/opt/sqlserver -Type Full \n\nStart-DbaMigration -Source $sql1 -Destination $sql3 -UseLastBackup "
  },
  {
    "path": "docs/RELEASE.md",
    "content": "## 23rd August 2021\n\nFixed bug where custom tests left an empty DbcResult #846\nAdded feature to overwrite config file if it already exists for Export-DbcConfig #844\nEnabled ping latency testing in PowerShell Core\n\n##Latest\n## 23rd August 2021\n\nRemoved the Verbose for the Pester load - Apologies, this was Rob!\nThank 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\nThank you [@MikeyBronowski](https://www.github.com/MikeyBronowski) spelling and full stops #842\nThank you [ashdar](https://github.com/ashdar) Check for existence in the Tag list before adding a Tag to the Tag list #853\nThank you [ashdar](https://github.com/ashdar) Updated PowerPlan Assertion #850\nThank you [tboggiano](https://github.com/tboggiano) CIS check for SQL Mail XPS for SQL Server 2008 and below (was) #779\nThank you [tboggiano](https://github.com/tboggiano) Added function to set CIS config (was) #776\nThank you [tboggiano](https://github.com/tboggiano) CIS check for TCP IP Protocols (was) #775\n\n## April 7th 2021\n\nThank you [@mikedavem](https://www.github.com/mikedavem) Fixed rogue verbose when importing [#834](https://github.com/sqlcollaborative/dbachecks/issues/834)\n\nThank 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)\n\nThank 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)\n\nThank 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)\n\nThank you [@MikeyBronowski](https://www.github.com/MikeyBronowski) Get-DbcConfig Adding support to multiple names [#829](https://github.com/sqlcollaborative/dbachecks/issues/829)\n\nThank you [@MikeyBronowski](https://www.github.com/MikeyBronowski) Spellings [#827](https://github.com/sqlcollaborative/dbachecks/issues/827)\n\nThank you [@TheAntGreen](https://www.github.com/TheAntGreen) updated variables to make errors obvious [#825](https://github.com/sqlcollaborative/dbachecks/issues/825)\n\nThank you [@MrBlueSky](https://www.github.com/MrBlueSky) - add info to suggest using Duplicate index command [#807](https://github.com/sqlcollaborative/dbachecks/issues/807)\n\nThank you [@PsPsam](https://www.github.com/PsPsam) - Ping check to work on core and 5.1 [#763](https://github.com/sqlcollaborative/dbachecks/issues/763)\n\nThank you [@zikato](https://www.github.com/zikato) - certificate expiration gives two failures if in the past [#785](https://github.com/sqlcollaborative/dbachecks/issues/785)\n\nThank 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)\n\nThank you [@Shashtsoh](https://www.github.com/Shashtsoh) - Remove aliases to work in core [#837](https://github.com/sqlcollaborative/dbachecks/issues/837)\n\nThank you [@a4ic6n](https://www.github.com/a4ic6n) - Max Memory check false succeeds [#836](https://github.com/sqlcollaborative/dbachecks/issues/836)\n\n\n## December 14th 2020\n\nThank you tboggiano Browser check altered for instance count #758\nThank you zikato - Fixing datafile auto growth #786\nThank you fatherjack Typos #767\nThank you tboggiano Query Store enabled and disabled test improvements #791\nThank you relsna fixed issue with error log window #814\nThank you @TheAntGreen Typos #815\nThank you @TheAntGreen Add additional filter to filter out negative run_durations #816\nThank you @TheAntGreen Add policy for additional excluded dbs from the SAFE CLR check #817\nThank you @MikeyBronowski Fix the check for enabled alerts #819\nThank you @MikeyBronowski Updating the link in documentation #820\nThank you @mikedavem Updated HADR checks with additional checks #822\nThank you @mikedavem Database backup diff check - fix issue #812 #824\n\n## Date November 23rd 2020\n\nFinally Rob gets around to working on PRs - Really sorry it has taken so long\n\nFixes for bug 780 & 783 #784 - Thank you @TheAntGreen\nFix local windows groups, additional filter needed on the object filter #789 - Thank you @TheAntGreen\n$null check for anything running SQL2008R2 or below as containment doesnt exist in those versions. #790 - Thank you @TheAntGreen\n\nFix for IsClustered checks for service startup types #792  - Thank you @TheAntGreen\n\nCertCheck took ages to run, was still checking excluded DB's then filtering, change to not query the excluded DBs #793  - Thank you @TheAntGreen\n\nFixed few typos in docs #799 - Thank you @jpomfret\n\nFixed few typos in docs #799 - Thank you @TheAntGreen\n\nDuplicateIndex 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\n\nGuestUserConnect - 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\n\nNotExpectedTraceFlag - added a filter to filter out any trace flags which WHERE expected to prevent false positive alerts #801 - Thank you @TheAntGreen\n\nAdd policy to exclude databases on the trustworthy check #806  - Thank you @TheAntGreen\n\nUnused Index Check wasn't executing correctly #808   - Thank you @TheAntGreen\n\n#803 Addition of the date filter for File Autogrowth detection #809   - Thank you @TheAntGreen\n\nNew Check - Agent Mail Profile #811   - Thank you @TheAntGreen\n\nScan for startup procs, use config option to override the value in use #813  - Thank you @TheAntGreen\n\n##Latest\n\n## Date September 22nd 2020\n\nOnly Importing Pester v4 and lower to reduce Pester v5 errors\n\n## Date July 13th 2020\n\nThank you jpomfret Added skip.backup.readonly config  #777\nThank you jpomfret typos  #771\nThank you jpomfret Added MSDB suspect pages table check  #768\nThank you markaugust Added instance name to Agent Service ACcount checks #766\nThank you tboggiano fixed Agent Run time calculation #746\n\n## Date 9th May 2020\n\nUPDATED TO VERSION 2\n\nNew Commands\n\n    Convert-DbcResult - To parse results and add Label, ComputerName, Instance and Database\n    Set-DbcFile - To save the parsed results to a file json, csv or xml\n    Write-DbcTable - to add results to a database\n\nNew Parameter\n    -FromDatabase on Star-DbcPowerBi - to open new Power Bi template file\n\nNew PowerBi template file for reporting on results from the database\n\nImproved Spelling\n\nUpdated Unit Tests for Checks to enabled results to be parsed\n\nImproved Check Titles\n\nConfiguration for Max history days for Job duration\n\nStop trying to check inaccessible databases for checks\n\nImproved Query Store checks\n\nEnsure long running agent jobs ignores durations longer than 24 hours\n\nIgnore jobs that never stop from the duration check\n\n##Latest\n\n## Date 29th March 2020\n\nUPDATED MINIMUM POWERSHELL VERSION\n\nUpdated Required versions of Pester, dbatools and PSFramework modules\n\nThank you @dstrait\n    Fix variable for SaDisabled check #750\n    Fix errant braces in SQL Browser Service Check #751\n    Fix PingComputer Check #752\n\nThank you markaugust\n    Fix to ensure AG Name is in HADR checks #755\n\nThank you Tracey Boggiano\n    Added Contained Database auth check and Query Store Enabled Checks #756\n\nThank you Rob\n    Added exclude database config for Query store checks\n    Version check for Query Store Checks\n    Some spellings!\n\n##Latest\n\n## Date 18th March 2020\nThank you Tracey tboggiano\n    New CIS user-defined CLRs to be set to SAFE_ACCESS #734\n    CIS tests for if service accounts are local admins #736\n\nThank you Rob\n    Getting service accounts tests to pass if no service\n    Made long running jobs check work as expected\n    Improved Database Mail check\n    Made sure disk allocations dont run on Core\n\nThank you mikedavem\n    Fixed bug in disk allocation check exclusions\n    Added multiple ags to the HADR check #742\n\n## Date 14th March 2020\nThank you Tracey tboggiano\n    New CIS Check Hide Instance #728\n    New CIS Check Symmetric Key #732\n    New CIS Check Agent Proxy not have access to public Role #732\n\n## Date 8th January 2020\nThank you Tracey tboggiano\n    New CIS Check Guest Account connect permissions #725\n    New CIS Check BuiltIn Admins login #726\n    New CIS Check public role permissions #729\n    New CIS Check local windows groups do not have logins #731\n    Update sa login check #730\n\nThank you Rob\n    Added Tag parameter to Get-DbcCheck\n    Updated tests to work with PowerShell 7\n\n## Date 22nd December\nThank you Tracey tboggiano\n    Two New CIS Checks Contained databases should be auto-closed #721\n    sa login disabled and should not exist #719\n\nThank you Rob\n    Fix bug in Agent Tests #723\n\n## Date 28th November\nThank you Tracey tboggiano\n    Added new CIS Check for the latest SQL build #716\n\nThank you Rob\n    Making the SQL Engine Service Check configurable #706\n\n## Date 26th November\nThank you Tracey @tboggiano\n    Added new CIS Check for OLE AUtomation Procedures to be disabled #707\n    Moving the Cross DB Ownership Chaining check into the AllInstance check to help speed up checks #708\nThank you Rob\n    Fixing the Tags so that they are picked up by AllInstanceInfo Fixes #715\n\n## Date 16th November\nThank you Matt @matt2005\n    Removed rogue else from Agents Tests #713\n\n## Date 17th October\nThank you Shane @SOZDBA\n    Improved Documentation\nThank you Gareth NewMan\n    Added New Check - Default File Path\n\n## Date 1st October 2019\nThank you Rob\nFixed some merge issues with a load of code :-(\nCreated GitHub Action to run Pester Checks on PR\nThank you @TracyBoggiano\nAdded New Checks\n    RemoteAccessDisabled\n    ScanForStartUpProcedures\nThank you Gareth Newman\n    Improved wording in tests #700 , #697\n    Fix incorrect calculation in last agent run time #696 #698\nFixed bug in AllInstanceInfo\nThank you Richard Imenes\n    Fixed dead links in readme #702\nThank you Benjamin Schenk\n    Fixed Send-MailMessage in readme #705\n\n## Date 30th July 2019\nThank you Rob ;-)\nAdded two new checks #239\n    LastJobRunTime and LongRunningJob\nAdded four new configs\n    skip.agent.longrunningjobs\n    skip.agent.lastjobruntime\n    agent.longrunningjob.percentage\n    agent.lastjobruntime.percentage\n\n## Date 29th July 2019\nThank you @TracyBoggiano\nAdded tags for checks that will be part of CIS checks #642\nCIS project started\nAdded check for default trace enabled #684\n\n## Date 23rd July 2019\nThank you @dstrait, @Sozdba\nFix tests that use time to work if client and instance are in different time zones #610\nFixed Maintenance Solution clean up time test #633\nImproved Run time #635\nImproved Error Log warning window honouring #637\nIgnore SQL 2005 for some tests #630,629,#628\nSkip TF1118 test if SQL2016 or above\n\n## Date 8th July 2019\nThanks to Chuck for notifying of error\nFixed Update-DbcPowerBiDataSource\n\n\n## Date 2nd July 2019\ndbachecks works with PowerShell Core #620\ndbachecks works with dbatools v1 #624\nMinimum PowerShell Now 5.0 #568\nPrettier output in test names for @cl because she is ace #495\nFixes for none-readable secondaries causing tests to fail #611\nAdded ability to exclude disks from disk allocation check #561\nAdded ability to exclude cancelled jobs from failed job check #552\nAdded max job history for failed jobs #552\nSome extra tags added\n\n## Date 22nd May 2019 at Techorama in Room 12\nThank You @SOZDBA, @djfcc, @wsmelton\nImproved validation for IP addresses in clusters\nIgnored Off-line databases for Pseudo Recovery Checks\nSome internal testing changes\n\n\n## Date 05/02/2019\nThank you Chrissy! @cl\nadded default environment #596\naltered configuration validation for mail to stop errors\nEnsured database status check doesnt fail as readonly for snapshots\n\n## Date 31/01/2019\nThank you Chrissy!\nadd support for inline config file, fixes #501 #594\n\n## Date 29/01/2019\nAdded skip for authentication scheme #587\nAdded WhatIf to Update-DbcPowerBiDataSource Thank you @shaneis #590\n$null to the left Thank you @jwmoss #588\n\n## Date 19/01/2019\nThank you Claudio\nAdded extra check for Job History Settings #582\nAdded extra check for Error Log Count #583\nAdded integration test code and docker compose file\n\n##Latest\n\n## Date 22/11/2018\nSpelling - Thanks RonaldHensbergen\nFix for #576 When calling just Invoke-DbcCheck without a Check it fails to run the Server Tests correctly\n\n\n## Date 12/11/2018\nAdded more information to the output - thanks @ClaudioESSilva\nSpelling - Thanks ChrisTuckerNM\nFix for #564 - Error Importing DbcConfig in PowerShell 4 - Thanks @niphod\n\n## Date 29/10/2018\nFixed #435 Page verify on SQL 2000 and SQL2005\nReduced number of calls to the instance for database checks improving performance\n\n## Date 27/10/2018\nFixed #435 Page verify on SQL 2000 and SQL2005\nReduced number of calls to the instance for database checks improving performance\n\n## Date 17/10/2018\nSpelling and Because added - Thank you @LowlyDBA\nNew Check for XPCmdShell enabled added\n\n## Date 11/10/2018\nAdded Check for CLR Enabled\nAdded Check for Cross Database Ownership Chaining\nAdded Check for Database Mail XPs\nAdded Check for Ad Hoc Distributed Queries\nAdded Tag for security\nDemo CI/CD at Polar Conf\n\n## Date 24/09/2018\nMoved the Instance Connection Check to the Instance Tests\nFixed bug with Set-DbcConfig not adding none-arrays!\nNew Check for Expected Trace Flags\nNew Check for Not Expected TraceFlags\nStopped dbatools chatty messages polluting the test results\n\n## Date 07/09/2018\nUpdated dbatools required module to 0.9.410\nRenamed all dbatools commands to new naming convention\nFixed Bug with JSON file naming\nImproved Server Checks to remove Red and improve speed for none contactable servers\nAltered all server checks to use assertions and added pester Tests\nRemoved left over ogv entry\n\n## Date 05/09/2018\nNew Check for 2 digit cut off thanks @CláudioESSilva\nhttps://claudioessilva.eu/2018/09/04/dont-cutoff-yourself-when-dealing-with-dates-in-t-sql-did-you-know/\nFixed bug with adding NoneContactable Instances to variable\nImproved error handling for HADR checks\n\n## Date 28/08/2018\nAdded MaxBehind to SupportedBuild Tests - Thank you @LowlyDBA\nEnsured the Database parameter checks only the specified Databases - Thank you @jpomfret\nUpdated Set-DbcConfig to allow Append to append arrays to arrays closes #535\nAltered json filename creation to avoid max characters error\nAltered PowerBi to display information correctly with filename changes\n\n## Date 24/08/2017\nFixed Error with using Credential and stopped changing path when running checks from custom repos - Thank you @sammyxx\n\n## Date 23/08/2017\nUpdate to the help message for clusters by @LowlyDBA\nPotential Breaking Change - Removed Tags from names of json files so that PowerBi will correctly show Environment names\n\n## Date 15/08/2018\nFixed issue 521 ExcludeDatabase parameter doesn't work - THANK YOU @jpomfret\nTHANK YOU @jpomfret - Issue 509 -Database should only check databases listed and exclude all others\nFurther update to Update-DbcPowerBiDataSource to allow Environment as well as specify filename\nImproved performance of the Server checks\nImproved performance of the Instance checks\nImproved performance of the Database checks\nImproved performance of the ErrorLog checks\nRemoved Send-DbcSendMailMessage until it can be re-coded\n\n## Date 13/08/2018\nFixed #504 by enabling FileName parameter on Update-PowerBiDataSource\nAdded in new function to begin to reduce the number of calls to each instance\nReduced required Pester version to 4.3.1\nFurther PowerShell V4 improvements\n\n## Date 06/08/2018\nAdded New Check for tempdb data file sizes to be the same - Thank you @garethnewman #512\nAltered Services Check so that clustered instances start mode is checked correctly thank you @kylejdoyle #516\nSkip PowerPlan test if no connection thanks @cl #490\nFixed bug with XESession and PSv4 thank you @kylejdoyle #517\nError silently on failing Service check (thanks Rob ;-) )\nFixed dbatools command names\nFixed PSv4 support for importing the module also\n\n## Date 31/07/2018\n\nAdded check for Database Exists - Thanks @sqldbawithbeard\nAdded excluded databases config to each Database Check and wrote Pester Test for that #506\nAdded msdb to exclusion fro duplicate index #506\nFixed offline install bug #484\n\n## Date 30/07/2018\n\nUpdated Required Module versions - Thank you @cl\nUpdated Agent Checks to fail a test on no connection rather than throw all the PowerShell errors - Thanks @sqldbawithbeard\nUpdated HADR Checks for PS4 compatibility Issue #513\n\n## Date 28/06/2018\n\nDon't check versions before 2008 for AdHocWorkloads Thank you John McCall @LowlyDBA\nMore Spelling! Thank you John McCall @LowlyDBA\nUpdated required version and dbatools error log command name Thank you Our Glorious Chrissy @cl\n\n## Date 30/05/2018\nNew Release Notes command added\nSpelling\n\n## Date 29/05/2012\n\n"
  },
  {
    "path": "docs/functions/Clear-DbcPowerBiDataSource.md",
    "content": "# Clear-DbcPowerBiDataSource\n\n## SYNOPSIS\nClears the data source directory created by Update-DbcPowerBiDataSource\n\n## SYNTAX\n\n```\nClear-DbcPowerBiDataSource [[-Path] <String>] [[-Environment] <String>] [-EnableException] [<CommonParameters>]\n```\n\n## DESCRIPTION\nClears the data source directory created by Update-DbcPowerBiDataSource (\"C:\\windows\\temp\\dbachecks\\*.json\" by default).\nThis command makes it easier to clean up data used by PowerBI via Start-DbcPowerBi.\n\n## EXAMPLES\n\n### EXAMPLE 1\n```\nClear-DbcPowerBiDataSource\n```\n\nRemoves \"$env:windir\\temp\\dbachecks\\*.json\"\n\n### EXAMPLE 2\n```\nClear-DbcPowerBiDataSource -Environment Production\n```\n\nRemoves \"$env:windir\\temp\\dbachecks\\*Production*.json\"\n\n## PARAMETERS\n\n### -Path\nThe directory to your JSON files, which will be removed.\n\"C:\\windows\\temp\\dbachecks\\*.json\" by default\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: 1\nDefault value: \"$env:windir\\temp\\dbachecks\"\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -Environment\nRemoves the JSON files for a specific environment\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: 2\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -EnableException\nBy default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: False\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### CommonParameters\nThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).\n\n## INPUTS\n\n## OUTPUTS\n\n## NOTES\n\n## RELATED LINKS\n\n[https://dbachecks.readthedocs.io/en/latest/functions/Clear-DbcPowerBiDataSource/](https://dbachecks.readthedocs.io/en/latest/functions/Clear-DbcPowerBiDataSource/)\n\n"
  },
  {
    "path": "docs/functions/Convert-DbcResult.md",
    "content": "# Convert-DbcResult\n\n## SYNOPSIS\nTakes the results of Invoke-DbcCheck, parses it and converts it to a datatable object\n\n## SYNTAX\n\n```\nConvert-DbcResult [-TestResults] <PSObject> [[-Label] <String>] [<CommonParameters>]\n```\n\n## DESCRIPTION\nYou need to run Invoke-DbcCheck with the PassThru parameter and this command will take the\nresults and parse them creating a datatable object with column headings\nDate Label Describe Context Name Database ComputerName Instance Result FailureMessage\nso that it can be written to a database with Write-DbcTable (or Write-DbaDataTable) or to\na file with Set-DbcFile\n\n## EXAMPLES\n\n### EXAMPLE 1\n```\nInvoke-DbcCheck -SqlInstance SQL2017N5 -Check AutoClose -Passthru | Convert-DbcResult -Label Beard-Check\n```\n\nRuns the AutoClose check against SQL2017N5 and converts to a datatable with a label of Beard-Check\n\n### EXAMPLE 2\n```\nInvoke-DbcCheck -SqlInstance SQL2017N5 -Check AutoClose -Passthru | Convert-DbcResult -Label Beard-Check | Write-DbcTable -SqlInstance sql2017n5 -Database tempdb -Table newdbachecks\n```\n\nRuns the AutoClose check against SQL2017N5 and converts to a datatable with a label of Beard-Check and writes it to a table newdbachecks in tempdb on SQL2017N5 (NB Don't use tempdb!!)\n\n### EXAMPLE 3\n```\nInvoke-DbcCheck -SqlInstance SQL2017N5 -Check AutoClose -Passthru | Convert-DbcResult -Label Beard-Check | Set-DbcFile -FilePath C:\\temp\\dbachecks\\ -FileName Auto-close.json -FileType Json\n```\n\nRuns the AutoClose check against SQL2017N5 and converts to a datatable with a label of Beard-Check and outputs to JSON and saves in C:\\temp\\dbachecks\\Auto-close.json\n\n## PARAMETERS\n\n### -TestResults\nThe output of Invoke-DbcCheck (WITH -PassThru)\n\n```yaml\nType: PSObject\nParameter Sets: (All)\nAliases:\n\nRequired: True\nPosition: 1\nDefault value: None\nAccept pipeline input: True (ByValue)\nAccept wildcard characters: False\n```\n\n### -Label\nAn optional label to add to the set of results to identify them - Think Morning-Checks or New-instance\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: 2\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### CommonParameters\nThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).\n\n## INPUTS\n\n## OUTPUTS\n\n### System.Data.DataTable\n## NOTES\nInitial - RMS 28/12/2019\n\n## RELATED LINKS\n"
  },
  {
    "path": "docs/functions/Export-DbcConfig.md",
    "content": "# Export-DbcConfig\n\n## SYNOPSIS\nExports dbachecks configs to a json file to make it easier to modify or be used for specific configurations.\n\n## SYNTAX\n\n```\nExport-DbcConfig [[-Path] <String>] [-Force] [<CommonParameters>]\n```\n\n## DESCRIPTION\nExports dbachecks configs to a json file to make it easier to modify or be used for specific configurations.\n\n## EXAMPLES\n\n### EXAMPLE 1\n```\nExport-DbcConfig\n```\n\nExports config to \"$script:localapp\\config.json\"\n\n### EXAMPLE 2\n```\nExport-DbcConfig -Path \\\\nfs\\projects\\config.json\n```\n\nExports config to \\\\\\\\nfs\\projects\\config.json\n\n### EXAMPLE 3\n```\n$config = Export-DbcConfig | Invoke-Item\n```\n\nExports config to \"$script:localapp\\config.json\" as and opens it in a default application.\n\n## PARAMETERS\n\n### -Path\nThe path to export to, by default is \"$script:localapp\\config.json\"\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: 1\nDefault value: \"$script:localapp\\config.json\"\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -Force\nOverwrite Existing file\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: False\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### CommonParameters\nThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).\n\n## INPUTS\n\n## OUTPUTS\n\n### System.String\n## NOTES\n\n## RELATED LINKS\n\n[https://dbachecks.readthedocs.io/en/latest/functions/Export-DbcConfig/](https://dbachecks.readthedocs.io/en/latest/functions/Export-DbcConfig/)\n\n"
  },
  {
    "path": "docs/functions/Get-DbcCheck.md",
    "content": "# Get-DbcCheck\n\n## SYNOPSIS\nLists all checks, tags and unique identifiers\n\n## SYNTAX\n\n```\nGet-DbcCheck [[-Tag] <String>] [[-Pattern] <String>] [[-Group] <String>] [<CommonParameters>]\n```\n\n## DESCRIPTION\nLists all checks, tags and unique identifiers\n\n## EXAMPLES\n\n### EXAMPLE 1\n```\nGet-DbcCheck\n```\n\nRetrieves all of the available checks\n\n### EXAMPLE 2\n```\nGet-DbcCheck backups\n```\n\nRetrieves all of the available tags that match backups\n\n## PARAMETERS\n\n### -Tag\nThe tag to return information about\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: 1\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -Pattern\nMay be any string, supports wildcards.\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: 2\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -Group\nTo be able to filter by group\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: 3\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### CommonParameters\nThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).\n\n## INPUTS\n\n## OUTPUTS\n\n## NOTES\n\n## RELATED LINKS\n\n[https://dbachecks.readthedocs.io/en/latest/functions/Get-DbcCheck/](https://dbachecks.readthedocs.io/en/latest/functions/Get-DbcCheck/)\n\n"
  },
  {
    "path": "docs/functions/Get-DbcConfig.md",
    "content": "# Get-DbcConfig\n\n## SYNOPSIS\nRetrieves configuration elements by name.\n\n## SYNTAX\n\n```\nGet-DbcConfig [[-Name] <String[]>] [-EnableException] [<CommonParameters>]\n```\n\n## DESCRIPTION\nRetrieves configuration elements by name.\nCan be used to search the existing configuration list.\n\n## EXAMPLES\n\n### EXAMPLE 1\n```\nGet-DbcConfig app.sqlinstance\n```\n\nRetrieves the configuration element for the configuration app.sqlinstance\n\n## PARAMETERS\n\n### -Name\nDefault: \"*\"\nThe name of the configuration element(s) to retrieve.\nMay be any string, supports wildcards.\n\n```yaml\nType: String[]\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: 1\nDefault value: *\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -EnableException\nBy default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: False\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### CommonParameters\nThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).\n\n## INPUTS\n\n## OUTPUTS\n\n## NOTES\n\n## RELATED LINKS\n\n[https://dbachecks.readthedocs.io/en/latest/functions/Get-DbcConfig/](https://dbachecks.readthedocs.io/en/latest/functions/Get-DbcConfig/)\n\n"
  },
  {
    "path": "docs/functions/Get-DbcConfigValue.md",
    "content": "# Get-DbcConfigValue\n\n## SYNOPSIS\nRetrieves raw configuration values by name.\n\n## SYNTAX\n\n```\nGet-DbcConfigValue [[-Name] <String>] [-EnableException] [<CommonParameters>]\n```\n\n## DESCRIPTION\nRetrieves raw configuration values by name.\n\nCan be used to search the existing configuration list.\n\n## EXAMPLES\n\n### EXAMPLE 1\n```\nGet-DbcConfigValue app.sqlinstance\n```\n\nRetrieves the raw value for the key \"app.sqlinstance\"\n\n## PARAMETERS\n\n### -Name\nDefault: \"*\"\n\nThe name of the configuration element(s) to retrieve.\nMay be any string, supports wildcards.\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: 1\nDefault value: *\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -EnableException\nBy default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: False\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### CommonParameters\nThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).\n\n## INPUTS\n\n## OUTPUTS\n\n## NOTES\n\n## RELATED LINKS\n\n[https://dbachecks.readthedocs.io/en/latest/functions/Get-DbcConfig/](https://dbachecks.readthedocs.io/en/latest/functions/Get-DbcConfig/)\n\n"
  },
  {
    "path": "docs/functions/Get-DbcReleaseNote.md",
    "content": "# Get-DbcReleaseNote\n\n## SYNOPSIS\nReturns the release notes for the module - organised by date\n\n## SYNTAX\n\n```\nGet-DbcReleaseNote [-Latest]\n```\n\n## DESCRIPTION\nGrabs the release notes for the dbachecks module and returns either the latest or all of them\n\n## EXAMPLES\n\n### EXAMPLE 1\n```\nGet-DbcReleaseNote\n```\n\nReturns the release notes for the dbachecks module\n\n### EXAMPLE 2\n```\nGet-DbcReleaseNote -Latest\n```\n\nReturns just the latest release notes for the dbachecks module\n\n## PARAMETERS\n\n### -Latest\nA Switch to return the latest release notes only\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: False\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n## INPUTS\n\n## OUTPUTS\n\n## NOTES\n30/05/2012 - RMS\n\n## RELATED LINKS\n\n[https://dbachecks.readthedocs.io/en/latest/functions/Get-DbcReleaseNote/](https://dbachecks.readthedocs.io/en/latest/functions/Get-DbcReleaseNote/)\n\n"
  },
  {
    "path": "docs/functions/Get-DbcTagCollection.md",
    "content": "# Get-DbcTagCollection\n\n## SYNOPSIS\nRetrieves a list of all available tags.\nSimplistic, similar to Get-Verb.\n\n## SYNTAX\n\n```\nGet-DbcTagCollection [[-Name] <String>] [-EnableException] [<CommonParameters>]\n```\n\n## DESCRIPTION\nRetrieves a list of all available tags.\nSimplistic, similar to Get-Verb.\n\n## EXAMPLES\n\n### EXAMPLE 1\n```\nGet-DbcTag\n```\n\nRetrieves all of the available tags for -Tag and -ExcludeTag\n\n### EXAMPLE 2\n```\nGet-DbcTag backups\n```\n\nRetrieves all of the available tags for -Tag and -ExcludeTag that are -like backups\n\n## PARAMETERS\n\n### -Name\nDefault: \"*\"\n\nThe name of the tag to retrieve.\nMay be any string, supports wildcards.\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: 1\nDefault value: *\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -EnableException\nBy default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: False\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### CommonParameters\nThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).\n\n## INPUTS\n\n## OUTPUTS\n\n## NOTES\n\n## RELATED LINKS\n\n[https://dbachecks.readthedocs.io/en/latest/functions/Get-DbcTagCollection/](https://dbachecks.readthedocs.io/en/latest/functions/Get-DbcTagCollection/)\n\n"
  },
  {
    "path": "docs/functions/Import-DbcConfig.md",
    "content": "# Import-DbcConfig\n\n## SYNOPSIS\nImports dbachecks configs from a json file\n\n## SYNTAX\n\n```\nImport-DbcConfig [[-Path] <String>] [-Temporary] [-EnableException] [<CommonParameters>]\n```\n\n## DESCRIPTION\nImports dbachecks configs from a json file\n\n## EXAMPLES\n\n### EXAMPLE 1\n```\nImport-DbcConfig\n```\n\nImports config from \"$script:localapp\\config.json\"\n\n### EXAMPLE 2\n```\nImport-DbcConfig -Path \\\\nas\\projects\\config.json\n```\n\nImports config from \\\\\\\\nas\\projects\\config.json\n\n## PARAMETERS\n\n### -Path\nThe path to import from, by default is \"$script:localapp\\config.json\"\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: 1\nDefault value: \"$script:localapp\\config.json\"\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -Temporary\nThe settings are not persisted outside the current session.\nBy default, settings will be remembered across all PowerShell sessions.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: False\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -EnableException\nBy default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: False\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### CommonParameters\nThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).\n\n## INPUTS\n\n## OUTPUTS\n\n## NOTES\n\n## RELATED LINKS\n\n[https://dbachecks.readthedocs.io/en/latest/functions/Import-DbcConfig/](https://dbachecks.readthedocs.io/en/latest/functions/Import-DbcConfig/)\n\n"
  },
  {
    "path": "docs/functions/Invoke-DbcCheck.md",
    "content": "# Invoke-DbcCheck\n\n## SYNOPSIS\nInvoke-DbcCheck is a SQL-centric Invoke-Pester wrapper\n\n## SYNTAX\n\n### Default (Default)\n```\nInvoke-DbcCheck [-Script <Object[]>] [-TestName <String[]>] [-EnableExit] [[-Check] <String[]>]\n [-ExcludeCheck <String[]>] [-PassThru] [-SqlInstance <DbaInstanceParameter[]>]\n [-ComputerName <DbaInstanceParameter[]>] [-SqlCredential <PSCredential>] [-Credential <PSCredential>]\n [-Database <Object[]>] [-ExcludeDatabase <Object[]>] [-Value <String[]>] [-ConfigFile <String>]\n [-CodeCoverage <Object[]>] [-CodeCoverageOutputFile <String>] [-CodeCoverageOutputFileFormat <String>]\n [-Strict] [-OutputFormat <String>] [-AllChecks] [-Quiet] [-PesterOption <Object>] [-Show <String>]\n [-ConfigAgentAlertJob <Object>] [-ConfigAgentAlertMessageid <Object>] [-ConfigAgentAlertNotification <Object>]\n [-ConfigAgentAlertSeverity <Object>] [-ConfigAgentDatabasemailprofile <Object>]\n [-ConfigAgentDbaoperatoremail <Object>] [-ConfigAgentDbaoperatorname <Object>]\n [-ConfigAgentFailedjobExcludecancelled <Object>] [-ConfigAgentFailedjobSince <Object>]\n [-ConfigAgentFailsafeoperator <Object>] [-ConfigAgentHistoryMaximumhistoryrows <Object>]\n [-ConfigAgentHistoryMaximumjobhistoryrows <Object>] [-ConfigAgentLastjobruntimePercentage <Object>]\n [-ConfigAgentLongrunningjobPercentage <Object>] [-ConfigAgentValidjobownerName <Object>]\n [-ConfigAppCheckrepos <Object>] [-ConfigAppCluster <Object>] [-ConfigAppComputername <Object>]\n [-ConfigAppLocalapp <Object>] [-ConfigAppMaildirectory <Object>] [-ConfigAppSqlcredential <Object>]\n [-ConfigAppSqlinstance <Object>] [-ConfigAppWincredential <Object>]\n [-ConfigCommandInvokedbccheckExcludecheck <Object>] [-ConfigCommandInvokedbccheckExcludedatabases <Object>]\n [-ConfigDatabaseExists <Object>] [-ConfigDatabaseQuerystoredisabledExcludedb <Object>]\n [-ConfigDatabaseQuerystoreenabledExcludedb <Object>] [-ConfigDomainDomaincontroller <Object>]\n [-ConfigDomainName <Object>] [-ConfigDomainOrganizationalunit <Object>] [-ConfigGlobalNotcontactable <Object>]\n [-ConfigMailFailurethreshhold <Object>] [-ConfigMailFrom <Object>] [-ConfigMailSmtpserver <Object>]\n [-ConfigMailSubject <Object>] [-ConfigMailTo <Object>] [-ConfigOlaJobNameCommandLogCleanup <Object>]\n [-ConfigOlaJobNameDeleteBackupHistory <Object>] [-ConfigOlaJobNameOutputFileCleanup <Object>]\n [-ConfigOlaJobNamePurgeBackupHistory <Object>] [-ConfigOlaJobNameSystemFull <Object>]\n [-ConfigOlaJobNameSystemIntegrity <Object>] [-ConfigOlaJobNameUserDiff <Object>]\n [-ConfigOlaJobNameUserFull <Object>] [-ConfigOlaJobNameUserIndex <Object>]\n [-ConfigOlaJobNameUserIntegrity <Object>] [-ConfigOlaJobNameUserLog <Object>]\n [-ConfigPolicyAdlogingroupExcludecheck <Object>] [-ConfigPolicyAdloginuserExcludecheck <Object>]\n [-ConfigPolicyBackupDatadir <Object>] [-ConfigPolicyBackupDefaultbackupcompression <Object>]\n [-ConfigPolicyBackupDiffmaxhours <Object>] [-ConfigPolicyBackupFullmaxdays <Object>]\n [-ConfigPolicyBackupLogdir <Object>] [-ConfigPolicyBackupLogmaxminutes <Object>]\n [-ConfigPolicyBackupNewdbgraceperiod <Object>] [-ConfigPolicyBackupTestserver <Object>]\n [-ConfigPolicyBuildBehind <Object>] [-ConfigPolicyBuildWarningwindow <Object>]\n [-ConfigPolicyCertificateexpirationExcludedb <Object>]\n [-ConfigPolicyCertificateexpirationWarningwindow <Object>] [-ConfigPolicyClusterHostrecordttl <Object>]\n [-ConfigPolicyClusterNetworkProtocolsIPV4 <Object>] [-ConfigPolicyClusterRegisterallprovidersIP <Object>]\n [-ConfigPolicyConnectionAuthscheme <Object>] [-ConfigPolicyConnectionPingcount <Object>]\n [-ConfigPolicyConnectionPingmaxms <Object>] [-ConfigPolicyDacallowed <Object>]\n [-ConfigPolicyDatabaseAutoclose <Object>] [-ConfigPolicyDatabaseAutocreatestatistics <Object>]\n [-ConfigPolicyDatabaseAutoshrink <Object>] [-ConfigPolicyDatabaseAutoupdatestatistics <Object>]\n [-ConfigPolicyDatabaseAutoupdatestatisticsasynchronously <Object>]\n [-ConfigPolicyDatabaseClrassembliessafeexcludedb <Object>]\n [-ConfigPolicyDatabaseDuplicateindexexcludedb <Object>] [-ConfigPolicyDatabaseFilebalancetolerance <Object>]\n [-ConfigPolicyDatabaseFilegrowthdaystocheck <Object>] [-ConfigPolicyDatabaseFilegrowthexcludedb <Object>]\n [-ConfigPolicyDatabaseFilegrowthfreespacethreshold <Object>] [-ConfigPolicyDatabaseFilegrowthtype <Object>]\n [-ConfigPolicyDatabaseFilegrowthvalue <Object>] [-ConfigPolicyDatabaseLogfilecount <Object>]\n [-ConfigPolicyDatabaseLogfilepercentused <Object>] [-ConfigPolicyDatabaseLogfilesizecomparison <Object>]\n [-ConfigPolicyDatabaseLogfilesizepercentage <Object>] [-ConfigPolicyDatabaseMaxdop <Object>]\n [-ConfigPolicyDatabaseMaxdopexcludedb <Object>] [-ConfigPolicyDatabaseMaxvlf <Object>]\n [-ConfigPolicyDatabaseStatusExcludeoffline <Object>] [-ConfigPolicyDatabaseStatusExcludereadonly <Object>]\n [-ConfigPolicyDatabaseStatusExcluderestoring <Object>] [-ConfigPolicyDatabaseTrustworthyexcludedb <Object>]\n [-ConfigPolicyDatabaseWrongcollation <Object>] [-ConfigPolicyDbccMaxdays <Object>]\n [-ConfigPolicyDiskspacePercentfree <Object>] [-ConfigPolicyDumpMaxcount <Object>]\n [-ConfigPolicyErrorlogLogcount <Object>] [-ConfigPolicyErrorlogWarningwindow <Object>]\n [-ConfigPolicyHadrAgtcpport <Object>] [-ConfigPolicyHadrEndpointname <Object>]\n [-ConfigPolicyHadrEndpointport <Object>] [-ConfigPolicyHadrFailureconditionlevel <Object>]\n [-ConfigPolicyHadrHealthchecktimeout <Object>] [-ConfigPolicyHadrLeasetimeout <Object>]\n [-ConfigPolicyHadrSessiontimeout <Object>] [-ConfigPolicyHadrTcpport <Object>]\n [-ConfigPolicyIdentityUsagepercent <Object>] [-ConfigPolicyInstanceMemorydumpsdaystocheck <Object>]\n [-ConfigPolicyInstanceSqlenginestart <Object>] [-ConfigPolicyInstanceSqlenginestate <Object>]\n [-ConfigPolicyInstancemaxdopExcludeinstance <Object>] [-ConfigPolicyInstancemaxdopMaxdop <Object>]\n [-ConfigPolicyInstancemaxdopUserecommended <Object>] [-ConfigPolicyInvaliddbownerExcludedb <Object>]\n [-ConfigPolicyInvaliddbownerName <Object>] [-ConfigPolicyNetworkLatencymaxms <Object>]\n [-ConfigPolicyOlaCommandLogCleanUp <Object>] [-ConfigPolicyOlaCommandLogenabled <Object>]\n [-ConfigPolicyOlaCommandLogscheduled <Object>] [-ConfigPolicyOlaDatabase <Object>]\n [-ConfigPolicyOlaDeleteBackupHistoryCleanUp <Object>] [-ConfigPolicyOlaDeleteBackupHistoryenabled <Object>]\n [-ConfigPolicyOlaDeleteBackupHistoryscheduled <Object>] [-ConfigPolicyOlaInstalled <Object>]\n [-ConfigPolicyOlaOutputFileCleanUp <Object>] [-ConfigPolicyOlaOutputFileCleanupenabled <Object>]\n [-ConfigPolicyOlaOutputFileCleanupscheduled <Object>] [-ConfigPolicyOlaPurgeJobHistoryCleanUp <Object>]\n [-ConfigPolicyOlaPurgeJobHistoryenabled <Object>] [-ConfigPolicyOlaPurgeJobHistoryscheduled <Object>]\n [-ConfigPolicyOlaSystemfullenabled <Object>] [-ConfigPolicyOlaSystemfullretention <Object>]\n [-ConfigPolicyOlaSystemfullscheduled <Object>] [-ConfigPolicyOlaSystemIntegrityCheckenabled <Object>]\n [-ConfigPolicyOlaSystemIntegrityCheckscheduled <Object>] [-ConfigPolicyOlaUserdiffenabled <Object>]\n [-ConfigPolicyOlaUserdiffretention <Object>] [-ConfigPolicyOlaUserdiffscheduled <Object>]\n [-ConfigPolicyOlaUserfullenabled <Object>] [-ConfigPolicyOlaUserfullretention <Object>]\n [-ConfigPolicyOlaUserfullscheduled <Object>] [-ConfigPolicyOlaUserIndexOptimizeenabled <Object>]\n [-ConfigPolicyOlaUserIndexOptimizescheduled <Object>] [-ConfigPolicyOlaUserIntegrityCheckenabled <Object>]\n [-ConfigPolicyOlaUserIntegrityCheckscheduled <Object>] [-ConfigPolicyOlaUserlogenabled <Object>]\n [-ConfigPolicyOlaUserlogretention <Object>] [-ConfigPolicyOlaUserlogscheduled <Object>]\n [-ConfigPolicyOleautomation <Object>] [-ConfigPolicyPageverify <Object>]\n [-ConfigPolicyRecoverymodelExcludedb <Object>] [-ConfigPolicyRecoverymodelType <Object>]\n [-ConfigPolicySecurityAdhocdistributedqueriesenabled <Object>] [-ConfigPolicySecurityClrenabled <Object>]\n [-ConfigPolicySecurityContainedbautoclose <Object>] [-ConfigPolicySecurityCrossdbownershipchaining <Object>]\n [-ConfigPolicySecurityDatabasemailenabled <Object>] [-ConfigPolicySecurityLatestbuild <Object>]\n [-ConfigPolicySecurityOleautomationproceduresdisabled <Object>]\n [-ConfigPolicySecurityRemoteaccessdisabled <Object>]\n [-ConfigPolicySecurityScanforstartupproceduresdisabled <Object>]\n [-ConfigPolicySecurityXpcmdshelldisabled <Object>] [-ConfigPolicyServerCpuprioritisation <Object>]\n [-ConfigPolicyServerExcludeDiskAllocationUnit <Object>] [-ConfigPolicyStorageBackuppath <Object>]\n [-ConfigPolicySuspectpagesThreshold <Object>] [-ConfigPolicyTraceflagsExpected <Object>]\n [-ConfigPolicyTraceflagsNotexpected <Object>] [-ConfigPolicyTwodigityearcutoff <Object>]\n [-ConfigPolicyValiddbownerExcludedb <Object>] [-ConfigPolicyValiddbownerName <Object>]\n [-ConfigPolicyWhoisactiveDatabase <Object>] [-ConfigPolicyXeventRequiredrunningsession <Object>]\n [-ConfigPolicyXeventRequiredstoppedsession <Object>] [-ConfigPolicyXeventValidrunningsession <Object>]\n [-ConfigSkipAgentAlert <Object>] [-ConfigSkipAgentLastjobruntime <Object>]\n [-ConfigSkipAgentLongrunningjobs <Object>] [-ConfigSkipBackupReadonly <Object>]\n [-ConfigSkipBackupSecondaries <Object>] [-ConfigSkipBackupTesting <Object>]\n [-ConfigSkipClusterNetclusterinterface <Object>] [-ConfigSkipConnectionAuth <Object>]\n [-ConfigSkipConnectionPing <Object>] [-ConfigSkipConnectionRemoting <Object>]\n [-ConfigSkipDatabaseFilegrowthdisabled <Object>] [-ConfigSkipDatabaseLogfilecounttest <Object>]\n [-ConfigSkipDatafilegrowthdisabled <Object>] [-ConfigSkipDbccDatapuritycheck <Object>]\n [-ConfigSkipDiffbackuptest <Object>] [-ConfigSkipHadrListenerPingcheck <Object>]\n [-ConfigSkipHadrListenerTcpport <Object>] [-ConfigSkipHadrReplicaTcpport <Object>]\n [-ConfigSkipInstanceDefaulttrace <Object>] [-ConfigSkipInstanceLatestbuild <Object>]\n [-ConfigSkipInstanceModeldbgrowth <Object>] [-ConfigSkipInstanceOleautomationproceduresdisabled <Object>]\n [-ConfigSkipInstanceRemoteaccessdisabled <Object>]\n [-ConfigSkipInstanceScanforstartupproceduresdisabled <Object>] [-ConfigSkipInstanceSuspectpagelimit <Object>]\n [-ConfigSkipLogfilecounttest <Object>] [-ConfigSkipLogshiptesting <Object>]\n [-ConfigSkipSecurityAgentserviceadmin <Object>] [-ConfigSkipSecurityAsymmetrickeysize <Object>]\n [-ConfigSkipSecurityBuiltinadmin <Object>] [-ConfigSkipSecurityClrassembliessafe <Object>]\n [-ConfigSkipSecurityContainedbautoclose <Object>] [-ConfigSkipSecurityContainedDBSQLAuth <Object>]\n [-ConfigSkipSecurityEngineserviceadmin <Object>] [-ConfigSkipSecurityFulltextserviceadmin <Object>]\n [-ConfigSkipSecurityGuestuserconnect <Object>] [-ConfigSkipSecurityHideinstance <Object>]\n [-ConfigSkipSecurityLocalwindowsgroup <Object>] [-ConfigSkipSecurityLoginauditlevelfailed <Object>]\n [-ConfigSkipSecurityLoginauditlevelsuccessful <Object>] [-ConfigSkipSecurityLoginCheckPolicy <Object>]\n [-ConfigSkipSecurityLoginMustChange <Object>] [-ConfigSkipSecurityLoginPasswordExpiration <Object>]\n [-ConfigSkipSecurityNonstandardport <Object>] [-ConfigSkipSecurityPublicPermission <Object>]\n [-ConfigSkipSecurityPublicrolepermission <Object>] [-ConfigSkipSecurityQuerystoredisabled <Object>]\n [-ConfigSkipSecurityQuerystoreenabled <Object>] [-ConfigSkipSecuritySadisabled <Object>]\n [-ConfigSkipSecuritySaexist <Object>] [-ConfigSkipSecurityServerprotocol <Object>]\n [-ConfigSkipSecuritySqlagentproxiesnopublicrole <Object>] [-ConfigSkipSecuritySQLMailXPsDisabled <Object>]\n [-ConfigSkipSecuritySymmetrickeyencryptionlevel <Object>] [-ConfigSkipTempdb1118 <Object>]\n [-ConfigSkipTempdbfilecount <Object>] [-ConfigSkipTempdbfilegrowthpercent <Object>]\n [-ConfigSkipTempdbfilesizemax <Object>] [-ConfigSkipTempdbfilesonc <Object>]\n [-ConfigTestingIntegrationInstance <Object>] [<CommonParameters>]\n```\n\n### NewOutputSet\n```\nInvoke-DbcCheck [-Script <Object[]>] [-TestName <String[]>] [-EnableExit] [[-Check] <String[]>]\n [-ExcludeCheck <String[]>] [-PassThru] [-SqlInstance <DbaInstanceParameter[]>]\n [-ComputerName <DbaInstanceParameter[]>] [-SqlCredential <PSCredential>] [-Credential <PSCredential>]\n [-Database <Object[]>] [-ExcludeDatabase <Object[]>] [-Value <String[]>] [-ConfigFile <String>]\n [-CodeCoverage <Object[]>] [-CodeCoverageOutputFile <String>] [-CodeCoverageOutputFileFormat <String>]\n [-Strict] -OutputFile <String> [-OutputFormat <String>] [-AllChecks] [-Quiet] [-PesterOption <Object>]\n [-Show <String>] [-ConfigAgentAlertJob <Object>] [-ConfigAgentAlertMessageid <Object>]\n [-ConfigAgentAlertNotification <Object>] [-ConfigAgentAlertSeverity <Object>]\n [-ConfigAgentDatabasemailprofile <Object>] [-ConfigAgentDbaoperatoremail <Object>]\n [-ConfigAgentDbaoperatorname <Object>] [-ConfigAgentFailedjobExcludecancelled <Object>]\n [-ConfigAgentFailedjobSince <Object>] [-ConfigAgentFailsafeoperator <Object>]\n [-ConfigAgentHistoryMaximumhistoryrows <Object>] [-ConfigAgentHistoryMaximumjobhistoryrows <Object>]\n [-ConfigAgentLastjobruntimePercentage <Object>] [-ConfigAgentLongrunningjobPercentage <Object>]\n [-ConfigAgentValidjobownerName <Object>] [-ConfigAppCheckrepos <Object>] [-ConfigAppCluster <Object>]\n [-ConfigAppComputername <Object>] [-ConfigAppLocalapp <Object>] [-ConfigAppMaildirectory <Object>]\n [-ConfigAppSqlcredential <Object>] [-ConfigAppSqlinstance <Object>] [-ConfigAppWincredential <Object>]\n [-ConfigCommandInvokedbccheckExcludecheck <Object>] [-ConfigCommandInvokedbccheckExcludedatabases <Object>]\n [-ConfigDatabaseExists <Object>] [-ConfigDatabaseQuerystoredisabledExcludedb <Object>]\n [-ConfigDatabaseQuerystoreenabledExcludedb <Object>] [-ConfigDomainDomaincontroller <Object>]\n [-ConfigDomainName <Object>] [-ConfigDomainOrganizationalunit <Object>] [-ConfigGlobalNotcontactable <Object>]\n [-ConfigMailFailurethreshhold <Object>] [-ConfigMailFrom <Object>] [-ConfigMailSmtpserver <Object>]\n [-ConfigMailSubject <Object>] [-ConfigMailTo <Object>] [-ConfigOlaJobNameCommandLogCleanup <Object>]\n [-ConfigOlaJobNameDeleteBackupHistory <Object>] [-ConfigOlaJobNameOutputFileCleanup <Object>]\n [-ConfigOlaJobNamePurgeBackupHistory <Object>] [-ConfigOlaJobNameSystemFull <Object>]\n [-ConfigOlaJobNameSystemIntegrity <Object>] [-ConfigOlaJobNameUserDiff <Object>]\n [-ConfigOlaJobNameUserFull <Object>] [-ConfigOlaJobNameUserIndex <Object>]\n [-ConfigOlaJobNameUserIntegrity <Object>] [-ConfigOlaJobNameUserLog <Object>]\n [-ConfigPolicyAdlogingroupExcludecheck <Object>] [-ConfigPolicyAdloginuserExcludecheck <Object>]\n [-ConfigPolicyBackupDatadir <Object>] [-ConfigPolicyBackupDefaultbackupcompression <Object>]\n [-ConfigPolicyBackupDiffmaxhours <Object>] [-ConfigPolicyBackupFullmaxdays <Object>]\n [-ConfigPolicyBackupLogdir <Object>] [-ConfigPolicyBackupLogmaxminutes <Object>]\n [-ConfigPolicyBackupNewdbgraceperiod <Object>] [-ConfigPolicyBackupTestserver <Object>]\n [-ConfigPolicyBuildBehind <Object>] [-ConfigPolicyBuildWarningwindow <Object>]\n [-ConfigPolicyCertificateexpirationExcludedb <Object>]\n [-ConfigPolicyCertificateexpirationWarningwindow <Object>] [-ConfigPolicyClusterHostrecordttl <Object>]\n [-ConfigPolicyClusterNetworkProtocolsIPV4 <Object>] [-ConfigPolicyClusterRegisterallprovidersIP <Object>]\n [-ConfigPolicyConnectionAuthscheme <Object>] [-ConfigPolicyConnectionPingcount <Object>]\n [-ConfigPolicyConnectionPingmaxms <Object>] [-ConfigPolicyDacallowed <Object>]\n [-ConfigPolicyDatabaseAutoclose <Object>] [-ConfigPolicyDatabaseAutocreatestatistics <Object>]\n [-ConfigPolicyDatabaseAutoshrink <Object>] [-ConfigPolicyDatabaseAutoupdatestatistics <Object>]\n [-ConfigPolicyDatabaseAutoupdatestatisticsasynchronously <Object>]\n [-ConfigPolicyDatabaseClrassembliessafeexcludedb <Object>]\n [-ConfigPolicyDatabaseDuplicateindexexcludedb <Object>] [-ConfigPolicyDatabaseFilebalancetolerance <Object>]\n [-ConfigPolicyDatabaseFilegrowthdaystocheck <Object>] [-ConfigPolicyDatabaseFilegrowthexcludedb <Object>]\n [-ConfigPolicyDatabaseFilegrowthfreespacethreshold <Object>] [-ConfigPolicyDatabaseFilegrowthtype <Object>]\n [-ConfigPolicyDatabaseFilegrowthvalue <Object>] [-ConfigPolicyDatabaseLogfilecount <Object>]\n [-ConfigPolicyDatabaseLogfilepercentused <Object>] [-ConfigPolicyDatabaseLogfilesizecomparison <Object>]\n [-ConfigPolicyDatabaseLogfilesizepercentage <Object>] [-ConfigPolicyDatabaseMaxdop <Object>]\n [-ConfigPolicyDatabaseMaxdopexcludedb <Object>] [-ConfigPolicyDatabaseMaxvlf <Object>]\n [-ConfigPolicyDatabaseStatusExcludeoffline <Object>] [-ConfigPolicyDatabaseStatusExcludereadonly <Object>]\n [-ConfigPolicyDatabaseStatusExcluderestoring <Object>] [-ConfigPolicyDatabaseTrustworthyexcludedb <Object>]\n [-ConfigPolicyDatabaseWrongcollation <Object>] [-ConfigPolicyDbccMaxdays <Object>]\n [-ConfigPolicyDiskspacePercentfree <Object>] [-ConfigPolicyDumpMaxcount <Object>]\n [-ConfigPolicyErrorlogLogcount <Object>] [-ConfigPolicyErrorlogWarningwindow <Object>]\n [-ConfigPolicyHadrAgtcpport <Object>] [-ConfigPolicyHadrEndpointname <Object>]\n [-ConfigPolicyHadrEndpointport <Object>] [-ConfigPolicyHadrFailureconditionlevel <Object>]\n [-ConfigPolicyHadrHealthchecktimeout <Object>] [-ConfigPolicyHadrLeasetimeout <Object>]\n [-ConfigPolicyHadrSessiontimeout <Object>] [-ConfigPolicyHadrTcpport <Object>]\n [-ConfigPolicyIdentityUsagepercent <Object>] [-ConfigPolicyInstanceMemorydumpsdaystocheck <Object>]\n [-ConfigPolicyInstanceSqlenginestart <Object>] [-ConfigPolicyInstanceSqlenginestate <Object>]\n [-ConfigPolicyInstancemaxdopExcludeinstance <Object>] [-ConfigPolicyInstancemaxdopMaxdop <Object>]\n [-ConfigPolicyInstancemaxdopUserecommended <Object>] [-ConfigPolicyInvaliddbownerExcludedb <Object>]\n [-ConfigPolicyInvaliddbownerName <Object>] [-ConfigPolicyNetworkLatencymaxms <Object>]\n [-ConfigPolicyOlaCommandLogCleanUp <Object>] [-ConfigPolicyOlaCommandLogenabled <Object>]\n [-ConfigPolicyOlaCommandLogscheduled <Object>] [-ConfigPolicyOlaDatabase <Object>]\n [-ConfigPolicyOlaDeleteBackupHistoryCleanUp <Object>] [-ConfigPolicyOlaDeleteBackupHistoryenabled <Object>]\n [-ConfigPolicyOlaDeleteBackupHistoryscheduled <Object>] [-ConfigPolicyOlaInstalled <Object>]\n [-ConfigPolicyOlaOutputFileCleanUp <Object>] [-ConfigPolicyOlaOutputFileCleanupenabled <Object>]\n [-ConfigPolicyOlaOutputFileCleanupscheduled <Object>] [-ConfigPolicyOlaPurgeJobHistoryCleanUp <Object>]\n [-ConfigPolicyOlaPurgeJobHistoryenabled <Object>] [-ConfigPolicyOlaPurgeJobHistoryscheduled <Object>]\n [-ConfigPolicyOlaSystemfullenabled <Object>] [-ConfigPolicyOlaSystemfullretention <Object>]\n [-ConfigPolicyOlaSystemfullscheduled <Object>] [-ConfigPolicyOlaSystemIntegrityCheckenabled <Object>]\n [-ConfigPolicyOlaSystemIntegrityCheckscheduled <Object>] [-ConfigPolicyOlaUserdiffenabled <Object>]\n [-ConfigPolicyOlaUserdiffretention <Object>] [-ConfigPolicyOlaUserdiffscheduled <Object>]\n [-ConfigPolicyOlaUserfullenabled <Object>] [-ConfigPolicyOlaUserfullretention <Object>]\n [-ConfigPolicyOlaUserfullscheduled <Object>] [-ConfigPolicyOlaUserIndexOptimizeenabled <Object>]\n [-ConfigPolicyOlaUserIndexOptimizescheduled <Object>] [-ConfigPolicyOlaUserIntegrityCheckenabled <Object>]\n [-ConfigPolicyOlaUserIntegrityCheckscheduled <Object>] [-ConfigPolicyOlaUserlogenabled <Object>]\n [-ConfigPolicyOlaUserlogretention <Object>] [-ConfigPolicyOlaUserlogscheduled <Object>]\n [-ConfigPolicyOleautomation <Object>] [-ConfigPolicyPageverify <Object>]\n [-ConfigPolicyRecoverymodelExcludedb <Object>] [-ConfigPolicyRecoverymodelType <Object>]\n [-ConfigPolicySecurityAdhocdistributedqueriesenabled <Object>] [-ConfigPolicySecurityClrenabled <Object>]\n [-ConfigPolicySecurityContainedbautoclose <Object>] [-ConfigPolicySecurityCrossdbownershipchaining <Object>]\n [-ConfigPolicySecurityDatabasemailenabled <Object>] [-ConfigPolicySecurityLatestbuild <Object>]\n [-ConfigPolicySecurityOleautomationproceduresdisabled <Object>]\n [-ConfigPolicySecurityRemoteaccessdisabled <Object>]\n [-ConfigPolicySecurityScanforstartupproceduresdisabled <Object>]\n [-ConfigPolicySecurityXpcmdshelldisabled <Object>] [-ConfigPolicyServerCpuprioritisation <Object>]\n [-ConfigPolicyServerExcludeDiskAllocationUnit <Object>] [-ConfigPolicyStorageBackuppath <Object>]\n [-ConfigPolicySuspectpagesThreshold <Object>] [-ConfigPolicyTraceflagsExpected <Object>]\n [-ConfigPolicyTraceflagsNotexpected <Object>] [-ConfigPolicyTwodigityearcutoff <Object>]\n [-ConfigPolicyValiddbownerExcludedb <Object>] [-ConfigPolicyValiddbownerName <Object>]\n [-ConfigPolicyWhoisactiveDatabase <Object>] [-ConfigPolicyXeventRequiredrunningsession <Object>]\n [-ConfigPolicyXeventRequiredstoppedsession <Object>] [-ConfigPolicyXeventValidrunningsession <Object>]\n [-ConfigSkipAgentAlert <Object>] [-ConfigSkipAgentLastjobruntime <Object>]\n [-ConfigSkipAgentLongrunningjobs <Object>] [-ConfigSkipBackupReadonly <Object>]\n [-ConfigSkipBackupSecondaries <Object>] [-ConfigSkipBackupTesting <Object>]\n [-ConfigSkipClusterNetclusterinterface <Object>] [-ConfigSkipConnectionAuth <Object>]\n [-ConfigSkipConnectionPing <Object>] [-ConfigSkipConnectionRemoting <Object>]\n [-ConfigSkipDatabaseFilegrowthdisabled <Object>] [-ConfigSkipDatabaseLogfilecounttest <Object>]\n [-ConfigSkipDatafilegrowthdisabled <Object>] [-ConfigSkipDbccDatapuritycheck <Object>]\n [-ConfigSkipDiffbackuptest <Object>] [-ConfigSkipHadrListenerPingcheck <Object>]\n [-ConfigSkipHadrListenerTcpport <Object>] [-ConfigSkipHadrReplicaTcpport <Object>]\n [-ConfigSkipInstanceDefaulttrace <Object>] [-ConfigSkipInstanceLatestbuild <Object>]\n [-ConfigSkipInstanceModeldbgrowth <Object>] [-ConfigSkipInstanceOleautomationproceduresdisabled <Object>]\n [-ConfigSkipInstanceRemoteaccessdisabled <Object>]\n [-ConfigSkipInstanceScanforstartupproceduresdisabled <Object>] [-ConfigSkipInstanceSuspectpagelimit <Object>]\n [-ConfigSkipLogfilecounttest <Object>] [-ConfigSkipLogshiptesting <Object>]\n [-ConfigSkipSecurityAgentserviceadmin <Object>] [-ConfigSkipSecurityAsymmetrickeysize <Object>]\n [-ConfigSkipSecurityBuiltinadmin <Object>] [-ConfigSkipSecurityClrassembliessafe <Object>]\n [-ConfigSkipSecurityContainedbautoclose <Object>] [-ConfigSkipSecurityContainedDBSQLAuth <Object>]\n [-ConfigSkipSecurityEngineserviceadmin <Object>] [-ConfigSkipSecurityFulltextserviceadmin <Object>]\n [-ConfigSkipSecurityGuestuserconnect <Object>] [-ConfigSkipSecurityHideinstance <Object>]\n [-ConfigSkipSecurityLocalwindowsgroup <Object>] [-ConfigSkipSecurityLoginauditlevelfailed <Object>]\n [-ConfigSkipSecurityLoginauditlevelsuccessful <Object>] [-ConfigSkipSecurityLoginCheckPolicy <Object>]\n [-ConfigSkipSecurityLoginMustChange <Object>] [-ConfigSkipSecurityLoginPasswordExpiration <Object>]\n [-ConfigSkipSecurityNonstandardport <Object>] [-ConfigSkipSecurityPublicPermission <Object>]\n [-ConfigSkipSecurityPublicrolepermission <Object>] [-ConfigSkipSecurityQuerystoredisabled <Object>]\n [-ConfigSkipSecurityQuerystoreenabled <Object>] [-ConfigSkipSecuritySadisabled <Object>]\n [-ConfigSkipSecuritySaexist <Object>] [-ConfigSkipSecurityServerprotocol <Object>]\n [-ConfigSkipSecuritySqlagentproxiesnopublicrole <Object>] [-ConfigSkipSecuritySQLMailXPsDisabled <Object>]\n [-ConfigSkipSecuritySymmetrickeyencryptionlevel <Object>] [-ConfigSkipTempdb1118 <Object>]\n [-ConfigSkipTempdbfilecount <Object>] [-ConfigSkipTempdbfilegrowthpercent <Object>]\n [-ConfigSkipTempdbfilesizemax <Object>] [-ConfigSkipTempdbfilesonc <Object>]\n [-ConfigTestingIntegrationInstance <Object>] [<CommonParameters>]\n```\n\n## DESCRIPTION\nThe Invoke-DbcCheck function runs Pester tests, including *.Tests.ps1 files and Pester tests in PowerShell scripts.\n\nExtended description about Pester: Get-Help -Name Invoke-Pester\n\n## EXAMPLES\n\n### EXAMPLE 1\n```\nInvoke-DbcCheck -Tag Backup -SqlInstance sql2016\n```\n\nRuns all of the checks tagged Backup against the sql2016 instance\n\n### EXAMPLE 2\n```\nInvoke-DbcCheck -Tag RecoveryModel -SqlInstance sql2017, sqlcluster -SqlCredential (Get-Credential sqladmin)\n```\n\nRuns the Recovery model check against the SQL instances sql2017, sqlcluster\nusing the sqladmin SQL login with the password provided interactively\n\n### EXAMPLE 3\n```\nInvoke-DbcCheck -Check Database -ExcludeCheck AutoShrink -ConfigFile \\\\share\\repo\\prod.json\n```\n\nRuns all of the checks tagged Database except for the AutoShrink check against\nthe SQL Instances set in the config under app.sqlinstance\n\nImports configuration file, \\\\\\\\share\\repo\\prod.json, prior to executing checks.\n\n### EXAMPLE 4\n```\n# Set the servers you'll be working with\nSet-DbcConfig -Name app.sqlinstance -Value sql2016, sql2017, sql2008, sql2008\\express\nSet-DbcConfig -Name app.computername -Value sql2016, sql2017, sql2008\n```\n\n# Look at the current configs\nGet-DbcConfig\n\n# Invoke a few tests\nInvoke-DbcCheck -Tags SuspectPage, LastBackup\n\nRuns the Suspect Pages and Last Backup checks against the SQL Instances sql2016,\nsql2017, sql2008, sql2008\\express after setting them in the configuration\n\n### EXAMPLE 5\n```\nInvoke-DbcCheck -SqlInstance sql2017 -Tags SuspectPage, LastBackup -Show Summary -PassThru | Update-DbcPowerBiDataSource\n```\n\nStart-DbcPowerBi\n\nRuns the Suspect Page and Last Backup checks against the SQL Instances set in\nthe config under app.sqlinstance only showing the summary of the results of the\nchecks.\nIt then updates the source json for the XML which is stored at\nC:\\Windows\\temp\\dbachecks\\ and then opens the PowerBi report in PowerBi Desktop\n\n### EXAMPLE 6\n```\nGet-Help -Name Invoke-Pester -Examples\n```\n\nWant to get super deep?\nYou can look at Invoke-Pester's example's and run them against Invoke-DbcCheck since it's a wrapper.\n\nhttps://github.com/pester/Pester/wiki/Invoke-Pester\n\nDescribe\nabout_Pester\n\n## PARAMETERS\n\n### -Script\nGet-Help -Name Invoke-Pester -Parameter Script\n\n```yaml\nType: Object[]\nParameter Sets: (All)\nAliases: Path, relative_path\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -TestName\nGet-Help -Name Invoke-Pester -Parameter TestName\n\n```yaml\nType: String[]\nParameter Sets: (All)\nAliases: Name\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -EnableExit\nGet-Help -Name Invoke-Pester -Parameter EnableExit\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: False\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -Check\nRuns only tests in Describe blocks with the specified Tag parameter values.\nWildcard characters and Tag values that include spaces or whitespace characters are not supported.\n\nWhen you specify multiple Tag values, Invoke-DbcCheck runs tests that have any of the listed tags (it ORs the tags).\nHowever, when you specify TestName and Tag values, Invoke-DbcCheck runs only describe blocks that have one of the specified TestName values and one of the specified Tag values.\n\nIf you use both Tag and ExcludeTag, ExcludeTag takes precedence.\n\n```yaml\nType: String[]\nParameter Sets: (All)\nAliases: Tags, Tag, Checks\n\nRequired: False\nPosition: 1\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ExcludeCheck\nOmits tests in Describe blocks with the specified Tag parameter values.\nWildcard characters and Tag values that include spaces or whitespace characters are not supported.\n\nWhen you specify multiple ExcludeTag values, Invoke-DbcCheck omits tests that have any of the listed tags (it ORs the tags).\nHowever, when you specify TestName and ExcludeTag values, Invoke-DbcCheck omits only describe blocks that have one of the specified TestName values and one of the specified Tag values.\n\nIf you use both Tag and ExcludeTag, ExcludeTag takes precedence\n\n```yaml\nType: String[]\nParameter Sets: (All)\nAliases: ExcludeTags, ExcludeTag, ExcludeChecks\n\nRequired: False\nPosition: Named\nDefault value: (Get-PSFConfigValue -FullName 'dbachecks.command.invokedbccheck.excludecheck' -Fallback @())\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -PassThru\nReturns a custom object (PSCustomObject) that contains the test results.\n\nBy default, Invoke-DbcCheck writes to the host program, not to the output stream (stdout).\nIf you try to save the result in a variable, the variable is empty unless you\nuse the PassThru parameter.\n\nTo suppress the host output, use the Quiet parameter.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: False\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -SqlInstance\nA list of SQL Servers to run the tests against.\nIf this is not provided, it will be gathered from:\nGet-DbatoolsConfig -Name app.sqlinstance\n\n```yaml\nType: DbaInstanceParameter[]\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ComputerName\nA list of computers to run the tests against.\nIf this is not provided, it will be gathered from:\nGet-DbatoolsConfig -Name app.computername\n\n```yaml\nType: DbaInstanceParameter[]\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -SqlCredential\nAlternate SQL Server-based credential.\n\n```yaml\nType: PSCredential\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -Credential\nAlternate Windows credential.\n\n```yaml\nType: PSCredential\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -Database\nA list of databases to include if your check is database centric.\n\n```yaml\nType: Object[]\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ExcludeDatabase\nA list of databases to exclude if your check is database centric.\n\n```yaml\nType: Object[]\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: (Get-PSFConfigValue -FullName 'dbachecks.command.invokedbccheck.excludedatabase' -Fallback @())\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -Value\nA value..\nit's hard to explain\n\n```yaml\nType: String[]\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigFile\nThe path to the exported dbachecks config file.\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -CodeCoverage\nGet-Help -Name Invoke-Pester -Parameter CodeCoverage\n\n```yaml\nType: Object[]\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: @()\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -CodeCoverageOutputFile\nGet-Help -Name Invoke-Pester -Parameter CodeCoverageOutputFile\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -CodeCoverageOutputFileFormat\nGet-Help -Name Invoke-Pester -Parameter CodeCoverageOutputFileFormat\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: JaCoCo\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -Strict\nMakes Pending and Skipped tests to Failed tests.\nUseful for continuous integration where you need to make sure all tests passed.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: False\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -OutputFile\nGet-Help -Name Invoke-Pester -Parameter OutputFile\n\n```yaml\nType: String\nParameter Sets: NewOutputSet\nAliases:\n\nRequired: True\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -OutputFormat\nThe format of output.\nCurrently, only NUnitXML is supported.\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -AllChecks\nIn the unlikely event that you'd like to run all checks, specify -AllChecks.\nThese checks still confirm to the skip settings in Get-DbcConfig.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: False\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -Quiet\nThe parameter Quiet is deprecated since Pester v.\n4.0 and will be deleted in the next major version of Pester.\nPlease use the parameter Show with value 'None' instead.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: False\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -PesterOption\nGet-Help -Name Invoke-Pester -Parameter PesterOption\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -Show\nCustomizes the output Pester writes to the screen.\n\nAvailable options are\nNone\nDefault\nPassed\nFailed\nPending\nSkipped\nInconclusive\nDescribe\nContext\nSummary\nHeader\nAll\nFails\n\nThe options can be combined to define presets.\n\nCommon use cases are:\n\nNone - to write no output to the screen.\nAll - to write all available information (this is default option).\nFails - to write everything except Passed (but including Describes etc.).\n\nA common setting is also Failed, Summary, to write only failed tests and test summary.\n\nThis parameter does not affect the PassThru custom object or the XML output that is written when you use the Output parameters.\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: All\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigAgentAlertJob\n{{ Fill ConfigAgentAlertJob Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigAgentAlertMessageid\n{{ Fill ConfigAgentAlertMessageid Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigAgentAlertNotification\n{{ Fill ConfigAgentAlertNotification Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigAgentAlertSeverity\n{{ Fill ConfigAgentAlertSeverity Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigAgentDatabasemailprofile\n{{ Fill ConfigAgentDatabasemailprofile Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigAgentDbaoperatoremail\n{{ Fill ConfigAgentDbaoperatoremail Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigAgentDbaoperatorname\n{{ Fill ConfigAgentDbaoperatorname Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigAgentFailedjobExcludecancelled\n{{ Fill ConfigAgentFailedjobExcludecancelled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigAgentFailedjobSince\n{{ Fill ConfigAgentFailedjobSince Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigAgentFailsafeoperator\n{{ Fill ConfigAgentFailsafeoperator Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigAgentHistoryMaximumhistoryrows\n{{ Fill ConfigAgentHistoryMaximumhistoryrows Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigAgentHistoryMaximumjobhistoryrows\n{{ Fill ConfigAgentHistoryMaximumjobhistoryrows Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigAgentLastjobruntimePercentage\n{{ Fill ConfigAgentLastjobruntimePercentage Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigAgentLongrunningjobPercentage\n{{ Fill ConfigAgentLongrunningjobPercentage Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigAgentValidjobownerName\n{{ Fill ConfigAgentValidjobownerName Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigAppCheckrepos\n{{ Fill ConfigAppCheckrepos Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigAppCluster\n{{ Fill ConfigAppCluster Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigAppComputername\n{{ Fill ConfigAppComputername Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigAppLocalapp\n{{ Fill ConfigAppLocalapp Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigAppMaildirectory\n{{ Fill ConfigAppMaildirectory Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigAppSqlcredential\n{{ Fill ConfigAppSqlcredential Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigAppSqlinstance\n{{ Fill ConfigAppSqlinstance Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigAppWincredential\n{{ Fill ConfigAppWincredential Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigCommandInvokedbccheckExcludecheck\n{{ Fill ConfigCommandInvokedbccheckExcludecheck Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigCommandInvokedbccheckExcludedatabases\n{{ Fill ConfigCommandInvokedbccheckExcludedatabases Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigDatabaseExists\n{{ Fill ConfigDatabaseExists Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigDatabaseQuerystoredisabledExcludedb\n{{ Fill ConfigDatabaseQuerystoredisabledExcludedb Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigDatabaseQuerystoreenabledExcludedb\n{{ Fill ConfigDatabaseQuerystoreenabledExcludedb Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigDomainDomaincontroller\n{{ Fill ConfigDomainDomaincontroller Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigDomainName\n{{ Fill ConfigDomainName Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigDomainOrganizationalunit\n{{ Fill ConfigDomainOrganizationalunit Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigGlobalNotcontactable\n{{ Fill ConfigGlobalNotcontactable Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigMailFailurethreshhold\n{{ Fill ConfigMailFailurethreshhold Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigMailFrom\n{{ Fill ConfigMailFrom Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigMailSmtpserver\n{{ Fill ConfigMailSmtpserver Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigMailSubject\n{{ Fill ConfigMailSubject Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigMailTo\n{{ Fill ConfigMailTo Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigOlaJobNameCommandLogCleanup\n{{ Fill ConfigOlaJobNameCommandLogCleanup Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigOlaJobNameDeleteBackupHistory\n{{ Fill ConfigOlaJobNameDeleteBackupHistory Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigOlaJobNameOutputFileCleanup\n{{ Fill ConfigOlaJobNameOutputFileCleanup Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigOlaJobNamePurgeBackupHistory\n{{ Fill ConfigOlaJobNamePurgeBackupHistory Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigOlaJobNameSystemFull\n{{ Fill ConfigOlaJobNameSystemFull Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigOlaJobNameSystemIntegrity\n{{ Fill ConfigOlaJobNameSystemIntegrity Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigOlaJobNameUserDiff\n{{ Fill ConfigOlaJobNameUserDiff Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigOlaJobNameUserFull\n{{ Fill ConfigOlaJobNameUserFull Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigOlaJobNameUserIndex\n{{ Fill ConfigOlaJobNameUserIndex Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigOlaJobNameUserIntegrity\n{{ Fill ConfigOlaJobNameUserIntegrity Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigOlaJobNameUserLog\n{{ Fill ConfigOlaJobNameUserLog Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyAdlogingroupExcludecheck\n{{ Fill ConfigPolicyAdlogingroupExcludecheck Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyAdloginuserExcludecheck\n{{ Fill ConfigPolicyAdloginuserExcludecheck Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyBackupDatadir\n{{ Fill ConfigPolicyBackupDatadir Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyBackupDefaultbackupcompression\n{{ Fill ConfigPolicyBackupDefaultbackupcompression Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyBackupDiffmaxhours\n{{ Fill ConfigPolicyBackupDiffmaxhours Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyBackupFullmaxdays\n{{ Fill ConfigPolicyBackupFullmaxdays Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyBackupLogdir\n{{ Fill ConfigPolicyBackupLogdir Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyBackupLogmaxminutes\n{{ Fill ConfigPolicyBackupLogmaxminutes Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyBackupNewdbgraceperiod\n{{ Fill ConfigPolicyBackupNewdbgraceperiod Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyBackupTestserver\n{{ Fill ConfigPolicyBackupTestserver Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyBuildBehind\n{{ Fill ConfigPolicyBuildBehind Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyBuildWarningwindow\n{{ Fill ConfigPolicyBuildWarningwindow Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyCertificateexpirationExcludedb\n{{ Fill ConfigPolicyCertificateexpirationExcludedb Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyCertificateexpirationWarningwindow\n{{ Fill ConfigPolicyCertificateexpirationWarningwindow Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyClusterHostrecordttl\n{{ Fill ConfigPolicyClusterHostrecordttl Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyClusterNetworkProtocolsIPV4\n{{ Fill ConfigPolicyClusterNetworkProtocolsIPV4 Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyClusterRegisterallprovidersIP\n{{ Fill ConfigPolicyClusterRegisterallprovidersIP Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyConnectionAuthscheme\n{{ Fill ConfigPolicyConnectionAuthscheme Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyConnectionPingcount\n{{ Fill ConfigPolicyConnectionPingcount Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyConnectionPingmaxms\n{{ Fill ConfigPolicyConnectionPingmaxms Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyDacallowed\n{{ Fill ConfigPolicyDacallowed Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyDatabaseAutoclose\n{{ Fill ConfigPolicyDatabaseAutoclose Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyDatabaseAutocreatestatistics\n{{ Fill ConfigPolicyDatabaseAutocreatestatistics Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyDatabaseAutoshrink\n{{ Fill ConfigPolicyDatabaseAutoshrink Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyDatabaseAutoupdatestatistics\n{{ Fill ConfigPolicyDatabaseAutoupdatestatistics Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyDatabaseAutoupdatestatisticsasynchronously\n{{ Fill ConfigPolicyDatabaseAutoupdatestatisticsasynchronously Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyDatabaseClrassembliessafeexcludedb\n{{ Fill ConfigPolicyDatabaseClrassembliessafeexcludedb Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyDatabaseDuplicateindexexcludedb\n{{ Fill ConfigPolicyDatabaseDuplicateindexexcludedb Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyDatabaseFilebalancetolerance\n{{ Fill ConfigPolicyDatabaseFilebalancetolerance Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyDatabaseFilegrowthdaystocheck\n{{ Fill ConfigPolicyDatabaseFilegrowthdaystocheck Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyDatabaseFilegrowthexcludedb\n{{ Fill ConfigPolicyDatabaseFilegrowthexcludedb Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyDatabaseFilegrowthfreespacethreshold\n{{ Fill ConfigPolicyDatabaseFilegrowthfreespacethreshold Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyDatabaseFilegrowthtype\n{{ Fill ConfigPolicyDatabaseFilegrowthtype Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyDatabaseFilegrowthvalue\n{{ Fill ConfigPolicyDatabaseFilegrowthvalue Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyDatabaseLogfilecount\n{{ Fill ConfigPolicyDatabaseLogfilecount Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyDatabaseLogfilepercentused\n{{ Fill ConfigPolicyDatabaseLogfilepercentused Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyDatabaseLogfilesizecomparison\n{{ Fill ConfigPolicyDatabaseLogfilesizecomparison Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyDatabaseLogfilesizepercentage\n{{ Fill ConfigPolicyDatabaseLogfilesizepercentage Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyDatabaseMaxdop\n{{ Fill ConfigPolicyDatabaseMaxdop Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyDatabaseMaxdopexcludedb\n{{ Fill ConfigPolicyDatabaseMaxdopexcludedb Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyDatabaseMaxvlf\n{{ Fill ConfigPolicyDatabaseMaxvlf Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyDatabaseStatusExcludeoffline\n{{ Fill ConfigPolicyDatabaseStatusExcludeoffline Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyDatabaseStatusExcludereadonly\n{{ Fill ConfigPolicyDatabaseStatusExcludereadonly Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyDatabaseStatusExcluderestoring\n{{ Fill ConfigPolicyDatabaseStatusExcluderestoring Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyDatabaseTrustworthyexcludedb\n{{ Fill ConfigPolicyDatabaseTrustworthyexcludedb Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyDatabaseWrongcollation\n{{ Fill ConfigPolicyDatabaseWrongcollation Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyDbccMaxdays\n{{ Fill ConfigPolicyDbccMaxdays Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyDiskspacePercentfree\n{{ Fill ConfigPolicyDiskspacePercentfree Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyDumpMaxcount\n{{ Fill ConfigPolicyDumpMaxcount Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyErrorlogLogcount\n{{ Fill ConfigPolicyErrorlogLogcount Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyErrorlogWarningwindow\n{{ Fill ConfigPolicyErrorlogWarningwindow Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyHadrAgtcpport\n{{ Fill ConfigPolicyHadrAgtcpport Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyHadrEndpointname\n{{ Fill ConfigPolicyHadrEndpointname Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyHadrEndpointport\n{{ Fill ConfigPolicyHadrEndpointport Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyHadrFailureconditionlevel\n{{ Fill ConfigPolicyHadrFailureconditionlevel Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyHadrHealthchecktimeout\n{{ Fill ConfigPolicyHadrHealthchecktimeout Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyHadrLeasetimeout\n{{ Fill ConfigPolicyHadrLeasetimeout Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyHadrSessiontimeout\n{{ Fill ConfigPolicyHadrSessiontimeout Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyHadrTcpport\n{{ Fill ConfigPolicyHadrTcpport Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyIdentityUsagepercent\n{{ Fill ConfigPolicyIdentityUsagepercent Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyInstancemaxdopExcludeinstance\n{{ Fill ConfigPolicyInstancemaxdopExcludeinstance Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyInstancemaxdopMaxdop\n{{ Fill ConfigPolicyInstancemaxdopMaxdop Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyInstancemaxdopUserecommended\n{{ Fill ConfigPolicyInstancemaxdopUserecommended Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyInstanceMemorydumpsdaystocheck\n{{ Fill ConfigPolicyInstanceMemorydumpsdaystocheck Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyInstanceSqlenginestart\n{{ Fill ConfigPolicyInstanceSqlenginestart Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyInstanceSqlenginestate\n{{ Fill ConfigPolicyInstanceSqlenginestate Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyInvaliddbownerExcludedb\n{{ Fill ConfigPolicyInvaliddbownerExcludedb Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyInvaliddbownerName\n{{ Fill ConfigPolicyInvaliddbownerName Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyNetworkLatencymaxms\n{{ Fill ConfigPolicyNetworkLatencymaxms Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyOlaCommandLogCleanUp\n{{ Fill ConfigPolicyOlaCommandLogCleanUp Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyOlaCommandLogenabled\n{{ Fill ConfigPolicyOlaCommandLogenabled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyOlaCommandLogscheduled\n{{ Fill ConfigPolicyOlaCommandLogscheduled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyOlaDatabase\n{{ Fill ConfigPolicyOlaDatabase Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyOlaDeleteBackupHistoryCleanUp\n{{ Fill ConfigPolicyOlaDeleteBackupHistoryCleanUp Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyOlaDeleteBackupHistoryenabled\n{{ Fill ConfigPolicyOlaDeleteBackupHistoryenabled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyOlaDeleteBackupHistoryscheduled\n{{ Fill ConfigPolicyOlaDeleteBackupHistoryscheduled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyOlaInstalled\n{{ Fill ConfigPolicyOlaInstalled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyOlaOutputFileCleanUp\n{{ Fill ConfigPolicyOlaOutputFileCleanUp Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyOlaOutputFileCleanupenabled\n{{ Fill ConfigPolicyOlaOutputFileCleanupenabled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyOlaOutputFileCleanupscheduled\n{{ Fill ConfigPolicyOlaOutputFileCleanupscheduled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyOlaPurgeJobHistoryCleanUp\n{{ Fill ConfigPolicyOlaPurgeJobHistoryCleanUp Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyOlaPurgeJobHistoryenabled\n{{ Fill ConfigPolicyOlaPurgeJobHistoryenabled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyOlaPurgeJobHistoryscheduled\n{{ Fill ConfigPolicyOlaPurgeJobHistoryscheduled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyOlaSystemfullenabled\n{{ Fill ConfigPolicyOlaSystemfullenabled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyOlaSystemfullretention\n{{ Fill ConfigPolicyOlaSystemfullretention Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyOlaSystemfullscheduled\n{{ Fill ConfigPolicyOlaSystemfullscheduled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyOlaSystemIntegrityCheckenabled\n{{ Fill ConfigPolicyOlaSystemIntegrityCheckenabled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyOlaSystemIntegrityCheckscheduled\n{{ Fill ConfigPolicyOlaSystemIntegrityCheckscheduled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyOlaUserdiffenabled\n{{ Fill ConfigPolicyOlaUserdiffenabled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyOlaUserdiffretention\n{{ Fill ConfigPolicyOlaUserdiffretention Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyOlaUserdiffscheduled\n{{ Fill ConfigPolicyOlaUserdiffscheduled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyOlaUserfullenabled\n{{ Fill ConfigPolicyOlaUserfullenabled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyOlaUserfullretention\n{{ Fill ConfigPolicyOlaUserfullretention Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyOlaUserfullscheduled\n{{ Fill ConfigPolicyOlaUserfullscheduled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyOlaUserIndexOptimizeenabled\n{{ Fill ConfigPolicyOlaUserIndexOptimizeenabled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyOlaUserIndexOptimizescheduled\n{{ Fill ConfigPolicyOlaUserIndexOptimizescheduled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyOlaUserIntegrityCheckenabled\n{{ Fill ConfigPolicyOlaUserIntegrityCheckenabled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyOlaUserIntegrityCheckscheduled\n{{ Fill ConfigPolicyOlaUserIntegrityCheckscheduled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyOlaUserlogenabled\n{{ Fill ConfigPolicyOlaUserlogenabled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyOlaUserlogretention\n{{ Fill ConfigPolicyOlaUserlogretention Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyOlaUserlogscheduled\n{{ Fill ConfigPolicyOlaUserlogscheduled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyOleautomation\n{{ Fill ConfigPolicyOleautomation Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyPageverify\n{{ Fill ConfigPolicyPageverify Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyRecoverymodelExcludedb\n{{ Fill ConfigPolicyRecoverymodelExcludedb Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyRecoverymodelType\n{{ Fill ConfigPolicyRecoverymodelType Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicySecurityAdhocdistributedqueriesenabled\n{{ Fill ConfigPolicySecurityAdhocdistributedqueriesenabled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicySecurityClrenabled\n{{ Fill ConfigPolicySecurityClrenabled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicySecurityContainedbautoclose\n{{ Fill ConfigPolicySecurityContainedbautoclose Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicySecurityCrossdbownershipchaining\n{{ Fill ConfigPolicySecurityCrossdbownershipchaining Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicySecurityDatabasemailenabled\n{{ Fill ConfigPolicySecurityDatabasemailenabled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicySecurityLatestbuild\n{{ Fill ConfigPolicySecurityLatestbuild Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicySecurityOleautomationproceduresdisabled\n{{ Fill ConfigPolicySecurityOleautomationproceduresdisabled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicySecurityRemoteaccessdisabled\n{{ Fill ConfigPolicySecurityRemoteaccessdisabled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicySecurityScanforstartupproceduresdisabled\n{{ Fill ConfigPolicySecurityScanforstartupproceduresdisabled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicySecurityXpcmdshelldisabled\n{{ Fill ConfigPolicySecurityXpcmdshelldisabled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyServerCpuprioritisation\n{{ Fill ConfigPolicyServerCpuprioritisation Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyServerExcludeDiskAllocationUnit\n{{ Fill ConfigPolicyServerExcludeDiskAllocationUnit Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyStorageBackuppath\n{{ Fill ConfigPolicyStorageBackuppath Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicySuspectpagesThreshold\n{{ Fill ConfigPolicySuspectpagesThreshold Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyTraceflagsExpected\n{{ Fill ConfigPolicyTraceflagsExpected Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyTraceflagsNotexpected\n{{ Fill ConfigPolicyTraceflagsNotexpected Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyTwodigityearcutoff\n{{ Fill ConfigPolicyTwodigityearcutoff Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyValiddbownerExcludedb\n{{ Fill ConfigPolicyValiddbownerExcludedb Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyValiddbownerName\n{{ Fill ConfigPolicyValiddbownerName Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyWhoisactiveDatabase\n{{ Fill ConfigPolicyWhoisactiveDatabase Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyXeventRequiredrunningsession\n{{ Fill ConfigPolicyXeventRequiredrunningsession Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyXeventRequiredstoppedsession\n{{ Fill ConfigPolicyXeventRequiredstoppedsession Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigPolicyXeventValidrunningsession\n{{ Fill ConfigPolicyXeventValidrunningsession Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipAgentAlert\n{{ Fill ConfigSkipAgentAlert Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipAgentLastjobruntime\n{{ Fill ConfigSkipAgentLastjobruntime Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipAgentLongrunningjobs\n{{ Fill ConfigSkipAgentLongrunningjobs Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipBackupReadonly\n{{ Fill ConfigSkipBackupReadonly Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipBackupSecondaries\n{{ Fill ConfigSkipBackupSecondaries Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipBackupTesting\n{{ Fill ConfigSkipBackupTesting Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipClusterNetclusterinterface\n{{ Fill ConfigSkipClusterNetclusterinterface Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipConnectionAuth\n{{ Fill ConfigSkipConnectionAuth Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipConnectionPing\n{{ Fill ConfigSkipConnectionPing Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipConnectionRemoting\n{{ Fill ConfigSkipConnectionRemoting Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipDatabaseFilegrowthdisabled\n{{ Fill ConfigSkipDatabaseFilegrowthdisabled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipDatabaseLogfilecounttest\n{{ Fill ConfigSkipDatabaseLogfilecounttest Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipDatafilegrowthdisabled\n{{ Fill ConfigSkipDatafilegrowthdisabled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipDbccDatapuritycheck\n{{ Fill ConfigSkipDbccDatapuritycheck Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipDiffbackuptest\n{{ Fill ConfigSkipDiffbackuptest Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipHadrListenerPingcheck\n{{ Fill ConfigSkipHadrListenerPingcheck Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipHadrListenerTcpport\n{{ Fill ConfigSkipHadrListenerTcpport Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipHadrReplicaTcpport\n{{ Fill ConfigSkipHadrReplicaTcpport Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipInstanceDefaulttrace\n{{ Fill ConfigSkipInstanceDefaulttrace Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipInstanceLatestbuild\n{{ Fill ConfigSkipInstanceLatestbuild Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipInstanceModeldbgrowth\n{{ Fill ConfigSkipInstanceModeldbgrowth Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipInstanceOleautomationproceduresdisabled\n{{ Fill ConfigSkipInstanceOleautomationproceduresdisabled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipInstanceRemoteaccessdisabled\n{{ Fill ConfigSkipInstanceRemoteaccessdisabled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipInstanceScanforstartupproceduresdisabled\n{{ Fill ConfigSkipInstanceScanforstartupproceduresdisabled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipInstanceSuspectpagelimit\n{{ Fill ConfigSkipInstanceSuspectpagelimit Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipLogfilecounttest\n{{ Fill ConfigSkipLogfilecounttest Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipLogshiptesting\n{{ Fill ConfigSkipLogshiptesting Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipSecurityAgentserviceadmin\n{{ Fill ConfigSkipSecurityAgentserviceadmin Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipSecurityAsymmetrickeysize\n{{ Fill ConfigSkipSecurityAsymmetrickeysize Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipSecurityBuiltinadmin\n{{ Fill ConfigSkipSecurityBuiltinadmin Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipSecurityClrassembliessafe\n{{ Fill ConfigSkipSecurityClrassembliessafe Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipSecurityContainedbautoclose\n{{ Fill ConfigSkipSecurityContainedbautoclose Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipSecurityContainedDBSQLAuth\n{{ Fill ConfigSkipSecurityContainedDBSQLAuth Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipSecurityEngineserviceadmin\n{{ Fill ConfigSkipSecurityEngineserviceadmin Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipSecurityFulltextserviceadmin\n{{ Fill ConfigSkipSecurityFulltextserviceadmin Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipSecurityGuestuserconnect\n{{ Fill ConfigSkipSecurityGuestuserconnect Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipSecurityHideinstance\n{{ Fill ConfigSkipSecurityHideinstance Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipSecurityLocalwindowsgroup\n{{ Fill ConfigSkipSecurityLocalwindowsgroup Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipSecurityLoginauditlevelfailed\n{{ Fill ConfigSkipSecurityLoginauditlevelfailed Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipSecurityLoginauditlevelsuccessful\n{{ Fill ConfigSkipSecurityLoginauditlevelsuccessful Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipSecurityLoginCheckPolicy\n{{ Fill ConfigSkipSecurityLoginCheckPolicy Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipSecurityLoginMustChange\n{{ Fill ConfigSkipSecurityLoginMustChange Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipSecurityLoginPasswordExpiration\n{{ Fill ConfigSkipSecurityLoginPasswordExpiration Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipSecurityNonstandardport\n{{ Fill ConfigSkipSecurityNonstandardport Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipSecurityPublicPermission\n{{ Fill ConfigSkipSecurityPublicPermission Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipSecurityPublicrolepermission\n{{ Fill ConfigSkipSecurityPublicrolepermission Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipSecurityQuerystoredisabled\n{{ Fill ConfigSkipSecurityQuerystoredisabled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipSecurityQuerystoreenabled\n{{ Fill ConfigSkipSecurityQuerystoreenabled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipSecuritySadisabled\n{{ Fill ConfigSkipSecuritySadisabled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipSecuritySaexist\n{{ Fill ConfigSkipSecuritySaexist Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipSecurityServerprotocol\n{{ Fill ConfigSkipSecurityServerprotocol Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipSecuritySqlagentproxiesnopublicrole\n{{ Fill ConfigSkipSecuritySqlagentproxiesnopublicrole Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipSecuritySQLMailXPsDisabled\n{{ Fill ConfigSkipSecuritySQLMailXPsDisabled Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipSecuritySymmetrickeyencryptionlevel\n{{ Fill ConfigSkipSecuritySymmetrickeyencryptionlevel Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipTempdb1118\n{{ Fill ConfigSkipTempdb1118 Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipTempdbfilecount\n{{ Fill ConfigSkipTempdbfilecount Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipTempdbfilegrowthpercent\n{{ Fill ConfigSkipTempdbfilegrowthpercent Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipTempdbfilesizemax\n{{ Fill ConfigSkipTempdbfilesizemax Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigSkipTempdbfilesonc\n{{ Fill ConfigSkipTempdbfilesonc Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConfigTestingIntegrationInstance\n{{ Fill ConfigTestingIntegrationInstance Description }}\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### CommonParameters\nThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).\n\n## INPUTS\n\n## OUTPUTS\n\n## NOTES\n\n## RELATED LINKS\n\n[https://dbachecks.readthedocs.io/en/latest/functions/Invoke-DbcCheck/](https://dbachecks.readthedocs.io/en/latest/functions/Invoke-DbcCheck/)\n\n"
  },
  {
    "path": "docs/functions/Invoke-DbcConfigFile.md",
    "content": "# Invoke-DbcConfigFile\n\n## SYNOPSIS\nOpens the default location of the json config file for easy edits.\n\n## SYNTAX\n\n```\nInvoke-DbcConfigFile [[-Path] <String>] [-EnableException] [<CommonParameters>]\n```\n\n## DESCRIPTION\nOpens the default location of the json config file for easy edits.\nFollow with Import-DbcConfig to import changes.\n\n## EXAMPLES\n\n### EXAMPLE 1\n```\nInvoke-DbcConfigFile\n```\n\nOpens \"$script:localapp\\config.json\" for editing.\nFollow with Import-DbcConfig.\n\n## PARAMETERS\n\n### -Path\nThe path to open, by default is \"$script:localapp\\config.json\"\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: 1\nDefault value: \"$script:localapp\\config.json\"\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -EnableException\nBy default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: False\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### CommonParameters\nThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).\n\n## INPUTS\n\n## OUTPUTS\n\n## NOTES\n\n## RELATED LINKS\n\n[https://dbachecks.readthedocs.io/en/latest/functions/Invoke-DbcConfigFile/](https://dbachecks.readthedocs.io/en/latest/functions/Invoke-DbcConfigFile/)\n\n"
  },
  {
    "path": "docs/functions/Reset-DbcConfig.md",
    "content": "# Reset-DbcConfig\n\n## SYNOPSIS\nResets configuration entries to their default values.\n\n## SYNTAX\n\n```\nReset-DbcConfig [[-Name] <String[]>] [<CommonParameters>]\n```\n\n## DESCRIPTION\nThis function unregisters configuration values and then registers them back with the default values and type.\n\nThis can be used to get the dbachecks back to default state of configuration, or to resolve problems with a specific setting.\n\n## EXAMPLES\n\n### EXAMPLE 1\n```\nReset-DbcConfig\n```\n\nResets all the configuration values for dbachecks.\n\n### EXAMPLE 2\n```\nReset-DbcConfig -Name policy.recoverymodel.type\n```\n\nResets the policy.recoverymodel.type to the default value and type.\n\n## PARAMETERS\n\n### -Name\nName of the configuration key.\n\n```yaml\nType: String[]\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: 1\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### CommonParameters\nThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).\n\n## INPUTS\n\n## OUTPUTS\n\n## NOTES\n\n## RELATED LINKS\n\n[https://dbachecks.readthedocs.io/en/latest/functions/Reset-DbcConfig/](https://dbachecks.readthedocs.io/en/latest/functions/Reset-DbcConfig/)\n\n"
  },
  {
    "path": "docs/functions/Save-DbcRequiredModules.md",
    "content": "# Save-DbcRequiredModules\n\n## SYNOPSIS\nSaves all required modules, including dbachecks, dbatools, Pester and PSFramework to a directory.\nIdeal for offline installs.\n\n## SYNTAX\n\n```\nSave-DbcRequiredModules [-Path] <String> [-EnableException] [<CommonParameters>]\n```\n\n## DESCRIPTION\nSaves all required modules, including dbachecks, dbatools, Pester and PSFramework to a directory.\nIdeal for offline installs.\n\n## EXAMPLES\n\n### EXAMPLE 1\n```\nSave-DbcRequiredModules -Path C:\\temp\\downlaods\n```\n\nSaves all required modules and dbachecks to C:\\temp\\downloads\n\n## PARAMETERS\n\n### -Path\nThe directory where the modules will be saved.\nDirectory will be created if it does not exist.\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases:\n\nRequired: True\nPosition: 1\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -EnableException\nBy default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: False\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### CommonParameters\nThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).\n\n## INPUTS\n\n## OUTPUTS\n\n## NOTES\n\n## RELATED LINKS\n\n[https://dbachecks.readthedocs.io/en/latest/functions/Save-DbcRequiredModules/](https://dbachecks.readthedocs.io/en/latest/functions/Save-DbcRequiredModules/)\n\n"
  },
  {
    "path": "docs/functions/Set-DbcCisConfig.md",
    "content": "# Set-DbcCisConfig\n\n## SYNOPSIS\nSets values for CIS checks.\n\n## SYNTAX\n\n```\nSet-DbcCisConfig [-WhatIf] [-Confirm] [<CommonParameters>]\n```\n\n## DESCRIPTION\nSets CIS checks to defaults values that were different than normals values. \nThen sets CIS\ntest that are set to skip by default to run.\n\n## EXAMPLES\n\n### EXAMPLE 1\n```\nSet-DbcCisConfig\n```\n\nsets the configuration for CIS checks\n\n## PARAMETERS\n\n### -WhatIf\nShows what would happen if the cmdlet runs.\nThe cmdlet is not run.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: wi\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -Confirm\nPrompts you for confirmation before running the cmdlet.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: cf\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### CommonParameters\nThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).\n\n## INPUTS\n\n## OUTPUTS\n\n## NOTES\n\n## RELATED LINKS\n\n[https://dbachecks.readthedocs.io/en/latest/functions/Set-DbcCisConfig/](https://dbachecks.readthedocs.io/en/latest/functions/Set-DbcCisConfig/)\n\n"
  },
  {
    "path": "docs/functions/Set-DbcConfig.md",
    "content": "# Set-DbcConfig\n\n## SYNOPSIS\nSets configuration values for specific checks.\n\n## SYNTAX\n\n```\nSet-DbcConfig [[-Name] <String>] [[-Value] <Object>] [[-Handler] <ScriptBlock>] [-Append] [-Temporary]\n [-EnableException] [-WhatIf] [-Confirm] [<CommonParameters>]\n```\n\n## DESCRIPTION\nChanges configuration values which enable each check to have specific thresholds\n\n## EXAMPLES\n\n### EXAMPLE 1\n```\nSet-DbcConfig -Name app.sqlinstance -Value sql2016, sql2017, sqlcluster\n```\n\nSets the SQL Instances which will be checked by default using Invoke-DbcCheck\nto sql2016, sql2017, sqlcluster\n\n### EXAMPLE 2\n```\nSet-DbcConfig -Name policy.validdbowner.name -Value 'TheBeard\\sqldbowner'\n```\n\nSets the value of the configuration for the expected database owners to\nTheBeard\\sqldbowner\n\n### EXAMPLE 3\n```\nSet-DbcConfig -Name policy.database.status.excludereadonly -Value 'TheBeard'\n```\n\nSets the value of the configuration for databases that are expected to be readonly\nto TheBeard\n\n### EXAMPLE 4\n```\nSet-DbcConfig -Name agent.validjobowner.name -Value 'TheBeard\\SQLJobOwner' -Append\n```\n\nAdds 'TheBeard\\SQLJobOwner' to the value of the configuration for accounts that\nare expected to be owners of SQL Agent Jobs\n\n## PARAMETERS\n\n### -Name\nName of the configuration entry.\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: 1\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -Value\nThe value to assign.\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: 2\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -Handler\nA scriptblock that is executed when a value is being set.\n\nIs only executed if the validation was successful (assuming there was a validation, of course)\n\n```yaml\nType: ScriptBlock\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: 3\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -Append\nAdds the value to the existing configuration instead of overwriting it\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: False\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -Temporary\nThe setting is not persisted outside the current session.\nBy default, settings will be remembered across all powershell sessions.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: False\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -EnableException\nBy default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: False\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -WhatIf\nShows what would happen if the cmdlet runs.\nThe cmdlet is not run.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: wi\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -Confirm\nPrompts you for confirmation before running the cmdlet.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: cf\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### CommonParameters\nThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).\n\n## INPUTS\n\n## OUTPUTS\n\n## NOTES\n\n## RELATED LINKS\n\n[https://dbachecks.readthedocs.io/en/latest/functions/Set-DbcConfig/](https://dbachecks.readthedocs.io/en/latest/functions/Set-DbcConfig/)\n\n"
  },
  {
    "path": "docs/functions/Set-DbcFile.md",
    "content": "# Set-DbcFile\n\n## SYNOPSIS\nWrites the result of Invoke-DbcCheck to a file (after converting with Convert-DbcResult)\n\n## SYNTAX\n\n### Default (Default)\n```\nSet-DbcFile -InputObject <Object> -FilePath <String> -FileName <String> -FileType <String> [-WhatIf] [-Confirm]\n [<CommonParameters>]\n```\n\n### Force\n```\nSet-DbcFile -InputObject <Object> -FilePath <String> -FileName <String> -FileType <String> [-Force] [-WhatIf]\n [-Confirm] [<CommonParameters>]\n```\n\n### Append\n```\nSet-DbcFile -InputObject <Object> -FilePath <String> -FileName <String> -FileType <String> [-Append] [-WhatIf]\n [-Confirm] [<CommonParameters>]\n```\n\n## DESCRIPTION\nWhen a check has been run with Invoke-DbcCheck (and -PassThru) and then converted with\nConvert-DbcResult This command will write the results to a CSV, JSON or XML file\n\n## EXAMPLES\n\n### EXAMPLE 1\n```\n$Date = Get-Date -Format \"yyyy-MM-dd\"\nInvoke-DbcCheck -SqlInstance SQL2017N5 -Check AutoClose -Passthru | Convert-DbcResult -Label Beard-Check | Set-DbcFile -FilePath C:\\temp\\dbachecks\\ -FileName Auto-close_$Date -FileType xml\n```\n\nRuns the AutoClose check against SQL2017N5 and converts to a datatable with a label of Beard-Check and outputs to xml and saves in C:\\temp\\dbachecks\\Auto-close_DATE.xml\n\n### EXAMPLE 2\n```\nInvoke-DbcCheck -SqlInstance SQL2017N5 -Check AutoClose -Passthru | Convert-DbcResult -Label Beard-Check | Set-DbcFile -FilePath C:\\temp\\dbachecks\\ -FileName Auto-close.xml -FileType xml\n```\n\nRuns the AutoClose check against SQL2017N5 and converts to a datatable with a label of Beard-Check and outputs to xml and saves in C:\\temp\\dbachecks\\Auto-close.xml\n\n### EXAMPLE 3\n```\nInvoke-DbcCheck -SqlInstance SQL2017N5 -Check AutoClose -Passthru | Convert-DbcResult -Label Beard-Check | Set-DbcFile -FilePath C:\\temp\\dbachecks\\ -FileName Auto-close.csv -FileType csv\n```\n\nRuns the AutoClose check against SQL2017N5 and converts to a datatable with a label of Beard-Check and outputs to csv and saves in C:\\temp\\dbachecks\\Auto-close.csv\n\n### EXAMPLE 4\n```\nInvoke-DbcCheck -SqlInstance SQL2017N5 -Check AutoClose -Passthru | Convert-DbcResult -Label Beard-Check | Set-DbcFile -FilePath C:\\temp\\dbachecks\\ -FileName Auto-close.json -FileType Json\n```\n\nRuns the AutoClose check against SQL2017N5 and converts to a datatable with a label of Beard-Check and outputs to JSON and saves in C:\\temp\\dbachecks\\Auto-close.json\n\n### EXAMPLE 5\n```\nInvoke-DbcCheck -SqlInstance SQL2017N5 -Check AutoClose -Passthru | Convert-DbcResult -Label Beard-Check | Set-DbcFile -FilePath C:\\temp\\dbachecks\\ -FileName Auto-close.json -FileType Json -Append\n```\n\nRuns the AutoClose check against SQL2017N5 and converts to a datatable with a label of Beard-Check and outputs to JSON and saves in C:\\temp\\dbachecks\\Auto-close.json appending the results to the existing file\n\n### EXAMPLE 6\n```\nInvoke-DbcCheck -SqlInstance SQL2017N5 -Check AutoClose -Passthru | Convert-DbcResult -Label Beard-Check | Set-DbcFile -FilePath C:\\temp\\dbachecks\\ -FileName Auto-close.json -FileType Json -Force\n```\n\nRuns the AutoClose check against SQL2017N5 and converts to a datatable with a label of Beard-Check and outputs to JSON and saves in C:\\temp\\dbachecks\\Auto-close.json overwriting the existing file\n\n## PARAMETERS\n\n### -InputObject\nThe datatable created by Convert-DbcResult\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: True\nPosition: Named\nDefault value: None\nAccept pipeline input: True (ByValue)\nAccept wildcard characters: False\n```\n\n### -FilePath\nThe directory for the file\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases:\n\nRequired: True\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -FileName\nThe name of the file\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases:\n\nRequired: True\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -FileType\nThe type of file -CSV,JSON,XML\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases:\n\nRequired: True\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -Append\nAdd to an existing file or not\n\n```yaml\nType: SwitchParameter\nParameter Sets: Append\nAliases:\n\nRequired: True\nPosition: Named\nDefault value: False\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -Force\nOverwrite Existing file\n\n```yaml\nType: SwitchParameter\nParameter Sets: Force\nAliases:\n\nRequired: True\nPosition: Named\nDefault value: False\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -WhatIf\nShows what would happen if the cmdlet runs.\nThe cmdlet is not run.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: wi\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -Confirm\nPrompts you for confirmation before running the cmdlet.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: cf\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### CommonParameters\nThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).\n\n## INPUTS\n\n## OUTPUTS\n\n### System.String\n## NOTES\nInitial - RMS 28/12/2019\n\n## RELATED LINKS\n"
  },
  {
    "path": "docs/functions/Start-DbcPowerBi.md",
    "content": "# Start-DbcPowerBi\n\n## SYNOPSIS\nLaunches one of the included dbachecks Power BI dashboards either the original for json files or the new one for database.\n**You will need refresh* the Power BI dashboard every time to see the new results!\n\n## SYNTAX\n\n```\nStart-DbcPowerBi [-FromDatabase] [[-Path] <String>] [-EnableException] [-WhatIf] [-Confirm]\n [<CommonParameters>]\n```\n\n## DESCRIPTION\nLaunches one of the included dbachecks Power BI dashboards either the original for json files or the new one for database.**You will need refresh* the Power BI dashboard every time to see the new results.\n\n## EXAMPLES\n\n### EXAMPLE 1\n```\nStart-DbcPowerBi -FromDatabase\n```\n\nLaunches the Database Power Bi dashboard template, which will prompt for the Instance and database name\n\n### EXAMPLE 2\n```\nStart-DbcPowerBi\n```\n\nLaunches the Json PowerBi from \"$script:ModuleRoot\\bin\\dbachecks.pbix\" using \"C:\\windows\\Temp\\dbachecks\\*.json\" (generated by Update-DbcPowerBiDataSource) as the datasource.\n\n### EXAMPLE 3\n```\nStart-DbcPowerBi -Path \\\\nas\\projects\\dbachecks.pbix\n```\n\nLaunches \\\\\\\\nas\\projects\\dbachecks.pbix using \"C:\\windows\\Temp\\dbachecks\\*.json\" as the datasource\n\n## PARAMETERS\n\n### -FromDatabase\nA Switch to use to open the database based PowerBi dashboard if you have stored the results in a database with Write-DbcTable.\nIf not chosen it will use the original Power Bi file with a json data source\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: False\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -Path\nThe location of the pbix or pbit file if you have moved it or want to use your own.\n\"$script:ModuleRoot\\bin\\dbachecks.pbix\" or \"$script:ModuleRoot\\bin\\dbachecks-FromDatabase.pbit\"  by default.\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: 1\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -EnableException\nBy default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: False\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -WhatIf\nShows what would happen if the cmdlet runs.\nThe cmdlet is not run.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: wi\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -Confirm\nPrompts you for confirmation before running the cmdlet.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: cf\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### CommonParameters\nThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).\n\n## INPUTS\n\n## OUTPUTS\n\n## NOTES\n\n## RELATED LINKS\n\n[https://dbachecks.readthedocs.io/en/latest/functions/Start-DbcPowerBi/](https://dbachecks.readthedocs.io/en/latest/functions/Start-DbcPowerBi/)\n\n"
  },
  {
    "path": "docs/functions/Update-DbcPowerBiDataSource.md",
    "content": "# Update-DbcPowerBiDataSource\n\n## SYNOPSIS\nConverts Pester results and exports file in required format for launching the\nPower BI command.\n**You will need refresh* the Power BI dashboard every time to\nsee the new results.\n\n## SYNTAX\n\n```\nUpdate-DbcPowerBiDataSource [-InputObject] <PSObject> [[-Path] <String>] [[-FileName] <String>]\n [[-Environment] <String>] [-Force] [-EnableException] [-Append] [-WhatIf] [-Confirm] [<CommonParameters>]\n```\n\n## DESCRIPTION\nConverts Pester results and exports file in required format for launching the\nPower BI command.\n**You will need refresh* the Power BI dashboard every time to\nsee the new results.\n\nBasically, it does this:\n$InputObject.TestResult | Select-Object -First 20 | ConvertTo-Json -Depth 3 | Out-File \"$env:windir\\temp\\dbachecks.json\"\n\n## EXAMPLES\n\n### EXAMPLE 1\n```\nInvoke-DbcCheck -SqlInstance $Instance -Check DatabaseStatus -Show None -PassThru | Update-DbcPowerBiDataSource\n```\n\nRuns the DatabaseStatus checks against $Instance then saves to json to $env:windir\\temp\\dbachecks\\dbachecks_1_DatabaseStatus.json\n\n### EXAMPLE 2\n```\nInvoke-DbcCheck -SqlInstance $Instance -Check DatabaseStatus -Show None -PassThru | Update-DbcPowerBiDataSource -Path C:\\Temp\n```\n\nRuns the DatabaseStatus checks against $Instance then saves to json to C:\\Temp\\dbachecks_1_DatabaseStatus.json\n\n### EXAMPLE 3\n```\nInvoke-DbcCheck -SqlInstance $Instance -Check DatabaseStatus -Show None -PassThru | Update-DbcPowerBiDataSource -Path C:\\Temp  -FileName BeardyTests\n```\n\nRuns the DatabaseStatus checks against $Instance then saves to json to C:\\Temp\\BeardyTests.json\n\n### EXAMPLE 4\n```\nInvoke-DbcCheck -SqlInstance $Instance -Check DatabaseStatus -Show None -PassThru | Update-DbcPowerBiDataSource -Path C:\\Temp  -FileName BeardyTests.json\n```\n\nRuns the DatabaseStatus checks against $Instance then saves to json to C:\\Temp\\BeardyTests.json\n\n### EXAMPLE 5\n```\nInvoke-DbcCheck -SqlInstance $Instance -Check DatabaseStatus -Show None -PassThru | Update-DbcPowerBiDataSource -Path C:\\Temp  -Environment Prod_DBChecks\n```\n\nRuns the DatabaseStatus checks against $Instance then saves to json to  C:\\Temp\\dbachecks_1_Prod_DBChecks_DatabaseStatus.json\n\n### EXAMPLE 6\n```\nInvoke-DbcCheck -SqlInstance $Instance -Check DatabaseStatus -Show None -PassThru | Update-DbcPowerBiDataSource -Environment Prod_DBChecks\n```\n\nRuns the DatabaseStatus checks against $Instance then saves to json to  C:\\Windows\\temp\\dbachecks\\dbachecks_1_Prod_DBChecks_DatabaseStatus.json\n\n### EXAMPLE 7\n```\nInvoke-DbcCheck -SqlInstance sql2017 -Tag Backup -Show Summary -PassThru | Update-DbcPowerBiDataSource -Path \\\\nas\\projects\\dbachecks.json\nStart-DbcPowerBi -Path \\\\nas\\projects\\dbachecks.json\n```\n\nRuns tests, saves to json to \\\\\\\\nas\\projects\\dbachecks.json\nOpens the PowerBi using that file\nthen you'll have to change your data source in Power BI because by default it\npoints to C:\\Windows\\Temp (limitation of Power BI)\n\n### EXAMPLE 8\n```\nSet-DbcConfig -Name app.checkrepos -Value \\\\SharedPath\\CustomPesterChecks\nInvoke-DbcCheck -SqlInstance $Instance -Check DatabaseStatus, CustomCheckTag -PassThru | Update-DbcPowerBiDataSource -Path \\\\SharedPath\\CheckResults -Name CustomCheckResults -Append\n```\n\nBecause we are using a custom check repository you MUSTR use the Append parameter for Update-DbcPowerBiDataSource\notherwise the json file will be overwritten\n\nSets the custom check repository to \\\\\\\\SharedPath\\CustomPesterChecks\nRuns the DatabaseStatus checks and custom checks with the CustomCheckTag against $Instance then saves all the results\nto json to \\\\\\\\SharedPath\\CheckResults.json -Name CustomCheckResults\n\n### EXAMPLE 9\n```\nInvoke-DbcCheck -SqlInstance sql2017 -Check SuspectPage -Show None -PassThru | Update-DbcPowerBiDataSource -Environment Test -Whatif\n```\n\nWhat if: Performing the operation \"Removing .json files named *Default*\" on target \"C:\\Windows\\temp\\dbachecks\".\nWhat if: Performing the operation \"Passing results\" on target \"C:\\Windows\\temp\\dbachecks\\dbachecks_1_Test__SuspectPage.json\".\n\nWill not actually create or update the data sources but will output what happens with the command and what the file name will be\ncalled.\n\n## PARAMETERS\n\n### -InputObject\nRequired.\nResultset from Invoke-DbcCheck.\nIf InputObject is not provided, it will be generated using a very generic resultset:\n\n```yaml\nType: PSObject\nParameter Sets: (All)\nAliases:\n\nRequired: True\nPosition: 1\nDefault value: None\nAccept pipeline input: True (ByValue)\nAccept wildcard characters: False\n```\n\n### -Path\nThe directory to store your JSON files.\n\"C:\\windows\\temp\\dbachecks\\*.json\" by default\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: 2\nDefault value: \"$env:windir\\temp\\dbachecks\"\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -FileName\nif you want to give the file a specific name\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: 3\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -Environment\nA Name to give your suite of tests IE Prod - This will also alter the name of the file\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: 4\nDefault value: Default\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -Force\nDelete all json files in the data source folder.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: False\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -EnableException\nBy default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: False\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -Append\nAppends results to existing file.\nUse this if you have custom check repos\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: False\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -WhatIf\nShows what would happen if the cmdlet runs.\nThe cmdlet is not run.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: wi\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -Confirm\nPrompts you for confirmation before running the cmdlet.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: cf\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### CommonParameters\nThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).\n\n## INPUTS\n\n## OUTPUTS\n\n## NOTES\n\n## RELATED LINKS\n\n[https://dbachecks.readthedocs.io/en/latest/functions/Update-DbcPowerBiDataSource/](https://dbachecks.readthedocs.io/en/latest/functions/Update-DbcPowerBiDataSource/)\n\n"
  },
  {
    "path": "docs/functions/Update-DbcRequiredModules.md",
    "content": "# Update-DbcRequiredModules\n\n## SYNOPSIS\nUpdates all required modules, including dbachecks.\n\n## SYNTAX\n\n```\nUpdate-DbcRequiredModules [-EnableException] [-WhatIf] [-Confirm] [<CommonParameters>]\n```\n\n## DESCRIPTION\nUpdates all required modules, including dbachecks.\n\n## EXAMPLES\n\n### EXAMPLE 1\n```\nUpdate-DbcRequiredModules\n```\n\nUpdates all required modules including dbachecks\n\n## PARAMETERS\n\n### -EnableException\nBy default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: False\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -WhatIf\nShows what would happen if the cmdlet runs.\nThe cmdlet is not run.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: wi\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -Confirm\nPrompts you for confirmation before running the cmdlet.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: cf\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### CommonParameters\nThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).\n\n## INPUTS\n\n## OUTPUTS\n\n## NOTES\n\n## RELATED LINKS\n\n[https://dbachecks.readthedocs.io/en/latest/functions/Update-DbcRequiredModules/](https://dbachecks.readthedocs.io/en/latest/functions/Update-DbcRequiredModules/)\n\n"
  },
  {
    "path": "docs/functions/Write-DbcTable.md",
    "content": "# Write-DbcTable\n\n## SYNOPSIS\nWrites the result of Invoke-DbcCheck (with -PassThru) after Convert-DbcResult to a database table\n\n## SYNTAX\n\n```\nWrite-DbcTable [-SqlInstance] <String> [[-SqlCredential] <PSCredential>] [[-Database] <Object>]\n [-InputObject] <Object> [[-Table] <String>] [[-Schema] <String>] [-Truncate] [-WhatIf] [-Confirm]\n [<CommonParameters>]\n```\n\n## DESCRIPTION\nAfter running Invoke-DbcCheck (With PassThru) and converting it to a datatable with Convert-DbcResult, this command\nwill write the results to a database table and will also write the current Checks to another table called dbachecksChecks\n\n## EXAMPLES\n\n### EXAMPLE 1\n```\nInvoke-DbcCheck -SqlInstance SQL2017N5 -Check AutoClose -Passthru | Convert-DbcResult -Label Beard-Check | Write-DbcTable -SqlInstance sql2017n5 -Database tempdb -Table newdbachecks\n```\n\nRuns the AutoClose check against SQL2017N5 and converts to a datatable with a label of Beard-Check and writes it to a table newdbachecks in tempdb on SQL2017N5 (NB Don't use tempdb!!)\n\n## PARAMETERS\n\n### -SqlInstance\nThe Instance for the results\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases:\n\nRequired: True\nPosition: 1\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -SqlCredential\nThe SQL Credential for the instance if required\n\n```yaml\nType: PSCredential\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: 2\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -Database\nThe database to write the results\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: 3\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -InputObject\nThe datatable from Convert-DbcResult\n\n```yaml\nType: Object\nParameter Sets: (All)\nAliases:\n\nRequired: True\nPosition: 4\nDefault value: None\nAccept pipeline input: True (ByValue)\nAccept wildcard characters: False\n```\n\n### -Table\nThe name of the table for the results - will be created if it doesn't exist.\nBy default it will be named CheckResults\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: 5\nDefault value: CheckResults\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -Schema\nThe schema for the table - defaults to dbo\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: 6\nDefault value: Dbo\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -Truncate\nWill truncate the existing table (if results go to a staging table for example)\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: False\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -WhatIf\nShows what would happen if the cmdlet runs.\nThe cmdlet is not run.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: wi\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -Confirm\nPrompts you for confirmation before running the cmdlet.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: cf\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### CommonParameters\nThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).\n\n## INPUTS\n\n## OUTPUTS\n\n### System.String\n## NOTES\nInitial - RMS 28/12/2019\n\n## RELATED LINKS\n"
  },
  {
    "path": "docs/index.md",
    "content": "# dbachecks\n\n<img align=\"left\" src=\"https://user-images.githubusercontent.com/8278033/34322840-ed09114e-e832-11e7-9670-9baa686ade71.png\">\n\ndbachecks is a framework created by and for SQL Server pros who need to validate their environments. Basically, we all share similar checklists and mostly just the server names and RPO/RTO/etc change.\n\nThis open source module allows us to crowdsource our checklists using [Pester](https://github.com/Pester/Pester) tests. Such checks include:\n\n* Backups are being performed\n* Identity columns are not about to max out\n* Servers have access to backup paths\n* Database integrity checks are being performed and corruption does not exist\n* Disk space is not about to run out\n* All enabled jobs have succeeded\n\nHave questions about development? Please visit our [Wiki](https://github.com/sqlcollaborative/dbachecks/wiki). **Anyone developing this module** should visit that Wiki page (after fully reading this readme) for a brief overview.\n\n## Build Status\n<table>\n  <tbody>\n    <tr>\n      <td><a href=\"https://sqlcollaborative.visualstudio.com/dbachecks/_build/index?context=mine&path=%5C&definitionId=3&_a=completed\" target=\"_blank\"><img align=\"left\" src=\"https://sqlcollaborative.visualstudio.com/_apis/public/build/definitions/a0deae7b-ae38-4ecc-a836-5f79cc561140/3/badge\"></a></td>\n      <td>Development Branch Build - Unit testing <a href=\"https://sqlcollaborative.visualstudio.com/dbachecks/_build/index?context=mine&path=%5C&definitionId=3&_a=completed\" target=\"_blank\">Click Here</a></td>\n    </tr>\n    <tr>\n      <td><a href-\"https://sqlcollaborative.visualstudio.com/dbachecks/_build/index?context=mine&path=%5C&definitionId=2&_a=completed\"><img align=\"left\" src=\"https://sqlcollaborative.visualstudio.com/_apis/public/build/definitions/a0deae7b-ae38-4ecc-a836-5f79cc561140/2/badge\"></a></td>\n      <td>Main Branch Build - Module version update and Code Signing <a href=\"https://sqlcollaborative.visualstudio.com/dbachecks/_build/index?context=mine&path=%5C&definitionId=2&_a=completed\" target=\"_blank\">Click Here</a></td>\n    </tr>\n        <tr>\n      <td><a href = \"https://sqlcollaborative.visualstudio.com/dbachecks/_releases2?definitionId=3&view=mine&_a=releases\"><img align=\"left\" src=\"https://sqlcollaborative.vsrm.visualstudio.com/_apis/public/Release/badge/a0deae7b-ae38-4ecc-a836-5f79cc561140/2/2\"></a></td>\n          <td>Main Branch Release - Release to PowerShell Gallery <a href=\"https://sqlcollaborative.visualstudio.com/dbachecks/_releases2?definitionId=3&view=mine&_a=releases\" target=\"_blank\">Click Here</a></td>\n    </tr>\n  </tbody>\n</table>\n\nWant to know how our CD process works? Read this [blog post](https://sqldbawithabeard.com/2018/05/01/version-update-code-signing-and-publishing-to-the-powershell-gallery-with-vsts/) and see how the team manage it\n\n## Prerequisites\n### Client requirements\n* PowerShell 5 + is required.\n* Automatic installation of the dependent modules will only be provided via the [PowerShell Gallery](https://www.powershellgallery.com).\n\nWhen you install from the Gallery, it'll auto-install:\n\n* dbatools\n* PSFramework\n\nYou will also need to manually install the Pester module at version 4.10.0, this is due to inconsistencies between dbachecks and Pester v5.  If you have Pester v5 installed it is recommended to remove this and use Pester 4.10.0 or force an import of 4.10.0 when running dbachecks\n\n````\nInstall-Module Pester -SkipPublisherCheck -Force -RequiredVersion 4.10.0\nImport-Module Pester -Force -RequiredVersion 4.10.0\n````\n\nWhen you import, it'll auto-import\n\n* dbatools\n* Pester\n* PSFramework\n\nIf you have already installed the module and you update it, you may be required to update the Pester or the PSFramework modules before it will import. If you see a message like\n\n![error](https://user-images.githubusercontent.com/6729780/35032185-dfe988a2-fb5d-11e7-83e3-6a41a9c89b81.png)\n\nThen you need to\n\n````\nInstall-Module Pester -SkipPublisherCheck -Force -RequiredVersion 4.10.0\nImport-Module Pester -Force -RequiredVersion 4.10.0\n````\n\nYou may need to do the same thing for the PSFramework or dbatools modules also\n\n### SQL requirements\n\ndbachecks uses dbatools for most of it's data gathering so it supports SQL Versions from SQL 2000 to SQL vNext including SQL running on Linux. (dbachecks will not install on PowerShell Core yet so can not be run on a Linux client) Obviously some of the Services and disk space checks will not work against instances running on Linux as they are using Windows API calls.\n\n## Getting started\n\nChecks are performed using `Invoke-DbcCheck` which is basically a wrapper for [Invoke-Pester](https://github.com/pester/Pester/wiki/Invoke-Pester). This means that supported `Invoke-Pester` parameters work against `Invoke-DbcCheck`.\n\nIn this module, a \"Check\" is synonymous with a \"Tag\" in Pester. So you can **Invoke-DbcCheck** and specify a Check that you want to run. You can see a list of the available Checks with **Get-DbcCheck**.\n\n![image](https://user-images.githubusercontent.com/8278033/34329332-57f40a1c-e8fc-11e7-8526-178c415b09bf.png)\n\nOnce you've decided on the Check(s) you want to run, it's time to ensure you have a list of servers to run the checks against.\n\n### Making server lists\n\nSimilar to the [dbatools](https://dbatools.io) module, dbachecks accepts `-SqlInstance` and `-ComputerName` parameters.\n\n`Invoke-DbcCheck -SqlInstance $servers -Checks SuspectPage, LastBackup`\n\nIf you have a simplified (single) environment, however, you can set a permanent list of servers. \"Servers\" include both SQL Server instances and Windows servers. Checks that access Windows Server (e.g. disk space checks) will utilize `-ComputerName` parameter. A pure SQL Server command(s) (such as the backup check) utilizes the `-SqlInstance` parameter.\n\n```powershell\n# Set the servers you'll be working with\nSet-DbcConfig -Name app.sqlinstance -Value sql2016, sql2017, sql2008, sql2008\\express\nSet-DbcConfig -Name app.computername -Value sql2016, sql2017, sql2008\n\n# Look at the current configs\nGet-DbcConfig\n\n# Invoke a few tests\nInvoke-DbcCheck -Checks SuspectPage, LastBackup\n```\n#### What it looks like\n\n![image](https://user-images.githubusercontent.com/8278033/34315954-431d0b16-e78a-11e7-8f6d-c87b40ed90b2.png)\n\n#### Other ways to execute checks against specific servers\n\nAdditional `Invoke-DbcCheck` examples:\n\n```powershell\nInvoke-DbcCheck -Check Backup -SqlInstance sql2016\nInvoke-DbcCheck -Check RecoveryModel -SqlInstance sql2017, sqlcluster\n\n$sqlinstance = Get-DbaRegisteredServer -SqlInstance sql2017 -Group Express\nInvoke-DbcCheck -Check Backup -SqlInstance $sqlinstance\n\nInvoke-DbcCheck -Check Storage -ComputerName server1, server2\n```\n\n## Check and ExcludeCheck\n\nWe tag each of our Checks using singular descriptions such as Backup, Database or Storage. You can see all the Pester related Tags using `Get-DbcTagCollection` or `Get-DbcCheck`.\n\nEach Check generally has a few Tags but at least one Tag is unique. This allows us to essentially name a Check and using these Tags, you can either include (`-Check`) or Exclude (`-ExcludeCheck`) in your results. The Exclude will always take precedence.\n\nFor example, the Database Tag runs a number of Checks including Backup Checks. The command below will run all Database Checks except for the Backup Checks.\n\n```powershell\nInvoke-DbcCheck -Check Database -ExcludeCheck Backup -SqlInstance sql2016 -SqlCredential (Get-Credential sqladmin)\n```\n\nAll valid [Pester](https://github.com/Pester/Pester) syntax is valid for dbachecks so if you'd like to know more, you can review their documentation.\n\n## Reporting on the data\n\nSince this is just PowerShell and Pester, results can be exported then easily converted to pretty reports. We've provided two options: Power BI and SMTP mail.\n\n### Power BI Visualizations!\n\nWe've also included a pre-built Power BI Desktop report! You can download Power BI Desktop from [here](https://powerbi.microsoft.com/en-us/downloads/) or it is now offered via the [Microsoft Store on Windows 10](https://www.microsoft.com/store/productId/9NTXR16HNW1T).\n\nNote: We strongly recommend that you keep your PowerBI Desktop updated since we can add brand-new stuff that appears on the most recent releases.\n\nTo use the Power BI report, pipe the results of `Invoke-DbcCheck` to `Update-DbcPowerBiDataSource` (defaults to `C:\\Windows\\temp\\dbachecks`), then launch the included `dbachecks.pbix` file using `Start-DbcPowerBi`. Once the Power BI report is open, just hit **refresh**.\n\n```powershell\n# Run checks and export its JSON\nInvoke-DbcCheck -SqlInstance sql2017 -Checks SuspectPage, LastBackup -Show Summary -PassThru | Update-DbcPowerBiDataSource\n\n# Launch Power BI then hit refresh\nStart-DbcPowerBi\n```\n\n![image](https://user-images.githubusercontent.com/19521315/36527050-640d6c0a-17a8-11e8-9781-0aab0a8f8d48.png)\n\nThe above report uses `Update-DbcPowerBiDataSource`'s `-Environment` parameter.\n\n```powershell\n# Run checks and export its JSON\nInvoke-DbcCheck -SqlInstance $prod -Checks LastBackup -Show Summary -PassThru |\nUpdate-DbcPowerBiDataSource -Enviornment Prod\n```\n\n😍😍😍\n\n### Sending mail\n\nWe even included a command to make emailing the results easier!\n\n```powershell\nInvoke-DbcCheck -SqlInstance sql2017 -Checks SuspectPage, LastBackup -OutputFormat NUnitXml -PassThru |\nSend-DbcMailMessage -To clemaire@dbatools.io -From nobody@dbachecks.io -SmtpServer smtp.ad.local\n```\n\n![image](https://user-images.githubusercontent.com/8278033/34316816-cc157d04-e79e-11e7-971d-1cfee90b2e11.png)\n\nIf you'd like to test locally, check out [PaperCut](https://github.com/ChangemakerStudios/Papercut/releases) which is just a quick email viewer that happens to have a built-in SMTP server. It provides awesome, built-in functionality so you can send the reports!\n\n## Advanced usage\n\n### Skipping some internal tests\n\nThe Check `LastGoodCheckDb` includes a test for data purity. You may be in an environment that can't support data purity. If this check needs to be skipped, you can do the following:\n\n```powershell\nGet-DbcConfig *skip*\nSet-DbcConfig -Name skip.dbcc.datapuritycheck -Value $true\n```\n\nNeed to skip a whole test? Just use the `-ExcludeCheck` which is auto-populated with both Check names and Pester Tags.\n\n### Setting a global SQL Credential\n\n`Set-DbcConfig` persists the values. If you `Set-DbcConfig -Name app.sqlcredential -Value (Get-Credential sa)` it will set the `SqlCredential` for the whole module, but not your local console! So cool.\n\nYou can also manually change the `SqlCredential` or `Credential` by specifying it in `Invoke-DbaCheck`:\n\n```powershell\nInvoke-DbaCheck -SqlInstance sql2017 -SqlCredential (Get-Credential sqladmin) -Check MaxMemory\n```\n\n### Manipulating the underlying commands\n\nYou can also modify the parameters of the actual command that's being executed:\n\n```powershell\nSet-Variable -Name PSDefaultParameterValues -Value @{ 'Get-DbaDiskSpace:ExcludeDrive' = 'C:\\' } -Scope Global\nInvoke-DbcCheck -Check Storage\n```\n\n## Can I run tests not included the module?\n\nIf you have super specialized checks to run, you can add a new repository, update the `app.checkrepos` config and this will make all of your tests available to `Invoke-DbcCheck`. From here, you can pipe to `Send-DbcMailMessage`, `Update-DbcPowerBiDataSource` or parse however you would parse Pester results.\n\n![image](https://user-images.githubusercontent.com/8278033/34320729-aeacb72a-e800-11e7-8278-a83de46afcc6.png)\n\nSo first, add your repository\n\n```powershell\nSet-DbcConfig -Name app.checkrepos -Value C:\\temp\\checks -Append\n```\n\nThen add additional checks. We recommend using the [development guidelines for dbachecks](https://github.com/potatoqualitee/dbachecks/wiki).\n\n![image](https://user-images.githubusercontent.com/8278033/34320819-07fe939c-e802-11e7-8203-a82740cc8f19.png)\n\n## I'd like to run my checks in SQL Server Agent\n\nGreat idea! Remember that this module requires PowerShell version 4.0, which doesn't always mesh with SQL Server's PowerShell Job Step. To run dbachecks, **we recommend you use CmdExec**. You can read more at [dbatools.io/agent](https://dbatools.io/agent).\n\nIf you do choose to use the PowerShell step, don't forget to `Set-Location` somewhere outside of SQLSERVER:, otherwise, you'll get errors similar to this\n\n![image](https://user-images.githubusercontent.com/8771143/35379174-878505fc-01b5-11e8-8731-41be4daff815.png)\n\n## I don't have access to the PowerShell Gallery, how can I download this?\n\nThis module has a number of dependencies which makes creating a GitHub-centric installer a bit of a pain. We suggest you use a machine with [PowerShellGet](https://docs.microsoft.com/en-us/powershell/gallery/psget/get_psget_module) installed and Save all the modules you need:\n\n```powershell\nSave-Module -Name dbachecks, dbatools, PSFramework, Pester -Path C:\\temp\n```\n\nThen move them to somewhere in your `$env:PSModulePath`, perhaps **Documents\\WindowsPowerShell\\Modules** or **C:\\Program Files\\WindowsPowerShell\\Modules**.\n\n## Read more\n\nRead more about dbachecks from a number of our original contributors!\n\n* [Announcing dbachecks – Configurable PowerShell Validation For Your SQL Instances by Rob Sewell](https://sqldbawithabeard.com/2018/02/22/announcing-dbachecks-configurable-powershell-validation-for-your-sql-instances/)\n* [introducing dbachecks - a new module from the dbatools team! by Chrissy LeMaire](https://dbachecks.io/introducing)\n* [install dbachecks by Chrissy LeMaire](https://dbachecks.io/install)\n* [dbachecks commands by Chrissy LeMaire](https://dbachecks.io/commands)\n* [dbachecks – Using Power BI dashboards to analyse results by Cláudio Silva](http://claudioessilva.eu/2018/02/22/dbachecks-using-power-bi-dashboards-to-analyse-results/)\n* [My wrapper for dbachecks by Tony Wilhelm](https://v-roddba.blogspot.com/2018/02/wrapper-for-dbachecks.html)\n* [Checking backups with dbachecks by Jess Pomfret](http://jesspomfret.com/checking-backups-with-dbachecks/)\n* [dbachecks please! by Garry Bargsley](http://blog.garrybargsley.com/dbachecks-please)\n* [dbachecks – Configuration Deep Dive by Rob Sewell](https://sqldbawithabeard.com/2018/02/22/dbachecks-configuration-deep-dive/)\n* [Test Log Shipping with dbachecks by Sander Stad](https://www.sqlstad.nl/powershell/test-log-shipping-with-dbachecks/)\n* [Checking your backup strategy with dbachecks by Joshua Corrick](https://corrick.io/blog/checking-your-backup-strategy-with-dbachecks)\n* [Enterprise-level reporting with dbachecks by Jason Squires](http://www.sqlnotnull.com/2018/02/20/enterprise-level-reporting-with-dbachecks-from-the-makers-of-dbatools)\n* [Adding your own checks to dbachecks by Shane O'Neill](http://nocolumnname.blog/2018/02/22/adding-your-own-checks-to-dbachecks)\n* [dbachecks - A different approach for an in-progress and incremental validation by Cláudio Silva](http://claudioessilva.eu/2018/02/22/dbachecks-a-different-approach-for-a-in-progress-and-incremental-validation/)\n* [dbachecks - Improved Descriptions by Rob Sewell](https://sqldbawithabeard.com/2018/05/19/dbachecks-improved-descriptions/)\n* [DBACHECKS – SQL SERVER COMPLIANCE TESTING WITH SIMPLE CONFIGURATION MANAGEMENT by Stuart Moore](https://stuart-moore.com/dbachecks-sql-server-compliance-testing-simple-configuration-management/)\n* [dbachecks – Which Configuration Item For Which Check ? by Rob Sewell](https://sqldbawithabeard.com/2018/05/15/dbachecks-which-configuration-item-for-which-check/)\n*[https://sqldbawithabeard.com/2018/04/08/checking-availability-groups-with-dbachecks/ by Rob Sewell](https://sqldbawithabeard.com/2018/04/08/checking-availability-groups-with-dbachecks/)\n\nKnow of any more blog posts about dbachecks? - Please add them here.\n\n## Party\n\nNice work!\n"
  },
  {
    "path": "header-mkdocs.yml",
    "content": "site_name: dbachecks\nrepo_url: https://github.com/sqlcollaborative/dbachecks\nsite_author: The Beard\nedit_uri: edit/main/docs/\ntheme: readthedocs\ncopyright: \"dbachecks is licensed under the <a href='https://github.com/sqlcollaborative/dbachecks/raw/main/LICENSE'>MIT license\"\npages:\n  - Home: index.md"
  },
  {
    "path": "mkdocs.yml",
    "content": "site_name: dbachecks\nrepo_url: https://github.com/sqlcollaborative/dbachecks\nsite_author: The Beard\nedit_uri: edit/main/docs/\ntheme: readthedocs\ncopyright: \"dbachecks is licensed under the <a href='https://github.com/sqlcollaborative/dbachecks/raw/master/LICENSE'>MIT license\"\npages:\n  - Home: index.md\n  - Release Notes: RELEASE.md\n  - Functions:\n    - Clear-DbcPowerBiDataSource: functions/Clear-DbcPowerBiDataSource.md\n    - Convert-DbcResult: functions/Convert-DbcResult.md\n    - Export-DbcConfig: functions/Export-DbcConfig.md\n    - Get-DbcCheck: functions/Get-DbcCheck.md\n    - Get-DbcConfig: functions/Get-DbcConfig.md\n    - Get-DbcConfigValue: functions/Get-DbcConfigValue.md\n    - Get-DbcReleaseNote: functions/Get-DbcReleaseNote.md\n    - Get-DbcTagCollection: functions/Get-DbcTagCollection.md\n    - Import-DbcConfig: functions/Import-DbcConfig.md\n    - Invoke-DbcCheck: functions/Invoke-DbcCheck.md\n    - Invoke-DbcConfigFile: functions/Invoke-DbcConfigFile.md\n    - Reset-DbcConfig: functions/Reset-DbcConfig.md\n    - Save-DbcRequiredModules: functions/Save-DbcRequiredModules.md\n    - Set-DbcCisConfig: functions/Set-DbcCisConfig.md\n    - Set-DbcConfig: functions/Set-DbcConfig.md\n    - Set-DbcFile: functions/Set-DbcFile.md\n    - Start-DbcPowerBi: functions/Start-DbcPowerBi.md\n    - Update-DbcPowerBiDataSource: functions/Update-DbcPowerBiDataSource.md\n    - Update-DbcRequiredModules: functions/Update-DbcRequiredModules.md\n    - Write-DbcTable: functions/Write-DbcTable.md\n\n"
  },
  {
    "path": "readme.md",
    "content": "# dbachecks\n\n<a href=\"https://star-history.com/#dataplat/dbachecks&Date\"><img align=\"right\" height=\"300\" src=\"https://api.star-history.com/svg?repos=dataplat/dbachecks&type=Date\"></a>\n\n[![.github/workflows/deploy-module.yml](https://github.com/dataplat/dbachecks/actions/workflows/deploy-module.yml/badge.svg?branch=main)](https://github.com/dataplat/dbachecks/actions/workflows/deploy-module.yml)  \n[![GitHub release badge](https://badgen.net/github/release/dataplat/dbachecks/stable?label=latest_release)](https://github.com/dataplat/dbachecks/releases/latest) \n[![GitHub pre-release badge](https://badgen.net/github/release/dataplat/dbachecks?label=pre-release)](https://github.com/dataplat/dbachecks/releases/)  \n[![PowerShell Gallery](https://img.shields.io/powershellgallery/v/dbachecks?label=PowerShell_Gallery)](https://www.powershellgallery.com/packages/dbachecks/)  \n[![GitHub license badge](https://badgen.net/github/license/dataplat/dbachecks)](https://github.com/dataplat/dbachecks/blob/43423437f831e2844452d482a50864f224f12534/LICENSE)\n[![GitHub releases badge](https://badgen.net/github/releases/dataplat/dbachecks)](https://github.com/dataplat/dbachecks/releases)  \n![Ubuntu Linux](https://badgen.net/badge/icon/Ubuntu?icon=terminal&label=pwsh)[![Linux Tests](https://gist.githubusercontent.com/SQLDBAWithABeard/7a5d2837e29654202f22392187c75fec/raw/linux-badge.svg)](https://github.com/dataplat/dbachecks/actions/)  \n![macOS](https://badgen.net/badge/icon/macOS?icon=apple&label=pwsh)[![MacOs Tests](https://gist.githubusercontent.com/SQLDBAWithABeard/7a5d2837e29654202f22392187c75fec/raw/macos-badge.svg)](https://github.com/dataplat/dbachecks/actions/)  \n![Windows badge](https://badgen.net/badge/icon/windows?icon=windows&label=pwsh)[![Windows pwsh Tests](https://gist.githubusercontent.com/SQLDBAWithABeard/7a5d2837e29654202f22392187c75fec/raw/winps7-badge.svg)](https://github.com/dataplat/dbachecks/actions/)  \n ![Windows badge](https://badgen.net/badge/icon/windows?icon=windows&label=5.1)[![Windows PowerShell 5.1 Tests](https://gist.githubusercontent.com/SQLDBAWithABeard/7a5d2837e29654202f22392187c75fec/raw/winps51-badge.svg)](https://github.com/dataplat/dbachecks/actions/)\n\n\n<img src=\"https://user-images.githubusercontent.com/8278033/34322840-ed09114e-e832-11e7-9670-9baa686ade71.png\">\n\n**Please note - development on v2 has stopped and all efforts are focused on the v3 improvements to use Pester v5 and improve performance.**\n\nYou are welcome to help by picking something from the project https://github.com/orgs/dataplat/projects/2 or by contacting @SQLDBAWithABeard @jpomfret @ClaudioESSilva or @shaneis\n\ndbachecks is a framework created by and for SQL Server pros who need to validate their environments. Basically, we all share similar checklists and mostly just the server names and RPO/RTO/etc change.\n\nThis open source module allows us to crowd-source our checklists using [Pester](https://github.com/Pester/Pester) tests. Such checks include:\n\n* Backups are being performed\n* Identity columns are not about to max out\n* Servers have access to backup paths\n* Database integrity checks are being performed and corruption does not exist\n* Disk space is not about to run out\n* All enabled jobs have succeeded\n\n## Interactive dbachecks PowerShell Notebooks for Azure Data Studio\n\nYou can find a set of interactive PowerShell Notebooks which will introduce you to all of the core concepts in Robs GitHub. There is a set of .NET interactive Jupyter Notebooks\n\nhttps://github.com/SQLDBAWithABeard/JupyterNotebooks/tree/main/notebooks/dotNETNotebooks/dbachecks\n\nand a set of Jupyter Notebooks that will run in Azure Data Studio\n\nhttps://github.com/SQLDBAWithABeard/JupyterNotebooks/tree/main/notebooks/NotDotNet/dbachecks\n\nBoth will use a docker container to show you how dbachecks works.\n\nThere is a zip file containing the Notebooks here\n\nhttps://github.com/SQLDBAWithABeard/Presentations/raw/main/Notebooks/dbachecks/Notebooks.zip\n\nHave questions about development? Please visit our [Wiki](https://github.com/sqlcollaborative/dbachecks/wiki). **Anyone developing this module** should visit that Wiki page (after fully reading this readme) for a brief overview.\n\n## Build Status\n<table>\n  <tbody>\n    <tr>\n      <td><a href=\"https://sqlcollaborative.visualstudio.com/dbachecks/_build/index?context=mine&path=%5C&definitionId=3&_a=completed\" target=\"_blank\"><img align=\"left\" src=\"https://sqlcollaborative.visualstudio.com/_apis/public/build/definitions/a0deae7b-ae38-4ecc-a836-5f79cc561140/3/badge\"></a></td>\n      <td>Development Branch Build - Unit testing <a href=\"https://sqlcollaborative.visualstudio.com/dbachecks/_build/index?context=mine&path=%5C&definitionId=3&_a=completed\" target=\"_blank\">Click Here</a></td>\n    </tr>\n    <tr>\n      <td><a href-\"https://sqlcollaborative.visualstudio.com/dbachecks/_build/index?context=mine&path=%5C&definitionId=2&_a=completed\"><img align=\"left\" src=\"https://sqlcollaborative.visualstudio.com/_apis/public/build/definitions/a0deae7b-ae38-4ecc-a836-5f79cc561140/2/badge\"></a></td>\n      <td>Main Branch Build - Module version update and Code Signing <a href=\"https://sqlcollaborative.visualstudio.com/dbachecks/_build/index?context=mine&path=%5C&definitionId=2&_a=completed\" target=\"_blank\">Click Here</a></td>\n    </tr>\n        <tr>\n      <td><a href = \"https://sqlcollaborative.visualstudio.com/dbachecks/_releases2?definitionId=3&view=mine&_a=releases\"><img align=\"left\" src=\"https://sqlcollaborative.vsrm.visualstudio.com/_apis/public/Release/badge/a0deae7b-ae38-4ecc-a836-5f79cc561140/2/2\"></a></td>\n          <td>Main Branch Release - Release to PowerShell Gallery <a href=\"https://sqlcollaborative.visualstudio.com/dbachecks/_releases2?definitionId=3&view=mine&_a=releases\" target=\"_blank\">Click Here</a></td>\n    </tr>\n  </tbody>\n</table>\n\nWant to know how our CD process works? Read this [blog post](https://sqldbawithabeard.com/2018/05/01/version-update-code-signing-and-publishing-to-the-powershell-gallery-with-vsts/) and see how the team manage it\n\n## Prerequisites\n### Client requirements\n* PowerShell 5 + is required.\n* Automatic installation of the dependent modules will only be provided via the [PowerShell Gallery](https://www.powershellgallery.com).\n\nWhen you install from the Gallery, it'll auto-install:\n\n* dbatools\n* PSFramework\n\nYou will also need to manually install the Pester module at version 4.10.0, this is due to inconsistencies between dbachecks and Pester v5.  If you have Pester v5 installed it is recommended to remove this and use Pester 4.10.0 or force an import of 4.10.0 when running dbachecks\n\n````\nInstall-Module Pester -SkipPublisherCheck -Force -RequiredVersion 4.10.0\nImport-Module Pester -Force -RequiredVersion 4.10.0\n````\n\nWhen you import, it'll auto-import\n\n* dbatools\n* Pester\n* PSFramework\n\nIf you have already installed the module and you update it, you may be required to update the Pester or the PSFramework modules before it will import. If you see a message like\n\n![error](https://user-images.githubusercontent.com/6729780/35032185-dfe988a2-fb5d-11e7-83e3-6a41a9c89b81.png)\n\nThen you need to\n\n````\nInstall-Module Pester -SkipPublisherCheck -Force -RequiredVersion 4.10.0\nImport-Module Pester -Force -RequiredVersion 4.10.0\n````\n\nYou may need to do the same thing for the PSFramework or dbatools modules also\n\n### SQL requirements\n\ndbachecks uses dbatools for most of it's data gathering so it supports SQL Versions from SQL 2000 to SQL vNext including SQL running on Linux. (dbachecks will not install on PowerShell Core yet so can not be run on a Linux client) Obviously some of the Services and disk space checks will not work against instances running on Linux as they are using gWindows API calls.\n\n## Getting started\n\nChecks are performed using `Invoke-DbcCheck` which is basically a wrapper for [Invoke-Pester](https://github.com/pester/Pester/wiki/Invoke-Pester). This means that supported `Invoke-Pester` parameters work against `Invoke-DbcCheck`.\n\nIn this module, a \"Check\" is synonymous with a \"Tag\" in Pester. So you can **Invoke-DbcCheck** and specify a Check that you want to run. You can see a list of the available Checks with **Get-DbcCheck**.\n\n![image](https://user-images.githubusercontent.com/8278033/34329332-57f40a1c-e8fc-11e7-8526-178c415b09bf.png)\n\nOnce you've decided on the Check(s) you want to run, it's time to ensure you have a list of servers to run the checks against.\n\n### Making server lists\n\nSimilar to the [dbatools](https://dbatools.io) module, dbachecks accepts `-SqlInstance` and `-ComputerName` parameters.\n\n`Invoke-DbcCheck -SqlInstance $servers -Checks SuspectPage, LastBackup`\n\nIf you have a simplified (single) environment, however, you can set a permanent list of servers. \"Servers\" include both SQL Server instances and Windows servers. Checks that access Windows Server (e.g. disk space checks) will utilize `-ComputerName` parameter. A pure SQL Server command(s) (such as the backup check) utilizes the `-SqlInstance` parameter.\n\n```powershell\n# Set the servers you'll be working with\nSet-DbcConfig -Name app.sqlinstance -Value sql2016, sql2017, sql2008, sql2008\\express\nSet-DbcConfig -Name app.computername -Value sql2016, sql2017, sql2008\n\n# Look at the current configs\nGet-DbcConfig\n\n# Invoke a few tests\nInvoke-DbcCheck -Checks SuspectPage, LastBackup\n```\n#### What it looks like\n\n![image](https://user-images.githubusercontent.com/8278033/34315954-431d0b16-e78a-11e7-8f6d-c87b40ed90b2.png)\n\n#### Other ways to execute checks against specific servers\n\nAdditional `Invoke-DbcCheck` examples:\n\n```powershell\nInvoke-DbcCheck -Check Backup -SqlInstance sql2016\nInvoke-DbcCheck -Check RecoveryModel -SqlInstance sql2017, sqlcluster\n\n$sqlinstance = Get-DbaRegisteredServer -SqlInstance sql2017 -Group Express\nInvoke-DbcCheck -Check Backup -SqlInstance $sqlinstance\n\nInvoke-DbcCheck -Check Storage -ComputerName server1, server2\n```\n\n## Check and ExcludeCheck\n\nWe tag each of our Checks using singular descriptions such as Backup, Database or Storage. You can see all the Pester related Tags using `Get-DbcTagCollection` or `Get-DbcCheck`.\n\nEach Check generally has a few Tags but at least one Tag is unique. This allows us to essentially name a Check and using these Tags, you can either include (`-Check`) or Exclude (`-ExcludeCheck`) in your results. The Exclude will always take precedence.\n\nFor example, the Database Tag runs a number of Checks including Backup Checks. The command below will run all Database Checks except for the Backup Checks.\n\n```powershell\nInvoke-DbcCheck -Check Database -ExcludeCheck Backup -SqlInstance sql2016 -SqlCredential (Get-Credential sqladmin)\n```\n\nAll valid [Pester](https://github.com/Pester/Pester) syntax is valid for dbachecks so if you'd like to know more, you can review their documentation.\n\n## Reporting on the data\n\nSince this is just PowerShell and Pester, results can be exported then easily converted to pretty reports. We've provided two options: Power BI and SMTP mail.\n\n### Power BI Visualizations!\n\nWe've also included a pre-built Power BI Desktop report! You can download Power BI Desktop from [here](https://powerbi.microsoft.com/en-us/downloads/) or it is now offered via the [Microsoft Store on Windows 10](https://www.microsoft.com/store/productId/9NTXR16HNW1T).\n\nNote: We strongly recommend that you keep your PowerBI Desktop updated since we can add brand-new stuff that appears on the most recent releases.\n\nTo use the Power BI report, pipe the results of `Invoke-DbcCheck` to `Update-DbcPowerBiDataSource` (defaults to `C:\\Windows\\temp\\dbachecks`), then launch the included `dbachecks.pbix` file using `Start-DbcPowerBi`. Once the Power BI report is open, just hit **refresh**.\n\n```powershell\n# Run checks and export its JSON\nInvoke-DbcCheck -SqlInstance sql2017 -Checks SuspectPage, LastBackup -Show Summary -PassThru | Update-DbcPowerBiDataSource\n\n# Launch Power BI then hit refresh\nStart-DbcPowerBi\n```\n\n![image](https://user-images.githubusercontent.com/19521315/36527050-640d6c0a-17a8-11e8-9781-0aab0a8f8d48.png)\n\nThe above report uses `Update-DbcPowerBiDataSource`'s `-Environment` parameter.\n\n```powershell\n# Run checks and export its JSON\nInvoke-DbcCheck -SqlInstance $prod -Checks LastBackup -Show Summary -PassThru |\nUpdate-DbcPowerBiDataSource -Environment Prod\n```\n\n😍😍😍\n\n### Sending mail\n\nWe even included a command to make emailing the results easier!\n\n```powershell\n$outputDirectory = (Get-DbcConfigValue -Name app.maildirectory)\n$filename = $outputDirectory + '\\file.xml'\nInvoke-Dbccheck -OutputFile $fileName -OutputFormat NunitXML\n\n$outputpath = $outputDirectory + \"\\index.html\"\n$reportunit = \"ModulePath\\bin\\ReportUnit.exe\"\n& $reportunit $outputDirectory\n\n$htmlbody = Get-Content -Path $outputpath -ErrorAction SilentlyContinue | Out-String\n\nSend-MailMessage -To clemaire@dbatools.io -From nobody@dbachecks.io -SMTP smtp.ad.local -BodyAsHtml $htmlbody\n```\n\n![image](https://user-images.githubusercontent.com/8278033/34316816-cc157d04-e79e-11e7-971d-1cfee90b2e11.png)\n\nIf you'd like to test locally, check out [PaperCut](https://github.com/ChangemakerStudios/Papercut/releases) which is just a quick email viewer that happens to have a built-in SMTP server. It provides awesome, built-in functionality so you can send the reports!\n\n## Advanced usage\n\n### Skipping some internal tests\n\nThe Check `LastGoodCheckDb` includes a test for data purity. You may be in an environment that can't support data purity. If this check needs to be skipped, you can do the following:\n\n```powershell\nGet-DbcConfig *skip*\nSet-DbcConfig -Name skip.dbcc.datapuritycheck -Value $true\n```\n\nNeed to skip a whole test? Just use the `-ExcludeCheck` which is auto-populated with both Check names and Pester Tags.\n\n### Setting a global SQL Credential\n\n`Set-DbcConfig` persists the values. If you `Set-DbcConfig -Name app.sqlcredential -Value (Get-Credential sa)` it will set the `SqlCredential` for the whole module, but not your local console! So cool.\n\nYou can also manually change the `SqlCredential` or `Credential` by specifying it in `Invoke-DbaCheck`:\n\n```powershell\nInvoke-DbaCheck -SqlInstance sql2017 -SqlCredential (Get-Credential sqladmin) -Check MaxMemory\n```\n\n### Manipulating the underlying commands\n\nYou can also modify the parameters of the actual command that's being executed:\n\n```powershell\nSet-Variable -Name PSDefaultParameterValues -Value @{ 'Get-DbaDiskSpace:ExcludeDrive' = 'C:\\' } -Scope Global\nInvoke-DbcCheck -Check Storage\n```\n\n## Can I run tests not included the module?\n\nIf you have super specialized checks to run, you can add a new repository, update the `app.checkrepos` config and this will make all of your tests available to `Invoke-DbcCheck`. From here, you can pipe to `Send-DbcMailMessage`, `Update-DbcPowerBiDataSource` or parse however you would parse Pester results.\n\n![image](https://user-images.githubusercontent.com/8278033/34320729-aeacb72a-e800-11e7-8278-a83de46afcc6.png)\n\nSo first, add your repository\n\n```powershell\nSet-DbcConfig -Name app.checkrepos -Value C:\\temp\\checks -Append\n```\n\nThen add additional checks. We recommend using the [development guidelines for dbachecks](https://github.com/potatoqualitee/dbachecks/wiki).\n\n![image](https://user-images.githubusercontent.com/8278033/34320819-07fe939c-e802-11e7-8203-a82740cc8f19.png)\n\n## I'd like to run my checks in SQL Server Agent\n\nGreat idea! Remember that this module requires PowerShell version 4.0, which doesn't always mesh with SQL Server's PowerShell Job Step. To run dbachecks, **we recommend you use CmdExec**. You can read more at [dbatools.io/agent](https://dbatools.io/agent).\n\nIf you do choose to use the PowerShell step, don't forget to `Set-Location` somewhere outside of SQLSERVER:, otherwise, you'll get errors similar to this\n\n![image](https://user-images.githubusercontent.com/8771143/35379174-878505fc-01b5-11e8-8731-41be4daff815.png)\n\n## I don't have access to the PowerShell Gallery, how can I download this?\n\nThis module has a number of dependencies which makes creating a GitHub-centric installer a bit of a pain. We suggest you use a machine with [PowerShellGet](https://docs.microsoft.com/en-us/powershell/scripting/gallery/installing-psget) installed and Save all the modules you need:\n\n```powershell\nSave-Module -Name dbachecks, dbatools, PSFramework, Pester -Path C:\\temp\n```\n\nThen move them to somewhere in your `$env:PSModulePath`, perhaps **Documents\\WindowsPowerShell\\Modules** or **C:\\Program Files\\WindowsPowerShell\\Modules**.\n\n## Read more\n\nRead more about dbachecks from a number of our original contributors!\n\n* [Announcing dbachecks – Configurable PowerShell Validation For Your SQL Instances by Rob Sewell](https://sqldbawithabeard.com/2018/02/22/announcing-dbachecks-configurable-powershell-validation-for-your-sql-instances/)\n* [introducing dbachecks - a new module from the dbatools team! by Chrissy LeMaire](https://dbachecks.io/introducing)\n* [install dbachecks by Chrissy LeMaire](https://dbachecks.io/install)\n* [dbachecks commands by Chrissy LeMaire](https://dbachecks.io/commands)\n* [dbachecks – Using Power BI dashboards to analyse results by Cláudio Silva](http://claudioessilva.eu/2018/02/22/dbachecks-using-power-bi-dashboards-to-analyse-results/)\n* [My wrapper for dbachecks by Tony Wilhelm](https://v-roddba.blogspot.com/2018/02/wrapper-for-dbachecks.html)\n* [Checking backups with dbachecks by Jess Pomfret](http://jesspomfret.com/checking-backups-with-dbachecks/)\n* [dbachecks please! by Garry Bargsley](https://garrybargsley.com/2018/02/22/dbachecks-please/)\n* [dbachecks – Configuration Deep Dive by Rob Sewell](https://sqldbawithabeard.com/2018/02/22/dbachecks-configuration-deep-dive/)\n* [Test Log Shipping with dbachecks by Sander Stad](https://www.sqlstad.nl/powershell/test-log-shipping-with-dbachecks/)\n* [Checking your backup strategy with dbachecks by Joshua Corrick](https://corrick.io/blog/checking-your-backup-strategy-with-dbachecks)\n* [Enterprise-level reporting with dbachecks by Jason Squires](http://www.sqlnotnull.com/2018/02/22/enterprise-level-reporting-with-dbachecks-from-the-makers-of-dbatools/)\n* [Adding your own checks to dbachecks by Shane O'Neill](http://nocolumnname.blog/2018/02/22/adding-your-own-checks-to-dbachecks)\n* [dbachecks - A different approach for an in-progress and incremental validation by Cláudio Silva](https://claudioessilva.eu/2018/02/22/dbachecks-a-different-approach-for-an-in-progress-and-incremental-validation/)\n* [dbachecks - Improved Descriptions by Rob Sewell](https://sqldbawithabeard.com/2018/05/19/dbachecks-improved-descriptions/)\n* [DBACHECKS – SQL SERVER COMPLIANCE TESTING WITH SIMPLE CONFIGURATION MANAGEMENT by Stuart Moore](https://stuart-moore.com/dbachecks-sql-server-compliance-testing-simple-configuration-management/)\n* [dbachecks – Which Configuration Item For Which Check ? by Rob Sewell](https://sqldbawithabeard.com/2018/05/15/dbachecks-which-configuration-item-for-which-check/)\n*[https://sqldbawithabeard.com/2018/04/08/checking-availability-groups-with-dbachecks/ by Rob Sewell](https://sqldbawithabeard.com/2018/04/08/checking-availability-groups-with-dbachecks/)\n\nKnow of any more blog posts about dbachecks? - Please add them here.\n\n## Party\n\nNice work!\n\n# How to Contribute\n\nWe welcome contributions to the project. You can fork the repository, make changes and create a Pull Request. [Rob has written a guide here](https://sqldbawithabeard.com/?p=11030)\n"
  },
  {
    "path": "source/checks/Agent.Tests.ps1",
    "content": "$filename = $MyInvocation.MyCommand.Name.Replace('.Tests.ps1', '')\n. $PSScriptRoot/../internal/assertions/Agent.Assertions.ps1\n[string[]]$NotContactable = (Get-PSFConfig -Module dbachecks -Name global.notcontactable).Value\n\nSet-PSFConfig -Module dbachecks -Name global.notcontactable -Value $NotContactable\n\n@(Get-Instance).ForEach{\n    if ($NotContactable -notcontains $psitem) {\n        $Instance = $psitem\n        try {\n            $InstanceSMO = Connect-DbaInstance\t-SqlInstance $Instance -ErrorAction SilentlyContinue -ErrorVariable errorvar\n        } catch {\n            $NotContactable += $Instance\n        }\n        if ($NotContactable -notcontains $psitem) {\n            if ($null -eq $InstanceSMO.version) {\n                $NotContactable += $Instance\n            } elseif (($InstanceSMO).Edition -like 'Express Edition*') { }\n            else {\n                Describe \"Database Mail XPs\" -Tags DatabaseMailEnabled, CIS, security, $filename {\n                    $DatabaseMailEnabled = Get-DbcConfigValue policy.security.DatabaseMailEnabled\n                    if ($NotContactable -contains $psitem) {\n                        Context \"Testing Database Mail XPs on $psitem\" {\n                            It \"Can't Connect to $Psitem\" {\n                                $false\t| Should -BeTrue -Because 'The instance should be available to be connected to!'\n                            }\n                        }\n                    } else {\n                        Context \"Testing Database Mail XPs on $psitem\" {\n                            It \"Testing Database Mail XPs is set to $DatabaseMailEnabled on $psitem\" {\n                                Assert-DatabaseMailEnabled -SQLInstance $Psitem -DatabaseMailEnabled $DatabaseMailEnabled\n                            }\n                        }\n                    }\n                }\n\n                Describe \"SQL Agent Account\" -Tags AgentServiceAccount, ServiceAccount, $filename {\n                    if ($NotContactable -contains $psitem) {\n                        Context \"Testing SQL Agent is running on $psitem\" {\n                            It \"Can't Connect to $Psitem\" {\n                                $false | Should -BeTrue -Because 'The instance should be available to be connected to!'\n                            }\n                        }\n                    } else {\n                        # cant check agent on container - hmm does this actually work with instance need to check\n                        if (-not $IsLinux -and ($InstanceSMO.HostPlatform -ne 'Linux')) {\n\n                            Context \"Testing SQL Agent is running on $psitem\" {\n                                @(Get-DbaService -ComputerName $psitem -Type Agent).ForEach{\n                                    It \"SQL Agent should be running for $($psitem.InstanceName) on $($psitem.ComputerName)\" {\n                                        $psitem.State | Should -Be 'Running' -Because 'The agent service is required to run SQL Agent jobs'\n                                    }\n                                    if ($InstanceSMO.IsClustered) {\n                                        It \"SQL Agent service should have a start mode of Manual for FailOver Clustered Instance $($psitem.InstanceName) on $($psitem.ComputerName)\" {\n                                            $psitem.StartMode | Should -Be 'Manual' -Because 'Clustered Instances required that the Agent service is set to manual'\n                                        }\n                                    } else {\n                                        It \"SQL Agent service should have a start mode of Automatic for standalone instance $($psitem.InstanceName) on $($psitem.ComputerName)\" {\n                                            $psitem.StartMode | Should -Be 'Automatic' -Because 'Otherwise the Agent Jobs wont run if the server is restarted'\n                                        }\n                                    }\n                                }\n                            }\n                        } else {\n                            Context \"Testing SQL Agent is running on $psitem\" {\n                                It \"Running on Linux or connecting to container so can't check Services on $Psitem\" -Skip {\n                                }\n                            }\n                        }\n                    }\n                }\n\n                Describe \"DBA Operators\" -Tags DbaOperator, Operator, $filename {\n                    if ($NotContactable -contains $psitem) {\n                        Context \"Testing DBA Operators exists on $psitem\" {\n                            It \"Can't Connect to $Psitem\" {\n                                $false | Should -BeTrue -Because 'The instance should be available to be connected to!'\n                            }\n                        }\n                    } else {\n                        Context \"Testing DBA Operators exists on $psitem\" {\n                            $operatorname = Get-DbcConfigValue agent.dbaoperatorname\n                            $operatoremail = Get-DbcConfigValue agent.dbaoperatoremail\n                            $results = Get-DbaAgentOperator -SqlInstance $psitem -Operator $operatorname\n                            @($operatorname).ForEach{\n                                It \"The Operator exists on $psitem\" {\n                                    $psitem | Should -BeIn $Results.Name -Because 'This Operator is expected to exist'\n                                }\n                            }\n                            @($operatoremail).ForEach{\n                                if ($operatoremail) {\n                                    It \"The Operator email $operatoremail is correct on $psitem\" {\n                                        $psitem | Should -BeIn $results.EmailAddress -Because 'This operator email is expected to exist'\n                                    }\n                                }\n                            }\n                        }\n                    }\n                }\n\n                Describe \"Failsafe Operator\" -Tags FailsafeOperator, Operator, $filename {\n                    if ($NotContactable -contains $psitem) {\n                        Context \"Testing failsafe operator exists on $psitem\" {\n                            It \"Can't Connect to $Psitem\" {\n                                $false | Should -BeTrue -Because 'The instance should be available to be connected to!'\n                            }\n                        }\n                    } else {\n                        Context \"Testing failsafe operator exists on $psitem\" {\n                            $failsafeoperator = Get-DbcConfigValue agent.failsafeoperator\n                            It \"The Failsafe Operator exists on $psitem\" {\n                                (Connect-DbaInstance -SqlInstance $psitem).JobServer.AlertSystem.FailSafeOperator | Should -Be $failsafeoperator -Because 'The failsafe operator will ensure that any job failures will be notified to someone if not set explicitly'\n                            }\n                        }\n                    }\n                }\n\n                Describe \"Database Mail Profile\" -Tags DatabaseMailProfile, $filename {\n                    if ($NotContactable -contains $psitem) {\n                        Context \"Testing database mail profile is set on $psitem\" {\n                            It \"Can't Connect to $Psitem\" {\n                                $false | Should -BeTrue -Because 'The instance should be available to be connected to!'\n                            }\n                        }\n                    } else {\n                        Context \"Testing database mail profile is set on $psitem\" {\n                            $databasemailprofile = Get-DbcConfigValue agent.databasemailprofile\n                            It \"The Database Mail profile $databasemailprofile exists on $psitem\" {\n                                ((Get-DbaDbMailProfile -SqlInstance $InstanceSMO).Name -contains $databasemailprofile) | Should -Be $true -Because 'The database mail profile is required to send emails'\n                            }\n                        }\n                    }\n                }\n\n                Describe \"Agent Mail Profile\" -Tags AgentMailProfile, $filename {\n                    if ($NotContactable -contains $psitem) {\n                        Context \"Testing SQL Agent Alert System database mail profile is set on $psitem\" {\n                            It \"Can't Connect to $Psitem\" {\n                                $false | Should -BeTrue -Because 'The instance should be available to be connected to!'\n                            }\n                        }\n                    } else {\n                        Context \"Testing SQL Agent Alert System database mail profile is set on $psitem\" {\n                            $agentmailprofile = Get-DbcConfigValue agent.databasemailprofile\n                            It \"The SQL Server Agent Alert System should have an enabled database mail profile on $psitem\" {\n                                (Get-DbaAgentServer -SqlInstance $InstanceSMO).DatabaseMailProfile | Should -Be $agentmailprofile -Because 'The SQL Agent Alert System needs an enabled database mail profile to send alert emails'\n                            }\n                        }\n                    }\n                }\n\n                Describe \"Failed Jobs\" -Tags FailedJob, $filename {\n\n                    if ($NotContactable -contains $psitem) {\n                        Context \"Checking for failed enabled jobs on $psitem\" {\n                            It \"Can't Connect to $Psitem\" {\n                                $false | Should -BeTrue -Because 'The instance should be available to be connected to!'\n                            }\n                        }\n                    } else {\n                        $maxdays = Get-DbcConfigValue agent.failedjob.since\n                        $startdate = (Get-Date).AddDays( - $maxdays)\n                        Context \"Checking for failed enabled jobs since $startdate on $psitem\" {\n                            $excludecancelled = Get-DbcConfigValue agent.failedjob.excludecancelled\n                            @(Get-DbaAgentJob -SqlInstance $psitem | Where-Object { $Psitem.IsEnabled -and ($psitem.LastRunDate -gt $startdate) }).ForEach{\n                                if ($psitem.LastRunOutcome -eq 'Unknown') {\n                                    It -Skip \"We chose to skip this as $psitem's last run outcome is unknown on $($psitem.SqlInstance)\" {\n                                        $psitem.LastRunOutcome | Should -Be 'Succeeded' -Because 'All Agent Jobs should have succeed this one is unknown - you need to investigate the failed jobs'\n                                    }\n                                } elseif (($psitem.LastRunOutcome -eq 'Cancelled') -and ($excludecancelled -eq $true)) {\n                                    It -Skip \"We chose to skip this as $psitem's last run outcome is cancelled on $($psitem.SqlInstance)\" {\n                                        $psitem.LastRunOutcome | Should -Be 'Succeeded' -Because 'All Agent Jobs should have succeed this one is unknown - you need to investigate the failed jobs'\n                                    }\n                                } else {\n                                    It \"$psitem's last run outcome is $($psitem.LastRunOutcome) on $($psitem.SqlInstance)\" {\n                                        $psitem.LastRunOutcome | Should -Be 'Succeeded' -Because 'All Agent Jobs should have succeed - you need to investigate the failed jobs'\n                                    }\n                                }\n                            }\n                        }\n                    }\n                }\n\n                Describe \"Valid Job Owner\" -Tags ValidJobOwner, $filename {\n                    [string[]]$targetowner = Get-DbcConfigValue agent.validjobowner.name\n\n                    if ($NotContactable -contains $psitem) {\n                        Context \"Testing job owners on $psitem\" {\n                            It \"Can't Connect to $Psitem\" {\n                                $false | Should -BeTrue -Because 'The instance should be available to be connected to!'\n                            }\n                        }\n                    } else {\n                        Context \"Testing job owners on $psitem\" {\n                            @(Get-DbaAgentJob -SqlInstance $psitem -EnableException:$false).ForEach{\n                                It \"Job $($psitem.Name)  - owner $($psitem.OwnerLoginName) should be in this list ( $( [String]::Join(', ', $targetowner) ) ) on $($psitem.SqlInstance)\" {\n                                    $psitem.OwnerLoginName | Should -BeIn $TargetOwner -Because 'The account that is the job owner is not what was expected'\n                                }\n                            }\n                        }\n                    }\n                }\n                Describe \"Invalid Job Owner\" -Tags InValidJobOwner, $filename {\n                    [string[]]$targetowner = Get-DbcConfigValue agent.invalidjobowner.name\n\n                    if ($NotContactable -contains $psitem) {\n                        Context \"Testing job owners on $psitem\" {\n                            It \"Can't Connect to $Psitem\" {\n                                $false | Should -BeTrue -Because 'The instance should be available to be connected to!'\n                            }\n                        }\n                    } else {\n                        Context \"Testing job owners on $psitem\" {\n                            @(Get-DbaAgentJob -SqlInstance $psitem -EnableException:$false).ForEach{\n                                It \"Job $($psitem.Name)  - owner $($psitem.OwnerLoginName) should not be in this list ( $( [String]::Join(', ', $targetowner) ) ) on $($psitem.SqlInstance)\" {\n                                    $psitem.OwnerLoginName | Should -Not -BeIn $TargetOwner -Because 'The account that is the job owner has been defined as not valid'\n                                }\n                            }\n                        }\n                    }\n                }\n\n                Describe \"Agent Alerts\" -Tags AgentAlert, $filename {\n                    $severity = Get-DbcConfigValue agent.alert.Severity\n                    $messageid = Get-DbcConfigValue agent.alert.messageid\n                    $AgentAlertJob = Get-DbcConfigValue agent.alert.Job\n                    $AgentAlertNotification = Get-DbcConfigValue agent.alert.Notification\n                    $skip = Get-DbcConfigValue skip.agent.alert\n                    if ($NotContactable -contains $psitem) {\n                        Context \"Testing Agent Alerts Severity exists on $psitem\" {\n                            It \"Can't Connect to $Psitem\" {\n                                $false | Should -BeTrue -Because 'The instance should be available to be connected to!'\n                            }\n                        }\n                        Context \"Testing Agent Alerts MessageID exists on $psitem\" {\n                            It \"Can't Connect to $Psitem\" {\n                                $false | Should -BeTrue -Because 'The instance should be available to be connected to!'\n                            }\n                        }\n                    } else {\n                        $alerts = Get-DbaAgentAlert -SqlInstance $psitem\n                        Context \"Testing Agent Alerts Severity exists on $psitem\" {\n                            ForEach ($sev in $severity) {\n                                It \"Severity $sev Alert should exist on $psitem\" -Skip:$skip {\n                                    ($alerts.Where{ $psitem.Severity -eq $sev }) | Should -Be $true -Because 'Recommended Agent Alerts to exists http://blog.extreme-advice.com/2013/01/29/list-of-errors-and-severity-level-in-sql-server-with-catalog-view-sysmessages/'\n                                }\n                                It \"Severity $sev Alert should be enabled on $psitem\" -Skip:$skip {\n                                    ($alerts.Where{ $psitem.Severity -eq $sev }).IsEnabled | Should -Be $true -Because 'Configured alerts should be enabled'\n                                }\n                                if ($AgentAlertJob) {\n                                    It \"A job name for Severity $sev Alert on $psitem\" -Skip:$skip {\n                                        ($alerts.Where{ $psitem.Severity -eq $sev }).jobname -ne $null | Should -Be $true -Because 'Should notify by SQL Agent Job'\n                                    }\n                                }\n                                if ($AgentAlertNotification) {\n                                    It \"Severity $sev Alert should have a notification on $psitem\" -Skip:$skip {\n                                        ($alerts.Where{ $psitem.Severity -eq $sev }).HasNotification -in 1, 2, 3, 4, 5, 6, 7 | Should -Be $true -Because 'Should notify by Agent notifications'\n                                    }\n                                }\n                            }\n                        }\n                        Context \"Testing Agent Alerts MessageID exists on $psitem\" {\n                            ForEach ($mid in $messageid) {\n                                It \"Message_ID $mid Alert should exist on $psitem\" -Skip:$skip {\n                                    ($alerts.Where{ $psitem.messageid -eq $mid }) | Should -Be $true -Because 'Recommended Agent Alerts to exists http://blog.extreme-advice.com/2013/01/29/list-of-errors-and-severity-level-in-sql-server-with-catalog-view-sysmessages/'\n                                }\n                                It \"Message_ID $mid Alert should be enabled on $psitem\" -Skip:$skip {\n                                    ($alerts.Where{ $psitem.messageid -eq $mid }) | Should -Be $true -Because 'Configured alerts should be enabled'\n                                }\n                                if ($AgentAlertJob) {\n                                    It \"A Job name for Message_ID $mid Alert should be on $psitem\" -Skip:$skip {\n                                        ($alerts.Where{ $psitem.messageid -eq $mid }).jobname -ne $null | Should -Be $true -Because 'Should notify by SQL Agent Job'\n                                    }\n                                }\n                                if ($AgentAlertNotification) {\n                                    It \"Message_ID $mid Alert should have a notification on $psitem\" -Skip:$skip {\n                                        ($alerts.Where{ $psitem.messageid -eq $mid }).HasNotification -in 1, 2, 3, 4, 5, 6, 7 | Should -Be $true -Because 'Should notify by Agent notifications'\n                                    }\n                                }\n                            }\n                        }\n                    }\n                }\n\n                Describe \"Job History Configuration\" -Tags JobHistory, $filename {\n                    if ($NotContactable -contains $psitem) {\n                        Context \"Testing job history configuration on $psitem\" {\n                            It \"Can't Connect to $Psitem\" {\n                                $false | Should -BeTrue -Because 'The instance should be available to be connected to!'\n                            }\n                        }\n                    } else {\n                        Context \"Testing job history configuration on $psitem\" {\n                            [int]$minimumJobHistoryRows = Get-DbcConfigValue agent.history.maximumhistoryrows\n                            [int]$minimumJobHistoryRowsPerJob = Get-DbcConfigValue agent.history.maximumjobhistoryrows\n\n                            $AgentServer = Get-DbaAgentServer -SqlInstance $psitem -EnableException:$false\n\n                            if ($minimumJobHistoryRows -eq -1) {\n                                It \"The maximum job history configuration should be set to disabled on $psitem\" {\n                                    Assert-JobHistoryRowsDisabled -AgentServer $AgentServer -minimumJobHistoryRows $minimumJobHistoryRows\n                                }\n                            } else {\n                                It \"The maximum job history number of rows configuration should be greater or equal to $minimumJobHistoryRows on $psitem\" {\n                                    Assert-JobHistoryRows -AgentServer $AgentServer -minimumJobHistoryRows $minimumJobHistoryRows\n                                }\n                                It \"The maximum job history rows per job configuration should be greater or equal to $minimumJobHistoryRowsPerJob on $psitem\" {\n                                    Assert-JobHistoryRowsPerJob -AgentServer $AgentServer -minimumJobHistoryRowsPerJob $minimumJobHistoryRowsPerJob\n                                }\n                            }\n                        }\n                    }\n                }\n                Describe \"Long Running Agent Jobs\" -Tags LongRunningJob, $filename {\n                    $skip = Get-DbcConfigValue skip.agent.longrunningjobs\n                    $runningjobpercentage = Get-DbcConfigValue agent.longrunningjob.percentage\n                    if (-not $skip) {\n                        $query = \"SELECT\n        JobName,\n        AvgSec,\n        start_execution_date as StartDate,\n        RunningSeconds,\n        RunningSeconds - AvgSec AS Diff\n        FROM\n        (\n        SELECT\n         j.name AS JobName,\n         start_execution_date,\n         AVG(DATEDIFF(SECOND, 0, STUFF(STUFF(RIGHT('000000'\n            + CONVERT(VARCHAR(6),jh.run_duration),6),5,0,':'),3,0,':'))) AS AvgSec,\n            ja.start_execution_date as startdate,\n        DATEDIFF(second, ja.start_execution_date, GetDate()) AS RunningSeconds\n        FROM msdb.dbo.sysjobactivity ja\n        JOIN msdb.dbo.sysjobs j\n        ON ja.job_id = j.job_id\n        JOIN msdb.dbo.sysjobhistory jh\n        ON jh.job_id = j.job_id\n        WHERE start_execution_date is not null\n        AND stop_execution_date is null\n        AND run_duration < 235959\n        AND run_duration >= 0\n        AND ja.start_execution_date > DATEADD(day,-1,GETDATE())\n        GROUP BY j.name,j.job_id,start_execution_date,stop_execution_date,ja.job_id\n        ) AS t\n        ORDER BY JobName;\"\n                        $runningjobs = Invoke-DbaQuery -SqlInstance $PSItem -Database msdb -Query $query\n                    }\n                    if ($NotContactable -contains $psitem) {\n                        Context \"Testing long running jobs on $psitem\" {\n                            It \"Can't Connect to $Psitem\" {\n                                $false | Should -BeTrue -Because 'The instance should be available to be connected to!'\n                            }\n                        }\n                    } else {\n                        Context \"Testing long running jobs on $psitem\" {\n                            if ($runningjobs) {\n                                foreach ($runningjob in $runningjobs | Where-Object { $_.AvgSec -ne 0 }) {\n                                    It \"Running job $($runningjob.JobName) duration should not be more than $runningjobpercentage % extra of the average run time on $psitem\" -Skip:$skip {\n                                        Assert-LongRunningJobs -runningjob $runningjob -runningjobpercentage $runningjobpercentage\n                                    }\n                                }\n                            } else {\n                                It \"There are no running jobs currently on $psitem\" -Skip:$skip {\n                                    $True | Should -BeTrue\n                                }\n                            }\n                        }\n                    }\n                }\n                Describe \"Last Agent Job Run\" -Tags LastJobRunTime, $filename {\n                    $skip = Get-DbcConfigValue skip.agent.lastjobruntime\n                    $runningjobpercentage = Get-DbcConfigValue agent.lastjobruntime.percentage\n                    $maxdays = Get-DbcConfigValue agent.failedjob.since\n                    if (-not $skip) {\n                        $query = \"IF OBJECT_ID('tempdb..#dbachecksLastRunTime') IS NOT NULL DROP Table #dbachecksLastRunTime\n                        SELECT * INTO #dbachecksLastRunTime\n                        FROM\n                        (\n                        SELECT\n                        j.job_id,\n                        j.name AS JobName,\n                        DATEDIFF(SECOND, 0, STUFF(STUFF(RIGHT('000000' + CONVERT(VARCHAR(6),jh.run_duration),6),5,0,':'),3,0,':')) AS Duration\n                        FROM msdb.dbo.sysjobs j\n                        INNER JOIN\n                            (\n                                SELECT job_id, instance_id = MAX(instance_id)\n                                    FROM msdb.dbo.sysjobhistory\n                                    GROUP BY job_id\n                            ) AS h\n                            ON j.job_id = h.job_id\n                        INNER JOIN\n                            msdb.dbo.sysjobhistory AS jh\n                            ON jh.job_id = h.job_id\n                            AND jh.instance_id = h.instance_id\n                            WHERE msdb.dbo.agent_datetime(jh.run_date, jh.run_time) > DATEADD(DAY,- $maxdays,GETDATE())\n                            AND jh.step_id = 0\n                        ) AS lrt\n\n                        IF OBJECT_ID('tempdb..#dbachecksAverageRunTime') IS NOT NULL DROP Table #dbachecksAverageRunTime\n                        SELECT * INTO #dbachecksAverageRunTime\n                        FROM\n                        (\n                        SELECT\n                        job_id,\n                        AVG(DATEDIFF(SECOND, 0, STUFF(STUFF(RIGHT('000000' + CONVERT(VARCHAR(6),run_duration),6),5,0,':'),3,0,':'))) AS AvgSec\n                        FROM msdb.dbo.sysjobhistory hist\n                        WHERE msdb.dbo.agent_datetime(run_date, run_time) > DATEADD(DAY,- $maxdays,GETDATE())\n                        AND Step_id = 0\n                        AND run_duration >= 0\n                        GROUP BY job_id\n                        ) as art\n\n                        SELECT\n                        JobName,\n                        Duration,\n                        AvgSec,\n                        Duration - AvgSec AS Diff\n                        FROM #dbachecksLastRunTime lastrun\n                        JOIN #dbachecksAverageRunTime avgrun\n                        ON lastrun.job_id = avgrun.job_id\n\n                        DROP Table #dbachecksLastRunTime\n                        DROP Table #dbachecksAverageRunTime\"\n                        $lastagentjobruns = Invoke-DbaQuery -SqlInstance $PSItem -Database msdb -Query $query\n                        Context \"Testing last job run time on $psitem\" {\n                            foreach ($lastagentjobrun in $lastagentjobruns | Where-Object { $_.AvgSec -ne 0 }) {\n                                It \"Job $($lastagentjobrun.JobName) last run duration should be not be greater than $runningjobpercentage % extra of the average run time on $psitem\" -Skip:$skip {\n                                    Assert-LastJobRun -lastagentjobrun $lastagentjobrun -runningjobpercentage $runningjobpercentage\n                                }\n                            }\n                        }\n                    } else {\n                        Context \"Testing last job run time on $psitem\" {\n                            It \"Job average run time on $psitem\" -Skip {\n                                Assert-LastJobRun -lastagentjobrun $lastagentjobrun -runningjobpercentage $runningjobpercentage\n                            }\n                        }\n                    }\n                }\n            }\n        }\n    }\n}"
  },
  {
    "path": "source/checks/Agentv5.Tests.ps1",
    "content": "# So the v5 files need to be handled differently.\n# We will start with a BeforeDiscovery which will gather the Instance Information up front\n# Gather the instances we know are not contactable\n\nBeforeDiscovery {\n    # Gather the instances we know are not contactable\n    [string[]]$NotContactable = (Get-PSFConfig -Module dbachecks -Name global.notcontactable).Value\n    # Get all the tags in use in this run\n    $Tags = Get-CheckInformation -Check $Check -Group Agent -AllChecks $AllChecks -ExcludeCheck $ChecksToExclude\n\n    $InstancesToTest = @(Get-Instance).ForEach{\n        # just add it to the Not Contactable list\n        if ($NotContactable -notcontains $psitem) {\n            $Instance = $psitem\n            try {\n                $InstanceSMO = Connect-DbaInstance -SqlInstance $Instance -ErrorAction SilentlyContinue -ErrorVariable errorvar\n            }\n            catch {\n                $NotContactable += $Instance\n            }\n            if ($NotContactable -notcontains $psitem) {\n                if ($null -eq $InstanceSMO.version) {\n                    $NotContactable += $Instance\n                }\n                # ToDo: Give cool message about Agent not existing on Express Edition?!\n                elseif (($InstanceSMO).Edition -like \"Express Edition*\") {}\n                else {\n                    # Get the relevant information for the checks in one go to save repeated trips to the instance and set values for Not Contactable tests if required\n                    Get-AllAgentInfo -Instance $InstanceSMO -Tags $Tags\n                }\n            }\n        }\n    }\n\n    #TODO : Clean this up\n    Write-PSFMessage -Message \"Instances = $($InstancesToTest.Name)\" -Level Verbose\n\n    Set-PSFConfig -Module dbachecks -Name global.notcontactable -Value $NotContactable\n\n    # Get-DbcConfig is expensive so we call it once\n    $__dbcconfig = Get-DbcConfig\n}\n\nDescribe \"Database Mail XPs\" -Tag DatabaseMailEnabled, CIS, security, Agent -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.agent.databasemailenabled' }).Value\n    Context \"Testing Database Mail XPs on <_.Name>\" {\n        It \"Testing Database Mail XPs is set to <_.ConfigValues.DatabaseMailEnabled> on <_.Name>\" -Skip:$skip {\n            $PSItem.DatabaseMailEnabled | Should -Be $PSItem.ConfigValues.DatabaseMailEnabled -Because 'The Database Mail XPs setting should be set correctly'\n        }\n    }\n}\n\nDescribe \"SQL Agent Account\" -Tag AgentServiceAccount, ServiceAccount, Agent -ForEach $InstancesToTest {\n    $skipServiceState = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.agent.servicestate' }).Value\n    $skipServiceStartMode = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.agent.servicestartmode' }).Value\n\n    Context \"Testing SQL Agent is running on <_.Name>\" {\n        It \"SQL Agent should be running for <_.InstanceName> on <_.Name>\" -Skip:$skipServiceState {\n            $PSItem.Agent.State | Should -Be \"Running\" -Because 'The agent service is required to run SQL Agent jobs'\n        }\n    }\n    if ($PSItem.IsClustered) {\n        It \"SQL Agent service should have a start mode of Manual for FailOver Clustered Instance <_.InstanceName> on <_.Name>\" -Skip:$skipServiceStartMode {\n            $PSItem.Agent.StartMode | Should -Be \"Manual\" -Because 'Clustered Instances required that the Agent service is set to manual'\n        }\n    }\n    else {\n        It \"SQL Agent service should have a start mode of Automatic for standalone instance <_.InstanceName> on <_.Name>\" -Skip:$skipServiceStartMode {\n            $PSItem.Agent.StartMode | Should -Be \"Automatic\" -Because 'Otherwise the Agent Jobs wont run if the server is restarted'\n        }\n    }\n}\n\nDescribe \"DBA Operator\" -Tag DbaOperator, Operator, Agent -ForEach $InstancesToTest {\n    $skipOperatorName = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.agent.dbaoperatorname' }).Value\n    $skipOperatorEmail = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.agent.dbaoperatoremail' }).Value\n\n    Context \"Testing DBA Operators exists on <_.Name>\" {\n        It \"The Operator <_.ExpectedOperatorName> exists on <_.Name>\" -Skip:$skipOperatorName -ForEach ($PSItem.Operator | Where-Object ExpectedOperatorName -NE 'null') {\n            $PSItem.ExpectedOperatorName | Should -BeIn $PSItem.ActualOperatorName -Because 'This Operator is expected to exist'\n        }\n\n        It \"The Operator email <_.ExpectedOperatorEmail> is correct on <_.Name>\" -Skip:$skipOperatorEmail -ForEach ($PSItem.Operator | Where-Object ExpectedOperatorEmail -NE 'null') {\n            $PSItem.ExpectedOperatorEmail | Should -BeIn $PSItem.ActualOperatorEmail -Because 'This operator email is expected to exist'\n        }\n    }\n}\n\nDescribe \"Failsafe operator\" -Tag FailsafeOperator, Operator, Agent -ForEach $InstancesToTest {\n    $skipFailsafeOperator = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.agent.failsafeoperator' }).Value\n\n    Context \"Testing failsafe operator exists on <_.Name>\" {\n        It \"The failsafe operator <_.FailSafeOperator.ExpectedFailSafeOperator> exists on <_.Name>\" -Skip:$skipFailsafeOperator {\n            $PSItem.FailSafeOperator.ActualFailSafeOperator | Should -Be $PSItem.FailSafeOperator.ExpectedFailSafeOperator -Because 'The failsafe operator will ensure that any job failures will be notified to someone if not set explicitly'\n        }\n    }\n}\n\nDescribe \"Database Mail Profile\" -Tag DatabaseMailProfile, Agent -ForEach $InstancesToTest {\n    $skipDatabaseMailProfile = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.agent.databasemailprofile' }).Value\n\n    Context \"Testing Database Mail Profile exists on <_.Name>\" {\n        It \"The Database Mail profile <_.DatabaseMailProfile.ExpectedDatabaseMailProfile> exists on <_.Name>\" -Skip:$skipDatabaseMailProfile { #-ForEach ($PSItem.DatabaseMailProfile | Where-Object ExpectedDatabaseMailProfile -NE 'null') {\n            $PSItem.DatabaseMailProfile.ActualDatabaseMailProfile | Should -BeIn $PSItem.DatabaseMailProfile.ExpectedDatabaseMailProfile -Because 'The database mail profile is required to send emails'\n        }\n    }\n}\n\nDescribe \"Agent Mail Profile\" -Tag AgentMailProfile, Agent -ForEach $InstancesToTest {\n    $skipAgentMailProfile = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.agent.mailprofile' }).Value\n\n    Context \"Testing SQL Agent Alert System database mail profile is set on <_.Name>\" {\n        It \"The SQL Server Agent Alert System has the mail profile <_.AgentMailProfile.ExpectedAgentMailProfile> enabled as profile on <_.Name>.\" -Skip:$skipAgentMailProfile { #-ForEach ($PSItem.DatabaseMailProfile | Where-Object ExpectedDatabaseMailProfile -NE 'null') {\n            $PSItem.AgentMailProfile.ActualAgentMailProfile | Should -Be $PSItem.AgentMailProfile.ExpectedAgentMailProfile -Because 'The SQL Agent Alert System needs an enabled database mail profile to send alert emails'\n        }\n    }\n}\n\nDescribe \"Valid Job Owner\" -Tag ValidJobOwner, Agent -ForEach $InstancesToTest {\n    $skipAgentJobTargetOwner = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.agent.jobowner' }).Value\n\n    Context \"Testing SQL Agent Job Owner on <_.Name>\" {\n        It \"The Job <_.JobName> has the Job Owner <_.ActualJobOwnerName> that should exist in this list ($([String]::Join(', ', \"<_.ExpectedJobOwnerName>\"))) on <_.InstanceName>\" -Skip:$skipAgentJobTargetOwner -ForEach ($PSItem.JobOwner) {\n            $PSItem.ActualJobOwnerName | Should -BeIn $PSItem.ExpectedJobOwnerName -Because 'The account that is the job owner is not what was expected'\n        }\n    }\n}\n\n\nDescribe \"Invalid Job Owner\" -Tag InvalidJobOwner, Agent -ForEach $InstancesToTest {\n    $skipAgentJobTargetInvalidOwner = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.agent.invalidjobowner.name' }).Value\n\n    Context \"Testing Invalid SQL Agent Job Owner on <_.Name>\" {\n        It \"The Job <_.JobName> has the Job Owner <_.ActualJobOwnerName> that shouldn't exist in this list ($([String]::Join(', ', \"<_.InvalidJobOwnerName>\"))) on <_.InstanceName>\" -Skip:$skipAgentJobTargetInvalidOwner -ForEach ($PSItem.InvalidJobOwner) {\n            $PSItem.ActualJobOwnerName | Should -Not -BeIn $PSItem.InvalidJobOwnerName -Because 'The account that is the job owner has been defined as not valid'\n        }\n    }\n}\n\n\nDescribe \"Last Agent Job Run\" -Tag LastJobRunTime, Agent -ForEach $InstancesToTest {\n    $skipAgentJobLastRun = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.agent.lastjobruntime' }).Value\n\n    Context \"Testing last job run time on <_.Name>\" {\n        It \"Job <_.JobName> last run duration (<_.Duration> seconds) should not be greater than <_.ExpectedRunningJobPercentage>% extra of the average run time (<_.Average> seconds) on <_.InstanceName>\" -Skip:$skipAgentJobLastRun -ForEach ($PSItem.LastJobRuns) {\n            $PSItem.ActualRunningJobPercentage | Should -BeLessThan $PSItem.ExpectedRunningJobPercentage -Because \"The last run of job $($PSItem.JobName) was $($PSItem.Duration) seconds. This is more than the $($PSItem.ExpectedRunningJobPercentage)% specified as the maximum variance\"\n        }\n    }\n}\n\n\nDescribe \"Long Running Agent Jobs\" -Tag LongRunningJob, Agent -ForEach $InstancesToTest {\n    $skipAgentLongRunningJobs = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.agent.longrunningjobs' }).Value\n\n    Context \"Testing long running jobs on <_.Name>\" {\n        It \"Running job <_.JobName> duration should not be more than <_.ExpectedLongRunningJobPercentage>% extra of the average run time (<_.Average> seconds) on <_.InstanceName>\" -Skip:$skipAgentLongRunningJobs -ForEach ($PSItem.LongRunningJobs) {\n            $PSItem.ActualLongRunningJobPercentage | Should -BeLessThan $PSItem.ExpectedLongRunningJobPercentage -Because \"The current running job $($PSItem.JobName) has been running for $($PSItem.Diff) seconds longer than the average run time. This is more than the $($PSItem.ExpectedLongRunningJobPercentage)% specified as the maximum\"\n        }\n    }\n}\n\n\nDescribe \"SQL Agent Failed Jobs\" -Tag FailedJob, Agent -ForEach $InstancesToTest {\n    $skipAgentFailedJobs = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.agent.failedjobs' }).Value\n    $excludecancelled = ($__dbcconfig | Where-Object { $_.Name -eq 'agent.failedjob.excludecancelled' }).Value\n\n    Context \"Checking for failed enabled jobs since on <_.Name>\" {\n        if (-not $skipAgentFailedJobs) {\n            It \"We chose to skip this as <_.JobName>'s last run outcome is unknown on <_.InstanceName>\" -Skip -ForEach ($PSItem.JobsFailed | Where-Object { $_.LastRunOutcome -eq \"Unknown\" }) {\n                $PSItem.LastRunOutcome | Should -Be $PSItem.ExpectedOutcome -Because 'All Agent Jobs should have succeed this one is unknown - you need to investigate the failed jobs'\n            }\n            It \"You chose to skip this as <_.JobName>'s last run outcome is cancelled on <_.InstanceName>\" -Skip -ForEach ($PSItem.JobsFailed | Where-Object { $_.LastRunOutcome -eq \"Cancelled\" -and ($excludecancelled -eq $true) }) {\n                $PSItem.LastRunOutcome | Should -Be $PSItem.ExpectedOutcome -Because 'All Agent Jobs should have succeed this one is Cancelled - you need to investigate the failed jobs'\n            }\n        }\n        It \"Job <_.JobName> last run outcome is <_.LastRunOutcome> on <_.InstanceName>\" -Skip:$skipAgentFailedJobs -ForEach ($PSItem.JobsFailed | Where-Object { $_.LastRunOutcome -notin (\"Cancelled\", \"Unknown\") }) {\n            $PSItem.LastRunOutcome | Should -Be $PSItem.ExpectedOutcome -Because \"All Agent Jobs should have succeed - you need to investigate the failed jobs\"\n        }\n    }\n}\n\n\n\nDescribe \"Agent Alerts\" -Tag AgentAlert, Agent -ForEach $InstancesToTest {\n    $skipAgentAlerts = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.agent.alert' }).Value\n    $AgentAlertJob = ($__dbcconfig | Where-Object { $_.Name -eq 'agent.alert.Job' }).Value\n    $AgentAlertNotification = ($__dbcconfig | Where-Object { $_.Name -eq 'agent.alert.Notification' }).Value\n\n    Context \"Testing Agent Alerts Severity exists on <_.Name>\" {\n        It \"Severity <_.AgentAlertSeverity> Alert should exist on <_.InstanceName>\" -Skip:$skipAgentAlerts -ForEach ($PSItem.AgentAlerts.Severities) { #| Where-Object { $_.Severity -NE $null }) {\n            $PSItem.Severity | Should -Be $PSItem.AgentAlertSeverity -Because \"Recommended Agent Alerts to exists http://blog.extreme-advice.com/2013/01/29/list-of-errors-and-severity-level-in-sql-server-with-catalog-view-sysmessages/\"\n        }\n\n        It \"Severity <_.AgentAlertSeverity> Alert should be enabled on <_.InstanceName>\" -Skip:$skipAgentAlerts -ForEach ($PSItem.AgentAlerts.Severities) {\n            $PSItem.IsEnabled | Should -Be $true -Because \"Configured alerts should be enabled\"\n        }\n        if ($AgentAlertJob) {\n            It \"A job name for Severity <_.AgentAlertSeverity> Alert on <_.InstanceName>\" -Skip:$skipAgentAlerts -ForEach ($PSItem.AgentAlerts.Severities) {\n                $PSItem.JobName -ne $null | Should -Be $true -Because \"Should notify by SQL Agent Job\"\n            }\n        }\n        if ($AgentAlertNotification) {\n            It \"Severity <_.AgentAlertSeverity> Alert should have a notification on <_.InstanceName>\" -Skip:$skipAgentAlerts -ForEach ($PSItem.AgentAlerts.Severities) {\n                $PSItem.HasNotification -in 1, 2, 3, 4, 5, 6, 7 | Should -Be $true -Because \"Should notify by Agent notifications\"\n            }\n        }\n\n    }\n\n    Context \"Testing Agent Alerts MessageID exists on <_.Name>\" {\n        It \"MessageID <_.AgentMessageID> Alert should exist on <_.InstanceName>\" -Skip:$skipAgentAlerts -ForEach ($PSItem.AgentAlerts.MessageIDs) {\n            $PSItem.MessageID | Should -Be $PSItem.AgentMessageID -Because \"Recommended Agent Alerts to exists http://blog.extreme-advice.com/2013/01/29/list-of-errors-and-severity-level-in-sql-server-with-catalog-view-sysmessages/\"\n        }\n        It \"MessageID <_.AgentMessageID> Alert should be enabled on <_.InstanceName>\" -Skip:$skipAgentAlerts -ForEach ($PSItem.AgentAlerts.MessageIDs) {\n            $PSItem.IsEnabled | Should -Be $true -Because \"Configured alerts should be enabled\"\n        }\n        if ($AgentAlertJob) {\n            It \"A job name for MessageID <_.AgentMessageID> on <_.InstanceName>\" -Skip:$skipAgentAlerts -ForEach ($PSItem.AgentAlerts.MessageIDs) {\n                $PSItem.JobName -ne $null | Should -Be $true -Because \"Should notify by SQL Agent Job\"\n            }\n        }\n        if ($AgentAlertNotification) {\n            It \"MessageID <_.AgentMessageID> Alert should have a notification on <_.InstanceName>\" -Skip:$skipAgentAlerts -ForEach ($PSItem.AgentAlerts.MessageIDs) {\n                $PSItem.HasNotification -in 1, 2, 3, 4, 5, 6, 7 | Should -Be $true -Because \"Should notify by Agent notifications\"\n            }\n        }\n    }\n}\n\nDescribe \"Job History Configuration\" -Tag JobHistory, Agent -ForEach $InstancesToTest {\n    $skipAgentJobHistory = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.agent.JobHistory' }).Value\n    [int]$minimumJobHistoryRows = ($__dbcconfig | Where-Object { $_.Name -eq 'agent.history.maximumhistoryrows' }).Value\n\n    if ($minimumJobHistoryRows -eq -1) {\n        It \"The maximum job history configuration should be set to disabled on <_.InstanceName>\" -Skip:$skipAgentJobHistory -ForEach ($PSItem.JobHistory) {\n            $PSItem.CurrentMaximumHistoryRows | Should -Be $PSItem.ExpectedMaximumHistoryRows -Because \"Maximum job history configuration should be disabled\"\n        }\n    } else {\n        It \"The maximum job history number of rows configuration should be greater or equal to <_.ExpectedMaximumHistoryRows> on <_.InstanceName>\" -Skip:$skipAgentJobHistory -ForEach ($PSItem.JobHistory) {\n            $PSItem.CurrentMaximumHistoryRows | Should -BeGreaterOrEqual $PSItem.ExpectedMaximumHistoryRows -Because \"We expect the maximum job history row configuration to be greater than the configured setting <_.ExpectedMaximumHistoryRows>\"\n        }\n        It \"The maximum job history rows per job configuration should be greater or equal to <_.ExpectedMaximumJobHistoryRows> on <_.InstanceName>\" -Skip:$skipAgentJobHistory -ForEach ($PSItem.JobHistory) {\n            $PSItem.CurrentMaximumJobHistoryRows | Should -BeGreaterOrEqual $PSItem.ExpectedMaximumJobHistoryRows -Because \"We expect the maximum job history row configuration per agent job to be greater than the configured setting <_.ExpectedMaximumJobHistoryRows>\"\n        }\n    }\n}"
  },
  {
    "path": "source/checks/Database.Tests.ps1",
    "content": "$filename = $MyInvocation.MyCommand.Name.Replace(\".Tests.ps1\", \"\")\n. $PSScriptRoot/../internal/assertions/Database.Assertions.ps1\n\n\n[array]$ExcludedDatabases = Get-DbcConfigValue command.invokedbccheck.excludedatabases\n$ExcludedDatabases += $ExcludeDatabase\n[string[]]$NotContactable = (Get-PSFConfig -Module dbachecks -Name global.notcontactable).Value\n\n@(Get-Instance).ForEach{\n    if ($NotContactable -notcontains $psitem) {\n        $Instance = $psitem\n        try {\n            $InstanceSMO = Connect-DbaInstance  -SqlInstance $Instance -ErrorAction SilentlyContinue -ErrorVariable errorvar\n        }\n        catch {\n            $NotContactable += $Instance\n        }\n        if ($NotContactable -notcontains $psitem) {\n            if ($null -eq $InstanceSMO.version) {\n                $NotContactable += $Instance\n            }\n            else {\n                $Version = $InstanceSMO.VersionMajor\n            }\n        }\n    }\n\n    Set-PSFConfig -Module dbachecks -Name global.notcontactable -Value $NotContactable\n\n    Describe \"Database Collation\" -Tags DatabaseCollation, High, $filename {\n        $Wrongcollation = Get-DbcConfigValue policy.database.wrongcollation\n        $exclude = \"ReportingServer\", \"ReportingServerTempDB\"\n        $exclude += $Wrongcollation\n        $exclude += $ExcludedDatabases\n\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing database collation on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            Context \"Testing database collation on $psitem\" {\n                @(Test-DbaDbCollation -SqlInstance $psitem -Database $Database -ExcludeDatabase $exclude).ForEach{\n                    It \"Database $($psitem.Database) collation ($($psitem.DatabaseCollation)) should match server collation ($($psitem.ServerCollation)) on $($psitem.SqlInstance)\" {\n                        $psitem.ServerCollation | Should -Be $psitem.DatabaseCollation -Because \"You will get collation conflict errors in tempdb\"\n                    }\n                }\n                if ($Wrongcollation) {\n                    @(Test-DbaDbCollation -SqlInstance $psitem -Database $Wrongcollation ).ForEach{\n                        It \"Database $($psitem.Database) collation ($($psitem.DatabaseCollation)) should not match server collation ($($psitem.ServerCollation)) on $($psitem.SqlInstance)\" {\n                            $psitem.ServerCollation | Should -Not -Be $psitem.DatabaseCollation -Because \"You have defined the database to have another collation then the server. You will get collation conflict errors in tempdb\"\n                        }\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Suspect Page\" -Tags SuspectPage, High, $filename {\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing suspect pages on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            Context \"Testing suspect pages on $psitem\" {\n                $InstanceSMO.Databases.Where{ if ($Database) { $_.Name -in $Database }else { $ExcludedDatabases -notcontains $PsItem.Name } }.ForEach{\n                    $results = Get-DbaSuspectPage -SqlInstance $psitem.Parent -Database $psitem.Name\n                    It \"Database $($psitem.Name) should return 0 suspect pages on $($psitem.Parent.Name)\" {\n                        @($results).Count | Should -Be 0 -Because \"You do not want suspect pages\"\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Last Backup Restore Test\" -Tags TestLastBackup, Backup, $filename {\n        if (-not (Get-DbcConfigValue skip.backup.testing)) {\n            $destserver = Get-DbcConfigValue policy.backup.testserver\n            $destdata = Get-DbcConfigValue policy.backup.datadir\n            $destlog = Get-DbcConfigValue policy.backup.logdir\n            if ($NotContactable -contains $psitem) {\n                Context \"Testing Backup Restore & Integrity Checks on $psitem\" {\n                    It \"Can't Connect to $Psitem\" {\n                        $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                    }\n                }\n            }\n            else {\n                if (-not $destserver) {\n                    $destserver = $psitem\n                }\n                Context \"Testing Backup Restore & Integrity Checks on $psitem\" {\n                    $srv = Connect-DbaInstance -SqlInstance $psitem\n                    $dbs = ($srv.Databases.Where{ $_.CreateDate.ToUniversalTime() -lt (Get-Date).ToUniversalTime().AddHours( - $graceperiod) -and $(if ($Database) { $_.Name -in $Database }else { $ExcludedDatabases -notcontains $PsItem.Name }) }).Name\n                    if (-not ($destdata)) { $destdata -eq $srv.DefaultFile }\n                    if (-not ($destlog)) { $destlog -eq $srv.DefaultLog }\n                    @(Test-DbaLastBackup -SqlInstance $psitem -Database $dbs -Destination $destserver -DataDirectory $destdata -LogDirectory $destlog -VerifyOnly).ForEach{ if ($psitem.DBCCResult -notmatch \"skipped for restored master\") {\n                            It \"Database $($psitem.Database) DBCC CheckDB should be success on $($psitem.SourceServer)\" {\n                                $psitem.DBCCResult | Should -Be \"Success\" -Because \"You need to run DBCC CHECKDB to ensure your database is consistent\"\n                            }\n                            It \"Database $($psitem.Database) restore should be success on $($psitem.SourceServer)\" {\n                                $psitem.RestoreResult | Should -Be \"Success\" -Because \"The backup file has not successfully restored - you have no backup\"\n                            }\n                        }\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Last Backup VerifyOnly\" -Tags TestLastBackupVerifyOnly, Backup, $filename {\n        $graceperiod = Get-DbcConfigValue policy.backup.newdbgraceperiod\n        if ($NotContactable -contains $psitem) {\n            Context \"VerifyOnly tests of last backups on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            Context \"VerifyOnly tests of last backups on $psitem\" {\n                $DatabasesToCheck = ($InstanceSMO.Databases.Where{ $_.IsAccessible -eq $true }.Where{ $_.CreateDate.ToUniversalTime() -lt (Get-Date).ToUniversalTime().AddHours( - $graceperiod) -and $(if ($Database) { $_.Name -in $Database }else { $ExcludedDatabases -notcontains $PsItem.Name }) }).Name\n                $BackUpVerify = $DatabasesToCheck.Foreach{\n                    $BackupVerifySplat = @{\n                        SqlInstance     = $InstanceSMO\n                        Database        = $psitem\n                        VerifyOnly      = $true\n                        EnableException = $true\n                    }\n                    try {\n                        Test-DbaLastBackup @BackupVerifySplat\n                    }\n                    catch {\n                        [pscustomobject]@{\n                            $psitem.RestoreResult = $_.Exception.Message\n                            $psitem.FileExists    = $_.Exception.Message\n                        }\n                    }\n                }\n                $BackUpVerify.ForEach{\n                    It \"Database $($psitem.Database) restore for Database should be success for $($psitem.SourceServer)\" {\n                        $psitem.RestoreResult | Should -Be \"Success\" -Because \"The restore file has not successfully verified - you have no backup\"\n                    }\n                    It \"Database $($psitem.Database) last backup file exists for $($psitem.SourceServer)\" {\n                        $psitem.FileExists | Should -BeTrue -Because \"Without a backup file you have no backup\"\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Valid Database Owner\" -Tags ValidDatabaseOwner, Medium, $filename {\n        [string[]]$targetowner = Get-DbcConfigValue policy.validdbowner.name\n        [string[]]$exclude = Get-DbcConfigValue policy.validdbowner.excludedb\n        $exclude += $ExcludedDatabases\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing Database Owners on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            Context \"Testing Database Owners on $psitem\" {\n                @($InstanceSMO.Databases.Where{ if ($database) { $_.Name -in $database }else { $_.Name -notin $exclude } }).ForEach{\n                    It \"Database $($psitem.Name) - owner $($psitem.Owner) should be in this list ( $( [String]::Join(\", \", $targetowner) ) ) on $($psitem.Parent.Name)\" {\n                        $psitem.Owner | Should -BeIn $TargetOwner -Because \"The account that is the database owner is not what was expected\"\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Invalid Database Owner\" -Tags InvalidDatabaseOwner, Medium, $filename {\n        [string[]]$targetowner = Get-DbcConfigValue policy.invaliddbowner.name\n        [string[]]$exclude = Get-DbcConfigValue policy.invaliddbowner.excludedb\n        $exclude += $ExcludedDatabases\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing Database Owners on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            Context \"Testing Database Owners on $psitem\" {\n                @($InstanceSMO.Databases.Where{ if ($database) { $_.Name -in $database }else { $_.Name -notin $exclude } }).ForEach{\n                    It \"Database $($psitem.Name) - owner $($psitem.Owner) should Not be in this list ( $( [String]::Join(\", \", $targetowner) ) ) on $($psitem.Parent.Name)\" {\n                        $psitem.Owner | Should -Not -BeIn $TargetOwner -Because \"The database owner was one specified as incorrect\"\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Last Good DBCC CHECKDB\" -Tags LastGoodCheckDb, Varied, $filename {\n        $maxdays = Get-DbcConfigValue policy.dbcc.maxdays\n        $datapurity = Get-DbcConfigValue skip.dbcc.datapuritycheck\n        $graceperiod = Get-DbcConfigValue policy.backup.newdbgraceperiod\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing Last Good DBCC CHECKDB on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            Context \"Testing Last Good DBCC CHECKDB on $psitem\" {\n                @(Get-DbaLastGoodCheckDb -SqlInstance $psitem -Database ($InstanceSMO.Databases.Where{ $_.CreateDate.ToUniversalTime() -lt (Get-Date).ToUniversalTime().AddHours( - $graceperiod) -and ($_.IsAccessible -eq $true) -and $(if ($database) { $psitem.name -in $Database }else { $ExcludedDatabases -notcontains $_.Name }) }).Name ).ForEach{\n                    if ($psitem.Database -ne \"tempdb\") {\n                        It \"Database $($psitem.Database) last good integrity check should be less than $maxdays days old on $($psitem.SqlInstance)\" {\n                            if ($psitem.LastGoodCheckDb) {\n                                $psitem.LastGoodCheckDb | Should -BeGreaterThan (Get-Date).ToUniversalTime().AddDays( - ($maxdays)) -Because \"You should have run a DBCC CheckDB inside that time\"\n                            }\n                            else {\n                                $psitem.LastGoodCheckDb | Should -BeGreaterThan (Get-Date).ToUniversalTime().AddDays( - ($maxdays)) -Because \"You should have run a DBCC CheckDB inside that time\"\n                            }\n                        }\n                        It -Skip:$datapurity \"Database $($psitem.Database) has Data Purity Enabled on $($psitem.SqlInstance)\" {\n                            $psitem.DataPurityEnabled | Should -BeTrue -Because \"the DATA_PURITY option causes the CHECKDB command to look for column values that are invalid or out of range.\"\n                        }\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Column Identity Usage\" -Tags IdentityUsage, Medium, $filename {\n        $maxpercentage = Get-DbcConfigValue policy.identity.usagepercent\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing Column Identity Usage on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            Context \"Testing Column Identity Usage on $psitem\" {\n                if ($version -lt 10) {\n                    It \"Database dbachecksskipped Testing Column Identity Usage on $Instance\" -Skip {\n                        Assert-DatabaseDuplicateIndex -Instance $instance -Database $psitem\n                    }\n                }\n                else {\n                    $exclude = $ExcludedDatabases\n                    $exclude += $InstanceSMO.Databases.Where{ $_.IsAccessible -eq $false }.Name\n                    @(Test-DbaIdentityUsage -SqlInstance $psitem -Database $Database -ExcludeDatabase $exclude).ForEach{\n                        if ($psitem.Database -ne \"tempdb\") {\n                            $columnfqdn = \"$($psitem.Database).$($psitem.Schema).$($psitem.Table).$($psitem.Column)\"\n                            It \"Database $($psitem.Database) - The usage for $columnfqdn should be less than $maxpercentage percent on $($psitem.SqlInstance)\" {\n                                $psitem.PercentUsed -lt $maxpercentage | Should -BeTrue -Because \"You do not want your Identity columns to hit the max value and stop inserts\"\n                            }\n                        }\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Recovery Model\" -Tags RecoveryModel, DISA, Medium, $filename {\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing Recovery Model on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            $recoverymodel = Get-DbcConfigValue policy.recoverymodel.type\n            Context \"Testing Recovery Model on $psitem\" {\n                $exclude = Get-DbcConfigValue policy.recoverymodel.excludedb\n                $exclude += $ExcludedDatabases\n                @(Get-DbaDbRecoveryModel -SqlInstance $psitem -Database $Database -ExcludeDatabase $exclude).ForEach{\n                    It \"Database $($psitem.Name) should be set to $recoverymodel on $($psitem.SqlInstance)\" {\n                        $psitem.RecoveryModel | Should -Be $recoverymodel -Because \"You expect this recovery model\"\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Duplicate Index\" -Tags DuplicateIndex, $filename {\n        $Excludeddbs = Get-DbcConfigValue policy.database.duplicateindexexcludedb\n        $Excludeddbs += $ExcludedDatabases\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing duplicate indexes on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            Context \"Testing duplicate indexes on $psitem\" {\n                if ($version -lt 10) {\n                    It \"Database dbachecksskipped should return 0 duplicate indexes on $Instance\" -Skip {\n                        Assert-DatabaseDuplicateIndex -Instance $instance -Database $psitem\n                    }\n                }\n                else {\n                    $instance = $Psitem\n                    @(Get-Database -Instance $instance -Requiredinfo Name -Exclusions NotAccessible -Database $Database -ExcludedDbs $Excludeddbs).ForEach{\n                        It \"Database $psitem should return 0 duplicate indexes on $Instance\" {\n                            Assert-DatabaseDuplicateIndex -Instance $instance -Database $psitem\n                        }\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Unused Index\" -Tags UnusedIndex, Medium, $filename {\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing Unused indexes on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            Context \"Testing Unused indexes on $psitem\" {\n                try {\n                    $Instance = $Psitem\n                    (Get-Database -Instance $Instance -RequiredInfo Name -Exclusions NotAccessible -Database $Database -ExcludedDbs $Excludeddbs).ForEach{\n                        $results = Find-DbaDbUnusedIndex -SqlInstance $psitem -Database $Database -ExcludeDatabase $ExcludedDatabases -EnableException\n                        It \"Database $psitem should return 0 Unused indexes on $($psitem.SQLInstance)\" {\n                            @($results).Count | Should -Be 0 -Because \"You should have indexes that are used\"\n                        }\n                    }\n                }\n                catch {\n                    It -Skip \"Database $psitem should return 0 Unused indexes on $($psitem.SQLInstance)\" {\n                        @($results).Count | Should -Be 0 -Because \"You should have indexes that are used\"\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Disabled Index\" -Tags DisabledIndex, Medium, $filename {\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing Disabled indexes on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            Context \"Testing Disabled indexes on $psitem\" {\n                $InstanceSMO.Databases.Where{ $(if ($Database) { $PsItem.Name -in $Database }else { $ExcludedDatabases -notcontains $PsItem.Name }) -and ($_.IsAccessible -eq $true) }.ForEach{\n                    $results = Find-DbaDbDisabledIndex -SqlInstance $psitem.Parent -Database $psitem.Name\n                    It \"Database $($psitem.Name) should return 0 Disabled indexes on $($psitem.Parent.Name)\" {\n                        @($results).Count | Should -Be 0 -Because \"Disabled indexes are wasting disk space\"\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Database Growth Event\" -Tags DatabaseGrowthEvent, Low, $filename {\n        $exclude = Get-DbcConfigValue policy.database.filegrowthexcludedb\n        $daystocheck = Get-DbcConfigValue policy.database.filegrowthdaystocheck\n        if ($null -eq $daystocheck) {\n            $datetocheckfrom = '0001-01-01'\n        }\n        else {\n            $datetocheckfrom = (Get-Date).ToUniversalTime().AddDays( - $daystocheck)\n        }\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing database growth event on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            Context \"Testing database growth event on $psitem\" {\n                $InstanceSMO.Databases.Where{ $(if ($Database) { $PsItem.Name -in $Database }else { $PSItem.Name -notin $exclude -and ($ExcludedDatabases -notcontains $PsItem.Name) }) }.ForEach{\n                    $results = @(Find-DbaDbGrowthEvent -SqlInstance $psitem.Parent -Database $psitem.Name).Where{ $_.StartTime -gt $datetocheckfrom }\n                    It \"Database $($psitem.Name) should return 0 database growth events on $($psitem.Parent.Name)\" {\n                        @($results).Count | Should -Be 0 -Because \"You want to control how your database files are grown\"\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Page Verify\" -Tags PageVerify, Medium, $filename {\n        $pageverify = Get-DbcConfigValue policy.pageverify\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing page verify on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            Context \"Testing page verify on $psitem\" {\n                switch ($version) {\n                    8 {\n                        It \"Database Page verify is not available on SQL 2000 on $psitem\" {\n                            $true | Should -BeTrue\n                        }\n                    }\n                    9 {\n                        $InstanceSMO.Databases.Where{ $(if ($Database) { $PsItem.Name -in $Database }else { $ExcludedDatabases -notcontains $PsItem.Name }) }.ForEach{\n                            if ($Psitem.Name -ne 'tempdb') {\n                                It \"Database $($psitem.Name) should have page verify set to $pageverify on $($psitem.Parent.Name)\" {\n                                    $psitem.PageVerify | Should -Be $pageverify -Because \"Page verify helps SQL Server to detect corruption\"\n                                }\n                            }\n                            else {\n                                It \"Database Page verify is not available on tempdb on SQL 2005 on $($psitem.Parent.Name)\" {\n                                    $true | Should -BeTrue\n                                }\n                            }\n                        }\n                    }\n                    Default {\n                        $InstanceSMO.Databases.Where{ $(if ($Database) { $PsItem.Name -in $Database }else { $ExcludedDatabases -notcontains $PsItem.Name }) }.ForEach{\n                            It \"Database $($psitem.Name) should have page verify set to $pageverify on $($psitem.Parent.Name)\" {\n                                $psitem.PageVerify | Should -Be $pageverify -Because \"Page verify helps SQL Server to detect corruption\"\n                            }\n                        }\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Auto Close\" -Tags AutoClose, High, $filename {\n        $autoclose = Get-DbcConfigValue policy.database.autoclose\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing Auto Close on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            Context \"Testing Auto Close on $psitem\" {\n                $InstanceSMO.Databases.Where{ $(if ($Database) { $PsItem.Name -in $Database }else { $ExcludedDatabases -notcontains $PsItem.Name }) }.ForEach{\n                    It \"Database $($psitem.Name) should have Auto Close set to $autoclose on $($psitem.Parent.Name)\" {\n                        $psitem.AutoClose | Should -Be $autoclose -Because \"Because!\"\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Auto Shrink\" -Tags AutoShrink, High, $filename {\n        $autoshrink = Get-DbcConfigValue policy.database.autoshrink\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing Auto Shrink on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            Context \"Testing Auto Shrink on $psitem\" {\n                $InstanceSMO.Databases.Where{ $(if ($Database) { $PsItem.Name -in $Database }else { $ExcludedDatabases -notcontains $PsItem.Name }) }.ForEach{\n                    It \"Database $($psitem.Name) should have Auto Shrink set to $autoshrink on $($psitem.Parent.Name)\" {\n                        $psitem.AutoShrink | Should -Be $autoshrink -Because \"Shrinking databases causes fragmentation and performance issues\"\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Last Full Backup Times\" -Tags LastFullBackup, LastBackup, Backup, DISA, Varied, $filename {\n        $maxfull = Get-DbcConfigValue policy.backup.fullmaxdays\n        $graceperiod = Get-DbcConfigValue policy.backup.newdbgraceperiod\n        $skipreadonly = Get-DbcConfigValue skip.backup.readonly\n        $skipsecondaries = Get-DbcConfigValue skip.backup.secondaries\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing last full backups on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            Context \"Testing last full backups on $psitem\" {\n                $InstanceSMO.Databases.Where{ ($psitem.Name -ne 'tempdb') -and $Psitem.CreateDate.ToUniversalTime() -lt (Get-Date).ToUniversalTime().AddHours( - $graceperiod) -and $(if ($Database) { $PsItem.Name -in $Database } else { $ExcludedDatabases -notcontains $PsItem.Name }) }.ForEach{\n                    if ($psitem.AvailabilityGroupName) {\n                        $agReplicaRole = $InstanceSMO.AvailabilityGroups[$psitem.AvailabilityGroupName].LocalReplicaRole\n                    }\n                    else {\n                        $agReplicaRole = $null\n                    }\n                    $skip = ($psitem.Status -match \"Offline\") -or ($psitem.IsAccessible -eq $false) -or ($psitem.Readonly -eq $true -and $skipreadonly -eq $true) -or ($agReplicaRole -eq 'Secondary' -and $skipsecondaries -eq $true)\n                    It -Skip:$skip \"Database $($psitem.Name) should have full backups less than $maxfull days old on $($psitem.Parent.Name)\" {\n                        $psitem.LastBackupDate.ToUniversalTime() | Should -BeGreaterThan (Get-Date).ToUniversalTime().AddDays( - ($maxfull)) -Because \"Taking regular backups is extraordinarily important\"\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Last Diff Backup Times\" -Tags LastDiffBackup, LastBackup, Backup, DISA, Varied, $filename {\n        if (-not (Get-DbcConfigValue skip.diffbackuptest)) {\n            $maxdiff = Get-DbcConfigValue policy.backup.diffmaxhours\n            $graceperiod = Get-DbcConfigValue policy.backup.newdbgraceperiod\n            $skipreadonly = Get-DbcConfigValue skip.backup.readonly\n            $skipsecondaries = Get-DbcConfigValue skip.backup.secondaries\n\n            if ($NotContactable -contains $psitem) {\n                Context \"Testing last diff backups on $psitem\" {\n                    It \"Can't Connect to $Psitem\" {\n                        $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                    }\n                }\n            }\n            else {\n                Context \"Testing last diff backups on $psitem\" {\n                    @($InstanceSMO.Databases.Where{ (-not $psitem.IsSystemObject) -and $Psitem.CreateDate.ToUniversalTime() -lt (Get-Date).ToUniversalTime().AddHours( - $graceperiod) -and $(if ($Database) { $PsItem.Name -in $Database }else { $ExcludedDatabases -notcontains $PsItem.Name }) }).ForEach{\n                        if ($psitem.AvailabilityGroupName) {\n                            $agReplicaRole = $InstanceSMO.AvailabilityGroups[$psitem.AvailabilityGroupName].LocalReplicaRole\n                        }\n                        else {\n                            $agReplicaRole = $null\n                        }\n                        $skip = ($psitem.Status -match \"Offline\") -or ($psitem.IsAccessible -eq $false) -or ($psitem.Readonly -eq $true -and $skipreadonly -eq $true) -or ($agReplicaRole -eq 'Secondary' -and $skipsecondaries -eq $true)\n                        It -Skip:$skip \"Database $($psitem.Name) diff backups should be less than $maxdiff hours old on $($psitem.Parent.Name)\" {\n                            ($psitem.LastBackupDate.ToUniversalTime(), $psitem.LastDifferentialBackupDate.ToUniversalTime() | Measure-Object -Max).Maximum | Should -BeGreaterThan (Get-Date).ToUniversalTime().AddHours( - ($maxdiff)) -Because 'Taking regular backups is extraordinarily important'\n                        }\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Last Log Backup Times\" -Tags LastLogBackup, LastBackup, Backup, DISA, Varied, $filename {\n        $maxlog = Get-DbcConfigValue policy.backup.logmaxminutes\n        $graceperiod = Get-DbcConfigValue policy.backup.newdbgraceperiod\n        $skipreadonly = Get-DbcConfigValue skip.backup.readonly\n        $skipsecondaries = Get-DbcConfigValue skip.backup.secondaries\n        [DateTime]$sqlinstancedatetime = $InstanceSMO.Query(\"SELECT getutcdate() as getutcdate\").getutcdate\n        [DateTime]$oldestbackupdateallowed = $sqlinstancedatetime.AddHours( - $graceperiod)\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing last log backups on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            Context \"Testing last log backups on $psitem\" {\n                @($InstanceSMO.Databases.Where{ (-not $psitem.IsSystemObject) -and $Psitem.CreateDate.ToUniversalTime() -lt $oldestbackupdateallowed -and $(if ($Database) { $PsItem.Name -in $Database }else { $ExcludedDatabases -notcontains $PsItem.Name }) }).ForEach{\n                    if ($psitem.RecoveryModel -ne \"Simple\") {\n                        if ($psitem.AvailabilityGroupName) {\n                            $agReplicaRole = $InstanceSMO.AvailabilityGroups[$psitem.AvailabilityGroupName].LocalReplicaRole\n                        }\n                        else {\n                            $agReplicaRole = $null\n                        }\n                        $skip = ($psitem.Status -match \"Offline\") -or ($psitem.IsAccessible -eq $false) -or ($psitem.Readonly -eq $true -and $skipreadonly -eq $true) -or ($agReplicaRole -eq 'Secondary' -and $skipsecondaries -eq $true)\n                        It -Skip:$skip  \"Database $($psitem.Name) log backups should be less than $maxlog minutes old on $($psitem.Parent.Name)\" {\n                            $psitem.LastLogBackupDate.ToUniversalTime() | Should -BeGreaterThan $sqlinstancedatetime.AddMinutes( - ($maxlog) + 1) -Because \"Taking regular backups is extraordinarily important\"\n                        }\n                    }\n                }\n            }\n        }\n    }\n\n\n    Describe \"Log File percent used\" -Tags LogfilePercentUsed, Medium, $filename {\n        $LogFilePercentage = Get-DbcConfigValue policy.database.logfilepercentused\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing Log File percent used for $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            Context \"Testing Log File percent used for $psitem\" {\n                $InstanceSMO.Databases.Where{ $(if ($Database) { $PsItem.Name -in $Database }else { $ExcludedDatabases -notcontains $PsItem.Name }) -and ($Psitem.IsAccessible -eq $true) }.ForEach{\n                    $LogFiles = Get-DbaDbSpace -SqlInstance $psitem.Parent.Name -Database $psitem.Name | Where-Object { $_.FileType -eq \"LOG\" }\n                    $DatabaseName = $psitem.Name\n                    $CurrentLogFilePercentage = ($LogFiles | Measure-Object -Property PercentUsed -Maximum).Maximum\n                    It \"Database $DatabaseName Should have a percentage used lower than $LogFilePercentage% on $($psitem.Parent.Name)\" {\n                        $CurrentLogFilePercentage | Should -BeLessThan $LogFilePercentage -Because \"Check backup strategy, open transactions, CDC, Replication and HADR solutions \"\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Virtual Log Files\" -Tags VirtualLogFile, Medium, $filename {\n        $vlfmax = Get-DbcConfigValue policy.database.maxvlf\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing Database VLFs on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            Context \"Testing Database VLFs on $psitem\" {\n                @(Measure-DbaDbVirtualLogFile -SqlInstance $psitem -ExcludeDatabase $ExcludedDatabases -Database $Database).ForEach{\n                    It \"Database $($psitem.Database) VLF count should be less than $vlfmax on $($psitem.SqlInstance)\" {\n                        $psitem.Total | Should -BeLessThan $vlfmax -Because \"Too many VLFs can impact performance and slow down backup/restore\"\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Log File Count Checks\" -Tags LogfileCount, Medium, $filename {\n        $LogFileCountTest = Get-DbcConfigValue skip.database.logfilecounttest\n        $LogFileCount = Get-DbcConfigValue policy.database.logfilecount\n        If (-not $LogFileCountTest) {\n            if ($NotContactable -contains $psitem) {\n                Context \"Testing Log File count for $psitem\" {\n                    It \"Can't Connect to $Psitem\" {\n                        $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                    }\n                }\n            }\n            else {\n                Context \"Testing Log File count for $psitem\" {\n                    @($InstanceSMO.Databases.Where{ if ($Database) { $PsItem.Name -in $Database }else { $ExcludedDatabases -notcontains $PsItem.Name -and ($Psitem.IsAccessible -eq $true) } }).ForEach{\n                        $Files = Get-DbaDbFile -SqlInstance $psitem.Parent.Name -Database $psitem.Name\n                        $LogFiles = $Files | Where-Object { $_.TypeDescription -eq \"LOG\" }\n                        It \"Database $($psitem.Name) Should have $LogFileCount or less Log files on $($psitem.Parent.Name)\" {\n                            $LogFiles.Count | Should -BeLessOrEqual $LogFileCount -Because \"You want the correct number of log files\"\n                        }\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Log File Size Checks\" -Tags LogfileSize, Medium, $filename {\n        $LogFileSizePercentage = Get-DbcConfigValue policy.database.logfilesizepercentage\n        $LogFileSizeComparison = Get-DbcConfigValue policy.database.logfilesizecomparison\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing Log File size for $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            Context \"Testing Log File size for $psitem\" {\n                $InstanceSMO.Databases.Where{ $(if ($Database) { $PsItem.Name -in $Database }else { $ExcludedDatabases -notcontains $PsItem.Name }) -and ($Psitem.IsAccessible -eq $true) }.ForEach{\n                    $Files = Get-DbaDbFile -SqlInstance $psitem.Parent.Name -Database $psitem.Name\n                    $DatabaseName = $psitem.Name\n                    $LogFiles = $Files | Where-Object { $_.TypeDescription -eq \"LOG\" }\n                    $Splat = @{$LogFileSizeComparison = $true;\n                        property                      = \"size\"\n                    }\n                    $LogFileSize = ($LogFiles | Measure-Object -Property Size -Maximum).Maximum\n                    $DataFileSize = ($Files | Where-Object { $_.TypeDescription -eq \"ROWS\" } | Measure-Object @Splat).$LogFileSizeComparison\n                    It \"Database $DatabaseName Should have no log files larger than $LogFileSizePercentage% of the $LogFileSizeComparison of DataFiles on $($psitem.Parent.Name)\" {\n                        $LogFileSize | Should -BeLessThan ($DataFileSize * $LogFileSizePercentage) -Because \"If your log file is this large you are not maintaining it well enough\"\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Future File Growth\" -Tags FutureFileGrowth, Low, $filename {\n        $threshold = Get-DbcConfigValue policy.database.filegrowthfreespacethreshold\n        [string[]]$exclude = Get-DbcConfigValue policy.database.filegrowthexcludedb\n        $exclude += $ExcludedDatabases\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing for files likely to grow soon on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            Context \"Testing for files likely to grow soon on $psitem\" {\n                $InstanceSMO.Databases.Where{ $(if ($Database) { $PsItem.Name -in $Database }else { $PsItem.Name -notin $exclude }) -and ($psitem.IsAccessible) }.ForEach{\n                    $Files = Get-DbaDbFile -SqlInstance $psitem.Parent.Name -Database $psitem.Name\n                    $Files | Add-Member ScriptProperty -Name PercentFree -Value { 100 - [Math]::Round(([int64]$PSItem.UsedSpace.Byte / [int64]$PSItem.Size.Byte) * 100, 3) }\n                    $Files | ForEach-Object {\n                        if (-Not (($PSItem.Growth -eq 0) -and (Get-DbcConfigValue skip.database.filegrowthdisabled))) {\n                            It \"Database $($PSItem.Database) file $($PSItem.LogicalName) has free space under threshold on $($PSItem.SqlInstance)\" {\n                                $PSItem.PercentFree | Should -BeGreaterOrEqual $threshold -Because \"free space within the file should be lower than threshold of $threshold %\"\n                            }\n                        }\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Correctly sized Filegroup members\" -Tags FileGroupBalanced, Medium, $filename {\n        $Tolerance = Get-DbcConfigValue policy.database.filebalancetolerance\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing for balanced FileGroups on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            Context \"Testing for balanced FileGroups on $psitem\" {\n                @(Connect-DbaInstance -SqlInstance $_).Databases.Where{ $(if ($Database) { $PsItem.Name -in $Database }else { $ExcludedDatabases -notcontains $PsItem.Name -and ($Psitem.IsAccessible -eq $true) }) }.ForEach{\n                    $Files = Get-DbaDbFile -SqlInstance $psitem.Parent.Name -Database $psitem.Name\n                    $FileGroups = $Files | Where-Object { $_.TypeDescription -eq \"ROWS\" } | Group-Object -Property FileGroupName\n                    @($FileGroups).ForEach{\n                        $Unbalanced = 0\n                        $Average = ($psitem.Group.Size | Measure-Object -Average).Average\n                        ## files where average size is less than 95% of the average or more than 105% of the average filegroup size (using default 5% config value)\n                        $Unbalanced = $psitem | Where-Object { $psitem.group.Size -lt ((1 - ($Tolerance / 100)) * $Average) -or $psitem.group.Size -gt ((1 + ($Tolerance / 100)) * $Average) }\n                        It \"Database $($psitem.Group[0].Database) File Group $($psitem.Name) should have FileGroup members with sizes within $tolerance % of the average on $($psitem.Group[0].SqlInstance)\" {\n                            $Unbalanced.count | Should -Be 0 -Because \"If your file groups are not balanced the files with the most free space will become allocation hotspots\"\n                        }\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Certificate Expiration\" -Tags CertificateExpiration, High, $filename {\n        $CertificateWarning = Get-DbcConfigValue policy.certificateexpiration.warningwindow\n        [string[]]$exclude = Get-DbcConfigValue policy.certificateexpiration.excludedb\n        $exclude += $ExcludedDatabases\n        if ($NotContactable -contains $psitem) {\n            Context \"Checking that encryption certificates have not expired on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            Context \"Checking that encryption certificates have not expired on $psitem\" {\n                @(Get-DbaDbEncryption -SqlInstance $psitem -IncludeSystemDBs -Database $Database -ExcludeDatabase $exclude | Where-Object { $_.Encryption -eq \"Certificate\" -and ($_.Database -notin $exclude) }).ForEach{\n                    It \"Database $($psitem.Database) certificate $($psitem.Name) has not expired on $($psitem.SqlInstance)\" {\n                        $psitem.ExpirationDate.ToUniversalTime() | Should -BeGreaterThan (Get-Date).ToUniversalTime() -Because \"this certificate should not be expired\"\n                    }\n                    if ($psitem.ExpirationDate.ToUniversalTime() -lt (Get-Date).ToUniversalTime()) {\n                        $skip = $true\n                    }\n                    else {\n                        $skip = $false\n                    }\n                    It \"Database $($psitem.Database) certificate $($psitem.Name) does not expire for more than $CertificateWarning months on $($psitem.SqlInstance)\" -Skip:$skip {\n                        $psitem.ExpirationDate.ToUniversalTime() | Should -BeGreaterThan (Get-Date).ToUniversalTime().AddMonths($CertificateWarning) -Because \"expires inside the warning window of $CertificateWarning months\"\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Auto Create Statistics\" -Tags AutoCreateStatistics, Low, $filename {\n        $autocreatestatistics = Get-DbcConfigValue policy.database.autocreatestatistics\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing Auto Create Statistics on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            Context \"Testing Auto Create Statistics on $psitem\" {\n                $InstanceSMO.Databases.Where{ $(if ($Database) { $PsItem.Name -in $Database }else { $ExcludedDatabases -notcontains $PsItem.Name }) }.ForEach{\n                    It \"Database $($psitem.Name) should have Auto Create Statistics set to $autocreatestatistics on $($psitem.Parent.Name)\" {\n                        $psitem.AutoCreateStatisticsEnabled | Should -Be $autocreatestatistics -Because \"This value is expected for autocreate statistics\"\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Auto Update Statistics\" -Tags AutoUpdateStatistics, Low, $filename {\n        $autoupdatestatistics = Get-DbcConfigValue policy.database.autoupdatestatistics\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing Auto Update Statistics on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            Context \"Testing Auto Update Statistics on $psitem\" {\n                $InstanceSMO.Databases.Where{ $(if ($Database) { $PsItem.Name -in $Database }else { $ExcludedDatabases -notcontains $PsItem.Name }) }.ForEach{\n                    It \"Database $($psitem.Name) should have Auto Update Statistics set to $autoupdatestatistics on $($psitem.Parent.Name)\" {\n                        $psitem.AutoUpdateStatisticsEnabled | Should -Be $autoupdatestatistics  -Because \"This value is expected for autoupdate statistics\"\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Auto Update Statistics Asynchronously\" -Tags AutoUpdateStatisticsAsynchronously, Low, $filename {\n        $autoupdatestatisticsasynchronously = Get-DbcConfigValue policy.database.autoupdatestatisticsasynchronously\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing Auto Update Statistics Asynchronously on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            Context \"Testing Auto Update Statistics Asynchronously on $psitem\" {\n                $InstanceSMO.Databases.Where{ $(if ($Database) { $PsItem.Name -in $Database }else { $ExcludedDatabases -notcontains $PsItem.Name }) }.ForEach{\n                    It \"Database $($psitem.Name) should have Auto Update Statistics Asynchronously set to $autoupdatestatisticsasynchronously on $($psitem.Parent.Name)\" {\n                        $psitem.AutoUpdateStatisticsAsync | Should -Be $autoupdatestatisticsasynchronously  -Because \"This value is expected for autoupdate statistics asynchronously\"\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Datafile Auto Growth Configuration\" -Tags DatafileAutoGrowthType, Low, $filename {\n        $datafilegrowthtype = Get-DbcConfigValue policy.database.filegrowthtype\n        $datafilegrowthvalue = Get-DbcConfigValue policy.database.filegrowthvalue\n        $exclude = Get-DbcConfigValue policy.database.filegrowthexcludedb\n        $exclude += $ExcludedDatabases\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing datafile growth type on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            Context \"Testing datafile growth type on $psitem\" {\n                $InstanceSMO.Databases.Where{ $(if ($Database) { $PsItem.Name -in $Database }else { $exclude -notcontains $PsItem.Name }) -and ($Psitem.IsAccessible -eq $true) }.ForEach{\n                    $Files = Get-DbaDbFile -SqlInstance $InstanceSMO -Database $psitem.Name\n                    @($Files).ForEach{\n                        if (-Not (($psitem.Growth -eq 0) -and (Get-DbcConfigValue skip.database.filegrowthdisabled))) {\n                            It \"Database $($psitem.Database) datafile $($psitem.LogicalName) on filegroup $($psitem.FileGroupName) should have GrowthType set to $datafilegrowthtype on $($psitem.SqlInstance)\" {\n                                $psitem.GrowthType | Should -Be $datafilegrowthtype -Because \"We expect a certain file growth type\"\n                            }\n                            if ($datafilegrowthtype -eq \"kb\") {\n                                It \"Database $($psitem.Database) datafile $($psitem.LogicalName) on filegroup $($psitem.FileGroupName) should have Growth set equal or higher than $datafilegrowthvalue on $($psitem.SqlInstance)\" {\n                                    $psitem.Growth * 8 | Should -BeGreaterOrEqual $datafilegrowthvalue  -because \"We expect a certain file growth value\"\n                                }\n                            }\n                            else {\n                                It \"Database $($psitem.Database) datafile $($psitem.LogicalName) on filegroup $($psitem.FileGroupName) should have Growth set equal or higher than $datafilegrowthvalue on $($psitem.SqlInstance)\" {\n                                    $psitem.Growth | Should -BeGreaterOrEqual $datafilegrowthvalue  -because \"We expect a certain fFile growth value\"\n                                }\n                            }\n                        }\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Trustworthy Option\" -Tags Trustworthy, DISA, Varied, CIS, $filename {\n        $exclude = Get-DbcConfigValue policy.database.trustworthyexcludedb\n        $exclude += $ExcludedDatabases\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing database trustworthy option on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            Context \"Testing database trustworthy option on $psitem\" {\n                @($InstanceSMO.Databases.Where{ $psitem.Name -ne 'msdb' -and ($(if ($Database) { $PsItem.Name -in $Database }else { $exclude -notcontains $PsItem.Name })) }).ForEach{\n                    It \"Database $($psitem.Name) should have Trustworthy set to false on $($psitem.Parent.Name)\" {\n                        $psitem.Trustworthy | Should -BeFalse -Because \"Trustworthy has security implications and may expose your SQL Server to additional risk\"\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Database Orphaned User\" -Tags OrphanedUser, CIS, Medium, $filename {\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing database orphaned user event on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            Context \"Testing database orphaned user event on $psitem\" {\n                $instance = $psitem\n                @($InstanceSMO.Databases.Where{ ($(if ($Database) { $PsItem.Name -in $Database }else { $ExcludedDatabases -notcontains $PsItem.Name })) }).ForEach{\n                    It \"Database $($psitem.Name) should return 0 orphaned user on $($psitem.Parent.Name)\" {\n                        @(Get-DbaDbOrphanUser -SqlInstance $instance -ExcludeDatabase $ExcludedDatabases -Database $psitem.Name).Count | Should -Be 0 -Because \"We dont want orphaned users\"\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"PseudoSimple Recovery Model\" -Tags PseudoSimple, Medium, $filename {\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing database is not in PseudoSimple recovery model on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            Context \"Testing database is not in PseudoSimple recovery model on $psitem\" {\n                @($InstanceSMO.Databases.Where{ $psitem.Name -ne 'tempdb' -and $psitem.Name -ne 'model' -and $psitem.Status -ne 'Offline' -and ($(if ($Database) { $PsItem.Name -in $Database }else { $ExcludedDatabases -notcontains $PsItem.Name })) }).ForEach{\n                    if (-not($psitem.RecoveryModel -eq \"Simple\")) {\n                        It \"Database $($psitem.Name) has PseudoSimple recovery model equal false on $($psitem.Parent.Name)\" { (Test-DbaDbRecoveryModel -SqlInstance $psitem.Parent -Database $psitem.Name).ActualRecoveryModel -eq \"SIMPLE\" | Should -BeFalse -Because \"PseudoSimple means that a FULL backup has not been taken and the database is still effectively in SIMPLE mode\" }\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Compatibility Level\" -Tags CompatibilityLevel, High, $filename {\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing database compatibility level matches server compatibility level on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            Context \"Testing database compatibility level matches server compatibility level on $psitem\" {\n                if ($version -lt 10) {\n                    It \"Database dbachecksskipped Testing database compatibility level matches server compatibility level on $psitem\" -Skip {\n                        Assert-DatabaseDuplicateIndex -Instance $instance -Database $psitem\n                    }\n                }\n                else {\n                    @(Test-DbaDbCompatibility -SqlInstance $psitem -ExcludeDatabase $ExcludedDatabases -Database $Database).ForEach{\n                        It \"Database $($psitem.Database) has a database compatibility level equal to the level of $($psitem.SqlInstance)\" {\n                            $psItem.DatabaseCompatibility | Should -Be $psItem.ServerLevel -Because \"it means you are on the appropriate compatibility level for your SQL Server version to use all available features\"\n                        }\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Foreign keys and check constraints not trusted\" -Tags FKCKTrusted, Low, $filename {\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing Foreign Keys and Check Constraints are not trusted $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            Context \"Testing Foreign Keys and Check Constraints are not trusted $psitem\" {\n                @(Get-DbaDbForeignKey -SqlInstance $psitem -ExcludeDatabase $ExcludedDatabases -Database $Database).Where{ $_.NotForReplication -eq $false }.ForEach{\n                    It \"Database $($psitem.Database) Foreign Key $($psitem.Name) on table $($psitem.Parent) should be trusted on $($psitem.SqlInstance)\" {\n                        $psitem.IsChecked | Should -Be $true -Because \"This can have a huge performance impact on queries. SQL Server won't use untrusted constraints to build better execution plans. It will also avoid data violation\"\n                    }\n                }\n\n                @(Get-DbaDbCheckConstraint -SqlInstance $psitem -ExcludeDatabase $ExcludedDatabases -Database $Database).Where{ $_.NotForReplication -eq $false -and $_.IsEnabled -eq $true }.ForEach{\n                    It \"Database $($psitem.Database) Check Constraint $($psitem.Name) on table $($psitem.Parent) should be trusted on $($psitem.SqlInstance)\" {\n                        $psitem.IsChecked | Should -Be $true -Because \"This can have a huge performance impact on queries. SQL Server won't use untrusted constraints to build better execution plans. It will also avoid data violation\"\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Database MaxDop\" -Tags MaxDopDatabase, MaxDop, Low, $filename {\n        $MaxDopValue = Get-DbcConfigValue policy.database.maxdop\n        [string[]]$exclude = Get-DbcConfigValue policy.database.maxdopexcludedb\n        $exclude += $ExcludedDatabases\n        if ($exclude) { Write-Warning \"Excluded $exclude from testing\" }\n        if ($NotContactable -contains $psitem) {\n            Context \"Database MaxDop setting is correct on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            Context \"Database MaxDop setting is correct on $psitem\" {\n                @(Test-DbaMaxDop -SqlInstance $psitem).Where{ $_.Database -ne 'N/A' -and $(if ($database) { $PsItem.Database -in $Database } else { $_.Database -notin $exclude }) }.ForEach{\n                    It \"Database $($psitem.Database) should have the correct MaxDop setting on $($psitem.SqlInstance)\" {\n                        Assert-DatabaseMaxDop -MaxDop $PsItem -MaxDopValue $MaxDopValue\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Database Status\" -Tags DatabaseStatus, High, $filename {\n        $ExcludeReadOnly = Get-DbcConfigValue policy.database.status.excludereadonly\n        $ExcludeOffline = Get-DbcConfigValue policy.database.status.excludeoffline\n        $ExcludeRestoring = Get-DbcConfigValue policy.database.status.excluderestoring\n\n        if ($NotContactable -contains $psitem) {\n            Context \"Database status is correct on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            Context \"Database status is correct on $psitem\" {\n                $instance = $psitem\n                @($InstanceSMO.Databases.Where{ $(if ($Database) { $PsItem.Name -in $Database }else { $ExcludedDatabases -notcontains $PsItem.Name }) }).Foreach{\n                    It \"Database $($psitem.Name) has the expected status on $instance\" {\n                        Assert-DatabaseStatus -Instance $instance -Database $($psitem.Name) -ExcludeReadOnly $ExcludeReadOnly -ExcludeOffline $ExcludeOffline -ExcludeRestoring $ExcludeRestoring\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Database Exists\" -Tags DatabaseExists, $filename {\n        $expected = Get-DbcConfigValue database.exists\n        if ($Database) { $expected += $Database }\n        $expected = $expected.where{ $psitem -notin $ExcludedDatabases }\n        if ($NotContactable -contains $psitem) {\n            Context \"Database exists on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            $instance = $psitem\n            Context \"Database exists on $psitem\" {\n                $expected.ForEach{\n                    It \"Database $psitem should exist on $($psitem.Parent.Name)\" {\n                        Assert-DatabaseExists -Instance $instance -Expecteddb $psitem\n                    }\n                }\n            }\n        }\n    }\n    Describe \"Contained Database Auto Close\" -Tags ContainedDBAutoClose, CIS, $filename {\n        $skip = Get-DbcConfigValue skip.security.containedbautoclose\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing contained database auto close option on $psitem\" {\n                It \"Can't Connect to $Psitem\" -Skip:$skip{\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            Context \"Testing contained database auto close option on $psitem\" {\n                @($InstanceSMO.Databases.Where{ $psitem.Name -ne 'msdb' -and $psItem.ContainmentType -ne \"NONE\" -and $psItem.ContainmentType -ne $null -and ($(if ($Database) { $PsItem.Name -in $Database }else { $ExcludedDatabases -notcontains $PsItem.Name })) }).ForEach{\n                    It \"Database $($psitem.Name) should have auto close set to false on $($psitem.Parent.Name)\" -Skip:$skip {\n                        $psitem.AutoClose | Should -BeFalse -Because \"Contained Databases should have auto close set to false for CIS compliance\"\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"CLR Assemblies SAFE_ACCESS\" -Tags CLRAssembliesSafe, CIS, $filename {\n        $skip = Get-DbcConfigValue skip.security.clrassembliessafe\n        [string[]]$exclude = Get-DbcConfigValue policy.database.clrassembliessafeexcludedb\n        $ExcludedDatabases += $exclude\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing that all user-defined CLR assemblies are set to SAFE_ACCESS on $psitem\" {\n                It \"Can't Connect to $Psitem\" -Skip:$skip {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            Context \"Testing that all user-defined CLR assemblies are set to SAFE_ACCESS on $psitem\" {\n                $instance = $psitem\n                @($InstanceSMO.Databases.Where{ ($(if ($Database) { $PsItem.Name -in $Database }else { $ExcludedDatabases -notcontains $PsItem.Name })) }).ForEach{\n                    It \"Database $($psitem.Name) user-defined CLR assemblies are set to SAFE_ACCESS on $($psitem.Parent.Name)\" {\n                        Assert-CLRAssembliesSafe -Instance $instance -Database $psitem.Name\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Guest User\" -Tags GuestUserConnect, Security, CIS, Medium, $filename {\n        $exclude = \"master\", \"tempdb\", \"msdb\"\n        $ExcludedDatabases = $ExcludedDatabases + $exclude\n        $skip = Get-DbcConfigValue skip.security.guestuserconnect\n\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing Guest user has CONNECT permission on $psitem\" {\n                It \"Can't Connect to $Psitem\" -Skip:$skip {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            $instance = $Psitem\n            Context \"Testing Guest user has CONNECT permission on $psitem\" {\n                @(Get-Database -Instance $Instance -Requiredinfo Name -Exclusions NotAccessible -Database $Database -ExcludedDbs $ExcludedDatabases).ForEach{\n                    It \"Database Guest user should return no CONNECT permissions in $psitem on $Instance\" -Skip:$skip {\n                        Assert-GuestUserConnect -Instance $instance -Database $psitem\n                    }\n                }\n            }\n        }\n    }\n    Describe \"AsymmetricKeySize\" -Tags AsymmetricKeySize, CIS, $filename {\n        $skip = Get-DbcConfigValue skip.security.asymmetrickeysize\n        $ExcludedDatabases = $ExcludedDatabases + \"master\", \"tempdb\", \"msdb\"\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing Asymmetric Key Size is 2048 or higher on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            Context \"Testing Asymmetric Key Size is 2048 or higher on $psitem\" {\n                @($InstanceSMO.Databases.Where{ ($(if ($Database) { $PsItem.Name -in $Database }else { $ExcludedDatabases -notcontains $PsItem.Name })) }).ForEach{\n                    It \"Database $($psitem.Name) Asymmetric Key Size should be at least 2048 on $($psitem.Parent.Name)\" -Skip:$skip {\n                        Assert-AsymmetricKeySize -Instance $instance -Database $psitem\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"SymmetricKeyEncryptionLevel\" -Tags SymmetricKeyEncryptionLevel, CIS, $filename {\n        $skip = Get-DbcConfigValue skip.security.symmetrickeyencryptionlevel\n        $ExcludedDatabases = $ExcludedDatabases + \"master\", \"tempdb\", \"msdb\"\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing Symmetric Key Encryption Level at least AES_128 or higher on $psitem\" {\n                It \"Can't Connect to $Psitem\" -Skip:$skip {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            Context \"Testing Symmetric Key Encryption Level at least AES_128 or higher on $psitem\" {\n                @($InstanceSMO.Databases.Where{ ($(if ($Database) { $PsItem.Name -in $Database }else { $ExcludedDatabases -notcontains $PsItem.Name })) }).ForEach{\n                    It \"Database $($psitem.Name) Symmetric Key Encryption Level should have AES_128 or higher on $($psitem.Parent.Name)\" -Skip:$skip {\n                        Assert-SymmetricKeyEncryptionLevel -Instance $instance -Database $psitem\n                    }\n                }\n            }\n        }\n    }\n    Describe \"Contained Database SQL Authenticated Users\" -Tags ContainedDBSQLAuth, CIS, $filename {\n        $skip = Get-DbcConfigValue skip.security.ContainedDBSQLAuth\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing contained database to see if sql authenticated users exist on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            Context \"Testing contained database to see if sql authenticated users exist on $psitem\" {\n                @($InstanceSMO.Databases.Where{ $psitem.Name -ne 'msdb' -and $psItem.ContainmentType -ne \"NONE\" -and ($(if ($Database) { $PsItem.Name -in $Database }else { $ExcludedDatabases -notcontains $PsItem.Name })) }).ForEach{\n                    if ($version -lt 13 ) { $skip = $true }\n                    It \"Database $($psitem.Name) should have no sql authenticated users on $($psitem.Parent.Name)\" -Skip:$skip {\n                        Assert-ContainedDBSQLAuth -Instance $InstanceSMO -Database $($psitem.Name)\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Query Store Enabled\" -Tags QueryStoreEnabled, Medium, $filename {\n        $QSExcludedDatabases = Get-DbcConfigValue database.querystoreenabled.excludedb\n        $exclude = \"master\", \"tempdb\" , \"model\"\n        $ExcludedDatabases += $exclude\n        $QSExcludedDatabases += $ExcludedDatabases\n        $Skip = Get-DbcConfigValue skip.security.querystoreenabled\n        if (!$skip -and $InstanceSMO.Version.Major -lt 13) {\n            $Skip = $true\n        }\n\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing to see if Query Store is enabled on $psitem\" {\n                It \"Can't Connect to $Psitem\" -Skip:$skip {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            $instance = $Psitem\n            Context \"Testing to see if Query Store is enabled on $psitem\" {\n                @($InstanceSMO.Databases.Where{ $(if ($Database) { $PsItem.Name -in $Database }else { $QSExcludedDatabases -notcontains $PsItem.Name }) }).Foreach{\n                    It \"Database $($psitem.Name) should have Query Store enabled on $Instance\" -Skip:$skip {\n                        Assert-QueryStoreEnabled -Instance $InstanceSMO -Database $($psitem.Name)\n                    }\n                }\n            }\n        }\n    }\n    Describe \"Query Store Disabled\" -Tags QueryStoreDisabled, Medium, $filename {\n        $QSExcludedDatabases = Get-DbcConfigValue database.querystoredisabled.excludedb\n        $exclude = \"master\", \"tempdb\" , \"model\"\n        $ExcludedDatabases += $exclude\n        $QSExcludedDatabases += $ExcludedDatabases\n        $Skip = Get-DbcConfigValue skip.security.querystoredisabled\n        if (!$skip -and $InstanceSMO.Version.Major -lt 13) {\n            $Skip = $true\n        }\n\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing to see if Query Store is disabled on $psitem\" {\n                It \"Can't Connect to $Psitem\" -Skip:$skip {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            $instance = $Psitem\n            Context \"Testing to see if Query Store is disabled on $psitem\" {\n                @($InstanceSMO.Databases.Where{ $(if ($Database) { $PsItem.Name -in $Database }else { $QSExcludedDatabases -notcontains $PsItem.Name }) }).Foreach{\n                    It \"Database $($psitem.Name) should have Query Store disabled on $Instance\" -Skip:$skip {\n                        Assert-QueryStoreDisabled -Instance $InstanceSMO -Database $($psitem.Name)\n                    }\n                }\n            }\n        }\n    }\n}\nSet-PSFConfig -Module dbachecks -Name global.notcontactable -Value $NotContactable\n\n\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUtcxr55FjceUEjdUkewbSpjmy\n# jvGgggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz\n# c3VyZWQgSUQgQ29kZSBTaWduaW5nIENBMB4XDTE3MDUwOTAwMDAwMFoXDTIwMDUx\n# MzEyMDAwMFowVzELMAkGA1UEBhMCVVMxETAPBgNVBAgTCFZpcmdpbmlhMQ8wDQYD\n# VQQHEwZWaWVubmExETAPBgNVBAoTCGRiYXRvb2xzMREwDwYDVQQDEwhkYmF0b29s\n# czCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAI8ng7JxnekL0AO4qQgt\n# Kr6p3q3SNOPh+SUZH+SyY8EA2I3wR7BMoT7rnZNolTwGjUXn7bRC6vISWg16N202\n# 1RBWdTGW2rVPBVLF4HA46jle4hcpEVquXdj3yGYa99ko1w2FOWzLjKvtLqj4tzOh\n# K7wa/Gbmv0Si/F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LExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQD\n# EyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgQ29kZSBTaWduaW5nIENBAhACwXUo\n# dNXChDGFKtigZGnKMAkGBSsOAwIaBQCgeDAYBgorBgEEAYI3AgEMMQowCKACgACh\n# AoAAMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcCAQsxDjAM\n# BgorBgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBQnK7qKjRxJU+HyxAj3yGDpDNaE\n# nDANBgkqhkiG9w0BAQEFAASCAQB/bH2PVbDMyrw6q29akwgV4y2inQ3H5aEv+rbW\n# QNqXAAM6YQdao2jNULDso8l8SFAda7/rGwKPysHSW9T5ItOwAt3k421oegIW14lc\n# 1X1u2TVEm/iZ7hDxdVpwasIg4E3Dsk2GDBnBex3Kvtqa5KI6SHrkf+0hmPh6h/We\n# HcYi+7U3OJifW6LE6PNm2OlqV/+lf91JVMWUnnV7Lj5l3+TL4RCHLhiQeQcdYyND\n# Jzz3o3efcO44AHdgYr2/NUBMqKG7cNvg0kfcVEJu0P/bJXXlOFZAPjJS29QY+LjH\n# reo+UTxlzVPFc1/7eYaPj05afNA80nAKJ+I0fg2DXoQxj8gM\n# SIG # End signature block\n"
  },
  {
    "path": "source/checks/Databasev5.Tests.ps1",
    "content": "# So the v5 files need to be handled differently.\n# Ww will start with a BeforeDiscovery , $Filename which for the Database Checks will need to gather the Instances up front\nBeforeDiscovery {\n\n    # Gather the instances we know are not contactable\n    [string[]]$NotContactable = (Get-PSFConfig -Module dbachecks -Name global.notcontactable).Value\n    # Get all the tags in use in this run\n    $Tags = Get-CheckInformation -Check $Check -Group Database -AllChecks $AllChecks -ExcludeCheck $ChecksToExclude\n\n\n    $InstancesToTest = @(Get-Instance).ForEach{\n        # just add it to the Not Contactable list\n        if ($NotContactable -notcontains $psitem) {\n            $Instance = $psitem\n            try {\n                $InstanceSMO = Connect-DbaInstance -SqlInstance $Instance -ErrorAction SilentlyContinue -ErrorVariable errorvar\n            } catch {\n                $NotContactable += $Instance\n            }\n            if ($NotContactable -notcontains $psitem) {\n                if ($null -eq $InstanceSMO.version) {\n                    $NotContactable += $Instance\n                } else {\n                    # Get the relevant information for the checks in one go to save repeated trips to the instance and set values for Not Contactable tests if required\n                    Get-AllDatabaseInfo -Instance $InstanceSMO -Tags $Tags\n                }\n            }\n        }\n    }\n    Write-PSFMessage -Message \"Instances = $($InstancesToTest.Name)\" -Level Verbose\n    Set-PSFConfig -Module dbachecks -Name global.notcontactable -Value $NotContactable\n\n    # Get-DbcConfig is expensive so we call it once\n    $__dbcconfig = Get-DbcConfig\n}\n\n# Each Test will have a -ForEach for the Instances and the InstancesToTest object will have a\n# lot of information gathered up front to reduce trips and connections to the database\n\n\n<#\n\n- copy in test\n- add skip  after describe\n    $skip = Get-DbcConfigValue skip.database.databasecollation\n    add to IT -Skip:$skip\n#>\n\n\n\nDescribe \"Suspect Page\" -Tag SuspectPage, High , Database -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.database.suspectpage' }).Value\n    Context \"Testing suspect pages on <_.Name>\" {\n        It \"Database <_.Name> should return 0 suspect pages on <_.SqlInstance>\" -Skip:$skip -ForEach $psitem.Databases.Where{ if ($Database) { $_.Name -in $Database } else { $psitem.ConfigValues.suspectpageexclude -notcontains $PsItem.Name } } {\n            $psitem.SuspectPage | Should -Be 0 -Because \"You do not want any suspect pages\"\n        }\n    }\n}\n\nDescribe \"Database Collation\" -Tag DatabaseCollation, High, Database -ForEach $InstancesToTest {\n    #TODO: Should we have a skip option for each IT block?\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.database.databasecollation' }).Value\n    Context \"Testing database collation on <_.Name>\" {\n        It \"Database <_.Name> collation <_.Collation> should match server collation <_.ServerCollation> on <_.SqlInstance>\" -Skip:$skip -ForEach $psitem.Databases.Where{ if ($Database) { $_.Name -in $Database } else { $psitem.ConfigValues.wrongcollation -notcontains $PsItem.Name } } {\n            $psitem.ServerCollation | Should -Be $psitem.Collation -Because \"You will get collation conflict errors in tempdb\"\n        }\n\n        # wrong collation set\n        It \"Database <_.Name> collation <_.Collation> should not match server collation <_.ServerCollation> on <_.SqlInstance>\" -Skip:$skip -ForEach $psitem.Databases.Where{ $_.Name -in $psitem.ConfigValues.wrongcollation } {\n            $psitem.ServerCollation | Should -Not -Be $psitem.Collation -Because \"You have defined the database to have another collation then the server. You will get collation conflict errors in tempdb\"\n        }\n    }\n}\n\n\nDescribe \"Valid Database Owner\" -Tag ValidDatabaseOwner, Medium, Database -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.database.validdatabaseowner' }).Value\n\n    Context \"Testing Database Owners on <_.Name>\" {\n        #TODO fix the it text - needs commas --> should be in this list ( sqladmin sa ) )\n        It \"Database <_.Name> - owner '<_.Owner>' should be in this list ( <_.ConfigValues.validdbownername> ) ) on <_.SqlInstance>\" -Skip:$skip -ForEach $psitem.Databases.Where{ if ($Database) { $_.Name -in $Database } else { $psitem.ConfigValues.validdbownerexclude -notcontains $PsItem.Name } } {\n            $psitem.Owner | Should -BeIn $psitem.ConfigValues.validdbownername -Because \"The account that is the database owner is not what was expected\"\n        }\n    }\n}\n\n\nDescribe \"Invalid Database Owner\" -Tag InvalidDatabaseOwner, Medium, Database -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.database.invaliddatabaseowner' }).Value\n    Context \"Testing Database Owners on <_.Name>\" {\n\n        It \"Database <_.Name> - owner '<_.Owner>' should not be in this list ( <_.ConfigValues.invaliddbownername> ) ) on <_.SqlInstance>\" -Skip:$skip -ForEach $psitem.Databases.Where{ if ($Database) { $_.Name -in $Database } else { $psitem.ConfigValues.invaliddbownerexclude -notcontains $PsItem.Name } } {\n            $psitem.Owner | Should -Not -BeIn $psitem.ConfigValues.invaliddbownername -Because \"The database owner was one specified as incorrect\"\n        }\n    }\n}\n\nDescribe \"AsymmetricKeySize\" -Tag AsymmetricKeySize, CIS, Database -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.security.asymmetrickeysize' }).Value\n    Context \"Testing Asymmetric Key Size is 2048 or higher on <_.Name>\" {\n        It \"Database <_.Name> asymmetric key size should be at least 2048 on <_.SqlInstance>\" -Skip:$skip -ForEach $psitem.Databases.Where{ if ($Database) { $_.Name -in $Database } else { $psitem.ConfigValues.asymmetrickeysizeexclude -notcontains $PsItem.Name } } {\n            $psitem.AsymmetricKeySize | Should -Be 0 -Because \"Asymmetric keys should have a key length greater than or equal to 2048\"\n            #$psitem.AsymmetricKeySize | Should -BeGreaterOrEqual 2048 -Because \"Asymmetric keys should have a key length greater than or equal to 2048\"\n        }\n    }\n}\n\nDescribe \"Auto Close\" -Tag AutoClose, High, Database -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.database.autoclose' }).Value\n    Context \"Testing Auto Close on <_.Name>\" {\n        It \"Database <_.Name> should have Auto Close set to <_.ConfigValues.autoclose> on <_.SqlInstance>\" -Skip:$skip -ForEach $psitem.Databases.Where{ if ($Database) { $_.Name -in $Database } else { $psitem.ConfigValues.autocloseexclude -notcontains $PsItem.Name } } {\n            $psitem.AutoClose | Should -Be $psitem.ConfigValues.autoclose -Because \"Because!\"\n        }\n    }\n}\n\nDescribe \"Auto Shrink\" -Tag AutoShrink, High, Database -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.database.autoshrink' }).Value\n    Context \"Testing Auto Shrink on <_.Name>\" {\n        It \"Database <_.Name> should have Auto Shrink set to <_.ConfigValues.autoshrink> on <_.SqlInstance>\" -Skip:$skip -ForEach $psitem.Databases.Where{ if ($Database) { $_.Name -in $Database } else { $psitem.ConfigValues.autoshrinkexclude -notcontains $PsItem.Name } } {\n            $psitem.AutoShrink | Should -Be $psitem.ConfigValues.autoshrink -Because \"Shrinking databases causes fragmentation and performance issues\"\n        }\n    }\n}\n\nDescribe \"Virtual Log Files\" -Tag VirtualLogFile, Medium, Database -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.database.vlf' }).Value\n    Context \"Testing Database VLFs on <_.Name>\" {\n        It \"Database <_.Name> VLF count should be less than <_.ConfigValues.maxvlf> on <_.SqlInstance>\" -Skip:$skip -ForEach $psitem.Databases.Where{ if ($Database) { $_.Name -in $Database } else { $psitem.ConfigValues.vlfexclude -notcontains $PsItem.Name } } {\n            $psitem.VLF | Should -BeLessThan $psitem.ConfigValues.maxvlf -Because \"Too many VLFs can impact performance and slow down backup/restore\"\n        }\n    }\n}\n\nDescribe \"Log File Count Checks\" -Tag LogfileCount, Medium, Database -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.database.logfilecounttest' }).Value\n    Context \"Testing Log File count for <_.Name>\" {\n        It \"Database <_.Name> should have <_.ConfigValues.logfilecount> or less log files on <_.SqlInstance>\" -Skip:$skip -ForEach $psitem.Databases.Where{ if ($Database) { $_.Name -in $Database } else { $psitem.ConfigValues.logfilecountexclude -notcontains $PsItem.Name } } {\n            $psitem.LogFileCount | Should -BeLessOrEqual $psitem.ConfigValues.logfilecount -Because \"You want the correct number of log files\"\n        }\n    }\n}\n\nDescribe \"Auto Create Statistics\" -Tag AutoCreateStatistics, Low, Database -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.database.autocreatestatistics' }).Value\n    Context \"Testing Auto Create Statistics for <_.Name>\" {\n        It \"Database <_.Name> should have Auto Create Statistics set to <_.ConfigValues.autocreatestats> on <_.SqlInstance>\" -Skip:$skip -ForEach $psitem.Databases.Where{ if ($Database) { $_.Name -in $Database } else { $psitem.ConfigValues.autocreatestatsexclude -notcontains $PsItem.Name } } {\n            $psitem.AutoCreateStatistics | Should -Be $psitem.ConfigValues.autocreatestats -Because \"This value is expected for autocreate statistics\"\n        }\n    }\n}\n\nDescribe \"Auto Update Statistics\" -Tag AutoUpdateStatistics, Low, Database -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.database.autoupdatestatistics' }).Value\n    Context \"Testing Auto Update Statistics on <_.Name>\" {\n        It \"Database <_.Name> should have Auto Update Statistics set to <_.ConfigValues.autoupdatestats> on <_.SqlInstance>\" -Skip:$skip -ForEach $psitem.Databases.Where{ if ($Database) { $_.Name -in $Database } else { $psitem.ConfigValues.autoupdatestatsexclude -notcontains $PsItem.Name } } {\n            $psitem.AutoUpdateStatistics | Should -Be $psitem.ConfigValues.autoupdatestats -Because \"This value is expected for autoupdate statistics\"\n        }\n    }\n}\n\nDescribe \"Auto Update Statistics Asynchronously\" -Tag AutoUpdateStatisticsAsynchronously, Low, Database -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.database.autoupdatestatisticsasynchronously' }).Value\n    Context \"Testing Auto Update Statistics Asynchronously on <_.Name>\" {\n        It \"Database <_.Name> should have Auto Update Statistics Asynchronously set to <_.ConfigValues.autoupdatestatsasync> on <_.SqlInstance>\" -Skip:$skip -ForEach $psitem.Databases.Where{ if ($Database) { $_.Name -in $Database } else { $psitem.ConfigValues.autoupdatestatsasyncexclude -notcontains $PsItem.Name } } {\n            $psitem.AutoUpdateStatisticsAsync | Should -Be $psitem.ConfigValues.autoupdatestatsasync -Because \"This value is expected for autoupdate statistics asynchronously\"\n        }\n    }\n}\n\nDescribe \"Trustworthy Option\" -Tag Trustworthy, DISA, Varied, CIS, Database -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.database.trustworthy' }).Value\n    Context \"Testing database trustworthy option on <_.Name>\" {\n        It \"Database <_.Name> should have Trustworthy set to false on <_.SqlInstance>\" -Skip:$skip -ForEach $psitem.Databases.Where{ if ($Database) { $_.Name -in $Database } else { $psitem.ConfigValues.trustworthyexclude -notcontains $PsItem.Name } } {\n            $psitem.Trustworthy | Should -BeFalse -Because \"Trustworthy has security implications and may expose your SQL Server to additional risk\"\n        }\n    }\n}\n\nDescribe \"Database Status\" -Tag DatabaseStatus, High, Database -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.database.status' }).Value\n    Context \"Database status is correct on <_.Name>\" {\n        It \"Database <_.Name> has the expected status on <_.SqlInstance>\" -Skip:$skip -ForEach $psitem.Databases.Where{ if ($Database) { $_.Name -in $Database } else { $psitem.ConfigValues.statusexclude -notcontains $PsItem.Name } } {\n            $psitem.Where{ $_.Name -notin $psitem.ConfigValues.excludereadonly -and $psitem.IsDatabaseSnapshot -eq $false }.Readonly | Should -Not -Contain True -Because \"We expect that there will be no Read-Only databases except for those specified\"\n            $psitem.Where{ $_.Name -notin $psitem.ConfigValues.excludeoffline }.Status | Should -Not -Match 'Offline' -Because \"We expect that there will be no offline databases except for those specified\"\n            $psitem.Where{ $_.Name -notin $psitem.ConfigValues.excluderestoring }.Status | Should -Not -Match 'Restoring' -Because \"We expect that there will be no databases in a restoring state except for those specified\"\n            $psitem.Where{ $_.Name -notin $psitem.ConfigValues.excludeoffline }.Status | Should -Not -Match 'AutoClosed' -Because \"We expect that there will be no databases that have been auto closed\"\n            $psitem.Status | Should -Not -Match 'Recover' -Because \"We expect that there will be no databases going through the recovery process or in a recovery pending state\"\n            $psitem.Status | Should -Not -Match 'Emergency' -Because \"We expect that there will be no databases in EmergencyMode\"\n            $psitem.Status | Should -Not -Match 'Standby' -Because \"We expect that there will be no databases in Standby\"\n            $psitem.Status | Should -Not -Match 'Suspect' -Because \"We expect that there will be no databases in a Suspect state\"\n        }\n    }\n}\n\nDescribe \"Query Store Enabled\" -Tag QueryStoreEnabled, Medium, Database -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.security.querystoreenabled' }).Value\n\n    Context \"Testing to see if Query Store is enabled on <_.Name>\" {\n        It \"Database <_.Name> should have Query Store enabled on <_.SqlInstance>\" -Skip:$skip -ForEach $psitem.Databases.Where{ if ($Database) { $_.Name -in $Database } else { $psitem.ConfigValues.qsenabledexclude -notcontains $PsItem.Name } } {\n            $psitem.QueryStore | Should -Not -BeIn ('OFF', 'ERROR') -Because \"We expect the Query Store to be enabled\"\n        }\n    }\n}\n\nDescribe \"Query Store Disabled\" -Tag QueryStoreDisabled, Medium, Database -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.security.querystoredisabled' }).Value\n\n    Context \"Testing to see if Query Store is disabled on <_.Name>\" {\n        It \"Database <_.Name> should have Query Store disabled on <_.SqlInstance>\" -Skip:$skip -ForEach $psitem.Databases.Where{ if ($Database) { $_.Name -in $Database } else { $psitem.ConfigValues.qsdisabledexclude -notcontains $PsItem.Name } } {\n            $psitem.QueryStore | Should -Not -Be 'OFF' -Because \"We expect the Query Store to be disabled\"\n        }\n    }\n}\n\nDescribe \"Compatibility Level\" -Tag CompatibilityLevel, High, Database -ForEach $InstancesToTest {\n    $Skip = ($__dbcconfig | Where-Object Name -EQ 'skip.database.compatibilitylevel').Value\n\n    Context \"Compatibility level matches server compatibility level on <_.Name>\" {\n        It \"Database <_.Name> has the expected compatibility level on <_.SqlInstance>\" -Skip:$skip -ForEach $psitem.Databases.Where{ if ($Database) { $_.Name -in $Database } else { $psitem.ConfigValues.compatexclude -notcontains $psitem.Name } } {\n            $psitem.CompatibilityLevel | Should -Be $psitem.ServerLevel -Because \"it means you are on the appropriate compatibility level for your SQL Server version to use all available features.\"\n        }\n    }\n}\n\nDescribe \"Guest User\" -Tag GuestUserConnect, Security, CIS, Medium, Database -ForEach $InstancesToTest {\n    $Skip = ($__dbcconfig | Where-Object Name -EQ 'skip.security.guestuserconnect').Value\n\n    Context \"Testing Guest user has CONNECT permission on <_.Name>\" {\n        It \"Database Guest user should return no CONNECT permissions in <_.Name> on <_.SqlInstance>\" -Skip:$skip -ForEach $psitem.Databases.Where{ if ($Database) { $_.Name -in $Database } else { $psitem.ConfigValues.guestuserexclude -notcontains $psitem.Name } } {\n            $psitem.GuestUserConnect | Should -BeFalse -Because \"we don't want the guest user to have connect access to our database.\"\n        }\n    }\n}\n\nDescribe \"Recovery Model\" -Tag RecoveryModel, DISA, Medium, Database -ForEach $InstancesToTest {\n    $Skip = ($__dbcconfig | Where-Object Name -EQ 'skip.database.recoverymodel').Value\n\n    Context \"Testing Recovery Model on <_.Name>\" {\n        It \"Database <_.Name> should be set to <_.ConfigValues.recoverymodeltype> on <_.SqlInstance>\" -Skip:$skip -ForEach $psitem.Databases.Where{ if ($Database) { $_.Name -in $Database } else { $psitem.ConfigValues.recoverymodelexclude -notcontains $psitem.Name } } {\n            $psitem.RecoveryModel | Should -Be $psitem.ConfigValues.recoverymodeltype -Because \"You expect this recovery model.\"\n        }\n    }\n}\n\nDescribe \"PseudoSimple Recovery Model\" -Tag PseudoSimple, Medium, Database -ForEach $InstancesToTest {\n    $Skip = ($__dbcconfig | Where-Object Name -EQ 'skip.database.pseudosimple').Value\n\n    Context \"Testing database is not in PseudoSimple recovery model on <_.Name>\" {\n        It \"Database <_.Name> has PseudoSimple recovery model equal false on <_.SqlInstance>\" -Skip:$skip -ForEach $psitem.Databases.Where{ if ($Database) { $_.Name -in $Database -and $_.RecoveryModel -eq 'Full' } else { $psitem.ConfigValues.pseudosimpleexclude -notcontains $psitem.Name -and $_.RecoveryModel -eq 'Full' } } {\n            $psitem.PseudoSimple | Should -BeFalse -Because \"PseudoSimple means that a FULL backup has not been taken and the database is still effectively in SIMPLE mode\"\n        }\n    }\n}\n\nDescribe \"Contained Database Auto Close\" -Tag ContainedDBAutoClose, CIS, Database -ForEach $InstancesToTest {\n    $Skip = ($__dbcconfig | Where-Object Name -EQ 'skip.security.containedbautoclose').Value\n\n    Context \"Testing contained database auto close option on <_.Name>\" {\n        It \"Database <_.Name> should have auto close set to false on <_.SqlInstance>\" -Skip:$skip -ForEach $psitem.Databases.Where{ if ($Database) { $_.Name -in $Database -and $_.ContainmentType -ne \"NONE\" } else { $psitem.ConfigValues.contdbautocloseexclude -notcontains $psitem.Name -and $_.ContainmentType -ne \"NONE\" } } {\n            $psitem.ContainedDbAutoClose | Should -BeFalse -Because \"Contained Databases should have auto close set to false for CIS compliance.\"\n        }\n    }\n}\n\nDescribe \"Contained Database SQL Authenticated Users\" -Tag ContainedDBSQLAuth, CIS, Database -ForEach $InstancesToTest {\n    $Skip = ($__dbcconfig | Where-Object Name -EQ 'skip.security.ContainedDBSQLAuth').Value\n\n    #TODO: something with this?\n    #if ($version -lt 13 ) { $skip = $true }\n\n    Context \"Testing contained database to see if sql authenticated users exist on <_.Name>\" {\n        It \"Database <_.Name> should have no sql authenticated users on <_.SqlInstance>\" -Skip:$skip -ForEach $psitem.Databases.Where{ if ($Database) { $_.Name -in $Database -and $_.ContainmentType -ne \"NONE\" } else { $psitem.ConfigValues.contdbsqlauthexclude -notcontains $psitem.Name -and $_.ContainmentType -ne \"NONE\" } } {\n            $psitem.ContainedDbSqlAuthUsers | Should -Be 0 -Because \"We expect there to be no sql authenticated users in contained database.\"\n        }\n    }\n}\n\nDescribe \"Page Verify\" -Tag PageVerify, Medium, Database -ForEach $InstancesToTest {\n    $Skip = ($__dbcconfig | Where-Object Name -EQ 'skip.database.pageverify').Value\n    Context \"Testing page verify on <_.Name>\" {\n\n        # handle differently depending on major version - not available at all in SQL 2000. 2005 not available on tempdb.\n        if($psitem.MajorVersion -eq 8) {\n            It \"Database Page verify is not available on SQL 2000 on <_.SqlInstance>\" {\n                $true | Should -BeTrue\n            }\n        } elseif ($psitem.MajorVersion -eq 9) {\n            It \"Database <_.Name> should have page verify set to <_.ConfigValues.pageverify> on <_.SqlInstance>\" -Skip:$skip -ForEach $psitem.Databases.Where{ if ($Database) { $_.Name -in $Database } else { $psitem.ConfigValues.pageverifyexclude -notcontains $psitem.Name } } {\n                if($psitem.Name -ne 'tempdb') {\n                    $psitem.PageVerify | Should -Be $psitem.ConfigValues.PageVerify -Because \"Page verify helps SQL Server to detect corruption\"\n                } else {\n                    $true | Should -BeTrue\n                }\n            }\n        } else {\n            It \"Database <_.Name> should have page verify set to <_.ConfigValues.pageverify> on <_.SqlInstance>\" -Skip:$skip -ForEach $psitem.Databases.Where{ if ($Database) { $_.Name -in $Database } else { $psitem.ConfigValues.pageverifyexclude -notcontains $psitem.Name -and $_.Name -ne 'tempdb'} } {\n                $psitem.PageVerify | Should -Be $psitem.ConfigValues.PageVerify -Because \"Page verify helps SQL Server to detect corruption.\"\n            }\n            #tempdb handled like v4\n            It \"Database Page verify is not available on tempdb on SQL 2005 on <_.SqlInstance>\" -Skip:$skip -ForEach $psitem.Databases.Where{ $_.Name -eq 'tempdb' } {\n                $psitem.PageVerify | Should -Be $psitem.ConfigValues.PageVerify -Because \"Page verify helps SQL Server to detect corruption.\"\n            }\n        }\n    }\n}\n\nDescribe  \"Foreign keys and check constraints not trusted\" -Tag FKCKTrusted, Low, Database -ForEach $InstancesToTest {\n    $Skip = ($__dbcconfig | Where-Object Name -EQ 'skip.database.fkcktrusted').Value\n        Context \"Testing Foreign Keys and Check Constraints are not trusted  <_.Name>\" {\n\n        It \"Database <_.Database> Foreign Key <_.Name> on table <_.Parent> should be trusted on <_.SqlInstance>\" -Skip:$skip -ForEach $psitem.Databases.Where{ if ($Database) { $_.Name -in $Database } else { $psitem.ConfigValues.fkcktrustedexclude -notcontains $psitem.Name } }.ForeignKeys {\n            $psitem.IsChecked | Should -Be $true -Because \"This can have a huge performance impact on queries. SQL Server won't use untrusted constraints to build better execution plans. It will also avoid data violation\"\n        }\n\n        It \"Database <_.Database> Foreign Key <_.Name> on table <_.Parent> should be trusted on <_.SqlInstance>\" -Skip:$skip -ForEach $psitem.Databases.Where{ if ($Database) { $_.Name -in $Database } else { $psitem.ConfigValues.fkcktrustedexclude -notcontains $psitem.Name } }.Constraints {\n            $psitem.IsChecked | Should -Be $true -Because \"This can have a huge performance impact on queries. SQL Server won't use untrusted constraints to build better execution plans. It will also avoid data violation\"\n        }\n    }\n}\n\n"
  },
  {
    "path": "source/checks/Domain.Tests.ps1",
    "content": "$filename = $MyInvocation.MyCommand.Name.Replace(\".Tests.ps1\", \"\")\n\nDescribe \"Active Directory Domain Name\" -Tags DomainName, $filename {\n    $domain = Get-DbcConfigValue domain.name\n    @(Get-ComputerName).ForEach{\n        Context \"Testing Active Directory Domain Name on $psitem\" {\n            if ($IsLinux) {\n                It \"Running on Linux so cant check AD for now on the Domain $domain\" -Skip {\n                    (Get-DbaCmObject -Class Win32_ComputerSystem -ComputerName $psitem -Credential $credential).Domain | Should -Be $domain -Because 'The machine needs to be on the domain'\n                }\n            }\n            else {\n                It \"$psitem should be on the Domain $domain\" {\n                    (Get-DbaCmObject -Class Win32_ComputerSystem -ComputerName $psitem -Credential $credential).Domain | Should -Be $domain -Because 'The machine needs to be on the domain'\n                }\n            }\n        }\n    }\n}\n\n# Skipping this for now until we get AdsiPS command equiv\nDescribe \"Active Directory OU\" -Tags OrganizationalUnit, $filename {\n    $dc = Get-DbcConfigValue domain.domaincontroller\n    @(Get-ComputerName).ForEach{\n        if ($IsLinux) {\n            Context \"Testing Active Directory OU on $psitem\" {\n                It \"Running on Linux so cant check AD for now on the Domain $domain\" -Skip {\n                    (Get-DbaCmObject -Class Win32_ComputerSystem -ComputerName $psitem -Credential $credential).Domain | Should -Be $domain -Because 'The machine needs to be on the domain'\n                }\n            }\n        }\n        else {\n            Context \"Testing Active Directory OU on $psitem\" {\n                if (-not $value) {\n                    # Can be passed by Invoke-DbcCheck -Value\n                    $value = Get-DbcConfigValue domain.organizationalunit\n                }\n                It -Skip \"$psitem should be in the right OU ($value on the Domain $domain\" {\n                    (Get-ADComputer $psitem -Properties CanonicalName -Server $dc).CanonicalName | Should -Be $value -Because 'The SQL Server should be in the correct OU'\n                }\n            }\n        }\n    }\n}\n    # SIG # Begin signature block\n    # MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n    # gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n    # AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUklzltAHEzTKwTAEUv/9O8d+T\n    # HOOgggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n    # AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n    # VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz\n    # c3VyZWQgSUQgQ29kZSBTaWduaW5nIENBMB4XDTE3MDUwOTAwMDAwMFoXDTIwMDUx\n    # MzEyMDAwMFowVzELMAkGA1UEBhMCVVMxETAPBgNVBAgTCFZpcmdpbmlhMQ8wDQYD\n    # VQQHEwZWaWVubmExETAPBgNVBAoTCGRiYXRvb2xzMREwDwYDVQQDEwhkYmF0b29s\n    # czCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAI8ng7JxnekL0AO4qQgt\n    # Kr6p3q3SNOPh+SUZH+SyY8EA2I3wR7BMoT7rnZNolTwGjUXn7bRC6vISWg16N202\n    # 1RBWdTGW2rVPBVLF4HA46jle4hcpEVquXdj3yGYa99ko1w2FOWzLjKvtLqj4tzOh\n    # K7wa/Gbmv0Si/FU6oOmctzYMI0QXtEG7lR1HsJT5kywwmgcjyuiN28iBIhT6man0\n    # Ib6xKDv40PblKq5c9AFVldXUGVeBJbLhcEAA1nSPSLGdc7j4J2SulGISYY7ocuX3\n    # tkv01te72Mv2KkqqpfkLEAQjXgtM0hlgwuc8/A4if+I0YtboCMkVQuwBpbR9/6ys\n    # Z+sCAwEAAaOCAcUwggHBMB8GA1UdIwQYMBaAFFrEuXsqCqOl6nEDwGD5LfZldQ5Y\n    # MB0GA1UdDgQWBBRcxSkFqeA3vvHU0aq2mVpFRSOdmjAOBgNVHQ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QuY29tL0RpZ2lDZXJ0QXNzdXJlZElEUm9v\n    # dENBLmNybDA6oDigNoY0aHR0cDovL2NybDMuZGlnaWNlcnQuY29tL0RpZ2lDZXJ0\n    # QXNzdXJlZElEUm9vdENBLmNybDBPBgNVHSAESDBGMDgGCmCGSAGG/WwAAgQwKjAo\n    # BggrBgEFBQcCARYcaHR0cHM6Ly93d3cuZGlnaWNlcnQuY29tL0NQUzAKBghghkgB\n    # hv1sAzAdBgNVHQ4EFgQUWsS5eyoKo6XqcQPAYPkt9mV1DlgwHwYDVR0jBBgwFoAU\n    # Reuir/SSy4IxLVGLp6chnfNtyA8wDQYJKoZIhvcNAQELBQADggEBAD7sDVoks/Mi\n    # 0RXILHwlKXaoHV0cLToaxO8wYdd+C2D9wz0PxK+L/e8q3yBVN7Dh9tGSdQ9RtG6l\n    # jlriXiSBThCk7j9xjmMOE0ut119EefM2FAaK95xGTlz/kLEbBw6RFfu6r7VRwo0k\n    # riTGxycqoSkoGjpxKAI8LpGjwCUR4pwUR6F6aGivm6dcIFzZcbEMj7uo+MUSaJ/P\n    # QMtARKUT8OZkDCUIQjKyNookAv4vcn4c10lFluhZHen6dGRrsutmQ9qzsIzV6Q3d\n    # 9gEgzpkxYz0IGhizgZtPxpMQBvwHgfqL2vmCSfdibqFT+hKUGIUukpHqaGxEMrJm\n    # oecYpJpkUe8xggIoMIICJAIBATCBhjByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMM\n    # RGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQD\n    # EyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgQ29kZSBTaWduaW5nIENBAhACwXUo\n    # dNXChDGFKtigZGnKMAkGBSsOAwIaBQCgeDAYBgorBgEEAYI3AgEMMQowCKACgACh\n    # AoAAMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcCAQsxDjAM\n    # BgorBgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBRx8dv3PekUmlV8Rz9sY6Ty3Q/s\n    # UTANBgkqhkiG9w0BAQEFAASCAQBhFAAiJgB6pgO+LwQQ3O5BmJhr1n1/YSShreGY\n    # KItAbsLUcO997zp2LFt7/sCRwH0BBv5GQ7D+tmmO/r07cWy9b0TjhXxK+I3/IJ0J\n    # JIYeYw1ABkROGRyus0NKe6oqu25wxSxCS2z0+v2P/tQ609ZzpNsgrQmfSbrVRk0x\n    # uIiDHOGzr4+POPOy1xMBHpX8PKMinkN+bQ3c0Gk78UaLwez8XeTWbnTxX8AYVafY\n    # wQWwO37nKICW+Gs+PuG+MweRZDHcc0Mwc+OHCtllcQtDXtZre1bgk9egCe5WyNW4\n    # Ym7OEK/rO7dAkrJ4vH4XXuqN5DfMqLcJS1Q47/P8EPPXtNfJ\n    # SIG # End signature block\n\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUC91oynVUf6FC/nbP2lsYpmtq\n# zoSgggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz\n# c3VyZWQgSUQgQ29kZSBTaWduaW5nIENBMB4XDTE3MDUwOTAwMDAwMFoXDTIwMDUx\n# MzEyMDAwMFowVzELMAkGA1UEBhMCVVMxETAPBgNVBAgTCFZpcmdpbmlhMQ8wDQYD\n# VQQHEwZWaWVubmExETAPBgNVBAoTCGRiYXRvb2xzMREwDwYDVQQDEwhkY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ARKUT8OZkDCUIQjKyNookAv4vcn4c10lFluhZHen6dGRrsutmQ9qzsIzV6Q3d\n# 9gEgzpkxYz0IGhizgZtPxpMQBvwHgfqL2vmCSfdibqFT+hKUGIUukpHqaGxEMrJm\n# oecYpJpkUe8xggIoMIICJAIBATCBhjByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMM\n# RGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQD\n# EyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgQ29kZSBTaWduaW5nIENBAhACwXUo\n# dNXChDGFKtigZGnKMAkGBSsOAwIaBQCgeDAYBgorBgEEAYI3AgEMMQowCKACgACh\n# AoAAMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcCAQsxDjAM\n# BgorBgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBT0LyaihpRitMUpdyWpMdCpJPcK\n# 8zANBgkqhkiG9w0BAQEFAASCAQBSkt/Q2VceY4P4UfP7kx4FvqeMW6u+4oJLgyPZ\n# K9veRmOHtzIi/yvN/xr2qNIRmx0a5S0wYSCBZslizEt6ba+eq5/a/Cg0IMp1hdrj\n# rK18kvcjJGnxY1DtAsup+woi7Uw1lhA6UQ7V5T72L1fE2QkBxCgRsSfAdW02Yclf\n# 6YdqAt2LDuoDFFKloDo5CXZdo8Barlh/LrtklHIJtzemwvVyZi4HDT1dDxXzXHEE\n# ta3qAYtZy0OwS1PlC8tjvDy5KaVRID/yR1MjjVYo82W8mwn6VX69pCEdPf4o+QhE\n# lCwQSMdwro8Nfiar4xrhQpHQeEYDOOskVATzAL1UQ4gLuN93\n# SIG # End signature block\n"
  },
  {
    "path": "source/checks/HADR.Tests.ps1",
    "content": "$filename = $MyInvocation.MyCommand.Name.Replace(\".Tests.ps1\", \"\")\n\n# Get all the info in the function\nfunction Get-ClusterObject {\n    [CmdletBinding()]\n    param (\n        [string]$ClusterVM\n    )\n\n    [PsCustomObject]$return = @{ }\n    # Don't think you can use the cluster name here it won't run remotely\n    try {\n        $ErrorActionPreference = 'Stop'\n        $return.Cluster = (Get-Cluster -Name $ClusterVM)\n        $return.Nodes = (Get-ClusterNode -Cluster $ClusterVM)\n        $return.Resources = (Get-ClusterResource -Cluster $ClusterVM)\n        $return.Network = (Get-ClusterNetwork -Cluster $ClusterVM)\n        $return.Groups = (Get-ClusterGroup -Cluster $ClusterVM)\n        $return.AGs = $return.Resources.Where{ $psitem.ResourceType -eq 'SQL Server Availability Group' }\n    }\n    catch {\n        $return.Cluster = 'FailedToConnect'\n        $return.Nodes = 'FailedToConnect'\n        $return.Resources = 'FailedToConnect'\n        $return.Network = 'FailedToConnect'\n        $return.Groups = 'FailedToConnect'\n        $return.AGs = 'FailedToConnect'\n    }\n    $return.AvailabilityGroups = @{ }\n    #Add all the AGs\n    foreach ($AGResource in $return.AGs) {\n        try {\n            # Because several replicas can be on the same cluster node,\n            # cluster node can appear several times, then we want to\n            # avoid duplicate detection of replicas\n            If ($PreviousClusterNode -ne $AGResource.OwnerNode.Name) {\n                $PreviousClusterNode = $AGResource.OwnerNode.Name\n                # We get cluster node owner first ...\n                # We need then for each owner to find out the corresponding replicas => SQL Instance Name + Port\n                $Replicas = Find-DbaInstance -ComputerName $AGResource.OwnerNode.Name\n            }\n\n            # Finally for each replica detected (SQL Server + Port)\n            # We try to find the corresponding AG(s) info\n            foreach ($replica in $Replicas){\n                $AGs = Get-DbaAvailabilityGroup -SqlInstance \"$($replica.ComputerName),$($replica.Port)\"\n\n                foreach ($AG in $AGs){\n                    If ($AG.AvailabilityGroup -eq $AGResource.Name) {\n                        $return.AvailabilityGroups[$AGResource.Name] = $AG\n                    }\n                }\n            }\n        }\n        catch {\n            $return = $null\n        }\n    }\n\n    Return $return\n}\n\n# Import module or bomb out\n\n# needs the failover cluster module\nif (-not (Get-Module FailoverClusters)) {\n    try {\n        if ($IsCoreCLR) {\n            Stop-PSFFunction -Message \"FailoverClusters module cannot be loaded in PowerShell Core unfortunately\" -ErrorRecord $psitem\n            return\n        }\n        else {\n            Import-Module FailoverClusters -ErrorAction Stop\n        }\n    }\n    catch {\n        Stop-PSFFunction -Message \"FailoverClusters module could not load - Please install the Failover Cluster module using Windows Features \" -ErrorRecord $psitem\n        return\n    }\n}\nelse {\n    if ($IsCoreCLR) {\n        Stop-PSFFunction -Message \"FailoverClusters module cannot be loaded in PowerShell Core unfortunately\" -ErrorRecord $psitem\n        return\n    }\n}\n\n# Grab some values\n$clusters = Get-DbcConfigValue app.cluster\n$skipClusterNetInterface = Get-DbcConfigValue skip.cluster.netclusterinterface\n$skipAgListenerPing = Get-DbcConfigValue skip.hadr.listener.pingcheck\n$skipAgListenerTcpPort = Get-DbcConfigValue skip.hadr.listener.tcpport\n$skipReplicaTcpPort = Get-DbcConfigValue skip.hadr.replica.tcpport\n$domainName = Get-DbcConfigValue domain.name\n$agTcpPort = Get-DbcConfigValue policy.hadr.agtcpport\n$sqlTcpPort = Get-DbcConfigValue policy.hadr.tcpport\n\n# hadr endpoint config parameters\n$hadrEndPointName = Get-DbcConfigValue policy.hadr.endpointname\n$hadrEndPointPort = Get-DbcConfigValue policy.hadr.endpointport\n$hadrSessionTimeout = Get-DbcConfigValue policy.hadr.sessiontimeout\n\n# cluster config parameters\n$clustAgResFailureConditionLevel = Get-DbcConfigValue policy.hadr.failureconditionlevel\n$clustAgResHealthCheckTimeout = Get-DbcConfigValue policy.hadr.healthchecktimeout\n$clustAgResLeaseTimeout = Get-DbcConfigValue policy.hadr.leasetimeout\n$clustPrivateNetworkProtocolsIPV4 = Get-DbcConfigValue policy.cluster.NetworkProtocolsIPV4\n$clustAgReshostRecordTTL = Get-DbcConfigValue policy.cluster.hostrecordttl\n$clustAgResRegisterAllProvidersIP = Get-DbcConfigValue policy.cluster.registerallprovidersIP\n\n#Check for Cluster config value\nif ($clusters.Count -eq 0) {\n    Write-Warning \"No Clusters to look at. Please use Set-DbcConfig -Name app.cluster to add clusters for checking\"\n    break\n}\n\n\nforeach ($clustervm in $clusters) {\n    try {\n        # pick the name here for the output - we cant use it as we are accessing remotely\n        $clustername = (Get-Cluster -Name $clustervm -ErrorAction Stop).Name\n    }\n    catch {\n        # so that we don't get the error and Get-ClusterObject fills it as FailedtoConnect\n        $clustername = $clustervm\n    }\n\n    Describe \"Cluster $clustername Health using Node $clustervm\" -Tags ClusterHealth, $filename {\n        $return = @(Get-ClusterObject -ClusterVM $clustervm)\n\n        Context \"Cluster nodes for $clustername\" {\n            @($return.Nodes).ForEach{\n                It \"This node should be available - Node $($psitem.Name)\" {\n                    $psitem.State | Should -Be 'Up' -Because 'Every node in the cluster should be available'\n                }\n            }\n        }\n        Context \"Cluster resources for $clustername\" {\n            # Get the resources that are no IP Addresses with an owner of Availability Group\n            $return.Resources.Where{ ( $_.ResourceType -in ($_.ResourceType -ne 'IP Address') ) -and ($_.OwnerGroup -in $Return.Ags) }.ForEach{\n                It \"This resource should be online - Resource $($psitem.Name)\" {\n                    $psitem.State | Should -Be 'Online' -Because 'All of the cluster resources should be online'\n                }\n            }\n            # Get the resources where IP Address is owned by AG and group by AG\n            @($return.Resources.Where{ $_.ResourceType -eq 'IP Address' -and $_.OwnerGroup -in $return.AGs } | Group-Object -Property OwnerGroup).ForEach{\n                It \"One of the IP Addresses should be online for AvailabilityGroup $($Psitem.Name)\" {\n                    $psitem.Group.Where{ $_.State -eq 'Online' }.Count | Should -Be 1 -Because \"There should be one IP Address online for Availability Group $($PSItem.Name)\"\n                }\n            }\n\n            $return.Resources.Where{ $_.ResourceType -eq 'Network Name' -and $_.OwnerGroup -in $return.AGs }.ForEach{\n                It \"HostRecordTTL should be $clustAgReshostRecordTTL for Resource $($PSItem.Name)\"  {\n                    $hostRecordTTL = ($PSItem | Get-ClusterParameter | Where-Object { $_.Name -eq 'HostRecordTTL' }).Value\n                    $hostRecordTTL | Should -be $clustAgReshostRecordTTL -Because \"$clustAgReshostRecordTTL is what we expect to be for hostRecordTTL\"\n                }\n                It \"RegisterAllProvidersIP should be $clustAgResRegisterAllProvidersIP for Resource $($PSItem.Name)\" {\n                    $RegisterAllProvidersIP = ($PSItem | Get-ClusterParameter | Where-Object { $_.Name -eq 'RegisterAllProvidersIP' }).Value\n                    $RegisterAllProvidersIP | Should -be $clustAgResRegisterAllProvidersIP -Because \"$clustAgResRegisterAllProvidersIP is what we expect to be for RegisterAllProvidersIP\"\n                }\n                It \"StatusNetBIOS should be $clustAgResStatusNetBIOS for Resource $($PSItem.Name)\" {\n                    $StatusNetBIOS = ($PSItem | Get-ClusterParameter | Where-Object { $_.Name -eq 'StatusNetBIOS' }).Value\n                    $StatusNetBIOS | Should -be 0 -Because \"NetBIOS State should be healthy\"\n                }\n                It \"StatusDNS should be $clustAgStatusDNS for Resource $($PSItem.Name)\" {\n                    $StatusDNS = ($PSItem | Get-ClusterParameter | Where-Object { $_.Name -eq 'StatusDNS' }).Value\n                    $StatusDNS | Should -be 0 -Because \"DNS State should be healthy\"\n                }\n                It \"StatusKerberos should be $clustAgStatusKerberos for Resource $($PSItem.Name)\" {\n                    $StatusKerberos = ($PSItem | Get-ClusterParameter | Where-Object { $_.Name -eq 'StatusKerberos' }).Value\n                    $StatusKerberos | Should -be 0 -Because \"Kerberos State should be healthy\"\n                }\n            }\n        }\n        Context \"Cluster network for $clustername\" {\n            It \"At least 2 dedicated networks for the cluster should exist for cluster $clustername\" -Skip:$skipClusterNetInterface {\n                $return.Network.count | Should -BeGreaterOrEqual 2 -Because \"To prevent heartbeat traffic to be overwhelmed by the public workload\"\n            }\n            It \"One Cluster Network interface should be dedicated for cluster traffic for cluster $clustername\" -Skip:$skipClusterNetInterface {\n                $return.network.Role | Should -Contain 'Cluster' -Because \"Heartbeat traffic is sensitive to network latency and network interface should be dedicated for this specific usage\"\n            }\n            It \"One Cluster Network interface should be dedicated for public traffic for cluster $clustername\" {\n                $return.network.Role | Should -Contain 'ClusterAndClient' -Because \"Public network is mandatory to handle public workload\"\n            }\n\n            $ClusterNetwork = $return.Network | Where-Object { $_.Role -eq 'Cluster' }\n            Foreach ($node in $return.Nodes){\n\n                $ReplicaNetInterfaces = Get-DbaWsfcNetworkInterface -ComputerName $clustervm | `\n                                        Where-Object { $_.Network -eq $ClusterNetwork.Name -And $_.Node -eq $node.Name}\n\n                Foreach ($rni in $ReplicaNetInterfaces | Where-Object { $_.IPv4Addresses -ne $null }){\n                    $netinterface = ($rni.Name.Split('-')[1]).Trim()\n                    $netbindings = Get-NetAdapter -Name $netinterface -CimSession $node.Name | `\n                                    Get-NetAdapterBinding | `\n                                    Where-Object { $_.Enabled -eq $true }\n                    It \"Only required network protocols should be configured for IPV4 cluster interface on node $($node.Name)\" -Skip:$skipClusterNetInterface {\n                        $netbindings.Count | Should -Be $clustPrivateNetworkProtocolsIPV4.Count -Because \"Heartbeat traffic is sensitive to network latency and network protocols should be configured optimally\"\n                    }\n                    $IpConfig = Get-NetIPConfiguration -CimSession $node.Name -InterfaceAlias $netinterface\n                    It \"No default gateway should be configured for cluster network interface - Node $($node.Name)\" -Skip:$skipClusterNetInterface {\n                        $IpConfig.IPv4DefaultGateway | Should -BeNullOrEmpty -Because \"Heartbeat traffic should not be routable\"\n                    }\n                    $IpDNS = Get-DnsClientServerAddress -CimSession $node.Name -InterfaceAlias $netinterface\n                    It \"No DNS entries should be configured for cluster network interface - Node $($node.Name)\" -Skip:$skipClusterNetInterface {\n                        $IpDNS.ServerAddresses.Count | Should -Be 0 -Because \"Heartbeat traffic doesn't use DNS resolution\"\n                    }\n                    $DNSRegistration = Get-NetAdapter `\n                                        -Name $netinterface `\n                                        -CimSession $node.Name | Get-DNSClient\n                    It \"DNS Registration should be disabled for cluster network interface - Node $($node.Name)\" -Skip:$skipClusterNetInterface {\n                        $DNSRegistration.RegisterThisConnectionsAddress | Should -Be $false -Because \"Heartbeat traffic doesn't use DNS resolution\"\n                    }\n                    $AdapterNetBios = Get-CimInstance `\n                                        -ClassName 'Win32_NetworkAdapterConfiguration' `\n                                        -CimSession $node.Name `\n                                        -Filter \"InterfaceIndex = $((Get-NetAdapter -CimSession $node.Name -Name $netinterface).ifIndex)\"\n\n                    It \"NetBios Over TCP/IP should be disabled for cluster network interface - Node $($node.Name)\" -Skip:$skipClusterNetInterface {\n                        $AdapterNetBios.TcpipNetbiosOptions | Should -Be 2 -Because \"Heartbeat traffic doesn't use NetBios resolution\"\n                    }\n                }\n            }\n\n            @($return.Network).ForEach{\n                It \"The Network should be up - Network $($psitem.Name)\" {\n                    $psitem.State | Should -Be 'Up' -Because 'All of the Cluster Networks should be up'\n                }\n            }\n        }\n\n        $AGResources = $return.Resources | Where-Object { $_.ResourceType -eq 'SQL Server Availability Group'}\n\n        Context \"Cluster Availability Group Resources for $clustername\" {\n            ForEach($AGRes in $AGResources){\n                It \"Failure Condition Level should be $clustAgResFailureConditionLevel for AG Resource $($AGRes.Name)\" {\n                    $AGResourceResult = $AGRes | Get-ClusterParameter | Where-Object { $_.Name -eq 'FailureConditionLevel' }\n                    $AGResourceResult.Value | Should -Be $clustAgResFailureConditionLevel -Because \"$clustAgResFailureConditionLevel is what we expect to be for Flexible automatic failover policy\"\n                }\n                It \"HealthCheck Timeout should be $clustAgResHealthCheckTimeout for AG Resource $($AGRes.Name)\" {\n                    $AGResourceResult = $AGRes | Get-ClusterParameter | Where-Object { $_.Name -eq 'HealthCheckTimeout' }\n                    $AGResourceResult.Value | Should -Be $clustAgResHealthCheckTimeout -Because \"$clustAgResHealthCheckTimeout is what we expect to be for health check timeout\"\n                }\n                It \"Lease Timeout should be $clustAgResLeaseTimeout for AG Resource $($AGRes.Name)\" {\n                    $AGResourceResult = $AGRes | Get-ClusterParameter | Where-Object { $_.Name -eq 'LeaseTimeout' }\n                    $AGResourceResult.Value | Should -Be $clustAgResLeaseTimeout -Because \"$clustAgResLeaseTimeout is what we expect to be for lease timeout\"\n                }\n            }\n        }\n\n        $AGs = $return.AGs.Name\n        foreach ($AGName in $AGs) {\n            $AG = @($return.AvailabilityGroups[$AGName])\n\n            Context \"HADR status for $($AG.SqlInstance) on $clustername\" {\n                It \"HADR should be enabled on the replica $($AG.SqlInstance)\" {\n                    try {\n                        $HADREnabled = (Get-DbaAgHadr -SqlInstance $AG.SqlInstance -WarningAction SilentlyContinue).IsHadrEnabled\n                    }\n                    catch {\n                        $HADREnabled = $false\n                    }\n                    $HADREnabled | Should -BeTrue -Because 'All of the nodes should have HADR enabled'\n                }\n            }\n\n            Context \"Cluster Connectivity for Availability Group $($AG.Name) on $clustername\" {\n                @($AG.AvailabilityGroupListeners).ForEach{\n                    try {\n                        $results = Test-DbaConnection -SqlInstance $_.Name\n                    }\n                    Catch {\n                        $results = [PSCustomObject]@{\n                            IsPingable     = $false\n                            ConnectSuccess = $false\n                            DomainName     = $false\n                            TCPPort        = $false\n                        }\n                    }\n\n                    It \"Listener should be pingable for $($results.SqlInstance)\" -skip:$skipaglistenerping {\n                        $results.IsPingable | Should -BeTrue -Because 'The listeners should be pingable'\n                    }\n                    It \"Listener should be connectable on $($results.SqlInstance)\" {\n                        $results.ConnectSuccess | Should -BeTrue -Because 'The listener should process SQL commands successfully'\n                    }\n\n                    It \"Listener domain name should be $domainname on $($results.SqlInstance)\" {\n                        $results.DomainName | Should -Be $domainname -Because \"$domainname is what we expect the domain name to be\"\n                    }\n                }\n\n                @($AG.AvailabilityReplicas).ForEach{\n                    $results = Test-DbaConnection -SqlInstance $PsItem.Name\n                    It \"Replica should be Pingable for $($results.SqlInstance)\" {\n                        $results.IsPingable | Should -BeTrue -Because 'Each replica should be pingable'\n                    }\n                    It \"Should be able to connect with SQL on Replica $($results.SqlInstance)\" {\n                        $results.ConnectSuccess | Should -BeTrue -Because 'Each replica should be able to process SQL commands'\n                    }\n\n                    It \"Replica domain name should be $domainname on Replica $($results.SqlInstance)\" {\n                        $results.DomainName | Should -Be $domainname -Because \"$domainname is what we expect the domain name to be\"\n                    }\n\n                    # Consolidated environments with multi-instances / AG replicas\n                    # In this case we cannot configure the same tcpport than those used for AG listeners\n                    # TCP port conflict\n                    # Adding exclusion for these scenarios\n\n                    It \"HADR TCP port should be in $tcpport for replica $($results.SqlInstance)\" -Skip:$skipReplicaTcpPort {\n                        $results.TCPPort | Should -BeIn $sqlTcpPort -Because \"We expect the TCP Port to be in $sqlTcpPort\"\n                    }\n\n                    $resultshadrendpoint = Get-DbaEndpoint -SqlInstance $results.SqlInstance -Endpoint $hadrEndPointName\n                    It \"HADR endpoint name should be $hadrEndPointName for replica $($results.SqlInstance)\" {\n                        $resultshadrendpoint.Name | Should -BeIn $hadrEndPointName -Because \"$hadrEndPointName is what we expect the compliant name to be\"\n                    }\n                    It \"HADR TCP endpoint state should be Started for replica $($results.SqlInstance)\" {\n                        $resultshadrendpoint.EndpointState | Should -BeIn \"Started\" -Because \"We expect the HADR Endpoint to get ready for log block replication\"\n                    }\n\n                    It \"Session timeout should be $hadrSessionTimeout for replica $($results.SqlInstance)\" {\n                        $replica = Get-DbaAgReplica -SqlInstance $PsItem.Name\n                        $replica.SessionTimeout | Should -BeIn $hadrSessionTimeout -Because \"$hadrSessionTimeout is what we expect the session time value to be\"\n                    }\n                }\n            }\n\n            Context \"Availability group status for $($AG.Name) on $clustername\" {\n                @($AG.AvailabilityReplicas).ForEach{\n                    It \"The replica should not be in unknown availability mode for $($psitem.Name)\" {\n                        $psitem.AvailabilityMode | Should -Not -Be 'Unknown' -Because 'The replica should not be in unknown state'\n                    }\n                }\n                @($AG.AvailabilityReplicas).Where{ $psitem.AvailabilityMode -eq 'SynchronousCommit' }.ForEach{\n                    It \"The replica should be synchronised $($psitem.Name)\" {\n                        $psitem.RollupSynchronizationState | Should -Be 'Synchronized' -Because 'The synchronous replica should be synchronised'\n                    }\n                }\n                $AG.AvailabilityReplicas.Where{ $psitem.AvailabilityMode -eq 'ASynchronousCommit' }.ForEach{\n                    It \"The replica should be synchronising $($psitem.Name)\" {\n                        $psitem.RollupSynchronizationState | Should -Be 'Synchronizing' -Because 'The asynchronous replica should be synchronizing '\n                    }\n                }\n                @($AG.AvailabilityReplicas).Where.ForEach{\n                    It \"The replica should be connected $($psitem.Name)\" {\n                        $psitem.ConnectionState | Should -Be 'Connected' -Because 'The replica should be connected'\n                    }\n                }\n            }\n\n            Context \"Database availability group status for $($AG.Name) on $clustername\" {\n                @($ag.AvailabilityReplicas.Where{ $_.AvailabilityMode -eq 'SynchronousCommit' }).ForEach{\n                    @(Get-DbaAgDatabase -SqlInstance $psitem.Name -AvailabilityGroup $Ag.Name).ForEach{\n                        It \"Database $($psitem.Name) should be synchronised on the replica $($psitem.sqlInstance)\" {\n                            $psitem.SynchronizationState | Should -Be 'Synchronized'  -Because 'The database on the synchronous replica should be synchronised'\n                        }\n                        It \"Database $($psitem.Name) should be failover ready on the replica $($psitem.sqlInstance)\" {\n                            $psitem.IsFailoverReady | Should -BeTrue -Because 'The database on the synchronous replica should be ready to failover'\n                        }\n                        It \"Database $($psitem.Name) should be joined on the  replica $($psitem.sqlInstance)\" {\n                            $psitem.IsJoined | Should -BeTrue -Because 'The database on the synchronous replica should be joined to the availability group'\n                        }\n                        It \"Database $($psitem.Name) should not be suspended on the replica $($psitem.sqlInstance)\" {\n                            $psitem.IsSuspended | Should -Be  $False -Because 'The database on the synchronous replica should not be suspended'\n                        }\n                    }\n                }\n                @($ag.AvailabilityReplicas.Where{ $_.AvailabilityMode -eq 'AsynchronousCommit' }).ForEach{\n                    @(Get-DbaAgDatabase -SqlInstance $PSItem.Name -AvailabilityGroup $Ag.Name).ForEach{\n                        It \"Database $($psitem.Name) should be synchronising as it is Async on the secondary replica $($psitem.sqlInstance)\" {\n                            $psitem.SynchronizationState | Should -Be 'Synchronizing' -Because 'The database on the asynchronous secondary replica should be synchronising'\n                        }\n                        It \"Database $($psitem.Name) should not be failover ready on the secondary replica $($psitem.sqlInstance)\" {\n                            $psitem.IsFailoverReady | Should -BeFalse -Because 'The database on the asynchronous secondary replica should be ready to failover'\n                        }\n                        It \"Database $($psitem.Name) should be joined on the secondary replica $($psitem.sqlInstance)\" {\n                            $psitem.IsJoined | Should -BeTrue -Because 'The database on the asynchronous secondary replica should be joined to the availability group'\n                        }\n                        It \"Database $($psitem.Name) should not be suspended on the secondary replica $($psitem.sqlInstance)\" {\n                            $psitem.IsSuspended | Should -Be  $False -Because 'The database on the asynchronous secondary replica should not be suspended'\n                        }\n                    }\n                }\n            }\n\n            Context \"Always On extended event status for replica $($AG.SqlInstance) on $clustername\" {\n                try {\n                    $Xevents = Get-DbaXEsession -SqlInstance $AG.SqlInstance -WarningAction SilentlyContinue\n                }\n                catch {\n                    $Xevents = 'FailedToConnect'\n                }\n                It \"There should be an extended event session called AlwaysOn_health on Replica $($psitem.Name)\" {\n                    $Xevents.Name  | Should -Contain 'AlwaysOn_health' -Because 'The extended events session should exist'\n                }\n                It \"The Always On Health extended event session should be running on Replica $($psitem.Name)\" {\n                    $Xevents.Where{ $_.Name -eq 'AlwaysOn_health' }.Status | Should -Be 'Running' -Because 'The extended event session will enable you to troubleshoot errors'\n                }\n                It \"The Always On Health extended event session should be set to auto start on Replica $($psitem.Name)\" {\n                    $Xevents.Where{ $_.Name -eq 'AlwaysOn_health' }.AutoStart | Should -BeTrue  -Because 'The extended event session will enable you to troubleshoot errors'\n                }\n            }\n        }\n    }\n}\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUW+i9VUpgxvFu0m8CjHR4wio2\n# QYygggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz\n# c3VyZW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1kd2mFoLBI5Tx5VL7lL9YmrS\n# SIG # End signature block\n"
  },
  {
    "path": "source/checks/Instance.Tests.ps1",
    "content": "$filename = $MyInvocation.MyCommand.Name.Replace(\".Tests.ps1\", \"\")\n. $PSScriptRoot/../internal/assertions/Instance.Assertions.ps1\n\n# Check out the comments at the top of Instance.Assertions for guidance on adding checks\n\n# Gather the instances we know are not contactable\n[string[]]$NotContactable = (Get-PSFConfig -Module dbachecks -Name global.notcontactable).Value\n\n# Get all the tags in use in this run\n$Tags = Get-CheckInformation -Check $Check -Group Instance -AllChecks $AllChecks -ExcludeCheck $ChecksToExclude\n\n@(Get-Instance).ForEach{\n    # Try to make a connection to the instance and add to NotContactable if required\n    if ($NotContactable -notcontains $psitem) {\n        $Instance = $psitem\n        try {\n            $InstanceSMO = Connect-DbaInstance -SqlInstance $Instance -ErrorAction SilentlyContinue -ErrorVariable errorvar\n        } catch {\n            $NotContactable += $Instance\n            $There = $false\n        }\n        if ($NotContactable -notcontains $psitem) {\n            if ($null -eq $InstanceSMO.version) {\n                $NotContactable += $Instance\n                $There = $false\n            } else {\n                $There = $True\n            }\n        }\n    } else {\n        $There = $false\n    }\n    # Get the relevant information for the checks in one go to save repeated trips to the instance and set values for Not Contactable tests if required\n    $AllInstanceInfo = Get-AllInstanceInfo -Instance $InstanceSMO -Tags $Tags -There $There\n    Describe \"Instance Connection\" -Tags InstanceConnection, Connectivity, High, $filename {\n        $skipremote = Get-DbcConfigValue skip.connection.remoting\n        $skipping = Get-DbcConfigValue skip.connection.ping\n        $skipauth = Get-DbcConfigValue skip.connection.auth\n        $authscheme = Get-DbcConfigValue policy.connection.authscheme\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing Instance Connection on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Testing Instance Connection on $psitem\" {\n                It \"connects successfully to $psitem\" {\n                    #Because Test-DbaInstance only shows connectsuccess false if the Connect-SQlInstance throws an error and we use Connect-DbaInstance\n                    $true | Should -BeTrue\n                }\n                #local is always NTLM except when its a container ;-)\n                if ($InstanceSMO.NetBiosName -eq $ENV:COMPUTERNAME -and ($instance -notlike '*,*')) {\n                    It -Skip:$skipauth \"auth scheme should be NTLM on the local machine on $psitem\" {\n                        (Test-DbaConnectionAuthScheme -SqlInstance $Instance).authscheme | Should -Be NTLM\n                    }\n                } else {\n                    It -Skip:$skipauth \"auth scheme should be $authscheme on $psitem\" {\n                        (Test-DbaConnectionAuthScheme -SqlInstance $Instance).authscheme | Should -Be $authscheme\n                    }\n                }\n                It -Skip:$skipping \"We should be able to ping host $psitem\" {\n                    $ping = New-Object System.Net.NetworkInformation.Ping\n                    $timeout = 1000 #milliseconds\n                    $reply = $ping.Send($InstanceSMO.ComputerName, $timeout)\n                    $pingable = $reply.Status -eq 'Success'\n                    $pingable | Should -BeTrue\n\n                }\n                It -Skip:$skipremote \"We should be able to remote onto $psitem\" {\n                    #simple remoting check\n                    try {\n                        $null = Invoke-Command -ComputerName $InstanceSMO.ComputerName -ScriptBlock { Get-ChildItem } -ErrorAction Stop\n                        $remoting = $true\n                    } catch {\n                        $remoting = $false\n                    }\n                    $remoting | Should -BeTrue\n                }\n            }\n        }\n    }\n\n    Describe \"SQL Engine Service\" -Tags SqlEngineServiceAccount, ServiceAccount, High, $filename {\n        $starttype = Get-DbcConfigValue policy.instance.sqlenginestart\n        $state = Get-DbcConfigValue policy.instance.sqlenginestate\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing SQL Engine Service on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            $IsClustered = $InstanceSMO.IsClustered\n            Context \"Testing SQL Engine Service on $psitem\" {\n                if ( -not $IsLInux) {\n                    @(Get-DbaService -ComputerName $psitem -Type Engine -ErrorAction SilentlyContinue).ForEach{\n                        It \"SQL Engine service account should be $state on $($psitem.InstanceName)\" {\n                            Assert-EngineState -AllInstanceInfo $AllInstanceInfo -state $state\n                        }\n                        if ($IsClustered) {\n                            It \"SQL Engine service account should have a start mode of Manual on FailOver Clustered Instance $($psitem.InstanceName)\" {\n                                Assert-EngineStartTypeCluster -AllInstanceInfo $AllInstanceInfo\n                            }\n                        } else {\n                            It \"SQL Engine service account should have a start mode of $starttype on standalone instance $($psitem.InstanceName)\" {\n                                Assert-EngineStartType -AllInstanceInfo $AllInstanceInfo -StartType $starttype\n                            }\n                        }\n                    }\n                } else {\n                    It \"Running on Linux so can't check Services on $Psitem\" -Skip {\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"TempDB Configuration\" -Tags TempDbConfiguration, Medium, $filename {\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing TempDB Configuration on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Testing TempDB Configuration on $psitem\" {\n                $TempDBTest = Test-DbaTempDbConfig -SqlInstance $psitem\n                It \"should have TF1118 enabled on $($TempDBTest[0].SqlInstance)\" -Skip:((Get-DbcConfigValue skip.TempDb1118) -or ($InstanceSMO.VersionMajor -gt 12)) {\n                    $TempDBTest[0].CurrentSetting | Should -Be $TempDBTest[0].Recommended -Because 'TF 1118 should be enabled'\n                }\n                It \"should have $($TempDBTest[1].Recommended) TempDB Files on $($TempDBTest[1].SqlInstance)\" -Skip:(Get-DbcConfigValue skip.tempdbfileCount) {\n                    $TempDBTest[1].CurrentSetting | Should -Be $TempDBTest[1].Recommended -Because 'This is the recommended number of tempdb files for your server'\n                }\n                It \"should not have TempDB Files autogrowth set to percent on $($TempDBTest[2].SqlInstance)\" -Skip:(Get-DbcConfigValue skip.TempDbFileGrowthPercent) {\n                    $TempDBTest[2].CurrentSetting | Should -Be $TempDBTest[2].Recommended -Because 'Auto growth type should not be percent'\n                }\n                It \"should not have TempDB Files on the C Drive on $($TempDBTest[3].SqlInstance)\" -Skip:(Get-DbcConfigValue skip.TempDbFilesonC) {\n                    $TempDBTest[3].CurrentSetting | Should -Be $TempDBTest[3].Recommended -Because 'You do not want the tempdb files on the same drive as the operating system'\n                }\n                It \"should not have TempDB Files with MaxSize Set on $($TempDBTest[4].SqlInstance)\" -Skip:(Get-DbcConfigValue skip.TempDbFileSizeMax) {\n                    $TempDBTest[4].CurrentSetting | Should -Be $TempDBTest[4].Recommended -Because 'Tempdb files should be able to grow'\n                }\n                It \"The data files should all be the same size on $($TempDBTest[0].SqlInstance)\" {\n                    Assert-TempDBSize -Instance $Psitem\n                }\n            }\n        }\n    }\n\n    Describe \"Ad Hoc Workload Optimization\" -Tags AdHocWorkload, Medium, $filename {\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing Ad Hoc Workload Optimization on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Testing Ad Hoc Workload Optimization on $psitem\" {\n                It \"Should have Optimize for Ad Hoc workloads set correctly on $psitem\" -Skip:((Get-Version -SQLInstance $psitem) -lt 10) {\n                    @(Test-DbaOptimizeForAdHoc -SqlInstance $psitem).ForEach{\n                        $psitem.CurrentOptimizeAdHoc | Should -Be $psitem.RecommendedOptimizeAdHoc -Because \"optimize for ad hoc workloads is a recommended setting\"\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Backup Path Access\" -Tags BackupPathAccess, Storage, DISA, Medium, $filename {\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing Backup Path Access on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Testing Backup Path Access on $psitem\" {\n                $backuppath = Get-DbcConfigValue policy.storage.backuppath\n                if (-not $backuppath) {\n                    $backuppath = (Get-DbaDefaultPath -SqlInstance $psitem).Backup\n                }\n                It \"can access backup path ($backuppath) on $psitem\" {\n                    Test-DbaPath -SqlInstance $psitem -Path $backuppath | Should -BeTrue -Because 'The SQL Service account needs to have access to the backup path to backup your databases'\n                }\n            }\n        }\n    }\n\n    Describe \"Default File Path\" -Tags DefaultFilePath, $filename {\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing Default File Path on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $false\t| Should -BeTrue -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Testing Default Data File Path on $psitem\" {\n                It \"Default Data File Path on $psitem\" {\n                    $diskFile = Get-DbaInstanceProperty -SqlInstance $psitem | Where-Object Name -EQ DefaultFile\n                    $diskFile.Value.substring(0, 1) | Should -Not -Be \"C\" -Because 'Default Data file path should not be your C:\\ drive'\n                }\n            }\n            Context \"Testing Default Log File Path on $psitem\" {\n                It \"Default Log File Path on $psitem\" {\n                    $diskLog = Get-DbaInstanceProperty -SqlInstance $psitem | Where-Object Name -EQ DefaultLog\n                    $diskLog.Value.substring(0, 1) | Should -Not -Be \"C\" -Because 'Default Log file path should not be your C:\\ drive'\n                }\n            }\n        }\n    }\n\n    Describe \"Dedicated Administrator Connection\" -Tags DAC, CIS, Low, $filename {\n        $dac = Get-DbcConfigValue policy.dacallowed\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing Dedicated Administrator Connection on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Testing Dedicated Administrator Connection on $psitem\" {\n                It \"DAC is set to $dac on $psitem\" {\n                    (Get-DbaSpConfigure -SqlInstance $psitem -ConfigName 'RemoteDACConnectionsEnabled').ConfiguredValue -eq 1 | Should -Be $dac -Because 'This is the setting that you have chosen for DAC connections'\n                }\n            }\n        }\n    }\n\n    Describe \"Network Latency\" -Tags NetworkLatency, Connectivity, Medium, $filename {\n        $max = Get-DbcConfigValue policy.network.latencymaxms\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing Network Latency on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Testing Network Latency on $psitem\" {\n                @(Test-DbaNetworkLatency -SqlInstance $psitem).ForEach{\n                    It \"network latency should be less than $max ms on $($psitem.SqlInstance)\" {\n                        $psitem.Average.TotalMilliseconds | Should -BeLessThan $max -Because 'You do not want to be waiting on the network'\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Linked Servers\" -Tags LinkedServerConnection, Connectivity, Medium, $filename {\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing Linked Servers on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Testing Linked Servers on $psitem\" {\n                @(Test-DbaLinkedServerConnection -SqlInstance $psitem).ForEach{\n                    It \"Linked Server $($psitem.LinkedServerName) has connectivity on $($psitem.SqlInstance)\" {\n                        $psitem.Connectivity | Should -BeTrue -Because 'You need to be able to connect to your linked servers'\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Max Memory\" -Tags MaxMemory, High, $filename {\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing Max Memory on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Testing Max Memory on $psitem\" {\n                if (-not $IsLInux) {\n                    It \"Max Memory setting should be correct on $psitem\" {\n                        @(Test-DbaMaxMemory -SqlInstance $psitem).ForEach{\n                            $psitem.MaxValue | Should -BeLessThan ($psitem.RecommendedValue + 379) -Because 'You do not want to exhaust server memory'\n                        }\n                    }\n                } else {\n                    It \"Max Memory setting should be correct (running on Linux so only checking Max Memory is less than Total Memory) on $psitem\" {\n                        # simply check that the max memory is less than total memory\n                        $MemoryValues = Get-DbaMaxMemory -SqlInstance $psitem\n                        $MemoryValues.Total | Should -BeGreaterThan $MemoryValues.MaxValue -Because 'You do not want to exhaust server memory'\n                    }\n                }\n            }\n        }\n    }\n\n\n    Describe \"Orphaned Files\" -Tags OrphanedFile, Low, $filename {\n        if ($NotContactable -contains $psitem) {\n            Context \"Checking for orphaned database files on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Checking for orphaned database files on $psitem\" {\n                It \"There should be zero orphaned database files on $psitem\" {\n                    @(Find-DbaOrphanedFile -SqlInstance $psitem).Count | Should -Be 0 -Because 'You dont want any orphaned files - Use Find-DbaOrphanedFile to locate them'\n                }\n            }\n        }\n    }\n\n    Describe \"SQL and Windows names match\" -Tags ServerNameMatch, Medium, $filename {\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing instance name matches Windows name for $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Testing instance name matches Windows name for $psitem\" {\n                if ($InstanceSMO.NetBiosName -eq $ENV:COMPUTERNAME -and ($instance -like '*,*')) {\n                    It \"We wont check this as it appears to be a local container - for $psitem\" -Skip {\n                    }\n                } else {\n                    It \"Testing rename required for $psitem\" {\n                        (Test-DbaInstanceName -SqlInstance $psitem).RenameRequired | Should -BeFalse -Because 'SQL and Windows should agree on the server name'\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"SQL Memory Dumps\" -Tags MemoryDump, Medium, $filename {\n        $maxdumps = Get-DbcConfigValue\tpolicy.dump.maxcount\n        if ($NotContactable -contains $psitem) {\n            Context \"Checking that dumps on $psitem do not exceed $maxdumps for $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Checking that dumps on $psitem do not exceed $maxdumps for $psitem\" {\n                It \"dump count of $count is less than or equal to the $maxdumps dumps on $psitem\" -Skip:($InstanceSMO.Version.Major -lt 11 -and (-not ($InstanceSMO.Version.Major -eq 10 -and $InstanceSMO.Version.Minor -eq 50)) ) {\n                    Assert-MaxDump -AllInstanceInfo $AllInstanceInfo -maxdumps $maxdumps\n                }\n            }\n        }\n    }\n\n    Describe \"Supported Build\" -Tags SupportedBuild, DISA, High, $filename {\n        $BuildWarning = Get-DbcConfigValue policy.build.warningwindow\n        $BuildBehind = Get-DbcConfigValue policy.build.behind\n        $Date = Get-Date\n        if ($NotContactable -contains $psitem) {\n            Context \"Checking that build is still supported by Microsoft for $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Checking that build is still supported by Microsoft for $psitem\" {\n                if ($BuildBehind) {\n                    It \"The build is not behind the latest build by more than $BuildBehind for $psitem\" {\n                        Assert-InstanceSupportedBuild -Instance $InstanceSMO -BuildBehind $BuildBehind -Date $Date\n                    }\n                }\n                It \"The build is supported by Microsoft for $psitem\" {\n                    Assert-InstanceSupportedBuild -Instance $InstanceSMO -Date $Date\n                }\n                It \"The build is supported by Microsoft within the warning window of $BuildWarning months for $psitem\" {\n                    Assert-InstanceSupportedBuild -Instance $InstanceSMO -BuildWarning $BuildWarning -Date $Date\n                }\n            }\n        }\n    }\n\n\n    Describe \"SA Login Renamed\" -Tags SaRenamed, DISA, CIS, Medium, $filename {\n        if ($NotContactable -contains $psitem) {\n            Context \"Checking that sa login has been renamed on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Checking that sa login has been renamed on $psitem\" {\n                $results = Get-DbaLogin -SqlInstance $psitem -Login sa\n                It \"sa login has been renamed on $psitem\" {\n                    $results | Should -Be $null -Because 'Renaming the sa account is a requirement'\n                }\n            }\n        }\n    }\n\n    Describe \"SA Login Disabled\" -Tags SaDisabled, DISA, CIS, Medium, $filename {\n        if ($NotContactable -contains $psitem) {\n            Context \"Checking that sa login has been disabled on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Checking that sa login has been disabled on $psitem\" {\n                $skip = Get-DbcConfigValue skip.security.sadisabled\n                It \"sa login is disabled on $psitem\" -Skip:$Skip {\n                    Assert-SaDisabled -AllInstanceInfo $AllInstanceInfo\n                }\n            }\n        }\n    }\n\n    Describe \"Login SA cannot exist\" -Tags SaExist, CIS, Medium, $filename {\n        if ($NotContactable -contains $psitem) {\n            Context \"Checking that a login named sa does not exist on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Checking that a login named sa does not exist on $psitem\" {\n                $skip = Get-DbcConfigValue skip.security.saexist\n                It \"sa login does not exist on $psitem\" -Skip:$Skip {\n                    Assert-SaExist -AllInstanceInfo $AllInstanceInfo\n                }\n            }\n        }\n    }\n    Describe \"Default Backup Compression\" -Tags DefaultBackupCompression, Low, $filename {\n        $defaultbackupcompression = Get-DbcConfigValue policy.backup.defaultbackupcompression\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing Default Backup Compression on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Testing Default Backup Compression on $psitem\" {\n                It \"Default Backup Compression is set to $defaultbackupcompression on $psitem\" -Skip:((Get-Version -SQLInstance $psitem) -lt 10) {\n                    Assert-BackupCompression -Instance $psitem -defaultbackupcompression $defaultbackupcompression\n                }\n            }\n        }\n    }\n\n    Describe \"XE Sessions That should be Stopped\" -Tags XESessionStopped, ExtendedEvent, Medium, $filename {\n        $xesession = Get-DbcConfigValue policy.xevent.requiredstoppedsession\n        if ((Get-Version -SQLInstance $psitem) -gt 10) {\n            # no point running if we dont have something to check\n            if ($xesession) {\n                if ($NotContactable -contains $psitem) {\n                    Context \"Checking sessions on $psitem\" {\n                        It \"Can't Connect to $Psitem\" {\n                            $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                        }\n                    }\n                } else {\n                    Context \"Checking sessions on $psitem\" {\n                        $runningsessions = (Get-DbaXESession -SqlInstance $psitem).Where{ $_.Status -eq 'Running' }.Name\n                        @($xesession).ForEach{\n                            It \"Session $psitem should not be running on $Instance\" {\n                                $psitem | Should -Not -BeIn $runningsessions -Because \"$psitem session should be stopped\"\n                            }\n                        }\n                    }\n                }\n            } else {\n                Write-Warning \"You need to use Set-DbcConfig -Name policy.xevent.requiredstoppedsession -Value to add some Extended Events session names to run this check\"\n            }\n        } else {\n            Context \"Checking sessions on $psitem\" {\n                It \"Version does not support XE sessions on $Instance\" -Skip {\n                    1 | Should -Be 3\n                }\n            }\n        }\n    }\n\n    Describe \"XE Sessions That should be Running\" -Tags XESessionRunning, ExtendedEvent, Medium, $filename {\n        $xesession = Get-DbcConfigValue policy.xevent.requiredrunningsession\n        if ((Get-Version -SQLInstance $psitem) -gt 10) {\n            # no point running if we dont have something to check\n            if ($xesession) {\n                if ($NotContactable -contains $psitem) {\n                    Context \"Checking running sessions on $psitem\" {\n                        It \"Can't Connect to $Psitem\" {\n                            $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                        }\n                    }\n                } else {\n                    Context \"Checking running sessions on $psitem\" {\n                        $runningsessions = (Get-DbaXESession -SqlInstance $psitem).Where{ $_.Status -eq 'Running' }.Name\n                        @($xesession).ForEach{\n                            It \"session $psitem should be running on $Instance\" {\n                                $psitem | Should -BeIn $runningsessions -Because \"$psitem session should be running\"\n                            }\n                        }\n                    }\n                }\n            } else {\n                Write-Warning \"You need to use Set-DbcConfig -Name policy.xevent.requiredrunningsession -Value to add some Extended Events session names to run this check\"\n            }\n        } else {\n            Context \"Checking running sessions on $psitem\" {\n                It \"Version does not support XE sessions on $Instance\" -Skip {\n                    1 | Should -Be 3\n                }\n            }\n        }\n    }\n\n    Describe \"XE Sessions That Are Allowed to Be Running\" -Tags XESessionRunningAllowed, ExtendedEvent, Medium, $filename {\n        $xesession = Get-DbcConfigValue policy.xevent.validrunningsession\n        if ((Get-Version -SQLInstance $psitem) -gt 10) {\n            # no point running if we dont have something to check\n            if ($xesession) {\n                if ($NotContactable -contains $psitem) {\n                    Context \"Checking running sessions allowed on $psitem\" {\n                        It \"Can't Connect to $Psitem\" {\n                            $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                        }\n                    }\n                } else {\n                    Context \"Checking running sessions allowed on $psitem\" {\n                        @(Get-DbaXESession -SqlInstance $psitem).Where{ $_.Status -eq 'Running' }.ForEach{\n                            It \"Session $($Psitem.Name) is allowed to be running on $Instance\" {\n                                $psitem.name | Should -BeIn $xesession -Because \"Only these sessions are allowed to be running\"\n                            }\n                        }\n                    }\n                }\n            } else {\n                Write-Warning \"You need to use Set-DbcConfig -Name policy.xevent.validrunningsession -Value to add some Extended Events session names to run this check\"\n            }\n        } else {\n            Context \"Checking running sessions allowed on $psitem\" {\n                It \"Version does not support XE sessions on $Instance\" -Skip {\n                    1 | Should -Be 3\n                }\n            }\n        }\n    }\n    Describe \"OLE Automation\" -Tags OLEAutomation, security, CIS, Medium, $filename {\n        $OLEAutomation = Get-DbcConfigValue policy.oleautomation\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing OLE Automation on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Testing OLE Automation on $psitem\" {\n                It \"OLE Automation is set to $OLEAutomation on $psitem\" {\n                    (Get-DbaSpConfigure -SqlInstance $psitem -ConfigName 'OleAutomationProceduresEnabled').ConfiguredValue -eq 1 | Should -Be $OLEAutomation -Because 'OLE Automation can introduce additional security risks'\n                }\n            }\n        }\n    }\n\n    Describe \"sp_whoisactive is Installed\" -Tags WhoIsActiveInstalled, Low, $filename {\n        $db = Get-DbcConfigValue policy.whoisactive.database\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing WhoIsActive exists on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Testing WhoIsActive exists on $psitem\" {\n                It \"WhoIsActive should exists on $db on $psitem\" {\n                    (Get-DbaModule -SqlInstance $psitem -Database $db -Type StoredProcedure | Where-Object name -EQ \"sp_WhoIsActive\") | Should -Not -Be $Null -Because 'The sp_WhoIsActive stored procedure should be installed'\n                }\n            }\n        }\n    }\n\n    Describe \"Model Database Growth\" -Tags ModelDbGrowth, Low, $filename {\n        $modeldbgrowthtest = Get-DbcConfigValue skip.instance.modeldbgrowth\n        if (-not $modeldbgrowthtest) {\n            if ($NotContactable -contains $psitem) {\n                Context \"Testing model database growth setting is not default on $psitem\" {\n                    It \"Can't Connect to $Psitem\" {\n                        $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                    }\n                }\n            } else {\n                Context \"Testing model database growth setting is not default on $psitem\" {\n                    @(Get-DbaDbFile -SqlInstance $psitem -Database Model).ForEach{\n                        It \"Model database growth settings should not be percent for file $($psitem.LogicalName) on $($psitem.SqlInstance)\" {\n                            $psitem.GrowthType | Should -Not -Be 'Percent' -Because 'New databases use the model database as a template and percent growth can cause performance problems'\n                        }\n                        It \"Model database growth settings should not be 1Mb for file $($psitem.LogicalName) on $($psitem.SqlInstance)\" {\n                            $psitem.Growth | Should -Not -Be 1024 -Because 'New databases use the model database as a template and growing for each Mb will have a performance impact'\n                        }\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Ad Users and Groups \" -Tags ADUser, Domain, High, $filename {\n        if (-not $IsLinux) {\n            $userexclude = Get-DbcConfigValue policy.adloginuser.excludecheck\n            $groupexclude = Get-DbcConfigValue policy.adlogingroup.excludecheck\n\n            if ($NotContactable -contains $psitem) {\n                Context \"Testing Active Directory users on $psitem\" {\n                    It \"Can't Connect to $Psitem\" {\n                        $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                    }\n                }\n                Context \"Testing Active Directory groups on $psitem\" {\n                    It \"Can't Connect to $Psitem\" {\n                        $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                    }\n                }\n            } else {\n                Context \"Testing Active Directory users on $psitem\" {\n                    @(Test-DbaWindowsLogin -SqlInstance $psitem -FilterBy LoginsOnly -ExcludeLogin $userexclude).ForEach{\n                        It \"Active Directory user $($psitem.login) was found in $Instance on $($psitem.domain)\" {\n                            $psitem.found | Should -Be $true -Because \"$($psitem.login) should be in Active Directory\"\n                        }\n                        if ($psitem.found -eq $true) {\n                            It \"Active Directory user $($psitem.login) should not have an expired password in $Instance on $($psitem.domain)\" {\n                                $psitem.PasswordExpired | Should -Be $false -Because \"$($psitem.login) password should not be expired\"\n                            }\n                            It \"Active Directory user $($psitem.login) should not be locked out in $Instance on $($psitem.domain)\" {\n                                $psitem.lockedout | Should -Be $false -Because \"$($psitem.login) should not be locked out\"\n                            }\n                            It \"Active Directory user $($psitem.login) should be enabled in $Instance on $($psitem.domain)\" {\n                                $psitem.Enabled | Should -Be $true -Because \"$($psitem.login) should be enabled\"\n                            }\n                            It \"Active Directory user $($psitem.login) should not be disabled in $Instance on $($psitem.Server)\" {\n                                $psitem.DisabledInSQLServer | Should -Be $false -Because \"$($psitem.login) should be active on the SQL server\"\n                            }\n                        }\n\n                    }\n                }\n\n                Context \"Testing Active Directory groups on $psitem\" {\n                    @(Test-DbaWindowsLogin -SqlInstance $psitem -FilterBy GroupsOnly -ExcludeLogin $groupexclude).ForEach{\n                        It \"Active Directory group $($psitem.login) was found in $Instance on $($psitem.domain)\" {\n                            $psitem.found | Should -Be $true -Because \"$($psitem.login) should be in Active Directory\"\n                        }\n                        if ($psitem.found -eq $true) {\n                            It \"Active Directory group $($psitem.login) should not be disabled in $Instance on $($psitem.Server)\" {\n                                $psitem.DisabledInSQLServer | Should -Be $false -Because \"$($psitem.login) should be active on the SQL server\"\n                            }\n                        }\n\n                    }\n                }\n            }\n        } else {\n            Context \"Testing Active Directory users on $psitem\" {\n                It \"Running on Linux so can't check AD on $Psitem\" -Skip {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n            Context \"Testing Active Directory groups on $psitem\" {\n                It \"Running on Linux so can't check AD on $Psitem\" -Skip {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n    }\n\n    Describe \"Error Log Entries\" -Tags ErrorLog, Medium, $filename {\n        $logwindow = Get-DbcConfigValue policy.errorlog.warningwindow\n        if ($NotContactable -contains $psitem) {\n            Context \"Checking error log on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Checking error log on $psitem\" {\n                It \"Error log should be free of error severities 17-24 within the window of $logwindow days on $psitem\" {\n                    Assert-ErrorLogEntry -AllInstanceInfo $AllInstanceInfo\n                }\n            }\n        }\n    }\n\n    Describe \"Error Log Count\" -Tags ErrorLogCount, CIS, Low, $filename {\n        $errorLogCount = Get-DbcConfigValue policy.errorlog.logcount\n        if ($NotContactable -contains $psitem) {\n            Context \"Checking error log count on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Checking error log count on $psitem\" {\n                It \"Error log count should be greater or equal to $errorLogCount on $psitem\" {\n                    Assert-ErrorLogCount -SqlInstance $psitem -errorLogCount $errorLogCount\n                }\n            }\n        }\n    }\n\n    Describe \"Instance MaxDop\" -Tags MaxDopInstance, MaxDop, Medium, $filename {\n        $UseRecommended = Get-DbcConfigValue policy.instancemaxdop.userecommended\n        $MaxDop = Get-DbcConfigValue policy.instancemaxdop.maxdop\n        $ExcludeInstance = Get-DbcConfigValue policy.instancemaxdop.excludeinstance\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing Instance MaxDop Value on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            if ($psitem -in $ExcludeInstance) { $Skip = $true }else { $skip = $false }\n            Context \"Testing Instance MaxDop Value on $psitem\" {\n                It \"Instance Level MaxDop setting should be correct on $psitem\" -Skip:$Skip {\n                    Assert-InstanceMaxDop -Instance $psitem -UseRecommended:$UseRecommended -MaxDopValue $MaxDop\n                }\n            }\n        }\n    }\n\n    Describe \"Two Digit Year Cutoff\" -Tags TwoDigitYearCutoff, Low, $filename {\n        $twodigityearcutoff = Get-DbcConfigValue policy.twodigityearcutoff\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing Two Digit Year Cutoff on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Testing Two Digit Year Cutoff on $psitem\" {\n                It \"Two Digit Year Cutoff is set to $twodigityearcutoff on $psitem\" {\n                    Assert-TwoDigitYearCutoff -Instance $psitem -TwoDigitYearCutoff $twodigityearcutoff\n                }\n            }\n        }\n    }\n\n    Describe \"Trace Flags Expected\" -Tags TraceFlagsExpected, TraceFlag, High, $filename {\n        $ExpectedTraceFlags = Get-DbcConfigValue policy.traceflags.expected\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing Expected Trace Flags on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            if ($null -eq $ExpectedTraceFlags) { $ExpectedTraceFlags = 0 }\n            $ActualTraceflags = (Get-DbaTraceFlag -SqlInstance $psitem).TraceFlag\n            Context \"Testing Expected Trace Flags on $psitem\" {\n                foreach ($ExpectedTraceFlag in $ExpectedTraceFlags) {\n                    if ($ExpectedTraceFlag -ne 0) {\n                        It \"Expected Trace Flag $ExpectedTraceFlag to exist on $psitem\" {\n                            Assert-TraceFlag -ActualTraceflags $ActualTraceflags -ExpectedTraceFlag $ExpectedTraceFlag\n                        }\n                    } else {\n                        It \"Expected No Trace Flag to exist on $psitem\" {\n                            Assert-TraceFlag -ActualTraceflags $ActualTraceflags -ExpectedTraceFlag $ExpectedTraceFlag\n                        }\n                    }\n                }\n            }\n        }\n    }\n    Describe \"Trace Flags Not Expected\" -Tags TraceFlagsNotExpected, TraceFlag, Medium, $filename {\n        $NotExpectedTraceFlags = Get-DbcConfigValue policy.traceflags.notexpected\n        $ExpectedTraceFlags = Get-DbcConfigValue policy.traceflags.expected\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing Not Expected Trace Flags on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Testing Not Expected Trace Flags on $psitem\" {\n                It \"Expected Trace Flags $NotExpectedTraceFlags to not exist on $psitem\" {\n                    Assert-NotTraceFlag -SQLInstance $psitem -NotExpectedTraceFlag $NotExpectedTraceFlags -ExpectedTraceFlag $ExpectedTraceFlags\n                }\n            }\n        }\n    }\n\n    Describe \"CLR Enabled\" -Tags CLREnabled, security, CIS, High, $filename {\n        $CLREnabled = Get-DbcConfigValue policy.security.clrenabled\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing CLR Enabled on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Testing CLR Enabled on $psitem\" {\n                It \"CLR Enabled is set to $CLREnabled on $psitem\" {\n                    Assert-CLREnabled -SQLInstance $psitem -CLREnabled $CLREnabled\n                }\n            }\n        }\n    }\n    Describe \"Cross Database Ownership Chaining\" -Tags CrossDBOwnershipChaining, security, CIS, Medium, $filename {\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing Cross Database Ownership Chaining on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Testing Cross Database Ownership Chaining on $psitem\" {\n                It \"Cross Database Ownership Chaining should be disabled on $psitem\" {\n                    Assert-CrossDBOwnershipChaining -AllInstanceInfo $AllInstanceInfo\n                }\n            }\n        }\n    }\n    Describe \"Ad Hoc Distributed Queries\" -Tags AdHocDistributedQueriesEnabled, security, CIS, Medium, $filename {\n        $AdHocDistributedQueriesEnabled = Get-DbcConfigValue policy.security.AdHocDistributedQueriesEnabled\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing Ad Hoc Distributed Queries on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Testing Ad Hoc Distributed Queries on $psitem\" {\n                It \"Ad Hoc Distributed Queries is set to $AdHocDistributedQueriesEnabled on $psitem\" {\n                    Assert-AdHocDistributedQueriesEnabled -SQLInstance $Psitem -AdHocDistributedQueriesEnabled $AdHocDistributedQueriesEnabled\n                }\n            }\n        }\n    }\n    Describe \"XP CmdShell\" -Tags XpCmdShellDisabled, security, CIS, Medium, $filename {\n        $XpCmdShellDisabled = Get-DbcConfigValue policy.security.XpCmdShellDisabled\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing XP CmdShell on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Testing XP CmdShell on $psitem\" {\n                It \"XPCmdShell is set to $XpCmdShellDisabled on $psitem\" {\n                    Assert-XpCmdShellDisabled -SQLInstance $Psitem -XpCmdShellDisabled $XpCmdShellDisabled\n                }\n            }\n        }\n    }\n\n    Describe \"Scan For Startup Procedures\" -Tags ScanForStartupProceduresDisabled, Security, CIS, Medium, $filename {\n        $skip = Get-DbcConfigValue skip.instance.scanforstartupproceduresdisabled\n        $ScanForStartupProcsDisabled = Get-DbcConfigValue policy.security.scanforstartupproceduresdisabled\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing Scan For Startup Procedures on $psitem\" {\n                It \"Can't Connect to $Psitem\" -Skip:$skip {\n                    $false\t| Should -BeTrue -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Testing Scan For Startup Procedures on $psitem\" {\n                It \"Scan For Startup Procedures is set to $ScanForStartupProcsDisabled on $psitem\" -Skip:$skip {\n                    Assert-ScanForStartupProcedures -AllInstanceInfo $AllInstanceInfo -ScanForStartupProcsDisabled $ScanForStartupProcsDisabled\n                }\n            }\n        }\n    }\n    Describe \"Default Trace\" -Tags DefaultTrace, CIS, Low, $filename {\n        $skip = Get-DbcConfigValue skip.instance.defaulttrace\n        if ($NotContactable -contains $psitem) {\n            Context \"Checking Default Trace on $psitem\" {\n                It \"Can't Connect to $Psitem\" -Skip:$skip {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Checking Default Trace on $psitem\" {\n                It \"The Default Trace should be enabled on $psitem\" -Skip:$skip {\n                    Assert-DefaultTrace -AllInstanceInfo $AllInstanceInfo\n                }\n            }\n        }\n    }\n    Describe \"OLE Automation Procedures Disabled\" -Tags OLEAutomationProceduresDisabled, CIS, Low, $filename {\n        $skip = Get-DbcConfigValue skip.instance.oleautomationproceduresdisabled\n        if ($NotContactable -contains $psitem) {\n            Context \"Checking OLE Automation Procedures on $psitem\" {\n                It \"Can't Connect to $Psitem\" -Skip:$skip {\n                    $false\t| Should -BeTrue -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Checking OLE Automation Procedures on $psitem\" {\n                It \"The OLE Automation Procedures should be disabled on $psitem\" -Skip:$skip {\n                    Assert-OLEAutomationProcedures -AllInstanceInfo $AllInstanceInfo\n                }\n            }\n        }\n    }\n    Describe \"Remote Access Disabled\" -Tags RemoteAccessDisabled, Security, CIS, Medium, $filename {\n        $skip = Get-DbcConfigValue skip.instance.remoteaccessdisabled\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing Remote Access on $psitem\" {\n                It \"Can't Connect to $Psitem\" -Skip:$skip {\n                    $false\t| Should -BeTrue -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Testing Remote Access on $psitem\" {\n                It \"The Remote Access should be disabled on $psitem\" -Skip:$skip {\n                    Assert-RemoteAccess -AllInstanceInfo $AllInstanceInfo\n                }\n            }\n        }\n    }\n\n    Describe \"Latest Build\" -Tags LatestBuild, Security, CIS, Medium, $filename {\n        $skip = Get-DbcConfigValue skip.instance.latestbuild\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing Latest Build on $psitem\" {\n                It \"Can't Connect to $Psitem\" -Skip:$skip {\n                    $false\t| Should -BeTrue -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Testing Latest Build on $psitem\" {\n                It \"The Latest Build of SQL should be installed on $psitem\" -Skip:$skip {\n                    Assert-LatestBuild -AllInstanceInfo $AllInstanceInfo\n                }\n            }\n        }\n    }\n\n    Describe \"Login BUILTIN Administrators cannot exist\" -Tags BuiltInAdmin, CIS, Medium, $filename {\n        if ($NotContactable -contains $psitem) {\n            Context \"Checking that a login named BUILTIN\\Administrators does not exist on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Checking that a login named BUILTIN\\Administrators does not exist on $psitem\" {\n                $skip = Get-DbcConfigValue skip.security.builtinadmin\n                It \"BUILTIN\\Administrators login does not exist on $psitem\" -Skip:$skip {\n                    Assert-BuiltInAdmin -AllInstanceInfo $AllInstanceInfo\n                }\n            }\n        }\n    }\n    Describe \"Local Windows Groups Not Have SQL Logins\" -Tags LocalWindowsGroup, Security, CIS, Medium, $filename {\n        $skip = Get-DbcConfigValue skip.security.localwindowsgroup\n        if ($NotContactable -contains $psitem) {\n            Context \"Checking that local Windows groups do not have SQL Logins on $psitem\" {\n                It \"Can't Connect to $Psitem\" -Skip:$skip {\n                    $false\t| Should -BeTrue -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Checking that local Windows groups do not have SQL Logins on $psitem\" {\n                It \"Local Windows groups should not SQL Logins on $psitem\" -Skip:$skip {\n                    Assert-LocalWindowsGroup -AllInstanceInfo $AllInstanceInfo\n                }\n            }\n        }\n    }\n\n    Describe \"Failed Login Auditing\" -Tags LoginAuditFailed, Security, CIS, Medium, $filename {\n        $skip = Get-DbcConfigValue skip.security.loginauditlevelfailed\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing if failed login auditing is in place on $psitem\" {\n                It \"Can't Connect to $Psitem\" -Skip:$skip {\n                    $false\t| Should -BeTrue -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Testing if failed login auditing is in place on $psitem\" {\n                It \"The failed login auditing should be set on $psitem\" -Skip:$skip {\n                    Assert-LoginAuditFailed -AllInstanceInfo $AllInstanceInfo\n                }\n            }\n        }\n    }\n\n    Describe \"Successful Login Auditing\" -Tags LoginAuditSuccessful, Security, CIS, Medium, $filename {\n        $skip = Get-DbcConfigValue skip.security.loginauditlevelsuccessful\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing if successful and failed login auditing is in place on $psitem\" {\n                It \"Can't Connect to $Psitem\" -Skip:$skip {\n                    $false\t| Should -BeTrue -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Testing if successful and failed login auditing is in place on $psitem\" {\n                It \"The successful and failed auditing should be set on $psitem\" -Skip:$skip {\n                    Assert-LoginAuditSuccessful -AllInstanceInfo $AllInstanceInfo\n                }\n            }\n        }\n    }\n    Describe \"SqlAgentProxiesNoPublicRole\" -Tags SqlAgentProxiesNoPublicRole, Security, CIS, Medium, $filename {\n        $skip = Get-DbcConfigValue skip.security.sqlagentproxiesnopublicrole\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing to see if the public role has access to the SQL Agent proxies on $psitem\" {\n                It \"Can't Connect to $Psitem\" -Skip:$skip {\n                    $false\t| Should -BeTrue -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Testing to see if the public role has access to the SQL Agent proxies on $psitem\" {\n                It \"The public role should not have access to the SQL Agent Proxies on $psitem\" -Skip:$skip {\n                    Assert-SqlAgentProxiesNoPublicRole -AllInstanceInfo $AllInstanceInfo\n                }\n            }\n        }\n    }\n\n    Describe \"Hide Instance\" -Tags HideInstance, Security, CIS, Medium, $filename {\n        $skip = Get-DbcConfigValue skip.security.hideinstance\n        if ($NotContactable -contains $psitem) {\n            Context \"Checking the Hide an Instance of SQL Server Database Engine property on $psitem\" {\n                It \"Can't Connect to $Psitem\" -Skip:$skip {\n                    $false\t| Should -BeTrue -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Checking the Hide an Instance of SQL Server Database Engine property on $psitem\" {\n                It \"The Hide an Instance of SQL Server Database Engine property on SQL Server instance $psitem\" -Skip:$skip {\n                    Assert-HideInstance -AllInstanceInfo $AllInstanceInfo\n                }\n            }\n        }\n    }\n    Describe \"SQL Engine Service Admin\" -Tags EngineServiceAdmin, Security, CIS, Medium, $filename {\n        $skip = Get-DbcConfigValue skip.security.EngineServiceAdmin\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing whether SQL Engine account is a local administrator on $psitem\" {\n                It \"Can't Connect to $Psitem\" -Skip:$skip {\n                    $false | Should -BeTrue -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            if ($IsCoreCLR) {\n                $Skip = $true\n            }\n            Context \"Testing whether SQL Engine account is a local administrator on $psitem\" {\n                It \"The SQL Engine service account should not be a local administrator on $psitem\" -Skip:$skip {\n                    Assert-EngineServiceAdmin -AllInstanceInfo $AllInstanceInfo\n                }\n            }\n        }\n    }\n\n    Describe \"SQL Agent Service Admin\" -Tags AgentServiceAdmin, Security, CIS, Medium, $filename {\n        $skip = Get-DbcConfigValue skip.security.AgentServiceAdmin\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing whether SQL Agent account is a local administrator on $psitem\" {\n                It \"Can't Connect to $Psitem\" -Skip:$skip {\n                    $false | Should -BeTrue -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            if ($IsCoreCLR) {\n                $Skip = $true\n            }\n            Context \"Testing whether SQL Agent account is a local administrator on $psitem\" {\n                It \"The SQL Agent service account should not be a local administrator on $psitem\" -Skip:$skip {\n                    Assert-AgentServiceAdmin -AllInstanceInfo $AllInstanceInfo\n                }\n            }\n        }\n    }\n\n    Describe \"SQL Full Text Service Admin\" -Tags FullTextServiceAdmin, Security, CIS, Medium, $filename {\n        $skip = Get-DbcConfigValue skip.security.FullTextServiceAdmin\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing whether SQL Full Text account is a local administrator on $psitem\" {\n                It \"Can't Connect to $Psitem\" -Skip:$skip {\n                    $false | Should -BeTrue -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            if ($IsCoreCLR) {\n                $Skip = $true\n            }\n            Context \"Testing whether SQL Full Text account is a local administrator on  $psitem\" {\n                It \"The SQL Full Text service account should not be a local administrator on $psitem\" -Skip:$skip {\n                    Assert-FullTextServiceAdmin -AllInstanceInfo $AllInstanceInfo\n                }\n            }\n        }\n    }\n    Describe \"Login Check Policy\" -Tags LoginCheckPolicy, Security, CIS, Medium, $filename {\n        $skip = Get-DbcConfigValue skip.security.LoginCheckPolicy\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing if the CHECK_POLICY is enabled on all logins on $psitem\" {\n                It \"Can't Connect to $Psitem\" -Skip:$skip {\n                    $false\t| Should -BeTrue -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Testing if the CHECK_POLICY is enabled on all logins on $psitem\" {\n                It \"All logins should have the CHECK_POLICY option set to ON on $psitem\" -Skip:$skip {\n                    Assert-LoginCheckPolicy -AllInstanceInfo $AllInstanceInfo\n                }\n            }\n        }\n    }\n\n    Describe \"Login Password Expiration\" -Tags LoginPasswordExpiration, Security, CIS, Medium, $filename {\n        $skip = Get-DbcConfigValue skip.security.LoginPasswordExpiration\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing if the login password expiration is enabled for sql logins in the sysadmin role $psitem\" {\n                It \"Can't Connect to $Psitem\" -Skip:$skip {\n                    $false\t| Should -BeTrue -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Testing if the login password expiration is enabled for sql logins in the sysadmin role on $psitem\" {\n                It \"All sql logins should have the password expiration option set to ON in the sysadmin role on $psitem\" -Skip:$skip {\n                    Assert-LoginPasswordExpiration -AllInstanceInfo $AllInstanceInfo\n                }\n            }\n        }\n    }\n\n    Describe \"Login Must Change\" -Tags LoginMustChange, Security, CIS, Medium, $filename {\n        $skip = Get-DbcConfigValue skip.security.LoginMustChange\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing if the new SQL logins that have not logged have to change their password when they log in on $psitem\" {\n                It \"Can't Connect to $Psitem\" -Skip:$skip {\n                    $false\t| Should -BeTrue -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Testing if the new SQL logins that have not logged have to change their password when they log in on $psitem\" {\n                It \"All new sql logins should have the have to change their password when they log in for the first time on $psitem\" -Skip:$skip {\n                    Assert-LoginMustChange -AllInstanceInfo $AllInstanceInfo\n                }\n            }\n        }\n    }\n\n    Describe \"Suspect Page Limit Nearing\" -Tags SuspectPageLimit, Medium, $filename {\n        $skip = Get-DbcConfigValue skip.instance.suspectpagelimit\n        $thresholdPercent = Get-DbcConfigValue policy.suspectpage.threshold\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing if the suspect_pages table is nearing the limit of 1000 rows on $psitem\" {\n                It \"Can't Connect to $Psitem\" -Skip:$skip {\n                    $false\t| Should -BeTrue -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Testing if the suspect_pages table is nearing the limit of 1000 rows on $psitem\" {\n                It \"The suspect_pages table in msdb shouldn't be nearing the limit of 1000 rows on $psitem\" -Skip:$skip {\n                    (((Get-DbaSuspectPage -SqlInstance $psitem | Measure-Object).Count) / 1000) * 100 | Should -BeLessThan $thresholdPercent\n                }\n            }\n        }\n    }\n\n    Describe \"SQL Mail XPs Disabled\" -Tags SQLMailXPsDisabled, Security, CIS, Medium, $filename {\n        $skip = Get-DbcConfigValue skip.security.SQLMailXPsDisabled\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing SQL Mail XPs on $psitem\" {\n                It \"Can't Connect to $Psitem\" -Skip:($skip -or $InstanceSMO.VersionMajor -gt 10) {\n                    $false\t| Should -BeTrue -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Testing SQL Mail XPs on $psitem\" {\n                It \"The SQL Mail XPs should be disabled on $psitem\" -Skip:($skip -or $InstanceSMO.VersionMajor -gt 10) {\n                    Assert-SQLMailXPs -AllInstanceInfo $AllInstanceInfo\n                }\n            }\n        }\n    }\n\n    Describe \"Public Role Permissions\" -Tags PublicPermission, Security, CIS, Medium, $filename {\n        $skip = Get-DbcConfigValue skip.security.PublicPermission\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing if the public role permissions don't have permissions on $psitem\" {\n                It \"Can't Connect to $Psitem\" -Skip:$skip {\n                    $false\t| Should -BeTrue -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            Context \"Testing if the public role permissions don't have permissions  on $psitem\" {\n                It \"All permissions should be set to CIS standards on the public role on $psitem\" -Skip:$skip {\n                    Assert-PublicPermission -AllInstanceInfo $AllInstanceInfo\n                }\n            }\n        }\n    }\n}\n\nDescribe \"SQL Browser Service\" -Tags SqlBrowserServiceAccount, ServiceAccount, CIS, High, $filename {\n    @(Get-ComputerName).ForEach{\n        if ($NotContactable -contains $psitem) {\n            Context \"Testing SQL Browser Service on $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $true | Should -BeFalse -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        } else {\n            # cant check agent on container - hmm does this actually work with instance need to check\n            if (-not $IsLinux -and ($InstanceSMO.HostPlatform -ne 'Linux')) {\n                Context \"Testing SQL Browser Service on $psitem\" {\n                    if (-not $IsLinux) {\n                        $Services = Get-DbaService -ComputerName $psitem\n                        if ($Services.Where{ $_.ServiceType -eq 'Engine' }.Count -eq 1) {\n                            It \"SQL Browser service should be Stopped as only one instance is installed on $psitem\" {\n                                $Services.Where{ $_.ServiceType -eq 'Browser' }.State | Should -Be \"Stopped\" -Because 'Unless there are multiple instances you dont need the browser service'\n                            }\n                        } else {\n                            It \"SQL Browser service should be Running as multiple instances are installed on $psitem\" {\n                                $Services.Where{ $_.ServiceType -eq 'Browser' }.State | Should -Be \"Running\" -Because 'You need the browser service with multiple instances' }\n                        }\n                        if ($Services.Where{ $_.ServiceType -eq 'Engine' }.Count -eq 1) {\n                            It \"SQL Browser service startmode should be Disabled as only one instance is installed on $psitem\" {\n                                $Services.Where{ $_.ServiceType -eq 'Browser' }.StartMode | Should -Be \"Disabled\" -Because 'Unless there are multiple instances you dont need the browser service' }\n                        } else {\n                            It \"SQL Browser service startmode should be Automatic as multiple instances are installed on $psitem\" {\n                                $Services.Where{ $_.ServiceType -eq 'Browser' }.StartMode | Should -Be \"Automatic\"\n                            }\n                        }\n                    } else {\n                        It \"Running on Linux so can't check Services on $Psitem\" -Skip {\n                        }\n                    }\n                }\n            } else {\n                Context \"Testing SQL Browser Service on $psitem\" {\n                    It \"Running on Linux or connecting to container so can't check Services on $Psitem\" -Skip {\n                    }\n                }\n            }\n        }\n    }\n}\n\nSet-PSFConfig -Module dbachecks -Name global.notcontactable -Value $NotContactable\n\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUW4dbcY1WxYJ8l/oAYpwlqWaL\n# aV+gggpSMI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x3G9C9+V8Nchj0oeQSMPjbalUTPNPfx1o7cpHEH\n# k8JY8K7rnCSSnCnkeZPP5KmXSrN9nSL9yX8EbQfmHSX8p/mNvPhkdWoxiTeAeEp0\n# Rh6z/OF4acRn3MxwpT+8WHvAT+X9Cen5Ec5o/BCdsx6E817E8g30x4RpO6I1jVWL\n# tYmk20LK2bUx5An2PGWmbutWs9KOn4OiM7TG0YG6WRL0i4Ot\n# SIG # End signature block\n"
  },
  {
    "path": "source/checks/Instancev5.Tests.ps1",
    "content": "# So the v5 files need to be handled differently.\n# Ww will start with a BeforeDiscovery which will gather the Instance Information up front\n# Gather the instances we know are not contactable\n\nBeforeDiscovery {\n    # Gather the instances we know are not  contactable\n    [string[]]$NotContactable = (Get-PSFConfig -Module dbachecks -Name global.notcontactable).Value\n    # Get all the tags in use in this run\n    $Tags = Get-CheckInformation -Check $Check -Group Instance -AllChecks $AllChecks -ExcludeCheck $ChecksToExclude\n    $InstancesToTest = @(Get-Instance).ForEach{\n        # just add it to the Not Contactable list\n        if ($NotContactable -notcontains $psitem) {\n            $Instance = $psitem\n            try {\n                $InstanceSMO = Connect-DbaInstance -SqlInstance $Instance -ErrorAction SilentlyContinue -ErrorVariable errorvar\n            } catch {\n                $NotContactable += $Instance\n            }\n            if ($NotContactable -notcontains $psitem) {\n                if ($null -eq $InstanceSMO.version) {\n                    $NotContactable += $Instance\n                } else {\n                    # Get the relevant information for the checks in one go to save repeated trips to the instance and set values for Not Contactable tests if required\n                    NewGet-AllInstanceInfo -Instance $InstanceSMO -Tags $Tags\n                }\n            }\n        }\n    }\n    Write-PSFMessage -Message \"Instances = $($InstancesToTest.Name)\" -Level Verbose\n    #if you ever need to see what is being tested uncomment and run in verbose but this crashed with a weird  Microsoft.SqlServer.Management.Sdk.Sfc.InvalidQueryExpressionEnumeratorException: urn could not be resolved at level OleDbProviderSetting.\n    # $InstancesToTestJson = $InstancesToTest | ConvertTo-Json -Depth 10\n    #Write-PSFMessage -Message \"InstancesToTest = $InstancesToTestJson\" -Level Verbose\n    Set-PSFConfig -Module dbachecks -Name global.notcontactable -Value $NotContactable\n    # Get-DbcConfig is expensive so we call it once\n    $__dbcconfig = Get-DbcConfig\n    $notcontactable = (Get-PSFConfig -Module dbachecks -Name global.notcontactable).Value\n    $Checks = Get-DbcCheck\n    $TestsNoGoBrrr = foreach ($Not in $notcontactable) {\n        foreach ($tag in $tags) {\n            [PSCustomObject]@{\n                Name = $Not\n                Tag  = $tag\n            }\n        }\n    }\n}\n\nBeforeAll {\n\n}\nDescribe \"<_.Tag> failed on <_.Name>\" -Tag FailedConnections -ForEach $TestsNoGoBrrr {\n    Context \"Checking <_.Tag> on <_.Name>\" {\n        It \"The instance <_.Name> is not connectable\" -Skip:$skip {\n            $false | Should -BeTrue -Because \"This instance is not connectable\"\n        }\n    }\n}\n\n# Ordered alphabetically by unique tag please\nDescribe \"Ad Hoc Distributed Queries\" -Tag AdHocDistributedQueriesEnabled, security, CIS, Medium, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.AdHocDistributedQueriesEnabled' }).Value\n    Context \"Checking Ad Hoc Distributed Queries on <_.Name>\" {\n        It \"Ad Hoc Distributed Queries is set to <_.ConfigValues.AdHocDistributedQueriesEnabled> on <_.Name>\" -Skip:$skip {\n            $PSItem.Configuration.AdHocDistributedQueriesEnabled.ConfigValue -eq 1 | Should -Be $psitem.ConfigValues.AdHocDistributedQueriesEnabled -Because 'This is the setting you have chosen for AdHoc Distributed Queries Enabled'\n        }\n    }\n}\n\nDescribe \"Ad Hoc Workload Optimization\" -Tag AdHocWorkload, Medium, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.AdHocWorkload' }).Value\n    Context \"Checking Ad Hoc Workload Optimization on <_.Name>\" {\n        It \"Ad Hoc Workload Optimization is enabled on <_.Name>\" -Skip:($skip -or $psitem.VersionMajor -lt 10) {\n            $PSItem.Configuration.OptimizeAdhocWorkloads.ConfigValue -eq 1 | Should -Be 1 -Because \"Optimize for ad hoc workloads is a recommended setting\"\n        }\n    }\n}\n\nDescribe \"SQL Agent Service Admin\" -Tags AgentServiceAdmin, Security, CIS, Medium, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.security.AgentServiceAdmin' }).Value\n    Context \"Testing whether SQL Agent account is a local administrator on <_.Name>\" {\n        It \"The SQL Agent service account should not be a local administrator on <_.Name>\" -Skip:$skip {\n            # We don't make this -BeFalse because the possible results  are $true/$false/'Could not connect'\n            $psitem.AgentServiceAdminExist | Should -Be $false -Because \"We expected the service account for the SQL Agent to not be a local administrator\"\n        }\n    }\n}\n\nDescribe \"Backup Path Access\" -Tag BackupPathAccess, Storage, DISA, Medium, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.BackupPathAccess' }).Value\n    Context \"Testing Backup Path Access on <_.Name>\" {\n        It \"can access backup path <_.BackupPathAccess.BackupPath> on <_.Name>\" {\n            $PsItem.BackupPathAccess.Result | Should -BeTrue -Because 'The SQL Service account needs to have access to the backup path $($PsItem.BackupPathAccess.BackupPath) to backup your databases'\n        }\n    }\n}\n\nDescribe \"CLR Enabled\" -Tag CLREnabled, security, CIS, High, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.CLREnabled' }).Value\n    Context \"Testing CLR Enabled on <_.Name>\" {\n        It \"CLR Enabled is set to <_.ConfigValues.CLREnabled> on <_.Name>\" -Skip:$skip {\n            $PSItem.Configuration.IsSqlClrEnabled.ConfigValue -eq 1 | Should -Be $psitem.ConfigValues.CLREnabled -Because 'This is the setting you have chosen for CLR Enabled'\n        }\n    }\n}\n\nDescribe \"Cross Database Ownership Chaining\" -Tag CrossDBOwnershipChaining, Security, CIS, Low, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.CrossDBOwnershipChaining' }).Value\n    Context \"Checking Cross Database Ownership Chaining on <_.Name>\" {\n        It \"Cross Database Ownership Chaining should be disabled on <_.Name>\" -Skip:$skip {\n            $PSItem.Configuration.CrossDBOwnershipChaining.ConfigValue | Should -Be 0 -Because \"We expected the Cross DB Ownership Chaining to be disabled\"\n        }\n    }\n}\n\nDescribe \"Dedicated Administrator Connection\" -Tag DAC, Security, CIS, Low, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.dac' }).Value\n    Context \"Checking Dedicated Administrator Connection on <_.Name>\" {\n        It \"DAC is set to <_.ConfigValues.dacallowed> on <_.Name>\" -Skip:$skip {\n            $PSItem.Configuration.RemoteDACConnectionsEnabled.ConfigValue -eq 1 | Should -Be $psitem.ConfigValues.dacallowed -Because 'This is the setting that you have chosen for DAC connections'\n        }\n    }\n}\n\nDescribe \"Default Backup Compression\" -Tag DefaultBackupCompression, Low, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.DefaultBackupCompression' }).Value\n    Context \"Checking Default Backup Compression on <_.Name>\" {\n        It \"Default Backup Compression is set to <_.ConfigValues.DefaultBackupCompression> on <_.Name>\" -Skip:$skip {\n            $PSItem.Configuration.DefaultBackupCompression.ConfigValue -eq 1 | Should -Be $psitem.ConfigValues.DefaultBackupCompression -Because 'This is the setting you have chosen the default backup compression'\n        }\n    }\n}\n\nDescribe \"Default File Path\" -Tag DefaultFilePath, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.DefaultFilePath' }).Value\n    Context \"Checking Default Data File Path on <_.Name>\" {\n        It \"Default Data File Path should not be on the C Drive on <_.Name>\" -Skip:$skip {\n            $PSItem.Settings.DefaultFile.substring(0, 1) | Should -Not -Be \"C\" -Because 'Default Data file path should not be your C:\\ drive'\n        }\n        It \"Default Log File Path should not be on the C Drive on <_.Name>\" -Skip:$skip {\n            $PSItem.Settings.DefaultLog.substring(0, 1) | Should -Not -Be \"C\" -Because 'Default Log file path should not be your C:\\ drive'\n        }\n    }\n}\n\nDescribe \"Default Trace\" -Tag DefaultTrace, CIS, Low, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.defaulttrace' }).Value\n    Context \"Checking Default Trace on <_.Name>\" {\n        It \"The Default Trace should be enabled on <_.Name>\" -Skip:$skip {\n            $PSItem.Configuration.DefaultTraceEnabled.ConfigValue | Should -Be 1 -Because \"We expected the Default Trace to be enabled\"\n        }\n    }\n}\n\nDescribe \"Error Log Entries\" -Tag ErrorLog, Medium, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.errorlogentries' }).Value\n    Context \"Checking error log on <_.Name>\" {\n        It \"Error log should be free of error severities 17-24 within the window of <_.ErrorLogEntries.logWindow> days on <_.Name>\" -Skip:$Skip {\n            $PSItem.ErrorLogEntries.Count | Should -Be 0 -Because \"these severities indicate serious problems\"\n        }\n    }\n}\n\nDescribe \"Error Log Count\" -Tag ErrorLogCount, CIS, Low, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.ErrorLogCount' }).Value\n    Context \"Checking error log count on <_.Name>\" {\n        It \"Error log count should be greater or equal to <_.ConfigValues.errorLogCount> on <_.Name>\" -Skip:$skip {\n            $psitem.NumberOfLogFiles | Should -BeGreaterOrEqual $psitem.ConfigValues.errorLogCount -Because \"We expect to have at least $($psitem.ConfigValues.errorLogCount) number of error log files\"\n        }\n    }\n}\n\nDescribe \"Hide Instance\" -Tag HideInstance, Security, CIS, Medium, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.security.hideinstance' }).Value\n    Context \"Checking the Hide an Instance of SQL Server Database Engine property on <_.Name>\" {\n        It \"The Hide an Instance of SQL Server Database Engine property on SQL Server instance <_.Name>\" -Skip:$skip {\n            # We don't make this -BeTrue because the possible results  are $true/$false/'Could not connect'\n            $psitem.HideInstance.Result | Should -Be $true -Because \"We expected the hide instance property to be set to $true\"\n        }\n    }\n}\n\nDescribe \"Instance Connection\" -Tag InstanceConnection, Connectivity, High, Instance -ForEach $InstancesToTest {\n    BeforeAll {\n        $skipall = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.connection' }).Value\n        $skipremote = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.connection.remoting' }).Value\n        $skipping = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.connection.ping' }).Value\n        $skipauth = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.connection.auth' }).Value\n        $authscheme = ($__dbcconfig | Where-Object { $_.Name -eq 'policy.connection.authscheme' }).Value\n    }\n    BeforeDiscovery {\n        $skipall = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.connection' }).Value\n        $skipremote = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.connection.remoting' }).Value\n        $skipping = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.connection.ping' }).Value\n        $skipauth = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.connection.auth' }).Value\n        $authscheme = ($__dbcconfig | Where-Object { $_.Name -eq 'policy.connection.authscheme' }).Value\n    }\n\n    Context \"Checking Instance Connection on on <_.Name>\" -Skip:$skipall {\n        It \"connects successfully to <_.Name>\" -Skip:$skipall {\n            $PsItem.InstanceConnection.Connect | Should -BeTrue -Because \"We expect the instance to be connectable\"\n        }\n        It \"auth scheme should be $authscheme on <_.Name>\" -Skip:$skipauth {\n            $PsItem.InstanceConnection.AuthScheme | Should -Be $authscheme -Because \"We expect the auth scheme to be $authscheme\"\n        }\n        It \"We should be able to ping host <_.Name>\" -Skip:$skipping {\n            $PsItem.InstanceConnection.Ping | Should -Be 'Success' -Because \"We expect the instance to be pingable\"\n        }\n        It \"We should be able to remote onto <_.Name>\" -Skip:$skipremote {\n            $PsItem.InstanceConnection.Remote | Should -BeTrue -Because \"We expect the instance to be remotely connectable\"\n        }\n    }\n}\n\nDescribe \"Latest Build\" -Tag LatestBuild, Security, CIS, Medium, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.latestbuild' }).Value\n    Context \"Testing Latest Build on <_.Name>\" {\n        It \"The Latest Build of SQL should be installed on <_.Name>\" -Skip:$skip {\n            $psitem.LatestBuild.Compliant | Should -BeTrue -Because \"being patched to the latest version is important\"\n        }\n    }\n}\n\nDescribe \"Linked Servers\" -Tag LinkedServerConnection, Connectivity, Medium, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.linkedserverconnection' }).Value\n    Context \"Testing Linked Server Connection on <_.Name>\" {\n        It \"should be able to connect to <_.LinkedServerName> for Linked Server <_.RemoteServer> on <_.InstanceName>\" -Skip:$skip -ForEach @($Psitem.LinkedServerResults) {\n            $psitem.Connectivity | Should -BeTrue -Because \"Linked server connection should be successful but the result was $($Psitem.Result)\"\n        }\n    }\n}\n\nDescribe \"Failed Login Auditing\" -Tag LoginAuditFailed, Security, CIS, Medium, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.security.loginauditlevelfailed' }).Value\n    Context \"Testing if failed login auditing is in place on <_.Name>\" {\n        It \"The failed login auditing should be set on  <_.Name>\" -Skip:$skip {\n            $psitem.Settings.AuditLevel | Should -BeIn @(\"Failure\", \"All\") -Because \"We expected the audit level to be set to capture failed logins\"\n        }\n    }\n}\n\nDescribe \"Successful Login Auditing\" -Tag LoginAuditSuccessful, Security, CIS, Medium, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.security.loginauditlevelsuccessful' }).Value\n    Context \"Testing if successful and failed login auditing is in place on  <_.Name>\" {\n        It \"The successful and failed auditing should be set on  <_.Name>\" -Skip:$skip {\n            $psitem.Settings.AuditLevel | Should -Be \"All\" -Because \"We expected the audit level to be set to capture all logins (successful and failed)\"\n        }\n    }\n}\n\nDescribe \"Login Check Policy\" -Tag LoginCheckPolicy, Security, CIS, Medium, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.security.LoginCheckPolicy' }).Value\n    Context \"Testing if the CHECK_POLICY is enabled on all logins on <_.Name>\" {\n        It \"All logins should have the CHECK_POLICY option set to ON on <_.Name>\" -Skip:$skip {\n           ($psitem.logins | Where-Object { $_.LoginType -eq 'SqlLogin' -and $_.PasswordPolicyEnforced -eq $false -and $_.IsDisabled -eq $false }).Count | Should -Be 0 -Because \"We expected the CHECK_POLICY for the all logins to be enabled\"\n        }\n    }\n}\n\nDescribe \"Login Must Change\" -Tag LoginMustChange, Security, CIS, Medium, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.security.LoginMustChange' }).Value\n    Context \"Testing if the new SQL logins that have not logged have to change their password when they log in on <_.Name>\" {\n        It \"All new sql logins should have the have to change their password when they log in for the first time on <_.Name>\" -Skip:$skip {\n            $PsItem.LoginMustChangeCount | Should -Be 0 -Because \"We expected the all the new sql logins to have to change the password on first login\"\n        }\n    }\n}\n\nDescribe \"Login Password Expiration\" -Tag LoginPasswordExpiration, Security, CIS, Medium, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.security.LoginPasswordExpiration' }).Value\n    Context \"Testing if the login password expiration is enabled for sql logins in the sysadmin role on <_.Name>\" {\n        It \"All sql logins should have the password expiration option set to ON in the sysadmin role on <_.Name>\" -Skip:$skip {\n            $PsItem.LoginPasswordExpirationCount | Should -Be 0 -Because \"We expected the password expiration policy to set on all sql logins in the sysadmin role\"\n        }\n    }\n}\n\nDescribe \"Instance MaxDop\" -Tag MaxDopInstance, MaxDop, Medium, Instance -ForEach ($InstancesToTest | Where-Object { $psitem.Name -notin $psitem.ConfigValues.ExcludeInstanceMaxDop }) {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.MaxDopInstance' }).Value\n    Context \"Testing Instance MaxDop Value on <_.Name>\" {\n        #if UseRecommended - check that the CurrentInstanceMaxDop property returned from Test-DbaMaxDop matches the the RecommendedMaxDop property\n        It \"Instance Level MaxDop setting should be correct on <_.Name>\" -Skip:$Skip -ForEach ($Psitem | Where-Object { $psitem.ConfigValues.UseRecommendedMaxDop -eq $true }) {\n            $psitem.MaxDopSettings.CurrentInstanceMaxDop | Should -Be $psitem.MaxDopSettings.RecommendedMaxDop -Because \"We expect the MaxDop Setting to be the default recommended value $($psitem.MaxDopSettings.RecommendedMaxDop)\"\n        }\n        #if not UseRecommended - check that the CurrentInstanceMaxDop property returned from Test-DbaMaxDop matches the MaxDopValue parameter\n        It \"Instance Level MaxDop setting should be correct on <_.Name>\" -Skip:$Skip -ForEach($Psitem | Where-Object { $psitem.ConfigValues.UseRecommendedMaxDop -ne $true }) {\n            $psitem.MaxDopSettings.CurrentInstanceMaxDop | Should -Be $psitem.ConfigValues.InstanceMaxDop -Because \"We expect the MaxDop Setting to be the value you specified $($psitem.ConfigValues.InstanceMaxDop)\"\n        }\n    }\n}\n\nDescribe \"Max Memory\" -Tag MaxMemory, High, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.maxmemory' }).Value\n    Context \"Testing Max Memory on <_.Name>\" {\n        It \"Max Memory setting should be correct on <_.Name>\" -Skip:$skip {\n            $Psitem.MaxMemory.MaxValue | Should -BeLessThan $Psitem.MaxMemory.RecommendedValue -Because 'You do not want to exhaust server memory'\n        }\n    }\n}\n\nDescribe \"SQL Memory Dumps\" -Tag MemoryDump, Medium, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.memorydump' }).Value\n    Context \"Testing SQL Memory Dumps on <_.Name>\" {\n        It \"There should be less than <_.MemoryDump.MaxDumps> since <_.MemoryDump.DumpDateCheckFrom> on <_.Name>\" -Skip:$skip {\n            $Psitem.MemoryDump.Result | Should -BeTrue -Because \"We expected less than $($Psitem.MemoryDump.MaxDumps) dumps since $($PsItem.MemoryDump.DumpDateCheckFrom)but found $($Psitem.MemoryDump.DumpCount) . Memory dumps often suggest issues with the SQL Server instance\"\n        }\n    }\n}\n\nDescribe \"Model Database Growth\" -Tag ModelDbGrowth, Low, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.modeldbgrowth' }).Value\n    Context \"Testing model database growth setting is not default on <_.Name>\" {\n        It \"Growth settings should not be percent for file <_.Name> on <_.Parent.Parent.Parent.Name>\" -Skip:$skip -ForEach $PsItem.Databases['model'].FileGroups.Files {\n            $psitem.GrowthType | Should -Not -Be 'Percent' -Because 'New databases use the model database as a template and percent growth can cause performance problems'\n        }\n        It \"Growth settings should not be 1Mb for file <_.Name> on <_.Parent.Parent.Parent.Name>\" -Skip:$skip -ForEach $PsItem.Databases['model'].FileGroups.Files {\n            $psitem.Growth | Should -Not -Be 1024 -Because 'New databases use the model database as a template and growing for each Mb will have a performance impact'\n        }\n        It \"Growth settings should not be percent for file <_.Name> on <_.Parent.Parent.Name>\" -Skip:$skip -ForEach @($PsItem.Databases['model'].LogFiles) {\n            $psitem.GrowthType | Should -Not -Be 'Percent' -Because 'New databases use the model database as a template and percent growth can cause performance problems'\n        }\n        It \"Growth settings should not be 1Mb for file <_.Name> on <_.Parent.Parent.Name>\" -Skip:$skip -ForEach @($PsItem.Databases['model'].LogFiles) {\n            $psitem.Growth | Should -Not -Be 1024 -Because 'New databases use the model database as a template and growing for each Mb will have a performance impact'\n        }\n    }\n}\n\nDescribe \"Network Latency\" -Tag NetworkLatency, Connectivity, Medium, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.networklatency' }).Value\n    Context \"Testing Network Latency on <_.Name>\" {\n        It \"should have a network latency less than <_.NetworkLatency.Threshold> ms on <_.Name>\" -Skip:$skip {\n            $psitem.NetworkLatency.Latency | Should -BeLessThan $psitem.NetworkLatency.Threshold -Because \"Network latency should be less than $($psitem.NetworkLatency.Threshold) ms\"\n        }\n    }\n}\n\nDescribe \"OLE Automation\" -Tag OLEAutomation, Security, CIS, Low, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.oleautomation' }).Value\n    Context \"Checking OLE Automation on <_.Name>\" {\n        It \"OLE Automation is set to <_.ConfigValues.OLEAutomation> on <_.Name>\" -Skip:$skip {\n            $PSItem.Configuration.OleAutomationProceduresEnabled.ConfigValue -eq 1 | Should -Be $psitem.ConfigValues.OLEAutomation -Because 'OLE Automation can introduce additional security risks'\n        }\n    }\n}\nDescribe \"OLE Automation Procedures Disabled\" -Tag OleAutomationProceduresDisabled, CIS, Low, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.oleautomationproceduresdisabled' }).Value\n    Context \"Checking OLE Automation Procedures on <_.Name>\" {\n        It \"The OLE Automation Procedures should be disabled on <_.Name>\" -Skip:$skip {\n            $PSItem.Configuration.OleAutomationProceduresEnabled.ConfigValue | Should -Be 0 -Because \"We expect the OLE Automation Procedures to be disabled\"\n        }\n    }\n}\n\nDescribe \"Orphaned Files\" -Tag OrphanedFile, Low, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.orphanedfile' }).Value\n    Context \"Testing Orphaned Files on <_.Name>\" {\n        It \"should not have orphaned files on <_.Name>\" -Skip:$skip {\n            $Psitem.OrphanedFile.FileCount | Should -Be 0 -Because 'You dont want any orphaned files - Use Find-DbaOrphanedFile to locate them'\n        }\n    }\n}\n\nDescribe \"Remote Access Disabled\" -Tag RemoteAccessDisabled, Security, CIS, Low, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.remoteaccessdisabled' }).Value\n    Context \"Checking Remote Access on <_.Name>\" {\n        It \"Remote Access should be disabled on <_.Name>\" -Skip:$skip {\n            $PSItem.Configuration.RemoteAccess.ConfigValue | Should -Be 0 -Because \"We expected Remote Access to be disabled\"\n        }\n    }\n}\n\nDescribe \"SA Login Disabled\" -Tag SaDisabled, DISA, CIS, Medium, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.security.sadisabled' }).Value\n    Context \"Checking that sa login has been disabled on <_.Name>\" {\n        It \"sa login is disabled on <_.Name>\" -Skip:$Skip {\n            ($PsItem.Logins | Where-Object ID -EQ 1).IsDisabled | Should -Be $true -Because \"We expected the original sa login to be disabled\"\n        }\n    }\n}\n\nDescribe \"Login SA cannot exist\" -Tag SaExist, CIS, Medium, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.security.saexist' }).Value\n    Context \"Checking that a login named sa does not exist on <_.Name>\" {\n        It \"sa login does not exist on <_.Name>\" -Skip:$Skip {\n            $PsItem.Logins['sa'].Count | Should -Be 0 -Because \"We expected no login to exist with the name sa\"\n        }\n    }\n}\n\nDescribe \"Public Role Permissions\" -Tag PublicPermission, PublicRolePermission, Security, CIS, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.security.PublicPermission' }).Value\n\n    Context \"Testing if the public role permissions don't have permissions  on <_.Name>\" {\n        It \"All permissions should be set to CIS standards on the public role on <_.Name>\" -Skip:$skip {\n            $PsItem.PublicRolePermissions | Should -Be 0 -Because \"We expected the public role to have no permissions for CIS compliance.\"\n        }\n    }\n}\n\nDescribe \"SA Login Renamed\" -Tag SaRenamed, DISA, CIS, Medium, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.SaRenamed' }).Value\n    Context \"Checking that sa login has been renamed on <_.Name>\" {\n        It \"sa login has been renamed on <_.Name>\" -Skip:$Skip {\n            ($PsItem.Logins.Name) | Should -Not -BeIn 'sa' -Because \"Renaming the sa account is a requirement\"\n        }\n    }\n}\n\nDescribe \"Scan For Startup Procedures\" -Tag ScanForStartupProceduresDisabled, Security, CIS, Low, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.scanforstartupproceduresdisabled' }).Value\n    Context \"Checking Scan For Startup Procedures on <_.Name>\" {\n        It \"Scan For Startup Procedures is set to <_.ConfigValues.scanforstartupproceduresdisabled> on <_.Name>\" -Skip:$skip {\n            $PSItem.Configuration.ScanForStartupProcedures.ConfigValue -eq 0 | Should -Be $PSItem.ConfigValues.scanforstartupproceduresdisabled -Because \"We expected the Cross DB Ownership Chaining to be disabled\"\n        }\n    }\n}\n\nDescribe \"SQL and Windows names match\" -Tag ServerNameMatch, Medium, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.servernamematch' }).Value\n    Context \"Testing SQL and Windows names match on <_.Name>\" {\n        It \"should have matching names on <_.Name>\" -Skip:$skip {\n            $Psitem.ServerNameMatch.renamerequired | Should -BeFalse -Because \"SQL and Windows names should match but configured name $($Psitem.ServerNameMatch.configuredServerName) does not match $($Psitem.ServerNameMatch.netName)\"\n        }\n    }\n}\n\nDescribe \"SQL Engine Service\" -Tag SqlEngineServiceAccount, ServiceAccount, High, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.sqlengineserviceaccount' }).Value\n    Context \"Testing SQL Engine Service on <_.Name>\" -Skip:$skip {\n        It \"SQL Engine service account should be <_.State> on <_.InstanceName>\" -ForEach $PsItem.SqlEngineServiceAccount {\n            $PsItem.State | Should -Be $PsItem.ExpectedState -Because \"We expected the SQL Engine service account to be $($PsItem.ExpectedState)\"\n        }\n        It \"SQL Engine service account should have a start mode of <_.ExpectedStartType> on instance <_.InstanceName>\" -ForEach $PsItem.SqlEngineServiceAccount {\n            $PsItem.StartType | Should -Be $PsItem.ExpectedStartType -Because $Psitem.because\n        }\n    }\n}\n\nDescribe \"SQL Mail XPs Disabled\" -Tag SQLMailXPsDisabled, Security, CIS, Low, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.SQLMailXPsDisabled' }).Value\n    Context \"Checking SQL Mail XPs on <_.Name>\" {\n        It \"SQL Mail XPs should be disabled on <_.Name>\" -Skip:($skip -or $psitem.VersionMajor -gt 10) {\n            $PSItem.Configuration.SqlMailXPsEnabled.ConfigValue | Should -Be 0 -Because \"We expected Sql Mail XPs to be disabled\"\n        }\n    }\n}\n\nDescribe \"Supported Build\" -Tag SupportedBuild, DISA, High, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.SupportedBuild' }).Value\n    Context \"Checking that build is still supported by Microsoft for <_.Name>\" -Skip:$skip {\n        It \"The build is not behind the latest build by more than <_.SupportedBuild.BuildBehind> for <_.Name>\" {\n            $psItem.SupportedBuild.Compliant | Should -BeTrue -Because \"this build $($psItem.SupportedBuild.Build) should not be behind the required build\"\n        }\n        It \"The build is supported by Microsoft for <_.Name>\" {\n            $psItem.SupportedBuild.InsideMicrosoftSupport | Should -BeTrue -Because \"this build $($psItem.SupportedBuild.Build) is now unsupported by Microsoft\"\n        }\n        It \"The build is supported by Microsoft within the warning window of <_.SupportedBuild.BuildWarning> months for <_.Name>\" {\n            $psItem.SupportedBuild.InsideBuildWarning | Should -BeTrue -Because \"this build $($psItem.SupportedBuild.Build)  will be unsupported by Microsoft on $($psItem.SupportedBuild.SupportedUntil) which is less than $($psItem.SupportedBuild.BuildWarning) months away\"\n        }\n    }\n}\n\nDescribe \"Suspect Page Limit Nearing\" -Tag SuspectPageLimit, Medium, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.suspectpagelimit' }).Value\n    Context \"Testing if the suspect_pages table is nearing the limit of 1000 rows on on <_.Name>\" {\n        It \"The suspect_pages table in msdb shouldn't be nearing the limit of 1000 rows on on <_.Name>\" -Skip:$skip {\n            $PSItem.SuspectPageCountResult | Should -BeTrue -Because \"The suspect_pages table in msdb shouldn't be nearing the limit of 1000 rows\"\n        }\n    }\n}\nDescribe \"Trace Flags Expected\" -Tag TraceFlagsExpected, TraceFlag, High, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.TraceFlagsExpected' }).Value\n    Context \"Testing Expected Trace Flags on <_.Name>\" {\n        It \"Expected No Trace Flags to exist on <_.Name>\" -Skip:$skip -ForEach ($Psitem | Where-Object { $null -eq $psitem.ConfigValues.TraceFlagsExpected }) {\n            $PsItem.ExpectedTraceFlags.ActualTraceFlags.TraceFlag | Should -BeNullOrEmpty -Because \"We expect that there will be no Trace Flags set on $($Psitem.Name) \"\n        }\n        It \"Expected Trace Flags <_.ExpectedTraceFlag> to exist on <_.InstanceName>\" -Skip:$skip -ForEach ($PsItem.ExpectedTraceFlags | Where-Object { $psitem.ExpectedTraceFlag -ne 'null' }) {\n            $PsItem.ActualTraceFlags.TraceFlag | Should -Contain $PsItem.ExpectedTraceFlag -Because \"We expect that Trace Flag $($PsItem.ExpectedTraceFlag) will be set on $($Psitem.InstanceName) \"\n        }\n    }\n}\n\nDescribe \"Trace Flags Not Expected\" -Tag TraceFlagsNotExpected, TraceFlag, Medium, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.TraceFlagsNotExpected' }).Value\n    Context \"Testing Not Expected Trace Flags on <_.Name>\" {\n        It \"Expected No Trace Flags except for <_.ConfigValues.TraceFlagsExpected> to exist on <_.Name>\" -Skip:$skip -ForEach ($Psitem | Where-Object { $null -eq $psitem.ConfigValues.TraceFlagsNotExpected }) {\n            $PsItem.NotExpectedTraceFlags.ActualTraceFlags.TraceFlag | Should -BeNullOrEmpty -Because \"We expect that there will be no Trace Flags set on $($Psitem.Name) except for $($psitem.ConfigValues.ExpectedTraceFlag)\"\n        }\n        It \"Expected <_.NotExpectedTraceFlag> Trace Flag to not exist on <_.InstanceName>\" -Skip:$skip -ForEach ($PsItem.NotExpectedTraceFlags | Where-Object { $psitem.NotExpectedTraceFlag -ne 'null' }) {\n            $PsItem.ActualTraceFlags.TraceFlag | Should -Not -Contain $PsItem.NotExpectedTraceFlag -Because \"We expect that Trace Flag $($PsItem.NotExpectedTraceFlag) will not be set on $($Psitem.InstanceName) except for $($psitem.ConfigValues.ExpectedTraceFlag)\"\n        }\n    }\n}\n\nDescribe \"Two Digit Year Cutoff\" -Tag TwoDigitYearCutoff, Low, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.TwoDigitYearCutoff' }).Value\n    Context \"Testing Two Digit Year Cutoff on <_.Name>\" {\n        It \"Two Digit Year Cutoff is set to <_.ConfigValues.TwoDigitYearCutoff> on <_.Name>\" -Skip:$skip {\n            $PSItem.Configuration.TwoDigitYearCutoff.ConfigValue | Should -Be $psitem.ConfigValues.TwoDigitYearCutoff -Because 'This is the value that you have chosen for Two Digit Year Cutoff configuration'\n        }\n    }\n}\n\nDescribe \"sp_whoisactive is Installed\" -Tag WhoIsActiveInstalled, Low, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.WhoIsActiveInstalled' }).Value\n    Context \"Testing WhoIsActive exists on <_.Name>\" {\n        It \"WhoIsActive should exist on <_.ConfigValues.whoisactivedatabase> on <_.Name>\" -Skip:$skip {\n            $Psitem.ConfigValues.WhoIsActiveInstalled | Should -Be 1 -Because \"The sp_WhoIsActive stored procedure should be installed in $($psitem.ConfigValues.whoisactivedatabase)\"\n        }\n    }\n}\n\nDescribe \"XE Sessions that should Exist\" -Tag XESessionExists, ExtendedEvent, Medium, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.XESessionExists' }).Value\n    Context \"Checking sessions on <_.Name>\" {\n        It \"Session <_.SessionName> should exist on <_.Name>\" -Skip:$skip -ForEach $PsItem.XeSessions.RequiredExists {\n            $psitem.SessionName | Should -BeIn $PsItem.Sessions -Because \"$($psitem.SessionName) session should exist on $($PsItem.Name)\"\n        }\n    }\n}\n\nDescribe \"XE Sessions that should be running\" -Tag XESessionRunning, ExtendedEvent, Medium, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.XESessionRunning' }).Value\n    Context \"Checking sessions on <_.Name>\" {\n        It \"Session <_.SessionName> should be running on <_.Name>\" -Skip:$skip -ForEach $PsItem.XeSessions.RequiredRunning {\n            $psitem.SessionName | Should -BeIn $PsItem.Running -Because \"$($psitem.SessionName) session should be running on $($PsItem.Name)\"\n        }\n    }\n}\n\nDescribe \"XE Sessions That Are Allowed to Be Running\" -Tag XESessionRunningAllowed, ExtendedEvent, Medium, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.XESessionRunningAllowed' }).Value\n    Context \"Checking running sessions allowed on <_.Name>\" {\n        It \"Session <_.SessionName> is allowed to be running on <_.Name>\" -Skip:$skip -ForEach $PsItem.XeSessions.RunningAllowed {\n            $psitem.SessionName | Should -BeIn $PsItem.Allowed -Because \"Only $($PsItem.Allowed) sessions are allowed to be running $($PsItem.Name)\"\n        }\n    }\n}\n\nDescribe \"XE Sessions that should be Stopped\" -Tag XESessionStopped, ExtendedEvent, Medium, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.XESessionStopped' }).Value\n    Context \"Checking sessions on <_.Name>\" {\n        It \"Session <_.SessionName> should not be running on <_.Name>\" -Skip:$skip -ForEach $PsItem.XeSessions.RequiredStopped {\n            $psitem.SessionName | Should -Not -BeIn $PsItem.Running -Because \"$($psitem.SessionName) session should be stopped on $($PsItem.Name)\"\n        }\n    }\n}\n\nDescribe \"XP CmdShell\" -Tag XpCmdShellDisabled, security, CIS, Medium, Instance -ForEach $InstancesToTest {\n    $skip = ($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.XpCmdShellDisabled' }).Value\n    Context \"Testing XP CmdShell on <_.Name>\" {\n        It \"XpCmdShellDisabled is set to <_.ConfigValues.XpCmdShellDisabled> on <_.Name>\" -Skip:$skip {\n            $PSItem.Configuration.XpCmdShellEnabled.ConfigValue -eq 0 | Should -Be $psitem.ConfigValues.XpCmdShellDisabled -Because 'This is the value that you have chosen for XPXmdShellDisabled configuration'\n        }\n    }\n}\n\n<#\nDescribe \"TempDB Configuration\" -Tags TempDbConfiguration, Medium, Instance -ForEach $InstancesToTest {\n    Context \"Testing TempDB Configuration on $psitem\" -Skip:(($__dbcconfig | Where-Object { $_.Name\n        It \"should have TF1118 enabled on <_.Name>\" -Skip:((($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.XESessionRunningAllowed' }).Value)  -or ($InstanceSMO.VersionMajor -gt 12)) {\n            $psitem.TempDBConfig.TF118EnabledCurrent | Should -Be  $psitem.TempDBConfig.TF118EnabledRecommended -Because 'TF 1118 should be enabled'\n        }\n        It \"should have <_.TempDBConfig.TempDBFilesRecommended> TempDB Files on <_.Name>\" -Skip:(($__dbcconfig | Where-Object { $_.Name -eq 'skip.tempdbfileCount' }).Value)  {\n            $psitem.TempDBConfig.TempDBFilesCurrent | Should -Be $psitem.TempDBConfig.TempDBFilesRecommended -Because 'This is the recommended number of tempdb files for your server'\n        }\n        It \"should not have TempDB Files autogrowth set to percent on $($TempDBTest[2].SqlInstance)\" -Skip:(($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.XESessionRunningAllowed' }).Value)  {\n            $TempDBTest[2].CurrentSetting | Should -Be $TempDBTest[2].Recommended -Because 'Auto growth type should not be percent'\n        }\n        It \"should not have TempDB Files on the C Drive on $($TempDBTest[3].SqlInstance)\" -Skip:(($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.XESessionRunningAllowed' }).Value) {\n            $TempDBTest[3].CurrentSetting | Should -Be $TempDBTest[3].Recommended -Because 'You do not want the tempdb files on the same drive as the operating system'\n        }\n        It \"should not have TempDB Files with MaxSize Set on $($TempDBTest[4].SqlInstance)\" -Skip:(($__dbcconfig | Where-Object { $_.Name -eq 'skip.instance.XESessionRunningAllowed' }).Value) {\n            $TempDBTest[4].CurrentSetting | Should -Be $TempDBTest[4].Recommended -Because 'Tempdb files should be able to grow'\n        }\n        It \"The data files should all be the same size on $($TempDBTest[0].SqlInstance)\" {\n            Assert-TempDBSize -Instance $Psitem\n        }\n    }\n}\n#>"
  },
  {
    "path": "source/checks/LogShipping.Tests.ps1",
    "content": "$filename = $MyInvocation.MyCommand.Name.Replace(\".Tests.ps1\", \"\")\nDescribe \"Log Shipping Status Primary\" -Tags LogShippingPrimary, $filename {\n    @(Get-Instance).ForEach{\n        Context \"Testing the primary databases on $psitem\" {\n            @(Test-DbaDbLogShipStatus -SqlInstance $psitem -Primary).ForEach{\n                It \"Status should be OK for $($psitem.Database) on $($psitem.SqlInstance)\" {\n                    $psitem.Status | Should -Be \"All OK\" -Because 'The Log shipping should be ok'\n                }\n            }\n        }\n    }\n}\nDescribe \"Log Shipping Status Secondary\" -Tags LogShippingSecondary, $filename {\n    @(Get-Instance).ForEach{\n        Context \"Testing the secondary databases on $psitem\" {\n            @(Test-DbaDbLogShipStatus -SqlInstance $psitem -Secondary).ForEach{\n                It \"Status should be OK for $($psitem.Database) on $($psitem.SqlInstance)\" {\n                    $psitem.Status | Should -Be \"All OK\"  -Because 'The Log shipping should be ok'\n                }\n            }\n        }\n    }\n}\n\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQU70DEQ6DkU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n# k8AFyw7TYJNV6lrFaVC/jGFPByUko/3MIm/l9J1RZkXSbPmoTfJYoc/N0Paad/Rk\n# +PIjcfuDsDSVm0Cu6gzRR2dt9z/1llPEmXD8edxm4fwq8be1DpEcZKg8pKhi6opm\n# x6aDA9x/E3phqNK9DxYnRl+fQybRX+78QLli4544t5RC3jr1UatkKGVe7KBOU7ip\n# 8+mvhb4U09vnIG9m60tTLfyXwnbOKH/gBc3EbMAmgK2Wvk+x\n# SIG # End signature block\n"
  },
  {
    "path": "source/checks/MaintenanceSolution.Tests.ps1",
    "content": "$filename = $MyInvocation.MyCommand.Name.Replace(\".Tests.ps1\", \"\")\n\nDescribe \"Ola maintenance solution installed\" -Tags OlaInstalled, $filename {\n    $OlaSPs = @('CommandExecute', 'DatabaseBackup', 'DatabaseIntegrityCheck', 'IndexOptimize')\n    $oladb = Get-DbcConfigValue policy.ola.database\n    @(Get-Instance).ForEach{\n        $db = Get-DbaDatabase -SqlInstance $psitem -Database $oladb\n        Context \"Checking the CommandLog table on $psitem\" {\n            It \"The CommandLog table exists in $oladb on $psitem\" {\n                @($db.tables | Where-Object name -eq \"CommandLog\").Count | Should -Be 1 -Because 'The command log table is required'\n            }\n        }\n        Context \"Checking the Ola Stored Procedures on $psitem\" {\n            It \"The stored procedures exists in $oladb on $psitem\" {\n                ($db.StoredProcedures | Where-Object { $psitem.schema -eq 'dbo' -and $psitem.name -in $OlaSPs } | Measure-Object).Count | Should -Be $OlaSPs.Count -Because 'The stored procedures are required for Olas jobs to run'\n            }\n        }\n    }\n}\n\n$SysFullJobName = Get-DbcConfigValue ola.JobName.SystemFull\n$UserFullJobName = Get-DbcConfigValue ola.JobName.UserFull\n$UserDiffJobName = Get-DbcConfigValue ola.JobName.UserDiff\n$UserLogJobName = Get-DbcConfigValue ola.JobName.UserLog\n$CommandLogJobName = Get-DbcConfigValue ola.JobName.CommandLogCleanup\n$SysIntegrityJobName = Get-DbcConfigValue ola.JobName.SystemIntegrity\n$UserIntegrityJobName = Get-DbcConfigValue ola.JobName.UserIntegrity\n$UserIndexJobName = Get-DbcConfigValue ola.JobName.UserIndex\n$OutputFileJobName = Get-DbcConfigValue ola.JobName.OutputFileCleanup\n$DeleteBackupJobName = Get-DbcConfigValue ola.JobName.DeleteBackupHistory\n$PurgeBackupJobName = Get-DbcConfigValue ola.JobName.PurgeBackupHistory\n\n\nDescribe \"Ola - $SysFullJobName\" -Tags SystemFull, OlaJobs, $filename {\n    $Enabled = Get-DbcConfigValue policy.ola.SystemFullenabled\n    $Scheduled = Get-DbcConfigValue policy.ola.SystemFullscheduled\n    $Retention = Get-DbcConfigValue policy.ola.SystemFullretention\n\n    @(Get-Instance).ForEach{\n        $job = Get-DbaAgentJob -SqlInstance $psitem -Job $SysFullJobName\n        Context  \"Is job enabled on $psitem\" {\n            It \"$SysFullJobName should be enabled - $Enabled on $psitem\" {\n                $job.IsEnabled | Should -Be $Enabled -Because \"If the $SysFullJobName job is not enabled it will not run\"\n            }\n        }\n        Context \"Is job scheduled on $psitem\" {\n            It \"$SysFullJobName should be scheduled - $Scheduled on $psitem\" {\n                $job.HasSchedule | Should -Be $Scheduled -Because \"If the $SysFullJobName job is not scheduled it will not run\"\n            }\n            It \"$SysFullJobName schedules should be enabled - $Scheduled on $psitem\" {\n                $results = ($job.JobSchedules | Where-Object IsEnabled | Measure-Object).Count -gt 0\n                $results | Should -BeGreaterThan 0 -Because \"If the schedule is not enabled the $SysFullJobName jobs will not run\"\n            }\n        }\n\n        if ($Retention) {\n            Context \"Checking the backup retention on $psitem\" {\n                $jobsteps = $job.JobSteps | Where-Object { $_.SubSystem -eq \"CmdExec\" -or $_.SubSystem -eq \"TransactSql\" }\n                if ($jobsteps) {\n                    $results = $jobsteps.Command.Split(\"@\") | Where-Object { $_ -match \"CleanupTime\" }\n                }\n                else {\n                    $results = $null\n                }\n\n                It \"Is the backup retention set to at least $Retention hours on $psitem\" {\n                    if ($results) {\n                        [int]$hours = $results.split(\"=\")[1].split(\",\").split(\" \")[1].replace('NULL','')\n                    }\n                    $hours | Should -BeGreaterOrEqual $Retention -Because \"The backup retention for $SysFullJobName needs to be correct\"\n                }\n            }\n        }\n    }\n}\n\nDescribe \"Ola - $UserFullJobName\" -Tags UserFull, OlaJobs, $filename {\n    @(Get-Instance).ForEach{\n        $job = Get-DbaAgentJob -SqlInstance $psitem -Job $UserFullJobName\n\n        $Enabled = Get-DbcConfigValue policy.ola.UserFullenabled\n        $Scheduled = Get-DbcConfigValue policy.ola.UserFullscheduled\n        $Retention = Get-DbcConfigValue policy.ola.UserFullretention\n\n        Context  \"Is job enabled on $psitem\" {\n            It \"$UserFullJobName should be enabled - $Enabled on $psitem\" {\n                $job.IsEnabled | Should -Be $Enabled -Because \"If the $UserFullJobName job is not enabled it will not run\"\n            }\n        }\n        Context \"Is job scheduled on $psitem\" {\n            It \"$UserFullJobName should be scheduled - $Scheduled on $psitem\" {\n                $job.HasSchedule | Should -Be $Scheduled -Because \"If the $UserFullJobName job is not scheduled it will not run\"\n            }\n            It \"$($UserFullJobName) schedules should be enabled - $Scheduled on $psitem\" {\n                $results = ($job.JobSchedules | Where-Object IsEnabled | Measure-Object).Count -gt 0\n                $results | Should -BeGreaterThan 0 -Because \"If the schedule is not enabled the $UserFullJobName job will not run\"\n            }\n        }\n\n        if ($Retention) {\n            Context \"Checking the backup retention on $psitem\" {\n                $jobsteps = $job.JobSteps | Where-Object { $_.SubSystem -eq \"CmdExec\" -or $_.SubSystem -eq \"TransactSql\" }\n                if ($jobsteps) {\n                    $results = $jobsteps.Command.Split(\"@\") | Where-Object { $_ -match \"CleanupTime\" }\n                }\n                else {\n                    $results = $null\n                }\n\n                It \"Is the backup retention set to at least $Retention hours on $psitem\" {\n                    if ($results) {\n                        [int]$hours = $results.split(\"=\")[1].split(\",\").split(\" \")[1].replace('NULL','')\n                    }\n                    $hours | Should -BeGreaterOrEqual $Retention -Because \"The backup retention for $UserFullJobName needs to be correct\"\n                }\n            }\n        }\n    }\n}\n\nDescribe \"Ola - $UserDiffJobName\" -Tags UserDiff, OlaJobs, $filename {\n    @(Get-Instance).ForEach{\n        $job = Get-DbaAgentJob -SqlInstance $psitem -Job $UserDiffJobName\n\n        $Enabled = Get-DbcConfigValue policy.ola.UserDiffenabled\n        $Scheduled = Get-DbcConfigValue policy.ola.UserDiffscheduled\n        $Retention = Get-DbcConfigValue policy.ola.UserDiffretention\n\n        Context  \"Is job enabled on $psitem\" {\n            It \"$UserDiffJobName should be enabled - $Enabled on $psitem\" {\n                $job.IsEnabled | Should -Be $Enabled -Because \"If the $UserDiffJobName job is not enabled it will not run\"\n            }\n        }\n        Context \"Is job scheduled on $psitem\" {\n            It \"$UserDiffJobName should be scheduled - $Scheduled on $psitem\" {\n                $job.HasSchedule | Should -Be $Scheduled -Because \"If the $UserDiffJobName job is not scheduled it will not run\"\n            }\n            It \"$($UserDiffJobName) schedules should be enabled - $Scheduled on $psitem\" {\n                $results = ($job.JobSchedules | Where-Object IsEnabled | Measure-Object).Count -gt 0\n                $results | Should -BeGreaterThan 0 -Because \"If the schedule is not enabled the $UserDiffJobName job will not run\"\n            }\n        }\n\n        if ($Retention) {\n            Context \"Checking the backup retention on $psitem\" {\n                $jobsteps = $job.JobSteps | Where-Object { $_.SubSystem -eq \"CmdExec\" -or $_.SubSystem -eq \"TransactSql\" }\n                if ($jobsteps) {\n                    $results = $jobsteps.Command.Split(\"@\") | Where-Object { $_ -match \"CleanupTime\" }\n                }\n                else {\n                    $results = $null\n                }\n\n                It \"Is the backup retention set to at least $Retention hours on $psitem\" {\n                    if ($results) {\n                        [int]$hours = $results.split(\"=\")[1].split(\",\").split(\" \")[1].replace('NULL','')\n                    }\n                    $hours | Should -BeGreaterOrEqual $Retention -Because \"The backup retention for $UserDiffJobName needs to be correct\"\n                }\n            }\n        }\n    }\n}\n\nDescribe \"Ola - $UserLogJobName\" -Tags UserLog, OlaJobs, $filename {\n    @(Get-Instance).ForEach{\n        $job = Get-DbaAgentJob -SqlInstance $psitem -Job $UserLogJobName\n\n        $Enabled = Get-DbcConfigValue policy.ola.UserLogenabled\n        $Scheduled = Get-DbcConfigValue policy.ola.UserLogscheduled\n        $Retention = Get-DbcConfigValue policy.ola.UserLogretention\n\n        Context  \"Is job enabled on $psitem\" {\n            It \"$UserLogJobName should be enabled - $Enabled on $psitem\" {\n                $job.IsEnabled | Should -Be $Enabled -Because \"If the $UserLogJobName job is not enabled it will not run\"\n            }\n        }\n        Context \"Is job scheduled on $psitem\" {\n            It \"$UserLogJobName should be scheduled - $Scheduled on $psitem\" {\n                $job.HasSchedule | Should -Be $Scheduled -Because \"If the $UserLogJobName job is not scheduled it will not run\"\n            }\n            It \"$($UserLogJobName) schedules should be enabled - $Scheduled on $psitem\" {\n                $results = ($job.JobSchedules | Where-Object IsEnabled | Measure-Object).Count -gt 0\n                $results | Should -BeGreaterThan 0 -Because \"If the schedule is not enabled the $UserLogJobName job will not run\"\n            }\n        }\n\n        if ($Retention) {\n            Context \"Checking the backup retention on $psitem\" {\n                $jobsteps = $job.JobSteps | Where-Object { $_.SubSystem -eq \"CmdExec\" -or $_.SubSystem -eq \"TransactSql\" }\n                if ($jobsteps) {\n                    $results = $jobsteps.Command.Split(\"@\") | Where-Object { $_ -match \"CleanupTime\" }\n                }\n                else {\n                    $results = $null\n                }\n\n                It \"Is the backup retention set to at least $Retention hours on $psitem\" {\n                    if ($results) {\n                        [int]$hours = $results.split(\"=\")[1].split(\",\").split(\" \")[1].replace('NULL','')\n                    }\n                    $hours | Should -BeGreaterOrEqual $Retention -Because \"The backup retention for $UserLogJobName needs to be correct\"\n                }\n            }\n        }\n    }\n}\n\nDescribe \"Ola - $CommandLogJobName\" -Tags CommandLog, OlaJobs, $filename {\n    @(Get-Instance).ForEach{\n        $job = Get-DbaAgentJob -SqlInstance $psitem -Job $CommandLogJobName\n\n        $Enabled = Get-DbcConfigValue policy.ola.CommandLogenabled\n        $Scheduled = Get-DbcConfigValue policy.ola.CommandLogscheduled\n        $CleanUp = Get-DbcConfigValue policy.ola.CommandLogCleanUp\n\n        Context  \"Is job enabled on $psitem\" {\n            It \"$CommandLogJobName should be enabled - $Enabled on $psitem\" {\n                $job.IsEnabled | Should -Be $Enabled -Because \"If the $CommandLogJobName job is not enabled it will not run\"\n            }\n        }\n        Context \"Is job scheduled on $psitem\" {\n            It \"$CommandLogJobName should be scheduled - $Scheduled on $psitem\" {\n                $job.HasSchedule | Should -Be $Scheduled -Because \"If the $CommandLogJobName job is not scheduled it will not run\"\n            }\n            It \"$($CommandLogJobName) schedules should be enabled - $Scheduled on $psitem\" {\n                $results = ($job.JobSchedules | Where-Object IsEnabled | Measure-Object).Count -gt 0\n                $results | Should -BeGreaterThan 0 -Because \"If the schedule is not enabled the $CommandLogJobName job will not run\"\n            }\n        }\n\n        Context \"Checking the Command Log Cleanup Time on $psitem\" {\n            $jobsteps = $job.JobSteps | Where-Object { $_.SubSystem -eq \"CmdExec\" -or $_.SubSystem -eq \"TransactSql\" }\n            $days = [regex]::matches($jobsteps.Command, \"dd,-(\\d*)\").groups[1].value\n\n            It \"Is the Clean up time set to at least $CleanUp Days on $psitem\" {\n                $days | Should -BeGreaterOrEqual $CleanUp -Because \"The Clean up time for $CommandLogJobName needs to be correct\"\n            }\n        }\n    }\n}\n\nDescribe \"Ola - $SysIntegrityJobName\" -Tags SystemIntegrityCheck, OlaJobs, $filename {\n    @(Get-Instance).ForEach{\n        $job = Get-DbaAgentJob -SqlInstance $psitem -Job $SysIntegrityJobName\n\n        $Enabled = Get-DbcConfigValue policy.ola.SystemIntegrityCheckenabled\n        $Scheduled = Get-DbcConfigValue policy.ola.SystemIntegrityCheckscheduled\n\n        Context  \"Is job enabled on $psitem\" {\n            It \"$SysIntegrityJobName should be enabled - $Enabled on $psitem\" {\n                $job.IsEnabled | Should -Be $Enabled -Because \"If the $SysIntegrityJobName job is not enabled it will not run\"\n            }\n        }\n        Context \"Is job scheduled on $psitem\" {\n            It \"$SysIntegrityJobName should be scheduled - $Scheduled on $psitem\" {\n                $job.HasSchedule | Should -Be $Scheduled -Because \"If the $SysIntegrityJobName job is not scheduled it will not run\"\n            }\n            It \"$($SysIntegrityJobName) schedules should be enabled - $Scheduled on $psitem\" {\n                $results = ($job.JobSchedules | Where-Object IsEnabled | Measure-Object).Count -gt 0\n                $results | Should -BeGreaterThan 0 -Because \"If the schedule is not enabled the $SysIntegrityJobName job will not run\"\n            }\n        }\n    }\n}\n\nDescribe \"Ola - $UserIntegrityJobName\" -Tags UserIntegrityCheck, OlaJobs, $filename {\n    @(Get-Instance).ForEach{\n        $job = Get-DbaAgentJob -SqlInstance $psitem -Job $UserIntegrityJobName\n\n        $Enabled = Get-DbcConfigValue policy.ola.UserIntegrityCheckenabled\n        $Scheduled = Get-DbcConfigValue policy.ola.UserIntegrityCheckscheduled\n\n        Context  \"Is job enabled on $psitem\" {\n            It \"$UserIntegrityJobName should be enabled - $Enabled on $psitem\" {\n                $job.IsEnabled | Should -Be $Enabled -Because \"If the $UserIntegrityJobName job is not enabled it will not run\"\n            }\n        }\n        Context \"Is job scheduled on $psitem\" {\n            It \"$UserIntegrityJobName should be scheduled - $Scheduled on $psitem\" {\n                $job.HasSchedule | Should -Be $Scheduled -Because \"If the $UserIntegrityJobName job is not scheduled it will not run\"\n            }\n            It \"$($UserIntegrityJobName) schedules should be enabled - $Scheduled on $psitem\" {\n                $results = ($job.JobSchedules | Where-Object IsEnabled | Measure-Object).Count -gt 0\n                $results | Should -BeGreaterThan 0 -Because \"If the schedule is not enabled the $UserIntegrityJobName job will not run\"\n            }\n        }\n    }\n}\n\nDescribe \"Ola - $UserIndexJobName\" -Tags UserIndexOptimize, OlaJobs, $filename {\n    @(Get-Instance).ForEach{\n        $job = Get-DbaAgentJob -SqlInstance $psitem -Job $UserIndexJobName\n\n        $Enabled = Get-DbcConfigValue policy.ola.UserIndexOptimizeenabled\n        $Scheduled = Get-DbcConfigValue policy.ola.UserIndexOptimizescheduled\n\n        Context  \"Is job enabled on $psitem\" {\n            It \"$UserIndexJobName should be enabled - $Enabled on $psitem\" {\n                $job.IsEnabled | Should -Be $Enabled -Because \"If the $UserIndexJobName job is not enabled it will not run\"\n            }\n        }\n        Context \"Is job scheduled on $psitem\" {\n            It \"$UserIndexJobName should be scheduled - $Scheduled on $psitem\" {\n                $job.HasSchedule | Should -Be $Scheduled -Because \"If the $UserIndexJobName job is not scheduled it will not run\"\n            }\n            It \"$($UserIndexJobName) schedules should be enabled - $Scheduled on $psitem\" {\n                $results = ($job.JobSchedules | Where-Object IsEnabled | Measure-Object).Count -gt 0\n                $results | Should -BeGreaterThan 0 -Because \"If the schedule is not enabled the $UserIndexJobName job will not run\"\n            }\n        }\n    }\n}\n\nDescribe \"Ola - $OutputFileJobName\" -Tags OutputFileCleanup, OlaJobs, $filename {\n    @(Get-Instance).ForEach{\n        $job = Get-DbaAgentJob -SqlInstance $psitem -Job $OutputFileJobName\n\n        $Enabled = Get-DbcConfigValue policy.ola.OutputFileCleanupenabled\n        $Scheduled = Get-DbcConfigValue policy.ola.OutputFileCleanupscheduled\n        $CleanUp = Get-DbcConfigValue policy.ola.OutputFileCleanUp\n\n        Context  \"Is job enabled on $psitem\" {\n            It \"$OutputFileJobName should be enabled - $Enabled on $psitem\" {\n                $job.IsEnabled | Should -Be $Enabled -Because \"If the $OutputFileJobName job is not enabled it will not run\"\n            }\n        }\n        Context \"Is job scheduled on $psitem\" {\n            It \"$OutputFileJobName should be scheduled - $Scheduled on $psitem\" {\n                $job.HasSchedule | Should -Be $Scheduled -Because \"If the $OutputFileJobName job is not scheduled it will not run\"\n            }\n            It \"$($OutputFileJobName) schedules should be enabled - $Scheduled on $psitem\" {\n                $results = ($job.JobSchedules | Where-Object IsEnabled | Measure-Object).Count -gt 0\n                $results | Should -BeGreaterThan 0 -Because \"If the schedule is not enabled the $OutputFileJobName job will not run\"\n            }\n        }\n\n        Context \"Checking the Output File Job Cleanup Time on $psitem\" {\n            $jobsteps = $job.JobSteps | Where-Object { $_.SubSystem -eq \"CmdExec\" -or $_.SubSystem -eq \"TransactSql\" }\n            $jobsteps.Command -match \"\\/d\\s-(\\d\\d)\"\n            If($Matches.Count -gt 0){\n                $days = $Matches[1]\n            }\n            else{\n                $days = 0\n            }\n\n            It \"Is the Clean up time set to at least $CleanUp Days on $psitem\" {\n                $days | Should -BeGreaterOrEqual $CleanUp -Because \"The Clean up time for $OutputFileJobName needs to be correct\"\n            }\n        }\n    }\n}\n\nDescribe \"Ola - $DeleteBackupJobName\" -Tags DeleteBackupHistory, OlaJobs, $filename {\n    @(Get-Instance).ForEach{\n        $job = Get-DbaAgentJob -SqlInstance $psitem -Job $DeleteBackupJobName\n\n        $Enabled = Get-DbcConfigValue policy.ola.DeleteBackupHistoryenabled\n        $Scheduled = Get-DbcConfigValue policy.ola.DeleteBackupHistoryscheduled\n        $CleanUp = Get-DbcConfigValue policy.ola.DeleteBackupHistoryCleanUp\n\n        Context  \"Is job enabled on $psitem\" {\n            It \"$DeleteBackupJobName should be enabled - $Enabled on $psitem\" {\n                $job.IsEnabled | Should -Be $Enabled -Because \"If the $DeleteBackupJobName job is not enabled it will not run\"\n            }\n        }\n        Context \"Is job scheduled on $psitem\" {\n            It \"$DeleteBackupJobName should be scheduled - $Scheduled on $psitem\" {\n                $job.HasSchedule | Should -Be $Scheduled -Because \"If the $DeleteBackupJobName job is not scheduled it will not run\"\n            }\n            It \"$($DeleteBackupJobName) schedules should be enabled - $Scheduled on $psitem\" {\n                $results = ($job.JobSchedules | Where-Object IsEnabled | Measure-Object).Count -gt 0\n                $results | Should -BeGreaterThan 0 -Because \"If the schedule is not enabled the $DeleteBackupJobName job will not run\"\n            }\n        }\n\n        Context \"Checking the Delete Backup History Cleanup Time on $psitem\" {\n            $jobsteps = $job.JobSteps | Where-Object { $_.SubSystem -eq \"CmdExec\" -or $_.SubSystem -eq \"TransactSql\" }\n            $days = [regex]::matches($jobsteps.Command, \"dd,-(\\d*)\").groups[1].value\n\n            It \"Is the Clean up time set to at least $CleanUp Days on $psitem\" {\n                $days | Should -BeGreaterOrEqual $CleanUp -Because \"The Clean up time for $DeleteBackupJobName needs to be correct\"\n            }\n        }\n    }\n}\n\nDescribe \"Ola - $PurgeBackupJobName\" -Tags PurgeJobHistory, OlaJobs, $filename {\n    @(Get-Instance).ForEach{\n        $job = Get-DbaAgentJob -SqlInstance $psitem -Job $PurgeBackupJobName\n\n        $Enabled = Get-DbcConfigValue policy.ola.PurgeJobHistoryenabled\n        $Scheduled = Get-DbcConfigValue policy.ola.PurgeJobHistoryscheduled\n        $CleanUp = Get-DbcConfigValue policy.ola.PurgeJobHistoryCleanUp\n\n        Context  \"Is job enabled on $psitem\" {\n            It \"$PurgeBackupJobName should be enabled - $Enabled on $psitem\" {\n                $job.IsEnabled | Should -Be $Enabled -Because \"If the $PurgeBackupJobName job is not enabled it will not run\"\n            }\n        }\n        Context \"Is job scheduled on $psitem\" {\n            It \"$PurgeBackupJobName should be scheduled - $Scheduled on $psitem\" {\n                $job.HasSchedule | Should -Be $Scheduled -Because \"If the $PurgeBackupJobName job is not scheduled it will not run\"\n            }\n            It \"$($PurgeBackupJobName) schedules should be enabled - $Scheduled on $psitem\" {\n                $results = ($job.JobSchedules | Where-Object IsEnabled | Measure-Object).Count -gt 0\n                $results | Should -BeGreaterThan 0 -Because \"If the schedule is not enabled the $PurgeBackupJobName job will not run\"\n            }\n        }\n\n        Context \"Checking the Purge Backup History Cleanup Time on $psitem\" {\n            $jobsteps = $job.JobSteps | Where-Object { $_.SubSystem -eq \"CmdExec\" -or $_.SubSystem -eq \"TransactSql\" }\n            $days = [regex]::matches($jobsteps.Command, \"dd,-(\\d*)\").groups[1].value\n\n            It \"Is the Clean up time set to at least $CleanUp Days on $psitem\" {\n                $days | Should -BeGreaterOrEqual $CleanUp -Because \"The Clean up time for $PurgeBackupJobName needs to be correct\"\n            }\n        }\n    }\n}\n\n\n\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQ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k+gKS/qcNNSK+ugz0pzotNya4sj\n# KFZ6T6AzliNxFJD7EVIBNtsjlMNBWVDIrALhZxOR6VGPxlvFhCXJTY2kuE4zfBTW\n# epbVpbBK8d2Z8NqhSM5Cnh8pwgABYygRIVYGby06XIXDf36Jd0wTk74uOqajOA/S\n# 5XkwxNaeoeV58gEHOquTOpXWsf1JFZBnKI8pn4imT1i/meGdvo5wnaI+uIY8N2m6\n# ZgDjrO0SN5cIMQE8jIaih/LjqplJkL/YB3h9dxLuDm37rSeSv/UX5ltM1cXmxIXk\n# mqUCh2+zTsZ8gOk5bkbuihdKpERqfF/5E8ZMw5mFMynDO+Yz\n# SIG # End signature block\n"
  },
  {
    "path": "source/checks/Server.Tests.ps1",
    "content": "$filename = $MyInvocation.MyCommand.Name.Replace(\".Tests.ps1\", \"\")\n. $PSScriptRoot/../internal/assertions/Server.Assertions.ps1\n\n# follow the guidance in Instance.Assertions to add new checks\n\n$Tags = Get-CheckInformation -Check $Check -Group Server -AllChecks $AllChecks -ExcludeCheck $ChecksToExclude\nif($IsLinux){\nWrite-PSFMessage \"We cannot run any of the Server tests from linux at the moment\" -Level Warning\nReturn\n}\n@(Get-ComputerName).ForEach{\n    $AllServerInfo = Get-AllServerInfo -ComputerName $Psitem -Tags $Tags\n    Describe \"Server Power Plan Configuration\" -Tags PowerPlan, Medium, $filename {\n        Context \"Testing Server Power Plan Configuration on $psitem\" {\n            It \"PowerPlan is High Performance on $psitem\" {\n                Assert-PowerPlan -AllServerInfo $AllServerInfo\n            }\n        }\n    }\n    Describe \"SPNs\" -Tags SPN, $filename {\n        Context \"Testing SPNs on $psitem\" {\n            $computername = $psitem\n            @($AllServerInfo.SPNs).ForEach{\n                It \"There should be an SPN $($psitem.RequiredSPN) for $($psitem.InstanceServiceAccount) on $computername\" {\n                    Assert-SPN -SPN $psitem\n                }\n            }\n        }\n    }\n\n    Describe \"Disk Space\" -Tags DiskCapacity, Storage, DISA, Varied, $filename {\n        $free = Get-DbcConfigValue policy.diskspace.percentfree\n        Context \"Testing Disk Space on $psitem\" {\n            @($AllServerInfo.DiskSpace).ForEach{\n                It \"$($psitem.Name) with $($psitem.PercentFree)% free should be at least $free% free on $($psitem.ComputerName)\" {\n                    Assert-DiskSpace -Disk $psitem\n                }\n            }\n        }\n    }\n\n    Describe \"Ping Computer\" -Tags PingComputer, Varied, $filename {\n        $pingmsmax = Get-DbcConfigValue policy.connection.pingmaxms\n        $pingcount = Get-DbcConfigValue policy.connection.pingcount\n        $skipping = Get-DbcConfigValue skip.connection.ping\n        Context \"Testing Ping to $psitem\" {\n            It -skip:$skipping \"Should have pinged $pingcount times for $psitem\" {\n                Assert-Ping -AllServerInfo $AllServerInfo -Type Ping\n            }\n            It -skip:$skipping \"Average response time (ms) should Be less than $pingmsmax (ms) for $psitem\" {\n                Assert-Ping -AllServerInfo $AllServerInfo -Type Average\n            }\n        }\n    }\n\n    Describe \"CPUPrioritisation\" -Tags CPUPrioritisation, Medium, $filename {\n        $exclude = Get-DbcConfigValue policy.server.cpuprioritisation\n        Context \"Testing CPU Prioritisation on $psitem\" {\n            It \"Should have the registry key set correctly for background CPU Prioritisation on $psitem\" -Skip:$exclude {\n                Assert-CPUPrioritisation -ComputerName $psitem\n            }\n        }\n    }\n\n    Describe \"Disk Allocation Unit\" -Tags DiskAllocationUnit, Medium, $filename {\n        if($IsCoreCLR){\n            Context \"Testing disk allocation unit on $psitem\" {\n                It \"Can't run this check on Core on $psitem\" -Skip {\n                    $true | Should -BeTrue\n                }\n            }\n        }\n        else {\n            Context \"Testing disk allocation unit on $psitem\" {\n                $computerName = $psitem\n                $excludedisks = Get-DbcConfigValue policy.server.excludeDiskAllocationUnit\n                @($AllServerInfo.DiskAllocation).Where{$psitem.IsSqlDisk -eq $true}.ForEach{\n                    if($Psitem.Name -in $excludedisks){\n                        $exclude = $true\n                    }\n                    else {\n                        $exclude = $false\n                    }\n                    It \"$($Psitem.Name) Should be set to 64kb on $computerName\" -Skip:$exclude {\n                        Assert-DiskAllocationUnit -DiskAllocationObject $Psitem\n                    }\n                }\n            }\n        }\n    }\n\n    Describe \"Non Standard Port\" -Tags NonStandardPort, Medium, CIS, $filename {\n        $skip = Get-DbcConfigValue skip.security.nonstandardport\n        Context \"Checking SQL Server ports on $psitem\" {\n            It  \"No SQL Server Instances should be configured with port 1433 on $psitem\" -skip:$skip {\n                Assert-NonStandardPort -AllServerInfo $AllServerInfo\n            }\n        }\n    }\n\n    Describe \"Server Protocols\" -Tags ServerProtocol, Medium, CIS, $filename {\n        $skip = Get-DbcConfigValue skip.security.serverprotocol\n        Context \"Checking SQL Server protocols on $psitem\" {\n            It  \"All SQL Server Instances should be configured to run only TCP/IP protocol on $psitem\" -skip:$skip {\n                Assert-ServerProtocol -AllServerInfo $AllServerInfo\n            }\n        }\n    }\n\n}\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQU4VzG8Um6bNQuBBJDVJTixLoH\n# c6GgggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz\n# c3VyZWQgSUQgQ29kZSBTaWduaW5nIENBMB4XDTE3MDUwOTAwMDAwMFoXDTIwMDUx\n# MzEyMDAwMFowVzELMAkGA1UEBhMCVVMxETAPBgNVBAgTCFZpcmdpbmlhMQ8wDQYD\n# VQQHEwZWaWVubmExETAPBgNVBAoTCGRiYXRvb2xzMREwDwYDVQQDEwhkYmF0b29s\n# czCCASIwDQYJKoZIhvcNA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FluhZHen6dGRrsutmQ9qzsIzV6Q3d\n# 9gEgzpkxYz0IGhizgZtPxpMQBvwHgfqL2vmCSfdibqFT+hKUGIUukpHqaGxEMrJm\n# oecYpJpkUe8xggIoMIICJAIBATCBhjByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMM\n# RGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQD\n# EyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgQ29kZSBTaWduaW5nIENBAhACwXUo\n# dNXChDGFKtigZGnKMAkGBSsOAwIaBQCgeDAYBgorBgEEAYI3AgEMMQowCKACgACh\n# AoAAMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcCAQsxDjAM\n# BgorBgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBQLrVHq2xWVeT/Yis0CW7DFOnrz\n# 3TANBgkqhkiG9w0BAQEFAASCAQBa4ar9/SNGWCbUjfixhB09tP8BgiYT+cVmfouo\n# VqnGmvLgY4FyzP9fDdu8lAFqGDXWEvX1WLHQ8Er0YQwAnqLzAkZ574G/JLkm3AYe\n# Kzmz45DiYWkXDwAUIc9blMY1f3y99sRYbY2ZCAyDnIdzb5hS2iL0jwLO/tI/3exn\n# sDGLRhdApejAphzoLOLiG4lgCLXQgXcebiQ9riqgpna/i4YhR5eeNhHirWRkY0WJ\n# baiw/YXViFXMC7YpNQrZsPntebw929RtRmwkCGmdwggDgSsBUDYUHuZbrpn5Vs4r\n# ifMN8tXG6d2PoD2g0ApF4YHEZGS/nGGolgBzEE/GkPW4z+RQ\n# SIG # End signature block\n"
  },
  {
    "path": "source/dbachecks.psm1",
    "content": "﻿$script:ModuleRoot = $PSScriptRoot\n$VerbosePreference = \"SilentlyContinue\"\n\nfunction Import-ModuleFile {\n    [CmdletBinding()]\n    Param (\n        [string]\n        $Path\n    )\n\n    if ($doDotSource) { . $Path }\n    else {\n        try {\n            $ExecutionContext.InvokeCommand.InvokeScript($false, ([scriptblock]::Create([io.file]::ReadAllText($Path))), $null, $null)\n        }\n        catch {\n            Write-Warning \"Failed to import $Path\"\n        }\n    }\n}\n\n# Detect whether at some level dotsourcing was enforced\n$script:doDotSource = $false\nif ($dbachecks_dotsourcemodule) { $script:doDotSource = $true }\nif ((Get-ItemProperty -Path \"HKLM:\\SOFTWARE\\Microsoft\\WindowsPowerShell\\dbachecks\\System\" -Name \"DoDotSource\" -ErrorAction Ignore).DoDotSource) { $script:doDotSource = $true }\nif ((Get-ItemProperty -Path \"HKCU:\\SOFTWARE\\Microsoft\\WindowsPowerShell\\dbachecks\\System\" -Name \"DoDotSource\" -ErrorAction Ignore).DoDotSource) { $script:doDotSource = $true }\n\n# Execute Preimport actions\nif($IsLinux){\n    Write-Verbose \"Loading preimport in linux\"\n    . Import-ModuleFile -Path \"$ModuleRoot/internal/scripts/preimport.ps1\"\n}else{\n    . Import-ModuleFile -Path \"$ModuleRoot\\internal\\scripts\\preimport.ps1\"\n}\n\n\n# Import all internal functions\nforeach ($function in (Get-ChildItem \"$ModuleRoot\\internal\\functions\\*.ps1\")) {\n    . Import-ModuleFile -Path $function.FullName\n}\n\n# Import all public functions\nforeach ($function in (Get-ChildItem \"$ModuleRoot\\functions\\*.ps1\")) {\n    . Import-ModuleFile -Path $function.FullName\n}\n\n# Execute Postimport actions\nif($IsLinux){\n    Write-Verbose \"Loading postimport in linux\"\n    . Import-ModuleFile -Path \"$ModuleRoot/internal/scripts/postimport.ps1\"\n}else{\n    . Import-ModuleFile -Path \"$ModuleRoot\\internal\\scripts\\postimport.ps1\"\n}\n\nif (-not (Test-Path Alias:Update-Dbachecks)) { Set-Alias -Scope Global -Name 'Update-Dbachecks' -Value 'Update-DbcRequiredModules' }\n$VerbosePreference = \"SilentlyContinue\"\n"
  },
  {
    "path": "source/functions/Clear-DbcPowerBiDataSource.ps1",
    "content": "﻿<#\n.SYNOPSIS\n    Clears the data source directory created by Update-DbcPowerBiDataSource\n.DESCRIPTION\n    Clears the data source directory created by Update-DbcPowerBiDataSource (\"C:\\windows\\temp\\dbachecks\\*.json\" by default). This command makes it easier to clean up data used by PowerBI via Start-DbcPowerBi.\n.PARAMETER Path\n    The directory to your JSON files, which will be removed. \"C:\\windows\\temp\\dbachecks\\*.json\" by default\n.PARAMETER Environment\n    Removes the JSON files for a specific environment\n.PARAMETER EnableException\n    By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\n    This avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\n    Using this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.\n.EXAMPLE\n    Clear-DbcPowerBiDataSource\n\n    Removes \"$env:windir\\temp\\dbachecks\\*.json\"\n.EXAMPLE\n    Clear-DbcPowerBiDataSource -Environment Production\n\n    Removes \"$env:windir\\temp\\dbachecks\\*Production*.json\"\n\n.LINK\nhttps://dbachecks.readthedocs.io/en/latest/functions/Clear-DbcPowerBiDataSource/\n#>\nfunction Clear-DbcPowerBiDataSource {\n    [CmdletBinding()]\n    param (\n        [string]$Path = \"$env:windir\\temp\\dbachecks\",\n        [string]$Environment,\n        [switch]$EnableException\n    )\n    if($IsLinux){\n        Write-PSFMessage \"We cannot run this command from linux at the moment\" -Level Warning\n        Return\n        }\n    $null = Remove-Item \"$Path\\*$Environment*.json\" -ErrorAction SilentlyContinue\n}\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUA00kTu85Ivjt7LC5otovqiJK\n# 1emgggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGln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j0DZJ0tk/\n# HUomLslBpqQgohNMG8OxlfPKhe+/fXIG58IRIQ8l28hdIj8ZM3MlXPRW+yI9wvgM\n# SgHLi+IvYbJW3rCfq9n5wbkMg9f4rjEjPGmv+aoY8mkjBvDe\n# SIG # End signature block\n"
  },
  {
    "path": "source/functions/Convert-DbcResult.ps1",
    "content": "<#\n.SYNOPSIS\nTakes the results of Invoke-DbcCheck, parses it and converts it to a datatable object\n\n.DESCRIPTION\nYou need to run Invoke-DbcCheck with the PassThru parameter and this command will take the\nresults and parse them creating a datatable object with column headings\nDate Label Describe Context Name Database ComputerName Instance Result FailureMessage\nso that it can be written to a database with Write-DbcTable (or Write-DbaDataTable) or to\na file with Set-DbcFile\n\n.PARAMETER TestResults\nThe output of Invoke-DbcCheck (WITH -PassThru)\n\n.PARAMETER Label\nAn optional label to add to the set of results to identify them - Think Morning-Checks or New-instance\n\n.EXAMPLE\nInvoke-DbcCheck -SqlInstance SQL2017N5 -Check AutoClose -Passthru | Convert-DbcResult -Label Beard-Check\n\nRuns the AutoClose check against SQL2017N5 and converts to a datatable with a label of Beard-Check\n\n.EXAMPLE\nInvoke-DbcCheck -SqlInstance SQL2017N5 -Check AutoClose -Passthru | Convert-DbcResult -Label Beard-Check | Write-DbcTable -SqlInstance sql2017n5 -Database tempdb -Table newdbachecks\n\nRuns the AutoClose check against SQL2017N5 and converts to a datatable with a label of Beard-Check and writes it to a table newdbachecks in tempdb on SQL2017N5 (NB Don't use tempdb!!)\n\n.EXAMPLE\nInvoke-DbcCheck -SqlInstance SQL2017N5 -Check AutoClose -Passthru | Convert-DbcResult -Label Beard-Check | Set-DbcFile -FilePath C:\\temp\\dbachecks\\ -FileName Auto-close.json -FileType Json\n\nRuns the AutoClose check against SQL2017N5 and converts to a datatable with a label of Beard-Check and outputs to JSON and saves in C:\\temp\\dbachecks\\Auto-close.json\n\n.NOTES\nInitial - RMS 28/12/2019\n#>\nfunction Convert-DbcResult {\n    [OutputType([System.Data.DataTable])]\n    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', '', Justification = 'Because I dont know why it doesnt know about Label')]\n    Param(\n        # The pester results object\n        [Parameter(Mandatory = $true, ValueFromPipeline = $true)]\n        [Alias('TestsResults')]\n        [PSCustomObject]$Results,\n        [Parameter(Mandatory = $false)]\n        # the label for the Tests\n        [string]$Label = 'NoLabel'\n    )\n\n    begin {\n        Write-PSFMessage \"Creating a datatable\" -Level Verbose\n\n        # Create DataTable Object\n        $table = New-Object system.Data.DataTable Results\n\n        # Create Columns\n        $col1 = New-Object system.Data.DataColumn Date, ([datetime])\n        $col2 = New-Object system.Data.DataColumn Label, ([string])\n        $col3 = New-Object system.Data.DataColumn Describe, ([string])\n        $col4 = New-Object system.Data.DataColumn Context, ([string])\n        $col5 = New-Object system.Data.DataColumn Name, ([string])\n        $col6 = New-Object system.Data.DataColumn Database, ([string])\n        $col7 = New-Object system.Data.DataColumn ComputerName, ([string])\n        $col8 = New-Object system.Data.DataColumn Instance, ([string])\n        $col9 = New-Object system.Data.DataColumn Result, ([string])\n        $col10 = New-Object system.Data.DataColumn FailureMessage, ([string])\n\n        #Add the Columns to the table\n        $table.columns.add($col1)\n        $table.columns.add($col2)\n        $table.columns.add($col3)\n        $table.columns.add($col4)\n        $table.columns.add($col5)\n        $table.columns.add($col6)\n        $table.columns.add($col7)\n        $table.columns.add($col8)\n        $table.columns.add($col9)\n        $table.columns.add($col10)\n\n\n    }\n    process {\n        Write-PSFMessage \"Testing we have a Test Results object\" -Level Verbose\n        if ( $Results.TestResult) {\n            Write-PSFMessage \"Processing the v4 test results\" -Level Verbose\n            $Results.TestResult.ForEach{\n                $ContextSplit = ($PSitem.Context -split ' ')\n                $ComputerName = ($ContextSplit[-1] -split '\\\\')[0]\n                $NameSplit = ($PSitem.Name -split ' ')\n                if ($PSitem.Name -match '^Database\\s(.*?)\\s') {\n                    $Database = $Matches[1]\n                } else {\n                    $Database = $null\n                }\n                $Date = Get-Date\n                # Create a new Row\n                $row = $table.NewRow()\n                # Add values to new row\n                $Row.Date = [datetime]$Date\n                $Row.Label = $Label\n                $Row.Describe = $PSitem.Describe\n                $Row.Context = $ContextSplit[0..($ContextSplit.Count - 3)] -join ' '\n                $Row.Name = $NameSplit[0..($NameSplit.Count - 3)] -join ' '\n                $Row.Database = $Database\n                $Row.ComputerName = $ComputerName\n                $Row.Instance = $ContextSplit[-1]\n                $Row.Result = $PSitem.Result\n                $Row.FailureMessage = $PSitem.FailureMessage\n                #Add new row to table\n                $table.Rows.Add($row)\n            }\n        } else {\n            Write-PSFMessage \"Processing the v5 test results\" -Level Verbose\n            $Results.Tests.Where{ $Psitem.Result -ne 'NotRun' }.ForEach{\n                $TestResult = $Psitem\n                switch ($TestResult.Result) {\n                    'skipped' {\n                        $PathSplit = $TestResult.ExpandedPath.split('.')\n                        $Describe = $PathSplit[0]\n                        $Context = $PathSplit[1]\n                        $ContextSplit = ($Context -split ' ')\n                        $Instance = $ContextSplit[-1]\n                        $CheckName = $TestResult.ExpandedName -replace '<_.Name>', 'CheckSkipped' -replace '<_.SqlInstance>', $Instance\n                        if ($TestResult.ExpandedName -match '<_\\.Name>') {\n                            $Database = 'CheckSkipped'\n                        } else {\n                            $Database = $null\n                        }\n                    }\n                    Default {\n                        $PathSplit = $TestResult.ExpandedPath.split('.')\n                        $Describe = $PathSplit[0]\n                        $Context = $PathSplit[1]\n                        $ContextSplit = ($Context -split ' ')\n                        $Instance = $ContextSplit[-1]\n                        $CheckName = $TestResult.ExpandedName\n                        if ($TestResult.ExpandedName -match '^Database\\s(.*?)\\s') {\n                            $Database = $Matches[1]\n                        } else {\n                            $Database = $null\n                        }\n                    }\n                }\n                $ComputerName = ($ContextSplit[-1] -split '\\\\')[0]\n\n\n                $Date = Get-Date\n\n                # Create a new Row\n                $row = $table.NewRow()\n                # Add values to new row\n                $Row.Date = [datetime]$Date\n                $Row.Label = $Label\n                $Row.Describe = $Describe\n                $Row.Context = $Context\n                $Row.Name = $CheckName\n                $Row.Database = $Database\n                $Row.ComputerName = $ComputerName\n                $Row.Instance = $Instance\n                $Row.Result = $TestResult.Result\n                $Row.FailureMessage = $TestResult.ErrorRecord.Exception.Message\n                #Add new row to table\n                $table.Rows.Add($row)\n            }\n        }\n    }\n    end {\n        Write-Output -NoEnumerate -InputObject $table\n    }\n}\n"
  },
  {
    "path": "source/functions/Export-DbcConfig.ps1",
    "content": "﻿<#\n.SYNOPSIS\n    Exports dbachecks configs to a json file to make it easier to modify or be used for specific configurations.\n\n.DESCRIPTION\n    Exports dbachecks configs to a json file to make it easier to modify or be used for specific configurations.\n\n.PARAMETER Path\n    The path to export to, by default is \"$script:localapp\\config.json\"\n\n.PARAMETER EnableException\nBy default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.\n\n.PARAMETER Force\nOverwrite Existing file\n\n.EXAMPLE\n    Export-DbcConfig\n\n    Exports config to \"$script:localapp\\config.json\"\n.EXAMPLE\n    Export-DbcConfig -Path \\\\nfs\\projects\\config.json\n\n    Exports config to \\\\nfs\\projects\\config.json\n\n.EXAMPLE\n    $config = Export-DbcConfig | Invoke-Item\n\n    Exports config to \"$script:localapp\\config.json\" as and opens it in a default application.\n\n.LINK\nhttps://dbachecks.readthedocs.io/en/latest/functions/Export-DbcConfig/\n#>\nfunction Export-DbcConfig {\n    [CmdletBinding()]\n    [OutputType('System.String')]\n    param (\n        [string]$Path = \"$script:localapp\\config.json\",\n        [switch]$Force\n    )\n\n    Write-PSFMessage \"Testing if $Path exists\" -Level Verbose\n    if (Test-Path -Path $Path) {\n        if (-not $Force) {\n            Write-PSFMessage \"Uh-Oh - File $Path exists - use the Force parameter to overwrite (even if your name is not Luke!)\" -Level Significant\n            Return ''\n        } else {\n            Write-PSFMessage \"File $Path exists and will be overwritten \" -Level Verbose\n        }\n    }\n    try {\n        Get-DbcConfig | Select-Object * | ConvertTo-Json -Depth 10 | Out-File -FilePath $Path -Force -ErrorAction Stop\n        # support for Invoke-Item\n        Get-Item -Path $Path\n        Write-PSFMessage -Message \"Wrote file to $Path\" -Level Verbose\n    } catch {\n        Stop-PSFFunction -Message $_ -Target $Path\n    }\n}\n"
  },
  {
    "path": "source/functions/Get-DbcCheck.ps1",
    "content": "﻿<#\n    .SYNOPSIS\n        Lists all checks, tags and unique identifiers\n\n    .DESCRIPTION\n        Lists all checks, tags and unique identifiers\n\n    .PARAMETER Tag\n        The tag to return information about\n\n    .PARAMETER Pattern\n        May be any string, supports wildcards.\n\n    .PARAMETER Group\n        To be able to filter by group\n\n    .EXAMPLE\n        Get-DbcCheck\n\n        Retrieves all of the available checks\n\n    .EXAMPLE\n        Get-DbcCheck backups\n\n        Retrieves all of the available tags that match backups\n\n    .LINK\n    https://dbachecks.readthedocs.io/en/latest/functions/Get-DbcCheck/\n#>\nfunction Get-DbcCheck {\n    [CmdletBinding()]\n    param (\n        [string]$Tag,\n        [string]$Pattern,\n        [string]$Group\n    )\n\n    process {\n        $script:localapp = Get-DbcConfigValue -Name app.localapp\n        # so that it works cross platform\n        $checksfile = Join-Path -Path $script:localapp -ChildPath 'checks.json'\n        if ($Pattern) {\n            if ($Pattern -notmatch '\\*') {\n                $output = @([System.IO.File]::ReadAllText($checksfile) | ConvertFrom-Json).ForEach{\n                    $psitem | Where-Object {\n                        $_.Group, $_.Description , $_.UniqueTag , $_.AllTags, $_.Type -match $Pattern\n                    }\n                }\n            } else {\n                $output = @([System.IO.File]::ReadAllText($checksfile) | ConvertFrom-Json).ForEach{\n                    $psitem | Where-Object {\n                        $_.Group, $_.Description , $_.UniqueTag , $_.AllTags, $_.Type -like $Pattern\n                    }\n                }\n            }\n        } else {\n            $output = [System.IO.File]::ReadAllText($checksfile) | ConvertFrom-Json\n        }\n        if ($Group) {\n            $output = @($output).ForEach{\n                $psitem | Where-Object {\n                    $_.Group -eq $Group\n                }\n            }\n        }\n        if ($Tag) {\n            $output = @($output).ForEach{\n                $psitem | Where-Object {\n                    $_.AllTags -match $Tag\n                }\n            }\n        }\n        @($output).ForEach{\n            Select-DefaultView -InputObject $psitem -TypeName Check -Property 'Group', 'Type', 'UniqueTag', 'AllTags', 'Config', 'Description'\n        }\n    }\n}"
  },
  {
    "path": "source/functions/Get-DbcConfig.ps1",
    "content": "﻿<#\n.SYNOPSIS\n    Retrieves configuration elements by name.\n\n.DESCRIPTION\n    Retrieves configuration elements by name.\n    Can be used to search the existing configuration list.\n\n.PARAMETER Name\n    Default: \"*\"\n    The name of the configuration element(s) to retrieve.\n    May be any string, supports wildcards.\n\n.PARAMETER EnableException\n    By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\n    This avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\n    Using this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.\n\n.EXAMPLE\n    Get-DbcConfig\n\n    Gets all of the dbachecks configurations for the current session.\n\n.EXAMPLE\n    Get-DbcConfig app.sqlinstance\n\n    Retrieves the configuration element for the configuration app.sqlinstance\n\n.LINK\nhttps://dbachecks.readthedocs.io/en/latest/functions/Get-DbcConfig/\n#>\nfunction Get-DbcConfig {\n    [CmdletBinding()]\n    param (\n        [string[]]$Name = '*',\n        [switch]$EnableException\n    )\n\n    begin {\n        $Module = 'dbachecks'\n    }\n    process {\n        foreach ($configName in $Name) {\n            $configName = $configName.ToLower()\n            $results = [PSFramework.Configuration.ConfigurationHost]::Configurations.Values | Where-Object { ($_.Name -like $configName) -and ($_.Module -like $Module) -and ((-not $_.Hidden) -or ($Force)) } | Sort-Object Module, Name\n            $results | Select-Object Name, Value, Description\n        }\n    }\n}\n\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR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EZj/tF66iVQ6l4rjR7UKESyCUugs1TA+GbRJJ4ZySFhBq\n# 4UhG666U5+1uiBwnMeFNZRc+zv4K9DgzYeIvtPKbxZfm5v0vJ9fpk3hhcbeBe8UV\n# 3Zt6CeJR8MKHr1w/NjUSXujMeRqiRtx7Dr7eur75WNFwyT+acTK7URzQXzdUkjEU\n# 7lTRy2oUWxjdiQk7bWMwdy8Eox7u1PpmrQ5NdWfFRo4ezsz9q7Gk2360QZLmsevb\n# F8irwSmcSyIDubZ6p9LxG/fFUXSlhGQMncrfozRLxcrXLHk3\n# SIG # End signature block\n"
  },
  {
    "path": "source/functions/Get-DbcConfigValue.ps1",
    "content": "﻿<#\n.SYNOPSIS\n    Retrieves raw configuration values by name.\n\n.DESCRIPTION\n    Retrieves raw configuration values by name.\n\n    Can be used to search the existing configuration list.\n\n.PARAMETER Name\n    Default: \"*\"\n\n    The name of the configuration element(s) to retrieve.\n    May be any string, supports wildcards.\n\n.PARAMETER EnableException\n    By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\n    This avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\n    Using this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.\n\n.EXAMPLE\n    Get-DbcConfigValue app.sqlinstance\n\n    Retrieves the raw value for the key \"app.sqlinstance\"\n\n.EXAMPLE\n    Get-DbcConfigValue app.computername\n\n    Retrieves the raw value for the key \"app.computername\"\n\n.LINK\nhttps://dbachecks.readthedocs.io/en/latest/functions/Get-DbcConfig/\n#>\nfunction Get-DbcConfigValue {\n    [CmdletBinding()]\n    param (\n        [string]$Name = '*',\n        [switch]$EnableException\n    )\n\n    begin {\n        #  $Module = \"dbachecks\"\n    }\n    process {\n        $Name = $Name.ToLower()\n        Get-DbcConfig -Name $name | Select-Object -ExpandProperty Value\n    }\n}\n\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQ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iG9w0BAQEFAASCAQBAAzm5rJJtiV/ZtGDlRmw1sY321FBpgDX6vUWi\n# NMh7GLPkTRKN78Z69mCzd8tI+G2LOVe4UyJftqWodS+ZXxQGjxWs9/EqVFjqhIgo\n# 7QF+w5szvjskt4Gj1BFXz2jkbWiqzUNMddZF0GLnQYjhZybtunqwfrM6bXJj9SIP\n# 2m7ASAowVcqr0tZn/ENtqL37Kd0VZWVq/KhM/FFG+OPj4M+74aEs5suej7fvzV2x\n# IXUazrkgeazTc4yS/9UhB3FKEqqIpdgaaXwlnc0CPVbpqI8h/KY7kJTLQ4ydbHFq\n# VmOWKCXRoYStjv5qrgxuITV6hiaArar6Xnreq0VLFcuqNf2S\n# SIG # End signature block\n"
  },
  {
    "path": "source/functions/Get-DbcReleaseNote.ps1",
    "content": "<#\n.SYNOPSIS\nReturns the release notes for the module - organised by date\n\n.DESCRIPTION\nGrabs the release notes for the dbachecks module and returns either the latest or all of them\n\n.PARAMETER Latest\nA Switch to return the latest release notes only\n\n.EXAMPLE\nGet-DbcReleaseNote\n\nReturns the release notes for the dbachecks module\n\n.EXAMPLE\nGet-DbcReleaseNote -Latest\n\nReturns just the latest release notes for the dbachecks module\n\n.LINK\nhttps://dbachecks.readthedocs.io/en/latest/functions/Get-DbcReleaseNote/\n\n.NOTES\n30/05/2012 - RMS\n#>\nfunction Get-DbcReleaseNote {\n    Param (\n        [switch]$Latest\n    )\n\n    $releasenotesfile = Join-Path -Path $PSScriptRoot -ChildPath 'RELEASE.md'\n\n    $releasenotes = [System.IO.File]::ReadAllText($releasenotesfile)\n\n    if ($Latest) {\n        ($releasenotes -Split \"##Latest\")[0]\n    } else {\n        $releasenotes\n    }\n}\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAA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rmUu7DRXi6ZjS92tEt+N3rbCcqWf23\n# MSeKNULZ7EIok6BKjJzsA1x5pfBdZXmIz6YXnHRn4wdo4yo5GpmtWJ/oL8Zm200+\n# WBCgcfSId0PDOrmVpfN1cmIpPCDZ+svfzo9f/P5cH+q9bY/hYbUKMOTQCr5/1tJe\n# wJ+/vGeqdEp0IxbU7B5MA2Nm9iY3HFh57iDOMS+gEQybj+8JmEQw+Zyvh4YZ+d2a\n# y9hCaxWuk44+GCaXmaFo2KkGC+CUOTpGOljIeWssQdutlFS2\n# SIG # End signature block\n"
  },
  {
    "path": "source/functions/Get-DbcTagCollection.ps1",
    "content": "﻿<#\n.SYNOPSIS\nRetrieves a list of all available tags. Simplistic, similar to Get-Verb.\n\n.DESCRIPTION\nRetrieves a list of all available tags. Simplistic, similar to Get-Verb.\n\n.PARAMETER Name\nDefault: \"*\"\n\nThe name of the tag to retrieve.\nMay be any string, supports wildcards.\n\n.PARAMETER EnableException\nBy default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.\n\n.EXAMPLE\nGet-DbcTag\n\nRetrieves all of the available tags for -Tag and -ExcludeTag\n.EXAMPLE\nGet-DbcTag backups\n\nRetrieves all of the available tags for -Tag and -ExcludeTag that are -like backups\n\n.LINK\nhttps://dbachecks.readthedocs.io/en/latest/functions/Get-DbcTagCollection/\n\n#>\nfunction Get-DbcTagCollection {\n    [CmdletBinding()]\n    param (\n        [string]$Name = \"*\",\n        [switch]$EnableException\n    )\n\n    process {\n        $script:localapp = Get-DbcConfigValue -Name app.localapp\n        # so that it works cross platform\n        $checksfile = Join-Path -Path $script:localapp -ChildPath 'checks.json'\n\n        $alltags = ([System.IO.File]::ReadAllText($checksfile) | ConvertFrom-Json) | Select-Object -ExpandProperty AllTags\n        ($alltags -split \",\").Trim() | Where-Object { $_ -like $name } | Sort-Object | Select-Object -Unique\n    }\n}\n\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUjVxf87ljPm2jHdPbI+pfbR2q\n# tK2gggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz\n# c3VyZWQgSUQgQ29kZSBTaWduaW5nIENBMB4XDTE3MDUwOTAwMDAwMFoXDTIwMDUx\n# MzEyMDAwMFowVzELMAkGA1UEBhMCVVMxETAPBgNVBAgTCFZpcmdpbmlhMQ8wDQYD\n# VQQHEwZWaWVubmExETAPBgNVBAoTCGRiYXRvb2xzMREwDwYDVQQDEwhkYmF0b29s\n# czCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAI8ng7JxnekL0AO4qQgt\n# Kr6p3q3SNOPh+SUZH+SyY8EA2I3wR7BMoT7rnZNolTwGjUXn7bRC6vISWg16N202\n# 1RBWdTGW2rVPBVLF4HA46jle4hcpEVquXdj3yGYa99ko1w2FOWzLjKvtLqj4tzOh\n# K7wa/Gbmv0Si/FU6oOmctzYMI0QXtEG7lR1HsJT5kywwmgcjyuiN28iBIhT6man0\n# Ib6xKDv40PblKq5c9AFVldXUGVeBJbLhcEAA1nSPSLGdc7j4J2SulGISYY7ocuX3\n# tkv01te72Mv2KkqqpfkLEAQjXgtM0hlgwuc8/A4if+I0YtboCMkVQuwBpbR9/6ys\n# Z+sCAwEAAaOCAcUwggHBMB8GA1UdIwQY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CisGAQQBgjcCAQsxDjAM\n# BgorBgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBRNBjIYXnlxLI1MtDtAAqXjSlPs\n# zTANBgkqhkiG9w0BAQEFAASCAQBdjaKdD8oVpoI/3gIlTU2smc/09Hv3kq05WPpn\n# kAv4t6E2l+St85RgZwojT1zgmgXIYdr+wv0z2Qejk6y06Hzgb/yCkQ1VGBHrcmOO\n# c/aXhU8QRkjfBtm5vRjzKpb31ayLvn8KNM4qT+ViSZJi79JbUW0FeNkPau8pQ7s+\n# t/HWxC2q9M4Gn2fravi8FPcV6GQAzkGsd+Y5gEC3kWF7o25VSZUZ4PxUC4XIkz0r\n# VQVFbS4davU9uWNzkxfOv4Jro0PhM56fN9ExHUFi+Wwa4xptL9BTIFNp1Uczvw8U\n# YtZWcUazKI9O3XKynRYrSTRUzhJ4O6ntZ3Fko1yf7QHncU1z\n# SIG # End signature block\n"
  },
  {
    "path": "source/functions/Import-DbcConfig.ps1",
    "content": "﻿<#\n.SYNOPSIS\nImports dbachecks configs from a json file\n\n.DESCRIPTION\n   Imports dbachecks configs from a json file\n\n.PARAMETER Path\nThe path to import from, by default is \"$script:localapp\\config.json\"\n\n.PARAMETER Temporary\nThe settings are not persisted outside the current session.\nBy default, settings will be remembered across all PowerShell sessions.\n\n.PARAMETER EnableException\nBy default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.\n\n.EXAMPLE\nImport-DbcConfig\n\nImports config from \"$script:localapp\\config.json\"\n\n.EXAMPLE\nImport-DbcConfig -Path \\\\nas\\projects\\config.json\n\nImports config from \\\\nas\\projects\\config.json\n\n.LINK\nhttps://dbachecks.readthedocs.io/en/latest/functions/Import-DbcConfig/\n\n#>\n\nfunction Import-DbcConfig {\n    [CmdletBinding()]\n    param (\n        [string]$Path = (Join-Path -Path $script:localapp -ChildPath config.json) ,\n        [switch]$Temporary\n    )\n\n    process {\n        if (-not (Test-Path -Path $Path)) {\n            Stop-PSFFunction -Message \"$Path does not exist. Run Export-DbcConfig to create.\"\n            return\n        }\n\n        try {\n            $results = [System.IO.File]::ReadAllText($Path) | ConvertFrom-Json\n        } catch {\n            Stop-PSFFunction -Message \"Failure\" -ErrorRecord $_\n            return\n        }\n\n        foreach ($result in $results) {\n            Set-DbcConfig -Name $result.Name -Value $result.Value -Temporary:$Temporary\n        }\n    }\n}"
  },
  {
    "path": "source/functions/Invoke-DbcCheck.ps1",
    "content": "﻿\n<#\n.SYNOPSIS\nInvoke-DbcCheck is a SQL-centric Invoke-Pester wrapper\n\n.DESCRIPTION\nThe Invoke-DbcCheck function runs Pester tests, including *.Tests.ps1 files and Pester tests in PowerShell scripts.\n\nExtended description about Pester: Get-Help -Name Invoke-Pester\n\n.PARAMETER Check\nRuns only tests in Describe blocks with the specified Tag parameter values. Wildcard characters and Tag values that include spaces or whitespace characters are not supported.\n\nWhen you specify multiple Tag values, Invoke-DbcCheck runs tests that have any of the listed tags (it ORs the tags). However, when you specify TestName and Tag values, Invoke-DbcCheck runs only describe blocks that have one of the specified TestName values and one of the specified Tag values.\n\nIf you use both Tag and ExcludeTag, ExcludeTag takes precedence.\n\n.PARAMETER ExcludeCheck\nOmits tests in Describe blocks with the specified Tag parameter values. Wildcard characters and Tag values that include spaces or whitespace characters are not supported.\n\nWhen you specify multiple ExcludeTag values, Invoke-DbcCheck omits tests that have any of the listed tags (it ORs the tags). However, when you specify TestName and ExcludeTag values, Invoke-DbcCheck omits only describe blocks that have one of the specified TestName values and one of the specified Tag values.\n\nIf you use both Tag and ExcludeTag, ExcludeTag takes precedence\n\n.PARAMETER SqlInstance\nA list of SQL Servers to run the tests against. If this is not provided, it will be gathered from:\nGet-DbatoolsConfig -Name app.sqlinstance\n\n.PARAMETER ComputerName\nA list of computers to run the tests against. If this is not provided, it will be gathered from:\nGet-DbatoolsConfig -Name app.computername\n\n.PARAMETER SqlCredential\nAlternate SQL Server-based credential.\n\n.PARAMETER Credential\nAlternate Windows credential.\n\n.PARAMETER Database\nA list of databases to include if your check is database centric.\n\n.PARAMETER ExcludeDatabase\nA list of databases to exclude if your check is database centric.\n\n.PARAMETER PassThru\nReturns a custom object (PSCustomObject) that contains the test results.\n\nBy default, Invoke-DbcCheck writes to the host program, not to the output stream (stdout).\nIf you try to save the result in a variable, the variable is empty unless you\nuse the PassThru parameter.\n\nTo suppress the host output, use the Quiet parameter.\n\n.PARAMETER ConfigFile\nThe path to the exported dbachecks config file.\n\n.PARAMETER OutputFormat\nThe format of output. Currently, only NUnitXML is supported.\n\n.PARAMETER Strict\nMakes Pending and Skipped tests to Failed tests. Useful for continuous integration where you need to make sure all tests passed.\n\n.PARAMETER AllChecks\nIn the unlikely event that you'd like to run all checks, specify -AllChecks. These checks still confirm to the skip settings in Get-DbcConfig.\n\n.PARAMETER Quiet\nThe parameter Quiet is deprecated since Pester v. 4.0 and will be deleted in the next major version of Pester. Please use the parameter Show with value 'None' instead.\n\n.PARAMETER Show\nCustomizes the output Pester writes to the screen.\n\nAvailable options are\nNone\nDefault\nPassed\nFailed\nPending\nSkipped\nInconclusive\nDescribe\nContext\nSummary\nHeader\nAll\nFails\n\nThe options can be combined to define presets.\n\nCommon use cases are:\n\nNone - to write no output to the screen.\nAll - to write all available information (this is default option).\nFails - to write everything except Passed (but including Describes etc.).\n\nA common setting is also Failed, Summary, to write only failed tests and test summary.\n\nThis parameter does not affect the PassThru custom object or the XML output that is written when you use the Output parameters.\n\n.PARAMETER Value\nA value.. it's hard to explain\n\n.PARAMETER Script\nGet-Help -Name Invoke-Pester -Parameter Script\n\n.PARAMETER TestName\nGet-Help -Name Invoke-Pester -Parameter TestName\n\n.PARAMETER EnableExit\nGet-Help -Name Invoke-Pester -Parameter EnableExit\n\n.PARAMETER OutputFile\nGet-Help -Name Invoke-Pester -Parameter OutputFile\n\n.PARAMETER CodeCoverage\nGet-Help -Name Invoke-Pester -Parameter CodeCoverage\n\n.PARAMETER PesterOption\nGet-Help -Name Invoke-Pester -Parameter PesterOption\n\n.PARAMETER CodeCoverageOutputFile\nGet-Help -Name Invoke-Pester -Parameter CodeCoverageOutputFile\n\n.PARAMETER CodeCoverageOutputFileFormat\nGet-Help -Name Invoke-Pester -Parameter CodeCoverageOutputFileFormat\n\n.LINK\nhttps://dbachecks.readthedocs.io/en/latest/functions/Invoke-DbcCheck/\n\n.EXAMPLE\nInvoke-DbcCheck -Tag Backup -SqlInstance sql2016\n\nRuns all of the checks tagged Backup against the sql2016 instance\n\n.EXAMPLE\nInvoke-DbcCheck -Tag RecoveryModel -SqlInstance sql2017, sqlcluster -SqlCredential (Get-Credential sqladmin)\n\nRuns the Recovery model check against the SQL instances sql2017, sqlcluster\nusing the sqladmin SQL login with the password provided interactively\n\n.EXAMPLE\nInvoke-DbcCheck -Check Database -ExcludeCheck AutoShrink -ConfigFile \\\\share\\repo\\prod.json\n\nRuns all of the checks tagged Database except for the AutoShrink check against\nthe SQL Instances set in the config under app.sqlinstance\n\nImports configuration file, \\\\share\\repo\\prod.json, prior to executing checks.\n\n.EXAMPLE\n# Set the servers you'll be working with\nSet-DbcConfig -Name app.sqlinstance -Value sql2016, sql2017, sql2008, sql2008\\express\nSet-DbcConfig -Name app.computername -Value sql2016, sql2017, sql2008\n\n# Look at the current configs\nGet-DbcConfig\n\n# Invoke a few tests\nInvoke-DbcCheck -Tags SuspectPage, LastBackup\n\nRuns the Suspect Pages and Last Backup checks against the SQL Instances sql2016,\nsql2017, sql2008, sql2008\\express after setting them in the configuration\n\n.EXAMPLE\nInvoke-DbcCheck -SqlInstance sql2017 -Tags SuspectPage, LastBackup -Show Summary -PassThru | Update-DbcPowerBiDataSource\n\nStart-DbcPowerBi\n\nRuns the Suspect Page and Last Backup checks against the SQL Instances set in\nthe config under app.sqlinstance only showing the summary of the results of the\nchecks. It then updates the source json for the XML which is stored at\nC:\\Windows\\temp\\dbachecks\\ and then opens the PowerBi report in PowerBi Desktop\n\n.EXAMPLE\nGet-Help -Name Invoke-Pester -Examples\n\nWant to get super deep? You can look at Invoke-Pester's example's and run them against Invoke-DbcCheck since it's a wrapper.\n\nhttps://github.com/pester/Pester/wiki/Invoke-Pester\n\nDescribe\nabout_Pester\n#>\n#TODO the help is probably not correct\nfunction Invoke-DbcCheck {\n    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidGlobalVars', '', Justification = 'Because scoping is hard')]\n    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', '', Justification = 'Because its set to the global var')]\n    [CmdletBinding(DefaultParameterSetName = 'Default')]\n    param (\n        [Alias('Path', 'relative_path')]\n        [object[]]$Script,\n        [Alias('Name')]\n        [string[]]$TestName,\n        [switch]$EnableExit,\n        [Parameter(Position = 0)]\n        [Alias('Tags', 'Tag', 'Checks')]\n        [string[]]$Check,\n        [AllowEmptyCollection()]\n        [Alias('ExcludeTags', 'ExcludeTag', 'ExcludeChecks')]\n        [string[]]$ExcludeCheck = (Get-PSFConfigValue -FullName 'dbachecks.command.invokedbccheck.excludecheck' -Fallback @()),\n        [switch]$PassThru,\n        [DbaInstance[]]$SqlInstance,\n        [DbaInstance[]]$ComputerName,\n        [PSCredential]$SqlCredential,\n        [PSCredential]$Credential,\n        [object[]]$Database,\n        [object[]]$ExcludeDatabase = (Get-PSFConfigValue -FullName 'dbachecks.command.invokedbccheck.excludedatabase' -Fallback @()),\n        [string[]]$Value,\n        [string]$ConfigFile,\n        [object[]]$CodeCoverage = @(),\n        [string]$CodeCoverageOutputFile,\n        [ValidateSet('JaCoCo')]\n        [string]$CodeCoverageOutputFileFormat = 'JaCoCo',\n        [switch]$Strict,\n        [Parameter(Mandatory = $true, ParameterSetName = 'NewOutputSet')]\n        [string]$OutputFile,\n        [ValidateSet('NUnitXml')]\n        [string]$OutputFormat,\n        [switch]$AllChecks,\n        [switch]$Quiet,\n        [ValidateSet('None', 'Minimal', 'Detailed', 'Default', 'Passed', 'Failed', 'Pending', 'Skipped', 'Inconclusive', 'Describe', 'Context', 'Summary', 'Header', 'Fails', 'All', 'Diagnostic')] #None, Default,Passed, Failed, Pending, Skipped, Inconclusive, Describe, Context, Summary, Header, All, Fails.\n        [string]$Show = 'All',\n        [bool]$legacy = $true\n    )\n\n    dynamicparam {\n        $config = Get-PSFConfig -Module dbachecks\n\n        $RuntimeParamDic = New-Object System.Management.Automation.RuntimeDefinedParameterDictionary\n\n        foreach ($setting in $config) {\n            $name = $setting.Name\n            $name = 'Config' + (($name.Split('.') | ForEach-Object { $_.SubString(0, 1).ToUpper() + $_.SubString(1) }) -join '')\n            $ParamAttrib = New-Object System.Management.Automation.ParameterAttribute\n            $ParamAttrib.ParameterSetName = '__AllParameterSets'\n            $AttribColl = New-Object System.Collections.ObjectModel.Collection[System.Attribute]\n            $AttribColl.Add($ParamAttrib)\n\n            $RuntimeParam = New-Object System.Management.Automation.RuntimeDefinedParameter($name, [object], $AttribColl)\n\n            $RuntimeParamDic.Add($name, $RuntimeParam)\n        }\n        return $RuntimeParamDic\n    }\n\n    begin {\n        if (Test-PSFParameterBinding -ParameterName ConfigFile) {\n            if (-not (Test-Path -Path $ConfigFile)) {\n                Stop-PSFFunction -Message \"$ConfigFile does not exist\"\n                return\n            }\n            $null = Import-DbcConfig -Path $ConfigFile -WarningAction SilentlyContinue -Temporary\n        }\n\n        $config = Get-PSFConfig -Module dbachecks\n        foreach ($key in $PSBoundParameters.Keys | Where-Object { $_ -like 'Config*' }) {\n            if ($item = $config | Where-Object { \"Config$($_.Name.Replace('.', ''))\" -eq $key }) {\n                Set-PSFConfig -Module dbachecks -Name $item.Name -Value $PSBoundParameters.$key\n            }\n        }\n\n        if ($SqlCredential) {\n            if ($PSDefaultParameterValues) {\n                $PSDefaultParameterValues.Remove('*:SqlCredential')\n                $newvalue = $PSDefaultParameterValues += @{ '*:SqlCredential' = $SqlCredential }\n                Set-Variable -Scope 0 -Name PSDefaultParameterValues -Value $newvalue\n            } else {\n                Set-Variable -Scope 0 -Name PSDefaultParameterValues -Value @{ '*:SqlCredential' = $SqlCredential }\n            }\n        } else {\n            if ($PSDefaultParameterValues) {\n                $PSDefaultParameterValues.Remove('*:SqlCredential')\n            }\n        }\n\n        if ($Credential) {\n            if ($PSDefaultParameterValues) {\n                $PSDefaultParameterValues.Remove('*Dba*:Credential')\n                $newvalue = $PSDefaultParameterValues += @{ '*Dba*:Credential' = $Credential }\n                Set-Variable -Scope 0 -Name PSDefaultParameterValues -Value $newvalue\n            } else {\n                Set-Variable -Scope 0 -Name PSDefaultParameterValues -Value @{ '*Dba*:Credential' = $Credential }\n            }\n        } else {\n            if ($PSDefaultParameterValues) {\n                $PSDefaultParameterValues.Remove('*Dba*:Credential')\n            }\n        }\n    }\n    process {\n\n        if ($legacy) {\n            try {\n                Write-PSFMessage 'Running in legacy mode, we need Version 4'\n                if (Get-Module Pester | Where-Object { $_.Version -gt '5.0.0' }) {\n                    Write-PSFMessage 'Remove Version 5' -Level Verbose\n                    Remove-Module Pester -ErrorAction SilentlyContinue\n                }\n                Write-PSFMessage 'import Version 4' -Level Verbose\n                Import-Module Pester -RequiredVersion 4.10.1 -Global\n            } catch {\n                Write-PSFMessage -Message 'Something Went wrong' -Level Warning -ErrorRecord $_\n                Return\n            }\n            $null = $PSBoundParameters.Remove('legacy')\n            Invoke-DbcCheckv4 @PSBoundParameters\n        } else {\n            try {\n                if (Get-Module Pester | Where-Object { $_.Version -lt '5.0.0' }) {\n                    Remove-Module Pester -ErrorAction SilentlyContinue\n                    Write-PSFMessage 'Running in fancy new mode, we need to import Version 5' -Level Verbose\n                    Import-Module Pester -MinimumVersion 5.0.0 -Global\n                } else {\n                    Write-PSFMessage 'Running in fancy new mode but not imported' -Level Verbose\n                }\n\n                # We should be able to move the creation of the container and the configuration to here\n                switch ($Show) {\n                    'None' {\n                        $NewShow = 'None'\n                    }\n                    'Default' {\n                        $NewShow = 'Detailed'\n                    }\n                    'Passed' {\n                        $NewShow = 'Normal'\n                    }\n                    'Failed' {\n                        $NewShow = 'Normal'\n                    }\n                    'Pending' {\n                        $NewShow = 'Normal'\n                    }\n                    'Skipped' {\n                        $NewShow = 'Normal'\n                    }\n                    'Inconclusive' {\n                        $NewShow = 'Normal'\n                    }\n                    'Describe' {\n                        $NewShow = 'Normal'\n                    }\n                    'Context' {\n                        $NewShow = 'Normal'\n                    }\n                    'Summary' {\n                        $NewShow = 'Normal'\n                    }\n                    'Header' {\n                        $NewShow = 'Normal'\n                    }\n                    'Fails' {\n                        $NewShow = 'Normal'\n                    }\n                    'All' {\n                        $NewShow = 'Detailed'\n                    }\n                    'Diagnostic' {\n                        $NewShow = 'Diagnostic'\n                    }\n                    'Minimal' {\n                        $NewShow = 'Minimal'\n                    }\n                    Default {\n                        $NewShow = 'Detailed'\n                    }\n                }\n                # cast from empty hashtable to get default\n                $configuration = New-PesterConfiguration\n                $configuration.Output.Verbosity = $NewShow\n                $configuration.Filter.Tag = $check + 'FailedConnections'\n                # Exclude the excluded checks and the not converted checks\n                $notv5 = (Get-PSFConfigValue -FullName 'dbachecks.checks.notv5ready')\n                $configuration.Filter.ExcludeTag = $ExcludeCheck + $notv5\n\n                if ($PassThru) {\n                    $configuration.Run.PassThru = $true\n                }\n                # So that if all of the checks passed in are not yet converted so that we stop\n\n                # Compare the two arrays\n                $comparisonResult = Compare-Object -ReferenceObject $check -DifferenceObject $notv5\n\n                # If all elements of $check are in $notv5, then $comparisonResult will be either $null or only contain differences where SideIndicator is '=>'\n\n                if (($comparisonResult | Where-Object SideIndicator -EQ '<=').Count -eq 0) {\n                    $Message = \"The checks that you are running are yet to be converted to v5 unfortunately. We cannot continue. Please use the legacy switch\"\n                    Write-PSFMessage -Message $Message -Level Warning\n                    Return\n                }\n\n                foreach ($c in $Check) {\n                    # So that if the only check passed in is not yet converted\n                    if ($c -in $notv5) {\n                        $Message = \"You are running a check {0} that is not yet converted to v5.\" -f $c\n                        Write-PSFMessage -Message $Message -Level Warning\n                    }\n                }\n            } catch {\n                Write-PSFMessage -Message 'Something Went wrong' -Level Warning -ErrorRecord $_\n                Return\n            }\n            $null = $PSBoundParameters.Remove('legacy')\n            $null = $PSBoundParameters.Remove('Show')\n            $null = $PSBoundParameters.Remove('PassThru')\n            Write-PSFMessage -Message ($PSBoundParameters | Out-String) -Level Verbose\n            Invoke-DbcCheckv5 @PSBoundParameters -configuration $configuration\n        }\n    }\n    end {\n        foreach ($c in $Check) {\n            # So that if the only check passed in is not yet converted\n            if ($c -in $notv5) {\n                $Message = \"You are running a check {0} that is not yet converted to v5.\" -f $c\n                Write-PSFMessage -Message $Message -Level Warning\n            }\n        }\n    }\n\n\n}"
  },
  {
    "path": "source/functions/Invoke-DbcConfigFile.ps1",
    "content": "﻿<#\n.SYNOPSIS\nOpens the default location of the json config file for easy edits.\n\n.DESCRIPTION\nOpens the default location of the json config file for easy edits. Follow with Import-DbcConfig to import changes.\n\n.PARAMETER Path\nThe path to open, by default is \"$script:localapp\\config.json\"\n\n.PARAMETER EnableException\nBy default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.\n\n.EXAMPLE\nInvoke-DbcConfigFile\n\nOpens \"$script:localapp\\config.json\" for editing.\n\n.EXAMPLE\nInvoke-DbcConfigFile -Path C:\\temp\\config.json\n\nOpens \"C:\\temp\\config.json\" for editing.\n\n.LINK\nhttps://dbachecks.readthedocs.io/en/latest/functions/Invoke-DbcConfigFile/\n\n#>\nfunction Invoke-DbcConfigFile {\n    [CmdletBinding()]\n    param (\n        [string]$Path = \"$script:localapp\\config.json\",\n        [switch]$EnableException\n    )\n\n    process {\n        if (-not (Test-Path -Path $Path)) {\n            Stop-PSFFunction -Message \"$Path does not exist. Run Export-DbcConfig to create a file.\"\n            return\n        }\n\n        try {\n            Invoke-Item -Path $Path\n            Write-PSFMessage -Level\tOutput -Message \"Remember to run Import-DbcConfig when you've finished your edits\"\n        } catch {\n            Stop-PSFFunction -Message 'Failure' -ErrorRecord $_\n            return\n        }\n    }\n}\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUhQLRhUDOEe2I8CmDdGnBrRYH\n# Ee+gggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz\n# c3VyZWQgSUQgQ29kZSBTaWduaW5nIENBMB4XDTE3MDUwOTAwMDAwMFoXDTIwMDUx\n# MzEyMDAwMFowVzELMAkGA1UEBhMCVVMxETAPBgNVBAgTCFZpcmdpbmlhMQ8wDQYD\n# VQQHEwZWaWVubmExETAPBgNVBAoTCGRiYXRvb2xzMREwDwYDVQQDEwhkYmF0b29s\n# czCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAI8ng7JxnekL0AO4qQgt\n# Kr6p3q3SNOPh+SUZH+SyY8EA2I3wR7BMoT7rnZNolTwGjUXn7bRC6vISWg16N202\n# 1RBWdTGW2rVPBVLF4HA46jle4hcpEVquXdj3yGYa99ko1w2FOWzLjKvtLqj4tzOh\n# K7wa/Gbmv0Si/FU6oOmctzYMI0QXtEG7lR1HsJT5kywwmgcjyuiN28iBIhT6man0\n# Ib6xKDv40PblKq5c9AFVldXUGVeBJbLhcEAA1nSPSLGdc7j4J2SulGISYY7ocuX3\n# tkv01te72Mv2KkqqpfkLEAQjXgtM0hlgw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EAYI3AgEMMQowCKACgACh\n# AoAAMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcCAQsxDjAM\n# BgorBgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBQxinshpufcrAFD4+lsl7TQL3lR\n# dTANBgkqhkiG9w0BAQEFAASCAQB8Cf7BgEbjFk9gvbjrOkQeTEY4N4khNOuv0b6y\n# EDOh+yazZiAFKDcF7p2mKyKzIkBm3gpv8S2iNhlV6nkqb8N23qvJ7ljgosVtXTId\n# 0rwhCAL0OheOcQPgdNCH8C3FvVznouf9UzRZFLDUp0aeThRE5Y+abT9HsrAn9EsF\n# K9cZk06BQXAv2iFZG3RCWnhFZgbeDwGq+7EgjKA871M/58zM/V6FPwmVz35mKCwr\n# xIe3OuMbZdvek8UafD+qpPMZ/NBSOe/nywfQBDGhbBPCxr53QzuY3GyopoxXsffU\n# TSjlcftuoLS1Am+d7JSU41yPg9PFr4L7ljrkoBmaOwWowOjA\n# SIG # End signature block\n"
  },
  {
    "path": "source/functions/Reset-DbcConfig.ps1",
    "content": ". $script:ModuleRoot/internal/functions/Invoke-ConfigurationScript.ps1\n<#\n.SYNOPSIS\nResets configuration entries to their default values.\n\n.DESCRIPTION\nThis function unregisters configuration values and then registers them back with the default values and type.\n\nThis can be used to get the dbachecks back to default state of configuration, or to resolve problems with a specific setting.\n\n.PARAMETER Name\nName of the configuration key.\n\n.EXAMPLE\nReset-DbcConfig\n\nResets all the configuration values for dbachecks.\n\n.EXAMPLE\nReset-DbcConfig -Name policy.recoverymodel.type\n\nResets the policy.recoverymodel.type to the default value and type.\n\n.LINK\nhttps://dbachecks.readthedocs.io/en/latest/functions/Reset-DbcConfig/\n\n#>\nfunction Reset-DbcConfig {\n    [Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSUseShouldProcessForStateChangingFunctions\", \"\")]\n    [CmdletBinding(DefaultParameterSetName = \"FullName\")]\n    param (\n        [Parameter(Mandatory = $false)]\n        [string[]]$Name\n    )\n    process {\n        if (!$Name) {\n            # no name provided, get all known dbachecks settings\n            $resolvedName = (Get-DbcConfig).Name\n        }\n        elseif ($Name -match '\\*') {\n            # wildcard is used, get only the matching settings\n            $resolvedName = (Get-DbcConfig).Name | Where-Object { $psitem -like $Name }\n        }\n        else {\n            $resolvedName = $Name\n        }\n\n        @($resolvedName).ForEach{\n            $localName = $psitem.ToLower()\n            if (-not (Get-DbcConfig -Name $localName)) {\n                Stop-PSFFunction -FunctionName Reset-DbcConfig -Message \"Setting named $localName does not exist. Use Get-DbcCheck to get the list of supported settings.\"\n            }\n            else {\n                Write-PSFMessage -FunctionName Reset-DbcConfig -Message \"resetting $localName\"\n                Unregister-PSFConfig -Module dbachecks -Name $localName\n                [PSFramework.Configuration.ConfigurationHost]::Configurations.Remove(\"dbachecks.$localName\") | Out-Null\n            }\n        }\n\n        # set up everything that is now missing back to the default values\n        Invoke-ConfigurationScript\n\n        # display the new values\n        @($resolvedName).ForEach{\n            Get-DbcConfig -Name $psitem\n        }\n    }\n}\n\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUNUBbq4EpBfs1joEMYSLCoPkb\n# zGGgggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz\n# c3VyZWQgSUQgQ29kZSBTaWduaW5nIENBMB4XDTE3MDUwOTAwMDAwMFoXDTIwMDUx\n# MzEyMDAwMFowVzELMAkGA1UEB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Tlz/kLEbBw6RFfu6r7VRwo0k\n# riTGxycqoSkoGjpxKAI8LpGjwCUR4pwUR6F6aGivm6dcIFzZcbEMj7uo+MUSaJ/P\n# QMtARKUT8OZkDCUIQjKyNookAv4vcn4c10lFluhZHen6dGRrsutmQ9qzsIzV6Q3d\n# 9gEgzpkxYz0IGhizgZtPxpMQBvwHgfqL2vmCSfdibqFT+hKUGIUukpHqaGxEMrJm\n# oecYpJpkUe8xggIoMIICJAIBATCBhjByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMM\n# RGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQD\n# EyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgQ29kZSBTaWduaW5nIENBAhACwXUo\n# dNXChDGFKtigZGnKMAkGBSsOAwIaBQCgeDAYBgorBgEEAYI3AgEMMQowCKACgACh\n# AoAAMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcCAQsxDjAM\n# BgorBgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBR3l3SiI0NPBR4CWmM9fmSkSKLy\n# GDANBgkqhkiG9w0BAQEFAASCAQAr7bYA6OAueFQ2dn1dUwQGhbFE0juwzfe4oO24\n# fZo+mG/t/FO/3CAK0HLcDXRlZ6DatOFBiAXg1TVQVB65Sj8kTaYK6c3RJvOh01O7\n# eARSCKMI3fpNVFJ3So1GmueVwI5h63b6uwUJcWc3aWEY0rBmS3qkZBuLQh/dU+OU\n# eTkBCLpMYrwz9O5xDsxbF6ff9RmF54vEAI056l8RkEVw/zqvRg5NmhFeMmHhA4lW\n# zzdfwmL+cwj5wkPOtWPDYOV6/iE3+cUN7WvIvL8pJ83Uw+FWDNS0/fO37L7fqNGu\n# j66L2DwWGyn/BoQ2KjG6HcRgNVe4VzCoZGdauvRrCEXRoJdj\n# SIG # End signature block\n"
  },
  {
    "path": "source/functions/Save-DbcRequiredModules.ps1",
    "content": "﻿<#\n.SYNOPSIS\nSaves all required modules, including dbachecks, dbatools, Pester and PSFramework to a directory. Ideal for offline installs.\n\n.DESCRIPTION\nSaves all required modules, including dbachecks, dbatools, Pester and PSFramework to a directory. Ideal for offline installs.\n\n.PARAMETER Path\nThe directory where the modules will be saved. Directory will be created if it does not exist.\n\n.PARAMETER EnableException\nBy default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.\n\n.EXAMPLE\nSave-DbcRequiredModules -Path C:\\temp\\downlaods\n\nSaves all required modules and dbachecks to C:\\temp\\downloads\n\n.EXAMPLE\nSave-DbcRequiredModules -Path C:\\temp\\downlaods -Verbose\n\nSaves all required modules and dbachecks to C:\\temp\\downloads and shows verbose output\n\n.LINK\nhttps://dbachecks.readthedocs.io/en/latest/functions/Save-DbcRequiredModules/\n\n#>\nfunction Save-DbcRequiredModules {\n    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseSingularNouns', '')]\n    [CmdletBinding()]\n    param (\n        [Parameter (Mandatory)]\n        [string]$Path,\n        [switch]$EnableException\n    )\n\n    if (-not (Test-Path $Path)) {\n        try {\n            $null = New-Item -ItemType Directory -Path $Path\n        } catch {\n            Stop-PSFFunction -Message 'Failure' -ErrorRecord $_\n        }\n    }\n\n    Write-PSFMessage -Level Output -Message \"Note: PowerShell Gallery will say 'Installing dependent package' but it's really just saving them.\"\n    Save-Module -Name dbachecks -Path $path -ErrorAction Stop\n}\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUSJO+eGA3wE8IQ+9je+ZB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4g/cZgNZcSCqOIeAKG0R4/7ZllEIf2V/r1ADqzf38xd+Sj47ZuuWSXN\n# Afwr8vhAUCeT38uc7amLDE2uRBXNkmX+MtEGVvczRzB10Z3F8MiEnLoxstd0O7Ug\n# Ak8AhSa/kENBKgNShyB7IoHIe0WI+Hlx/ia6+r9st18J0+NFxgUw6evsW1hryRqq\n# you198O1ZVDdGKM0Bv//pI0JLf9FWlK6hndAihTWK5y6n9RB\n# SIG # End signature block\n"
  },
  {
    "path": "source/functions/Set-DbcCisConfig.ps1",
    "content": "<#\n.SYNOPSIS\nSets values for CIS checks.\n.DESCRIPTION\nSets CIS checks to defaults values that were different than normals values.  Then sets CIS\ntest that are set to skip by default to run.\n\n.EXAMPLE\nSet-DbcCisConfig\n\nsets the configuration for CIS checks\n\n.EXAMPLE\nSet-DbcCisConfig -Verbose\n\nsets the configuration for CIS checks with verbose output\n\n.LINK\nhttps://dbachecks.readthedocs.io/en/latest/functions/Set-DbcCisConfig/\n#>\n\nfunction Set-DbcCisConfig {\n    [CmdletBinding(DefaultParameterSetName = 'Name', SupportsShouldProcess)]\n    Param (\n    )\n\n    Reset-DbcConfig\n\n    #set CIS to what they need to be\n    if ($PSCmdlet.ShouldProcess('Configuration' , 'Setting the values for CIS configuration ')) {\n        Set-DbcConfig -Name skip.security.nonstandardport -Value $false\n        Set-DbcConfig -Name policy.dacallowed -Value $false\n        Set-DbcConfig -Name policy.errorlog.logcount -Value 12\n        Set-DbcConfig -Name policy.security.oleautomationproceduresdisabled -Value $false\n        Set-DbcConfig -Name policy.oleautomation -Value 0\n        Set-DbcConfig -Name policy.security.adhocdistributedqueriesenabled -Value $false\n        Set-DbcConfig -Name policy.security.clrenabled -Value $false\n        Set-DbcConfig -Name policy.security.databasemailenabled -Value $false\n        Set-DbcConfig -Name policy.security.xpcmdshelldisabled -Value $false\n        Set-DbcConfig -Name skip.instance.defaulttrace -Value $false\n        Set-DbcConfig -Name policy.security.latestbuild -Value $true\n        Set-DbcConfig -Name skip.instance.oleautomationproceduresdisabled -Value $false\n        Set-DbcConfig -Name policy.security.remoteaccessdisabled -Value $false\n        Set-DbcConfig -Name policy.security.scanforstartupproceduresdisabled -Value $false\n        Set-DbcConfig -Name skip.security.agentserviceadmin -Value $false\n        Set-DbcConfig -Name skip.security.asymmetrickeysize -Value $false\n        Set-DbcConfig -Name skip.security.builtinadmin -Value $false\n        Set-DbcConfig -Name skip.security.clrassembliessafe -Value $false\n        Set-DbcConfig -Name policy.security.containedbautoclose -Value $false\n        Set-DbcConfig -Name skip.security.containedbautoclose -Value $false\n        Set-DbcConfig -Name policy.security.databasemailenabled -Value $false\n        Set-DbcConfig -Name policy.security.clrenabled -Value $false\n        Set-DbcConfig -Name policy.security.crossdbownershipchaining -Value $false\n        Set-DbcConfig -Name policy.security.databasemailenabled -Value $false\n        Set-DbcConfig -Name policy.security.adhocdistributedqueriesenabled -Value $false\n        Set-DbcConfig -Name policy.security.xpcmdshelldisabled -Value $false\n        Set-DbcConfig -Name skip.security.ContainedDBSQLAuth -Value $false\n        Set-DbcConfig -Name skip.security.engineserviceadmin -Value $false\n        Set-DbcConfig -Name skip.security.fulltextserviceadmin -Value $false\n        Set-DbcConfig -Name skip.security.guestuserconnect -Value $false\n        Set-DbcConfig -Name skip.security.hideinstance -Value $false\n        Set-DbcConfig -Name skip.security.localwindowsgroup -Value $false\n        Set-DbcConfig -Name skip.security.loginauditlevelfailed -Value $false\n        Set-DbcConfig -Name skip.security.loginauditlevelsuccessful -Value $false\n        Set-DbcConfig -Name skip.security.LoginCheckPolicy -Value $false\n        Set-DbcConfig -Name skip.security.LoginPasswordExpiration -Value $false\n        Set-DbcConfig -Name skip.security.LoginMustChange -Value $false\n        Set-DbcConfig -Name skip.security.sadisabled -Value $false\n        Set-DbcConfig -Name skip.security.saexist -Value $false\n        Set-DbcConfig -Name skip.security.sqlagentproxiesnopublicrole -Value $false\n        Set-DbcConfig -Name skip.security.symmetrickeyencryptionlevel -Value $false\n        Set-DbcConfig -Name skip.security.publicrolepermission -Value $false\n        Set-DbcConfig -Name skip.security.serverprotocol -Value $false\n        Set-DbcConfig -Name skip.security.SQLMailXPsDisabled -Value $false\n    }\n}"
  },
  {
    "path": "source/functions/Set-DbcConfig.ps1",
    "content": "﻿<#\n.SYNOPSIS\nSets configuration values for specific checks.\n\n.DESCRIPTION\nChanges configuration values which enable each check to have specific thresholds\n\n.PARAMETER Name\nName of the configuration entry.\n\n.PARAMETER Value\nThe value to assign.\n\n.PARAMETER Handler\nA scriptblock that is executed when a value is being set.\n\nIs only executed if the validation was successful (assuming there was a validation, of course)\n\n.PARAMETER Append\nAdds the value to the existing configuration instead of overwriting it\n\n.PARAMETER Temporary\nThe setting is not persisted outside the current session.\nBy default, settings will be remembered across all powershell sessions.\n\n.PARAMETER EnableException\nBy default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.\n\n.EXAMPLE\nSet-DbcConfig -Name app.sqlinstance -Value sql2016, sql2017, sqlcluster\n\nSets the SQL Instances which will be checked by default using Invoke-DbcCheck\nto sql2016, sql2017, sqlcluster\n\n.EXAMPLE\nSet-DbcConfig -Name policy.validdbowner.name -Value 'TheBeard\\sqldbowner'\n\nSets the value of the configuration for the expected database owners to\nTheBeard\\sqldbowner\n\n.EXAMPLE\nSet-DbcConfig -Name policy.database.status.excludereadonly -Value 'TheBeard'\n\nSets the value of the configuration for databases that are expected to be readonly\nto TheBeard\n\n.EXAMPLE\nSet-DbcConfig -Name agent.validjobowner.name -Value 'TheBeard\\SQLJobOwner' -Append\n\nAdds 'TheBeard\\SQLJobOwner' to the value of the configuration for accounts that\nare expected to be owners of SQL Agent Jobs\n\n.LINK\nhttps://dbachecks.readthedocs.io/en/latest/functions/Set-DbcConfig/\n\n#>\nfunction Set-DbcConfig {\n    [CmdletBinding(DefaultParameterSetName = \"FullName\", SupportsShouldProcess)]\n    param (\n        [string]$Name,\n        [AllowNull()]\n        [AllowEmptyCollection()]\n        [AllowEmptyString()]\n        $Value,\n        [System.Management.Automation.ScriptBlock]$Handler,\n        [switch]$Append,\n        [switch]$Temporary,\n        [switch]$EnableException\n    )\n\n    process {\n        if (-not (Get-DbcConfig -Name $Name)) {\n            Stop-PSFFunction -Message \"Setting named $Name does not exist. If you'd like us to support an additional setting, please file a GitHub issue.\"\n            return\n        }\n\n        if ($Append) {\n            $NewValue = (Get-DbcConfigValue -Name $Name)\n\n            # this is important to fix issue 535\n            # Need to process arrays correctly\n            if ($NewValue -is [System.Array]) {\n                if ($value -is [System.Array]) {\n                    $Value.ForEach{\n                        $NewValue += $psitem\n                    }\n                }\n                else {\n                    $NewValue += $Value\n                }\n            }\n            else {\n                $NewValue = $NewValue, $Value\n            }\n        }\n        else {\n            $NewValue = $Value\n        }\n\n        $Name = $Name.ToLower()\n        if ($PSCmdlet.ShouldProcess(\"$name\" , \"Setting the value to $NewValue on \")) {\n            Set-PSFConfig -Module dbachecks -Name $name -Value $NewValue\n        }\n        try {\n            if (-not $Temporary) {\n                if ($PSCmdlet.ShouldProcess(\"$name\" , \"Registering PSFConfig \")) {\n                    Register-PSFConfig -FullName dbachecks.$name -EnableException -WarningAction SilentlyContinue\n                }\n            }\n        }\n        catch {\n            if ($PSCmdlet.ShouldProcess(\"$Value\" , \"Setting PSFConfig $name \")) {\n                Set-PSFConfig -Module dbachecks -Name $name -Value ($Value -join \", \")\n            }\n            if (-not $Temporary) {\n                if ($PSCmdlet.ShouldProcess(\"$name\" , \"Registering PSFConfig \")) {\n                    Register-PSFConfig -FullName dbachecks.$name\n                }\n            }\n        }\n\n        # Still unsure if I'll persist it here - wondering if this impacts global or keeps local\n        if ($name -eq 'app.sqlcredential') {\n            if ($PSCmdlet.ShouldProcess(\"Variable\" , \"Setting PSDefaultParameterValues \")) {\n                Set-Variable -Scope 1 -Name PSDefaultParameterValues -Value @{ '*:SqlCredential' = $value }\n            }\n        }\n        $script:__dbcconfig = Get-DbcConfig\n        $__dbcconfig | Where-Object {$_.Name -eq  $name}\n    }\n}\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUB+pGjuwY8gjEzNBHHh7Zv2+O\n# uD6gggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz\n# c3VyZWQgSUQgQ29kZSBTaWduaW5nIENBMB4XDTE3MDUwOTAwMDAwMFoXDTIwMDUx\n# MzEyMDAwMFowVzELMAkGA1UEBhMCVVMxETAPBgNVBAgTCFZpcmdpbmlhMQ8wDQYD\n# VQQHEwZWaWVubmExETAPBgNVBAoTCGRiYXRvb2xzMREwDwYDVQQDEwhkYmF0b29s\n# czCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAI8ng7JxnekL0AO4qQgt\n# Kr6p3q3SNOPh+SUZH+SyY8EA2I3wR7BMoT7rnZNolTwGjUXn7bRC6vISWg16N202\n# 1RBWdTGW2rVPBVLF4HA46jle4hcpEVquXdj3yGYa99ko1w2FOWzLjKvtLqj4tzOh\n# K7wa/Gbmv0Si/FU6oOmctzYMI0QXtEG7lR1HsJT5kywwmgcjyuiN28iBIhT6man0\n# Ib6xKDv40PblKq5c9AFVldXUGVeBJbLhcEAA1nSPSLGdc7j4J2SulGISYY7ocuX3\n# tkv01te72Mv2KkqqpfkLEAQjXgtM0hlgwuc8/A4if+I0YtboCMkVQu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n# AoAAMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcCAQsxDjAM\n# BgorBgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBQrYn6ZWaQ47KzOQwtdMBx2rmr2\n# yzANBgkqhkiG9w0BAQEFAASCAQB4dlpQQs9z3Ts6k+zq/8jqs0Yd4LC2sqL3qoXF\n# bC5QbO5/yWN26ooPc1BCUbcrQZ0a9zz4NQDTEUzZsiqfJg1nh+rx/F1ElntfHIxy\n# yM2qeXl9zp89O6+/G4DwdFDK0xqj0NK1HBNbKlVWrPG52xlhPu8T/pmstk+H12Cb\n# UiyX/lnihNFctVVzk7d8Exy+k9NCI3zAgTd6Pnq0BHgz3TwaO4JmJi8LYJfxJxRZ\n# K6ARTFi8hqG6QRUAdfvBDabGzIdeGcs7OxDEMVZzGdtIxic7XUts9zCjcSRi5cjF\n# 7+H8HT8EBEwSuD8eka7wslOaYof8cv8KqN8mRMIWw5INikfl\n# SIG # End signature block\n"
  },
  {
    "path": "source/functions/Set-DbcFile.ps1",
    "content": "<#\n.SYNOPSIS\nWrites the result of Invoke-DbcCheck to a file (after converting with Convert-DbcResult)\n\n.DESCRIPTION\nWhen a check has been run with Invoke-DbcCheck (and -PassThru) and then converted with\nConvert-DbcResult This command will write the results to a CSV, JSON or XML file\n\n.PARAMETER InputObject\nThe datatable created by Convert-DbcResult\n\n.PARAMETER FilePath\nThe directory for the file\n\n.PARAMETER FileName\nThe name of the file\n\n.PARAMETER FileType\nThe type of file -CSV,JSON,XML\n\n.PARAMETER Append\nAdd to an existing file or not\n\n.PARAMETER Force\nOverwrite Existing file\n\n.EXAMPLE\n$Date = Get-Date -Format \"yyyy-MM-dd\"\nInvoke-DbcCheck -SqlInstance SQL2017N5 -Check AutoClose -Passthru | Convert-DbcResult -Label Beard-Check | Set-DbcFile -FilePath C:\\temp\\dbachecks\\ -FileName Auto-close_$Date -FileType xml\n\nRuns the AutoClose check against SQL2017N5 and converts to a datatable with a label of Beard-Check and outputs to xml and saves in C:\\temp\\dbachecks\\Auto-close_DATE.xml\n\n.EXAMPLE\nInvoke-DbcCheck -SqlInstance SQL2017N5 -Check AutoClose -Passthru | Convert-DbcResult -Label Beard-Check | Set-DbcFile -FilePath C:\\temp\\dbachecks\\ -FileName Auto-close.xml -FileType xml\n\nRuns the AutoClose check against SQL2017N5 and converts to a datatable with a label of Beard-Check and outputs to xml and saves in C:\\temp\\dbachecks\\Auto-close.xml\n\n.EXAMPLE\nInvoke-DbcCheck -SqlInstance SQL2017N5 -Check AutoClose -Passthru | Convert-DbcResult -Label Beard-Check | Set-DbcFile -FilePath C:\\temp\\dbachecks\\ -FileName Auto-close.csv -FileType csv\n\nRuns the AutoClose check against SQL2017N5 and converts to a datatable with a label of Beard-Check and outputs to csv and saves in C:\\temp\\dbachecks\\Auto-close.csv\n\n.EXAMPLE\nInvoke-DbcCheck -SqlInstance SQL2017N5 -Check AutoClose -Passthru | Convert-DbcResult -Label Beard-Check | Set-DbcFile -FilePath C:\\temp\\dbachecks\\ -FileName Auto-close.json -FileType Json\n\nRuns the AutoClose check against SQL2017N5 and converts to a datatable with a label of Beard-Check and outputs to JSON and saves in C:\\temp\\dbachecks\\Auto-close.json\n\n.EXAMPLE\nInvoke-DbcCheck -SqlInstance SQL2017N5 -Check AutoClose -Passthru | Convert-DbcResult -Label Beard-Check | Set-DbcFile -FilePath C:\\temp\\dbachecks\\ -FileName Auto-close.json -FileType Json -Append\n\nRuns the AutoClose check against SQL2017N5 and converts to a datatable with a label of Beard-Check and outputs to JSON and saves in C:\\temp\\dbachecks\\Auto-close.json appending the results to the existing file\n\n.EXAMPLE\nInvoke-DbcCheck -SqlInstance SQL2017N5 -Check AutoClose -Passthru | Convert-DbcResult -Label Beard-Check | Set-DbcFile -FilePath C:\\temp\\dbachecks\\ -FileName Auto-close.json -FileType Json -Force\n\nRuns the AutoClose check against SQL2017N5 and converts to a datatable with a label of Beard-Check and outputs to JSON and saves in C:\\temp\\dbachecks\\Auto-close.json overwriting the existing file\n\n.NOTES\nInitial - RMS 28/12/2019\n#>\nfunction Set-DbcFile {\n    [CmdletBinding(SupportsShouldProcess, DefaultParameterSetName = \"Default\")]\n    [OutputType([string])]\n    Param(\n        # The pester results object\n        [Parameter(Mandatory = $true, ValueFromPipeline = $true, ParameterSetName = 'Default')]\n        [Parameter(Mandatory = $true, ValueFromPipeline = $true, ParameterSetName = 'Append')]\n        [Parameter(Mandatory = $true, ValueFromPipeline = $true, ParameterSetName = 'Force')]\n        $InputObject,\n        [Parameter(Mandatory = $true, ParameterSetName = 'Default')]\n        [Parameter(Mandatory = $true, ParameterSetName = 'Append')]\n        [Parameter(Mandatory = $true, ParameterSetName = 'Force')]\n        # The Directory for the file\n        [string]$FilePath,\n        [Parameter(Mandatory = $true, ParameterSetName = 'Default')]\n        [Parameter(Mandatory = $true, ParameterSetName = 'Append')]\n        [Parameter(Mandatory = $true, ParameterSetName = 'Force')]\n        # The name for the file\n        [string]$FileName,\n        # the type of file\n        [Parameter(Mandatory = $true, ParameterSetName = 'Default')]\n        [Parameter(Mandatory = $true, ParameterSetName = 'Append')]\n        [Parameter(Mandatory = $true, ParameterSetName = 'Force')]\n        [ValidateSet('Csv', 'Json', 'Xml')]\n        [string]$FileType,\n        # Appending\n        [Parameter(Mandatory = $true, ParameterSetName = 'Append')]\n        [switch]$Append,\n        # Overwrite file\n        [Parameter(Mandatory = $true, ParameterSetName = 'Force')]\n        [switch]$Force\n    )\n\n    Write-PSFMessage \"Testing we have a Test Results object\" -Level Verbose\n    if(-not $InputObject){\n        Write-PSFMessage \"Uh-Oh - I'm really sorry - We don't have a Test Results Object\" -Level Significant\n        Write-PSFMessage \"Did You forget the -PassThru parameter on Invoke-DbcCheck?\" -Level Warning\n        Return ''\n    }\n    Write-PSFMessage \"Testing we can access $FilePath\" -Level Verbose\n    If (Test-Path -Path $FilePath) {\n\n    }\n    else {\n        Write-PSFMessage \"Uh-Oh - We cant access $FilePath - Please check that $Env:USERNAME has access\" -Level Significant\n        Return ''\n    }\n    $File = \"$FilePath\\$FileName\"\n    Write-PSFMessage \"Testing if $file exists\" -Level Verbose\n    if (Test-Path -Path $file) {\n        if (!$Force -and !$Append) {\n            Write-PSFMessage \"Uh-Oh - File $File exists - use the Force parameter to overwrite (even if your name is not Luke!)\" -Level Significant\n            Return ''\n        }\n        else {\n            if (-not $Append) {\n                Write-PSFMessage \"File $File exists and will be overwritten \" -Level Verbose\n            }\n        }\n        if ($Append) {\n            if ($FileType -eq 'XML') {\n                Write-PSFMessage \"I'm not coding appending to XML - Sorry - The Beard loves you but not that much\" -Level Significant\n                Return ''\n            }\n            else {\n                Write-PSFMessage \"File $File exists and will be appended to \" -Level Verbose\n            }\n        }\n    }\n\n    function Add-Extension {\n        Param ($FileType)\n                if(-not ($FileName.ToLower().EndsWith(\".$FileType\"))){\n                    Write-PSFMessage \"No Extension supplied so I will add .$FileType to $Filename\" -Level Verbose\n                    $FileName = $FileName + '.' + $FileType\n                }\n                $File = \"$FilePath\\$FileName\"\n                $File\n            }\n\n    try {\n        switch ($FileType) {\n            'CSV' {\n                $file = Add-Extension -FileType csv\n                if ($PSCmdlet.ShouldProcess(\"$File\" , \"Adding results to CSV\")) {\n                    $InputObject  | Select-Object * -ExcludeProperty ItemArray, Table, RowError, RowState, HasErrors | Export-Csv -Path $File -NoTypeInformation -Append:$Append\n                }\n            }\n            'Json' {\n                $file = Add-Extension -FileType json\n                if ($PSCmdlet.ShouldProcess(\"$File\" , \"Adding results to Json file\")) {\n                    $Date = @{Name = 'Date'; Expression = {($_.Date).Tostring('MM/dd/yy HH:mm:ss')}}\n                    $InputObject  | Select-Object $Date, Label,Describe,Context,Name,Database,ComputerName,Instance,Result,FailureMessage | ConvertTo-Json | Out-File -FilePath $File -Append:$Append\n                }\n            }\n            'Xml' {\n                $file = Add-Extension -FileType xml\n                if ($PSCmdlet.ShouldProcess(\"$File\" , \"Adding results to XML file \")) {\n                    $InputObject  | Select-Object * -ExcludeProperty ItemArray, Table, RowError, RowState, HasErrors | Export-CliXml -Path $File -Force:$force\n                }\n            }\n        }\n        Write-PSFMessage \"Exported results to $file\" -Level Output\n    }\n    catch {\n        Write-PSFMessage \"Uh-Oh - We failed to create the file $file :-(\"\n    }\n}\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUx0zz6Opkgx1KL+StqytBCrq5\n# dligggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz\n# c3VyZWQgSUQgQ29kZSBTaWduaW5nIENBMB4XDTE3MDUwOTAwMDAwMFoXDTIwMDUx\n# MzEyMDAwMFowVzELMAkGA1UEBhMCVVMxETAPBgNVBAgTCFZpcmdpbmlhMQ8wDQYD\n# VQQHEwZWaWVubmExETAPBgNVBAoTCGRiYXRvb2xzMREwDwYDVQQDEwhkYmF0b29s\n# czCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAI8ng7JxnekL0AO4qQgt\n# Kr6p3q3SNOPh+SUZH+SyY8EA2I3wR7BMoT7rnZNolTwGjUXn7bRC6vISWg16N202\n# 1RBWdTGW2rVPBVLF4HA46jle4hcpEVquXdj3yGYa99ko1w2FOWzLjKvtLqj4tzOh\n# K7wa/Gbmv0Si/FU6oOmctzYMI0QXtEG7lR1HsJT5kywwmgcjyuiN28iBIhT6man0\n# Ib6xKDv40PblKq5c9AFVldXUGVeBJbLhcEAA1nSPSLGdc7j4J2SulGISYY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dNXChDGFKtigZGnKMAkGBSsOAwIaBQCgeDAYBgorBgEEAYI3AgEMMQowCKACgACh\n# AoAAMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcCAQsxDjAM\n# BgorBgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBRT+0vM2eNscCs7R1X6mnoonUzs\n# oDANBgkqhkiG9w0BAQEFAASCAQBON/45klZQGxL9/H9nr+X9Vo0ETLQitGU1aj+W\n# zO6f8l9KfBm5O4wgbkvtRkSjs+prqVB3BYjD0ejlEK3/ewD+cR7UZLJs6TqralA7\n# DJPqsBk9Ssspkv8mgJqdG0r6sUxlhsVp7+UKXhc/ANhdV6Skb1MHxHht7kp6lIB7\n# ZpEWC7jJ44Zj0/2sJd2KgbyoADaw3R2IxByORc3AN3z4qDanRpLtHFPuGGpQeB8X\n# R0sOcXUc0076gSlW6LUMN1mtcb69PaYVos2OfQhmqSM/p/QbHV4XiX8pzQAZoYi9\n# nvilZTqD8lIeCshOCmiCZT9g9vtbI6KVNOO2U1I0aK6XAZg9\n# SIG # End signature block\n"
  },
  {
    "path": "source/functions/Start-DbcPowerBi.ps1",
    "content": "﻿<#\n.SYNOPSIS\nLaunches one of the included dbachecks Power BI dashboards either the original for json files or the new one for database. **You will need refresh* the Power BI dashboard every time to see the new results!\n\n.DESCRIPTION\nLaunches one of the included dbachecks Power BI dashboards either the original for json files or the new one for database.**You will need refresh* the Power BI dashboard every time to see the new results.\n\n.PARAMETER FromDatabase\nA Switch to use to open the database based PowerBi dashboard if you have stored the results in a database with Write-DbcTable. If not chosen it will use the original Power Bi file with a json data source\n\n.PARAMETER Path\nThe location of the pbix or pbit file if you have moved it or want to use your own. \"$script:ModuleRoot\\bin\\dbachecks.pbix\" or \"$script:ModuleRoot\\bin\\dbachecks-FromDatabase.pbit\"  by default.\n\n.PARAMETER EnableException\nBy default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.\n\n.EXAMPLE\nStart-DbcPowerBi -FromDatabase\n\nLaunches the Database Power Bi dashboard template, which will prompt for the Instance and database name\n.EXAMPLE\nStart-DbcPowerBi\n\nLaunches the Json PowerBi from \"$script:ModuleRoot\\bin\\dbachecks.pbix\" using \"C:\\windows\\Temp\\dbachecks\\*.json\" (generated by Update-DbcPowerBiDataSource) as the datasource.\n\n.EXAMPLE\nStart-DbcPowerBi -Path \\\\nas\\projects\\dbachecks.pbix\n\nLaunches \\\\nas\\projects\\dbachecks.pbix using \"C:\\windows\\Temp\\dbachecks\\*.json\" as the datasource\n\n.LINK\nhttps://dbachecks.readthedocs.io/en/latest/functions/Start-DbcPowerBi/\n\n#>\nfunction Start-DbcPowerBi {\n    [CmdletBinding(SupportsShouldProcess)]\n    param (\n        [switch]$FromDatabase,\n        [string]$Path,\n        [switch]$EnableException\n    )\n\n    process {\n        if ($IsLinux) {\n            Write-PSFMessage \"We cannot run this command from linux at the moment\" -Level Warning\n            Return\n        }\n        else {\n            if (-not $FromDatabase) {\n                if (-not $Path) {\n                    $Path = \"$script:ModuleRoot\\bin\\dbachecks.pbix\"\n                    $newpath = \"$script:localapp\\dbachecks.pbix\"\n                    $dirPath =  \"$Path\\dbachecks.pbix\"\n                }\n            }\n            else {\n                $Path = \"$script:ModuleRoot\\bin\\dbachecks-FromDatabase.pbit\"\n                $newpath = \"$script:localapp\\dbachecks-FromDatabase.pbit\"\n                $DirPath = \"$Path\\dbachecks-FromDatabase.pbit\"\n            }\n            if (Test-Path -Path $Path -PathType Container) {\n                $Path = $DirPath\n                Write-PSFMessage -Level Output -Message \"Path passed in, appending file name to it.\"\n                Write-PSFMessage -Level Output -Message \"New path: $path\"\n            }\n\n            if ($PSCmdlet.ShouldProcess(\"$newpath\" , \"Copying the file $path to \")) {\n                try {\n                    Copy-Item -Path $Path -Destination $newpath -Force\n                    $Path = $newpath\n                }\n                catch {\n                    Stop-PSFFunction -Message \"Failed Copying file\" -ErrorRecord $_\n                    return\n                }\n            }\n\n            if (-not (Test-Path -Path $Path)) {\n                Stop-PSFFunction -Message \"$Path does not exist\"\n                return\n            }\n            try {\n                Write-PSFMessage -Level Output -Message \"Launching the dbachecks dashboard. This may take a moment.\"\n                if ($PSCmdlet.ShouldProcess(\"$path\" , \"Starting PowerBi Desktop with file \")) {\n                    Invoke-Item -Path $path\n                }\n            }\n            catch {\n                Stop-PSFFunction -Message \"Failure\" -ErrorRecord $_\n                return\n            }\n        }\n    }\n}\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUetPRa6cC+Lkp6zDM+2AcTRnx\n# 6/6gggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz\n# c3VyZWQgSUQgQ29kZSBTaWduaW5nIENBMB4XDTE3MDUwOTAwMDAwMFoXDTIwMDUx\n# MzEyMDAwMFowVzELMAkGA1UEBhMCVVMxETAPBgNVBAgTCFZpcmdpbmlhMQ8wDQYD\n# VQQHEwZWaWVubmExETAPBgNVBAoTCGRiYXRvb2xzMREwDwYDVQQDEwhkYmF0b29s\n# czCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAI8ng7JxnekL0AO4qQgt\n# Kr6p3q3SNOPh+SUZH+SyY8EA2I3wR7BMoT7rnZNolTwGjUXn7bRC6vISWg16N202\n# 1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xggIoMIICJAIBATCBhjByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMM\n# RGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQD\n# EyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgQ29kZSBTaWduaW5nIENBAhACwXUo\n# dNXChDGFKtigZGnKMAkGBSsOAwIaBQCgeDAYBgorBgEEAYI3AgEMMQowCKACgACh\n# AoAAMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcCAQsxDjAM\n# BgorBgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBTR0ru8ENca5qKO8X5SWqRx6fYq\n# cjANBgkqhkiG9w0BAQEFAASCAQAwwGUB6ecdeKPSBRiTBR2dmdmeOBaZ0uhkLLfI\n# wrdFWhh1ybh1ieo5duo49S1ANx0fFeNULaFAuM1BHGQAVdAH6OLhEeg3NHTm+D+F\n# eFK9zLhbmexEOTGTtBjbwdX0KgHqfsyJVsr6Q5jhO8SeMoMxFT/SaP5CARt0JZwr\n# ip62S3xAxMC5ApLfxiAXhBjFMYo5K2TKWjnnTzRu/j2+jXWhLQ3NHzMF5e5x7Isp\n# RvOcnjLWH3/egC0hEk70j0qbgjW81JVqCYn9JwG+JGY14FqP3mkwqKKaWtpFs3Vz\n# XK2berv/8siVaV7feCoPZUi46FkCeXsWwSgR0y0JaccdNMxj\n# SIG # End signature block\n"
  },
  {
    "path": "source/functions/Update-DbcPowerBiDataSource.ps1",
    "content": "<#\n.SYNOPSIS\nConverts Pester results and exports file in required format for launching the\nPower BI command. **You will need refresh* the Power BI dashboard every time to\nsee the new results.\n\n.DESCRIPTION\nConverts Pester results and exports file in required format for launching the\nPower BI command. **You will need refresh* the Power BI dashboard every time to\nsee the new results.\n\nBasically, it does this:\n$InputObject.TestResult | Select-Object -First 20 | ConvertTo-Json -Depth 3 | Out-File \"$env:windir\\temp\\dbachecks.json\"\n\n.PARAMETER InputObject\nRequired. Resultset from Invoke-DbcCheck. If InputObject is not provided, it will be generated using a very generic resultset:\n\n.PARAMETER Path\nThe directory to store your JSON files. \"C:\\windows\\temp\\dbachecks\\*.json\" by default\n\n.PARAMETER FileName\nif you want to give the file a specific name\n\n.PARAMETER Environment\nA Name to give your suite of tests IE Prod - This will also alter the name of the file\n\n.PARAMETER Force\nDelete all json files in the data source folder.\n\n.PARAMETER Append\nAppends results to existing file. Use this if you have custom check repos\n\n.PARAMETER EnableException\nBy default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.\n\n.EXAMPLE\nInvoke-DbcCheck -SqlInstance $Instance -Check DatabaseStatus -Show None -PassThru | Update-DbcPowerBiDataSource\n\nRuns the DatabaseStatus checks against $Instance then saves to json to $env:windir\\temp\\dbachecks\\dbachecks_1_DatabaseStatus.json\n\n.EXAMPLE\nInvoke-DbcCheck -SqlInstance $Instance -Check DatabaseStatus -Show None -PassThru | Update-DbcPowerBiDataSource -Path C:\\Temp\n\nRuns the DatabaseStatus checks against $Instance then saves to json to C:\\Temp\\dbachecks_1_DatabaseStatus.json\n\n.EXAMPLE\nInvoke-DbcCheck -SqlInstance $Instance -Check DatabaseStatus -Show None -PassThru | Update-DbcPowerBiDataSource -Path C:\\Temp  -FileName BeardyTests\n\nRuns the DatabaseStatus checks against $Instance then saves to json to C:\\Temp\\BeardyTests.json\n\n.EXAMPLE\nInvoke-DbcCheck -SqlInstance $Instance -Check DatabaseStatus -Show None -PassThru | Update-DbcPowerBiDataSource -Path C:\\Temp  -FileName BeardyTests.json\n\nRuns the DatabaseStatus checks against $Instance then saves to json to C:\\Temp\\BeardyTests.json\n\n.EXAMPLE\nInvoke-DbcCheck -SqlInstance $Instance -Check DatabaseStatus -Show None -PassThru | Update-DbcPowerBiDataSource -Path C:\\Temp  -Environment Prod_DBChecks\n\nRuns the DatabaseStatus checks against $Instance then saves to json to  C:\\Temp\\dbachecks_1_Prod_DBChecks_DatabaseStatus.json\n\n.EXAMPLE\nInvoke-DbcCheck -SqlInstance $Instance -Check DatabaseStatus -Show None -PassThru | Update-DbcPowerBiDataSource -Environment Prod_DBChecks\n\nRuns the DatabaseStatus checks against $Instance then saves to json to  C:\\Windows\\temp\\dbachecks\\dbachecks_1_Prod_DBChecks_DatabaseStatus.json\n\n.EXAMPLE\nInvoke-DbcCheck -SqlInstance sql2017 -Tag Backup -Show Summary -PassThru | Update-DbcPowerBiDataSource -Path \\\\nas\\projects\\dbachecks.json\nStart-DbcPowerBi -Path \\\\nas\\projects\\dbachecks.json\n\nRuns tests, saves to json to \\\\nas\\projects\\dbachecks.json\nOpens the PowerBi using that file\nthen you'll have to change your data source in Power BI because by default it\npoints to C:\\Windows\\Temp (limitation of Power BI)\n\n.EXAMPLE\n\nSet-DbcConfig -Name app.checkrepos -Value \\\\SharedPath\\CustomPesterChecks\nInvoke-DbcCheck -SqlInstance $Instance -Check DatabaseStatus, CustomCheckTag -PassThru | Update-DbcPowerBiDataSource -Path \\\\SharedPath\\CheckResults -Name CustomCheckResults -Append\n\nBecause we are using a custom check repository you MUSTR use the Append parameter for Update-DbcPowerBiDataSource\notherwise the json file will be overwritten\n\nSets the custom check repository to \\\\SharedPath\\CustomPesterChecks\nRuns the DatabaseStatus checks and custom checks with the CustomCheckTag against $Instance then saves all the results\nto json to \\\\SharedPath\\CheckResults.json -Name CustomCheckResults\n\n\n.EXAMPLE\nInvoke-DbcCheck -SqlInstance sql2017 -Check SuspectPage -Show None -PassThru | Update-DbcPowerBiDataSource -Environment Test -Whatif\n\nWhat if: Performing the operation \"Removing .json files named *Default*\" on target \"C:\\Windows\\temp\\dbachecks\".\nWhat if: Performing the operation \"Passing results\" on target \"C:\\Windows\\temp\\dbachecks\\dbachecks_1_Test__SuspectPage.json\".\n\nWill not actually create or update the data sources but will output what happens with the command and what the file name will be\ncalled.\n\n.LINK\nhttps://dbachecks.readthedocs.io/en/latest/functions/Update-DbcPowerBiDataSource/\n\n#>\nfunction Update-DbcPowerBiDataSource {\n    [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Low')]\n    param (\n        [parameter(ValueFromPipeline, Mandatory)]\n        [pscustomobject]$InputObject,\n        [string]$Path = \"$env:windir\\temp\\dbachecks\",\n        [string]$FileName,\n        [string]$Environment = \"Default\",\n        [switch]$Force,\n        [switch]$EnableException,\n        [switch]$Append\n    )\n    begin {\n        Write-PSFMessage \"Starting begin block\" -Level Debug\n        if ($IsLinux -and $Path -eq '\\temp\\dbachecks') {\n            Write-PSFMessage \"Setting path on Linux\" -Level Verbose\n            $Path = Get-DbcConfigValue -Name app.localapp\n            Write-PSFMessage \"Setting path on Linux to $Path\" -Level Verbose\n        }\n        if ($Force) {\n            if ($PSCmdlet.ShouldProcess($Path, 'Removing all .json files')) {\n                try {\n                    $null = Remove-Item \"$Path\\*.json\" -ErrorAction Stop\n                    Write-PSFMessage \"Removed all files from $Path\" -Level Verbose\n                }\n                catch {\n                    Stop-PSFFunction -Message \"FAILED - Removing all files from $Path\" -ErrorRecord $_\n                    return\n                }\n            }\n        }\n    }\n    process {\n        ++$i\n        try {\n            if (-not (Test-Path -Path $Path)) {\n                if ($PSCmdlet.ShouldProcess($Path, 'Creating new directory')) {\n                    $null = New-Item -ItemType Directory -Path $Path -ErrorAction Stop\n                    Write-PSFMessage \"Created New Directory $Path\" -Level Verbose\n                }\n            }\n        }\n        catch {\n            Stop-PSFFunction -Message \"Failed - Creating New Directory $Path\" -ErrorRecord $_\n            return\n        }\n        $basename = \"dbachecks_$i\"\n        if ($Environment) {\n            $basename = \"dbachecks_$i\" + \"_$Environment`_\"\n        }\n        if ($FileName) {\n            $basename = $FileName\n        }\n        else {\n            if ($InputObject.TagFilter) {\n                $tagnames = $InputObject.TagFilter[0..3] -join \"_\"\n                $basename = \"$basename`_\" + $tagnames + \".json\"\n            }\n        }\n\n        if ($basename.EndsWith('.json')) {}\n        else {\n            $basename = $basename + \".json\"\n        }\n\n        Write-PSFMessage \"Set basename to $basename\" -Level Verbose\n        $FilePath = \"$Path\\$basename\"\n        Write-PSFMessage \"Set filepath to $FilePath\" -Level Verbose\n\n        if ($InputObject.TotalCount -gt 0) {\n            try {\n                if ($PSCmdlet.ShouldProcess($FilePath, 'Passing results')) {\n                    if ($Append) {\n                        $InputObject.TestResult | ConvertTo-Json -Depth 5 | Out-File -FilePath $FilePath -Append\n                        Write-PSFMessage -Level Output -Message \"Appended results to $FilePath\"\n                    }\n                    else {\n                        $InputObject.TestResult | ConvertTo-Json -Depth 5 | Out-File -FilePath $FilePath\n                        Write-PSFMessage -Level Output -Message \"Wrote results to $FilePath\"\n                    }\n                }\n            }\n            catch {\n                Stop-PSFFunction -Message \"Failed Passing Results to $FilePath\" -ErrorRecord $_\n                return\n            }\n        }\n    }\n    end {\n        if ($InputObject.TotalCount -isnot [int]) {\n            Stop-PSFFunction -Message \"Invalid TestResult. Did you forget to use -Passthru with Invoke-DbcCheck?\"\n            return\n        }\n    }\n}\n\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUGad1N8rU46XXXiQXKctuXhy8\n# qU+gggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz\n# c3VyZWQgSUQgQ29kZSBTaWduaW5nIENBMB4XDTE3MDUwOTAwMDAwMFoXDTIwMDUx\n#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j9xjmMOE0ut119EefM2FAaK95xGTlz/kLEbBw6RFfu6r7VRwo0k\n# riTGxycqoSkoGjpxKAI8LpGjwCUR4pwUR6F6aGivm6dcIFzZcbEMj7uo+MUSaJ/P\n# QMtARKUT8OZkDCUIQjKyNookAv4vcn4c10lFluhZHen6dGRrsutmQ9qzsIzV6Q3d\n# 9gEgzpkxYz0IGhizgZtPxpMQBvwHgfqL2vmCSfdibqFT+hKUGIUukpHqaGxEMrJm\n# oecYpJpkUe8xggIoMIICJAIBATCBhjByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMM\n# RGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQD\n# EyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgQ29kZSBTaWduaW5nIENBAhACwXUo\n# dNXChDGFKtigZGnKMAkGBSsOAwIaBQCgeDAYBgorBgEEAYI3AgEMMQowCKACgACh\n# AoAAMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcCAQsxDjAM\n# BgorBgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBS4q3UVKZeERragHnuZtyhulEMh\n# bzANBgkqhkiG9w0BAQEFAASCAQAIpU2w6E5wragmblIeHZRlZJ6NqOV9e0EgZdHF\n# hoKR+j4CBEZ2Jo0MF66siC0iQdR6amo0TNYsxo6L80ygxIrj7P6KoT3sOdzcJ0/3\n# BpoyUbC8rFhA9SVxtbe3CFCj4nSBsboeLLym+plBpHYaeLKnN5E+vpuXIfkh63We\n# 3ovKaMAADLihQb5SU0gBndsg0xzfcinv+YtMVCmEK8TRAT5bw+tjLOgBDUFVeyz1\n# x9w4cyvk6mhqW4PZDT42B2/79RPCMWifysVJ2t7sdLIkBByuQVhTFjJTQKwS6m3Y\n# OFwAm2rDk9l/2PuM406qXN0duVr4udpy3RMs+hXrWNa2477m\n# SIG # End signature block\n"
  },
  {
    "path": "source/functions/Update-DbcRequiredModules.ps1",
    "content": "<#\n.SYNOPSIS\nUpdates all required modules, including dbachecks.\n\n.DESCRIPTION\nUpdates all required modules, including dbachecks.\n\n.PARAMETER EnableException\nBy default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.\n\n.EXAMPLE\nUpdate-DbcRequiredModules\n\nUpdates all required modules including dbachecks\n\n.EXAMPLE\nUpdate-DbcRequiredModules -Verbose\n\nUpdates all required modules including dbachecks and shows verbose output\n\n.LINK\nhttps://dbachecks.readthedocs.io/en/latest/functions/Update-DbcRequiredModules/\n\n#>\nfunction Update-DbcRequiredModules {\n    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseSingularNouns', '')]\n    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')]\n    param (\n        [switch]$EnableException\n    )\n\n    $ModuleManifest = Import-PowerShellDataFile -Path \"$script:ModuleRoot\\dbachecks.psd1\"\n    foreach ($Module in $ModuleManifest.RequiredModules) {\n        if ($pscmdlet.ShouldProcess(\"Install $($Module.ModuleName) version $($Module.ModuleVersion) from repository\")) {\n            try {\n                Write-PSFMessage -Level Output -Message \"Updating $($Module.ModuleName)\"\n                Update-Module -Name $Module.ModuleName -ErrorAction Stop\n            } catch {\n                Stop-PSFFunction -Message 'Failure' -ErrorRecord $_\n            }\n        }\n    }\n    if ($pscmdlet.ShouldProcess('Install latest dbachecks from repository')) {\n        try {\n            Write-PSFMessage -Level Output -Message 'Updating dbachecks'\n            Update-Module -Name dbachecks -ErrorAction Stop\n        } catch {\n            Stop-PSFFunction -Message 'Failure' -ErrorRecord $_\n        }\n    }\n}\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAAB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Um\n# tBfBprG/Stj8p3PjxVHBARqEKdY+MHIA293Sfx6aokftJzKR5orDAm5SUVIwXvVV\n# zyRdnUB+tohNrrO/o0fBExr13XsXKnk8XhmZ1VzRa6FKpbeS1KnRbjxhzh0lwgZF\n# i0gdf/QWxszaDdYxxHICdB2AmpQy+sWuxhfqDzXluJXFagEiIGV3EWKt9/kNff9u\n# U6pMqyS2g8TIOqJve0obtSUSWjPy35e9ji26SglAliO+fkgtVYDP/D7fhHybobPW\n# nNerOskuKkkfHpdUCx5fW6Ft9G6Wy1OxDe/h6t3VdoJ6/pCz\n# SIG # End signature block\n"
  },
  {
    "path": "source/functions/Write-DbcTable.ps1",
    "content": "<#\n.SYNOPSIS\nWrites the result of Invoke-DbcCheck (with -PassThru) after Convert-DbcResult to a database table\n\n.DESCRIPTION\nAfter running Invoke-DbcCheck (With PassThru) and converting it to a datatable with Convert-DbcResult, this command\nwill write the results to a database table and will also write the current Checks to another table called dbachecksChecks\n\n.PARAMETER SqlInstance\nThe Instance for the results\n\n.PARAMETER SqlCredential\nThe SQL Credential for the instance if required\n\n.PARAMETER Database\nThe database to write the results\n\n.PARAMETER InputObject\nThe datatable from Convert-DbcResult\n\n.PARAMETER Table\nThe name of the table for the results - will be created if it doesn't exist. By default it will be named CheckResults\n\n.PARAMETER Schema\nThe schema for the table - defaults to dbo\n\n.PARAMETER Truncate\nWill truncate the existing table (if results go to a staging table for example)\n\n\n.EXAMPLE\nInvoke-DbcCheck -SqlInstance SQL2017N5 -Check AutoClose -Passthru | Convert-DbcResult -Label Beard-Check | Write-DbcTable -SqlInstance DbaInstance -Database dbadatabase\n\nRuns the AutoClose check against SQL2017N5 and converts to a datatable with a label of Beard-Check and writes it to the dbadatabase on DbaInstance\n\n.EXAMPLE\nImport-DbcConfig -Path \\\\share\\ProdMorningChecks.json\nInvoke-DbcCheck -SqlInstance $ProdSqlInstances -Passthru | Convert-DbcResult -Label Prod-Morning-Check | Write-DbcTable -SqlInstance DbaInstance -Database dbadatabase\n\nLoads the Prod Morning Checks Configuration and runs the checks against the SQL Instances converts to a datatable with a label of Prod-Morning-Check and writes it to the dbadatabase on DbaInstance\n\n.NOTES\nInitial - RMS 28/12/2019\n#>\nfunction Write-DbcTable {\n    [CmdletBinding(SupportsShouldProcess)]\n    [OutputType([string])]\n    Param(\n        [Parameter(Mandatory)]\n        [ValidateNotNull()]\n        [string]$SqlInstance,\n        [ValidateNotNull()]\n        [PSCredential]$SqlCredential,\n        [object]$Database,\n        [Parameter(Mandatory, ValueFromPipeline)]\n        # The pester results object\n        [ValidateNotNull()]\n        [object]$InputObject,\n        [ValidateNotNullOrEmpty()]\n        [string]$Table = 'CheckResults',\n        [ValidateNotNullOrEmpty()]\n        [string]$Schema = 'dbo',\n        [switch]$Truncate\n\n    )\n    Write-PSFMessage 'Testing we have a Test Results object' -Level Verbose\n    if (-not $InputObject) {\n        Write-PSFMessage \"Uh-Oh - I'm really sorry - We don't have a Test Results Object\" -Level Significant\n        Write-PSFMessage 'Did You forget the -PassThru parameter on Invoke-DbcCheck?' -Level Warning\n        Return ''\n    }\n    Write-PSFMessage \"Connecting to $SqlInstance\" -Level Verbose\n    $SqlInstanceSmo = Connect-DbaInstance -SqlInstance $SqlInstance -SqlCredential $SqlCredential\n\n    Write-PSFMessage \"Checking for dbachecks table in $Database\" -Level Verbose\n    if (Get-DbaDbTable -SqlInstance $SqlInstanceSmo -Database $Database -Table dbachecksChecks) {\n        if ($PSCmdlet.ShouldProcess(\"$schema.$database\" , \"On $SqlInstance - Update the dbachecksChecks tables \")) {\n            Get-DbcCheck | Write-DbaDbTableData -SqlInstance $SqlInstanceSmo -Database $Database -Table dbachecksChecks -Schema $Schema -AutoCreateTable -Truncate\n        }\n    } else {\n        if ($PSCmdlet.ShouldProcess(\"$schema.$database\" , \"On $SqlInstance - Add the dbachecksChecks tables \")) {\n            Get-DbcCheck | Write-DbaDbTableData -SqlInstance $SqlInstanceSmo -Database $Database -Table dbachecksChecks -Schema $Schema -AutoCreateTable\n        }\n    }\n    Write-PSFMessage \"Checking for $Table in $Database\" -Level Verbose\n    if (Get-DbaDbTable -SqlInstance $SqlInstanceSmo -Database $Database -Table $Table) {\n        Write-PSFMessage \"We have $table already - moving on.\" -Level Verbose\n    } else {\n        if ($PSCmdlet.ShouldProcess(\"$schema.$database\" , \"Create a new table called $table \")) {\n            # If specified table does not exists, create with specific datatypes to avoid nvarchar(max)\n            $sqlTableCreation = @\"\n CREATE TABLE [$schema].[$table](\n     [Date] [datetime2](7) NOT NULL,\n     [Label] [nvarchar](255) NULL,\n     [Describe] [nvarchar](255) NULL,\n     [Context] [nvarchar](255) NULL,\n     [Name] [nvarchar](600) NULL,\n     [Database] [nvarchar](255) NULL,\n     [ComputerName] [nvarchar](255) NULL,\n     [Instance] [nvarchar](255) NULL,\n     [Result] [nvarchar](10) NULL,\n     [FailureMessage] [nvarchar](MAX) NULL\n ) ON [PRIMARY]\n GO\n\n CREATE CLUSTERED INDEX CI_DATE ON [$schema].[$table]\n (\n     [Date]\n ) WITH (DATA_COMPRESSION = PAGE) ON [PRIMARY]\n GO\n\"@\n            Invoke-DbaQuery -SqlInstance $SqlInstanceSmo -Database $Database -Query $sqlTableCreation\n        }\n    }\n    if ($PSCmdlet.ShouldProcess(\"$Schema.$database\" , \"On $SqlInstance - Add dbachecks results to $Table \")) {\n        $InputObject | Write-DbaDbTableData -SqlInstance $SqlInstanceSmo -Database $Database -Table $Table -Schema $Schema -AutoCreateTable -Truncate:$Truncate\n    }\n}\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUegYAffTRCI+hKr04nGgnT1lL\n# /aSgggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBg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XXiNVMHlu+0MPtvnxI9PoXUuB4lBsafjjmEkoqmVsl/Y2zn2zoZkDuly/DY\n# vvau3Pl873m1ek2U7PtvBWuf2hTsWMIJWP2w9vlr5Kv1OSluBbsbSNdlDOlXYRSF\n# 0WiID26B/9duWJDW0WOyp35+uztj0ZRghn4L6v7Xr+mmAx+y\n# SIG # End signature block\n"
  },
  {
    "path": "source/internal/assertions/Agent.Assertions.ps1",
    "content": "function Assert-DatabaseMailEnabled {\n    param (\n        $SQLInstance,\n        $DatabaseMailEnabled\n    )\n   (Get-DbaSpConfigure -SqlInstance $SQLInstance -Name DatabaseMailEnabled).ConfiguredValue -eq 1 | Should -Be $DatabaseMailEnabled -Because 'The Database Mail XPs setting should be set correctly'\n}\n\nfunction Assert-JobHistoryRowsDisabled {\n    param (\n        $AgentServer,\n        $minimumJobHistoryRows\n    )\n    $AgentServer.MaximumHistoryRows | Should -Be $minimumJobHistoryRows -Because \"Maximum job history configuration should be disabled\"\n}\n\nfunction Assert-JobHistoryRows {\n    [Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSUseSingularNouns\", \"\")]\n    [CmdletBinding()]\n    param (\n        $AgentServer,\n        $minimumJobHistoryRows\n    )\n    $AgentServer.MaximumHistoryRows | Should -BeGreaterOrEqual $minimumJobHistoryRows -Because \"We expect the maximum job history row configuration to be greater than the configured setting $minimumJobHistoryRows\"\n}\n\nfunction Assert-JobHistoryRowsPerJob {\n    param (\n        $AgentServer,\n        $minimumJobHistoryRowsPerJob\n    )\n    $AgentServer.MaximumJobHistoryRows | Should -BeGreaterOrEqual $minimumJobHistoryRowsPerJob -Because \"We expect the maximum job history row configuration per agent job to be greater than the configured setting $minimumJobHistoryRowsPerJob\"\n}\n\n\nfunction Assert-LongRunningJobs {\n    [Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSUseSingularNouns\", \"\")]\n    [CmdletBinding()]\n    Param($runningjob,$runningjobpercentage)\n    [math]::Round($runningjob.Diff/$runningjob.AvgSec * 100) | Should -BeLessThan $runningjobpercentage -Because \"The current running job $($runningjob.JobName) has been running for $($runningjob.Diff) seconds longer than the average run time. This is more than the $runningjobpercentage % specified as the maximum\"\n}\nfunction Assert-LastJobRun {\n    Param($lastagentjobrun,$runningjobpercentage)\n    [math]::Round($lastagentjobrun.Diff/$lastagentjobrun.AvgSec * 100) | Should -BeLessThan $runningjobpercentage -Because \"The last run of job $($lastagentjobrun.JobName) was $($lastagentjobrun.duration) seconds. This is more than the $runningjobpercentage % specified as the maximum variance\"\n}\n\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUVZqV3+yZ6FjNVJ1E7tFvdy58\n# lIigggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz\n# c3VyZWQgSUQgQ29kZSBTaWduaW5nIENBMB4XDTE3MDUwOTAwMDAwMFoXDTIwMDUx\n# MzEyMDAwMFowVzELMAkGA1UEBhMCVVMxETAPBgNVBAgTCFZpcmdpbmlhMQ8wDQYD\n# VQQHEwZWaWVubmExETAPBgNVBAoTCGRiYXRvb2xzMREwDwYDVQQDEwhkYmF0b29s\n# czCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAI8ng7JxnekL0AO4qQgt\n# Kr6p3q3SNOPh+SUZH+SyY8EA2I3wR7BMoT7rnZNolTwGjUXn7bRC6vISWg16N202\n# 1RBWdTGW2rVPBVLF4HA46jle4hcpEVquXdj3yGYa99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BMGA1UEChMM\n# RGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQD\n# EyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgQ29kZSBTaWduaW5nIENBAhACwXUo\n# dNXChDGFKtigZGnKMAkGBSsOAwIaBQCgeDAYBgorBgEEAYI3AgEMMQowCKACgACh\n# AoAAMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcCAQsxDjAM\n# BgorBgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBRoWuosjY1u/VfrwujfwyttmErx\n# OjANBgkqhkiG9w0BAQEFAASCAQBfgfUgzByfZTVJ3/JPq9O9sH0758DCD4s3Q+Ly\n# Y0ODtMT7nXi8UiHfKerKIL8RAGtrB++u3EDU2r7bNnfB0MVE9qhTZRYs78xAMx55\n# 4v79veO1cA4FZl5ZZOMegzxly/jl5XxVpqH/aaplblszPSi6CMIj1bkuoscvDhSD\n# qnTVDNhcaJVFoDuYlNKHTXFT11zjpingAruD5Xe7I9bsIS+IyoxWi3loUGLlcxoq\n# EADepMg8uyzm7u9rebPr4GiQ0dTsrF0vWSf9/O4PsZ0lOPswflZXZ9M1DUdfth0A\n# YUrxnWePqL3uc/ICL5PXcMKpSAbRJghtQMT6AnCth6ekbyiu\n# SIG # End signature block\n"
  },
  {
    "path": "source/internal/assertions/Database.Assertions.ps1",
    "content": "function Get-Database {\n    Param(\n        [string]$Instance,\n        [string[]]$ExcludedDbs,\n        [string[]]$Database,\n        [ValidateSet('Name')]\n        [string]$Requiredinfo,\n        [ValidateSet('NotAccessible')]\n        [string]$Exclusions\n    )\n\n    switch ($Exclusions) {\n        NotAccessible { $dbs = (Connect-DbaInstance -SqlInstance $Instance).Databases.Where{$(if($database){$PsItem.Name -in $Database}else{$ExcludedDbs -notcontains $PsItem.Name}) -and $psitem.IsAccessible -eq $true} }\n        Default {\n            $dbs = (Connect-DbaInstance -SqlInstance $Instance).Databases.Where{$(if($database){$PsItem.Name -in $Database}else{$ExcludedDbs -notcontains $PsItem.Name})}\n        }\n    }\n    switch ($Requiredinfo) {\n        Name { $dbs.Name}\n        Default {}\n    }\n}\nfunction Assert-DatabaseMaxDop {\n    Param(\n        [pscustomobject]$MaxDop,\n        [int]$MaxDopValue\n    )\n    $MaxDop.DatabaseMaxDop | Should -Be $MaxDopValue -Because \"We expect the Database MaxDop Value to be the specified value $MaxDopValue\"\n}\n\nfunction Assert-DatabaseStatus {\n    Param(\n        [string]$instance,\n        [string[]]$Database,\n        [string[]]$Excludedbs,\n        [string[]]$ExcludeReadOnly,\n        [string[]]$ExcludeOffline,\n        [string[]]$ExcludeRestoring\n    )\n    if($Database){\n        $results = @((Connect-DbaInstance -SqlInstance $Instance).Databases.Where{$psitem.Name -in $Database -and $psitem.Name -notin $Excludedbs} | Select-Object Name, Status, Readonly, IsDatabaseSnapshot)\n    }\n    else{\n    $results = @((Connect-DbaInstance -SqlInstance $Instance).Databases.Where{$psitem.Name -notin $Excludedbs} | Select-Object Name, Status, Readonly, IsDatabaseSnapshot)\n    }\n    $results.Where{$_.Name -notin $ExcludeReadOnly -and $_.IsDatabaseSnapshot -eq $false}.Readonly | Should -Not -Contain True -Because \"We expect that there will be no Read-Only databases except for those specified\"\n    $results.Where{$_.Name -notin $ExcludeOffline}.Status | Should -Not -Match 'Offline' -Because \"We expect that there will be no offline databases except for those specified\"\n    $results.Where{$_.Name -notin $ExcludeRestoring}.Status | Should -Not -Match 'Restoring' -Because \"We expect that there will be no databases in a restoring state except for those specified\"\n    $results.Where{$_.Name -notin $ExcludeOffline}.Status | Should -Not -Match 'AutoClosed' -Because \"We expect that there will be no databases that have been auto closed\"\n    $results.Status | Should -Not -Match 'Recover' -Because \"We expect that there will be no databases going through the recovery process or in a recovery pending state\"\n    $results.Status | Should -Not -Match 'Emergency' -Because \"We expect that there will be no databases in EmergencyMode\"\n    $results.Status | Should -Not -Match 'Standby' -Because \"We expect that there will be no databases in Standby\"\n    $results.Status | Should -Not -Match 'Suspect' -Because \"We expect that there will be no databases in a Suspect state\"\n}\n\nfunction Assert-DatabaseDuplicateIndex {\n    Param(\n        [string]$instance,\n        [string]$Database\n    )\n    @(Find-DbaDbDuplicateIndex -SqlInstance $Instance -Database $Database).Count | Should -Be 0 -Because \"Duplicate indexes waste disk space and cost you extra IO, CPU, and Memory - Use Find-DbaDbDuplicateIndex to find them\"\n}\n\nfunction Assert-DatabaseExists {\n    [Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSUseSingularNouns\", \"\")]\n    [CmdletBinding()]\n    Param (\n        [string]$Instance,\n        [string]$ExpectedDB\n    )\n    $Actual = Get-Database -Instance $instance -Requiredinfo Name\n    $Actual | Should -Contain $expecteddb -Because \"We expect $expecteddb to be on $Instance\"\n}\n\nfunction Assert-GuestUserConnect {\n    Param (\n        [string]$Instance,\n        [string]$Database\n    )\n    $guestperms = Get-DbaUserPermission -SqlInstance $Instance -Database $Database | Where-Object {$_.Grantee -eq \"guest\" -and $_.Permission -eq \"CONNECT\"}\n    $guestperms.Count | Should -Be 0 -Because \"We expect the guest user in $Database on $Instance to not have CONNECT permissions\"\n}\n\nfunction Assert-CLRAssembliesSafe {\n    Param (\n        [string]$Instance,\n        [string]$Database\n    )\n    @(Get-DbaDbAssembly -SqlInstance $Instance -Database $Database | Where-Object {$_.IsSystemObject -eq $false -and $_.SecurityLevel -ne \"Safe\" -and $_.Database -ne \"SSISDB\" -and $_.Name -ne \"ISSERVER\"}).Count | Should -Be 0 -Because \"We expect CLR Assemblies to operate in the SAFE permission set\"\n}\n\nfunction Assert-AsymmetricKeySize {\n    Param (\n        [string]$Instance,\n        [string]$Database\n    )\n    @(Get-DbaDbEncryption -SqlInstance $Instance -Database $Database | Where-Object {$_.Encryption -eq \"Asymmetric Key\" -and $_.KeyLength -LT 2048}).Count | Should -Be 0 -Because \"Asymmetric keys should have a key length greater than or equal to 2048\"\n}\n\nfunction Assert-SymmetricKeyEncryptionLevel {\n    Param (\n        [string]$Instance,\n        [string]$Database\n    )\n    @(Get-DbaDbEncryption -SqlInstance $Instance -Database $Database | Where-Object {$_.Encryption -eq \"Symmetric Key\" -and $_.EncryptionAlgrothim -notin \"AES_128\",\"AES_192\",\"AES_256\"}).Count  | Should -Be 0 -Because \"Symmetric keys should have an encryption algrothim of at least AES_128\"\n}\n\nfunction Assert-QueryStoreEnabled {\n    Param (\n        [string]$Instance,\n        [string]$Database\n    )\n    (Get-DbaDbQueryStoreOption -SqlInstance $Instance -Database $Database).ActualState  | Should -Not -BeIn 'OFF', 'ERROR' -Because \"We expect the Query Store to be enabled in $Database on $Instance\"\n}\nfunction Assert-QueryStoreDisabled {\n    Param (\n        [string]$Instance,\n        [string]$Database\n    )\n    (Get-DbaDbQueryStoreOption -SqlInstance $Instance -Database $Database).ActualState | Should -Be 'OFF' -Because \"We expect the Query Store to be disabled in $Database on $Instance\"\n}\nfunction Assert-ContainedDBSQLAuth {\n    Param (\n        [string]$Instance,\n        [string]$Database\n    )\n    @(Get-DbaDbUser -SQLInstance $Instance -Database $Database | Where-Object {$_.LoginType -eq \"SqlLogin\" -and $_.HasDbAccess -eq $true}).Count | Should -Be 0 -Because \"We expect there to be no sql authenticated users in contained database $Database on $Instance\"\n}\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUWV5eEvZUineXnauPcBDvBW6K\n# wHygggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEa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V/1CKLtRyNRyQvxgrIQlGNe5Ei//V/v44mzD8in3dsL2cGZS\n# SIG # End signature block\n"
  },
  {
    "path": "source/internal/assertions/Instance.Assertions.ps1",
    "content": "<#\nThis file is used to hold the Assertions for the Instance.Tests\n\nWhen adding new checks or improving existing ones -\n\n    - Ensure your branch is up to date with the development branch\n    - In the Instance.Assertions.ps1 - Add a New code block in the switch using the unique tag name\n\n                'MemoryDump' {  # This is the unique tag\n                if ($There) {  ## we need $There to save trying to gather information from later checks for an instance that is not contactable\n                    ## Then a try catch to gather the required information for the assertion and set a variable to a custom object\n                    try {\n                        $MaxDump = [pscustomobject] @{\n                            # Warning Action removes dbatools output for version too low from test results\n                            # Skip on the it will show in the results\n                            Count = (Get-DbaDump -SqlInstance $psitem -WarningAction SilentlyContinue).Count\n                        }\n                    }\n                    # In the catch set There to false and create an object with the same name but an obvious error entry\n                    catch {\n                        $There = $false\n                        $MaxDump = [pscustomobject] @{\n                            Count = 'We Could not Connect to $Instance'\n                        }\n                    }\n                }\n                # the else matches the catch block\n                else {\n                    $There = $false\n                    $MaxDump = [pscustomobject] @{\n                        Count = 'We Could not Connect to $Instance'\n                    }\n                }\n            }\n\n    - Create an Assertion for the Check\n\n    Name must start Assert\n    function Assert-MaxDump {\n        Pass in params for configs\n    Param($AllInstanceInfo,$maxdumps)\n    Ensure Because has good information\n    $AllInstanceInfo.MaxDump.Count | Should -BeLessThan $maxdumps -Because \"We expected less than $maxdumps dumps but found $($AllInstanceInfo.MaxDump.Count). Memory dumps often suggest issues with the SQL Server instance\"\n}\n\n    - In The Instance.Tests.ps1 file create the check\n\n        # Must be in its own describe block, must use an s on Tags, first tag must be unique, last tag must be $filename\n        Describe \"SQL Memory Dumps\" -Tags MemoryDump, Medium, $filename {\n        # Gather any config items here so that the code to match config to check works\n        $maxdumps = Get-DbcConfigValue\tpolicy.dump.maxcount\n        # We check if the instance is contactable at the top of the file, use this block with the context title the same as the proper test below\n        if ($NotContactable -contains $psitem) {\n            Context \"Checking that dumps on $psitem do not exceed $maxdumps for $psitem\" {\n                It \"Can't Connect to $Psitem\" {\n                    $false\t|  Should -BeTrue -Because \"The instance should be available to be connected to!\"\n                }\n            }\n        }\n        else {\n            # The title must end $psitem\n            Context \"Checking that dumps on $psitem do not exceed $maxdumps for $psitem\" {\n                # The check itself - a skip can be added from a config value if required -Skip:$Skip or per version\n                It \"dump count of $count is less than or equal to the $maxdumps dumps on $psitem\" -Skip:($InstanceSMO.Version.Major -lt 10 ) {\n                    # Call the assertion with any parameters here\n                    Assert-MaxDump -AllInstanceInfo $AllInstanceInfo -maxdumps $maxdumps\n                }\n            }\n        }\n    }\n\n    - In the tests\\checks\\InstanceChecks.Tests.ps1 file add tests for the assertions by mocking passing and failing tests following the code in the file\n    - In a NEW session - checkout your branch of dbachecks\n        cd to the root of the repo\n        import the module with\n            ipmo .\\dbachecks.psd1\n        Run the Pester tests\n\n        Invoke-Pester .\\tests\\ -ExcludeTag Integration -Show Fails\n\nIt starts with the Get-AllInstanceInfo which uses all of the unique\n tags that have been passed and gathers the required information\n which can then be used for the assertions.\n\n The long term aim is to make Get-AllInstanceInfo as performant as\n possible and to cover all of the tests\n#>\n\nfunction Get-AllInstanceInfo {\n    # Using the unique tags gather the information required\n    Param($Instance, $Tags, $There)\n    # Using there so that if the instance is not contactable, no point carrying on with gathering more information\n    switch ($tags) {\n        'ErrorLog' {\n            if ($There) {\n                try {\n                    $logWindow = Get-DbcConfigValue -Name policy.errorlog.warningwindow\n                    # so that it can be mocked\n                    function Get-ErrorLogEntry {\n                        # get the number of the first error log that was created after the log window config\n                        $OldestErrorLogNumber = ($InstanceSMO.EnumErrorLogs() | Where-Object { $psitem.CreateDate -gt (Get-Date).AddDays( - $LogWindow) } | Sort-Object ArchiveNo -Descending | Select-Object -First 1).ArchiveNo + 1\n                        # Get the Error Log entries for each one\n                        (0..$OldestErrorLogNumber).ForEach{\n                            $InstanceSMO.ReadErrorLog($psitem).Where{ $_.Text -match \"Severity: 1[7-9]|Severity: 2[0-4]\" }\n                        }\n                    }\n                    # It is not enough to check the CreateDate on the log, you must check the LogDate on every error record as well.\n                    $ErrorLog = @(Get-ErrorLogEntry).ForEach{\n                        [PSCustomObject]@{\n                            LogDate     = $psitem.LogDate\n                            ProcessInfo = $Psitem.ProcessInfo\n                            Text        = $Psitem.Text\n                        } | Where-Object { $psitem.LogDate -gt (Get-Date).AddDays( - $LogWindow) }\n                    }\n                } catch {\n                    $There = $false\n                    $ErrorLog = [PSCustomObject]@{\n                        LogDate      = 'Do not know the Date'\n                        ProcessInfo  = 'Do not know the Process'\n                        Text         = 'Do not know the Test'\n                        InstanceName = 'An Error occurred ' + $Instance\n                    }\n                }\n            } else {\n                $There = $false\n                $ErrorLog = [PSCustomObject]@{\n                    LogDate      = 'Do not know the Date'\n                    ProcessInfo  = 'Do not know the Process'\n                    Text         = 'Do not know the Test'\n                    InstanceName = 'An Error occurred ' + $Instance\n                }\n            }\n        }\n        'DefaultTrace' {\n            if ($There) {\n                try {\n                    $SpConfig = Get-DbaSpConfigure -SqlInstance $Instance -ConfigName 'DefaultTraceEnabled'\n                    $DefaultTrace = [pscustomobject] @{\n                        ConfiguredValue = $SpConfig.ConfiguredValue\n                    }\n                } catch {\n                    $There = $false\n                    $DefaultTrace = [pscustomobject] @{\n                        ConfiguredValue = 'We Could not Connect to $Instance'\n                    }\n                }\n            } else {\n                $There = $false\n                $DefaultTrace = [pscustomobject] @{\n                    ConfiguredValue = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n\n        'OleAutomationProceduresDisabled' {\n            if ($There) {\n                try {\n                    $SpConfig = Get-DbaSpConfigure -SqlInstance $Instance -ConfigName 'OleAutomationProceduresEnabled'\n                    $OleAutomationProceduresDisabled = [pscustomobject] @{\n                        ConfiguredValue = $SpConfig.ConfiguredValue\n                    }\n                } catch {\n                    $There = $false\n                    $OleAutomationProceduresDisabled = [pscustomobject] @{\n                        ConfiguredValue = 'We Could not Connect to $Instance'\n                    }\n                }\n            } else {\n                $There = $false\n                $OleAutomationProceduresDisabled = [pscustomobject] @{\n                    ConfiguredValue = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n\n        'CrossDBOwnershipChaining' {\n            if ($There) {\n                try {\n                    $SpConfig = Get-DbaSpConfigure -SqlInstance $Instance -ConfigName 'CrossDBOwnershipChaining'\n                    $CrossDBOwnershipChaining = [pscustomobject] @{\n                        ConfiguredValue = $SpConfig.ConfiguredValue\n                    }\n                } catch {\n                    $There = $false\n                    $CrossDBOwnershipChaining = [pscustomobject] @{\n                        ConfiguredValue = 'We Could not Connect to $Instance'\n                    }\n                }\n            } else {\n                $There = $false\n                $CrossDBOwnershipChaining = [pscustomobject] @{\n                    ConfiguredValue = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n\n        'ScanForStartupProceduresDisabled' {\n            if ($There) {\n                try {\n                    $SpConfig = Get-DbaSpConfigure -SqlInstance $Instance -ConfigName 'ScanForStartupProcedures'\n\n                    $query = \"\n                        SELECT name\n                        FROM sys.procedures\n                        WHERE OBJECTPROPERTY(OBJECT_ID, 'ExecIsStartup') = 1\n                            AND name <> 'sp_MSrepl_startup'\"\n                    $results = Invoke-DbaQuery -SqlInstance $Instance -Query $query\n\n                    if ($null -eq $results) {\n                        $Value = 0\n                    } else {\n                        $Value = $SpConfig.ConfiguredValue\n                    }\n\n                    $ScanForStartupProceduresDisabled = [pscustomobject] @{\n                        ConfiguredValue = $Value\n                    }\n                } catch {\n                    $There = $false\n                    $ScanForStartupProceduresDisabled = [pscustomobject] @{\n                        ConfiguredValue = 'We Could not Connect to $Instance'\n                    }\n                }\n            } else {\n                $There = $false\n                $ScanForStartupProceduresDisabled = [pscustomobject] @{\n                    ConfiguredValue = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n        'MemoryDump' {\n            if ($There) {\n                try {\n                    $daystocheck = Get-DbcConfigValue policy.instance.memorydumpsdaystocheck\n                    if ($null -eq $daystocheck) {\n                        $datetocheckfrom = '0001-01-01'\n                    } else {\n                        $datetocheckfrom = (Get-Date).ToUniversalTime().AddDays( - $daystocheck )\n                    }\n                    $MaxDump = [pscustomobject] @{\n                        # Warning Action removes dbatools output for version too low from test results\n                        # Skip on the it will show in the results\n                        Count = (@(Get-DbaDump -SqlInstance $Instance -WarningAction SilentlyContinue).Where{ $_.CreationTime -gt $datetocheckfrom }).Count\n                    }\n                } catch {\n                    $There = $false\n                    $MaxDump = [pscustomobject] @{\n                        Count = 'We Could not Connect to $Instance'\n                    }\n                }\n            } else {\n                $There = $false\n                $MaxDump = [pscustomobject] @{\n                    Count = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n\n        'RemoteAccessDisabled' {\n            if ($There) {\n                try {\n                    $SpConfig = Get-DbaSpConfigure -SqlInstance $Instance -ConfigName 'RemoteAccess'\n                    $RemoteAccessDisabled = [pscustomobject] @{\n                        ConfiguredValue = $SpConfig.ConfiguredValue\n                    }\n                } catch {\n                    $There = $false\n                    $RemoteAccessDisabled = [pscustomobject] @{\n                        ConfiguredValue = 'We Could not Connect to $Instance'\n                    }\n                }\n            } else {\n                $There = $false\n                $RemoteAccessDisabled = [pscustomobject] @{\n                    ConfiguredValue = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n\n        'LatestBuild' {\n            if ($There) {\n                try {\n                    $results = Test-DbaBuild -SqlInstance $Instance -Latest\n                    $LatestBuild = [pscustomobject] @{\n                        Compliant = $results.Compliant\n                    }\n                } catch {\n                    $There = $false\n                    $LatestBuild = [pscustomobject] @{\n                        Compliant = 'We Could not Connect to $Instance'\n                    }\n                }\n            } else {\n                $There = $false\n                $LatestBuild = [pscustomobject] @{\n                    Compliant = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n        'SaDisabled' {\n            if ($There) {\n                try {\n                    #This needs to be done in query just in case the account had already been renamed\n                    $login = Get-DbaLogin -SqlInstance $Instance | Where-Object Id -EQ 1\n                    $SaDisabled = [pscustomobject] @{\n                        Disabled = $login.IsDisabled\n                    }\n                } catch {\n                    $There = $false\n                    $SaDisabled = [pscustomobject] @{\n                        Disabled = 'We Could not Connect to $Instance'\n                    }\n                }\n            } else {\n                $There = $false\n                $SaDisabled = [pscustomobject] @{\n                    Disabled = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n        'SaExist' {\n            if ($There) {\n                try {\n                    $SaExist = [pscustomobject] @{\n                        Exist = @(Get-DbaLogin -SqlInstance $Instance -Login sa).Count\n                    }\n                } catch {\n                    $There = $false\n                    $SaExist = [pscustomobject] @{\n                        Exist = 'We Could not Connect to $Instance'\n                    }\n                }\n            } else {\n                $There = $false\n                $SaExist = [pscustomobject] @{\n                    Exist = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n        'SqlEngineServiceAccount' {\n            if ($There) {\n                try {\n                    $ComputerName , $InstanceName = $Instance.Name.Split('\\')\n                    if ($null -eq $InstanceName) {\n                        $InstanceName = 'MSSQLSERVER'\n                    }\n                    $SqlEngineService = Get-DbaService -ComputerName $ComputerName -InstanceName $instanceName -Type Engine -ErrorAction SilentlyContinue\n                    $EngineService = [pscustomobject] @{\n                        State     = $SqlEngineService.State\n                        StartType = $SqlEngineService.StartMode\n                    }\n                } catch {\n                    $There = $false\n                    $EngineService = [pscustomobject] @{\n                        State     = 'We Could not Connect to $Instance $ComputerName , $InstanceName from catch'\n                        StartType = 'We Could not Connect to $Instance $ComputerName , $InstanceName from catch'\n                    }\n                }\n            } else {\n                $There = $false\n                $EngineService = [pscustomobject] @{\n                    State     = 'We Could not Connect to $Instance'\n                    StartType = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n        'PublicRolePermission' {\n            if ($There) {\n                try {\n                    #This needs to be done in query just in case the account had already been renamed\n                    $query = \"\n                        SELECT Count(*) AS [RowCount]\n                        FROM master.sys.server_permissions\n                        WHERE (grantee_principal_id = SUSER_SID(N'public') and state_desc LIKE 'GRANT%')\n                            AND NOT (state_desc = 'GRANT' and [permission_name] = 'VIEW ANY DATABASE' and class_desc = 'SERVER')\n                            AND NOT (state_desc = 'GRANT' and [permission_name] = 'CONNECT' and class_desc = 'ENDPOINT' and major_id = 2)\n                            AND NOT (state_desc = 'GRANT' and [permission_name] = 'CONNECT' and class_desc = 'ENDPOINT' and major_id = 3)\n                            AND NOT (state_desc = 'GRANT' and [permission_name] = 'CONNECT' and class_desc = 'ENDPOINT' and major_id = 4)\n                            AND NOT (state_desc = 'GRANT' and [permission_name] = 'CONNECT' and class_desc = 'ENDPOINT' and major_id = 5);\n                        \"\n                    $results = Invoke-DbaQuery -SqlInstance $Instance -Query $query\n\n                    $PublicRolePermission = [pscustomobject] @{\n                        Count = $results.RowCount\n                    }\n                } catch {\n                    $There = $false\n                    $PublicRolePermission = [pscustomobject] @{\n                        Count = 'We Could not Connect to $Instance'\n                    }\n                }\n            } else {\n                $There = $false\n                $PublicRolePermission = [pscustomobject] @{\n                    Count = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n        'BuiltInAdmin' {\n            if ($There) {\n                try {\n                    $BuiltInAdmin = [pscustomobject] @{\n                        Exist = @(Get-DbaLogin -SqlInstance $Instance -Login \"BUILTIN\\Administrators\").Count\n                    }\n                } catch {\n                    $There = $false\n                    $BuiltInAdmin = [pscustomobject] @{\n                        Exist = 'We Could not Connect to $Instance'\n                    }\n                }\n            } else {\n                $There = $false\n                $BuiltInAdmin = [pscustomobject] @{\n                    Exist = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n        'LocalWindowsGroup' {\n            if ($There) {\n                try {\n                    $ComputerName, $InstanceName = $Instance.Name.Split('\\')\n                    if ($null -eq $InstanceName) {\n                        $InstanceName = 'MSSQLSERVER'\n                    }\n                    $logins = Get-DbaLogin -SqlInstance $Instance | Where-Object { $_.LoginType -eq 'WindowsGroup' -and $_.Name.Split('\\') -eq $ComputerName }\n                    if ($null -ne $logins) {\n                        $LocalWindowsGroup = [pscustomobject] @{\n                            Exist = $true\n                        }\n                    } else {\n                        $LocalWindowsGroup = [pscustomobject] @{\n                            Exist = $false\n                        }\n                    }\n                } catch {\n                    $There = $false\n                    $LocalWindowsGroup = [pscustomobject] @{\n                        Exist = 'We Could not Connect to $Instance'\n                    }\n                }\n            } else {\n                $There = $false\n                $LocalWindowsGroup = [pscustomobject] @{\n                    Exist = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n        'LoginAuditFailed' {\n            if ($There) {\n                try {\n                    $results = Get-DbaInstanceProperty -SqlInstance $instance -InstanceProperty AuditLevel\n                    $LoginAuditFailed = [pscustomobject] @{\n                        AuditLevel = $results.Value\n                    }\n                } catch {\n                    $There = $false\n                    $LoginAuditFailed = [pscustomobject] @{\n                        AuditLevel = 'We Could not Connect to $Instance'\n                    }\n                }\n            } else {\n                $There = $false\n                $LoginAuditFailed = [pscustomobject] @{\n                    AuditLevel = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n\n        'LoginAuditSuccessful' {\n            if ($There) {\n                try {\n                    $results = Get-DbaInstanceProperty -SqlInstance $instance -InstanceProperty AuditLevel\n                    $LoginAuditSuccessful = [pscustomobject] @{\n                        AuditLevel = $results.Value\n                    }\n                } catch {\n                    $There = $false\n                    $LoginAuditSuccessful = [pscustomobject] @{\n                        AuditLevel = 'We Could not Connect to $Instance'\n                    }\n                }\n            } else {\n                $There = $false\n                $LoginAuditSuccessful = [pscustomobject] @{\n                    AuditLevel = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n\n        'SqlAgentProxiesNoPublicRole' {\n            if ($There) {\n                try {\n                    $SqlAgentProxiesWithPublicRole = @()\n\n                    Get-DbaAgentProxy -SqlInstance $Instance | ForEach-Object {\n                        if ($psitem.EnumMsdbRoles().Name -contains 'public') {\n                            $SqlAgentProxyWithPublicRole = [pscustomobject] @{\n                                Name               = $psitem.Name\n                                CredentialName     = $psitem.CredentialName\n                                CredentialIdentity = $psitem.CredentialIdentity\n                            }\n                            $SqlAgentProxiesWithPublicRole += $SqlAgentProxyWithPublicRole\n                        }\n                    }\n                } catch {\n                    $There = $false\n                    $SqlAgentProxiesWithPublicRole = [pscustomobject] @{\n                        Name               = 'We Could not Connect to $Instance'\n                        CredentialName     = $null\n                        CredentialIdentity = $null\n                    }\n                }\n            } else {\n                $There = $false\n                $SqlAgentProxiesWithPublicRole = [pscustomobject] @{\n                    Name               = 'We Could not Connect to $Instance'\n                    CredentialName     = $null\n                    CredentialIdentity = $null\n                }\n            }\n        }\n        'HideInstance' {\n            if ($There) {\n                try {\n                    $results = Get-DbaHideInstance -SqlInstance $Instance\n\n                    $HideInstance = [pscustomobject] @{\n                        HideInstance = $results.HideInstance\n                    }\n                } catch {\n                    $There = $false\n                    $HideInstance = [pscustomobject] @{\n                        HideInstance = 'We Could not Connect to $Instance'\n                    }\n                }\n            } else {\n                $There = $false\n                $HideInstance = [pscustomobject] @{\n                    HideInstance = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n\n        'EngineServiceAdmin' {\n            if ($There) {\n                if ($IsLinux) {\n                    $EngineServiceAdmin = [pscustomobject] @{\n                        Exist = 'We Cant Check running on Linux'\n                    }\n                } else {\n                    try {\n                        $ComputerName , $InstanceName = $Instance.Name.Split('\\')\n                        if ($null -eq $InstanceName) {\n                            $InstanceName = 'MSSQLSERVER'\n                        }\n                        $SqlEngineService = Get-DbaService -ComputerName $ComputerName -InstanceName $instanceName -Type Engine -ErrorAction SilentlyContinue\n                        $LocalAdmins = Invoke-Command -ComputerName $ComputerName -ScriptBlock { Get-LocalGroupMember -Group \"Administrators\" } -ErrorAction SilentlyContinue\n\n                        $EngineServiceAdmin = [pscustomobject] @{\n                            Exist = $localAdmins.Name.Contains($SqlEngineService.StartName)\n                        }\n                    } catch [System.Exception] {\n                        if ($_.Exception.Message -like '*No services found in relevant namespaces*') {\n                            $EngineServiceAdmin = [pscustomobject] @{\n                                Exist = $false\n                            }\n                        } else {\n                            $EngineServiceAdmin = [pscustomobject] @{\n                                Exist = 'Some sort of failure'\n                            }\n                        }\n                    } catch {\n                        $There = $false\n                        $EngineServiceAdmin = [pscustomobject] @{\n                            Exist = 'We Could not Connect to $Instance $ComputerName , $InstanceName from catch'\n                        }\n                    }\n                }\n            } else {\n                $There = $false\n                $EngineServiceAdmin = [pscustomobject] @{\n                    Exist = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n\n        'AgentServiceAdmin' {\n            if ($There) {\n                if ($IsLinux) {\n                    $AgentServiceAdmin = [pscustomobject] @{\n                        Exist = 'We Cant Check running on Linux'\n                    }\n                } else {\n                    try {\n                        $ComputerName , $InstanceName = $Instance.Name.Split('\\')\n                        if ($null -eq $InstanceName) {\n                            $InstanceName = 'MSSQLSERVER'\n                        }\n                        $SqlAgentService = Get-DbaService -ComputerName $ComputerName -InstanceName $instanceName -Type Agent -ErrorAction SilentlyContinue\n                        $LocalAdmins = Invoke-Command -ComputerName $ComputerName -ScriptBlock { Get-LocalGroupMember -Group \"Administrators\" } -ErrorAction SilentlyContinue\n\n                        $AgentServiceAdmin = [pscustomobject] @{\n                            Exist = $localAdmins.Name.Contains($SqlAgentService.StartName)\n                        }\n                    } catch [System.Exception] {\n                        if ($_.Exception.Message -like '*No services found in relevant namespaces*') {\n                            $AgentServiceAdmin = [pscustomobject] @{\n                                Exist = $false\n                            }\n                        } else {\n                            $AgentServiceAdmin = [pscustomobject] @{\n                                Exist = 'Some sort of failure'\n                            }\n                        }\n                    } catch {\n                        $There = $false\n                        $AgentServiceAdmin = [pscustomobject] @{\n                            Exist = 'We Could not Connect to $Instance $ComputerName , $InstanceName from catch'\n                        }\n                    }\n                }\n            } else {\n                $There = $false\n                $AgentServiceAdmin = [pscustomobject] @{\n                    Exist = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n\n        'FullTextServiceAdmin' {\n            if ($There) {\n                if ($IsLinux) {\n                    $FullTextServiceAdmin = [pscustomobject] @{\n                        Exist = 'We Cant Check running on Linux'\n                    }\n                } else {\n                    try {\n                        $ComputerName , $InstanceName = $Instance.Name.Split('\\')\n                        if ($null -eq $InstanceName) {\n                            $InstanceName = 'MSSQLSERVER'\n                        }\n                        $SqlFullTextService = Get-DbaService -ComputerName $ComputerName -InstanceName $instanceName -Type FullText -ErrorAction SilentlyContinue -WarningAction SilentlyContinue -WarningVariable WarVar\n                        $LocalAdmins = Invoke-Command -ComputerName $ComputerName -ScriptBlock { Get-LocalGroupMember -Group \"Administrators\" } -ErrorAction SilentlyContinue\n                        $FullTextServiceAdmin = [pscustomobject] @{\n                            Exist = $localAdmins.Name.Contains($SqlFullTextService.StartName)\n                        }\n                    } catch [System.Exception] {\n                        if ($_.Exception.Message -like '*No services found in relevant namespaces*') {\n                            $FullTextServiceAdmin = [pscustomobject] @{\n                                Exist = $false\n                            }\n                        } else {\n                            $FullTextServiceAdmin = [pscustomobject] @{\n                                Exist = 'Some sort of failure'\n                            }\n                        }\n                    } catch {\n                        $There = $false\n                        $FullTextServiceAdmin = [pscustomobject] @{\n                            Exist = \"We Could not Connect to $Instance $ComputerName , $InstanceName from catch\"\n                        }\n                    }\n                }\n\n            } else {\n                $There = $false\n                $FullTextServiceAdmin = [pscustomobject] @{\n                    Exist = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n\n        'LoginCheckPolicy' {\n            if ($There) {\n                try {\n                    $LoginCheckPolicy = [pscustomobject] @{\n                        Count = @(Get-DbaLogin -SqlInstance $instance -Type SQL | Where-Object { $_.PasswordPolicyEnforced -eq $false -and $_.IsDisabled -eq $false }).Count\n                    }\n                } catch {\n                    $There = $false\n                    $LoginCheckPolicy = [pscustomobject] @{\n                        Count = 'We Could not Connect to $Instance'\n                    }\n                }\n            } else {\n                $There = $false\n                $LoginCheckPolicy = [pscustomobject] @{\n                    Count = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n\n        'LoginPasswordExpiration' {\n            if ($There) {\n                try {\n                    $role = Get-DbaServerRole -SqlInstance $instance -ServerRole \"sysadmin\"\n\n                    $LoginPasswordExpiration = [pscustomobject] @{\n                        Count = @(Get-DbaLogin -SqlInstance $instance -Login @($role.Login) -Type SQL | Where-Object { $_.PasswordExpirationEnabled -eq $false -and $_.IsDisabled -eq $false }).Count\n                    }\n                } catch {\n                    $There = $false\n                    $LoginPasswordExpiration = [pscustomobject] @{\n                        Count = 'We Could not Connect to $Instance'\n                    }\n                }\n            } else {\n                $There = $false\n                $LoginPasswordExpiration = [pscustomobject] @{\n                    Count = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n        'LoginMustChange' {\n            if ($There) {\n                try {\n                    $role = Get-DbaServerRole -SqlInstance $instance -ServerRole \"sysadmin\"\n\n                    $LoginMustChange = [pscustomobject] @{\n                        Count = @(Get-DbaLogin -SqlInstance $instance -Login @($role.Login) -Type SQL | Where-Object { $_.MustChangePassword -eq $false -and $_.IsDisabled -eq $false -and $null -eq $_.LastLogin }).Count\n                    }\n                } catch {\n                    $There = $false\n                    $LoginMustChange = [pscustomobject] @{\n                        Count = 'We Could not Connect to $Instance'\n                    }\n                }\n            } else {\n                $There = $false\n                $LoginMustChange = [pscustomobject] @{\n                    Count = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n\n        'SQLMailXPsDisabled' {\n            if ($There) {\n                try {\n                    $SpConfig = Get-DbaSpConfigure -SqlInstance $Instance -ConfigName 'SqlMailXPsEnabled'\n                    $SQLMailXPsDisabled = [pscustomobject] @{\n                        ConfiguredValue = $SpConfig.ConfiguredValue\n                    }\n                } catch {\n                    $There = $false\n                    $SQLMailXPsDisabled = [pscustomobject] @{\n                        ConfiguredValue = 'We Could not Connect to $Instance'\n                    }\n                }\n            } else {\n                $There = $false\n                $SQLMailXPsDisabled = [pscustomobject] @{\n                    ConfiguredValue = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n\n        Default { }\n    }\n    [PSCustomObject]@{\n        ErrorLog                         = $ErrorLog\n        DefaultTrace                     = $DefaultTrace\n        MaxDump                          = $MaxDump\n        CrossDBOwnershipChaining         = $CrossDBOwnershipChaining\n        ScanForStartupProceduresDisabled = $ScanForStartupProceduresDisabled\n        RemoteAccess                     = $RemoteAccessDisabled\n        OleAutomationProceduresDisabled  = $OleAutomationProceduresDisabled\n        LatestBuild                      = $LatestBuild\n        SaExist                          = $SaExist\n        SaDisabled                       = $SaDisabled\n        EngineService                    = $EngineService\n        SqlAgentProxiesWithPublicRole    = $SqlAgentProxiesWithPublicRole\n        HideInstance                     = $HideInstance\n        LoginAuditFailed                 = $LoginAuditFailed\n        LoginAuditSuccessful             = $LoginAuditSuccessful\n        EngineServiceAdmin               = $EngineServiceAdmin\n        AgentServiceAdmin                = $AgentServiceAdmin\n        FullTextServiceAdmin             = $FullTextServiceAdmin\n        LocalWindowsGroup                = $LocalWindowsGroup\n        BuiltInAdmin                     = $BuiltInAdmin\n        PublicRolePermission             = $PublicRolePermission\n        LoginCheckPolicy                 = $LoginCheckPolicy\n        LoginPasswordExpiration          = $LoginPasswordExpiration\n        LoginMustChange                  = $LoginMustChange\n        SQLMailXPsDisabled               = $SQLMailXPsDisabled\n    }\n}\n\nfunction Assert-DefaultTrace {\n    Param($AllInstanceInfo)\n    $AllInstanceInfo.DefaultTrace.ConfiguredValue | Should -Be 1 -Because \"We expected the Default Trace to be enabled\"\n}\nfunction Assert-EngineState {\n    Param($AllInstanceInfo, $state)\n    $AllInstanceInfo.EngineService.State | Should -Be $state -Because \"The SQL Service was expected to be $state\"\n}\nfunction Assert-EngineStartType {\n    Param($AllInstanceInfo, $starttype)\n    $AllInstanceInfo.EngineService.StartType | Should -Be $starttype -Because \"The SQL Service Start Type was expected to be $starttype\"\n}\nfunction Assert-EngineStartTypeCluster {\n    Param($AllInstanceInfo)\n    $AllInstanceInfo.EngineService.StartType | Should -Be \"Manual\" -Because 'Clustered Instances required that the SQL engine service is set to manual'\n}\n\nfunction Assert-OleAutomationProcedures {\n    [Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSUseSingularNouns\", \"\")]\n    [CmdletBinding()]\n    Param($AllInstanceInfo)\n    $AllInstanceInfo.OleAutomationProceduresDisabled.ConfiguredValue | Should -Be 0 -Because \"We expect the OLE Automation Procedures to be disabled\"\n}\nfunction Assert-ScanForStartupProcedures {\n    [Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSUseSingularNouns\", \"\")]\n    [CmdletBinding()]\n    param ($AllInstanceInfo, $ScanForStartupProcsDisabled)\n    ($AllInstanceInfo.ScanForStartupProceduresDisabled.ConfiguredValue -eq 0) | Should -Be $ScanForStartupProcsDisabled -Because \"We expected the scan for startup procedures to be configured correctly\"\n}\nfunction Assert-MaxDump {\n    Param($AllInstanceInfo, $maxdumps)\n    $AllInstanceInfo.MaxDump.Count | Should -BeLessThan $maxdumps -Because \"We expected less than $maxdumps dumps but found $($AllInstanceInfo.MaxDump.Count). Memory dumps often suggest issues with the SQL Server instance\"\n}\n\nfunction Assert-RemoteAccess {\n    param ($AllInstanceInfo)\n    $AllInstanceInfo.RemoteAccess.ConfiguredValue | Should -Be 0 -Because \"We expected Remote Access to be disabled\"\n}\n\nfunction Assert-InstanceMaxDop {\n    Param(\n        [string]$Instance,\n        [switch]$UseRecommended,\n        [int]$MaxDopValue\n    )\n    $MaxDop = @(Test-DbaMaxDop -SqlInstance $Instance)[0]\n    if ($UseRecommended) {\n        #if UseRecommended - check that the CurrentInstanceMaxDop property returned from Test-DbaMaxDop matches the the RecommendedMaxDop property\n        $MaxDop.CurrentInstanceMaxDop | Should -Be $MaxDop.RecommendedMaxDop -Because \"We expect the MaxDop Setting to be the recommended value $($MaxDop.RecommendedMaxDop)\"\n    } else {\n        #if not UseRecommended - check that the CurrentInstanceMaxDop property returned from Test-DbaMaxDop matches the MaxDopValue parameter\n        $MaxDop.CurrentInstanceMaxDop | Should -Be $MaxDopValue -Because \"We expect the MaxDop Setting to be $MaxDopValue\"\n    }\n}\n\nfunction Assert-BackupCompression {\n    Param($Instance, $defaultbackupcompression)\n    (Get-DbaSpConfigure -SqlInstance $Instance -ConfigName 'DefaultBackupCompression').ConfiguredValue -eq 1 | Should -Be $defaultbackupcompression -Because 'The default backup compression should be set correctly'\n}\n\nfunction Assert-TempDBSize {\n    Param($Instance)\n\n    @((Get-DbaDbFile -SqlInstance $Instance -Database tempdb).Where{ $_.Type -eq 0 }.Size.Megabyte | Select-Object -Unique).Count | Should -Be 1 -Because \"We want all the tempdb data files to be the same size - See https://blogs.sentryone.com/aaronbertrand/sql-server-2016-tempdb-fixes/ and https://www.brentozar.com/blitz/tempdb-data-files/ for more information\"\n}\n\nfunction Assert-InstanceSupportedBuild {\n    Param(\n        [string]$Instance,\n        [int]$BuildWarning,\n        [string]$BuildBehind,\n        [DateTime]$Date\n    )\n    #If $BuildBehind check against SP/CU parameter to determine validity of the build\n    if ($BuildBehind) {\n        $results = Test-DbaBuild -SqlInstance $Instance -SqlCredential $sqlcredential -MaxBehind $BuildBehind\n        $Compliant = $results.Compliant\n        $Build = $results.build\n        $Compliant | Should -Be $true -Because \"this build $Build should not be behind the required build\"\n        #If no $BuildBehind only check against support dates\n    } else {\n        $Results = Test-DbaBuild -SqlInstance $Instance -SqlCredential $sqlcredential -Latest\n        [DateTime]$SupportedUntil = Get-Date $results.SupportedUntil -Format O\n        $Build = $results.build\n        #If $BuildWarning, check for support date within the warning window\n        if ($BuildWarning) {\n            [DateTime]$expected = Get-Date ($Date).AddMonths($BuildWarning) -Format O\n            $SupportedUntil | Should -BeGreaterThan $expected -Because \"this build $Build will be unsupported by Microsoft on $(Get-Date $SupportedUntil -Format O) which is less than $BuildWarning months away\"\n        }\n        #If neither, check for Microsoft support date\n        else {\n            $SupportedUntil | Should -BeGreaterThan $Date -Because \"this build $Build is now unsupported by Microsoft\"\n        }\n    }\n}\n\nfunction Assert-TwoDigitYearCutoff {\n    Param(\n        [string]$Instance,\n        [int]$TwoDigitYearCutoff\n    )\n    (Get-DbaSpConfigure -SqlInstance $Instance -ConfigName 'TwoDigitYearCutoff').ConfiguredValue | Should -Be $TwoDigitYearCutoff -Because 'This is the value that you have chosen for Two Digit Year Cutoff configuration'\n}\n\nfunction Assert-TraceFlag {\n    Param(\n        $ActualTraceflags,\n        [int[]]$ExpectedTraceFlag\n    )\n\n    if ($ExpectedTraceFlag -ne 0) {\n        $ExpectedTraceFlag | Should -BeIn $ActualTraceflags -Because \"We expect that Trace Flag $ExpectedTraceFlag will be set\"\n    } else {\n        $ActualTraceflags | Should -BeNullOrEmpty -Because \"We expect that there will be no Trace Flags set\"\n    }\n}\nfunction Assert-NotTraceFlag {\n    [CmdletBinding()]\n    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', 'ExpectedTraceFlag')]\n    Param(\n        [string]$SQLInstance,\n        [int[]]$NotExpectedTraceFlag,\n        [int[]]$ExpectedTraceFlag\n    )\n\n    if ($null -eq $NotExpectedTraceFlag) {\n        (@(Get-DbaTraceFlag -SqlInstance $SQLInstance).Where{ $_.TraceFlag -notin $ExpectedTraceFlag } | Select-Object).TraceFlag | Should -BeNullOrEmpty -Because \"We expect that there will be no Trace Flags set on $SQLInstance\"\n    } else {\n        @($NotExpectedTraceFlag).ForEach{\n            (Get-DbaTraceFlag -SqlInstance $SQLInstance).TraceFlag | Should -Not -Contain $PSItem -Because \"We expect that Trace Flag $PsItem will not be set on $SQLInstance\"\n        }\n    }\n}\n\nfunction Assert-CLREnabled {\n    param (\n        $SQLInstance,\n        $CLREnabled\n    )\n\n    (Get-DbaSpConfigure -SqlInstance $SQLInstance -Name IsSqlClrEnabled).ConfiguredValue -eq 1 | Should -Be $CLREnabled -Because 'The CLR Enabled should be set correctly'\n}\n\nfunction Assert-CrossDBOwnershipChaining {\n    Param($AllInstanceInfo)\n    $AllInstanceInfo.CrossDBOwnershipChaining.ConfiguredValue | Should -Be 0 -Because \"We expected the Cross DB Ownership Chaining to be disabled\"\n}\n\nfunction Assert-AdHocDistributedQueriesEnabled {\n    param (\n        $SQLInstance,\n        $AdHocDistributedQueriesEnabled\n    )\n    (Get-DbaSpConfigure -SqlInstance $SQLInstance -Name AdHocDistributedQueriesEnabled).ConfiguredValue -eq 1 | Should -Be $AdHocDistributedQueriesEnabled -Because 'The AdHoc Distributed Queries Enabled setting should be set correctly'\n}\nfunction Assert-XpCmdShellDisabled {\n    param (\n        $SQLInstance,\n        $XpCmdShellDisabled\n    )\n    (Get-DbaSpConfigure -SqlInstance $SQLInstance -Name XPCmdShellEnabled).ConfiguredValue -eq 0 | Should -Be $XpCmdShellDisabled -Because 'The XP CmdShell setting should be set correctly'\n}\nfunction Assert-ErrorLogCount {\n    param (\n        $SQLInstance,\n        $errorLogCount\n    )\n    (Get-DbaErrorLogConfig -SqlInstance $SQLInstance).LogCount | Should -BeGreaterOrEqual $errorLogCount -Because \"We expect to have at least $errorLogCount number of error log files\"\n}\n\nfunction Assert-ErrorLogEntry {\n    Param($AllInstanceInfo)\n    $AllInstanceInfo.ErrorLog | Should -BeNullOrEmpty -Because \"these severities indicate serious problems\"\n}\n\nfunction Assert-LatestBuild {\n    Param($AllInstanceInfo)\n    $AllInstanceInfo.LatestBuild.Compliant | Should -Be $true -Because \"We expected the SQL Server to be on the newest SQL Server Packs/CUs\"\n}\n\nfunction Assert-SaDisabled {\n    Param($AllInstanceInfo)\n    $AllInstanceInfo.SaDisabled.Disabled | Should -Be $true -Because \"We expected the original sa login to be disabled\"\n}\n\nfunction Assert-SaExist {\n    Param($AllInstanceInfo)\n    $AllInstanceInfo.SaExist.Exist | Should -Be 0 -Because \"We expected no login to exist with the name sa\"\n}\n\nfunction Assert-SqlAgentProxiesNoPublicRole {\n    Param($AllInstanceInfo)\n    $AllInstanceInfo.SqlAgentProxiesWithPublicRole | Should -BeNull -Because \"We expected the public role to not have access to any SQL Agent proxies\"\n}\nfunction Assert-HideInstance {\n    Param($AllInstanceInfo)\n    $AllInstanceInfo.HideInstance.HideInstance | Should -Be $true -Because \"We expected the hide instance property to be set to $true\"\n}\n\nfunction Assert-LocalWindowsGroup {\n    Param($AllInstanceInfo)\n    $AllInstanceInfo.LocalWindowsGroup.Exist | Should -Be $false -Because \"We expected to have no local Windows groups as SQL logins\"\n}\nfunction Assert-PublicRolePermission {\n    Param($AllInstanceInfo)\n    $AllInstanceInfo.PublicRolePermission.Count | Should -Be 0 -Because \"We expected the public server role to have been granted no permissions\"\n}\nfunction Assert-BuiltInAdmin {\n    Param($AllInstanceInfo)\n    $AllInstanceInfo.BuiltInAdmin.Exist | Should -Be 0 -Because \"We expected no login to exist with the name BUILTIN\\Administrators\"\n}\n\nfunction Assert-LoginAuditSuccessful {\n    Param($AllInstanceInfo)\n    $AllInstanceInfo.LoginAuditSuccessful.AuditLevel | Should -Be \"All\" -Because \"We expected the audit level to be set to capture all logins (successful and failed)\"\n}\n\nfunction Assert-LoginAuditFailed {\n    Param($AllInstanceInfo)\n    $AllInstanceInfo.LoginAuditFailed.AuditLevel | Should -BeIn @(\"Failure\", \"All\") -Because \"We expected the audit level to be set to capture failed logins\"\n}\n\n\nfunction Assert-AgentServiceAdmin {\n    Param($AllInstanceInfo)\n    $AllInstanceInfo.AgentServiceAdmin.Exist | Should -Be $false -Because \"We expected the service account for the SQL Agent to not be a local administrator\"\n}\n\nfunction Assert-EngineServiceAdmin {\n    Param($AllInstanceInfo)\n    $AllInstanceInfo.EngineServiceAdmin.Exist | Should -Be $false -Because \"We expected the service account for the SQL Engine to not be a local administrator\"\n}\n\nfunction Assert-FullTextServiceAdmin {\n    Param($AllInstanceInfo)\n    $AllInstanceInfo.FullTextServiceAdmin.Exist | Should -Be $false -Because \"We expected the service account for the SQL Full Text to not be a local administrator\"\n}\nfunction Assert-LoginCheckPolicy {\n    Param($AllInstanceInfo)\n    $AllInstanceInfo.LoginCheckPolicy.Count | Should -Be 0 -Because \"We expected the CHECK_POLICY for the all logins to be enabled\"\n}\n\nfunction Assert-LoginPasswordExpiration {\n    Param($AllInstanceInfo)\n    $AllInstanceInfo.LoginPasswordExpiration.Count | Should -Be 0 -Because \"We expected the password expiration policy to set on all sql logins in the sysadmin role\"\n}\n\nfunction Assert-LoginMustChange {\n    Param($AllInstanceInfo)\n    $AllInstanceInfo.LoginMustChange.Count | Should -Be 0 -Because \"We expected the all the new sql logins to have change the password on first login\"\n}\n\nfunction Assert-SQLMailXPsDisabled {\n    param ($AllInstanceInfo)\n    $AllInstanceInfo.SQLMailXPsDisabled.ConfiguredValue | Should -Be 0 -Because \"We expected Sql Mail XPs to be disabled\"\n}\n\nfunction Assert-PublicPermission {\n    Param($AllInstanceInfo)\n    $AllInstanceInfo.PublicPermission.Count | Should -Be 0 -Because \"We expected the public role to have no permissions for CIS compliance.\"\n}\n\n"
  },
  {
    "path": "source/internal/assertions/Server.Assertions.ps1",
    "content": "<#\nThis file is used to hold the Assertions for the Server.Tests\n\nFollow the guidance in Instance.Assertions to add new checks\n\nIt starts with the Get-AllServerInfo which uses all of the unique\n tags that have been passed and gathers the required information\n which can then be used for the assertions.\n\n The long term aim is to make Get-AllServerInfo as performant as\n possible\n#>\n\nfunction Get-AllServerInfo {\n    # Using the unique tags gather the information required\n    # 2018/09/04 - Added PowerPlan Tag - RMS\n    # 2018/09/06 - Added more Tags - RMS\n    Param($ComputerName, $Tags)\n    $There = $true\n    switch ($tags) {\n        'PingComputer' {\n            if ($There) {\n                try {\n                    $pingcount = Get-DbcConfigValue policy.connection.pingcount\n                    $PingComputer = Test-Connection -Count $pingcount -ComputerName $ComputerName -ErrorAction Stop\n                }\n                catch {\n                    $There = $false\n                    $PingComputer = [PSCustomObject] @{\n                        Count        = -1\n                        ResponseTime = 50000000\n                    }\n                }\n            }\n            else {\n                $PingComputer = [PSCustomObject] @{\n                    Count        = -1\n                    ResponseTime = 50000000\n                }\n            }\n        }\n        'DiskAllocationUnit' {\n            if ($There) {\n                try {\n                    $DiskAllocation = Test-DbaDiskAllocation -ComputerName $ComputerName -EnableException -WarningAction SilentlyContinue -WarningVariable DiskAllocationWarning\n                }\n                catch {\n                    $There = $false\n                    $DiskAllocation = [PSCustomObject]@{\n                        Name           = '? '\n                        isbestpractice = $false\n                        IsSqlDisk      = $true\n                    }\n                }\n            }\n            else {\n                $DiskAllocation = [PSCustomObject]@{\n                    Name           = '? '\n                    isbestpractice = $false\n                    IsSqlDisk      = $true\n                }\n            }\n        }\n        'PowerPlan' {\n            if ($There) {\n                try {\n                    $PowerPlan = (Test-DbaPowerPlan -ComputerName $ComputerName -EnableException -WarningVariable PowerWarning -WarningAction SilentlyContinue).IsBestPractice\n                }\n                catch {\n                    $PowerPlan = $false\n                }\n            }\n            else {\n                $PowerPlan = $false\n            }\n        }\n        'SPN' {\n            if ($There) {\n                try {\n                    $SPNs = Test-DbaSpn -ComputerName $ComputerName -EnableException -WarningVariable SPNWarning -WarningAction SilentlyContinue\n                    if ($SPNWarning) {\n                        if ($SPNWarning[1].ToString().Contains('Cannot resolve IP address')) {\n                            $There = $false\n                            $SPNs = [PSCustomObject]@{\n                                RequiredSPN            = 'Dont know the SPN'\n                                InstanceServiceAccount = 'Dont know the Account'\n                                Error                  = 'Could not connect'\n                            }\n                        }\n                        else {\n                            $SPNs = [PSCustomObject]@{\n                                RequiredSPN            = 'Dont know the SPN'\n                                InstanceServiceAccount = 'Dont know the Account'\n                                Error                  = 'An Error occurred'\n                            }\n                        }\n                    }\n                }\n                catch {\n                    $SPNs = [PSCustomObject]@{\n                        RequiredSPN            = 'Dont know the SPN'\n                        InstanceServiceAccount = 'Dont know the Account'\n                        Error                  = 'An Error occurred'\n                    }\n                }\n            }\n            else {\n                $SPNs = [PSCustomObject]@{\n                    RequiredSPN            = 'Dont know the SPN'\n                    InstanceServiceAccount = 'Dont know the Account'\n                    Error                  = 'An Error occurred'\n                }\n            }\n        }\n        'DiskCapacity' {\n            if ($There) {\n                try {\n                    $DiskSpace = Get-DbaDiskSpace -ComputerName $ComputerName -EnableException -WarningVariable DiskSpaceWarning -WarningAction SilentlyContinue\n                }\n                catch {\n                    if ($DiskSpaceWarning) {\n                        $There = $false\n                        if ($DiskSpaceWarning[1].ToString().Contains('Couldn''t resolve hostname')) {\n                            $DiskSpace = [PSCustomObject]@{\n                                Name         = 'Do not know the Name'\n                                PercentFree  = -1\n                                ComputerName = 'Cannot resolve ' + $ComputerName\n                            }\n                        }\n                    }\n                    else {\n                        $DiskSpace = [PSCustomObject]@{\n                            Name         = 'Do not know the Name'\n                            PercentFree  = -1\n                            ComputerName = 'An Error occurred ' + $ComputerName\n                        }\n                    }\n                }\n            }\n            else {\n                $DiskSpace = [PSCustomObject]@{\n                    Name         = 'Do not know the Name'\n                    PercentFree  = -1\n                    ComputerName = 'An Error occurred ' + $ComputerName\n                }\n            }\n        }\n        'NonStandardPort' {\n            if ($There) {\n                try {\n                    $count = (Find-DbaInstance -ComputerName $ComputerName -TCPPort 1433).Count\n                    $StandardPortCount = [pscustomobject] @{\n                        Count = $count\n                    }\n                }\n                catch {\n                    $There = $false\n                    $StandardPortCount = [pscustomobject] @{\n                        Count = 'We Could not Connect to $Instance'\n                    }\n                }\n            }\n            else {\n                $There = $false\n                $StandardPortCount = [pscustomobject] @{\n                    Count = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n        'ServerProtocol' {\n            if ($There) {\n                try {\n                    $count = (Get-DbaInstanceProtocol -ComputerName $ComputerName | Where-Object {$_.DisplayName -ne \"TCP/IP\" -and $_.IsEnabled -eq $true}).Count\n                    $ServerProtocol = [pscustomobject] @{\n                        Count = $count\n                    }\n                }\n                catch {\n                    $There = $false\n                    $ServerProtocol = [pscustomobject] @{\n                        Count = 'We Could not Connect to $Instance'\n                    }\n                }\n            }\n            else {\n                $There = $false\n                $ServerProtocol = [pscustomobject] @{\n                    Count = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n        Default {}\n    }\n    [PSCustomObject]@{\n        PowerPlan         = $PowerPlan\n        SPNs              = $SPNs\n        DiskSpace         = $DiskSpace\n        PingComputer      = $PingComputer\n        DiskAllocation    = $DiskAllocation\n        StandardPortCount = $StandardPortCount\n        ServerProtocol = $ServerProtocol\n    }\n}\n\nfunction Assert-CPUPrioritisation {\n    [CmdletBinding()]\n    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', 'ComputerName')]\n    Param(\n        [string]$ComputerName\n    )\n    function Get-RemoteRegistryValue {\n        $Reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]::LocalMachine, $ComputerName)\n        $RegSubKey = $Reg.OpenSubKey(\"System\\CurrentControlSet\\Control\\PriorityControl\")\n        $RegSubKey.GetValue('Win32PrioritySeparation')\n    }\n\n    Get-RemoteRegistryValue | Should -BeExactly 24 -Because \"a server should prioritise CPU to it's Services, not to the user experience when someone logs on\"\n}\n\nfunction Assert-DiskAllocationUnit {\n    Param($DiskAllocationObject)\n    $DiskAllocationObject.isbestpractice | Should -BeTrue -Because \"SQL Server performance will be better when accessing data from a disk that is formatted with 64Kb block allocation unit\"\n}\n\nfunction Assert-PowerPlan {\n    Param($AllServerInfo)\n    $AllServerInfo.PowerPlan | Should -Be 'True' -Because \"You want your SQL Server to not be throttled by the Power Plan settings - See https://support.microsoft.com/en-us/help/2207548/slow-performance-on-windows-server-when-using-the-balanced-power-plan\"\n}\n\nfunction Assert-SPN {\n    Param($SPN)\n    $SPN.Error | Should -Be 'None' -Because \"We expect to have a SPN $($SPN.RequiredSPN) for $($SPN.InstanceServiceAccount)\"\n}\n\nfunction Assert-DiskSpace {\n    Param($Disk)\n    $free = Get-DbcConfigValue policy.diskspace.percentfree\n    $Disk.PercentFree  | Should -BeGreaterThan $free -Because \"You Do not want to run out of space on your disks\"\n}\n\nfunction Assert-Ping {\n    Param(\n        $AllServerInfo,\n        $Type\n    )\n    $pingcount = Get-DbcConfigValue policy.connection.pingcount\n    $pingmsmax = Get-DbcConfigValue policy.connection.pingmaxms\n    switch ($type) {\n        Ping {\n            ($AllServerInfo.PingComputer).Count | Should -Be $pingcount -Because \"We expect the server to respond to ping\"\n        }\n        Average {\n            if ($IsCoreCLR) {\n                ($AllServerInfo.PingComputer | Measure-Object -Property Latency -Average).Average / $pingcount | Should -BeLessThan $pingmsmax -Because \"We expect the server to respond within $pingmsmax\"\n            }\n            else {\n                ($AllServerInfo.PingComputer | Measure-Object -Property ResponseTime -Average).Average / $pingcount | Should -BeLessThan $pingmsmax -Because \"We expect the server to respond within $pingmsmax\"\n            }\n        }\n        Default {}\n    }\n}\n\nfunction Assert-NonStandardPort {\n    Param($AllServerInfo)\n    $AllServerInfo.StandardPortCount.count | Should -Be 0 -Because \"SQL Server should be configured to not use the standard port of 1433\"\n}\n\nfunction Assert-ServerProtocol {\n    Param($AllServerInfo)\n    $AllServerInfo.ServerProtocol.Count | Should -Be 0 -Because \"SQL Server should be configured to use only the TCP/IP protocol\"\n}\n\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUkbWiF6k6prHEAiMVnoEKu09n\n# bPygggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz\n# c3VyZWQgSUQgQ29kZSBTaWduaW5nIENBMB4XDTE3MDUwOTAwMDAwMFoXDTIwMDUx\n# MzEyMDAwMFowVzELMAkGA1UEBhMCVVMxETAPBgNVBAgTCFZpcmdpbmlhMQ8wDQYD\n# VQQHEwZWaWVubmExETAPBgNVBAoTCGRiYXRvb2xzMREwDwYDVQQDEwhkYmF0b29s\n# czCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAI8ng7JxnekL0AO4qQgt\n# Kr6p3q3SNOPh+SUZH+SyY8EA2I3wR7BMoT7rnZNolTwGjUXn7bRC6vISWg16N202\n# 1RBWdTGW2rVPBVLF4HA46jle4hcpEVquXdj3yGYa99ko1w2FOWzLjKvtLqj4tzOh\n# K7wa/Gbmv0Si/FU6oOmctzYMI0QXtEG7lR1HsJT5kywwmgcjyui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\n# EyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgQ29kZSBTaWduaW5nIENBAhACwXUo\n# dNXChDGFKtigZGnKMAkGBSsOAwIaBQCgeDAYBgorBgEEAYI3AgEMMQowCKACgACh\n# AoAAMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcCAQsxDjAM\n# BgorBgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBT4os0MlMhlV4UraAiFxccwRITI\n# uTANBgkqhkiG9w0BAQEFAASCAQCKNm/SlwW5wDhBqZCVycDNtcEt3+/CdqsxM9AE\n# SVOHD31uUTQB/pgUyu0TE2VFlLYKCCbwxy/Rz4jLbbz3z+Dd/dm9wNvYnJc7rEs3\n# pj6VOVwCG+hwtneIjEJFF9DmoWgNczpuuDriHo6KsLZYX33t0PRpDpUsKq7WTXS9\n# YAm7zTvSPJnZhgBbDAC8QrGfngE+iaJu+OwquKikbgH5DsvBgGSkOsgaPztAtqjR\n# SEDeN3OGT5BsJKAh8qw8nezZXvYjd0ffsNEMNro/hN8SbTlR1kMm9NaUKyrTS48A\n# wpRxkz3cFtkEH5ql8BZTH3Nj4GsDrK40mCE2+1TKcboajhKM\n# SIG # End signature block\n"
  },
  {
    "path": "source/internal/configurations/DbcCheckDescriptions.json",
    "content": "[{\n        \"UniqueTag\": \"AgentServiceAccount\",\n        \"Description\": \"Tests that the SQL Agent Account is running and set to automatic.\"\n    },\n    {\n        \"UniqueTag\": \"DbaOperator\",\n        \"Description\": \"Tests that the specified (default blank) DBA Operators exist and have the correct email address.\"\n    },\n    {\n        \"UniqueTag\": \"FailsafeOperator\",\n        \"Description\": \"Tests that the specified (default blank) Failsafe Operator exists.\"\n    },\n    {\n        \"UniqueTag\": \"DatabaseMailProfile\",\n        \"Description\": \"Tests that the specified (default blank) Database Mail Profile exists.\"\n    },\n    {\n        \"UniqueTag\": \"FailedJob\",\n        \"Description\": \"Tests that enabled Agent Jobs last outcome was succeeded since specified start date (default 30 days ago) and can exclude cancelled jobs (default false).\"\n    },\n    {\n        \"UniqueTag\": \"ValidJobOwner\",\n        \"Description\": \"Tests that all Agent Jobs have a Job Owner in the list specified (default sa).\"\n    },\n    {\n        \"UniqueTag\": \"InvalidJobOwner\",\n        \"Description\": \"Tests that all Agent Jobs do not have a Job Owner in the list specified (default null).\"\n    },\n    {\n        \"UniqueTag\": \"AgentAlert\",\n        \"Description\": \"Tests that there are Agent Alerts set up for the specified (default 16-25) alert severities and ids (default 823-825) and if specified Agent Jobs and/or notifications.\"\n    },\n    {\n        \"UniqueTag\": \"DatabaseCollation\",\n        \"Description\": \"Tests that the Database Collation matches the instance collation except for specified databases.\"\n    },\n    {\n        \"UniqueTag\": \"SuspectPage\",\n        \"Description\": \"Tests that there are 0 Suspect Pages for the database.\"\n    },\n    {\n        \"UniqueTag\": \"SuspectPageLimit\",\n        \"Description\": \"Tests that the suspect_pages table in msdb is not nearing the limit of 1000 rows.\"\n    },\n    {\n        \"UniqueTag\": \"TestLastBackup\",\n        \"Description\": \"Restores the last backup of a database onto a specified (default blank so will use the same instance) restore instance and checks if the DBCC result was successful as well as the DBCC result. This can obviously take some time for large databases!\"\n    },\n    {\n        \"UniqueTag\": \"TestLastBackupVerifyOnly\",\n        \"Description\": \"Does a verify only restore of the last backup of the database and test the result.\"\n    },\n    {\n        \"UniqueTag\": \"ValidDatabaseOwner\",\n        \"Description\": \"Tests that the database owner is in the specified (default blank) list.\"\n    },\n    {\n        \"UniqueTag\": \"InvalidDatabaseOwner\",\n        \"Description\": \"Tests that the Database Owner is NOT in the specified (default blank) list.\"\n    },\n    {\n        \"UniqueTag\": \"LastGoodCheckDb\",\n        \"Description\": \"Tests that there was a Last Good DBCC CHECKDB within the specified limit (default blank) and if specified that the DATA_PURITY flag is set.\"\n    },\n    {\n        \"UniqueTag\": \"IdentityUsage\",\n        \"Description\": \"Tests that identity columns values are not above the specified percentage (default blank) of the maximum value for that data type.\"\n    },\n    {\n        \"UniqueTag\": \"RecoveryModel\",\n        \"Description\": \"Tests that the Recovery model for all of the databases is set as specified (default blank) except for any specified.\"\n    },\n    {\n        \"UniqueTag\": \"DuplicateIndex\",\n        \"Description\": \"Tests for any duplicate indexes.\"\n    },\n    {\n        \"UniqueTag\": \"UnusedIndex\",\n        \"Description\": \"Tests for any unused indexes.\"\n    },\n    {\n        \"UniqueTag\": \"DisabledIndex\",\n        \"Description\": \"Tests for any disabled indexes.\"\n    },\n    {\n        \"UniqueTag\": \"DatabaseGrowthEvent\",\n        \"Description\": \"Tests for any database growth events in the default system trace.\"\n    },\n    {\n        \"UniqueTag\": \"PageVerify\",\n        \"Description\": \"Tests the page verify setting.\"\n    },\n    {\n        \"UniqueTag\": \"AutoClose\",\n        \"Description\": \"Tests the auto-close setting.\"\n    },\n    {\n        \"UniqueTag\": \"AutoShrink\",\n        \"Description\": \"Tests the Auto Shrink setting.\"\n    },\n    {\n        \"UniqueTag\": \"LastFullBackup\",\n        \"Description\": \"Tests if the last full backup of a database is less than the specified number of days (default 7) except for offline databases and read-only databases (read-only if specified) and databases created recently (if specified).\"\n    },\n    {\n        \"UniqueTag\": \"LastDiffBackup\",\n        \"Description\": \"Tests if the last diff backup of a database is less than the specified number of hours (default 24) except for offline databases and read-only databases (read-only if specified) and databases created recently (if specified).\"\n    },\n    {\n        \"UniqueTag\": \"LastLogBackup\",\n        \"Description\": \"Tests if the last log backup of a database is less than the specified number of minutes (default 30) except for simple databases, offline databases and read-only databases (read-only if specified) and databases created recently (if specified).\"\n    },\n    {\n        \"UniqueTag\": \"VirtualLogFile\",\n        \"Description\": \"Tests the number of the Virtual Log Files are less than the specified number.\"\n    },\n    {\n        \"UniqueTag\": \"LogfileCount\",\n        \"Description\": \"Tests that the number of log files are less than the specified amount (default is 1) in all databases except those specified to be skipped by default.\"\n    },\n    {\n        \"UniqueTag\": \"LogfileSize\",\n        \"Description\": \"Tests that the database log files are less than the specified percentage of the specified comparison (maximum size or average - default is average) of the data file size (default 100).\"\n    },\n    {\n        \"UniqueTag\": \"LogfilePercentUsed\",\n        \"Description\": \"Tests that the database percent log file used is less than the specified percentage (default 75).\"\n    },\n    {\n        \"UniqueTag\": \"FutureFileGrowth\",\n        \"Description\": \"Tests if a database (except for those specified to be skipped explicitly) has free space less than the specified percentage (default 20).\"\n    },\n    {\n        \"UniqueTag\": \"FileGroupBalanced\",\n        \"Description\": \"Tests that all of the files within each filegroup are sized within the specified percentage (default 5) of the average.\"\n    },\n    {\n        \"UniqueTag\": \"CertificateExpiration\",\n        \"Description\": \"Tests that all certificates have not expired and are not due to expire within the specified (default 1) number of months.\"\n    },\n    {\n        \"UniqueTag\": \"AutoCreateStatistics\",\n        \"Description\": \"Tests the Auto Create Statistics property on each database is set to the specified (default false) value.\"\n    },\n    {\n        \"UniqueTag\": \"AutoUpdateStatistics\",\n        \"Description\": \"Tests the Auto Update Statistics property on each database is set to the specified (default true) value.\"\n    },\n    {\n        \"UniqueTag\": \"AutoUpdateStatisticsAsynchronously\",\n        \"Description\": \"Tests the Auto Update Statistics Asynchronously property on each database is set to the specified (default false) value.\"\n    },\n    {\n        \"UniqueTag\": \"DatafileAutoGrowthType\",\n        \"Description\": \"Tests that the Datafile Auto Growth type and value on each database except those specified is set to the specified (default type = kb, value = 65535) values.\"\n    },\n    {\n        \"UniqueTag\": \"Trustworthy\",\n        \"Description\": \"Tests that the Trustworthy Option for each database is set to false.\"\n    },\n    {\n        \"UniqueTag\": \"OrphanedUser\",\n        \"Description\": \"Tests that each database has 0 orphaned users.\"\n    },\n    {\n        \"UniqueTag\": \"PseudoSimple\",\n        \"Description\": \"Tests that databases are not in PseudoSimple Recovery Model.\"\n    },\n    {\n        \"UniqueTag\": \"CompatibilityLevel\",\n        \"Description\": \"tests that the servers compatibility level matches the compatibility level.\"\n    },\n    {\n        \"UniqueTag\": \"DomainName\",\n        \"Description\": \"Uses WMI Win32_ComputerSystem to check that the host machine is on the correct domain.\"\n    },\n    {\n        \"UniqueTag\": \"OrganizationalUnit\",\n        \"Description\": \"Currently skipped - Active Directory OU.\"\n    },\n    {\n        \"UniqueTag\": \"ClusterHealth\",\n        \"Description\": \"Runs a suite of tests against an Availability Group on a Windows cluster to ensure that everything is as it should be. Tests cluster resources are online, cluster nodes are up, at least one IP Address for the AG listener is available, that each replica and listener are pingable (listener ping check can be skipped), can be connected to via T-SQL, have the correct domain name and TCP port, that each replica is synchronized/ing, is connected, is not in an unknown state, each database is synchronized/ing, failover ready and joined to the domain and that the Always On Health Extended Event sessions are running and set to auto-start.\"\n    },\n    {\n        \"UniqueTag\": \"SqlEngineServiceAccount\",\n        \"Description\": \"Tests that the SQL Engine Service state is set to the configured value (default - Running) and that the start mode is set to the configured value (default - Automatic) unless it is a cluster in which case it checks that the start mode is set to Manual.\"\n    },\n    {\n        \"UniqueTag\": \"SqlBrowserServiceAccount\",\n        \"Description\": \"Tests that the SQL Browser Service is started and set to auto-start if there are multiple instances and stopped and set to disabled if there is only one.\"\n    },\n    {\n        \"UniqueTag\": \"TempDbConfiguration\",\n        \"Description\": \"Tests that the TempDB Configuration is correct, that TF118 is enabled, there are the recommended number of files, autogrowth is not set to percent, that the files can grow and that they are not located on the C drive (each of these tests can be configured individually to be skipped.\"\n    },\n    {\n        \"UniqueTag\": \"AdHocWorkload\",\n        \"Description\": \"Tests that the AAd Hoc Workload Optimization is enabled.\"\n    },\n    {\n        \"UniqueTag\": \"BackupPathAccess\",\n        \"Description\": \"Tests that the SQL Service account has access to the default backup path or the specified folder path.\"\n    },\n    {\n        \"UniqueTag\": \"DAC\",\n        \"Description\": \"Tests that the Dedicated Administrator Connection configuration setting matches the specified value (default true).\"\n    },\n    {\n        \"UniqueTag\": \"TwoDigitYearCutoff\",\n        \"Description\": \"Tests that the 'Two Digit Year Cutoff' configuration setting matches the specified value (default 2049).\"\n    },\n    {\n        \"UniqueTag\": \"NetworkLatency\",\n        \"Description\": \"Tests that the Network Latency is less than the specified (default 40 (ms)).\"\n    },\n    {\n        \"UniqueTag\": \"LinkedServerConnection\",\n        \"Description\": \"Tests for successful connection to all Linked Servers.\"\n    },\n    {\n        \"UniqueTag\": \"MaxMemory\",\n        \"Description\": \"Tests an instances Max Memory.\"\n    },\n    {\n        \"UniqueTag\": \"OrphanedFile\",\n        \"Description\": \"Tests that there are 0 orphaned data files.\"\n    },\n    {\n        \"UniqueTag\": \"ServerNameMatch\",\n        \"Description\": \"Tests that the SQL + Windows names match.\"\n    },\n    {\n        \"UniqueTag\": \"MemoryDump\",\n        \"Description\": \"Tests that there are less than the specified (default 1) number of SQL Memory Dumps.\"\n    },\n    {\n        \"UniqueTag\": \"SupportedBuild\",\n        \"Description\": \"Tests that the instance is still under Microsoft support and that it will still be under support in a specified (default 6) months.\"\n    },\n    {\n        \"UniqueTag\": \"SaRenamed\",\n        \"Description\": \"Tests that the SA Login has been renamed.\"\n    },\n    {\n        \"UniqueTag\": \"SaExist\",\n        \"Description\": \"Tests that a sa login does not exist.\"\n    },\n    {\n        \"UniqueTag\": \"SaDisabled\",\n        \"Description\": \"Tests that the original SA Login is disabled.\"\n    },\n    {\n        \"UniqueTag\": \"DefaultBackupCompression\",\n        \"Description\": \"Tests that an instances Default Backup Compression is set to the specified (default true) setting.\"\n    },\n    {\n        \"UniqueTag\": \"XESessionStopped\",\n        \"Description\": \"Tests that the specified (default blank) XE Sessions are stopped.\"\n    },\n    {\n        \"UniqueTag\": \"XESessionRunning\",\n        \"Description\": \"Tests that the specified (default blank) XE Sessions that are expected to be running are running.\"\n    },\n    {\n        \"UniqueTag\": \"XESessionRunningAllowed\",\n        \"Description\": \"Tests that the specified (default blank) XE Sessions that are allowed to be running are running.\"\n    },\n    {\n        \"UniqueTag\": \"OLEAutomation\",\n        \"Description\": \"Tests that OLE Automation is set to the specified (default false) setting.\"\n    },\n    {\n        \"UniqueTag\": \"WhoIsActiveInstalled\",\n        \"Description\": \"Tests that sp_whoisactive is Installed by testing the specified (default master) database for the stored procedure.\"\n    },\n    {\n        \"UniqueTag\": \"ModelDbGrowth\",\n        \"Description\": \"Tests that the Model Database Growth settings are not set to default.\"\n    },\n    {\n        \"UniqueTag\": \"ADUser\",\n        \"Description\": \"Tests that Ad Users and Groups, except those specified, that are logins on a SQL Server exist in Active Directory, do not have an expired password, are not locked out, are enabled in AD and on the SQL Server.\"\n    },\n    {\n        \"UniqueTag\": \"ErrorLog\",\n        \"Description\": \"Tests that the SQL Server Error Log does not have any Severity 17-24 level entries within the specified (default 2) days.\"\n    },\n    {\n        \"UniqueTag\": \"ErrorLogCount\",\n        \"Description\": \"Tests that the number of SQL Server Error Logs configured. Default value is -1 which means off (will use 6 files).\"\n    },\n    {\n        \"UniqueTag\": \"LogShippingPrimary\",\n        \"Description\": \"Tests that the Log Shipping Primary status is ok.\"\n    },\n    {\n        \"UniqueTag\": \"LogShippingSecondary\",\n        \"Description\": \"Tests that the Log Shipping Secondary status is ok.\"\n    },\n    {\n        \"UniqueTag\": \"OlaInstalled\",\n        \"Description\": \"Tests that Ola maintenance solution is installed by testing the specified (default master) database for the command log table and the stored procedures.\"\n    },\n    {\n        \"UniqueTag\": \"SystemFull\",\n        \"Description\": \"Tests that the Ola - System Full Agent Job (using the specified name defaults to Olas default naming) enabled setting is set as specified (default true), the schedules are set as specified (default true) and enabled and that the backup retention setting for the job is set as specified (default 192 (hours)).\"\n    },\n    {\n        \"UniqueTag\": \"UserFull\",\n        \"Description\": \"Tests that the Ola - User Full Agent Job (using the specified name defaults to Olas default naming) enabled setting is set as specified (default true), the schedules are set as specified (default true) and enabled and that the backup retention setting for the job is set as specified (default 192 (hours)).\"\n    },\n    {\n        \"UniqueTag\": \"UserDiff\",\n        \"Description\": \"Tests that the Ola - User Diff Agent Job (using the specified name defaults to Olas default naming) enabled setting is set as specified (default true), the schedules are set as specified (default true) and enabled and that the backup retention setting for the job is set as specified (default 192 (hours)).\"\n    },\n    {\n        \"UniqueTag\": \"UserLog\",\n        \"Description\": \"Tests that the Ola - User Log Agent Job (using the specified name defaults to Olas default naming) enabled setting is set as specified (default true), the schedules are set as specified (default true) and enabled and that the backup retention setting for the job is set as specified (default 192 (hours)).\"\n    },\n    {\n        \"UniqueTag\": \"CommandLog\",\n        \"Description\": \"Tests that the Ola - Command Log Cleanup Job (using the specified name defaults to Olas default naming) enabled setting is set as specified (default true), the schedules are set as specified (default true) and enabled and that the clean up setting for the job is set as specified (default 30 (days)).\"\n    },\n    {\n        \"UniqueTag\": \"SystemIntegrityCheck\",\n        \"Description\": \"Tests that the Ola - System Integrity Check Agent Job (using the specified name defaults to Olas default naming) enabled setting is set as specified (default true), the schedules are set as specified (default true) and enabled.\"\n    },\n    {\n        \"UniqueTag\": \"UserIntegrityCheck\",\n        \"Description\": \"Tests that the Ola - User Integrity Check Agent Job (using the specified name defaults to Olas default naming) enabled setting is set as specified (default true), the schedules are set as specified (default true) and enabled.\"\n    },\n    {\n        \"UniqueTag\": \"UserIndexOptimize\",\n        \"Description\": \"Tests that the Ola - User Index Optimise Agent Job (using the specified name defaults to Olas default naming) enabled setting is set as specified (default true), the schedules are set as specified (default true) and enabled.\"\n    },\n    {\n        \"UniqueTag\": \"OutputFileCleanup\",\n        \"Description\": \"Tests that the Ola - Output File Cleanup Job (using the specified name defaults to Olas default naming) enabled setting is set as specified (default true), the schedules are set as specified (default true) and enabled and that the clean up setting for the job is set as specified (default 30 (days)).\"\n    },\n    {\n        \"UniqueTag\": \"DeleteBackupHistory\",\n        \"Description\": \"Tests that the Ola - Delete Backup History Job (using the specified name defaults to Olas default naming) enabled setting is set as specified (default true), the schedules are set as specified (default true) and enabled and that the clean up setting for the job is set as specified (default 30 (days)).\"\n    },\n    {\n        \"UniqueTag\": \"PurgeJobHistory\",\n        \"Description\": \"Tests that the Ola - Purge Job History Job (using the specified name defaults to Olas default naming) enabled setting is set as specified (default true), the schedules are set as specified (default true) and enabled and that the clean up setting for the job is set as specified (default 30 (days)).\"\n    },\n    {\n        \"UniqueTag\": \"PowerPlan\",\n        \"Description\": \"Tests that the Server Power Plan is set to High Performance.\"\n    },\n    {\n        \"UniqueTag\": \"InstanceConnection\",\n        \"Description\": \"Tests that a SQL query can be run, that the specified authentication scheme (default kerberos) is being used, that the host responds to one ping and that the host supports PS Remoting.\"\n    },\n    {\n        \"UniqueTag\": \"SPN\",\n        \"Description\": \"Tests that all default SQL SPNs have been correctly registered.\"\n    },\n    {\n        \"UniqueTag\": \"DiskCapacity\",\n        \"Description\": \"Tests that each drive has at least the specified percentage (default 20) free space.\"\n    },\n    {\n        \"UniqueTag\": \"PingComputer\",\n        \"Description\": \"Tests that a host has been pinged a specified number of times (default 3) and that the average response time is less than specified (default 10 (ms)).\"\n    },\n    {\n        \"UniqueTag\": \"FKCKTrusted\",\n        \"Description\": \"Tests that each foreign key and each constraint is trusted.\"\n    },\n    {\n        \"UniqueTag\": \"MaxDopInstance\",\n        \"Description\": \"Tests that the instance level MaxDop settings on all instances (except those specified default blank) are set to the recommended value if specified (default false) or to the specified value (default 0).\"\n    },\n    {\n        \"UniqueTag\": \"MaxDopDatabase\",\n        \"Description\": \"Tests that the database level MaxDop settings for all databases on all instances from version 2016 up are set to the specified value (default 0).\"\n    },\n    {\n        \"UniqueTag\": \"DatabaseStatus\",\n        \"Description\": \"Tests that there are no databases on an instance that are in a state of AutoClose, Offline, ReadOnly, Restoring, Recovery, Recovery Pending, EmergencyMode, Suspect or StandBy. Databases that are in ReadOnly,Offline and Restoring mode can be specified (default none).\"\n    },\n    {\n        \"UniqueTag\": \"CPUPrioritisation\",\n        \"Description\": \"Tests that the CPU is prioritised for background activity over user UI experience. unless specified to ignore (default true).\"\n    },\n    {\n        \"UniqueTag\": \"DiskAllocationUnit\",\n        \"Description\": \"Tests that the disks available to the server are formatted for optimum performance (64KB allocation unit) unless a specified disk name (default none).\"\n    },\n    {\n        \"UniqueTag\": \"DatabaseExists\",\n        \"Description\": \"Tests that the databases are specified are on the instance (Note - Does not check if they are available - Use DatabaseStatus for that).\"\n    },\n    {\n        \"UniqueTag\": \"TraceFlagsExpected\",\n        \"Description\": \"Tests that the specified (default none) trace flags are running on the instance.\"\n    },\n    {\n        \"UniqueTag\": \"TraceFlagsNotExpected\",\n        \"Description\": \"Tests that the specified (default none) trace flags are not running on the instance.\"\n    },\n    {\n        \"UniqueTag\": \"CLREnabled\",\n        \"Description\": \"Tests that the CLR Enabled configuration setting is set as specified (default false).\"\n    },\n    {\n        \"UniqueTag\": \"CrossDBOwnershipChaining\",\n        \"Description\": \"Tests that the Cross Database Ownership Chaining configuration setting is set as specified (default false).\"\n    },\n    {\n        \"UniqueTag\": \"DatabaseMailEnabled\",\n        \"Description\": \"Tests that the Database Mail XPs configuration setting is set as specified (default false).\"\n    },\n    {\n        \"UniqueTag\": \"DefaultFilePath\",\n        \"Description\": \"Tests that the default file path for an instance is not the C drive.\"\n    },\n    {\n        \"UniqueTag\": \"AdHocDistributedQueriesEnabled\",\n        \"Description\": \"Tests that the AdHoc Distributed Queries configuration setting is set as specified (default false).\"\n    },\n    {\n        \"UniqueTag\": \"XpCmdShellDisabled\",\n        \"Description\": \"Tests that the XP CmdShell configuration setting is set as specified (default true - meaning it should be disabled).\"\n    },\n    {\n        \"UniqueTag\": \"OLEAutomationProceduresDisabled\",\n        \"Description\": \"Tests that the OLE Automation Procedures configuration setting is set as specified (default 0 - meaning it should be disabled).\"\n    },\n    {\n        \"UniqueTag\": \"RemoteAccessDisabled\",\n        \"Description\": \"Tests that the Remote Access configuration setting is set as specified (default true - meaning it should be disabled).\"\n    },\n    {\n        \"UniqueTag\": \"ScanForStartupProceduresDisabled\",\n        \"Description\": \"Tests that the Scan For Startup Procedures configuration setting is set as specified (default 0 - meaning it should be disabled).\"\n    },\n    {\n        \"UniqueTag\": \"JobHistory\",\n        \"Description\": \"Tests that the job history configuration for max number of rows in the whole agent log is greater than or equal to the specified value (default 1000) and that the max number of rows per job configuration is greater than or equal to the specified value (default 100).\"\n    },\n    {\n        \"UniqueTag\": \"DefaultTrace\",\n        \"Description\": \"Tests that the default trace configuration is set to enabled.\"\n    },\n    {\n        \"UniqueTag\": \"LongRunningJob\",\n        \"Description\": \"Tests that any currently running agent jobs have not been running for longer than the configured percentage (default 50) of time more than the average job run.\"\n    },\n    {\n        \"UniqueTag\": \"LastJobRunTime\",\n        \"Description\": \"Tests that the last durations of the agent jobs were not longer than the configured percentage (default 50) of time more than the average job run.\"\n    },\n    {\n        \"UniqueTag\": \"LatestBuild\",\n        \"Description\": \"Tests that the sees is SQL Server has the newest Service Packs and CUs installed.\"\n    },\n    {\n        \"UniqueTag\": \"ContainedDBAutoClose\",\n        \"Description\": \"Tests that each contained database has AUTO CLOSE disabled.\"\n    },\n    {\n        \"UniqueTag\": \"SqlAgentProxiesNoPublicRole\",\n        \"Description\": \"Tests that the public role does not have access to SQL Agent Proxies.\"\n    },\n    {\n        \"UniqueTag\": \"SymmetricKeyEncryptionLevel\",\n        \"Description\": \"Tests that Symmetric Key Encryption Level is at least AES_128 in non-system databases.\"\n    },\n    {\n        \"UniqueTag\": \"AsymmetricKeySize\",\n        \"Description\": \"Tests that Asymmetric Key Sizes are at least 2048 in non-system databases.\"\n    },\n    {\n        \"UniqueTag\": \"HideInstance\",\n        \"Description\": \"Tests that each hide instance is set to YES for the instance.\"\n    },\n    {\n        \"UniqueTag\": \"CLRAssembliesSafe\",\n        \"Description\": \"Tests that CLR assembly permissions are set to SAFE_ACCESS.\"\n    },\n    {\n        \"UniqueTag\": \"EngineServiceAdmin\",\n        \"Description\": \"Tests that the SQL Engine service account is not a local administrator.\"\n    },\n    {\n        \"UniqueTag\": \"AgentServiceAdmin\",\n        \"Description\": \"Tests that the SQL Agent service account is not a local administrator.\"\n    },\n    {\n        \"UniqueTag\": \"FullTextServiceAdmin\",\n        \"Description\": \"Tests that the SQL Full Text service account is not a local administrator.\"\n    },\n    {\n        \"UniqueTag\": \"LoginAuditFailed\",\n        \"Description\": \"Tests that server level logins are recorded for failed logins.\"\n    },\n    {\n        \"UniqueTag\": \"LoginAuditSuccessful\",\n        \"Description\": \"Tests that server level logins are recorded for successful and failed logins.\"\n    },\n    {\n        \"UniqueTag\": \"LocalWindowsGroup\",\n        \"Description\": \"Tests that no local Windows group has a SQL Login.\"\n    },\n    {\n        \"UniqueTag\": \"PublicRolePermission\",\n        \"Description\": \"Tests that server public role does not have any permissions.\"\n    },\n    {\n        \"UniqueTag\": \"GuestUserConnect\",\n        \"Description\": \"Tests that guest user does not have CONNECT permission.\"\n    },\n    {\n        \"UniqueTag\": \"BuiltInAdmin\",\n        \"Description\": \"Tests to see if the BUILTIN\\\\Administrator login exist.\"\n    },\n    {\n        \"UniqueTag\": \"QueryStoreEnabled\",\n        \"Description\": \"Tests to see Query Store is enabled on each database except those specified.\"\n    },\n    {\n        \"UniqueTag\": \"QueryStoreDisabled\",\n        \"Description\": \"Tests to see Query Store is disabled on each database except those specified.\"\n    },\n    {\n        \"UniqueTag\": \"ContainedDBSQLAuth\",\n        \"Description\": \"Tests to see a contained database contains sql authenticated users.\"\n    },\n    {\n        \"UniqueTag\": \"LoginCheckPolicy\",\n        \"Description\": \"Tests to see if CHECK_POLICY property is set for all logins.\"\n    },\n    {\n        \"UniqueTag\": \"LoginPasswordExpiration\",\n        \"Description\": \"Tests to see if password expiration policy is set for sql logins in sysadmin role.\"\n    },\n    {\n        \"UniqueTag\": \"LoginMustChange\",\n        \"Description\": \"Tests to see if password must change is enabled for new logins.\"\n    },\n    {\n        \"UniqueTag\": \"NonStandardPort\",\n        \"Description\": \"Tests to see if the SQL Server Instances are NOT running on the default port of 1433.\"\n    },\n    {\n        \"UniqueTag\": \"AgentMailProfile\",\n        \"Description\": \"Tests to see if the SQL Server Agent Alert System has an enabled database mail profile.\"\n    },\n    {\n        \"UniqueTag\": \"SQLMailXPsDisabled\",\n        \"Description\": \"Tests to see SQL Mail XPs are disabled.\"\n    },\n    {\n        \"UniqueTag\": \"PublicPermission\",\n        \"Description\": \"Tests to see if public role has extra permissions based on CIS requirements.\"\n    },\n    {\n        \"UniqueTag\": \"ServerProtocol\",\n        \"Description\": \"Tests to see if the SQL Server Instances are running other protocols besides TCP/IP.\"\n    }\n]"
  },
  {
    "path": "source/internal/configurations/configuration.ps1",
    "content": "﻿# Fred magic\n#Set-PSFConfig -Handler { if (Get-PSFTaskEngineCache -Module dbachecks -Name module-imported) { Write-PSFMessage -Level Warning -Message \"This setting will only take effect on the next console start\" } }\n\n#Add some validation for values with limited options\n[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidAssignmentToAutomaticVariable', 'input')]\n$LogFileComparisonValidationssb = { param ([string]$input) if ($input -in ('average', 'maximum')) { [PsCustomObject]@{Success = $true; value = $input } } else {\n        [PsCustomObject]@{Success = $false; message = \"must be average or maximum - $input\" }\n    } }\nRegister-PSFConfigValidation -Name validation.LogFileComparisonValidations -ScriptBlock $LogFileComparisonValidationssb\n$EmailValidationSb = {\n    param ([string]$input)\n    $EmailRegEx = \"^\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$\"\n    if (($input -match $EmailRegEx) -or -not ($input) ) {\n        [PsCustomObject]@{Success = $true; value = $input }\n    } else {\n        [PsCustomObject]@{Success = $false; message = \"does not appear to be an email address - $input\" }\n    }\n}\nRegister-PSFConfigValidation -Name validation.EmailValidation -ScriptBlock $EmailValidationSb\n\n$__dbachecksNotv5 = 'ADUser', 'BuiltInAdmin', 'EngineServiceAdmin', 'FullTextServiceAdmin', 'LocalWindowsGroup', 'PublicPermission', 'SqlBrowserServiceAccount', 'TempDbConfiguration','CertificateExpiration', 'DatabaseExists', 'DatabaseGrowthEvent',  'DatafileAutoGrowthType', 'DisabledIndex', 'DuplicateIndex', 'FileGroupBalanced', 'FutureFileGrowth', 'IdentityUsage', 'LastDiffBackup', 'LastFullBackup', 'LastGoodCheckDb', 'LastLogBackup', 'LogfilePercentUsed', 'LogfileSize', 'MaxDopDatabase', 'OrphanedUser', 'SymmetricKeyEncryptionLevel', 'TestLastBackup', 'TestLastBackupVerifyOnly', 'UnusedIndex', 'PowerPlan', 'SPN', 'DiskCapacity', 'PingComputer', 'CPUPrioritisation', 'DiskAllocationUnit', 'NonStandardPort', 'ServerProtocol', 'OlaInstalled', 'SystemFull', 'UserFull', 'UserDiff', 'UserLog', 'CommandLog', 'SystemIntegrityCheck', 'UserIntegrityCheck', 'UserIndexOptimize', 'OutputFileCleanup', 'DeleteBackupHistory', 'PurgeJobHistory', 'DomainName', 'OrganizationalUnit', 'ClusterHealth', 'LogShippingPrimary', 'LogShippingSecondary'\n\nSet-PSFConfig -Module dbachecks -Name checks.notv5ready -Value @($__dbachecksNotv5) -Initialize -Description \"Checks that have not been converted to v5 yet\"\n\n\n# some configs to help with autocompletes and other module level stuff\n#apps\n$defaultRepo = Join-Path -Path $script:ModuleRoot -ChildPath checks\nSet-PSFConfig -Module dbachecks -Name app.checkrepos -Value @($defaultRepo) -Initialize -Description \"Where Pester tests/checks are stored\"\nSet-PSFConfig -Module dbachecks -Name app.sqlinstance -Value $null -Initialize -Description \"List of SQL Server instances that SQL-based tests will run against\"\nSet-PSFConfig -Module dbachecks -Name app.computername -Value $null -Initialize -Description \"List of Windows Servers that Windows-based tests will run against\"\nSet-PSFConfig -Module dbachecks -Name app.sqlcredential -Value $null -Initialize -Description \"The universal SQL credential if Trusted/Windows Authentication is not used\"\nSet-PSFConfig -Module dbachecks -Name app.wincredential -Value $null -Initialize -Description \"The universal Windows if default Windows Authentication is not used\"\n\nif ($IsLinux) {\n    Set-PSFConfig -Module dbachecks -Name app.localapp -Value \"$home/dbachecks\" -Initialize -Description \"Persisted files live here\"\n    Set-PSFConfig -Module dbachecks -Name app.maildirectory -Value \"$home/dbachecks/dbachecks.mail\" -Initialize -Description \"Files for mail are stored here\"\n} else {\n    Set-PSFConfig -Module dbachecks -Name app.localapp -Value \"$env:localappdata\\dbachecks\" -Initialize -Description \"Persisted files live here\"\n    Set-PSFConfig -Module dbachecks -Name app.maildirectory -Value \"$env:localappdata\\dbachecks\\dbachecks.mail\" -Initialize -Description \"Files for mail are stored here\"\n}\n\nSet-PSFConfig -Module dbachecks -Name app.cluster -Value $null -Initialize -Description \"One host name for each cluster for the HADR checks\"\n\n# Policy Configs\n\n#instance\nSet-PSFConfig -Module dbachecks -Name policy.instance.sqlenginestart -Value 'Automatic' -Initialize -Description \"The expected start type of the SQL Engine Service - Automatic, Manual, Disabled - Defaults to Automatic\"\nSet-PSFConfig -Module dbachecks -Name policy.instance.sqlenginestate -Value 'Running' -Initialize -Description \"The expected state of the SQL Engine Service - Running, Stopped - Defaults to Running\"\nSet-PSFConfig -Module dbachecks -Name policy.instance.memorydumpsdaystocheck -Value $null -Initialize -Description \"The number of days to go back and check for memory dumps\"\n\n#Storage\nSet-PSFConfig -Module dbachecks -Name policy.storage.backuppath -Value $null -Initialize -Description \"Enables tests to check if servers have access to centralized backup location\"\n\n#Backup\nSet-PSFConfig -Module dbachecks -Name policy.backup.testserver -Value $null -Initialize -Description \"Destination server for backuptests\"\nSet-PSFConfig -Module dbachecks -Name policy.backup.datadir -Value $null -Initialize -Description \"Destination server data directory\"\nSet-PSFConfig -Module dbachecks -Name policy.backup.logdir -Value $null -Initialize -Description \"Destination server log directory\"\nSet-PSFConfig -Module dbachecks -Name policy.backup.fullmaxdays -Value 7 -Initialize -Description \"Maximum number of days before Full Backups are considered outdated\"\nSet-PSFConfig -Module dbachecks -Name policy.backup.diffmaxhours -Value 25 -Initialize -Description \"Maximum number of hours before Diff Backups are considered outdated\"\nSet-PSFConfig -Module dbachecks -Name policy.backup.logmaxminutes -Value 15 -Initialize -Description \"Maximum number of minutes before Log Backups are considered outdated\"\nSet-PSFConfig -Module dbachecks -Name policy.backup.newdbgraceperiod -Value 0 -Initialize -Description \"The number of hours a newly created database is allowed to not have backups\"\nSet-PSFConfig -Module dbachecks -Name policy.backup.defaultbackupcompression -Validation bool -Value $true -Initialize -Description \"Default Backup Compression should be enabled `$true or disabled `$false\"\nSet-PSFConfig -Module dbachecks -Name policy.security.clrenabled -Validation bool -Value $false -Initialize -Description \"CLR Enabled should be enabled `$true or disabled `$false\"\nSet-PSFConfig -Module dbachecks -Name policy.security.crossdbownershipchaining -Validation bool -Value $false -Initialize -Description \"Cross Database Ownership Chaining should be disabled `$false\"\nSet-PSFConfig -Module dbachecks -Name policy.security.databasemailenabled -Validation bool -Value $false -Initialize -Description \"Database Mail XPs should be enabled `$true or disabled `$false\"\nSet-PSFConfig -Module dbachecks -Name policy.security.adhocdistributedqueriesenabled -Validation bool -Value $false -Initialize -Description \"Ad Hoc Distributed Queries should be enabled `$true or disabled `$false\"\nSet-PSFConfig -Module dbachecks -Name policy.security.xpcmdshelldisabled -Validation bool -Value $true -Initialize -Description \"XP CmdShell should be disabled `$true or enabled `$false\"\nSet-PSFConfig -Module dbachecks -Name policy.security.oleautomationproceduresdisabled -Validation bool -Value $true -Initialize -Description \"OLE Automation Procedures should be disabled `$false\"\nSet-PSFConfig -Module dbachecks -Name policy.security.remoteaccessdisabled -Value 0 -Initialize -Description \"Remote Access should be disabled 0\"\nSet-PSFConfig -Module dbachecks -Name policy.security.scanforstartupproceduresdisabled -Validation bool -Value $true -Initialize -Description \"Scan For Startup Procedures disabled `$true or enabled `$false\"\nSet-PSFConfig -Module dbachecks -Name policy.security.latestbuild -Validation bool -Value $true -Initialize -Description \"SQL Server should have the latest SQL build (service packs/CUs) installed\"\nSet-PSFConfig -Module dbachecks -Name policy.security.containedbautoclose -Validation bool -Value $false -Initialize -Description \"Contained databases should have auto close enabled\"\n\n#diskspce\nSet-PSFConfig -Module dbachecks -Name policy.diskspace.percentfree -Value 20 -Initialize -Description \"Percent disk free\"\n\n#DBCC\nSet-PSFConfig -Module dbachecks -Name policy.dbcc.maxdays -Value 7 -Initialize -Description \"Maximum number of days before DBCC CHECKDB is considered outdated\"\n\n#Encryption\nSet-PSFConfig -Module dbachecks -Name policy.certificateexpiration.excludedb -Value @('master', 'msdb', 'model', 'tempdb') -Initialize -Description \"Databases to exclude from expired certificate checks\"\nSet-PSFConfig -Module dbachecks -Name policy.certificateexpiration.warningwindow -Value 1 -Initialize -Description \"The number of months prior to a certificate being expired that you want warning about\"\n\n#Identity\nSet-PSFConfig -Module dbachecks -Name policy.identity.usagepercent -Value 90 -Initialize -Description \"Maximum percentage of max of identity column\"\n\n#Network\nSet-PSFConfig -Module dbachecks -Name policy.network.latencymaxms -Value 40 -Initialize -Description \"Max network latency average\"\n\n#Recovery Model\nSet-PSFConfig -Module dbachecks -Name policy.recoverymodel.type -Value \"Full\" -Initialize -Description \"Standard recovery model\"\nSet-PSFConfig -Module dbachecks -Name policy.recoverymodel.excludedb -Value @('master', 'tempdb') -Initialize -Description \"Databases to exclude from standard recovery model check\"\n\n#Logins\nSet-PSFConfig -Module dbachecks -Name policy.adloginuser.excludecheck -Value \"\" -Initialize -Description \"Active Directory User logins to exclude from test.\"\nSet-PSFConfig -Module dbachecks -Name policy.adlogingroup.excludecheck -Value \"\" -Initialize -Description \"Active Directory Groups logins to exclude from test.\"\n\n#DBOwners\nSet-PSFConfig -Module dbachecks -Name policy.validdbowner.name -Value \"sa\" -Initialize -Description \"The database owner account should be this user\"\nSet-PSFConfig -Module dbachecks -Name policy.validdbowner.excludedb -Value @('master', 'msdb', 'model', 'tempdb') -Initialize -Description \"Databases to exclude from valid dbowner checks\"\nSet-PSFConfig -Module dbachecks -Name policy.invaliddbowner.name -Value \"sa\" -Initialize -Description \"The database owner account should not be this user\"\nSet-PSFConfig -Module dbachecks -Name policy.invaliddbowner.excludedb -Value @('master', 'msdb', 'model', 'tempdb') -Initialize -Description \"Databases to exclude from invalid dbowner checks\"\n\n#Error Log\nSet-PSFConfig -Module dbachecks -Name policy.errorlog.warningwindow -Value 2 -Initialize -Description \"The number of days prior to check for error log issues\"\nSet-PSFConfig -Module dbachecks -Name policy.errorlog.logcount -Value -1 -Initialize -Description \"The minimum number of error log files that should be configured. -1 means off/default\"\n\n#DAC\nSet-PSFConfig -Module dbachecks -Name policy.dacallowed -Validation bool -Value $true -Initialize -Description \"DAC should be allowed `$true or disallowed `$false\"\n\n#OLE Automation\nSet-PSFConfig -Module dbachecks -Name policy.oleautomation -Validation bool -Value $false -Initialize -Description \"OLE Automation should be enabled `$true or disabled `$false\"\n\n#Two Digit Year Cutoff\nSet-PSFConfig -Module dbachecks -Name policy.twodigityearcutoff -Value 2049 -Initialize -Description \"The value for 'Two Digit Year Cutoff' configuration. Default is 2049. \"\n\n#Connectivity\nSet-PSFConfig -Module dbachecks -Name policy.connection.authscheme -Value \"Kerberos\" -Initialize -Description \"Auth requirement (Kerberos, NTLM, etc)\"\nSet-PSFConfig -Module dbachecks -Name policy.connection.pingmaxms -Value 10 -Initialize -Description \"Maximum response time in ms\"\nSet-PSFConfig -Module dbachecks -Name policy.connection.pingcount -Value 3 -Initialize -Description \"Number of times to ping a server to establish average response time\"\n\n#HADR\nSet-PSFConfig -Module dbachecks -Name policy.hadr.agtcpport -Value \"\" -Initialize -Description \"The TCPPort for the HADR listener check\"\nSet-PSFConfig -Module dbachecks -Name policy.hadr.tcpport -Value \"1433\" -Initialize -Description \"The TCPPort for the HADR replica check\"\nSet-PSFConfig -Module dbachecks -Name policy.hadr.endpointname -Value \"Hadr_Endpoint\" -Initialize -Description \"The name for the HADR Endpoint check\"\nSet-PSFConfig -Module dbachecks -Name policy.hadr.endpointport -Value 5022 -Initialize -Description \"The TCPPort for the HADR endpoint check\"\nSet-PSFConfig -Module dbachecks -Name policy.hadr.failureconditionlevel -Value 3 -Initialize -Description \"Availability Group flexible automatic failover policy for the HADR cluster check\"\nSet-PSFConfig -Module dbachecks -Name policy.hadr.healthchecktimeout -Value 30000 -Initialize -Description \"Availability Group healthcheck timeout for the HADR cluster check\"\nSet-PSFConfig -Module dbachecks -Name policy.hadr.leasetimeout -Value 20000 -Initialize -Description \"Availability Group Lease timeout for the HADR cluster check\"\nSet-PSFConfig -Module dbachecks -Name policy.hadr.sessiontimeout -Value 10 -Initialize -Description \"Availability Group Replica Session timeout for the HADR replica check\"\nSet-PSFConfig -Module dbachecks -Name policy.cluster.NetworkProtocolsIPV4 -Value @('Internet Protocol Version 4 (TCP/IPv4)', 'Client for Microsoft Networks', 'File and Printer Sharing for Microsoft Networks') -Initialize -Description \"Minimum Private Cluster Network protocols for the HADR Cluster check\"\nSet-PSFConfig -Module dbachecks -Name policy.cluster.hostrecordttl -Value 1200 -Initialize -Description \"Cluster Network Resource - HostRecordTTL for the HADR Cluster check\"\nSet-PSFConfig -Module dbachecks -Name policy.cluster.registerallprovidersIP -Value 0 -Initialize -Description \"Cluster Network Resource - RegisterAllProvidersIP for the HADR Cluster check\"\n\n#Dump Files\nSet-PSFConfig -Module dbachecks -Name policy.dump.maxcount -Value 1 -Initialize -Description \"Maximum number of expected dumps\"\n\n#pageverify\n#TODO: Only 2 part name - should we fix this?\nSet-PSFConfig -Module dbachecks -Name policy.pageverify -Value \"Checksum\" -Initialize -Description \"Page verify option should be set to this value\"\n\n# InstanceMaxDop\nSet-PSFConfig -Module dbachecks -Name policy.instancemaxdop.userecommended -Value $false -Initialize -Description \"Use the recommendation from Test-DbaMaxDop to test the Max DOP settings - If set to false the value in policy.instancemaxdop.maxdop is used\"\nSet-PSFConfig -Module dbachecks -Name policy.instancemaxdop.maxdop -Value 0 -Initialize -Description \"The value for the Instance Level MaxDop Settings we expect\"\nSet-PSFConfig -Module dbachecks -Name policy.instancemaxdop.excludeinstance -Value @() -Initialize -Description \"Any Instances to exclude from checking Instance Level MaxDop - Useful if your estate contains SQL instances supporting Sharepoint for example\"\n\n# Database\nSet-PSFConfig -Module dbachecks -Name policy.database.autoclose -Validation bool -Value $false -Initialize -Description \"Auto Close should be allowed `$true or disallowed `$false\"\nSet-PSFConfig -Module dbachecks -Name policy.database.autoshrink -Validation bool -Value $false -Initialize -Description \"Auto Shrink should be allowed `$true or disallowed `$false\"\nSet-PSFConfig -Module dbachecks -Name policy.database.maxvlf -Value 512 -Initialize -Description \"Max virtual log files\"\nSet-PSFConfig -Module dbachecks -Name policy.database.autocreatestatistics -Validation bool -Value $true -Initialize -Description \"Auto Create Statistics should be enabled `$true or disabled `$false\"\nSet-PSFConfig -Module dbachecks -Name policy.database.autoupdatestatistics -Validation bool -Value $true -Initialize -Description \"Auto Update Statistics should be enabled `$true or disabled `$false\"\nSet-PSFConfig -Module dbachecks -Name policy.database.autoupdatestatisticsasynchronously -Validation bool -Value $false -Initialize -Description \"Auto Update Statistics Asynchronously should be enabled `$true or disabled `$false\"\nSet-PSFConfig -Module dbachecks -Name policy.database.filegrowthexcludedb -Value @() -Initialize -Description \"Databases to exclude from the file growth check\"\nSet-PSFConfig -Module dbachecks -Name policy.database.filegrowthtype -Value \"kb\" -Initialize -Description \"Growth Type should be 'kb' or 'percent'\"\nSet-PSFConfig -Module dbachecks -Name policy.database.filegrowthvalue -Value 65535 -Initialize -Description \"The auto growth value (in kb) should be equal or higher than this value. Example: A value of 65535 means at least 64MB. \"\nSet-PSFConfig -Module dbachecks -Name policy.database.logfilecount -Value 1 -Initialize -Description \"The number of Log files expected on a database\"\nSet-PSFConfig -Module dbachecks -Name policy.database.logfilesizepercentage -Value 100 -Initialize -Description \"Maximum percentage of Data file Size that logfile is allowed to be.\"\nSet-PSFConfig -Module dbachecks -Name policy.database.logfilesizecomparison -Validation validation.logfilecomparisonvalidations -Value 'average' -Initialize -Description \"How to compare data and log file size, options are maximum or average\"\nSet-PSFConfig -Module dbachecks -Name policy.database.filebalancetolerance -Value 5 -Initialize -Description \"Percentage for Tolerance for checking for balanced files in a filegroups\"\nSet-PSFConfig -Module dbachecks -Name policy.database.filegrowthfreespacethreshold -Value 20 -Initialize -Description \"Integer representing percentage of free space within a database file before warning\"\nSet-PSFConfig -Module dbachecks -Name policy.database.wrongcollation -Value @('ReportingServer', 'ReportingServerTempDB') -Initialize -Description \"Databases that doesnt match server collation check\"\nSet-PSFConfig -Module dbachecks -Name policy.database.maxdopexcludedb -Value @() -Initialize -Description \"Database Names that we don't want to check for maxdop\"\nSet-PSFConfig -Module dbachecks -Name policy.database.maxdop -Value 0 -Initialize -Description \"The value for the database maxdop that we expect\"\nSet-PSFConfig -Module dbachecks -Name policy.database.status.excludereadonly -Value @() -Initialize -Description \"Database names that we expect to be readonly\"\nSet-PSFConfig -Module dbachecks -Name policy.database.status.excludeoffline -Value @() -Initialize -Description \"Database names that we expect to be offline\"\nSet-PSFConfig -Module dbachecks -Name policy.database.status.excluderestoring -Value @() -Initialize -Description \"Database names that we expect to be restoring\"\nSet-PSFConfig -Module dbachecks -Name database.querystoreenabled.excludedb -Value @('model', 'tempdb', 'master') -Initialize -Description \"A List of databases that we do not want to check for Query Store enabled\"\nSet-PSFConfig -Module dbachecks -Name database.querystoredisabled.excludedb -Value @('model', 'tempdb', 'master') -Initialize -Description \"A List of databases that we do not want to check for Query Store disabled\"\nSet-PSFConfig -Module dbachecks -Name database.compatibilitylevel.excludedb -Value @() -Initialize -Description \"A list of databases that we do not want to check compatibility level\"\nSet-PSFConfig -Module dbachecks -Name database.guestuser.excludedb -Value @('master', 'tempdb', 'msdb') -Initialize -Description \"A list of databases that we do not want to check guest user connect permissions for\"\n\nSet-PSFConfig -Module dbachecks -Name policy.database.filegrowthdaystocheck -Value $null -Initialize -Description \"The number of days to go back to check for growth events\"\nSet-PSFConfig -Module dbachecks -Name policy.database.trustworthyexcludedb -Value @('msdb') -Initialize -Description \"A List of databases that we do not want to check for Trustworthy being on\"\nSet-PSFConfig -Module dbachecks -Name policy.database.duplicateindexexcludedb -Value @('msdb', 'ReportServer', 'ReportServerTempDB') -Initialize -Description \"A List of databases we do not want to check for Duplicate Indexes\"\nSet-PSFConfig -Module dbachecks -Name policy.database.clrassembliessafeexcludedb -Value @() -Initialize -Description \" A List of database what we do not want to check for SAFE CLR Assemblies\"\nSet-PSFConfig -Module dbachecks -Name policy.database.pseudosimpleexcludedb -Value @('tempdb', 'model') -Initialize -Description \"A List of databases that we do not want to check for pseudosimple recovery modelasd a\"\nSet-PSFConfig -Module dbachecks -Name policy.database.contdbautocloseexclude -Value @('msdb') -Initialize -Description \"A List of contained database that we we do not want to check for autoclose\"\nSet-PSFConfig -Module dbachecks -Name policy.database.contdbsqlauthexclude -Value @() -Initialize -Description \"A list of databases that we do not want to check for contained databases with SQL authenticated users\"\nSet-PSFConfig -Module dbachecks -Name policy.database.logfilepercentused -Value 75 -Initialize -Description \" The % log used we should stay below\"\n\n# Policy for Ola Hallengren Maintenance Solution\nSet-PSFConfig -Module dbachecks -Name policy.ola.installed -Validation bool -Value $true -Initialize -Description \"Checks to see if Ola Hallengren solution is installed\"\nSet-PSFConfig -Module dbachecks -Name policy.ola.database -Validation string -Value 'master' -Initialize -Description \"The database where Ola's maintenance solution is installed\"\nSet-PSFConfig -Module dbachecks -Name policy.ola.systemfullenabled -Validation bool -Value $true -Initialize -Description \"Ola's Full System Database Backup should be enabled `$true or disabled `$false\"\nSet-PSFConfig -Module dbachecks -Name policy.ola.userfullenabled -Validation bool -Value $true -Initialize -Description \"Ola's Full User Database Backup should be enabled `$true or disabled `$false\"\nSet-PSFConfig -Module dbachecks -Name policy.ola.userdiffenabled -Validation bool -Value $true -Initialize -Description \"Ola's Diff User Database Backup should be enabled `$true or disabled `$false\"\nSet-PSFConfig -Module dbachecks -Name policy.ola.userlogenabled -Validation bool -Value $true -Initialize -Description \"Ola's Log User Database Backup should be enabled `$true or disabled `$false\"\nSet-PSFConfig -Module dbachecks -Name policy.ola.systemfullscheduled -Validation bool -Value $true -Initialize -Description \"Ola's Full System Database Backup should be scheduled `$true or disabled `$false\"\nSet-PSFConfig -Module dbachecks -Name policy.ola.userfullscheduled -Validation bool -Value $true -Initialize -Description \"Ola's Full User Database Backup should be scheduled `$true or disabled `$false\"\nSet-PSFConfig -Module dbachecks -Name policy.ola.userdiffscheduled -Validation bool -Value $true -Initialize -Description \"Ola's Diff User Database Backup should be scheduled `$true or disabled `$false\"\nSet-PSFConfig -Module dbachecks -Name policy.ola.userlogscheduled -Validation bool -Value $true -Initialize -Description \"Ola's Log User Database Backup should be scheduled `$true or disabled `$false\"\nSet-PSFConfig -Module dbachecks -Name policy.ola.systemfullretention -Value 192 -Initialize -Description \"Ola's Full System Database Backup retention number of hours\"\nSet-PSFConfig -Module dbachecks -Name policy.ola.userfullretention -Value 192 -Initialize -Description \"Ola's Full User Database Backup retention number of hours\"\nSet-PSFConfig -Module dbachecks -Name policy.ola.userdiffretention -Value 192 -Initialize -Description \"Ola's Diff User Database Backup retention number of hours\"\nSet-PSFConfig -Module dbachecks -Name policy.ola.userlogretention -Value 192 -Initialize -Description \"Ola's Log User Database Backup retention number of hours\"\nSet-PSFConfig -Module dbachecks -Name policy.ola.CommandLogenabled -Validation bool -Value $true -Initialize -Description \"Ola's CommandLog Cleanup should be enabled `$true or disabled `$false\"\nSet-PSFConfig -Module dbachecks -Name policy.ola.CommandLogscheduled -Validation bool -Value $true -Initialize -Description \"Ola's CommandLog Cleanup should be scheduled `$true or disabled `$false\"\nSet-PSFConfig -Module dbachecks -Name policy.ola.CommandLogCleanUp -Value 30 -Initialize -Description \"Ola's CommandLog Cleanup setting should be this many days\"\nSet-PSFConfig -Module dbachecks -Name policy.ola.SystemIntegrityCheckenabled -Validation bool -Value $true -Initialize -Description \"Ola's System Database Integrity should be enabled `$true or disabled `$false\"\nSet-PSFConfig -Module dbachecks -Name policy.ola.SystemIntegrityCheckscheduled -Validation bool -Value $true -Initialize -Description \"Ola's System Database Integrity should be scheduled `$true or disabled `$false\"\nSet-PSFConfig -Module dbachecks -Name policy.ola.UserIntegrityCheckenabled -Validation bool -Value $true -Initialize -Description \"Ola's User Database Integrity should be enabled `$true or disabled `$false\"\nSet-PSFConfig -Module dbachecks -Name policy.ola.UserIntegrityCheckscheduled -Validation bool -Value $true -Initialize -Description \"Ola's User Database Integrity should be scheduled `$true or disabled `$false\"\nSet-PSFConfig -Module dbachecks -Name policy.ola.UserIndexOptimizeenabled -Validation bool -Value $true -Initialize -Description \"Ola's User Index Optimization should be enabled `$true or disabled `$false\"\nSet-PSFConfig -Module dbachecks -Name policy.ola.UserIndexOptimizescheduled -Validation bool -Value $true -Initialize -Description \"Ola's User Index Optimization should be scheduled `$true or disabled `$false\"\nSet-PSFConfig -Module dbachecks -Name policy.ola.OutputFileCleanupenabled -Validation bool -Value $true -Initialize -Description \"Ola's Output File Cleanup should be enabled `$true or disabled `$false\"\nSet-PSFConfig -Module dbachecks -Name policy.ola.OutputFileCleanupscheduled -Validation bool -Value $true -Initialize -Description \"Ola's Output File Cleanup should be scheduled `$true or disabled `$false\"\nSet-PSFConfig -Module dbachecks -Name policy.ola.OutputFileCleanUp -Value 30 -Initialize -Description \"Ola's OutputFile Cleanup setting should be this many days\"\nSet-PSFConfig -Module dbachecks -Name policy.ola.DeleteBackupHistoryenabled -Validation bool -Value $true -Initialize -Description \"Ola's Delete Backup History should be enabled `$true or disabled `$false\"\nSet-PSFConfig -Module dbachecks -Name policy.ola.DeleteBackupHistoryscheduled -Validation bool -Value $true -Initialize -Description \"Ola's Delete Backup History should be scheduled `$true or disabled `$false\"\nSet-PSFConfig -Module dbachecks -Name policy.ola.DeleteBackupHistoryCleanUp -Value 30 -Initialize -Description \"Ola's Delete Backup History Cleanup setting should be this many days\"\nSet-PSFConfig -Module dbachecks -Name policy.ola.PurgeJobHistoryenabled -Validation bool -Value $true -Initialize -Description \"Ola's Purge Job History should be enabled `$true or disabled `$false\"\nSet-PSFConfig -Module dbachecks -Name policy.ola.PurgeJobHistoryscheduled -Validation bool -Value $true -Initialize -Description \"Ola's Purge Job History should be scheduled `$true or disabled `$false\"\nSet-PSFConfig -Module dbachecks -Name policy.ola.PurgeJobHistoryCleanUp -Value 30 -Initialize -Description \"Ola's Purge Backup History Cleanup setting should be this many days\"\nSet-PSFConfig -Module dbachecks -Name ola.JobName.SystemFull -Value 'DatabaseBackup - SYSTEM_DATABASES - FULL' -Initialize -Description \"The name for the Ola System Full Job\"\nSet-PSFConfig -Module dbachecks -Name ola.JobName.UserFull -Value 'DatabaseBackup - USER_DATABASES - FULL' -Initialize -Description \"The name for the Ola User Full Job\"\nSet-PSFConfig -Module dbachecks -Name ola.JobName.UserDiff -Value 'DatabaseBackup - USER_DATABASES - DIFF' -Initialize -Description \"The name for the Ola User Diff Job\"\nSet-PSFConfig -Module dbachecks -Name ola.JobName.UserLog -Value 'DatabaseBackup - USER_DATABASES - Log' -Initialize -Description \"The name for the Ola User Log Job\"\nSet-PSFConfig -Module dbachecks -Name ola.JobName.CommandLogCleanup -Value 'CommandLog Cleanup' -Initialize -Description \"The name for the Ola CommandLog Cleanup Job\"\nSet-PSFConfig -Module dbachecks -Name ola.JobName.SystemIntegrity -Value 'DatabaseIntegrityCheck - SYSTEM_DATABASES' -Initialize -Description \"The name for the Ola System Integrity Job\"\nSet-PSFConfig -Module dbachecks -Name ola.JobName.UserIntegrity -Value 'DatabaseIntegrityCheck - USER_DATABASES' -Initialize -Description \"The name for the Ola User Integrity Job\"\nSet-PSFConfig -Module dbachecks -Name ola.JobName.UserIndex -Value 'IndexOptimize - USER_DATABASES' -Initialize -Description \"The name for the Ola User Index Job\"\nSet-PSFConfig -Module dbachecks -Name ola.JobName.OutputFileCleanup -Value 'Output File Cleanup' -Initialize -Description \"The name for the Ola Output File Cleanup Job\"\nSet-PSFConfig -Module dbachecks -Name ola.JobName.DeleteBackupHistory -Value 'sp_delete_backuphistory' -Initialize -Description \"The name for the Ola Delete Backup History Job\"\nSet-PSFConfig -Module dbachecks -Name ola.JobName.PurgeBackupHistory -Value 'sp_purge_jobhistory' -Initialize -Description \"The name for the Ola Delete Purge History Job\"\n\n# xevents\nSet-PSFConfig -Module dbachecks -Name policy.xevent.requiredexists -Value $null -Initialize -Description \"List of XE Sessions that should exist. This does not check if they are running\"\nSet-PSFConfig -Module dbachecks -Name policy.xevent.validrunningsession -Value $null -Initialize -Description \"List of XE Sessions that can be be running.\"\nSet-PSFConfig -Module dbachecks -Name policy.xevent.requiredrunningsession -Value $null -Initialize -Description \"List of XE Sessions that should be running.\"\nSet-PSFConfig -Module dbachecks -Name policy.xevent.requiredstoppedsession -Value $null -Initialize -Description \"List of XE Sessions that should not be running.\"\n\n# sp_WhoIsActive\nSet-PSFConfig -Module dbachecks -Name policy.whoisactive.database -Value \"master\" -Initialize -Description \"Which database should contain the sp_WhoIsActive stored procedure\"\n\n#Build\nSet-PSFConfig -Module dbachecks -Name policy.build.warningwindow -Value 6 -Initialize -Description \"The number of months prior to a build being unsupported that you want warning about\"\nSet-PSFConfig -Module dbachecks -Name policy.build.behind -Value $null -Initialize -Description \"The max number of service packs or cumulative updates a build can be behind by (ex. 1SP or 3CU). Null by default.\"\n\n# The frequency of the Ola Hallengrens User Full backups\n# See https://msdn.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.agent.jobschedule.frequencyinterval.aspx\n# for full options\n# 1 for Sunday 127 for every day\n\n# exclude databases\nSet-PSFConfig -Module dbachecks -Name policy.asymmetrickeysize.excludedb -Value @('master', 'msdb', 'tempdb') -Initialize -Description \"Databases to exclude from asymmetric key size checks\"\nSet-PSFConfig -Module dbachecks -Name policy.autoclose.excludedb -Value @() -Initialize -Description \"Databases to exclude from autoclose key size checks\"\nSet-PSFConfig -Module dbachecks -Name policy.autoshrink.excludedb -Value @() -Initialize -Description \"Databases to exclude from autoclose key size checks\"\nSet-PSFConfig -Module dbachecks -Name policy.vlf.excludedb -Value @('master', 'msdb', 'tempdb', 'model') -Initialize -Description \"Databases to exclude from asymmetric key size checks\"\nSet-PSFConfig -Module dbachecks -Name policy.logfilecount.excludedb -Value @() -Initialize -Description \"Databases to exclude from log file count checks\"\nSet-PSFConfig -Module dbachecks -Name policy.autocreatestats.excludedb -Value @() -Initialize -Description \"Databases to exclude from the auto create stats checks\"\nSet-PSFConfig -Module dbachecks -Name policy.autoupdatestats.excludedb -Value @() -Initialize -Description \"Databases to exclude from the auto update stats checks\"\nSet-PSFConfig -Module dbachecks -Name policy.autoupdatestatisticsasynchronously.excludedb -Value @() -Initialize -Description \"Databases to exclude from the auto update stats asynchronously checks\"\nSet-PSFConfig -Module dbachecks -Name policy.database.statusexcludedb -Value @() -Initialize -Description \"Databases to exclude from the database status checks\"\nSet-PSFConfig -Module dbachecks -Name policy.database.symmetrickeyencryptionlevelexcludedb -Value @('master', 'msdb', 'tempdb') -Initialize -Description \"Databases to exclude from the Symmetric Key Encryption Level checks\"\nSet-PSFConfig -Module dbachecks -Name policy.database.fkcktrustedexclude -Value @() -Initialize -Description \"Databases to exclude from the foreign key and constraints trusted checks\"\n\n\n\n# skips - these are for whole checks that should not run by default or internal commands that can't be skipped using ExcludeTag\n# instance\nSet-PSFConfig -Module dbachecks -Name skip.instance.memorydump -Validation bool -Value $false -Initialize -Description \"Skip the memory dump check\"\nSet-PSFConfig -Module dbachecks -Name skip.instance.modeldbgrowth -Validation bool -Value $false -Initialize -Description \"Skip the model database growth settings check\"\nSet-PSFConfig -Module dbachecks -Name skip.instance.defaulttrace -Validation bool -Value $false -Initialize -Description \"Skip the default trace check\"\nSet-PSFConfig -Module dbachecks -Name skip.instance.dac -Validation bool -Value $false -Initialize -Description \"Skip Dedicated Administrator Connection (DAC) check\"\nSet-PSFConfig -Module dbachecks -Name skip.instance.CrossDBOwnershipChaining -Validation bool -Value $false -Initialize -Description \"Skip Cross Database Ownership Chaining check\"\nSet-PSFConfig -Module dbachecks -Name skip.instance.SQLMailXPsDisabled -Validation bool -Value $false -Initialize -Description \"Skip SQL Mail XPs Disabled check\"\nSet-PSFConfig -Module dbachecks -Name skip.instance.oleautomation -Validation bool -Value $false -Initialize -Description \"Skip OLE Automation check\"\nSet-PSFConfig -Module dbachecks -Name skip.instance.oleautomationproceduresdisabled -Validation bool -Value $false -Initialize -Description \"Skip OLE Automation Procedures check\"\nSet-PSFConfig -Module dbachecks -Name skip.instance.remoteaccessdisabled -Validation bool -Value $false -Initialize -Description \"Skip the remote access check\"\nSet-PSFConfig -Module dbachecks -Name skip.instance.scanforstartupproceduresdisabled -Validation bool -Value $false -Initialize -Description \"Skip the scan for startup procedures disabled check\"\nSet-PSFConfig -Module dbachecks -Name skip.instance.latestbuild -Validation bool -Value $false -Initialize -Description \"Skip the scan the latest build of SQL Server check\"\nSet-PSFConfig -Module dbachecks -Name skip.instance.suspectpagelimit -Validation bool -Value $false -Initialize -Description \"Skip the check for whether the suspect_pages table is nearing the row limit of 1000\"\nSet-PSFConfig -Module dbachecks -Name skip.instance.AdHocWorkload -Validation bool -Value $false -Initialize -Description \"Skip the check for whether AdHocWorkload Optimization is enabled\"\nSet-PSFConfig -Module dbachecks -Name skip.instance.AdHocDistributedQueriesEnabled -Validation bool -Value $false -Initialize -Description \"Skip the check for whether AdHoc Distributed Queries Enabled settings\"\nSet-PSFConfig -Module dbachecks -Name skip.instance.DefaultFilePath -Validation bool -Value $false -Initialize -Description \"Skip the check for Default File Path\"\nSet-PSFConfig -Module dbachecks -Name skip.instance.SaRenamed -Validation bool -Value $false -Initialize -Description \"Skip the check for Sa Renamed\"\nSet-PSFConfig -Module dbachecks -Name skip.security.sadisabled -Validation bool -Value $true -Initialize -Description \"Skip the check for if the sa login is disabled\"\nSet-PSFConfig -Module dbachecks -Name skip.security.saexist -Validation bool -Value $true -Initialize -Description \"Skip the check for a login named sa does not exist\"\nSet-PSFConfig -Module dbachecks -Name skip.instance.DefaultBackupCompression -Validation bool -Value $false -Initialize -Description \"Skip the check for default backup compression\"\nSet-PSFConfig -Module dbachecks -Name skip.instance.ErrorLogCount -Validation bool -Value $false -Initialize -Description \"Skip the check for the number of Error Log Entries\"\nSet-PSFConfig -Module dbachecks -Name skip.instance.MaxDopInstance -Validation bool -Value $false -Initialize -Description \"Skip the check for the Max Dop Instance\"\nSet-PSFConfig -Module dbachecks -Name skip.instance.TwoDigitYearCutoff -Validation bool -Value $false -Initialize -Description \"Skip the check for the Two Digit Year Cut off setting\"\nSet-PSFConfig -Module dbachecks -Name skip.instance.TraceFlagsExpected -Validation bool -Value $false -Initialize -Description \"Skip the check for expected Trace Flags\"\nSet-PSFConfig -Module dbachecks -Name skip.instance.TraceFlagsNotExpected -Validation bool -Value $false -Initialize -Description \"Skip the check for not expected Trace Flags\"\nSet-PSFConfig -Module dbachecks -Name skip.instance.CLREnabled -Validation bool -Value $false -Initialize -Description \"Skip the check for CLR Enabled\"\nSet-PSFConfig -Module dbachecks -Name skip.instance.WhoIsActiveInstalled -Validation bool -Value $false -Initialize -Description \"Skip the check for whether WhoIsActive is Installed\"\nSet-PSFConfig -Module dbachecks -Name skip.instance.XpCmdShellDisabled -Validation bool -Value $false -Initialize -Description \"Skip the check for whether XpCmdShell is Disabled\"\nSet-PSFConfig -Module dbachecks -Name skip.instance.XESessionStopped -Validation bool -Value $false -Initialize -Description \"Skip the check for XESessions that are stopped\"\nSet-PSFConfig -Module dbachecks -Name skip.instance.XESessionRunning -Validation bool -Value $false -Initialize -Description \"Skip the check for XESessions that should be running\"\nSet-PSFConfig -Module dbachecks -Name skip.instance.XESessionRunningAllowed -Validation bool -Value $false -Initialize -Description \"Skip the check for XESessions that are allowed to be running\"\nSet-PSFConfig -Module dbachecks -Name skip.instance.errorlogentries -Validation bool -Value $false -Initialize -Description \"Skip the check for errorlog entries\"\nSet-PSFConfig -Module dbachecks -Name skip.instance.tempdb -Validation bool -Value $false -Initialize -Description \"Skip all the checks for the tempdb database\"\nSet-PSFConfig -Module dbachecks -Name skip.instance.BackupPathAccess -Validation bool -Value $false -Initialize -Description \"Skip the check for the backup path access check\"\nSet-PSFConfig -Module dbachecks -Name skip.instance.networklatency -Validation bool -Value $false -Initialize -Description \"Skip the check for network latency\"\nSet-PSFConfig -Module dbachecks -Name skip.instance.linkedserverconnection -Validation bool -Value $false -Initialize -Description \"Skip the check for linked server connection\"\nSet-PSFConfig -Module dbachecks -Name skip.instance.maxmemory -Validation bool -Value $false -Initialize -Description \"Skip the check for max memory\"\nSet-PSFConfig -Module dbachecks -Name skip.instance.orphanedfile -Validation bool -Value $false -Initialize -Description \"Skip the check for orphaned file\"\nSet-PSFConfig -Module dbachecks -Name skip.instance.servernamematch -Validation bool -Value $false -Initialize -Description \"Skip the check for server name match\"\nSet-PSFConfig -Module dbachecks -Name skip.instance.supportedbuild -Validation bool -Value $false -Initialize -Description \"Skip the checks for supported build\"\n# becuase we can't run this on core\nif ($IsCoreCLR) {\n    $value = $true\n} {\n    $value = $false\n}\nSet-PSFConfig -Module dbachecks -Name skip.instance.sqlengineserviceaccount -Validation bool -Value $value -Initialize -Description \"Skip the checks for sql engine service account\"\n\n\n\n\nSet-PSFConfig -Module dbachecks -Name skip.dbcc.datapuritycheck -Validation bool -Value $false -Initialize -Description \"Skip data purity check in last good dbcc command\"\nSet-PSFConfig -Module dbachecks -Name skip.backup.testing -Validation bool -Value $true -Initialize -Description \"Don't run Test-DbaLastBackup by default (it's not read-only)\"\nSet-PSFConfig -Module dbachecks -Name skip.backup.readonly -Validation bool -Value $false -Initialize -Description \"Check read-only databases for last backup\"\nSet-PSFConfig -Module dbachecks -Name skip.backup.secondaries -Validation bool -Value $false -Initialize -Description \"Check hadr secondary databases for last backup\"\nSet-PSFConfig -Module dbachecks -Name skip.tempdb1118 -Validation bool -Value $false -Initialize -Description \"Don't run test for Trace Flag 1118\"\nSet-PSFConfig -Module dbachecks -Name skip.tempdbfilecount -Validation bool -Value $false -Initialize -Description \"Don't run test for Temp Database File Count\"\nSet-PSFConfig -Module dbachecks -Name skip.tempdbfilegrowthpercent -Validation bool -Value $false -Initialize -Description \"Don't run test for Temp Database File Growth in Percent\"\nSet-PSFConfig -Module dbachecks -Name skip.tempdbfilesonc -Validation bool -Value $false -Initialize -Description \"Don't run test for Temp Database Files on C\"\nSet-PSFConfig -Module dbachecks -Name skip.tempdbfilesizemax -Validation bool -Value $false -Initialize -Description \"Don't run test for Temp Database Files Max Size\"\nSet-PSFConfig -Module dbachecks -Name skip.connection.remoting -Validation bool -Value $false -Initialize -Description \"Skip PowerShell remoting check for connectivity\"\nSet-PSFConfig -Module dbachecks -Name skip.connection.ping -Validation bool -Value $false -Initialize -Description \"Skip the ping check for connectivity\"\nSet-PSFConfig -Module dbachecks -Name skip.connection.auth -Validation bool -Value $false -Initialize -Description \"Skip the authenticaton scheme check for connectivity\"\nSet-PSFConfig -Module dbachecks -Name skip.connection -Validation bool -Value $false -Initialize -Description \"Skip the connection checks\"\nSet-PSFConfig -Module dbachecks -Name skip.datafilegrowthdisabled -Validation bool -Value $true -Initialize -Description \"Skip validation of datafiles which have growth value equal to zero.\"\nSet-PSFConfig -Module dbachecks -Name skip.logfilecounttest -Validation bool -Value $false -Initialize -Description \"Skip the logfilecount test\"\nSet-PSFConfig -Module dbachecks -Name skip.diffbackuptest -Validation bool -Value $false -Initialize -Description \"Skip the Differential backup test\"\nSet-PSFConfig -Module dbachecks -Name skip.database.filegrowthdisabled -Validation bool -Value $true -Initialize -Description \"Skip validation of datafiles which have growth value equal to zero.\"\nSet-PSFConfig -Module dbachecks -Name skip.database.logfilecounttest -Validation bool -Value $false -Initialize -Description \"Skip the logfilecount test\"\nSet-PSFConfig -Module dbachecks -Name skip.database.validdatabaseowner -Validation bool -Value $false -Initialize -Description \"Skip the valid database owner test\"\nSet-PSFConfig -Module dbachecks -Name skip.database.invaliddatabaseowner -Validation bool -Value $false -Initialize -Description \"Skip the invalid database owner test\"\nSet-PSFConfig -Module dbachecks -Name skip.database.databasecollation -Validation bool -Value $false -Initialize -Description \"Skip the database collation test\"\nSet-PSFConfig -Module dbachecks -Name skip.database.suspectpage -Validation bool -Value $false -Initialize -Description \"Skip the suspect pages test\"\nSet-PSFConfig -Module dbachecks -Name skip.database.autoclose -Validation bool -Value $false -Initialize -Description \"Skip the autoclose test\"\nSet-PSFConfig -Module dbachecks -Name skip.database.vlf -Validation bool -Value $false -Initialize -Description \"Skip the virtual log file test\"\nSet-PSFConfig -Module dbachecks -Name skip.database.autocreatestatistics -Validation bool -Value $false -Initialize -Description \"Skip the auto create statistics test\"\nSet-PSFConfig -Module dbachecks -Name skip.database.autoupdatestatistics -Validation bool -Value $false -Initialize -Description \"Skip the auto update statistics test\"\nSet-PSFConfig -Module dbachecks -Name skip.database.autoupdatestatisticsasynchronously -Validation bool -Value $false -Initialize -Description \"Skip the auto update statistics asynchronously test\"\nSet-PSFConfig -Module dbachecks -Name skip.database.trustworthy -Validation bool -Value $false -Initialize -Description \"Skip the trustworthy database test\"\nSet-PSFConfig -Module dbachecks -Name skip.database.status -Validation bool -Value $false -Initialize -Description \"Skip the database status test\"\nSet-PSFConfig -Module dbachecks -Name skip.database.compatibilitylevel -Validation bool -Value $false -Initialize -Description \"Skip the database compatibility test\"\nSet-PSFConfig -Module dbachecks -Name skip.database.recoverymodel -Validation bool -Value $false -Initialize -Description \"Skip the database recovery model test\"\nSet-PSFConfig -Module dbachecks -Name skip.database.pseudosimple -Validation bool -Value $false -Initialize -Description \"Skip the database PseudoSimple recovery model test\"\nSet-PSFConfig -Module dbachecks -Name skip.database.pageverify -Validation bool -Value $false -Initialize -Description \"Skip the database page verify test\"\nSet-PSFConfig -Module dbachecks -Name skip.database.fkcktrusted -Validation bool -Value $false -Initialize -Description \"Skip the check for foreign keys and constraints being trusted\"\n\nSet-PSFConfig -Module dbachecks -Name skip.logshiptesting -Validation bool -Value $false -Initialize -Description \"Skip the logshipping test\"\n\nSet-PSFConfig -Module dbachecks -Name skip.cluster.netclusterinterface -Validation bool -Value $false -Initialize -Description \"Skip cluster private network interface checks\"\nSet-PSFConfig -Module dbachecks -Name skip.hadr.listener.pingcheck -Validation bool -Value $false -Initialize -Description \"Skip the HADR listener ping test (especially useful for Azure and AWS)\"\nSet-PSFConfig -Module dbachecks -Name skip.hadr.listener.tcpport -Validation bool -Value $false -Initialize -Description \"Skip the HADR AG Listener TCP port number (If port number is not standard across the entire AG architecture)\"\nSet-PSFConfig -Module dbachecks -Name skip.hadr.replica.tcpport -Validation bool -Value $false -Initialize -Description \"Skip the HADR Replica TCP port number (If port number is not standard across the entire AG architecture)\"\nSet-PSFConfig -Module dbachecks -Name skip.hadr.listener.pingcheck -Validation bool -Value $false -Initialize -Description \"Skip the HADR listener ping test (especially useful for Azure and AWS)\"\n\nSet-PSFConfig -Module dbachecks -Name skip.agent.databasemailenabled -Validation bool -Value $false -Initialize -Description \"Skip the Database Mail Enabled agent check\"\nSet-PSFConfig -Module dbachecks -Name skip.agent.servicestartmode -Validation bool -Value $false -Initialize -Description \"Skip the Agent Service State check\"\nSet-PSFConfig -Module dbachecks -Name skip.agent.servicestate -Validation bool -Value $false -Initialize -Description \"Skip the Agent Service Start Mode check\"\nSet-PSFConfig -Module dbachecks -Name skip.agent.dbaoperatorname -Validation bool -Value $false -Initialize -Description \"Skip the Agent Operator Name check\"\nSet-PSFConfig -Module dbachecks -Name skip.agent.dbaoperatoremail -Validation bool -Value $false -Initialize -Description \"Skip the Agent Operator Email check\"\nSet-PSFConfig -Module dbachecks -Name skip.agent.failsafeoperator -Validation bool -Value $false -Initialize -Description \"Skip the Agent Failsafe Operator check\"\nSet-PSFConfig -Module dbachecks -Name skip.agent.databasemailprofile -Validation bool -Value $false -Initialize -Description \"Skip the Database Mail Profile check\"\nSet-PSFConfig -Module dbachecks -Name skip.agent.mailprofile -Validation bool -Value $false -Initialize -Description \"Skip the SQL Server Agent Mail Profile check\"\nSet-PSFConfig -Module dbachecks -Name skip.agent.longrunningjobs -Validation bool -Value $false -Initialize -Description \"Skip the long running agent jobs check\"\nSet-PSFConfig -Module dbachecks -Name skip.agent.lastjobruntime -Validation bool -Value $false -Initialize -Description \"Skip the last agent job time check\"\nSet-PSFConfig -Module dbachecks -Name skip.agent.jobowner -Validation bool -Value $false -Initialize -Description \"Skip the Agent Job Owner check\"\nSet-PSFConfig -Module dbachecks -Name skip.agent.invalidjobowner.name -Validation bool -Value $false -Initialize -Description \"Skip the Agent Job Invalid Owner check\"\nSet-PSFConfig -Module dbachecks -Name skip.agent.failedjobs -Validation bool -Value $false -Initialize -Description \"Skip the Agent Failed Jobs check\"\nSet-PSFConfig -Module dbachecks -Name skip.agent.JobHistory -Validation bool -Value $false -Initialize -Description \"Skip the Agent Job History check\"\n\n\n\nSet-PSFConfig -Module dbachecks -Name skip.security.containedbautoclose -Validation bool -Value $true -Initialize -Description \"Skips the scan for contained databases should have auto close enabled\"\nSet-PSFConfig -Module dbachecks -Name skip.security.sqlagentproxiesnopublicrole -Validation bool -Value $true -Initialize -Description \"Skips the scan for if the public role has access to SQL Agent proxies\"\nSet-PSFConfig -Module dbachecks -Name skip.security.symmetrickeyencryptionlevel -Validation bool -Value $true -Initialize -Description \"Skips the test for if the Symmetric Encryption is at least AES_128 or higher in non-system databases\"\nSet-PSFConfig -Module dbachecks -Name skip.security.asymmetrickeysize -Validation bool -Value $true -Initialize -Description \"Skips the test for the size of the Assymetric Key sizes being above 2048 in non-system databases\"\nSet-PSFConfig -Module dbachecks -Name skip.security.hideinstance -Validation bool -Value $true -Initialize -Description \"Skips the scan for if hide instance is set to YES on the instance\"\nSet-PSFConfig -Module dbachecks -Name skip.security.clrassembliessafe -Validation bool -Value $true -Initialize -Description \"Skips the scan for CLR Assemblies set to SAFE_ACCESS\"\nSet-PSFConfig -Module dbachecks -Name skip.security.engineserviceadmin -Validation bool -Value $true -Initialize -Description \"Skips the scan for the SQL Server Engine account is a local administrator\"\nSet-PSFConfig -Module dbachecks -Name skip.security.agentserviceadmin -Validation bool -Value $true -Initialize -Description \"Skips the scan for the SQL Server Agent account is a local administrator\"\nSet-PSFConfig -Module dbachecks -Name skip.security.fulltextserviceadmin -Validation bool -Value $true -Initialize -Description \"Skips the scan for the SQL Server Full Text account is a local administrator\"\nSet-PSFConfig -Module dbachecks -Name skip.security.querystoredisabled -Validation bool -Value $true -Initialize -Description \"Skips the check for if Query Store is disabled\"\nSet-PSFConfig -Module dbachecks -Name skip.security.querystoreenabled -Validation bool -Value $false -Initialize -Description \"Skips the check for if Query Store is enabled\"\nSet-PSFConfig -Module dbachecks -Name skip.security.loginauditlevelfailed -Validation bool -Value $true -Initialize -Description \"Skips the scan for if server login level records failed logins\"\nSet-PSFConfig -Module dbachecks -Name skip.security.loginauditlevelsuccessful -Validation bool -Value $true -Initialize -Description \"Skips the scan for if server login level records successful and failed logins\"\nSet-PSFConfig -Module dbachecks -Name skip.security.localwindowsgroup -Validation bool -Value $true -Initialize -Description \"Skips the scan for if local windows groups have SQL Logins\"\nSet-PSFConfig -Module dbachecks -Name skip.security.publicrolepermission -Validation bool -Value $true -Initialize -Description \"Skips the scan for if the public server role has permissions\"\nSet-PSFConfig -Module dbachecks -Name skip.security.builtinadmin -Validation bool -Value $true -Initialize -Description \"Skips the scan for BUILTIN\\Administrators login\"\nSet-PSFConfig -Module dbachecks -Name skip.security.guestuserconnect -Validation bool -Value $true -Initialize -Description \"Skips the scan for guest user have CONNECT permission\"\nSet-PSFConfig -Module dbachecks -Name skip.security.ContainedDBSQLAuth -Validation bool -Value $true -Initialize -Description \"Skips the scan for if a contained database as sql authenticated users\"\nSet-PSFConfig -Module dbachecks -Name skip.agent.alert -Validation bool -Value $false -Initialize -Description \"Skips the agent alerts checks\"\nSet-PSFConfig -Module dbachecks -Name skip.security.LoginCheckPolicy -Validation bool -Value $true -Initialize -Description \"Skips the scan for CHECK_POLICY on for all logins\"\nSet-PSFConfig -Module dbachecks -Name skip.security.LoginPasswordExpiration -Validation bool -Value $true -Initialize -Description \"Skips the scan for password expiration on for all logins in sysadmin role\"\nSet-PSFConfig -Module dbachecks -Name skip.security.LoginMustChange -Validation bool -Value $true -Initialize -Description \"Skips the scan for new logins must have password change turned on\"\nSet-PSFConfig -Module dbachecks -Name skip.security.nonstandardport -Validation bool -Value $true -Initialize -Description \"Skips the check for whether SQL Server should be configured with a non standard port\"\nSet-PSFConfig -Module dbachecks -Name skip.security.SQLMailXPsDisabled -Validation bool -Value $true -Initialize -Description \"Skip the check for Sql Mail XPs being disabled\"\nSet-PSFConfig -Module dbachecks -Name skip.security.PublicPermission -Validation bool -Value $true -Initialize -Description \"Skips the check for whether public role has permissions\"\nSet-PSFConfig -Module dbachecks -Name skip.security.serverprotocol -Validation bool -Value $true -Initialize -Description \"Skips the check for whether SQL Server is running on any other protocols but TCP/IP\"\n#agent\nSet-PSFConfig -Module dbachecks -Name agent.dbaoperatorname -Value $null -Initialize -Description \"Name of the DBA Operator in SQL Agent\"\nSet-PSFConfig -Module dbachecks -Name agent.dbaoperatoremail -Value $null -Initialize -Description \"Email address of the DBA Operator in SQL Agent\"\nSet-PSFConfig -Module dbachecks -Name agent.failsafeoperator -Value $null -Initialize -Description \"Email address of the Failsafe Operator in SQL Agent\"\n# TODO: Should this be instance instead of agent?\nSet-PSFConfig -Module dbachecks -Name agent.databasemailprofile -Value $null -Initialize -Description \"Name of the Database Mail Profile in SQL Agent\"\nSet-PSFConfig -Module dbachecks -Name agent.mailprofile -Value $null -Initialize -Description \"Name of the SQL Server Agent Mail Profile in SQL Agent\"\nSet-PSFConfig -Module dbachecks -Name agent.validjobowner.name -Value \"sa\" -Initialize -Description \"Agent job owner account should be this user\"\nSet-PSFConfig -Module dbachecks -Name agent.invalidjobowner.name -Value $null -Initialize -Description \"Agent job owner account should not be this user\"\nSet-PSFConfig -Module dbachecks -Name agent.alert.messageid -Value @('823', '824', '825') -Initialize -Description \"Agent alert messageid to validate; https://www.brentozar.com/blitz/configure-sql-server-alerts/\"\nSet-PSFConfig -Module dbachecks -Name agent.alert.severity -Value @('16', '17', '18', '19', '20', '21', '22', '23', '24', '25') -Initialize -Description \"Agent alert severity to validate; https://www.brentozar.com/blitz/configure-sql-server-alerts/\"\nSet-PSFConfig -Module dbachecks -Name agent.alert.job -Value $false -Initialize -Description \"Should we check for an agent job for the Agent Alert checks?\"\nSet-PSFConfig -Module dbachecks -Name agent.alert.notification -Value $true -Initialize -Description \"Should we check for a notification for the Agent Alert checks?\"\nSet-PSFConfig -Module dbachecks -Name agent.history.maximumhistoryrows -Value 1000 -Initialize -Description \"Maximum job history log size (in rows). The value -1 means disabled\"\nSet-PSFConfig -Module dbachecks -Name agent.history.maximumjobhistoryrows -Value 100 -Initialize -Description \"Maximum job history row per job. When the property is disabled the value is 0.\"\nSet-PSFConfig -Module dbachecks -Name agent.failedjob.excludecancelled -Value $false -Initialize -Description \"Exclude agent jobs with a status of cancelled\"\nSet-PSFConfig -Module dbachecks -Name agent.failedjob.since -Value 30 -Initialize -Description \"The maximum number of days to check for failed jobs\"\nSet-PSFConfig -Module dbachecks -Name agent.longrunningjob.percentage -Value 50 -Initialize -Description \"The maximum percentage variance that a currently running job is allowed over the average for that job\"\nSet-PSFConfig -Module dbachecks -Name agent.lastjobruntime.percentage -Value 50 -Initialize -Description \"The maximum percentage variance that the last run of a job is allowed over the average for that job\"\n\n# domain\nSet-PSFConfig -Module dbachecks -Name domain.name -Value $null -Initialize -Description \"The Active Directory domain that your server is a part of\"\nSet-PSFConfig -Module dbachecks -Name domain.organizationalunit -Value $null -Initialize -Description \"The OU that your server should be a part of\"\nSet-PSFConfig -Module dbachecks -Name domain.domaincontroller -Value $null -Initialize -Description \"The domain controller to process your requests\"\n\n# email\nSet-PSFConfig -Module dbachecks -Name mail.failurethreshhold -Value 0 -Initialize -Description \"Number of errors that must be present to generate an email report\"\nSet-PSFConfig -Module dbachecks -Name mail.smtpserver -Value $null -Initialize -Description \"Store the name of the smtp server to send email reports\"\nSet-PSFConfig -Module dbachecks -Name mail.to -Value $null -Validation validation.EmailValidation -Initialize -Description \"Email address to send the report to\"\nSet-PSFConfig -Module dbachecks -Name mail.from -Value $null -Validation validation.EmailValidation -Initialize -Description \"Email address the email reports should come from\"\nSet-PSFConfig -Module dbachecks -Name mail.subject -Value 'dbachecks results' -Validation String -Initialize -Description \"Subject line of the email report\"\n\n# Command parameter default values\nSet-PSFConfig -Module dbachecks -Name command.invokedbccheck.excludecheck -Value @() -Initialize -Description \"Invoke-DbcCheck: The checks that should be skipped by default.\"\nSet-PSFConfig -Module dbachecks -Name command.invokedbccheck.excludedatabases -Value @() -Initialize -Description \"Invoke-DbcCheck: The databases that should be skipped by default.\"\n\n# config for integration testing\nSet-PSFConfig -Module dbachecks -Name testing.integration.instance -Value @(\"localhost\") -Initialize -Description \"Default SQL Server instances to be used by integration tests\"\n\n# Suspect pages\nSet-PSFConfig -Module dbachecks -Name policy.suspectpage.excludedb -Value 90 -Initialize -Description \"Default threshold (%) to check whether suspect_pages is nearing row limit of 1000\"\nSet-PSFConfig -Module dbachecks -Name policy.suspectpage.threshold -Value 90 -Initialize -Description \"Default threshold (%) to check whether suspect_pages is nearing row limit of 1000\"\n\n# Server\nSet-PSFConfig -Module dbachecks -Name policy.server.cpuprioritisation -Value $true -Initialize -Description \"Shall we skip the CPU Prioritisation check\"\nSet-PSFConfig -Module dbachecks -Name policy.server.excludeDiskAllocationUnit -Value @() -Initialize -Description \"The disks to skip from the Disk Allocation Unit check - Must be 'DISKLETTER:\\'\"\n\n# Devops\nSet-PSFConfig -Module dbachecks -Name database.exists -Value @(\"master\", \"msdb\", \"tempdb\", \"model\") -Initialize -Description \"The databases we expect to be on the instances\"\n\n# Not Contactable\nSet-PSFConfig -Module dbachecks -Name global.notcontactable -Value @() -Initialize -Description \"This is used within the checks to avoid trying to contact none-responsive instances many times - do not set manually\"\nSet-PSFConfig -Module dbachecks -Name policy.traceflags.expected -Value @() -Initialize -Description \"The trace flags we expect to be running\"\nSet-PSFConfig -Module dbachecks -Name policy.traceflags.notexpected -Value @() -Initialize -Description \"The trace flags we expect not to be running\"\n"
  },
  {
    "path": "source/internal/functions/Get-AllAgentInfo.ps1",
    "content": "function Get-AllAgentInfo {\n    # Using the unique tags gather the information required\n    Param($Instance, $Tags)\n\n    #ToDo: Clean unused SMO classes\n    #clear out the default initialised fields\n    $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Server], $false)\n    $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Database], $false)\n    $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Login], $false)\n    $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Agent.Job], $false)\n    $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Agent.Operator], $false)\n    $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Agent.AlertSystem], $false)\n    $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.StoredProcedure], $false)\n    $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Information], $false)\n    $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Settings], $false)\n    $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.LogFile], $false)\n    $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.DataFile], $false)\n\n    # set the default init fields for all the tags\n\n    # Server Initial fields\n    $ServerInitFields = $Instance.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Server])\n    $ServerInitFields.Add(\"VersionMajor\") | Out-Null # so we can check versions\n    $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Server], $ServerInitFields)\n\n    # Job Server Initial fields\n    $OperatorInitFields = $Instance.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Agent.Operator])\n\n    # Job Server Alert System Initial fields\n    $FailsafeInitFields = $Instance.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Agent.AlertSystem])\n\n    # JobServer Initial fields\n    $AgentMailProfileInitFields = $Instance.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Agent.JobServer])\n\n    # Database Mail Profile Initial fields\n    $DatabaseMailProfileInitFields = $Instance.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Mail.MailProfile])\n\n    # JobOwner Initial fields\n    $JobOwnerInitFields = $Instance.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Agent.Job])\n\n    # Invalid JobOwner Initial fields\n    $InvalidJobOwnerInitFields = $Instance.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Agent.Job])\n\n    # Failed Job Initial fields\n    $FailedJobInitFields = $Instance.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Agent.Job])\n\n    # Agent Alerts Initial fields\n    $AgentAlertsInitFields = $Instance.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Agent.Alert])\n\n    # Agent Job History Initial fields\n    $AgentJobHistory = $Instance.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Agent.JobServer])\n\n    # Set up blank ConfigValues object for any config we need to use in the checks\n    $ConfigValues = [PSCustomObject]@{}\n\n    # Using there so that if the instance is not contactable, no point carrying on with gathering more information\n    switch ($tags) {\n\n        'DatabaseMailEnabled' {\n            $configurations = $true\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'DatabaseMailEnabled' -Value (($__dbcconfig | Where-Object { $_.Name -eq 'policy.security.databasemailenabled' }).Value)\n        }\n        'AgentServiceAccount' {\n            if (($Instance.VersionMajor -ge 14) -or $IsLinux -or $Instance.HostPlatform -eq 'Linux') {\n                $Agent = @($Instance.Query(\"SELECT status_desc, startup_type_desc, servicename FROM sys.dm_server_services\") | Where-Object servicename -Like '*Agent*').ForEach{\n                    [PSCustomObject]@{\n                        State     = $PSItem.status_desc\n                        StartMode = $PSItem.startup_type_desc\n                    }\n                }\n            } else {\n                # Windows\n                $Agent = @(Get-DbaService -ComputerName $Instance.ComputerName -Type Agent)\n            }\n        }\n        'DbaOperator' {\n            $OperatorInitFields.Add(\"Name\") | Out-Null # so we can check operators\n            $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Agent.Operator], $OperatorInitFields)\n            $OperatorInitFields = $Instance.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Agent.Operator])\n\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'DbaOperatorName' -Value (($__dbcconfig | Where-Object { $_.Name -eq 'agent.dbaoperatorname' }).Value)\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'DbaOperatorEmail' -Value (($__dbcconfig | Where-Object { $_.Name -eq 'agent.dbaoperatoremail' }).Value)\n\n            $Operator = $ConfigValues.DbaOperatorName.ForEach{\n                [PSCustomObject]@{\n                    InstanceName          = $Instance.Name\n                    ExpectedOperatorName  = $PSItem\n                    ActualOperatorName    = $Instance.JobServer.Operators.Name\n                    ExpectedOperatorEmail = 'null'\n                    ActualOperatorEmail   = 'null'\n                }\n            }\n\n            $Operator += $ConfigValues.DbaOperatorEmail.ForEach{\n                [PSCustomObject]@{\n                    InstanceName          = $Instance.Name\n                    ExpectedOperatorName  = 'null'\n                    ActualOperatorName    = 'null'\n                    ExpectedOperatorEmail = $PSItem\n                    ActualOperatorEmail   = $Instance.JobServer.Operators.EmailAddress\n                }\n            }\n        }\n        'FailsafeOperator' {\n            $FailsafeInitFields.Add(\"FailSafeOperator\") | Out-Null # so we can check failsafe operators\n            $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Agent.AlertSystem], $FailsafeInitFields)\n            $FailsafeInitFields = $Instance.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Agent.AlertSystem])\n\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'FailsafeOperator' -Value (($__dbcconfig | Where-Object { $_.Name -eq 'agent.failsafeoperator' }).Value)\n\n            $failsafeOperator = $ConfigValues.FailsafeOperator.ForEach{\n                [PSCustomObject]@{\n                    InstanceName             = $Instance.Name\n                    ExpectedFailSafeOperator = $PSItem\n                    ActualFailSafeOperator   = $Instance.JobServer.AlertSystem.FailSafeOperator\n                }\n            }\n        }\n        'DatabaseMailProfile' {\n            $DatabaseMailProfileInitFields.Add(\"Name\") | Out-Null # so we can check failsafe operators\n            $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Mail.MailProfile], $DatabaseMailProfileInitFields)\n            $DatabaseMailProfileInitFields = $Instance.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Mail.MailProfile])\n\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'DatabaseMailProfile' -Value (($__dbcconfig | Where-Object { $_.Name -eq 'agent.databasemailprofile' }).Value)\n\n            $databaseMailProfile = $ConfigValues.DatabaseMailProfile.ForEach{\n                [PSCustomObject]@{\n                    InstanceName                = $Instance.Name\n                    ExpectedDatabaseMailProfile = $ConfigValues.DatabaseMailProfile\n                    ActualDatabaseMailProfile   = $Instance.Mail.Profiles.Name\n                }\n            }\n        }\n        'AgentMailProfile' {\n            $AgentMailProfileInitFields.Add(\"DatabaseMailProfile\") | Out-Null # so we can check failsafe operators\n            $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Agent.JobServer], $AgentMailProfileInitFields)\n            $AgentMailProfileInitFields = $Instance.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Agent.JobServer])\n\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'AgentMailProfile' -Value (($__dbcconfig | Where-Object { $_.Name -eq 'agent.databasemailprofile' }).Value)\n\n            $agentMailProfile = $ConfigValues.AgentMailProfile.ForEach{\n\n                [PSCustomObject]@{\n                    InstanceName             = $Instance.Name\n                    ExpectedAgentMailProfile = $ConfigValues.AgentMailProfile\n                    ActualAgentMailProfile   = $Instance.JobServer.DatabaseMailProfile\n                }\n            }\n        }\n        'FailedJob' {\n            $FailedJobInitFields.Add(\"Name\") | Out-Null # so we can check Job Name\n            $FailedJobInitFields.Add(\"IsEnabled\") | Out-Null # so we can check Job status\n            $FailedJobInitFields.Add(\"LastRunDate\") | Out-Null # so we can check Job LastRunDate\n            $FailedJobInitFields.Add(\"LastRunOutcome\") | Out-Null # so we can check Job LastRunOutcome\n\n            $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Agent.Job], $FailedJobInitFields)\n            $FailedJobInitFields = $Instance.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Agent.Job])\n\n            $maxdays = ($__dbcconfig | Where-Object { $_.Name -eq 'agent.failedjob.since' }).Value\n            $startdate = (Get-Date).AddDays( - $maxdays)\n\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'FailedJob' -Value 'Succeeded'\n\n            $JobsFailed = ($Instance.JobServer.Jobs | Where-Object { $_.IsEnabled -and ($_.LastRunDate -gt $startdate) }).ForEach{\n                [PSCustomObject]@{\n                    InstanceName    = $Instance.Name\n                    JobName         = $PSItem.Name\n                    ExpectedOutcome = $ConfigValues.FailedJob\n                    LastRunOutcome  = $PSItem.LastRunOutcome\n                }\n            }\n        }\n        'ValidJobOwner' {\n            $JobOwnerInitFields.Add(\"OwnerLoginName\") | Out-Null # so we can check Job Owner\n            $JobOwnerInitFields.Add(\"Name\") | Out-Null # so we can check Job Name\n            $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Agent.Job], $JobOwnerInitFields)\n            $JobOwnerInitFields = $Instance.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Agent.Job])\n\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'TargetJobOwner' -Value (($__dbcconfig | Where-Object { $_.Name -eq 'agent.validjobowner.name' }).Value)\n\n            $JobOwner = $Instance.JobServer.Jobs.ForEach{\n                [PSCustomObject]@{\n                    InstanceName         = $Instance.Name\n                    JobName              = $PSItem.Name\n                    ExpectedJobOwnerName = $ConfigValues.TargetJobOwner #$PSItem\n                    ActualJobOwnerName   = $PSItem.OwnerLoginName\n                }\n            }\n        }\n        'InvalidJobOwner' {\n            $InvalidJobOwnerInitFields.Add(\"OwnerLoginName\") | Out-Null # so we can check Job Owner\n            $InvalidJobOwnerInitFields.Add(\"Name\") | Out-Null # so we can check Job Name\n            $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Agent.Job], $InvalidJobOwnerInitFields)\n            $InvalidJobOwnerInitFields = $Instance.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Agent.Job])\n\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'InvalidJobOwner' -Value (($__dbcconfig | Where-Object { $_.Name -eq 'agent.invalidjobowner.name' }).Value)\n\n            $InvalidJobOwner = $Instance.JobServer.Jobs.ForEach{\n                [PSCustomObject]@{\n                    InstanceName         = $Instance.Name\n                    JobName              = $PSItem.Name\n                    ExpectedJobOwnerName = $ConfigValues.InvalidJobOwner\n                    ActualJobOwnerName   = $PSItem.OwnerLoginName\n                }\n            }\n\n        }\n        'AgentAlert' {\n            $AgentAlertsInitFields.Add(\"Severity\") | Out-Null # so we can check Alert Severity\n            $AgentAlertsInitFields.Add(\"IsEnabled\") | Out-Null # so we can check Alert status\n            $AgentAlertsInitFields.Add(\"JobName\") | Out-Null # so we can check Alert job\n            $AgentAlertsInitFields.Add(\"HasNotification\") | Out-Null # so we can check Alert notification\n\n            $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Agent.Alert], $AgentAlertsInitFields)\n            $AgentAlertsInitFields = $Instance.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Agent.Alert])\n\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'AgentAlertSeverity' -Value (($__dbcconfig | Where-Object { $_.Name -eq 'agent.alert.Severity' }).Value)\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'AgentAlertMessageId' -Value (($__dbcconfig | Where-Object { $_.Name -eq 'agent.alert.messageid' }).Value)\n\n            $Severities = $ConfigValues.AgentAlertSeverity.ForEach{\n                $Severity = [int]($PSItem)\n                $sev = $Instance.JobServer.Alerts.Where{ $_.Severity -eq $Severity }\n                [PSCustomObject]@{\n                    InstanceName       = $Instance.Name\n                    AlertName          = $sev.Name\n                    Severity           = $sev.Severity\n                    IsEnabled          = $sev.IsEnabled\n                    JobName            = $sev.JobName\n                    HasNotification    = $sev.HasNotification\n                    AgentAlertSeverity = $Severity\n                }\n            }\n\n            $MessageIDs = $ConfigValues.AgentAlertMessageId.ForEach{\n                $MessageID = [int]($PSItem)\n                $msgID = $Instance.JobServer.Alerts.Where{ $_.MessageID -eq $MessageID }\n                [PSCustomObject]@{\n                    InstanceName    = $Instance.Name\n                    AlertName       = $msgID.Name\n                    MessageID       = $msgID.MessageID\n                    IsEnabled       = $msgID.IsEnabled\n                    JobName         = $msgID.JobName\n                    HasNotification = $msgID.HasNotification\n                    AgentMessageID  = $MessageID\n                }\n            }\n\n            $AgentAlerts = [PSCustomObject]@{\n                Severities = $Severities\n                MessageIDs = $MessageIDs\n            }\n        }\n        'JobHistory' {\n            $AgentJobHistory.Add(\"MaximumHistoryRows\") | Out-Null # so we can check Alert Severity\n            $AgentJobHistory.Add(\"MaximumJobHistoryRows\") | Out-Null # so we can check Alert status\n\n            $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Agent.JobServer], $AgentJobHistory)\n            $AgentJobHistory = $Instance.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Agent.JobServer])\n\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'AgentMaximumHistoryRows' -Value (($__dbcconfig | Where-Object { $_.Name -eq 'agent.history.maximumhistoryrows' }).Value)\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'AgentMaximumJobHistoryRows' -Value (($__dbcconfig | Where-Object { $_.Name -eq 'agent.history.maximumjobhistoryrows' }).Value)\n\n            $JobHistory = [PSCustomObject]@{\n                InstanceName                  = $Instance.Name\n                CurrentMaximumHistoryRows     = $Instance.JobServer.MaximumHistoryRows\n                ExpectedMaximumHistoryRows    = $ConfigValues.AgentMaximumHistoryRows\n                CurrentMaximumJobHistoryRows  = $Instance.JobServer.MaximumJobHistoryRows\n                ExpectedMaximumJobHistoryRows = $ConfigValues.AgentMaximumJobHistoryRows\n            }\n        }\n        'LongRunningJob' {\n            $query = \"SELECT\n                JobName,\n                AvgSec,\n                start_execution_date as StartDate,\n                RunningSeconds,\n                RunningSeconds - AvgSec AS Diff\n                FROM\n                (\n                SELECT\n                j.name AS JobName,\n                start_execution_date,\n                AVG(DATEDIFF(SECOND, 0, STUFF(STUFF(RIGHT('000000'\n                + CONVERT(VARCHAR(6),jh.run_duration),6),5,0,':'),3,0,':'))) AS AvgSec,\n                ja.start_execution_date as startdate,\n                DATEDIFF(second, ja.start_execution_date, GetDate()) AS RunningSeconds\n                FROM msdb.dbo.sysjobactivity ja\n                JOIN msdb.dbo.sysjobs j\n                ON ja.job_id = j.job_id\n                JOIN msdb.dbo.sysjobhistory jh\n                ON jh.job_id = j.job_id\n                WHERE start_execution_date is not null\n                AND stop_execution_date is null\n                AND run_duration < 235959\n                AND run_duration >= 0\n                AND ja.start_execution_date > DATEADD(day,-1,GETDATE())\n                GROUP BY j.name,j.job_id,start_execution_date,stop_execution_date,ja.job_id\n                ) AS t\n                ORDER BY JobName;\"\n            $runningjobs = Invoke-DbaQuery -SqlInstance $Instance -Database msdb -Query $query\n\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'LongRunningJob' -Value (($__dbcconfig | Where-Object { $_.Name -eq 'agent.longrunningjob.percentage' }).Value)\n\n            $LongRunningJobs = $($runningjobs | Where-Object { $_.AvgSec -ne 0 }).ForEach{\n                [PSCustomObject]@{\n                    InstanceName                     = $Instance.Name\n                    JobName                          = $PSItem.JobName\n                    RunningSeconds                   = $PSItem.RunningSeconds\n                    Average                          = $PSItem.AvgSec\n                    Diff                             = $PSItem.Diff\n                    ExpectedLongRunningJobPercentage = $ConfigValues.LongRunningJob\n                    ActualLongRunningJobPercentage   = [math]::Round($PSItem.Diff / $PSItem.AvgSec * 100)\n                }\n            }\n        }\n        'LastJobRunTime' {\n            $maxdays = ($__dbcconfig | Where-Object { $_.Name -eq 'agent.failedjob.since' }).Value\n            $query = \"IF OBJECT_ID('tempdb..#dbachecksLastRunTime') IS NOT NULL DROP Table #dbachecksLastRunTime\n                SELECT * INTO #dbachecksLastRunTime\n                FROM\n                (\n                SELECT\n                j.job_id,\n                j.name AS JobName,\n                DATEDIFF(SECOND, 0, STUFF(STUFF(RIGHT('000000' + CONVERT(VARCHAR(6),jh.run_duration),6),5,0,':'),3,0,':')) AS Duration\n                FROM msdb.dbo.sysjobs j\n                INNER JOIN\n                    (\n                        SELECT job_id, instance_id = MAX(instance_id)\n                            FROM msdb.dbo.sysjobhistory\n                            GROUP BY job_id\n                    ) AS h\n                    ON j.job_id = h.job_id\n                INNER JOIN\n                    msdb.dbo.sysjobhistory AS jh\n                    ON jh.job_id = h.job_id\n                    AND jh.instance_id = h.instance_id\n                    WHERE msdb.dbo.agent_datetime(jh.run_date, jh.run_time) > DATEADD(DAY,- {0},GETDATE())\n                    AND jh.step_id = 0\n                ) AS lrt\n                            IF OBJECT_ID('tempdb..#dbachecksAverageRunTime') IS NOT NULL DROP Table #dbachecksAverageRunTime\n                SELECT * INTO #dbachecksAverageRunTime\n                FROM\n                (\n                SELECT\n                job_id,\n                AVG(DATEDIFF(SECOND, 0, STUFF(STUFF(RIGHT('000000' + CONVERT(VARCHAR(6),run_duration),6),5,0,':'),3,0,':'))) AS AvgSec\n                FROM msdb.dbo.sysjobhistory hist\n                WHERE msdb.dbo.agent_datetime(run_date, run_time) > DATEADD(DAY,- {0},GETDATE())\n                AND Step_id = 0\n                AND run_duration >= 0\n                GROUP BY job_id\n                ) as art\n                            SELECT\n                JobName,\n                Duration,\n                AvgSec,\n                Duration - AvgSec AS Diff\n                FROM #dbachecksLastRunTime lastrun\n                JOIN #dbachecksAverageRunTime avgrun\n                ON lastrun.job_id = avgrun.job_id\n                            DROP Table #dbachecksLastRunTime\n                DROP Table #dbachecksAverageRunTime\" -f $maxdays\n            $lastagentjobruns = Invoke-DbaQuery -SqlInstance $Instance -Database msdb -Query $query\n\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'LastJobRuns' -Value (($__dbcconfig | Where-Object { $_.Name -eq 'agent.lastjobruntime.percentage' }).Value)\n\n            $LastJobRuns = $($lastagentjobruns | Where-Object { $_.AvgSec -ne 0 }).ForEach{\n                [PSCustomObject]@{\n                    InstanceName                 = $Instance.Name\n                    JobName                      = $PSItem.JobName\n                    Duration                     = $PSItem.Duration\n                    Average                      = $PSItem.AvgSec\n                    ExpectedRunningJobPercentage = $ConfigValues.LastJobRuns\n                    ActualRunningJobPercentage   = [math]::Round($PSItem.Diff / $PSItem.AvgSec * 100)\n                }\n            }\n        }\n        Default { }\n    }\n\n    #build the object\n    $testInstanceObject = [PSCustomObject]@{\n        ComputerName        = $Instance.ComputerName\n        InstanceName        = $Instance.DbaInstanceName\n        Name                = $Instance.Name\n        ConfigValues        = @($ConfigValues)\n        HostPlatform        = $Instance.HostPlatform\n        IsClustered         = $Instance.IsClustered\n        DatabaseMailEnabled = $Instance.Configuration.DatabaseMailEnabled.ConfigValue\n        Agent               = @($Agent)\n        Operator            = @($Operator)\n        FailSafeOperator    = @($failsafeOperator)\n        DatabaseMailProfile = @($databaseMailProfile)\n        AgentMailProfile    = @($agentMailProfile)\n        JobOwner            = $JobOwner\n        InvalidJobOwner     = $InvalidJobOwner\n        JobsFailed          = $JobsFailed\n        LastJobRuns         = $LastJobRuns\n        LongRunningJobs     = $LongRunningJobs\n        AgentAlerts         = $AgentAlerts\n        JobHistory          = @($JobHistory)\n    }\n    return $testInstanceObject\n}"
  },
  {
    "path": "source/internal/functions/Get-AllDatabaseInfo.ps1",
    "content": "function Get-AllDatabaseInfo {\n    # Using the unique tags gather the information required\n    Param($Instance, $Tags)\n\n    #clear out the default initialised fields\n    $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Server], $false)\n    $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Database], $false)\n    $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Login], $false)\n    $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Agent.Job], $false)\n    $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.StoredProcedure], $false)\n    $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Information], $false)\n    $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Settings], $false)\n    $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.LogFile], $false)\n    $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.DataFile], $false)\n\n    # set the default init fields for all the tags\n\n    # Server Initial fields\n    $ServerInitFields = $Instance.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Server])\n    $ServerInitFields.Add(\"VersionMajor\") | Out-Null # so we can check versions\n    $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Server], $ServerInitFields)\n\n    # Database Initial Fields\n    $DatabaseInitFields = $Instance.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Database])\n\n    # Stored Procedure Initial Fields\n    $StoredProcedureInitFields = $Instance.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.StoredProcedure])\n\n    # Information Initial Fields\n\n    # Settings Initial Fields\n    $SettingsInitFields = $Instance.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Settings])\n\n    # Login Initial Fields\n    $LoginInitFields = $Instance.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Login])\n\n    # Log File Initial Fields\n    $LogFileInitFields = $Instance.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.LogFile])\n\n    # Data File Initial Fields\n    $DataFileInitFields = $Instance.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.DataFile])\n\n    # Configuration cannot have default init fields :-)\n    $configurations = $false\n\n    # Set up blank ConfigValues object for any config we need to use in the checks\n    $ConfigValues = [PSCustomObject]@{}\n\n    # Using there so that if the instance is not contactable, no point carrying on with gathering more information\n    switch ($tags) {\n\n        'AsymmetricKeySize' {\n            $asymmetrickey = $true\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'asymmetrickeysizeexclude' -Value ($__dbcconfig | Where-Object Name -EQ 'policy.asymmetrickeysize.excludedb').Value\n        }\n\n        'AutoClose' {\n            $autoclose = $true\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'autoclose' -Value ($__dbcconfig | Where-Object Name -EQ 'policy.database.autoclose').Value\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'autocloseexclude' -Value ($__dbcconfig | Where-Object Name -EQ 'policy.autoclose.excludedb').Value\n        }\n\n        'AutoShrink' {\n            $autoshrink = $true\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'autoshrink' -Value ($__dbcconfig | Where-Object Name -EQ 'policy.database.autoshrink').Value\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'autoshrinkexclude' -Value ($__dbcconfig | Where-Object Name -EQ 'policy.autoshrinke.excludedb').Value\n        }\n\n        'ValidDatabaseOwner' {\n            $owner = $true\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'validdbownername' -Value ($__dbcconfig | Where-Object Name -EQ 'policy.validdbowner.name').Value\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'validdbownerexclude' -Value ($__dbcconfig | Where-Object Name -EQ 'policy.validdbowner.excludedb').Value\n        }\n\n        'InvalidDatabaseOwner' {\n            $owner = $true\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'invaliddbownername' -Value ($__dbcconfig | Where-Object Name -EQ 'policy.invaliddbowner.name').Value\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'invaliddbownerexclude' -Value ($__dbcconfig | Where-Object Name -EQ 'policy.invaliddbowner.excludedb').Value\n        }\n\n        'DatabaseCollation' {\n            $collation = $true\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'wrongcollation' -Value ($__dbcconfig | Where-Object Name -EQ 'policy.database.wrongcollation').Value\n        }\n\n        'SuspectPage' {\n            $suspectPage = $true\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'suspectpageexclude' -Value ($__dbcconfig | Where-Object Name -EQ 'policy.suspectpage.excludedb').Value\n        }\n        'VirtualLogFile' {\n            $vlf = $true\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'maxvlf' -Value ($__dbcconfig | Where-Object Name -EQ 'policy.database.maxvlf').Value\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'vlfexclude' -Value ($__dbcconfig | Where-Object Name -EQ 'policy.vlf.excludedb').Value\n        }\n        'LogFileCount' {\n            $logfilecount = $true\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'logfilecount' -Value ($__dbcconfig | Where-Object Name -EQ 'policy.database.logfilecount').Value\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'logfilecountexclude' -Value ($__dbcconfig | Where-Object Name -EQ 'policy.logfilecount.excludedb').Value\n        }\n        'AutoCreateStatistics' {\n            $autocreatestats = $true\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'autocreatestats' -Value ($__dbcconfig | Where-Object Name -EQ 'policy.database.autocreatestatistics').Value\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'autocreatestatsexclude' -Value ($__dbcconfig | Where-Object Name -EQ 'policy.autocreatestats.excludedb').Value\n        }\n        'AutoUpdateStatistics' {\n            $autoupdatestats = $true\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'autoupdatestats' -Value ($__dbcconfig | Where-Object Name -EQ 'policy.database.autoupdatestatistics').Value\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'autoupdatestatsexclude' -Value ($__dbcconfig | Where-Object Name -EQ 'policy.autoupdatestats.excludedb').Value\n        }\n        'AutoUpdateStatisticsAsynchronously' {\n            $autoupdatestatsasync = $true\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'autoupdatestatsasync' -Value ($__dbcconfig | Where-Object Name -EQ 'policy.database.autoupdatestatisticsasynchronously').Value\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'autoupdatestatsasyncexclude' -Value ($__dbcconfig | Where-Object Name -EQ 'policy.autoupdatestatisticsasynchronously.excludedb').Value\n        }\n        'Trustworthy' {\n            $trustworthy = $true\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'trustworthyexclude' -Value ($__dbcconfig | Where-Object Name -EQ 'policy.database.trustworthyexcludedb').Value\n        }\n        'DatabaseStatus' {\n            $status = $true\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'excludereadonly' -Value ($__dbcconfig | Where-Object Name -EQ 'policy.database.status.excludereadonly').Value\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'excludeoffline' -Value ($__dbcconfig | Where-Object Name -EQ 'policy.database.status.excludeoffline').Value\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'excluderestoring' -Value ($__dbcconfig | Where-Object Name -EQ 'policy.database.status.excluderestoring').Value\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'statusexclude' -Value ($__dbcconfig | Where-Object Name -EQ 'policy.database.statusexcludedb').Value\n        }\n        'QueryStoreEnabled' {\n            $qs = $true\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'qsenabledexclude' -Value ($__dbcconfig | Where-Object Name -EQ 'database.querystoreenabled.excludedb').Value\n        }\n        'QueryStoreDisabled' {\n            $qs = $true\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'qsdisabledexclude' -Value ($__dbcconfig | Where-Object Name -EQ 'database.querystoredisabled.excludedb').Value\n        }\n        'CompatibilityLevel' {\n            $compatibilityLevel = $true\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'compatexclude' -Value ($__dbcconfig | Where-Object Name -EQ 'database.compatibilitylevel.excludedb').Value\n        }\n        'GuestUserConnect' {\n            $guestUserConnect = $true\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'guestuserexclude' -Value ($__dbcconfig | Where-Object Name -EQ 'database.guestuser.excludedb').Value\n        }\n        'RecoveryModel' {\n            $recoverymodel = $true\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'recoverymodeltype' -Value ($__dbcconfig | Where-Object Name -EQ 'policy.recoverymodel.type').Value\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'recoverymodelexclude' -Value ($__dbcconfig | Where-Object Name -EQ 'policy.recoverymodel.excludedb').Value\n        }\n        'PseudoSimple' {\n            $pseudoSimple = $true\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'pseudosimpleexclude' -Value ($__dbcconfig | Where-Object Name -EQ 'policy.database.pseudosimpleexcludedb').Value\n        }\n        'ContainedDBAutoClose' {\n            $containedDbAutoClose = $true\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'contdbautocloseexclude' -Value ($__dbcconfig | Where-Object Name -EQ 'policy.database.contdbautocloseexclude').Value\n        }\n        'ContainedDBSQLAuth' {\n            $containedDbSqlAuthUsers = $true\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'contdbsqlauthexclude' -Value ($__dbcconfig | Where-Object Name -EQ 'policy.database.contdbsqlauthexclude').Value\n        }\n        'PageVerify' {\n            $pageverify = $true\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'pageverifyexclude' -Value ($__dbcconfig | Where-Object Name -EQ 'policy.database.contdbsqlauthexclude').Value\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'pageverify' -Value ($__dbcconfig | Where-Object Name -EQ 'policy.pageverify').Value\n        }\n        'FKCKTrusted' {\n            $trusted = $true\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'fkcktrustedexclude' -Value ($__dbcconfig | Where-Object Name -EQ 'policy.database.fkcktrustedexclude').Value\n        }\n        Default { }\n    }\n\n    #build the object\n    $testInstanceObject = [PSCustomObject]@{\n        ComputerName = $Instance.ComputerName\n        InstanceName = $Instance.DbaInstanceName\n        Name         = $Instance.Name\n        ConfigValues = $ConfigValues\n        MajorVersion = $Instance.VersionMajor\n        Databases    = $Instance.Databases.Foreach{\n            [PSCustomObject]@{\n                Name                      = $psitem.Name\n                SqlInstance               = $Instance.Name\n                Owner                     = @(if ($owner) { $psitem.owner })\n                ServerCollation           = @(if ($collation) { $Instance.collation })\n                Collation                 = @(if ($collation) { $psitem.collation })\n                SuspectPage               = @(if ($suspectPage) { (Get-DbaSuspectPage -SqlInstance $Instance -Database $psitem.Name | Measure-Object).Count })\n                ConfigValues              = $ConfigValues\n                AsymmetricKeySize         = @(if ($asymmetrickey) { ($psitem.AsymmetricKeys | Where-Object { $_.KeyLength -lt 2048 } | Measure-Object).Count })\n                AutoClose                 = @(if ($autoclose -or $containedDbAutoClose) { $psitem.AutoClose })\n                AutoCreateStatistics      = @(if ($autocreatestats) { $psitem.AutoCreateStatisticsEnabled })\n                AutoUpdateStatistics      = @(if ($autoupdatestats) { $psitem.AutoUpdateStatisticsEnabled })\n                AutoUpdateStatisticsAsync = @(if ($autoupdatestatsasync) { $psitem.AutoUpdateStatisticsAsync })\n                AutoShrink                = @(if ($autoshrink) { $psitem.AutoShrink })\n                VLF                       = @(if ($vlf) { ($psitem.Query(\"DBCC LOGINFO\") | Measure-Object).Count })\n                LogFileCount              = @(if ($logfilecount) { ($psitem.LogFiles | Measure-Object).Count })\n                Trustworthy               = @(if ($trustworthy) { $psitem.Trustworthy })\n                Status                    = @(if ($status) { $psitem.Status })\n                IsDatabaseSnapshot        = @(if ($status) { $psitem.IsDatabaseSnapshot }) # needed for status test\n                Readonly                  = @(if ($status) { $psitem.Readonly }) # needed for status test\n                QueryStore                = @(if ($qs) { $psitem.QueryStoreOptions.ActualState })\n                CompatibilityLevel        = @(if ($compatibilitylevel) { $psitem.CompatibilityLevel })\n                ServerLevel               = @(if ($compatibilitylevel) { [Enum]::GetNames('Microsoft.SqlServer.Management.Smo.CompatibilityLevel').Where{ $psitem -match $Instance.VersionMajor } })\n                GuestUserConnect          = @(if ($guestUserConnect) { if ($psitem.EnumDatabasePermissions('guest') | Where-Object { $_.PermissionState -eq 'Grant' -and $_.PermissionType.Connect }) { $true } } )\n                RecoveryModel             = @(if ($pseudoSimple -or $recoverymodel) { $psitem.RecoveryModel })\n                PseudoSimple              = @(if ($pseudoSimple) { '' -eq (($psitem.Query('Select last_log_backup_lsn from sys.database_recovery_status where database_id = DB_ID()')).last_log_backup_lsn) })\n                ContainmentType           = @(if ($containedDbAutoClose -or $containedDbSqlAuthUsers) { $psitem.ContainmentType })\n                ContainedDbAutoClose      = @(if ($containedDbAutoClose) { if (($psItem.ContainmentType -ne \"NONE\") -and ($null -ne $psItem.ContainmentType) -and $psitem.AutoClose) { $true } else { $false } } )\n                ContainedDbSqlAuthUsers   = @(if ($containedDbSqlAuthUsers) { if ($psItem.ContainmentType -ne \"NONE\" -and ($null -ne $psItem.ContainmentType)) { ($psitem.Users | Where-Object { $_.LoginType -eq \"SqlLogin\" -and $_.HasDbAccess -eq $true } | Measure-Object ).Count } } )\n                PageVerify                = @(if ($pageverify) { $psitem.PageVerify })\n                ForeignKeys               = @(if ($trusted) {$psitem.Tables.ForeignKeys | Where-Object {-not $_.NotForReplication} | Select-Object Name, Parent, @{l='Database';e={$_.Parent.Parent.Name}}, IsChecked } )\n                Constraints               = @(if ($trusted) {$psitem.Tables.Checks | Where-Object {(-not $_.NotForReplication) -and $_.IsEnabled} | Select-Object Name, Parent, @{l='Database';e={$_.Parent.Parent.Name}}, IsChecked } )\n            }\n        }\n    }\n    return $testInstanceObject\n}\n"
  },
  {
    "path": "source/internal/functions/Get-CheckFile.ps1",
    "content": "<#\n.SYNOPSIS\nThis will return all of the files that match a Check name - either by name or by pester tag\n\n.DESCRIPTION\nThis will return all of the files that match a Check name - either by name or by pester tag\n\nfor either v4 or v5 Pester checks using the v5 switch\n\n.PARAMETER Repo\nThe repo paths to check - normally defined by Get-CheckRepo\n\n.PARAMETER Check\nThe Check\n\n.PARAMETER v5\nAre we looking for Pester v5 files or not\n\n.EXAMPLE\nGet-CheckFile -Check AutoClose\n\nGets the files for the AutoClose check\n\n.NOTES\nInternal - used in Invoke-DbcCheckv4 and Invoke-DbcCheckv5\n#>\nfunction Get-CheckFile {\n    [CmdletBinding()]\n    param(\n        [Parameter(Mandatory = $true)]\n        [String]$Repo,\n        [Parameter(Mandatory = $true)]\n        [String[]]$Check,\n        [Parameter()]\n        [switch]$v5\n    )\n\n    $script:selectedFiles = New-Object System.Collections.Generic.List[String]\n\n    switch ($v5) {\n        $false {\n            if ($Check.Count -gt 0) {\n                # specific checks were requested. find them.\n                $TestsPath = Join-Path -Path $Repo -ChildPath '*.Tests.ps1'\n                @(Get-ChildItem -Path $TestsPath ).ForEach{\n                    # we do not want v5 files here\n                    if ($psitem.Name -notmatch 'v5') {\n                        $script:checksFile = $psitem.FullName\n\n                        if ($Check -contains ($PSItem.Name -replace '.Tests.ps1', '')) {\n                            # file matches by name\n                            if (!($script:selectedFiles -contains $script:checksFile)) {\n                                $script:selectedFiles.Add($script:checksFile)\n                            }\n                        } else {\n                            @($check).ForEach{\n                                if (@([System.IO.File]::ReadAllLines($script:checksFile) | Select-String -Pattern \"^\\s*Describe.*-Tags\\s+.*($psitem)\").Matches.Count) {\n                                    # file matches by one of the tags\n                                    if (!($script:selectedFiles -contains $script:checksFile)) {\n                                        $script:selectedFiles.Add($script:checksFile)\n                                    }\n                                }\n                            }\n                        }\n                    }\n                }\n            }\n        }\n        $true {\n            $message = 'We are going to use v5 files'\n            Write-PSFMessage -Message $message -Level Verbose\n            if ($Check.Count -gt 0) {\n                # specific checks were requested. find them.\n                $message = 'Specific checks were requested. find them'\n                Write-PSFMessage -Message $message -Level Verbose\n                $message = 'Searching Path {0} for test files' -f $repo\n                Write-PSFMessage -Message $message -Level Verbose\n                $TestsPath = Join-Path -Path $Repo -ChildPath '*.Tests.ps1'\n                @(Get-ChildItem -Path $TestsPath ).ForEach{\n                    $message = 'Processing {0}' -f $psitem.Name\n                    Write-PSFMessage -Message $message -Level Verbose\n                    # but we only want v5 files\n                    if ($psitem.Name -match 'v5') {\n\n                        $message = '{0} is a v5 file' -f $psitem.Name\n                        Write-PSFMessage -Message $message -Level Verbose\n\n                        $script:checksFile = $psitem.FullName\n\n                        if ($Check -contains ($PSItem.Name -replace 'v5.Tests.ps1', '')) {\n                            $message = '{0} file matches check {1}' -f $psitem.Name, ($Check | Out-String)\n                            Write-PSFMessage -Message $message -Level Verbose\n                            # file matches by name\n                            if (!($script:selectedFiles -contains $script:checksFile)) {\n                                $script:selectedFiles.Add($script:checksFile)\n                            }\n                        } else {\n                            $message = '{0} file does not match check {1} lets check for the tag' -f $psitem.Name, ($Check | Out-String)\n                            Write-PSFMessage -Message $message -Level Verbose\n                            $fileContent = [System.IO.File]::ReadAllLines($script:checksFile)\n                            @($check).ForEach{\n                                $message = 'Check file {0} for the tag {1}' -f $script:checksFile, $psitem\n                                Write-PSFMessage -Message $message -Level Verbose\n                                if (@($fileContent | Select-String -Pattern \"^\\s*Describe.*-Tag\\s+.*($psitem)\").Matches.Count) {\n                                    $message = 'The file {0} has the tag {1}' -f $script:checksFile, $psitem\n                                    Write-PSFMessage -Message $message -Level Verbose\n                                    # file matches by one of the tags\n                                    if (!($script:selectedFiles -contains $script:checksFile)) {\n                                        $script:selectedFiles.Add($script:checksFile)\n                                    }\n                                } else {\n                                    $message = 'The file {0} does not have the tag {1}' -f $script:checksFile, $psitem\n                                    Write-PSFMessage -Message $message -Level Verbose\n                                }\n                            }\n                        }\n                    }\n                }\n            }\n        }\n    }\n    return $script:selectedFiles\n}"
  },
  {
    "path": "source/internal/functions/Get-CheckInformation.ps1",
    "content": "# Returns all of the tags that have been specified in the checks file for this run of the Invoke-DbcCheck\nfunction Get-CheckInformation {\n    Param($Group, $Check, $AllChecks ,$ExcludeCheck)\n    ## need to reset the variable here\n    $script:localapp = Get-DbcConfigValue -Name app.localapp\n    $GroupChecksConfig = Get-DbcCheck -Group $Group\n    # Nothing if we exclude the group\n    if ($ExcludeCheck -contains $Group) {Return}\n    # Create an array of tags for the group except the Group Name\n    #It's a bit clubnky but it works\n    # This will create a list of all the tags for the group that has been specified ( so the instance checks or the database checks for example)\n    $GroupChecks = @()\n    @($GroupChecksConfig.AllTags).foreach{\n        @($psitem.Split(',')).ForEach{\n            $checkitem = $_.Trim()\n            if ($checkitem -eq $Group) {}\n            elseif ($ExcludeCheck -match $Checkitem) {}\n            else {\n                if (-not $GroupChecks.Contains($checkitem)) {\n                    $GroupChecks += $checkitem\n                }\n            }\n        }\n    }\n    # Now we have a list of tags if we have a group. We need to have a list of tags for all the possible checks passed in\n\n    #BUT\n\n    # If we have called Invoke-DbcCheck without using the Check parameter (IE using the config) we have nothing in Check\n\n    # So Lets fix that!\n\n    if($null -eq $Check){\n        $Check = $GroupChecks\n    }\n\n    ## OK - Now we can return all of the tags for all fo the checks whether they are specified individually, by group, in the Check parameter or not specified and included by the config as either a group or an individual tag (Which is what I want!)\n\n    $CheckInfo = @()\n    if(($Check -eq $Group) -or ($Check -contains $Group) -or ($AllChecks)){\n        $CheckInfo = $GroupChecks\n    }\n    else{\n        @($Check).ForEach{\n            if($GroupChecks -contains $psitem){\n    ## BUT - This falls flat when you use a tag for a number of Checks that is not a group (like CIS) in that case all you get in $CheckInfo is CIS and not the relevant unique tags\n                @(Get-DbcCheck -Tag $psitem).ForEach{\n                    if (-not $CheckInfo.Contains($psitem.UniqueTag)) {\n                        $CheckInfo += $psitem.UniqueTag\n                    }\n                }\n            }\n        }\n    }\n    Return $CheckInfo\n}\n\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUb7Xe99cKDYQhSmLwA7GVuxpD\n# O2OgggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz\n# c3VyZWQgSUQgQ29kZSBTaWduaW5nIENBMB4XDTE3MDUwOTAwMDAwMFoXDTIwMDUx\n# MzEyMDAwMFowVzELMAkGA1UEBhMCVVMxETAPBgNVBAgTCFZpcmdpbmlhMQ8wDQYD\n# VQQHEwZWaWVubmExETAPBgNVBAoTCGRiYXRvb2xzMREwDwYDVQQDEwhkYmF0b29s\n# czCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAI8ng7JxnekL0AO4qQgt\n# Kr6p3q3SNOPh+SUZH+SyY8EA2I3wR7BMoT7rnZNolTwGjUXn7bRC6vISWg16N202\n# 1RBWdTGW2rVPBVLF4HA46jle4hcpEVquXdj3yGYa99ko1w2FOWzLjKvtLqj4tzOh\n# K7wa/Gbmv0Si/FU6oOmctzYMI0QXtEG7lR1HsJT5kywwmgcjyuiN28iBIhT6man0\n# Ib6xKDv40PblKq5c9AFVldXUGVeBJbLhcEAA1nSPSLGdc7j4J2SulGISYY7ocuX3\n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tigZGnKMAkGBSsOAwIaBQCgeDAYBgorBgEEAYI3AgEMMQowCKACgACh\n# AoAAMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcCAQsxDjAM\n# BgorBgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBS0Jl/mFVoeWuv7lxKDeeVAXzM7\n# /jANBgkqhkiG9w0BAQEFAASCAQB/UhD2mtAuccy4MtMMu4QYH9tMUsQ7y3ea0adX\n# FDp6Ql2zWswo29Tc1LUjXcLLuH9hHy4r+pDheKKnPqo33L9r1HWqDi23noVUn/r4\n# EdapCkfNISgGfpiGzjuATDkpYjvsePGJBgyhDQvSfP2ORFUzVj/qe12jGgFQe81m\n# C4aU7ylTEaK7fJT0WUpTc4xbP/OW6q1K/0ldYHAimzSI2BqQ345v2NY6MhhPMbaj\n# ETC0AA880BkH5FMRmNRwYzB8KBSrY2jgVKk6b+2u70y1auTXJf/AiAygRHoP5sQt\n# 6h7G6EtF6XEhYT2i3LhSSsZ3oAICq4ayluV4eM7Fv2iKmWMw\n# SIG # End signature block\n"
  },
  {
    "path": "source/internal/functions/Get-CheckRepo.ps1",
    "content": "﻿# Can't set arrays right now, w/e\nfunction Get-CheckRepo {\n    $repos = Get-DbcConfigValue app.checkrepos\n    if ($repos -match \", \") {\n        $repos = $repos.Replace(\", \", \",\")\n        $repos = $repos.Split(\",\")\n    }\n    return $repos\n}"
  },
  {
    "path": "source/internal/functions/Get-ComputerName.ps1",
    "content": "﻿function Get-ComputerName {\n    if ($null -ne $computername) {\n        return [array]$computername\n    }\n    else {\n        $computers = Get-DbcConfigValue app.computername\n        if ($computers.Length -eq 0) {\n            Write-PSFMessage -Level Warning -Message \"You must specify -ComputerName or use Set-DbcConfig app.computername to setup a list of servers\"\n        }\n        else {\n            [array]$computers\n        }\n    }\n}\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gj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AASCAQAH6gE99C9zUcjbtRJIg6Sfzp+gXzF4jrttF0Kf\n# zWZoT4wkZPqHa51teeUfWZrsR02cEAuyhuFGyYeWNpxJ7N4VI2tGsEAOycCfy/Xv\n# hUkaZQbLV4LhuixgEOGF3p7lydfxFnJA7GNxhgfkNNTsX4zQ0q+7eb8vcqRnlFIg\n# TlbdHSyVjlOSTuqVJf+cyr5C4vafz9t49dUFBP44z45nz5pqfxOCRf9YjS9JiJN0\n# vgloSbqih+EAqb6NAOpCQB37EsNdVJrhxwA/Vn0knzxxrOyX2ga2TM44Nix9MJwW\n# 3V7FsF7U9gvTVBfXqSQv+TIcO1PnXt0QozQsPlZbfQAtIwvo\n# SIG # End signature block\n"
  },
  {
    "path": "source/internal/functions/Get-DatabaseDetail.ps1",
    "content": "function Get-DatabaseDetail {\n    param (\n        [DbaInstanceParameter[]]$SqlInstance,\n        [object[]]$ExcludeDatabase\n    )\n    begin {\n        if (!(test-path variable:script:results)) {\n            $script:results = @{}\n        }\n    }\n    process {\n        foreach ($instance in $SqlInstance) {\n            try {\n                if (!($script:results.ContainsKey($instance))) {\n                    $server = Connect-DbaInstance -SqlInstance $instance -SqlCredential $sqlcredential\n                    $dbs = $server.Query(\"\nselect quotename(d.name) [Database]\n    ,d.collation_name                   DatabaseCollation\n    ,suser_sname(d.owner_sid)           CurrentOwner\n    ,d.recovery_model_desc              RecoveryModel\n    ,d.is_auto_shrink_on                AutoShrink\n    ,d.is_auto_close_on                 AutoClose\n    ,d.is_auto_create_stats_on          AutoCreateStatisticsEnabled\n    ,d.is_auto_update_stats_on          AutoUpdateStatisticsEnabled\n    ,d.is_auto_update_stats_async_on    AutoUpdateStatisticsAsync\n    ,d.is_trustworthy_on                Trustworthy\n    ,d.page_verify_option_desc          PageVerify\n    ,isnull((select count(*) from msdb..suspect_pages sp where sp.database_id = d.database_id and event_type in (1,2,3)),0) SuspectPages\n    ,d.state_desc                       Status\n    ,d.compatibility_level              CompatibilityLevel\n    ,d.user_access_desc                 UserAccess\n    ,d.is_read_only                     IsReadOnly\nfrom sys.databases d\n                                        \")\n\n                    foreach($db in $dbs) {\n                        $db | Add-Member -Force -MemberType NoteProperty -Name ServerCollation -Value $server.Collation\n                        $db | Add-Member -Force -MemberType NoteProperty -Name SqlInstance -Value $server.DomainInstanceName\n                        $db | Add-Member -Force -MemberType NoteProperty -Name SqlVersion -Value $server.VersionMajor\n                    }\n\n                    $script:results.Add($instance, $dbs)\n                }\n\n                $server.DomainInstanceName\n                $server.VersionMajor\n\n                return $script:results[$instance] | Where-Object { $psitem.Database -notin $ExcludeDatabase -or !$ExcludeDatabase }\n            }\n            catch {\n                #Stop-Function -Message \"Failure\" -Category ConnectionError -ErrorRecord $_ -Target $instance -Continue\n                throw\n            }\n        }\n    }\n}\n\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUHYJW1aa82Kb8/1c6ja8kIoWs\n# CzygggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz\n# c3VyZWQgSUQgQ29kZSBTaWduaW5nIENBMB4XDTE3MDUwOTAwMDAwMFoXDTIwMDUx\n# MzEyMDAwMFowVzELMAkGA1UEBhMCVVMxETAPBgNVBAgTCFZpcmdpbmlhMQ8wDQYD\n# VQQHEwZWaWVubmExETAPBgNVBAoTCGRiYXRvb2xzMREwDwYDVQQDEwhkYmF0b29s\n# czCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQ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Q9qzsIzV6Q3d\n# 9gEgzpkxYz0IGhizgZtPxpMQBvwHgfqL2vmCSfdibqFT+hKUGIUukpHqaGxEMrJm\n# oecYpJpkUe8xggIoMIICJAIBATCBhjByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMM\n# RGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQD\n# EyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQgQ29kZSBTaWduaW5nIENBAhACwXUo\n# dNXChDGFKtigZGnKMAkGBSsOAwIaBQCgeDAYBgorBgEEAYI3AgEMMQowCKACgACh\n# AoAAMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcCAQsxDjAM\n# BgorBgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBSip9SPeC6nD6iY7Nf+9bPrzhJA\n# fjANBgkqhkiG9w0BAQEFAASCAQBHy9vZF0+Vx/0afb0MqqAndcOztUqnspf9EJ/8\n# Ewh+fQWbFm/VInVu4nvtU5rXK00rIbp1nesQJi4BUq/uSmyW5SOUMvW18OLu4U9C\n# x0PhTmsf/uZPD9K6DGNPXKOuJgTDov2jOM4gH25JbQJfSZZjAmNCIhWPU3e//n3d\n# T1pTcajBAOn0Nfggfz9z2EMaJlDpvN1DGdzYKuGlPbPfuA26M6d3fvYaXtwtDnMs\n# vLObZluM0ovvvcunNzjIwWB0hgKTM/XuUbEfEgkwp1kNsE3PRKAgY0/Iz0lIU6TI\n# SyijkgMOclb9CxY65lyu1/1AM/ogAPaB/YFasCi4P7TPp8JZ\n# SIG # End signature block\n"
  },
  {
    "path": "source/internal/functions/Get-SqlInstance.ps1",
    "content": "﻿function Get-Instance {\n    if ($null -ne $sqlinstance) {\n        return [array]$sqlinstance\n    }\n\n    $instances = Get-DbcConfigValue app.sqlinstance\n    if ($instances.Length -eq 0) {\n        Write-PSFMessage -Level Warning -Message \"You must specify -SqlInstance or use Set-DbcConfig app.sqlinstance to setup a list of servers\"\n        return\n    }\n    else {\n        [array]$instances\n    }\n}\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUKG+fi8Y+2vCSeOs1aYV/2+vA\n# /GSgggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz\n# c3VyZWQgSUQgQ29kZSBTaWduaW5nIENBMB4XDTE3MDUwOTAwMDAwMFoXDTIwMDUx\n# MzEyMDAwMFowVzELMAkGA1UEBhMCVVMxETAPBgNVBAgTCFZpcmdpbmlhMQ8wDQYD\n# VQQHEwZWaWVubmExETAPBgNVBAoTCGRiYXRvb2xzMREwDwYDVQQDEwhkYmF0b29s\n# czCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAI8ng7JxnekL0AO4qQgt\n# Kr6p3q3SNOPh+SUZH+SyY8EA2I3wR7BMoT7rnZNolTwGjUXn7bRC6vISWg16N202\n# 1RBWdTGW2rVPBVLF4HA46jle4hcpEVquXdj3yGYa99ko1w2FOWzLjKvtLqj4tzOh\n# K7wa/Gbmv0Si/FU6oOmctzYMI0QXtEG7lR1HsJT5kywwmgcjyuiN28iBIhT6man0\n# Ib6xKDv40PblKq5c9AFVldXUGVeBJbLhcEAA1nSPSLGdc7j4J2SulGISYY7ocuX3\n# tkv01te72Mv2KkqqpfkLEAQjXgtM0hlgwuc8/A4if+I0YtboCMkVQuwBpbR9/6ys\n# Z+sCAwEA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AzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcCAQsxDjAM\n# BgorBgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBQWo5+F0QJWSu2APCWXfQhpAxKM\n# rjANBgkqhkiG9w0BAQEFAASCAQAgEYgaTNo9JN40KuthlhfYpd6kE/CHB/ukv1OR\n# O6cLnyxTLWSr6myjtLTmo0MfRc1pnhs8nSIvkklAier8xLqw2ENINOGx9umhKJTU\n# YA4gTjhVn8PD+Cx3aLkxJKP/Ka8Vfzff9E36cXae3g1q/TQvGgX+JPDkrMWNFPbn\n# ThfWZ0WgwUfPcsYu4SV5w7TY/fcGY2V0v476D0xnroQAwnW/fq9d37BTqbBrGTdC\n# t2nYV26HtHcyLhPUb+lFvd5Pza/50DujXygDKU4vPXmUHpY48umHIyGa74rGuLD8\n# T7prtnuFOVXvW8aMGRbvclIo3HdenIS9IibhOI2fA8Q03GGQ\n# SIG # End signature block\n"
  },
  {
    "path": "source/internal/functions/Get-Version.ps1",
    "content": "function Get-Version {\n    Param($SqlInstance)\n    (Connect-DbaInstance -SqlInstance $SqlInstance).Version.Major\n}\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUm9sIEtob9SkkRtUi83s7yTMm\n# L3SgggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz\n# c3VyZWQgSUQgQ29kZSBTaWduaW5nIENBMB4XDTE3MDUwOTAwMD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},
  {
    "path": "source/internal/functions/Get-v5Checks.ps1",
    "content": "function Get-v5Checks {\n    $v5files = Get-ChildItem -Path $v5Path -Recurse -Filter *.ps1 -Exclude *-v5.ps1        \n    [Management.Automation.Language.Parser]::ParseInput($GroupContent, [ref]$tokens, [ref]$errors).\n        FindAll([Func[Management.Automation.Language.Ast, bool]] {\n                param ($ast)\n                $ast.CommandElements -and\n                $ast.CommandElements[0].Value -eq 'describe'\n            }, $true) |\n            ForEach-Object {\n                $CE = $PSItem.CommandElements\n                $secondString = ($CE | Where-Object { $PSItem.StaticType.name -eq 'string' })[1]\n                $tagIdx = $CE.IndexOf(($CE | Where-Object ParameterName -EQ 'Tags')) + 1\n                $tags = if ($tagIdx -and $tagIdx -lt $CE.Count) {\n                    $CE[$tagIdx].Extent\n                }\n                New-Object PSCustomObject -Property @{\n                    GroupName  = $GroupName\n                    CheckTitle = $secondString\n                    CheckTags  = $tags\n                }\n            }\n}"
  },
  {
    "path": "source/internal/functions/Invoke-ConfigurationScript.ps1",
    "content": "function Invoke-ConfigurationScript {\n    <#\n    .SYNOPSIS\n    Invokes the configurations/configuration.ps1 script\n\n    .DESCRIPTION\n    This function is necessary to be able to do integration tests of Reset-DbcConfig without affecting the real configuration values\n    It is important to be able to validate, that Reset-DbcConfig does not reset too much without affecting live configuration values.\n    #>\n    [CmdletBinding()]\n    param()\n    . $script:ModuleRoot\\internal\\configurations\\configuration.ps1\n}\n\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUNH31mcI/oInNRfghcUFAcl0K\n# WPmgggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEw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qnrFU/T7mH8UMu60KhuK17vUP\n# +inuDEBdDm3US8pqWFRvmkrXMcd6fs7usfBUcvG5pXw8F+svVNLOErAWGtBixvga\n# 3yN0hYqrpmJ5u5OObWFUHbs5n70lU+2aGwVXs5nQ2XQYvBdI\n# SIG # End signature block\n"
  },
  {
    "path": "source/internal/functions/Invoke-DbcCheckv4.ps1",
    "content": "function Invoke-DbcCheckv4 {\n    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidGlobalVars', '', Justification='Because scoping is hard')]\n    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', '', Justification='Because its set to the global var')]\n    [CmdletBinding(DefaultParameterSetName = 'Default')]\n    param (\n        [Alias('Path', 'relative_path')]\n        [object[]]$Script,\n        [Alias(\"Name\")]\n        [string[]]$TestName,\n        [switch]$EnableExit,\n        [Parameter(Position = 0)]\n        [Alias(\"Tags\", \"Tag\", \"Checks\")]\n        [string[]]$Check,\n        [AllowEmptyCollection()]\n        [Alias(\"ExcludeTags\", \"ExcludeTag\", \"ExcludeChecks\")]\n        [string[]]$ExcludeCheck = (Get-PSFConfigValue -FullName 'dbachecks.command.invokedbccheck.excludecheck' -Fallback @()),\n        [switch]$PassThru,\n        [DbaInstance[]]$SqlInstance,\n        [DbaInstance[]]$ComputerName,\n        [PSCredential]$SqlCredential,\n        [PSCredential]$Credential,\n        [object[]]$Database,\n        [object[]]$ExcludeDatabase = (Get-PSFConfigValue -FullName 'dbachecks.command.invokedbccheck.excludedatabase' -Fallback @()),\n        [string[]]$Value,\n        [string]$ConfigFile,\n        [object[]]$CodeCoverage = @(),\n        [string]$CodeCoverageOutputFile,\n        [ValidateSet('JaCoCo')]\n        [string]$CodeCoverageOutputFileFormat = \"JaCoCo\",\n        [switch]$Strict,\n        [Parameter(Mandatory = $true, ParameterSetName = 'NewOutputSet')]\n        [string]$OutputFile,\n        [ValidateSet('NUnitXml')]\n        [string]$OutputFormat,\n        [switch]$AllChecks,\n        [switch]$Quiet,\n        [object]$PesterOption,\n        [string]$Show = 'All'\n    )\n\n    dynamicparam {\n        $config = Get-PSFConfig -Module dbachecks\n\n        $RuntimeParamDic = New-Object System.Management.Automation.RuntimeDefinedParameterDictionary\n\n        foreach ($setting in $config) {\n            $name = $setting.Name\n            $name = \"Config\" + (($name.Split(\".\") | ForEach-Object { $_.SubString(0, 1).ToUpper() + $_.SubString(1) }) -join '')\n            $ParamAttrib = New-Object System.Management.Automation.ParameterAttribute\n            $ParamAttrib.ParameterSetName = '__AllParameterSets'\n            $AttribColl = New-Object  System.Collections.ObjectModel.Collection[System.Attribute]\n            $AttribColl.Add($ParamAttrib)\n\n            $RuntimeParam = New-Object System.Management.Automation.RuntimeDefinedParameter($name, [object], $AttribColl)\n\n            $RuntimeParamDic.Add($name, $RuntimeParam)\n        }\n        return $RuntimeParamDic\n    }\n\n    begin {\n\n    }\n\n    process {\n        if (Test-PSFFunctionInterrupt) { return }\n\n        #get the output config for dbatools and store it to set it back at the end\n        $dbatoolsoutputconfig = Get-DbatoolsConfigValue -FullName message.consoleoutput.disable\n        if (!$dbatoolsoutputconfig) {\n            Set-DbatoolsConfig -FullName message.consoleoutput.disable -Value $true\n        }\n\n\n        if (-not $Script -and -not $TestName -and -not $Check -and -not $ExcludeCheck -and -not $AllChecks) {\n            Stop-PSFFunction -Message \"Please specify Check, ExcludeCheck, Script, TestName or AllChecks\"\n            return\n        }\n\n        if (-not $SqlInstance.InputObject -and -not $ComputerName.InputObject -and -not (Get-PSFConfigValue -FullName dbachecks.app.sqlinstance) -and -not (Get-PSFConfigValue -FullName dbachecks.app.computername) -and -not (Get-PSFConfigValue -FullName dbachecks.app.cluster)) {\n            Stop-PSFFunction -Message \"No servers set to run against. Use Get/Set-DbcConfig to setup your servers or Get-Help Invoke-DbcCheck for additional options.\"\n            return\n        }\n\n        $customparam = 'SqlInstance', 'ComputerName', 'SqlCredential', 'Credential', 'Database', 'ExcludeDatabase', 'Value'\n\n        foreach ($param in $customparam) {\n            if (Test-PSFParameterBinding -ParameterName $param) {\n                $value = Get-Variable -Name $param\n                if ($value.InputObject) {\n                    Set-Variable -Scope 0 -Name $param -Value $value.InputObject -ErrorAction SilentlyContinue\n                    $PSDefaultParameterValues.Add( { \"*-Dba*:$param\", $value.InputObject })\n                }\n            }\n            else {\n                $PSDefaultParameterValues.Remove( { \"*-Dba*:$param\" })\n            }\n            $null = $PSBoundParameters.Remove($param)\n        }\n\n\n        # Lil bit of cleanup here, for a switcharoo\n        $null = $PSBoundParameters.Remove('AllChecks')\n        $null = $PSBoundParameters.Remove('Check')\n        $null = $PSBoundParameters.Remove('ExcludeCheck')\n        $null = $PSBoundParameters.Remove('ConfigFile')\n        $null = $PSBoundParameters.Add('Tag', $Check)\n        $null = $PSBoundParameters.Add('ExcludeTag', $ExcludeCheck)\n\n        $globalexcludedchecks = Get-PSFConfigValue -FullName dbachecks.command.invokedbccheck.excludecheck\n        $global:ChecksToExclude = $ExcludeCheck + $globalexcludedchecks\n        [string[]]$Script:ExcludedDatabases = Get-PSFConfigValue -FullName dbachecks.command.invokedbccheck.excludedatabases\n        $Script:ExcludedDatabases += $ExcludeDatabase\n\n\n        foreach ($singlecheck in $check) {\n            if ($singlecheck -in $globalexcludedchecks) {\n                Write-PSFMessage -Level Warning -Message \"$singlecheck is excluded in command.invokedbccheck.excludecheck and will be skipped \"\n            }\n        }\n\n        if ($AllChecks -and $globalexcludedchecks) {\n            Write-PSFMessage -Level Warning -Message \"$globalexcludedchecks will be skipped\"\n        }\n\n        if ($ExcludedDatabases) {\n            Write-PSFMessage -Level Warning -Message \"$ExcludedDatabases databases will be skipped for all checks\"\n        }\n\n        # Then we'll need a generic param passer that doesn't require global params\n        # cuz global params are hard\n\n        $finishedAllTheChecks = $false\n        try {\n            $repos = Get-CheckRepo\n            foreach ($repo in $repos) {\n                if ((Test-Path $repo -ErrorAction SilentlyContinue)) {\n                    if ($OutputFormat -eq \"NUnitXml\" -and -not $OutputFile) {\n                        $number = $repos.IndexOf($repo)\n                        $timestamp = Get-Date -format \"yyyyMMddHHmmss\"\n                        $PSBoundParameters['OutputFile'] = \"$script:maildirectory\\report-$number-$pid-$timestamp.xml\"\n                    }\n\n                    if ($Check.Count -gt 0) {\n                        # specific checks were listed. find the necessary script files.\n                        $PSBoundParameters['Script'] = (Get-CheckFile -Repo $repo -Check $check)\n                    }\n\n                    Push-Location -Path $repo\n                    ## remove any previous entries ready for this run\n                    Set-PSFConfig -Module dbachecks -Name global.notcontactable -Value @()\n                    \n                    Write-PSFMessage -Message ($PSBoundParameters | Out-String) -Level Significant\n                    \n                    Invoke-Pester @PSBoundParameters\n                    Pop-Location\n                }\n            }\n            $finishedAllTheChecks = $true\n        }\n        catch {\n            Stop-PSFFunction -Message \"There was a problem executing Invoke-Pester\" -ErrorRecord $psitem\n        }\n        finally {\n            # reset the config to original value\n            Set-DbatoolsConfig -FullName message.consoleoutput.disable -Value $dbatoolsoutputconfig\n\n            if (!($finishedAllTheChecks)) {\n                Write-PSFMessage -Level Warning -Message \"Execution was cancelled!\"\n                Pop-Location\n            }\n        }\n    }\n}\n\n\n<#\n.SYNOPSIS\nInvoke-DbcCheck is a SQL-centric Invoke-Pester wrapper\n\n.DESCRIPTION\nThe Invoke-DbcCheck function runs Pester tests, including *.Tests.ps1 files and Pester tests in PowerShell scripts.\n\nExtended description about Pester: Get-Help -Name Invoke-Pester\n\n.PARAMETER Check\nRuns only tests in Describe blocks with the specified Tag parameter values. Wildcard characters and Tag values that include spaces or whitespace characters are not supported.\n\nWhen you specify multiple Tag values, Invoke-DbcCheck runs tests that have any of the listed tags (it ORs the tags). However, when you specify TestName and Tag values, Invoke-DbcCheck runs only describe blocks that have one of the specified TestName values and one of the specified Tag values.\n\nIf you use both Tag and ExcludeTag, ExcludeTag takes precedence.\n\n.PARAMETER ExcludeCheck\nOmits tests in Describe blocks with the specified Tag parameter values. Wildcard characters and Tag values that include spaces or whitespace characters are not supported.\n\nWhen you specify multiple ExcludeTag values, Invoke-DbcCheck omits tests that have any of the listed tags (it ORs the tags). However, when you specify TestName and ExcludeTag values, Invoke-DbcCheck omits only describe blocks that have one of the specified TestName values and one of the specified Tag values.\n\nIf you use both Tag and ExcludeTag, ExcludeTag takes precedence\n\n.PARAMETER SqlInstance\nA list of SQL Servers to run the tests against. If this is not provided, it will be gathered from:\nGet-DbatoolsConfig -Name app.sqlinstance\n\n.PARAMETER ComputerName\nA list of computers to run the tests against. If this is not provided, it will be gathered from:\nGet-DbatoolsConfig -Name app.computername\n\n.PARAMETER SqlCredential\nAlternate SQL Server-based credential.\n\n.PARAMETER Credential\nAlternate Windows credential.\n\n.PARAMETER Database\nA list of databases to include if your check is database centric.\n\n.PARAMETER ExcludeDatabase\nA list of databases to exclude if your check is database centric.\n\n.PARAMETER PassThru\nReturns a custom object (PSCustomObject) that contains the test results.\n\nBy default, Invoke-DbcCheck writes to the host program, not to the output stream (stdout).\nIf you try to save the result in a variable, the variable is empty unless you\nuse the PassThru parameter.\n\nTo suppress the host output, use the Quiet parameter.\n\n.PARAMETER ConfigFile\nThe path to the exported dbachecks config file.\n\n.PARAMETER OutputFormat\nThe format of output. Currently, only NUnitXML is supported.\n\n.PARAMETER Strict\nMakes Pending and Skipped tests to Failed tests. Useful for continuous integration where you need to make sure all tests passed.\n\n.PARAMETER AllChecks\nIn the unlikely event that you'd like to run all checks, specify -AllChecks. These checks still confirm to the skip settings in Get-DbcConfig.\n\n.PARAMETER Quiet\nThe parameter Quiet is deprecated since Pester v. 4.0 and will be deleted in the next major version of Pester. Please use the parameter Show with value 'None' instead.\n\n.PARAMETER Show\nCustomizes the output Pester writes to the screen.\n\nAvailable options are\nNone\nDefault\nPassed\nFailed\nPending\nSkipped\nInconclusive\nDescribe\nContext\nSummary\nHeader\nAll\nFails\n\nThe options can be combined to define presets.\n\nCommon use cases are:\n\nNone - to write no output to the screen.\nAll - to write all available information (this is default option).\nFails - to write everything except Passed (but including Describes etc.).\n\nA common setting is also Failed, Summary, to write only failed tests and test summary.\n\nThis parameter does not affect the PassThru custom object or the XML output that is written when you use the Output parameters.\n\n.PARAMETER Value\nA value.. it's hard to explain\n\n.PARAMETER Script\nGet-Help -Name Invoke-Pester -Parameter Script\n\n.PARAMETER TestName\nGet-Help -Name Invoke-Pester -Parameter TestName\n\n.PARAMETER EnableExit\nGet-Help -Name Invoke-Pester -Parameter EnableExit\n\n.PARAMETER OutputFile\nGet-Help -Name Invoke-Pester -Parameter OutputFile\n\n.PARAMETER CodeCoverage\nGet-Help -Name Invoke-Pester -Parameter CodeCoverage\n\n.PARAMETER PesterOption\nGet-Help -Name Invoke-Pester -Parameter PesterOption\n\n.PARAMETER CodeCoverageOutputFile\nGet-Help -Name Invoke-Pester -Parameter CodeCoverageOutputFile\n\n.PARAMETER CodeCoverageOutputFileFormat\nGet-Help -Name Invoke-Pester -Parameter CodeCoverageOutputFileFormat\n\n.LINK\nhttps://dbachecks.readthedocs.io/en/latest/functions/Invoke-DbcCheck/\n\n.EXAMPLE\nInvoke-DbcCheck -Tag Backup -SqlInstance sql2016\n\nRuns all of the checks tagged Backup against the sql2016 instance\n\n.EXAMPLE\nInvoke-DbcCheck -Tag RecoveryModel -SqlInstance sql2017, sqlcluster -SqlCredential (Get-Credential sqladmin)\n\nRuns the Recovery model check against the SQL instances sql2017, sqlcluster\nusing the sqladmin SQL login with the password provided interactively\n\n.EXAMPLE\nInvoke-DbcCheck -Check Database -ExcludeCheck AutoShrink -ConfigFile \\\\share\\repo\\prod.json\n\nRuns all of the checks tagged Database except for the AutoShrink check against\nthe SQL Instances set in the config under app.sqlinstance\n\nImports configuration file, \\\\share\\repo\\prod.json, prior to executing checks.\n\n.EXAMPLE\n# Set the servers you'll be working with\nSet-DbcConfig -Name app.sqlinstance -Value sql2016, sql2017, sql2008, sql2008\\express\nSet-DbcConfig -Name app.computername -Value sql2016, sql2017, sql2008\n\n# Look at the current configs\nGet-DbcConfig\n\n# Invoke a few tests\nInvoke-DbcCheck -Tags SuspectPage, LastBackup\n\nRuns the Suspect Pages and Last Backup checks against the SQL Instances sql2016,\nsql2017, sql2008, sql2008\\express after setting them in the configuration\n\n.EXAMPLE\nInvoke-DbcCheck -SqlInstance sql2017 -Tags SuspectPage, LastBackup -Show Summary -PassThru | Update-DbcPowerBiDataSource\n\nStart-DbcPowerBi\n\nRuns the Suspect Page and Last Backup checks against the SQL Instances set in\nthe config under app.sqlinstance only showing the summary of the results of the\nchecks. It then updates the source json for the XML which is stored at\nC:\\Windows\\temp\\dbachecks\\ and then opens the PowerBi report in PowerBi Desktop\n\n.EXAMPLE\nGet-Help -Name Invoke-Pester -Examples\n\nWant to get super deep? You can look at Invoke-Pester's example's and run them against Invoke-DbcCheck since it's a wrapper.\n\nhttps://github.com/pester/Pester/wiki/Invoke-Pester\n\nDescribe\nabout_Pester\n#>\n"
  },
  {
    "path": "source/internal/functions/Invoke-DbcCheckv5.ps1",
    "content": "function Invoke-DbcCheckv5 {\n    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidGlobalVars', '', Justification = 'Because scoping is hard')]\n    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', '', Justification = 'Because its set to the global var')]\n    [CmdletBinding(DefaultParameterSetName = 'Default')]\n    param (\n        [Alias('Path', 'relative_path')]\n        [object[]]$Script,\n        [Alias(\"Name\")]\n        [string[]]$TestName,\n        [switch]$EnableExit,\n        [Parameter(Position = 0)]\n        [Alias(\"Tags\", \"Tag\", \"Checks\")]\n        [string[]]$Check,\n        [AllowEmptyCollection()]\n        [Alias(\"ExcludeTags\", \"ExcludeTag\", \"ExcludeChecks\")]\n        [string[]]$ExcludeCheck = (Get-PSFConfigValue -FullName 'dbachecks.command.invokedbccheck.excludecheck' -Fallback @()),\n        [switch]$PassThru,\n        [DbaInstance[]]$SqlInstance,\n        [DbaInstance[]]$ComputerName,\n        [PSCredential]$SqlCredential,\n        [PSCredential]$Credential,\n        [object[]]$Database,\n        [object[]]$ExcludeDatabase = (Get-PSFConfigValue -FullName 'dbachecks.command.invokedbccheck.excludedatabase' -Fallback @()),\n        [string[]]$Value,\n        [string]$ConfigFile,\n        [object[]]$CodeCoverage = @(),\n        [string]$CodeCoverageOutputFile,\n        [ValidateSet('JaCoCo')]\n        [string]$CodeCoverageOutputFileFormat = \"JaCoCo\",\n        [switch]$Strict,\n        [Parameter(Mandatory = $true, ParameterSetName = 'NewOutputSet')]\n        [string]$OutputFile,\n        [ValidateSet('NUnitXml')]\n        [string]$OutputFormat,\n        [switch]$AllChecks,\n        [object]$Configuration\n    )\n\n    dynamicparam {\n        $config = Get-PSFConfig -Module dbachecks\n\n        $RuntimeParamDic = New-Object System.Management.Automation.RuntimeDefinedParameterDictionary\n\n        foreach ($setting in $config) {\n            $name = $setting.Name\n            $name = \"Config\" + (($name.Split(\".\") | ForEach-Object { $_.SubString(0, 1).ToUpper() + $_.SubString(1) }) -join '')\n            $ParamAttrib = New-Object System.Management.Automation.ParameterAttribute\n            $ParamAttrib.ParameterSetName = '__AllParameterSets'\n            $AttribColl = New-Object System.Collections.ObjectModel.Collection[System.Attribute]\n            $AttribColl.Add($ParamAttrib)\n\n            $RuntimeParam = New-Object System.Management.Automation.RuntimeDefinedParameter($name, [object], $AttribColl)\n\n            $RuntimeParamDic.Add($name, $RuntimeParam)\n        }\n        return $RuntimeParamDic\n    }\n\n    begin {\n    }\n\n    process {\n        if (Test-PSFFunctionInterrupt) { return }\n\n        #get the output config for dbatools and store it to set it back at the end\n        $dbatoolsoutputconfig = Get-DbatoolsConfigValue -FullName message.consoleoutput.disable\n        if (!$dbatoolsoutputconfig) {\n            Set-DbatoolsConfig -FullName message.consoleoutput.disable -Value $true\n        }\n\n        # validation (could this be done only in Invoke-DbcCheck ?)\n        if (-not $Script -and -not $TestName -and -not $Check -and -not $ExcludeCheck -and -not $AllChecks) {\n            Stop-PSFFunction -Message \"Please specify Check, ExcludeCheck, Script, TestName or AllChecks\"\n            return\n        }\n        # validition (could this be done only in Invoke-DbcCheck ?)\n\n        if (-not $SqlInstance.InputObject -and -not $ComputerName.InputObject -and -not (Get-PSFConfigValue -FullName dbachecks.app.sqlinstance) -and -not (Get-PSFConfigValue -FullName dbachecks.app.computername) -and -not (Get-PSFConfigValue -FullName dbachecks.app.cluster)) {\n            Stop-PSFFunction -Message \"No servers set to run against. Use Get/Set-DbcConfig to setup your servers or Get-Help Invoke-DbcCheck for additional options.\"\n            return\n        }\n\n        # set these parameters as default parameters to make less writing (and more troubleshooting ;-) )\n        $customparam = 'SqlInstance', 'ComputerName', 'SqlCredential', 'Credential', 'Database', 'ExcludeDatabase', 'Value'\n\n        foreach ($param in $customparam) {\n            if (Test-PSFParameterBinding -ParameterName $param) {\n                $value = Get-Variable -Name $param\n                if ($value.InputObject) {\n                    Set-Variable -Scope 0 -Name $param -Value $value.InputObject -ErrorAction SilentlyContinue\n                    $PSDefaultParameterValues.Add( { \"*-Dba*:$param\", $value.InputObject })\n                }\n            } else {\n                $PSDefaultParameterValues.Remove( { \"*-Dba*:$param\" })\n            }\n            $null = $PSBoundParameters.Remove($param)\n        }\n\n\n        # Another bit of validation here that could be in Invoke-DbcCheck I think\n        # Lil bit of cleanup here, for a switcharoo\n        $null = $PSBoundParameters.Remove('AllChecks')\n        $null = $PSBoundParameters.Remove('Check')\n        $null = $PSBoundParameters.Remove('ExcludeCheck')\n        $null = $PSBoundParameters.Remove('ConfigFile')\n\n        $globalexcludedchecks = Get-PSFConfigValue -FullName dbachecks.command.invokedbccheck.excludecheck\n        $global:ChecksToExclude = $ExcludeCheck + $globalexcludedchecks\n        [string[]]$Script:ExcludedDatabases = Get-PSFConfigValue -FullName dbachecks.command.invokedbccheck.excludedatabases\n        $Script:ExcludedDatabases += $ExcludeDatabase\n\n\n        foreach ($singlecheck in $check) {\n            if ($singlecheck -in $globalexcludedchecks) {\n                Write-PSFMessage -Level Warning -Message \"$singlecheck is excluded in command.invokedbccheck.excludecheck and will be skipped \"\n            }\n        }\n\n        if ($AllChecks -and $globalexcludedchecks) {\n            Write-PSFMessage -Level Warning -Message \"$globalexcludedchecks will be skipped\"\n        }\n\n        if ($ExcludedDatabases) {\n            Write-PSFMessage -Level Warning -Message \"$ExcludedDatabases databases will be skipped for all checks\"\n        }\n\n        # Then we'll need a generic param passer that doesn't require global params\n        # cuz global params are hard\n        # We so shuld have done this :-)\n\n        $finishedAllTheChecks = $false\n        try {\n            $repos = Get-CheckRepo\n            foreach ($repo in $repos) {\n                if ((Test-Path $repo -ErrorAction SilentlyContinue)) {\n                    if ($OutputFormat -eq \"NUnitXml\" -and -not $OutputFile) {\n                        $number = $repos.IndexOf($repo)\n                        $timestamp = Get-Date -Format \"yyyyMMddHHmmss\"\n                        $PSBoundParameters['OutputFile'] = \"$script:maildirectory\\report-$number-$pid-$timestamp.xml\"\n                    }\n\n                    if ($Check.Count -gt 0) {\n                        # specific checks were listed. find the necessary script files.\n\n                        # We are only going to check the files named v5 here is this a good idea?\n                        # Anyone have any better ideas here ? - Remember we need to be able to run under both conditions\n\n                        $Configuration.Run.Path = (Get-CheckFile -Repo $repo -Check $check -v5)\n                    }\n\n                    Push-Location -Path $repo\n                    ## remove any previous entries ready for this run\n                    Set-PSFConfig -Module dbachecks -Name global.notcontactable -Value @()\n\n                    $config = $Configuration | ConvertTo-Json -Depth 5\n                    Write-PSFMessage -Message \"Config = $Config\" -Level Verbose\n                    Write-PSFMessage -Message ($PSBoundParameters | Out-String) -Level Verbose\n\n                    Write-PSFMessage -Message \"SqlInstance is $SqlInstance\" -Level Verbose\n                    # Because we have all these bound params :-(\n                    $null = $PSBoundParameters.Remove('configuration')\n                    Invoke-Pester -Configuration $configuration\n\n                    Pop-Location\n                }\n            }\n            $finishedAllTheChecks = $true\n        } catch {\n            Stop-PSFFunction -Message \"There was a problem executing Invoke-Pester\" -ErrorRecord $psitem\n        } finally {\n            # reset the config to original value\n            Set-DbatoolsConfig -FullName message.consoleoutput.disable -Value $dbatoolsoutputconfig\n\n            if (!($finishedAllTheChecks)) {\n                Write-PSFMessage -Level Warning -Message \"Execution was cancelled!\"\n                Pop-Location\n            }\n        }\n    }\n}\n\n\n<#\n.SYNOPSIS\nInvoke-DbcCheck is a SQL-centric Invoke-Pester wrapper\n\n.DESCRIPTION\nThe Invoke-DbcCheck function runs Pester tests, including *.Tests.ps1 files and Pester tests in PowerShell scripts.\n\nExtended description about Pester: Get-Help -Name Invoke-Pester\n\n.PARAMETER Check\nRuns only tests in Describe blocks with the specified Tag parameter values. Wildcard characters and Tag values that include spaces or whitespace characters are not supported.\n\nWhen you specify multiple Tag values, Invoke-DbcCheck runs tests that have any of the listed tags (it ORs the tags). However, when you specify TestName and Tag values, Invoke-DbcCheck runs only describe blocks that have one of the specified TestName values and one of the specified Tag values.\n\nIf you use both Tag and ExcludeTag, ExcludeTag takes precedence.\n\n.PARAMETER ExcludeCheck\nOmits tests in Describe blocks with the specified Tag parameter values. Wildcard characters and Tag values that include spaces or whitespace characters are not supported.\n\nWhen you specify multiple ExcludeTag values, Invoke-DbcCheck omits tests that have any of the listed tags (it ORs the tags). However, when you specify TestName and ExcludeTag values, Invoke-DbcCheck omits only describe blocks that have one of the specified TestName values and one of the specified Tag values.\n\nIf you use both Tag and ExcludeTag, ExcludeTag takes precedence\n\n.PARAMETER SqlInstance\nA list of SQL Servers to run the tests against. If this is not provided, it will be gathered from:\nGet-DbatoolsConfig -Name app.sqlinstance\n\n.PARAMETER ComputerName\nA list of computers to run the tests against. If this is not provided, it will be gathered from:\nGet-DbatoolsConfig -Name app.computername\n\n.PARAMETER SqlCredential\nAlternate SQL Server-based credential.\n\n.PARAMETER Credential\nAlternate Windows credential.\n\n.PARAMETER Database\nA list of databases to include if your check is database centric.\n\n.PARAMETER ExcludeDatabase\nA list of databases to exclude if your check is database centric.\n\n.PARAMETER PassThru\nReturns a custom object (PSCustomObject) that contains the test results.\n\nBy default, Invoke-DbcCheck writes to the host program, not to the output stream (stdout).\nIf you try to save the result in a variable, the variable is empty unless you\nuse the PassThru parameter.\n\nTo suppress the host output, use the Quiet parameter.\n\n.PARAMETER ConfigFile\nThe path to the exported dbachecks config file.\n\n.PARAMETER OutputFormat\nThe format of output. Currently, only NUnitXML is supported.\n\n.PARAMETER Strict\nMakes Pending and Skipped tests to Failed tests. Useful for continuous integration where you need to make sure all tests passed.\n\n.PARAMETER AllChecks\nIn the unlikely event that you'd like to run all checks, specify -AllChecks. These checks still confirm to the skip settings in Get-DbcConfig.\n\n.PARAMETER Quiet\nThe parameter Quiet is deprecated since Pester v. 4.0 and will be deleted in the next major version of Pester. Please use the parameter Show with value 'None' instead.\n\n.PARAMETER Show\nCustomizes the output Pester writes to the screen.\n\nAvailable options are\nNone\nDefault\nPassed\nFailed\nPending\nSkipped\nInconclusive\nDescribe\nContext\nSummary\nHeader\nAll\nFails\n\nThe options can be combined to define presets.\n\nCommon use cases are:\n\nNone - to write no output to the screen.\nAll - to write all available information (this is default option).\nFails - to write everything except Passed (but including Describes etc.).\n\nA common setting is also Failed, Summary, to write only failed tests and test summary.\n\nThis parameter does not affect the PassThru custom object or the XML output that is written when you use the Output parameters.\n\n.PARAMETER Value\nA value.. it's hard to explain\n\n.PARAMETER Script\nGet-Help -Name Invoke-Pester -Parameter Script\n\n.PARAMETER TestName\nGet-Help -Name Invoke-Pester -Parameter TestName\n\n.PARAMETER EnableExit\nGet-Help -Name Invoke-Pester -Parameter EnableExit\n\n.PARAMETER OutputFile\nGet-Help -Name Invoke-Pester -Parameter OutputFile\n\n.PARAMETER CodeCoverage\nGet-Help -Name Invoke-Pester -Parameter CodeCoverage\n\n.PARAMETER PesterOption\nGet-Help -Name Invoke-Pester -Parameter PesterOption\n\n.PARAMETER CodeCoverageOutputFile\nGet-Help -Name Invoke-Pester -Parameter CodeCoverageOutputFile\n\n.PARAMETER CodeCoverageOutputFileFormat\nGet-Help -Name Invoke-Pester -Parameter CodeCoverageOutputFileFormat\n\n.LINK\nhttps://dbachecks.readthedocs.io/en/latest/functions/Invoke-DbcCheck/\n\n.EXAMPLE\nInvoke-DbcCheck -Tag Backup -SqlInstance sql2016\n\nRuns all of the checks tagged Backup against the sql2016 instance\n\n.EXAMPLE\nInvoke-DbcCheck -Tag RecoveryModel -SqlInstance sql2017, sqlcluster -SqlCredential (Get-Credential sqladmin)\n\nRuns the Recovery model check against the SQL instances sql2017, sqlcluster\nusing the sqladmin SQL login with the password provided interactively\n\n.EXAMPLE\nInvoke-DbcCheck -Check Database -ExcludeCheck AutoShrink -ConfigFile \\\\share\\repo\\prod.json\n\nRuns all of the checks tagged Database except for the AutoShrink check against\nthe SQL Instances set in the config under app.sqlinstance\n\nImports configuration file, \\\\share\\repo\\prod.json, prior to executing checks.\n\n.EXAMPLE\n# Set the servers you'll be working with\nSet-DbcConfig -Name app.sqlinstance -Value sql2016, sql2017, sql2008, sql2008\\express\nSet-DbcConfig -Name app.computername -Value sql2016, sql2017, sql2008\n\n# Look at the current configs\nGet-DbcConfig\n\n# Invoke a few tests\nInvoke-DbcCheck -Tags SuspectPage, LastBackup\n\nRuns the Suspect Pages and Last Backup checks against the SQL Instances sql2016,\nsql2017, sql2008, sql2008\\express after setting them in the configuration\n\n.EXAMPLE\nInvoke-DbcCheck -SqlInstance sql2017 -Tags SuspectPage, LastBackup -Show Summary -PassThru | Update-DbcPowerBiDataSource\n\nStart-DbcPowerBi\n\nRuns the Suspect Page and Last Backup checks against the SQL Instances set in\nthe config under app.sqlinstance only showing the summary of the results of the\nchecks. It then updates the source json for the XML which is stored at\nC:\\Windows\\temp\\dbachecks\\ and then opens the PowerBi report in PowerBi Desktop\n\n.EXAMPLE\nGet-Help -Name Invoke-Pester -Examples\n\nWant to get super deep? You can look at Invoke-Pester's example's and run them against Invoke-DbcCheck since it's a wrapper.\n\nhttps://github.com/pester/Pester/wiki/Invoke-Pester\n\nDescribe\nabout_Pester\n#>\n"
  },
  {
    "path": "source/internal/functions/New-Json.ps1",
    "content": "\nfunction New-Json {\n    [CmdletBinding(SupportsShouldProcess)]\n    Param()\n    # Parse repo for tags and descriptions then write json\n    $script:localapp = Get-DbcConfigValue -Name app.localapp\n    $repos = Get-CheckRepo\n    $collection = $groups = $repofiles = @()\n    foreach ($repo in $repos) {\n        $folders = Join-Path -Path $repo -ChildPath '*.Tests.ps1'\n        $repofiles += (Get-ChildItem $folders )\n    }\n    $tokens = $null\n    $errors = $null\n    foreach ($file in $repofiles) {\n        $Check = $null\n        # We dont want to mess with v5 files - although we will need to write the json for them\n        if ($file.Name -notmatch 'v5') {\n            $message = \"We are going to look at this file {0}\" -f $file.Name\n            Write-PSFMessage -Message $message -Level Verbose\n            $filename = $file.Name.Replace(\".Tests.ps1\", \"\")\n            #  Write-Verbose \"Processing $FileName\"\n            #  Write-Verbose \"Getting Content of File\"\n            $Check = [System.IO.File]::ReadAllText($file)\n\n            # because custom checks if they are not coded correctly will break this json creation\n            # and they wont get added nicely so that they can be targetted with tags (checks)\n            # this part will check all of the files and ensure that they have the filename variabel at the top and that\n            # each describe is using Tags not Tag and the last tag is the $filename\n\n            if ($Filename -notin ('Agent', 'Database', 'Domain', 'HADR', 'Instance', 'LogShipping', 'MaintenanceSolution', 'Server')) {\n\n                #all checks files MUST have this at the top\n                if ($Check -notmatch '\\$filename = \\$MyInvocation\\.MyCommand\\.Name\\.Replace\\(\"\\.Tests\\.ps1\", \"\"\\)') {\n                    Write-Verbose \"$Filename does not have the correct value at the top so we will add it\"\n                    $filecontent = @\"\n  `$filename = `$MyInvocation.MyCommand.Name.Replace(\".Tests.ps1\", \"\")\n\n\"@\n                    $filecontent = $filecontent + $Check\n                    if ($PSCmdlet.ShouldProcess(\"$($File.Name)\" , \"Adding the filename variable to the file\")) {\n                        $Check = $null\n                        Set-Content -Path $file -Value $filecontent\n                        Write-Verbose \"Getting Content of File again\"\n                        $Check = [System.IO.File]::ReadAllText($file)\n                    }\n\n                }\n\n                ## Parse the file with AST\n                $CheckFileAST = [Management.Automation.Language.Parser]::ParseInput($check, [ref]$tokens, [ref]$errors)\n\n                #Check that the tags are set correctly otherwise the json doesnt get properly created\n                $Statements = $CheckFileAST.EndBlock.statements.Extent\n                ## Ignore the filename line\n                @($Statements.Where{ $PSItem.StartLineNumber -ne 1 }).ForEach{\n                    #  Write-Verbose \"Checking the Describe Tag $($PSItem.Text.SubString(0,50) )\"\n                    if ($PSItem.Text -notmatch 'Describe \".*\" -Tags .*,.*\\$filename \\{') {\n                        $RogueDescribe = $PSItem.Text.SubString(0, $PSitem.Text.IndexOf('{'))\n                        Write-Warning \"The Describe Tag $RogueDescribe in $($File.Name) is not set up correctly - we will try to fix it for you\"\n                        $replace = $RogueDescribe + ', $Filename '\n                        $Check = $Check -replace $RogueDescribe , $replace\n                        $Check = $Check -replace '-Tag ', '-Tags '\n                        if ($PSCmdlet.ShouldProcess(\"$($File.Name)\" , \"Fixing the tags on the files\")) {\n                            Set-Content $file -Value $Check\n                            $Check = $null\n                        }\n                        #  Write-Verbose \"Getting Content of File again\"\n                        $Check = [System.IO.File]::ReadAllText($file)\n\n                    }\n                }\n            }\n\n            ## Parse the file with AST\n            $CheckFileAST = [Management.Automation.Language.Parser]::ParseInput($check, [ref]$tokens, [ref]$errors)\n\n            ## New code uses a Computer Name loop to speed up execution so need to find that as well\n            $ComputerNameForEach = $CheckFileAST.FindAll([Func[Management.Automation.Language.Ast, bool]] {\n                    param ($ast)\n                    $ast -is [System.Management.Automation.Language.InvokeMemberExpressionAst] -and $ast.expression.Subexpression.Extent.Text -eq 'Get-ComputerName'\n                }, $true).Extent\n\n            ## New code uses a Computer Name loop to speed up execution so need to find that as well\n            $InstanceNameForEach = $CheckFileAST.FindAll([Func[Management.Automation.Language.Ast, bool]] {\n                    param ($ast)\n                    $ast -is [System.Management.Automation.Language.InvokeMemberExpressionAst] -and $ast.expression.Subexpression.Extent.Text -eq 'Get-Instance'\n                }, $true).Extent\n\n\n            ## Old code we can use the describes\n            $Describes = $CheckFileAST.FindAll([Func[Management.Automation.Language.Ast, bool]] {\n                    param ($ast)\n                    $ast.CommandElements -and\n                    $ast.CommandElements[0].Value -eq 'Describe'\n                }, $true)\n\n            @($describes).ForEach{\n                $groups += $filename\n                $Describe = $_.CommandElements.Where{ $PSItem.StaticType.name -eq 'string' }[1]\n                $title = $Describe.Value\n                $Tags = $PSItem.CommandElements.Where{ $PSItem.StaticType.name -eq 'Object[]' -and $null -eq $psitem.Value }.Extent.Text.ToString().Replace(', $filename', '')\n                # CHoose the type\n                if ($Describe.Parent -match \"Get-Instance\") {\n                    $type = \"Sqlinstance\"\n                } elseif ($Describe.Parent -match \"Get-ComputerName\" -or $Describe.Parent -match \"AllServerInfo\") {\n                    $type = \"ComputerName\"\n                } elseif ($Describe.Parent -match \"Get-ClusterObject\") {\n                    $Type = \"ClusterNode\"\n                } else {\n                    #Choose the type from the new way from inside the foreach\n                    if ($ComputerNameForEach -match $title) {\n                        $type = \"ComputerName\"\n                    } elseif ($InstanceNameForEach -match $title) {\n                        $type = \"Sqlinstance\"\n                    } else {\n                        $type = $null\n                    }\n                }\n\n                if ($filename -eq 'HADR') {\n                    ## HADR configs are outside of describe\n                    $configs = [regex]::matches($check, \"Get-DbcConfigValue\\s([a-zA-Z\\d]*.[a-zA-Z\\d]*.[a-zA-Z\\d]*.[a-zA-Z\\d]*\\b)\").groups.Where{ $_.Name -eq 1 }.Value\n                } else {\n                    $configs = [regex]::matches($describe.Parent.Extent.Text, \"Get-DbcConfigValue\\s([a-zA-Z\\d]*.[a-zA-Z\\d]*.[a-zA-Z\\d]*.[a-zA-Z\\d]*\\b)\").groups.Where{ $_.Name -eq 1 }.Value\n                }\n                $Config = ''\n                foreach ($c in $Configs) { $config += \"$c \" } # DON't DELETE THE SPACE in \"$c \"\n                if ($filename -eq 'MaintenanceSolution') {\n                    # The Maintenance Solution needs a bit of faffing as the configs for the jobnames are used to create the titles\n                    switch ($tags -match $PSItem) {\n                        { $Tags.Contains('SystemFull') } {\n                            $config = 'ola.JobName.SystemFull ' + $config\n                            $title = 'Ola - ' + (Get-DbcConfigValue -Name ola.jobname.systemfull)\n                        }\n                        { $Tags.Contains('UserFull') } {\n                            $config = 'ola.JobName.UserFull ' + $config\n                            $title = 'Ola - ' + (Get-DbcConfigValue -Name ola.jobname.userfull)\n                        }\n                        { $Tags.Contains('UserDiff') } {\n                            $config = 'ola.JobName.UserDiff ' + $config\n                            $title = 'Ola - ' + (Get-DbcConfigValue -Name ola.jobname.userdiff)\n                        }\n                        { $Tags.Contains('UserLog') } {\n                            $config = 'ola.JobName.UserLog ' + $config\n                            $title = 'Ola - ' + (Get-DbcConfigValue -Name ola.jobname.userlog)\n                        }\n                        { $Tags.Contains('CommandLog') } {\n                            $config = 'ola.JobName.CommandLogCleanup ' + $config\n                            $title = 'Ola - ' + (Get-DbcConfigValue -Name ola.jobname.commandlogcleanup)\n                        }\n                        { $Tags.Contains('SystemIntegrityCheck') } {\n                            $config = 'ola.JobName.SystemIntegrity ' + $config\n                            $title = 'Ola - ' + (Get-DbcConfigValue -Name ola.jobname.systemintegrity)\n                        }\n                        { $Tags.Contains('UserIntegrityCheck') } {\n                            $config = 'ola.JobName.UserIntegrity ' + $config\n                            $title = 'Ola - ' + (Get-DbcConfigValue -Name ola.jobname.userintegrity)\n                        }\n                        { $Tags.Contains('UserIndexOptimize') } {\n                            $config = 'ola.JobName.UserIndex ' + $config\n                            $title = 'Ola - ' + (Get-DbcConfigValue -Name ola.jobname.userindex)\n                        }\n                        { $Tags.Contains('OutputFileCleanup') } {\n                            $config = 'ola.JobName.OutputFileCleanup ' + $config\n                            $title = 'Ola - ' + (Get-DbcConfigValue -Name ola.jobname.outputfilecleanup)\n                        }\n                        { $Tags.Contains('DeleteBackupHistory') } {\n                            $config = 'ola.JobName.DeleteBackupHistory ' + $config\n                            $title = 'Ola - ' + (Get-DbcConfigValue -Name ola.jobname.deletebackuphistory)\n                        }\n                        { $Tags.Contains('PurgeJobHistory') } {\n                            $config = 'ola.JobName.PurgeBackupHistory ' + $config\n                            $title = 'Ola - ' + (Get-DbcConfigValue -Name ola.jobname.purgebackuphistory)\n                        }\n                        Default {}\n                    }\n                }\n                # add the config for the type\n                switch ($type) {\n                    SqlInstance { $config = 'app.sqlinstance ' + $config }\n                    ComputerName { $config = 'app.computername ' + $config }\n                    ClusterNode { $config = 'app.sqlinstance ' + $config }\n                    Default {}\n                }\n                if (-not $config) { $config = \"None\" }\n                $collection += [pscustomobject]@{\n                    Group       = $filename\n                    Type        = $type\n                    UniqueTag   = $null\n                    AllTags     = \"$tags, $filename\"\n                    Config      = $config\n                    Description = $null\n                    Describe    = $title\n                }\n            }\n        }\n    }\n    $singletags = (($collection.AllTags -split \",\").Trim() | Group-Object | Where-Object { $_.Count -eq 1 -and $_.Name -notin $groups })\n    $descriptionsFile = Join-Path -Path $script:ModuleRoot -ChildPath 'internal\\configurations\\DbcCheckDescriptions.json'\n    $descriptions = [System.IO.File]::ReadAllText($descriptionsFile) | ConvertFrom-Json\n    foreach ($check in $collection) {\n        $unique = $singletags | Where-Object { $_.Name -in ($check.AllTags -split \",\").Trim() }\n        $check.UniqueTag = $unique.Name\n        $Check.Description = $Descriptions.Where{ $_.UniqueTag -eq $Check.UniqueTag }.Description\n    }\n    try {\n        $checksfile = Join-Path -Path $script:localapp -ChildPath 'checks.json'\n        if ($PSCmdlet.ShouldProcess($checksfile  , \"Convert Json and write to file\")) {\n            ConvertTo-Json -InputObject $collection | Out-File $checksfile\n        }\n    } catch {\n        Write-PSFMessage \"Failed to create the json, something weird might happen now with tags and things\" -Level Significant\n    }\n\n}\n"
  },
  {
    "path": "source/internal/functions/NewGet-AllInstanceInfo.ps1",
    "content": "function NewGet-AllInstanceInfo {\n    # Using the unique tags gather the information required\n    Param($Instance, $Tags)\n\n    #clear out the default initialised fields\n    $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Server], $false)\n    $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Database], $false)\n    $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Login], $false)\n    $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Agent.Job], $false)\n    $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.StoredProcedure], $false)\n    $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Information], $false)\n    $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Settings], $false)\n    $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.LogFile], $false)\n    $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.DataFile], $false)\n\n    # set the default init fields for all the tags\n\n    # Server Initial fields\n    $ServerInitFields = $Instance.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Server])\n    $ServerInitFields.Add(\"VersionMajor\") | Out-Null # so we can check versions\n    $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Server], $ServerInitFields)\n\n    # Database Initial Fields\n    $DatabaseInitFields = $Instance.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Database])\n\n    # Stored Procedure Initial Fields\n    $StoredProcedureInitFields = $Instance.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.StoredProcedure])\n\n    # Information Initial Fields\n\n    # Settings Initial Fields\n    $SettingsInitFields = $Instance.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Settings])\n\n    # Login Initial Fields\n    $LoginInitFields = $Instance.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Login])\n\n    # Log File Initial Fields\n    $LogFileInitFields = $Instance.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.LogFile])\n\n    # Data File Initial Fields\n    $DataFileInitFields = $Instance.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.DataFile])\n\n    # Configuration cannot have default init fields :-)\n    $configurations = $false\n\n    # Set up blank ConfigValues object for any config we need to use in the checks\n    $ConfigValues = [PSCustomObject]@{}\n\n    # Using there so that if the instance is not contactable, no point carrying on with gathering more information\n    switch ($tags) {\n\n        'DefaultTrace' {\n            $configurations = $true\n        }\n        'OleAutomationProceduresDisabled' {\n            $configurations = $true\n        }\n        'CrossDBOwnershipChaining' {\n            $configurations = $true\n        }\n        'ScanForStartupProceduresDisabled' {\n            # we have to check the spconfigure and we have to check that any stored procedurees in master have startup set to true\n            $configurations = $true\n            $ScanForStartupProceduresDisabled = $true\n            $StoredProcedureInitFields.Add(\"Startup\") | Out-Null # So we can check SPs start up for the CIS checks\n            $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.StoredProcedure], $StoredProcedureInitFields)\n            $StoredProcedureInitFields = $Instance.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.StoredProcedure]) #  I think we need to re-initialise here\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'scanforstartupproceduresdisabled' -Value (($__dbcconfig | Where-Object { $_.Name -eq 'policy.security.scanforstartupproceduresdisabled' }).Value)\n        }\n        'RemoteAccessDisabled' {\n            $configurations = $true\n        }\n        'SQLMailXPsDisabled' {\n            $configurations = $true\n        }\n        'DAC' {\n            $configurations = $true\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'dacallowed' -Value (($__dbcconfig | Where-Object { $_.Name -eq 'policy.dacallowed' }).Value)\n        }\n        'OLEAutomation' {\n            $configurations = $true\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'OLEAutomation' -Value (($__dbcconfig | Where-Object { $_.Name -eq 'policy.oleautomation' }).Value)\n        }\n        'AdHocWorkload' {\n            $configurations = $true\n        }\n        'AdHocDistributedQueriesEnabled' {\n            $configurations = $true\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'AdHocDistributedQueriesEnabled' -Value (($__dbcconfig | Where-Object { $_.Name -eq 'policy.security.AdHocDistributedQueriesEnabled' }).Value)\n        }\n        'DefaultBackupCompression' {\n            $configurations = $true\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'DefaultBackupCompression' -Value (($__dbcconfig | Where-Object { $_.Name -eq 'policy.backup.defaultbackupcompression' }).Value)\n        }\n        'DefaultFilePath' {\n            $SettingsInitFields.Add(\"DefaultFile\") | Out-Null # so we can check file paths\n            $SettingsInitFields.Add(\"DefaultLog\") | Out-Null # so we can check file paths\n            $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Settings], $SettingsInitFields)\n        }\n        'SaRenamed' {\n        }\n        'SaDisabled' {\n            $LoginInitFields.Add(\"IsDisabled\") | Out-Null # so we can check if sa is disabled\n            $LoginInitFields.Add(\"ID\") | Out-Null # so we can check if sa is disabled even if it has been renamed\n            $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Settings], $LoginInitFields)\n        }\n        'ModelDbGrowth' {\n            $LogFileInitFields.Add(\"Growth\") | Out-Null # So we can check the model file growth settings\n            $LogFileInitFields.Add(\"GrowthType\") | Out-Null # So we can check the model file growth settings\n            $LogFileInitFields.Add(\"Name\") | Out-Null # So we can check the model file growth settings\n            $DataFileInitFields.Add(\"Growth\") | Out-Null # So we can check the model file growth settings\n            $DataFileInitFields.Add(\"GrowthType\") | Out-Null # So we can check the model file growth settings\n            $DataFileInitFields.Add(\"Name\") | Out-Null # So we can check the model file growth settings\n            $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.LogFile], $LogFileInitFields)\n            $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.DataFile], $DataFileInitFields)\n            $LogFileInitFields = $Instance.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.LogFile]) #  I think we need to re-initialise here\n            $DataFileInitFields = $Instance.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.DataFile]) #  I think we need to re-initialise here\n\n        }\n        'ErrorlogCount' {\n\n            $ServerInitFields.Add(\"NumberOfLogFiles\") | Out-Null # so we can check versions\n            $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Server], $ServerInitFields)\n            $ServerInitFields = $Instance.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Server]) #  I think we need to re-initialise here\n\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'errorLogCount' -Value (($__dbcconfig | Where-Object { $_.Name -eq 'policy.errorlog.logcount' }).Value)\n\n        }\n        'MaxDopInstance' {\n            #Test-DbaMaxDop needs these because it checks every database as well\n            $DatabaseInitFields.Add(\"IsAccessible\") | Out-Null # so we can check if its accessible\n            $DatabaseInitFields.Add(\"IsSystemObject \") | Out-Null # so we can check if its accessible\n            $DatabaseInitFields.Add(\"MaxDop \") | Out-Null # so we can check if its accessible\n            $DatabaseInitFields.Add(\"Name \") | Out-Null # so we can check if its accessible\n            $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Database], $DatabaseInitFields)\n            $DatabaseInitFields = $Instance.GetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Database]) #  I think we need to re-initialise here\n\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'UseRecommendedMaxDop' -Value (($__dbcconfig | Where-Object { $_.Name -eq 'policy.instancemaxdop.userecommended' }).Value)\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'InstanceMaxDop' -Value (($__dbcconfig | Where-Object { $_.Name -eq 'policy.instancemaxdop.maxdop' }).Value)\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'ExcludeInstanceMaxDop' -Value (($__dbcconfig | Where-Object { $_.Name -eq 'policy.instancemaxdop.excludeinstance' }).Value)\n            if ($Instance.Name -notin $ConfigValues.ExcludeInstanceMaxDop) {\n                $MaxDopSettings = (Test-DbaMaxDop -SqlInstance $Instance)[0] # because we dont care about the database maxdops here - potentially we could store it and use it for DatabaseMaxDop ?\n            }\n        }\n        'TwoDigitYearCutoff' {\n            $configurations = $true\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'TwoDigitYearCutoff' -Value (($__dbcconfig | Where-Object { $_.Name -eq 'policy.twodigityearcutoff' }).Value)\n\n        }\n        'TraceFlagsExpected' {\n            $TraceFlagsExpected = ($__dbcconfig | Where-Object { $_.Name -eq 'policy.traceflags.expected' }).Value\n            $TraceFlagsActual = $Instance.EnumActiveGlobalTraceFlags()\n            if (-not $ConfigValues.TraceFlagsExpected) {\n                $ConfigValues | Add-Member -MemberType NoteProperty -Name 'TraceFlagsExpected' -Value $TraceFlagsExpected -Force\n            }\n            $ExpectedTraceFlags = $TraceFlagsExpected.Foreach{\n                [PSCustomObject]@{\n                    InstanceName      = $Instance.Name\n                    ExpectedTraceFlag = $PSItem\n                    ActualTraceFlags  = $TraceFlagsActual\n                }\n            }\n            $ExpectedTraceFlags += [PSCustomObject]@{\n                InstanceName      = $Instance.Name\n                ExpectedTraceFlag = 'null'\n                ActualTraceFlags  = $TraceFlagsActual\n            }\n        }\n        'TraceFlagsNotExpected' {\n            $TraceFlagsNotExpected = ($__dbcconfig | Where-Object { $_.Name -eq 'policy.traceflags.notexpected' }).Value\n            $TraceFlagsExpected = ($__dbcconfig | Where-Object { $_.Name -eq 'policy.traceflags.expected' }).Value\n            if ($null -eq $TraceFlagsExpected) { $TraceFlagsExpected = 'none expected' }\n            $TraceFlagsActual = $Instance.EnumActiveGlobalTraceFlags()\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'TraceFlagsNotExpected' -Value $TraceFlagsNotExpected\n            if (-not $ConfigValues.TraceFlagsExpected) {\n                $ConfigValues | Add-Member -MemberType NoteProperty -Name 'TraceFlagsExpected' -Value $TraceFlagsExpected -Force\n            }\n            $NotExpectedTraceFlags = $TraceFlagsNotExpected.Where{ $_ -notin $TraceFlagsExpected }.Foreach{\n                [PSCustomObject]@{\n                    InstanceName         = $Instance.Name\n                    NotExpectedTraceFlag = $PSItem\n                    TraceFlagsExpected   = $TraceFlagsExpected\n                    ActualTraceFlags     = $TraceFlagsActual\n                }\n            }\n            $NotExpectedTraceFlags += [PSCustomObject]@{\n                InstanceName         = $Instance.Name\n                TraceFlagsExpected   = $TraceFlagsExpected\n                NotExpectedTraceFlag = 'null'\n                ActualTraceFlags     = $TraceFlagsActual\n            }\n        }\n        'CLREnabled' {\n            $configurations = $true\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'CLREnabled' -Value (($__dbcconfig | Where-Object { $_.Name -eq 'policy.security.clrenabled' }).Value)\n        }\n        'WhoIsActiveInstalled' {\n            $configurations = $true\n            $WhoIsActiveInstalled = $true\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'whoisactivedatabase' -Value (($__dbcconfig | Where-Object { $_.Name -eq 'policy.whoisactive.database' }).Value)\n        }\n        'XpCmdShellDisabled' {\n            $configurations = $true\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'XpCmdShellDisabled' -Value (($__dbcconfig | Where-Object { $_.Name -eq 'policy.security.XpCmdShellDisabled' }).Value)\n\n        }\n        'XESessionStopped' {\n            if (-not $xeSessions) {\n                $xeSessions = Get-DbaXESession -SqlInstance $Instance\n            }\n            $RequiredStopped = (($__dbcconfig | Where-Object { $_.Name -eq 'policy.xevent.requiredstoppedsession' }).Value)\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'requiredstoppedsession' -Value $RequiredStopped\n            if (-not $xeSessions) {\n                $RunningSessions = $xeSessions.Where{ $_.Status -eq 'Running' }.Name\n            }\n            if (-not $Sessions) {\n                $Sessions = $xeSessions.Name\n            }\n        }\n        'XESessionExists' {\n            if (-not $xeSessions) {\n                $xeSessions = Get-DbaXESession -SqlInstance $Instance\n            }\n            $RequiredExists = (($__dbcconfig | Where-Object { $_.Name -eq 'policy.xevent.requiredexists' }).Value)\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'requiredexistssessions' -Value $RequiredExists\n            if (-not $RunningSessions) {\n                $RunningSessions = $xeSessions.Where{ $_.Status -eq 'Running' }.Name\n            }\n            if (-not $Sessions) {\n                $Sessions = $xeSessions.Name\n            }\n        }\n        'XESessionRunning' {\n            if (-not $xeSessions) {\n                $xeSessions = Get-DbaXESession -SqlInstance $Instance\n            }\n            $RequiredRunning = (($__dbcconfig | Where-Object { $_.Name -eq 'policy.xevent.requiredrunningsession' }).Value)\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'requiredrunningsession' -Value $RequiredRunning\n            if (-not $RunningSessions) {\n                $RunningSessions = $xeSessions.Where{ $_.Status -eq 'Running' }.Name\n            }\n            if (-not $Sessions) {\n                $Sessions = $xeSessions.Name\n            }\n        }\n        'XESessionRunningAllowed' {\n            if (-not $xeSessions) {\n                $xeSessions = Get-DbaXESession -SqlInstance $Instance\n            }\n            $RunningAllowed = (($__dbcconfig | Where-Object { $_.Name -eq 'policy.xevent.validrunningsession' }).Value)\n            $ConfigValues | Add-Member -MemberType NoteProperty -Name 'validrunningsession' -Value $RunningAllowed\n            if (-not $RunningSessions) {\n                $RunningSessions = $xeSessions.Where{ $_.Status -eq 'Running' }.Name\n            }\n            if (-not $Sessions) {\n                $Sessions = $xeSessions.Name\n            }\n        }\n        'ErrorLog' {\n            $logWindow = ($__dbcconfig | Where-Object { $_.Name -eq 'policy.errorlog.warningwindow' }).Value\n            # so that it can be mocked\n            function Get-ErrorLogEntry {\n                # get the number of the first error log that was created after the log window config\n                $OldestErrorLogNumber = ($InstanceSMO.EnumErrorLogs() | Where-Object { $psitem.CreateDate -gt (Get-Date).AddDays( - $LogWindow) } | Sort-Object ArchiveNo -Descending | Select-Object -First 1).ArchiveNo + 1\n                # Get the Error Log entries for each one\n                    (0..$OldestErrorLogNumber).ForEach{\n                    $InstanceSMO.ReadErrorLog($psitem).Where{ $_.Text -match \"Severity: 1[7-9]|Severity: 2[0-4]\" }\n                }\n            }\n            # It is not enough to check the CreateDate on the log, you must check the LogDate on every error record as well.\n            $ErrorLogCount = (Get-ErrorLogEntry | Where-Object { $psitem.LogDate -gt (Get-Date).AddDays( - $LogWindow) }).Count\n        }\n        'TempDbConfiguration' {\n            $TempDBTest = Test-DbaTempDbConfig -SqlInstance $Instance\n        }\n        'InstanceConnection' {\n            #local is always NTLM except when its a container ;-)\n            if ($Instance.ComputerNamePhysicalNetBIOS -eq $ENV:COMPUTERNAME -and ($instance.Name -notlike '*,*')) {\n                $authscheme = 'skipped-local'\n            } else {\n                if (-not(($__dbcconfig | Where-Object { $_.Name -eq 'skip.connection.auth' }).Value)) {\n                    $authscheme = $instance.Query(\"Select auth_scheme as AuthScheme FROM sys.dm_exec_connections WHERE session_id = @@SPID\").AuthScheme\n                } else {\n                    $authscheme = 'skipped'\n                }\n            }\n            if ($IsWindows) {\n                if (-not(($__dbcconfig | Where-Object { $_.Name -eq 'skip.connection.ping' }).Value)) {\n                    $pingu = New-Object System.Net.NetworkInformation.Ping\n                    $timeout = 1000 #milliseconds\n                    $ping = ($pingu.Send($instance.ComputerName, $timeout)).Status\n                } else {\n                    $ping = 'skipped'\n                }\n            } else {\n                $ping = 'skipped'\n            }\n\n\n            if (-not(($__dbcconfig | Where-Object { $_.Name -eq 'skip.connection.remote' }).Value)) {\n                #simple remoting check\n                try {\n                    $null = Invoke-Command -ComputerName $instance.ComputerName -ScriptBlock { Get-ChildItem } -ErrorAction Stop\n                    $remote = $true\n                } catch {\n                    $remote = $false\n                }\n            } else {\n                $remote = 'skipped'\n            }\n\n            $InstanceConnection = @{\n                Connect    = $true # because we wouldnt get here otherwise\n                AuthScheme = $authscheme\n                Ping       = $ping\n                Remote     = $remote\n            }\n        }\n        'BackUpPathAccess' {\n            # get value from config or from default setting\n            $BackupPath = ($__dbcconfig | Where-Object { $_.Name -eq 'policy.storage.backuppath' }).Value\n            if (-not $BackupPath) {\n                $BackupPath = $Instance.BackupDirectory\n            }\n            $BackupPathAccess = Test-DbaPath -SqlInstance $Instance -Path $BackupPath\n        }\n        'LatestBuild' {\n            $LatestBuild = Test-DbaBuild -SqlInstance $Instance -Latest\n        }\n        'NetworkLatency' {\n            $NetworkThreshold = ($__dbcconfig | Where-Object { $_.Name -eq 'policy.network.latencymaxms' }).Value\n            $Latency = (Test-DbaNetworkLatency -SqlInstance $Instance).NetworkOnlyTotal.TotalMilliseconds\n        }\n\n        'LinkedServerConnection' {\n            $LinkedServerResults = Test-DbaLinkedServerConnection -SqlInstance $Instance\n        }\n\n        'MaxMemory' {\n            if ($isLinux -or $isMacOS) {\n                $totalMemory = $Instance.PhysicalMemory\n                # Some servers under-report by 1.\n                if (($totalMemory % 1024) -ne 0) {\n                    $totalMemory = $totalMemory + 1\n                }\n                $MaxMemory = [PSCustomObject]@{\n                    MaxValue         = $Instance.Configuration.MaxServerMemory.ConfigValue + 379\n                    RecommendedValue = $totalMemory\n                    # because we added 379 before and I have zero idea why\n                }\n            } else {\n                $MemoryValues = Test-DbaMaxMemory -SqlInstance $Instance\n                $MaxMemory = [PSCustomObject]@{\n                    MaxValue         = $MemoryValues.MaxValue\n                    RecommendedValue = $MemoryValues.RecommendedValue\n                }\n            }\n        }\n\n        'OrphanedFile' {\n            $FileCount = @(Find-DbaOrphanedFile -SqlInstance $Instance).Count\n        }\n\n        'ServerNameMatch' {\n            $ServerNameMatchconfiguredServerName = $Instance.Query(\"SELECT @@servername AS ServerName\").ServerName\n            $ServerNameMatchnetName = $Instance.NetName\n            $ServerNameMatchrenamerequired = $ServerNameMatchnetName -ne $ServerNameMatchconfiguredServerName\n        }\n\n        'MemoryDump' {\n            $maxdumps = ($__dbcconfig | Where-Object { $_.Name -eq 'policy.dump.maxcount' }).Value\n            $daystocheck = ($__dbcconfig | Where-Object { $_.Name -eq 'policy.instance.memorydumpsdaystocheck' }).Value\n            if ($null -eq $daystocheck) {\n                $datetocheckfrom = '0001-01-01'\n            } else {\n                $datetocheckfrom = (Get-Date).ToUniversalTime().AddDays( - $daystocheck )\n            }\n            if (($InstanceSMO.Version.Major -lt 11 -and (-not ($InstanceSMO.Version.Major -eq 10 -and $InstanceSMO.Version.Minor -eq 50)))) {\n                $MemoryDumpCount = 0\n            } else {\n                # Warning Action removes dbatools output for version too low from test results\n                # Skip on the it will show in the results\n                $MemoryDumpCount = (@(Get-DbaDump -SqlInstance $Instance -WarningAction SilentlyContinue).Where{ $_.CreationTime -gt $datetocheckfrom }).Count\n            }\n\n            $Dump = [pscustomobject] @{\n                DumpCount         = $MemoryDumpCount\n                MaxDumps          = $maxdumps\n                DumpDateCheckFrom = $datetocheckfrom\n                Result            = $MemoryDumpCount -le $maxdumps\n            }\n        }\n\n        'HideInstance' {\n            try {\n                $HideInstance = [pscustomobject] @{\n                    Result = (Get-DbaHideInstance -SqlInstance $InstanceSMO).HideInstance\n                }\n            } catch {\n                $HideInstance = [pscustomobject] @{\n                    Result = 'We Could not Connect to $Instance'\n                }\n            }\n        }\n\n        'LoginAuditFailed' {\n            $SettingsInitFields.Add(\"AuditLevel\") | Out-Null # so we can check auditlevel\n            $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Settings], $SettingsInitFields)\n        }\n\n        'LoginAuditSuccessful' {\n            $SettingsInitFields.Add(\"AuditLevel\") | Out-Null # so we can check auditlevel\n            $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Settings], $SettingsInitFields)\n        }\n\n        'LoginCheckPolicy' {\n            $LoginInitFields.Add(\"IsDisabled\") | Out-Null # so we can check login check policy\n            $LoginInitFields.Add(\"PasswordPolicyEnforced\") | Out-Null # so we can check login check policy\n            $Instance.SetDefaultInitFields([Microsoft.SqlServer.Management.Smo.Settings], $LoginInitFields)\n        }\n\n        { 'PublicRolePermissions' -or 'PublicPermission' } {\n            #This needs to be done in query just in case the account had already been renamed\n            $query = \"\n                     SELECT Count(*) AS [RowCount]\n                     FROM master.sys.server_permissions\n                     WHERE (grantee_principal_id = SUSER_SID(N'public') and state_desc LIKE 'GRANT%')\n                             AND NOT (state_desc = 'GRANT' and [permission_name] = 'VIEW ANY DATABASE' and class_desc = 'SERVER')\n                             AND NOT (state_desc = 'GRANT' and [permission_name] = 'CONNECT' and class_desc = 'ENDPOINT' and major_id = 2)\n                             AND NOT (state_desc = 'GRANT' and [permission_name] = 'CONNECT' and class_desc = 'ENDPOINT' and major_id = 3)\n                             AND NOT (state_desc = 'GRANT' and [permission_name] = 'CONNECT' and class_desc = 'ENDPOINT' and major_id = 4)\n                             AND NOT (state_desc = 'GRANT' and [permission_name] = 'CONNECT' and class_desc = 'ENDPOINT' and major_id = 5);\n                        \"\n            $PublicRolePermsCount = $Instance.Query($query).RowCount\n        }\n\n        'SuspectPageLimit' {\n            $sql = \"Select\n            COUNT(file_id) as 'SuspectPageCount'\n            from msdb.dbo.suspect_pages\"\n            $SuspectPageCountResult = (($Instance.Query($sql).SuspectPageCount / 1000) * 100 ) -lt ($__dbcconfig | Where-Object { $_.Name -eq 'policy.suspectpage.threshold' }).Value\n        }\n\n        'SupportedBuild' {\n            $BuildWarning = ($__dbcconfig | Where-Object { $_.Name -eq 'policy.build.warningwindow' }).Value\n            $BuildBehind = ($__dbcconfig | Where-Object { $_.Name -eq 'policy.build.behind' }).Value\n            $Date = Get-Date\n            #If $BuildBehind check against SP/CU parameter to determine validity of the build\n            if ($BuildBehind) {\n                $buildBehindResults = Test-DbaBuild -SqlInstance $Instance -SqlCredential $sqlcredential -MaxBehind $BuildBehind\n                $Compliant = $buildBehindResults.Compliant\n\n                #If no $BuildBehind only check against support dates\n            } else {\n                $Compliant = $true\n            }\n\n            $Results = Test-DbaBuild -SqlInstance $Instance -SqlCredential $sqlcredential -Latest\n            [DateTime]$SupportedUntil = Get-Date $results.SupportedUntil -Format O\n            $Build = $results.build\n            #If $BuildWarning, check for support date within the warning window\n            if ($BuildWarning) {\n                [DateTime]$expected = Get-Date ($Date).AddMonths($BuildWarning) -Format O\n                $SupportedUntil | Should -BeGreaterThan $expected -Because \"this build $Build will be unsupported by Microsoft on $(Get-Date $SupportedUntil -Format O) which is less than $BuildWarning months away\"\n            } else {\n                #If neither, check for Microsoft support date\n                $SupportedUntil | Should -BeGreaterThan $Date -Because \"this build $Build is now unsupported by Microsoft\"\n            }\n\n            $SupportedBuild = [pscustomobject]@{\n                BuildBehind            = $BuildBehind\n                Compliant              = $Compliant\n                Build                  = $Build\n                SupportedUntil         = $SupportedUntil\n                Expected               = $expected\n                BuildWarning           = $BuildWarning\n                InsideBuildWarning     = $SupportedUntil -gt $expected\n                InsideMicrosoftSupport = $SupportedUntil -gt $Date\n            }\n        }\n\n        'LoginMustChange' {\n            $loginTimeSql = \"SELECT login_name, MAX(login_time) AS login_time FROM sys.dm_exec_sessions GROUP BY login_name\"\n            $loginTimes = $instance.ConnectionContext.ExecuteWithResults($loginTimeSql).Tables[0]\n            $lastlogin = @{Name = 'LastLogin' ; Expression = { $Name = $_.name; ($loginTimes | Where-Object { $_.login_name -eq $name }).login_time\n                }\n            }\n            $LoginMustChangeCount = ($Instance.Logins | Where-Object { $_.LoginType -eq 'SqlLogin' } | Where-Object { $_.Name -in $Instance.Roles['sysadmin'].EnumMemberNames() } | Select-Object Name, $lastlogin, MustChangePassword, IsDisabled | Where-Object { $_.MustChangePassword -eq $false -and $_.IsDisabled -eq $false -and $null -eq $_.LastLogin }).Count\n        }\n\n        'LoginPasswordExpiration' {\n            $LoginPasswordExpirationCount = ($Instance.Logins | Where-Object { $_.Name -in $Instance.Roles['sysadmin'].EnumMemberNames() } | Where-Object { $_.LoginType -eq 'SqlLogin' -and $_.PasswordExpirationEnabled -EQ $false -and $_.IsDisabled -EQ $false }).Count\n        }\n\n        'AgentServiceAdmin' {\n            try {\n                $SqlAgentService = Get-DbaService -ComputerName $Instance.ComputerName -InstanceName $Instance.DbaInstanceName -Type Agent -ErrorAction SilentlyContinue\n                $LocalAdmins = Invoke-Command -ComputerName $ComputerName -ScriptBlock { Get-LocalGroupMember -Group \"Administrators\" } -ErrorAction SilentlyContinue\n                $AgentServiceAdminExist = $localAdmins.Name.Contains($SqlAgentService.StartName)\n\n            } catch [System.Exception] {\n                if ($_.Exception.Message -like '*No services found in relevant namespaces*') {\n                    $AgentServiceAdminExist = $false\n                } else {\n                    $AgentServiceAdminExist = 'Some sort of failure'\n                }\n            } catch {\n                $AgentServiceAdminExist = 'We Could not Connect to $Instance $ComputerName , $InstanceName from catch'\n            }\n        }\n\n        'SqlEngineServiceAccount' {\n            $starttype = ($__dbcconfig | Where-Object { $_.Name -eq 'policy.instance.sqlenginestart' }).Value\n            $state = ($__dbcconfig | Where-Object { $_.Name -eq 'policy.instance.sqlenginestate' }).Value\n            try {\n                $EngineAccounts = Get-DbaService -ComputerName $psitem -Type Engine -ErrorAction Stop\n\n            } catch [System.Exception] {\n                if ($_.Exception.Message -like '*No services found in relevant namespaces*') {\n                    $EngineAccounts = [PSCustomObject]@{\n                        InstanceName      = $Instance.Name\n                        State             = 'unknown'\n                        ExpectedState     = $state\n                        StartType         = 'unknown'\n                        ExpectedStartType = $starttype\n                        because           = 'Some sort of failure - No services found in relevant namespaces'\n                    }\n                } else {\n                    $EngineAccounts = [PSCustomObject]@{\n                        InstanceName      = $Instance.Name\n                        State             = 'unknown'\n                        ExpectedState     = $state\n                        StartType         = 'unknown'\n                        ExpectedStartType = $starttype\n                        because           = 'Some sort of failure'\n                    }\n                }\n            } catch {\n                $EngineAccounts = [PSCustomObject]@{\n                    InstanceName      = $Instance.Name\n                    State             = 'unknown'\n                    ExpectedState     = $state\n                    StartType         = 'unknown'\n                    ExpectedStartType = $starttype\n                    because           = 'We Could not Connect to $Instance $ComputerName , $InstanceName from catch'\n                }\n            }\n\n            if ($Instance.IsClustered) {\n                $starttype = 'Manual'\n                $because = 'This is a clustered instance and Clustered Instances required that the SQL engine service is set to manual'\n            } else {\n                $because = \"The SQL Service Start Type was expected to be $starttype\"\n            }\n\n            $SqlEngineServiceAccount = foreach ($EngineAccount in $EngineAccounts) {\n                [PSCustomObject]@{\n                    InstanceName      = $Instance.Name\n                    State             = $EngineAccount.State\n                    ExpectedState     = $state\n                    StartType         = $EngineAccount.StartType\n                    ExpectedStartType = $starttype\n                    because           = $because\n                }\n            }\n        }\n\n        Default { }\n    }\n\n    #build the object\n\n    $testInstanceObject = [PSCustomObject]@{\n        ComputerName                 = $Instance.ComputerName\n        InstanceName                 = $Instance.DbaInstanceName\n        Name                         = $Instance.Name\n        ConfigValues                 = $ConfigValues\n        VersionMajor                 = $Instance.VersionMajor\n        Configuration                = if ($configurations) { $Instance.Configuration } else { $null }\n        Settings                     = $Instance.Settings\n        Logins                       = $Instance.Logins\n        Databases                    = $Instance.Databases\n        NumberOfLogFiles             = $Instance.NumberOfLogFiles\n        MaxDopSettings               = $MaxDopSettings\n        ExpectedTraceFlags           = $ExpectedTraceFlags\n        NotExpectedTraceFlags        = $NotExpectedTraceFlags\n        XESessions                   = [pscustomobject]@{\n            RequiredStopped = $RequiredStopped.ForEach{\n                [pscustomobject]@{\n                    Name        = $Instance.Name\n                    SessionName = $PSItem\n                    Running     = $RunningSessions\n                }\n            }\n            RequiredExists  = $RequiredExists.ForEach{\n                [pscustomobject]@{\n                    Name        = $Instance.Name\n                    SessionName = $PSItem\n                    Sessions    = $Sessions\n                }\n            }\n            RequiredRunning = $RequiredRunning.ForEach{\n                [pscustomobject]@{\n                    Name        = $Instance.Name\n                    SessionName = $PSItem\n                    Sessions    = $Sessions\n                    Running     = $RunningSessions\n                }\n            }\n            RunningAllowed  = $RunningSessions.ForEach{\n                [pscustomobject]@{\n                    Name        = $Instance.Name\n                    SessionName = $PSItem\n                    Sessions    = $Sessions\n                    Allowed     = $RunningAllowed\n                }\n            }\n            Name            = $Instance.Name\n            Sessions        = $Sessions\n            Running         = $RunningSessions\n        }\n        ErrorLogEntries              = [pscustomobject]@{\n            errorLogCount = $ErrorLogCount\n            logWindow     = $logWindow\n        }\n        InstanceConnection           = $InstanceConnection\n        BackupPathAccess             = [pscustomobject]@{\n            Result     = $BackupPathAccess\n            BackupPath = $BackupPath\n        }\n        LatestBuild                  = [PSCustomObject]@{\n            Compliant = $LatestBuild.Compliant\n        }\n        NetworkLatency               = [PSCustomObject]@{\n            Latency   = $Latency\n            Threshold = $NetworkThreshold\n        }\n        LinkedServerResults          = if ($LinkedServerResults) {\n            $LinkedServerResults.ForEach{\n                [pscustomobject]@{\n                    InstanceName     = $Instance.Name\n                    LinkedServerName = $PSItem.LinkedServerName\n                    RemoteServer     = $PSItem.RemoteServer\n                    Connectivity     = $PSItem.Connectivity\n                    Result           = $PSItem.Result\n                }\n            }\n        } else {\n            [pscustomobject]@{\n                InstanceName     = $Instance.Name\n                LinkedServerName = 'None found'\n                RemoteServer     = 'None'\n                Connectivity     = $true\n                Result           = 'None'\n            }\n        }\n        MaxMemory                    = $MaxMemory\n        OrphanedFile                 = [pscustomobject]@{\n            FileCount = $FileCount\n        }\n        ServerNameMatch              = [pscustomobject]@{\n            configuredServerName = $ServerNameMatchconfiguredServerName\n            netName              = $ServerNameMatchnetName\n            renamerequired       = $ServerNameMatchrenamerequired\n        }\n        MemoryDump                   = $Dump\n        HideInstance                 = $HideInstance\n        SuspectPageCountResult       = $SuspectPageCountResult\n        SupportedBuild               = $SupportedBuild\n        LoginMustChangeCount         = $LoginMustChangeCount\n        LoginPasswordExpirationCount = $LoginPasswordExpirationCount\n        AgentServiceAdminExist       = $AgentServiceAdminExist\n        SqlEngineServiceAccount      = $SqlEngineServiceAccount\n        PublicRolePermissions        = $PublicRolePermsCount\n        # TempDbConfig          = [PSCustomObject]@{\n        #     TF118EnabledCurrent     = $tempDBTest[0].CurrentSetting\n        #     TF118EnabledRecommended = $tempDBTest[0].Recommended\n        #     TempDBFilesCurrent      = $tempDBTest[1].CurrentSetting\n        #      TempDBFilesRecommended  = $tempDBTest[1].Recommended\n        # }\n    }\n    if ($ScanForStartupProceduresDisabled) {\n        $StartUpSPs = $Instance.Databases['master'].StoredProcedures.Where{ $_. Name -ne 'sp_MSrepl_startup' -and $_.StartUp -eq $true }.count\n        if ($StartUpSPs -eq 0) {\n            $testInstanceObject.Configuration.ScanForStartupProcedures.ConfigValue = 0\n        }\n    }\n    if ($WhoIsActiveInstalled) {\n        $whoisdatabase = ($__dbcconfig | Where-Object { $_.Name -eq 'policy.whoisactive.database' }).Value\n        $WhoIsActiveInstalled = $Instance.Databases[$whoisdatabase].StoredProcedures.Where{ $_.Name -eq 'sp_WhoIsActive' }.count\n        $testInstanceObject.ConfigValues | Add-Member -MemberType NoteProperty -Name 'WhoIsActiveInstalled' -Value $whoIsActiveInstalled\n    }\n    return $testInstanceObject\n}"
  },
  {
    "path": "source/internal/functions/Select-DefaultView.ps1",
    "content": "﻿function Select-DefaultView {\n    <#\n\n    This command enables us to send full on objects to the pipeline without the user seeing it\n\n    See it in action in Get-DbaSnapshot and Remove-DbaDbSnapshot\n\n    a lot of this is from boe, thanks boe!\n    https://learn-powershell.net/2013/08/03/quick-hits-set-the-default-property-display-in-powershell-on-custom-objects/\n\n    TypeName creates a new type so that we can use ps1xml to modify the output\n    #>\n\n    [CmdletBinding()]\n    param (\n        [parameter(ValueFromPipeline = $true)]\n        [object]$InputObject,\n        [string[]]$Property,\n        [string[]]$ExcludeProperty,\n        [string]$TypeName\n    )\n    process {\n\n        #if ($null -eq $InputObject) { return }\n\n        if ($TypeName) {\n            $InputObject.PSObject.TypeNames.Insert(0, \"dbachecks.$TypeName\")\n        }\n\n        if ($ExcludeProperty) {\n            if ($InputObject.GetType().Name.ToString() -eq 'DataRow') {\n                $ExcludeProperty += 'Item', 'RowError', 'RowState', 'Table', 'ItemArray', 'HasErrors'\n            }\n\n            $properties = ($InputObject.PsObject.Members | Where-Object MemberType -ne 'Method' | Where-Object { $_.Name -notin $ExcludeProperty }).Name\n            $defaultset = New-Object System.Management.Automation.PSPropertySet('DefaultDisplayPropertySet', [string[]]$properties)\n        }\n        else {\n            # property needs to be string\n            if (\"$property\" -like \"* as *\") {\n                $newproperty = @()\n                foreach ($p in $property) {\n                    if ($p -like \"* as *\") {\n                        $old, $new = $p -isplit \" as \"\n                        # Do not be tempted to not pipe here\n                        $inputobject | Add-Member -Force -MemberType AliasProperty -Name $new -Value $old -ErrorAction SilentlyContinue\n                        $newproperty += $new\n                    }\n                    else {\n                        $newproperty += $p\n                    }\n                }\n                $property = $newproperty\n            }\n            $defaultset = New-Object System.Management.Automation.PSPropertySet('DefaultDisplayPropertySet', [string[]]$Property)\n        }\n\n        $standardmembers = [System.Management.Automation.PSMemberInfo[]]@($defaultset)\n\n        # Do not be tempted to not pipe here\n        $inputobject | Add-Member -Force -MemberType MemberSet -Name PSStandardMembers -Value $standardmembers -ErrorAction SilentlyContinue\n\n        $inputobject\n    }\n}\n\n\n# SIG # Begin signature block\n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GCSqGSIb3DQEJBDEWBBQP2A4ycR+17K3nh4JHESq3urkk\n# bDANBgkqhkiG9w0BAQEFAASCAQACfk+ri4MHdwxCscxPaPI39K22xXo/psfOxFvE\n# KeWMgCD0k1QMh0O3VY0vivpIMq7YmCg09bXErYH3PS7ELCOfOQHSv3Da7svtelPO\n# 4OnM9GRnjjqShhIqiOXI9CqKM0gU/ZdNoqLPMNdB6NZgO3dl5ahyIHofBSp8AvQW\n# 3sCWJMy/IyUiga0wChSn9KbCF/GyvTEjmcb61wDjLS+Ib1vW78cxVIfhlG2N8TrJ\n# r/RiIANktqP0gQF2JfLjizx/6zM/NkELTCv47VfnrNOrhNUqXd7l7D0Gaeorr8Fs\n# 0iKgGtqipPFGZltJadcw1wLsS/X3KCfyNVhfCgnfxh2s1bFw\n# SIG # End signature block\n"
  },
  {
    "path": "source/internal/functions/Set-DatabaseForIntegrationTesting.ps1",
    "content": "<#\n\nThis function is intended for use in integration testing.\nIt ensures the test database exists and the test instnace.\n\n#>\nfunction Set-DatabaseForIntegrationTesting {\n    [Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"PSUseShouldProcessForStateChangingFunctions\", \"\",\"\",\"\", \"Because it isnt changing state\")]\n    [CmdletBinding()]\n    Param (\n        [DbaInstanceParameter]$SqlInstance,\n        [string]$DatabaseName\n    )\n    process {\n        $db = Get-DbaDatabase -SqlInstance $SqlInstance -SqlCredential $sqlcredential -Database $DatabaseName\n        if ($null -eq $db) {\n            $server = Connect-DbaInstance -SqlInstance $SqlInstance -SqlCredential $sqlcredential\n            $server.Query(\"create database $DatabaseName\")\n        }\n    }\n}\n\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUVx8312WVatpbP6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bwFawUKobHO1qnV+7ZtMi86FAIHun4mwujRtSO+2FFEp\n# aNuyB3kPnfJ9PivF+ypJdcv8PrKQU6g1B111tKiKASnrXBusmQYeOB+iRy0mJxRa\n# srUVDc9UNMxwjlCatSRK+NDWB9T/EcnXzCNNZe5ldOjvZ76u4HIzcH1v4ZND9Lz1\n# R9g4c0+yznMKyFFl8UkWiDIjOTsutX/XSKMasPk6jYkIQ3un\n# SIG # End signature block\n"
  },
  {
    "path": "source/internal/scripts/postimport.ps1",
    "content": "﻿# Add all things you want to run after importing the main code\n\n# Load Configurations\nforeach ($file in (Get-ChildItem \"$ModuleRoot\\internal\\configurations\\*.ps1\")) {\n    . Import-ModuleFile -Path $file.FullName\n}\n\n$script:__dbcconfig = Get-DbcConfig\n# load app stuff and create files if needed\n$script:localapp = ($__dbcconfig | Where-Object {$_.Name -eq 'app.localapp' }).Value\n$script:maildirectory = ($__dbcconfig | Where-Object {$_.Name -eq 'app.maildirectory' }).Value\n\nif (-not (Test-Path -Path $script:localapp)) {\n    New-Item -ItemType Directory -Path $script:localapp\n}\n\nif (-not (Test-Path -Path $script:maildirectory)) {\n    New-Item -ItemType Directory -Path $script:maildirectory\n}\n\n# Parse repo for tags and descriptions then write json\ntry{\n    New-Json\n}\ncatch{\n    Write-Warning \"Failed creating JSON\"\n    $errmessage = $_ | Select-Object * | Out-String\n    Write-Warning \"Error message is $errmessage\"\n}\n\n# Load Tab Expansion\nforeach ($file in (Get-ChildItem \"$ModuleRoot\\internal\\tepp\\*.ps1\")) {\n    . Import-ModuleFile -Path $file.FullName\n}\n\n# Importing PSDefaultParameterValues\n$PSDefaultParameterValues = $global:PSDefaultParameterValues\n\n# Set default param values if it exists\nif ($credential = (Get-DbcConfigValue -Name app.sqlcredential1)) {\n    if ($PSDefaultParameterValues) {\n        $newvalue = $PSDefaultParameterValues += @{ '*:SqlCredential' = $credential }\n        Set-Variable -Scope 0 -Name PSDefaultParameterValues -Value $newvalue\n    }\n    else {\n        Set-Variable -Scope 0 -Name PSDefaultParameterValues -Value @{ '*:SqlCredential' = $credential }\n    }\n}\n\n# EnableException so that failed commands cause failures\n$PSDefaultParameterValues += @{ '*-Dba*:EnableException' = $true }\n\n# Fred magic\n# Set-PSFTaskEngineCache -Module dbachecks -Name module-imported -Value $true\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQU0O3gDy6dPPYex5t5xuY0b+DK\n# BSWgggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFz\n# c3VyZWQgSUQgQ29kZSBTaWduaW5nIENBMB4XDTE3MDUwOTAwMDAwMFoXDTIwMDUx\n# MzEyMDAwMFowVzELMAkGA1UEBhMCVVMxETAPBgNVBAgTCFZpcmdpbmlhMQ8wDQYD\n# VQQHEwZWaWVubmExETAPBgNVBAoTCGRiYXRvb2xzMREwDwYDVQQDEwhkYmF0b29s\n# czCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAI8ng7JxnekL0AO4qQgt\n# Kr6p3q3SNOPh+SUZH+SyY8EA2I3wR7BMoT7rnZNolTwGjUXn7bRC6vISWg16N202\n# 1RBWdTGW2rVPBVLF4HA46jle4hcpEVquXdj3yGYa99ko1w2FOWzLjKvtLqj4tzOh\n# K7wa/Gbmv0Si/FU6oOmctzYMI0QXtEG7lR1HsJT5kywwmgcjyuiN28iBIhT6man0\n# Ib6xKDv40PblKq5c9AFVldXUGVeBJbLhcEAA1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WduaW5nIENBAhACwXUo\n# dNXChDGFKtigZGnKMAkGBSsOAwIaBQCgeDAYBgorBgEEAYI3AgEMMQowCKACgACh\n# AoAAMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcCAQsxDjAM\n# BgorBgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBRCHOFSpPFijfysrtOz3I7HnAD7\n# ajANBgkqhkiG9w0BAQEFAASCAQAU38tJN2GnCUtaSGgkyrBTsoDuW0MwNhHt++6D\n# +NgE/4eIlSmI54/YmupgRcjWbV0U0Mmnjai1iNXN+aitCzGehsEDT/zSaOuuSbCk\n# L0/DTRrVZH5KI8pxcMhPga5f0IFaWUaocMF8E2RhZlcdhQX/hQFuWpTN6aqpGj+X\n# W0WORT50FxbLSKbAe0etZ2RI8oTac7nL+SC/d9JAHd54BECJDIes46V7p66HuUqx\n# 1UHwtycC/ThEDx9NA6p2NLuS7oXHrn1rXU0Kgeh8fcoMOrQrtbT4mlwzaIthi/MF\n# YE6E2iwPXPxOOrBo7yNT2hcSmok58HmzkwYjX3QcM/lhWQ/X\n# SIG # End signature block\n"
  },
  {
    "path": "source/internal/scripts/preimport.ps1",
    "content": "﻿# Add all things you want to run before importing the main code\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUhpH05OLZf7fOBcgMYy+o9FW/\n# oBigggpSMIIFGjCCBAKgAwIBAgIQAsF1KHTVwoQxhSrYoGRpyjANBgkqhkiG9w0B\n# AQsFADByMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD\n# VQQLExB3d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2V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cFLQuharHCIP18udOhO0CfERhNoRpxJ6lkKQl72vjnc2UEhd\n# SIG # End signature block\n"
  },
  {
    "path": "source/internal/tepp/autocomplete.ps1",
    "content": "﻿# Register that script block\nRegister-PSFTeppScriptblock -Name SqlInstance -ScriptBlock { Get-PSFConfig -Module dbachecks -Name SqlInstance }\nRegister-PSFTeppScriptblock -Name ComputerName -ScriptBlock { Get-PSFConfig -Module dbachecks -Name ComputerName }\nRegister-PSFTeppScriptblock -Name confignames -ScriptBlock { (Get-PSFConfig -Module dbachecks).Name }\nRegister-PSFTeppScriptblock -Name tags -ScriptBlock { Get-DbcTagCollection }\nRegister-PSFTeppScriptblock -Name environments -ScriptBlock { \"Production\", \"Development\", \"Test\" }\nRegister-PSFTeppScriptblock -Name policy.database.filegrowthtype  -ScriptBlock { \"kb\", \"percent\" }\n\n# Register the actual auto completer\nRegister-PSFTeppArgumentCompleter -Command Update-DbcPowerBiDataSource -Parameter Environment -Name environments\nRegister-PSFTeppArgumentCompleter -Command Clear-DbcPowerBiDataSource -Parameter Environment -Name environments\nRegister-PSFTeppArgumentCompleter -Command Invoke-DbcCheck -Parameter Check -Name tags\nRegister-PSFTeppArgumentCompleter -Command Invoke-DbcCheck -Parameter ExcludeCheck  -Name tags\nRegister-PSFTeppArgumentCompleter -Command Get-DbcConfig -Parameter Name -Name confignames\nRegister-PSFTeppArgumentCompleter -Command Get-DbcConfigValue -Parameter Name -Name confignames\nRegister-PSFTeppArgumentCompleter -Command Set-DbcConfig -Parameter Name -Name confignames\nRegister-PSFTeppArgumentCompleter -Command Get-DbcTagCollection -Parameter Name -Name tags\nRegister-PSFTeppArgumentCompleter -Command Set-DbcConfig -Parameter Value -Name policy.database.filegrowthtype\n# SIG # Begin signature block\n# MIINEAYJKoZIhvcNAQcCoIINATCCDP0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgE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yJYpH7dlBcDGxTCtsPfqkpWuS5ZegCIWWtj5v9nMdb9ruxR\n# kI9SzjgBBiYVhb/IfQ2KFzkAiif29hkSDqO4tXOIQfVQ5vK/4YXKlNdpXUxZZlFk\n# fH/JfAXV86LiVmhKe5EhTy2tB44f06kLGyICG5ROsQhVbn2/cfC48BMnxqNAlxua\n# PR2Ph2Ript7e+OhzheTkGqNUnWMfRr+7P+aAq/mYbIoeHwy8O8aPlQ/aZR0tzSYP\n# MthFrtZVItplLT1hzOFoVZG90aI5E+6nmOgH8QjQwJZnaBs5\n# SIG # End signature block\n"
  },
  {
    "path": "source/xml/dbachecks.Format.ps1xml",
    "content": "﻿<?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<ViewSelectedBy>\n\t\t\t\t<TypeName>dbachecks.Check</TypeName>\n\t\t\t</ViewSelectedBy>\n\t\t\t<TableControl>\n\t\t\t\t<AutoSize/>\n\t\t\t\t<TableHeaders>\n\t\t\t\t\t<TableColumnHeader/>\n\t\t\t\t\t<TableColumnHeader/>\n\t\t\t\t\t<TableColumnHeader/>\n\t\t\t\t\t<TableColumnHeader/>\n\t\t\t\t\t<TableColumnHeader/>\n\t\t\t\t\t<TableColumnHeader/>\n\t\t\t\t</TableHeaders>\n\t\t\t\t<TableRowEntries>\n\t\t\t\t\t<TableRowEntry>\n\t\t\t\t\t\t<TableColumnItems>\n\t\t\t\t\t\t\t<TableColumnItem>\n\t\t\t\t\t\t\t\t<PropertyName>Group</PropertyName>\n\t\t\t\t\t\t\t</TableColumnItem>\n\t\t\t\t\t\t\t<TableColumnItem>\n\t\t\t\t\t\t\t\t<PropertyName>Type</PropertyName>\n\t\t\t\t\t\t\t</TableColumnItem>\n\t\t\t\t\t\t\t<TableColumnItem>\n\t\t\t\t\t\t\t\t<PropertyName>UniqueTag</PropertyName>\n\t\t\t\t\t\t\t</TableColumnItem>\n\t\t\t\t\t\t\t<TableColumnItem>\n\t\t\t\t\t\t\t\t<PropertyName>AllTags</PropertyName>\n\t\t\t\t\t\t\t</TableColumnItem>\n\t\t\t\t\t\t\t<TableColumnItem>\n\t\t\t\t\t\t\t\t<PropertyName>Config</PropertyName>\n\t\t\t\t\t\t\t</TableColumnItem>\n\t\t\t\t\t\t\t<TableColumnItem>\n\t\t\t\t\t\t\t\t<PropertyName>Description</PropertyName>\n\t\t\t\t\t\t\t</TableColumnItem>\n\t\t\t\t\t\t</TableColumnItems>\n\t\t\t\t\t</TableRowEntry>\n\t\t\t\t</TableRowEntries>\n\t\t\t</TableControl>\n\t\t</View>\n  </ViewDefinitions>\n</Configuration>\n"
  },
  {
    "path": "tests/Project.Tests.ps1",
    "content": "BeforeDiscovery {\n    $script:ModuleName = 'dbachecks'\n    $ModuleBase = (Get-Module -Name $ModuleName -ListAvailable).ModuleBase\n    $commands = Get-Command -Module $ModuleName -CommandType Cmdlet, Function\n}\nDescribe 'PSScriptAnalyzer rule-sets' -Tag Build , ScriptAnalyzer {\n    BeforeDiscovery {\n        $script:ModuleName = 'dbachecks'\n        $ModuleBase = (Get-Module -Name $ModuleName -ListAvailable).ModuleBase\n        $Rules = Get-ScriptAnalyzerRule\n        $scripts = Get-ChildItem $ModuleBase -Include *.ps1, *.psm1, *.psd1 -Recurse | Where-Object fullname -NotMatch 'classes'\n        # Get last commit that was merged from main\n        $lastCommit = git log --grep=\"Updated Version Number and docs from master\" -1 --format='%H'\n        # Get the files that have been altered in since the last merge from master\n        $scripts = git diff --name-only $lastCommit HEAD | Where-Object { $psitem.EndsWith('ps1') }\n        # only the ones in these folders\n        $scripts = $scripts | Where-Object { ($_ -like 'internal*') -or ($_ -like 'functions*') -or ( $_ -like 'checks*') }\n    }\n\n\n\n    Context 'Checking PSScriptAnalyzer on Script <_>' -ForEach $scripts {\n\n        BeforeDiscovery {\n            $PsScriptAnalyzerSettings = 'PSScriptAnalyzerSettings.psd1'\n            $scriptpath = Join-Path -Path $ModuleBase -ChildPath $PsItem\n            \n            $Tests = $rules.ForEach{\n                @{\n                    scriptpath               = $scriptpath\n                    RuleName                 = $_.RuleName\n                    PsScriptAnalyzerSettings = $PsScriptAnalyzerSettings\n                }\n            }\n        }\n\n        It 'The Script Analyzer Rule <_.RuleName> Should not fail' -ForEach $Tests {\n            $rulefailures = Invoke-ScriptAnalyzer -Path $PsItem.scriptpath -IncludeRule $PsItem.RuleName -Settings $PsItem.PsScriptAnalyzerSettings\n            $message = ($rulefailures | Select-Object Message -Unique).Message\n            $lines = $rulefailures.Line -join ','\n            $Because = 'Script Analyzer says the rules have been broken on lines {3} with Message {0} Check in VSCode Problems tab or Run Invoke-ScriptAnalyzer -Script {1} -Settings {2}' -f $message, $scriptpath, $PsScriptAnalyzerSettings, $lines\n            $rulefailures.Count | Should -Be 0 -Because $Because\n        }\n    }\n}\n\n\n\nDescribe 'Testing help for <_.Name>' -Tag Help -ForEach $commands {\n\n    BeforeAll {\n        $Help = Get-Help $PsItem.Name -ErrorAction SilentlyContinue\n    }\n\n    Context 'General help' {\n        It 'Synopsis should not be auto-generated or empty' {\n            $Because = 'We are good citizens and write good help'\n            $Help.Synopsis | Should -Not -BeLike 'Short description*' -Because $Because\n            $Help.Synopsis[0] | Should -Not -Match '\\n' -Because $Because\n        }\n        It 'Description should not be auto-generated or empty' {\n            $Because = 'We are good citizens and write good help'\n            $Help.Description | Should -Not -BeLike '*Long description*' -Because $Because\n            $Help.Description | Should -Not -BeNullOrEmpty -Because $Because\n        }\n    }\n\n    Context 'Examples help' {\n        It 'There should be more than one example' {\n            $Because = 'Most commands should have more than one example to explain and we are good citizens and write good help'\n            $Help.Examples.example.Count | Should -BeGreaterThan 1 -Because $Because\n        }\n\n        It 'There should be code for <_.title>' -ForEach $Help.Examples.Example {\n            $Because = 'All examples should have code otherwise what is the point? and we are good citizens and write good help'\n            $PsItem.Code | Should -Not -BeNullOrEmpty -Because $Because\n            $PsItem.Code | Should -Not -BeLike '*An example*' -Because $Because\n        }\n        It 'There should be remarks for <_.title>' -ForEach $Help.Examples.Example {\n            $Because = 'All examples should have explanations otherwise what is the point? and we are good citizens and write good help'\n            $PsItem.remarks[0] | Should -Not -Be '@{Text=}' -Because $Because\n        }\n    }\n\n    Context 'Parameters help' {\n        It 'Parameter <_.name> should have help' -ForEach ($command.ParameterSets.Parameters | Where-Object Name -NotIn 'Debug', 'ErrorAction', 'ErrorVariable', 'InformationAction', 'InformationVariable', 'OutBuffer', 'OutVariable', 'PipelineVariable', 'Verbose', 'WarningAction', 'WarningVariable', 'Confirm', 'WhatIf') {\n            $Because = 'Every parameter should have help and we are good citizens and write good help'\n            $_.Description.Text | Should -Not -BeNullOrEmpty -Because $Because\n            $_.Description.Text | Should -Not -Be 'Parameter description' -Because $Because\n        }\n    }\n}\n\n\n"
  },
  {
    "path": "tests/QA/module.tests.ps1",
    "content": "\nBeforeDiscovery {\n    $script:moduleName = $ProjectName\n\n    Remove-Module -Name $script:moduleName -Force -ErrorAction SilentlyContinue\n\n    $mut = Get-Module -Name $script:moduleName -ListAvailable |\n        Select-Object -First 1 |\n            Import-Module -Force -ErrorAction Stop -PassThru\n}\n\nBeforeAll {\n    $script:moduleName = $ProjectName\n\n    # Convert-Path required for PS7 or Join-Path fails\n    $projectPath = \"$($PSScriptRoot)\\..\\..\" | Convert-Path\n\n    $sourcePath = (\n        Get-ChildItem -Path $projectPath\\*\\*.psd1 |\n            Where-Object -FilterScript {\n                ($_.Directory.Name -match 'source|src' -or $_.Directory.Name -eq $_.BaseName) `\n                    -and $(\n                    try\n                    {\n                        Test-ModuleManifest -Path $_.FullName -ErrorAction Stop\n                    }\n                    catch\n                    {\n                        $false\n                    }\n                )\n            }\n    ).Directory.FullName\n}\n\nDescribe 'Changelog Management' -Tag 'Changelog' {\n    It 'Changelog has been updated' -Skip:(\n        -not ([bool](Get-Command git -ErrorAction SilentlyContinue) -and\n            [bool](&(Get-Process -Id $PID).Path -NoProfile -Command 'git rev-parse --is-inside-work-tree 2>$null'))\n    ) {\n        # Get the list of changed files compared with branch main\n        $headCommit = &git rev-parse HEAD\n        $defaultBranchCommit = &git rev-parse origin/main\n        $filesChanged = &git @('diff', \"$defaultBranchCommit...$headCommit\", '--name-only')\n        $filesStagedAndUnstaged = &git @('diff', 'HEAD', '--name-only')\n\n        $filesChanged += $filesStagedAndUnstaged\n\n        # Only check if there are any changed files.\n        if ($filesChanged)\n        {\n            $filesChanged | Should -Contain 'CHANGELOG.md' -Because 'the CHANGELOG.md must be updated with at least one entry in the Unreleased section for each PR'\n        }\n    }\n\n    It 'Changelog format compliant with keepachangelog format' -Skip:(![bool](Get-Command git -EA SilentlyContinue)) {\n        { Get-ChangelogData -Path (Join-Path $ProjectPath 'CHANGELOG.md') -ErrorAction Stop } | Should -Not -Throw\n    }\n\n    It 'Changelog should have an Unreleased header' -Skip:$skipTest {\n            (Get-ChangelogData -Path (Join-Path -Path $ProjectPath -ChildPath 'CHANGELOG.md') -ErrorAction Stop).Unreleased.RawData | Should -Not -BeNullOrEmpty\n    }\n}\n\nDescribe 'General module control' -Tags 'FunctionalQuality' {\n    It 'Should import without errors' {\n        { Import-Module -Name $script:moduleName -Force -ErrorAction Stop } | Should -Not -Throw\n\n        Get-Module -Name $script:moduleName | Should -Not -BeNullOrEmpty\n    }\n\n    It 'Should remove without error' {\n        { Remove-Module -Name $script:moduleName -ErrorAction Stop } | Should -Not -Throw\n\n        Get-Module $script:moduleName | Should -BeNullOrEmpty\n    }\n}\n\n\nBeforeDiscovery {\n    # Must use the imported module to build test cases.\n    $allModuleFunctions = & $mut { Get-Command -Module $args[0] -CommandType Function } $script:moduleName\n\n    # Build test cases.\n    $testCases = @()\n\n    foreach ($function in $allModuleFunctions)\n    {\n        $testCases += @{\n            Name = $function.Name\n        }\n    }\n}\n<#\nDescribe 'Quality for module' -Tags 'TestQuality' {\n    BeforeDiscovery {\n        if (Get-Command -Name Invoke-ScriptAnalyzer -ErrorAction SilentlyContinue)\n        {\n            $scriptAnalyzerRules = Get-ScriptAnalyzerRule\n        }\n        else\n        {\n            if ($ErrorActionPreference -ne 'Stop')\n            {\n                Write-Warning -Message 'ScriptAnalyzer not found!'\n            }\n            else\n            {\n                throw 'ScriptAnalyzer not found!'\n            }\n        }\n    }\n\n    It 'Should have a unit test for <Name>' -ForEach $testCases {\n        Get-ChildItem -Path 'tests\\' -Recurse -Include \"$Name.Tests.ps1\" | Should -Not -BeNullOrEmpty\n    }\n\n    It 'Should pass Script Analyzer for <Name>' -ForEach $testCases -Skip:(-not $scriptAnalyzerRules) {\n        $functionFile = Get-ChildItem -Path $sourcePath -Recurse -Include \"$Name.ps1\"\n\n        $pssaResult = (Invoke-ScriptAnalyzer -Path $functionFile.FullName)\n        $report = $pssaResult | Format-Table -AutoSize | Out-String -Width 110\n        $pssaResult | Should -BeNullOrEmpty -Because `\n            \"some rule triggered.`r`n`r`n $report\"\n    }\n}\n\nDescribe 'Help for module' -Tags 'helpQuality' {\n    It 'Should have .SYNOPSIS for <Name>' -ForEach $testCases {\n        $functionFile = Get-ChildItem -Path $sourcePath -Recurse -Include \"$Name.ps1\"\n\n        $scriptFileRawContent = Get-Content -Raw -Path $functionFile.FullName\n\n        $abstractSyntaxTree = [System.Management.Automation.Language.Parser]::ParseInput($scriptFileRawContent, [ref] $null, [ref] $null)\n\n        $astSearchDelegate = { $args[0] -is [System.Management.Automation.Language.FunctionDefinitionAst] }\n\n        $parsedFunction = $abstractSyntaxTree.FindAll( $astSearchDelegate, $true ) |\n            Where-Object -FilterScript {\n                $_.Name -eq $Name\n            }\n\n        $functionHelp = $parsedFunction.GetHelpContent()\n\n        $functionHelp.Synopsis | Should -Not -BeNullOrEmpty\n    }\n\n    It 'Should have a .DESCRIPTION with length greater than 40 characters for <Name>' -ForEach $testCases {\n        $functionFile = Get-ChildItem -Path $sourcePath -Recurse -Include \"$Name.ps1\"\n\n        $scriptFileRawContent = Get-Content -Raw -Path $functionFile.FullName\n\n        $abstractSyntaxTree = [System.Management.Automation.Language.Parser]::ParseInput($scriptFileRawContent, [ref] $null, [ref] $null)\n\n        $astSearchDelegate = { $args[0] -is [System.Management.Automation.Language.FunctionDefinitionAst] }\n\n        $parsedFunction = $abstractSyntaxTree.FindAll($astSearchDelegate, $true) |\n            Where-Object -FilterScript {\n                $_.Name -eq $Name\n            }\n\n        $functionHelp = $parsedFunction.GetHelpContent()\n\n        $functionHelp.Description.Length | Should -BeGreaterThan 40\n    }\n\n    It 'Should have at least one (1) example for <Name>' -ForEach $testCases {\n        $functionFile = Get-ChildItem -Path $sourcePath -Recurse -Include \"$Name.ps1\"\n\n        $scriptFileRawContent = Get-Content -Raw -Path $functionFile.FullName\n\n        $abstractSyntaxTree = [System.Management.Automation.Language.Parser]::ParseInput($scriptFileRawContent, [ref] $null, [ref] $null)\n\n        $astSearchDelegate = { $args[0] -is [System.Management.Automation.Language.FunctionDefinitionAst] }\n\n        $parsedFunction = $abstractSyntaxTree.FindAll( $astSearchDelegate, $true ) |\n            Where-Object -FilterScript {\n                $_.Name -eq $Name\n            }\n\n        $functionHelp = $parsedFunction.GetHelpContent()\n\n        $functionHelp.Examples.Count | Should -BeGreaterThan 0\n        $functionHelp.Examples[0] | Should -Match ([regex]::Escape($function.Name))\n        $functionHelp.Examples[0].Length | Should -BeGreaterThan ($function.Name.Length + 10)\n\n    }\n\n    It 'Should have described all parameters for <Name>' -ForEach $testCases {\n        $functionFile = Get-ChildItem -Path $sourcePath -Recurse -Include \"$Name.ps1\"\n\n        $scriptFileRawContent = Get-Content -Raw -Path $functionFile.FullName\n\n        $abstractSyntaxTree = [System.Management.Automation.Language.Parser]::ParseInput($scriptFileRawContent, [ref] $null, [ref] $null)\n\n        $astSearchDelegate = { $args[0] -is [System.Management.Automation.Language.FunctionDefinitionAst] }\n\n        $parsedFunction = $abstractSyntaxTree.FindAll( $astSearchDelegate, $true ) |\n            Where-Object -FilterScript {\n                $_.Name -eq $Name\n            }\n\n        $functionHelp = $parsedFunction.GetHelpContent()\n\n        $parameters = $parsedFunction.Body.ParamBlock.Parameters.Name.VariablePath.ForEach({ $_.ToString() })\n\n        foreach ($parameter in $parameters)\n        {\n            $functionHelp.Parameters.($parameter.ToUpper()) | Should -Not -BeNullOrEmpty -Because ('the parameter {0} must have a description' -f $parameter)\n            $functionHelp.Parameters.($parameter.ToUpper()).Length | Should -BeGreaterThan 25 -Because ('the parameter {0} must have descriptive description' -f $parameter)\n        }\n    }\n}\n#>"
  },
  {
    "path": "tests/Unit/Private/Get-PrivateFunction.tests.ps1",
    "content": "<#\n$ProjectPath = \"$PSScriptRoot\\..\\..\\..\" | Convert-Path\n$ProjectName = ((Get-ChildItem -Path $ProjectPath\\*\\*.psd1).Where{\n        ($_.Directory.Name -match 'source|src' -or $_.Directory.Name -eq $_.BaseName) -and\n        $(try { Test-ModuleManifest $_.FullName -ErrorAction Stop } catch { $false } )\n    }).BaseName\n\n\nImport-Module $ProjectName\n\nInModuleScope $ProjectName {\n    Describe Get-PrivateFunction {\n        Context 'Default' {\n            BeforeEach {\n                $return = Get-PrivateFunction -PrivateData 'string'\n            }\n\n            It 'Returns a single object' {\n                ($return | Measure-Object).Count | Should -Be 1\n            }\n\n            It 'Returns a string based on the parameter PrivateData' {\n                $return | Should -Be 'string'\n            }\n        }\n    }\n}\n#>"
  },
  {
    "path": "tests/Unit/Public/Export-DbcConfig.Tests.ps1",
    "content": "﻿\nDescribe \"Export-DbcConfig Unit Tests\" -Tags \"IntegrationTests\" {\n    Context \"Command executes properly and returns proper info\" {\n        BeforeAll {\n            $localapp = Get-DbcConfigValue -Name 'app.localapp'\n            Remove-Item \"$localapp\\config.json\" -ErrorAction SilentlyContinue\n            Export-DbcConfig -Path 'TestDrive:\\config.json'\n        }\n        AfterAll {\n            Remove-Item \"$localapp\\config.json\" -ErrorAction SilentlyContinue\n        }\n        It \"Should not throw\" {\n            { Export-DbcConfig } | Should -Not -Throw\n        }\n\n        It \"outputs default file without errors\" {\n            (Get-ChildItem \"$localapp\\config.json\" -ErrorAction SilentlyContinue) -ne $null | Should -BeTrue\n        }\n\n        It \"outputs a named file without errors\" {\n            Test-Path 'TestDrive:\\config.json' | Should -BeTrue\n        }\n\n        It \"outputs an object\" {\n            $o = Export-DbcConfig -Force\n            $o | Get-Member -Name Open | Should -Not -BeNullOrEmpty\n        }\n    }\n}"
  },
  {
    "path": "tests/Unit/Public/Get-Something.tests.ps1",
    "content": "<#\n$ProjectPath = \"$PSScriptRoot\\..\\..\\..\" | Convert-Path\n$ProjectName = ((Get-ChildItem -Path $ProjectPath\\*\\*.psd1).Where{\n        ($_.Directory.Name -match 'source|src' -or $_.Directory.Name -eq $_.BaseName) -and\n        $(try { Test-ModuleManifest $_.FullName -ErrorAction Stop } catch { $false } )\n    }).BaseName\n\nImport-Module $ProjectName\n\nInModuleScope $ProjectName {\n    Describe Get-Something {\n        Mock Get-PrivateFunction { $PrivateData }\n\n        Context 'Return values' {\n            BeforeEach {\n                $return = Get-Something -Data 'value'\n            }\n\n            It 'Returns a single object' {\n                ($return | Measure-Object).Count | Should -Be 1\n            }\n\n            It 'Returns a string from Get-PrivateFunction' {\n                Assert-MockCalled Get-PrivateFunction -Times 1 -Exactly -Scope It\n                $return | Should -Be 'value'\n            }\n        }\n\n        Context 'Pipeline' {\n            It 'Accepts values from the pipeline by value' {\n                $return = 'value1', 'value2' | Get-Something\n                Assert-MockCalled Get-PrivateFunction -Times 2 -Exactly -Scope It\n                $return[0] | Should -Be 'value1'\n                $return[1] | Should -Be 'value2'\n            }\n\n            It 'Accepts value from the pipeline by property name' {\n                $return = 'value1', 'value2' | ForEach-Object {\n                    [PSCustomObject]@{\n                        Data = $_\n                        OtherProperty = 'other'\n                    }\n                } | Get-Something\n\n                Assert-MockCalled Get-PrivateFunction -Times 2 -Exactly -Scope It\n                $return[0] | Should -Be 'value1'\n                $return[1] | Should -Be 'value2'\n            }\n        }\n\n        Context 'ShouldProcess' {\n            It 'Supports WhatIf' {\n                (Get-Command Get-Something).Parameters.ContainsKey('WhatIf') | Should -Be $true\n                { Get-Something -Data 'value' -WhatIf } | Should -Not -Throw\n            }\n\n            It 'Does not call Get-PrivateFunction if WhatIf is set' {\n                $return = Get-Something -Data 'value' -WhatIf\n                $return | Should -BeNullOrEmpty\n                Assert-MockCalled Get-PrivateFunction -Times 0 -Scope It\n            }\n        }\n    }\n}\n#>"
  },
  {
    "path": "tests/Unit.Tests.ps1",
    "content": "\n# This should stop people making breaking changes to the tests without first altering the test\n\nBeforeDiscovery {\n    Remove-Module dbachecks -Force -ErrorAction SilentlyContinue\n    Import-Module dbachecks\n    $ModuleBase = (Get-Module dbachecks).ModuleBase\n\n    $v4Groups = (Get-ChildItem $ModuleBase\\checks).Where{ $PSItem.Name -notlike '*v5*' }\n}\n\nDescribe \"Group <_.Name.Replace('.Tests.ps1','')> that each v4 dbachecks Pester test is correctly formatted for Power Bi and Coded correctly\" -Tags UnitTest -ForEach $v4Groups {\n    BeforeDiscovery {\n        $tokens = $null\n        $errors = $null\n        $GroupName = $Psitem.Name -replace '.Tests.ps1', ''\n        $GroupContent = Get-Content $Psitem.FullName -Raw\n\n        $v4Describes = [Management.Automation.Language.Parser]::ParseInput($GroupContent, [ref]$tokens, [ref]$errors).\n        FindAll([Func[Management.Automation.Language.Ast, bool]] {\n                param ($ast)\n                $ast.CommandElements -and\n                $ast.CommandElements[0].Value -eq 'describe'\n            }, $true) |\n            ForEach-Object {\n                $CE = $PSItem.CommandElements\n                $secondString = ($CE | Where-Object { $PSItem.StaticType.name -eq 'string' })[1]\n                $tagIdx = $CE.IndexOf(($CE | Where-Object ParameterName -EQ 'Tags')) + 1\n                $tags = if ($tagIdx -and $tagIdx -lt $CE.Count) {\n                    $CE[$tagIdx].Extent\n                }\n                New-Object PSCustomObject -Property @{\n                    GroupName  = $GroupName\n                    CheckTitle = $secondString\n                    CheckTags  = $tags\n                    Extent     = $secondString.Parent.Extent.Text\n                }\n            }\n        ## Find the Contexts\n        \n        $tokens = $null\n        $errors = $null\n        $v4Contexts = [Management.Automation.Language.Parser]::ParseInput($GroupContent, [ref]$tokens, [ref]$errors).\n        FindAll([Func[Management.Automation.Language.Ast, bool]] {\n                param ($ast)\n                $ast.CommandElements -and\n                $ast.CommandElements[0].Value -eq 'Context'\n            }, $true) |\n            ForEach-Object {\n                $CE = $PSItem.CommandElements\n                $secondString = ($CE | Where-Object { $PSItem.StaticType.name -eq 'string' })[1]\n                New-Object PSCustomObject -Property @{\n                    GroupName = $GroupName\n                    Name      = $secondString\n                }\n            }\n        ## Find the Its\n        $tokens = $null\n        $errors = $null\n        $v4Its = [Management.Automation.Language.Parser]::ParseInput($GroupContent, [ref]$tokens, [ref]$errors).\n        FindAll([Func[Management.Automation.Language.Ast, bool]] {\n                param ($ast)\n                $ast.CommandElements -and\n                $ast.CommandElements[0].Value -eq 'It'\n            }, $true) |\n            ForEach-Object {\n                $CE = $PSItem.CommandElements\n                $secondString = ($CE | Where-Object { $PSItem.StaticType.name -eq 'string' })[1]\n                New-Object PSCustomObject -Property @{\n                    GroupName = $GroupName\n                    Name      = $secondString\n                }\n            }\n\n        ## This just grabs all the code\n        $AST = [System.Management.Automation.Language.Parser]::ParseInput($GroupContent, [ref]$null, [ref]$null)\n        $v4Code = New-Object PSCustomObject -Property @{\n            GroupName = $GroupName\n            Statement = $AST.EndBlock.statements.Extent.Where{ $PSItem.StartLineNumber -ne 1 }.Where{ $PSItem.Text -match 'Describe' }  ## Ignore the filename line and only if the title contains a describe\n        }\n            \n    }\n    BeforeAll {\n        $UniqueTags = (Get-DbcCheck).UniqueTag\n    }\n    Context \"Validating the group $GroupName - Check's Describes titles and tags\" -ForEach $v4Describes {\n        BeforeDiscovery {\n            $CheckTitle = $PsItem.CheckTitle.Value\n            $CheckTagsList = $PSItem.CheckTags.Text.Split(',').Trim().Where{ ($PSItem -ne '$filename') -and ($PSItem -notlike '*statistics*') -and ($PSItem -notlike '*BackupPathAccess*') -and ($PSItem -notlike '*OlaJobs*') -and ($PSItem -notlike '*status*') -and ($PSItem -notlike '*exists') -and ($PSItem -notlike '*Ops') \n            }\n        }\n        It \"The Describe Title - <_.CheckTitle.Value> - Should Use a double quote after the Describe\" {\n            $PSItem.CheckTitle.StringConstantType | Should -Be 'DoubleQuoted' -Because 'You need to alter the title of the Describe - We need use double quotes for titles'\n        }\n        It \"The Describe Title - <_.CheckTitle.Value> - should use a plural for tags\" {\n            $PSItem.CheckTags | Should -Not -BeNullOrEmpty -Because 'You need to alter the tags parameter of the Describe - We use the plural of Tags'\n        }\n\n        It \"The Describe Title - $CheckTitle - Tags parameter <_> should be Singular\" -ForEach $CheckTagsList {\n            $PSItem.ToString().Endswith('s') | Should -BeFalse -Because 'You need to alter the tags for this Describe OR alter this test if the tag makes sense - Our coding standards say tags should be singular'\n        }\n        It \"The Describe Title - $CheckTitle - The first Tag <_> should be in the unique Tags returned from Get-DbcCheck\" -ForEach $CheckTagsList[0].Where{ $PsItem -notin ('Low', 'High', 'Storage', 'DISA') } {\n            $UniqueTags | Should -Contain $Psitem -Because 'We need a unique tag for each test - Format should be -Tags space UniqueTag comma - Also if you are running this on a machine where dbachecks has already been imported previously try running reset-dbcconfig, which will create a new checks.json for Get-DbcCheck'\n        }\n        It \"The Describe Title - <_.CheckTitle.Value> - should reference the global exclude configuration\" -ForEach $Psitem.Where{ $Psitem.GroupName -eq 'Database' } {\n            $psitem.Extent -like \"*`$ExcludedDatabases*\" | Should -BeTrue -Because 'We need to exclude the databases specified in the config command.invokedbccheck.excludedatabases'\n        }\n    }\n    Context \"Validating the group $GroupName - Checking Contexts\" {\n        It \"The Context Title - <_.Name> - Should end with `$PSItem (or `$clustername) So that the PowerBi will work correctly\" -ForEach $v4Contexts {\n            $PSItem.Name.ToString().Endswith('psitem\"') -or $PSItem.Name.ToString().Endswith('clustername\"') -or $PSItem.Name.ToString().Endswith('SqlInstance\"') | Should -BeTrue -Because 'You need to alter the title of the Context - This helps the PowerBi to parse the data'\n        }\n    }\n    Context \"Validating the group $GroupName - Checking Its\" {\n        It \"The It - <_.Name> - Should end with the right ending so that the PowerBi will work correctly\" -ForEach $v4its {\n            $Lower = $PSItem.Name.ToString().ToLower()\n            $Lower.Endswith('psitem\"') -or $Lower.Endswith('clustername\"') -or $Lower.EndsWith('server)\"') -or $Lower.EndsWith('name)\"') -or $Lower.EndsWith('name\"') -or $Lower.EndsWith('instance\"') -or $Lower.EndsWith('instance)\"') -or $Lower.EndsWith('domain)\"') -or $Lower.EndsWith('domain\"') -or $Lower.EndsWith('replica)\"') | Should -BeTrue -Because 'You need to alter the title of the It, it should end with the instance name or computername - This helps the PowerBi to parse the data'\n        }\n        It \"The Database It - <_.Name> - Should begin with - Database\" -ForEach $v4its.Where{ $Psitem.GroupName -eq 'Database' } {\n            $PSItem.Name.ToString().StartsWith('\"Database') -or $PSItem.Name.ToString().StartsWith('\"Can') | Should -BeTrue -Because 'You need to alter the It Title to start with Database (or Can t Connect) - For the database checks we can parse them and make magic'\n        }\n    }\n\n    Context \"Validating the group $GroupName - Checking Code Quality\" -ForEach $v4Code {\n\n        It \"Should Use Get-Instance or Get-ComputerName\" -ForEach $psitem.Statement {\n        ($PSItem.text -Match 'Get-Instance') -or ($PSItem.text -match 'Get-ComputerName') -or ($PSItem.text -match 'clustervm' ) | Should -BeTrue -Because 'These are the commands to use to get Instances or Computers or clusters'\n        }\n\n        It \"Should use the ForEach Method\" -ForEach $psitem.Where{ $PsItem.GroupName -notlike '*HADR*' }.Statement {\n        ($PSItem.text -match 'Get-Instance\\).ForEach{' ) -or ($Psitem.text -match 'Get-ComputerName\\).ForEach{' ) | Should -BeTrue # use the \\ to escape the ) -Because 'We use the ForEach method in our coding standards'\n        }\n        It \"Should not use `$_\" -ForEach $psitem.Statement {\n        ($PSItem.text -match '$_' ) | Should -BeFalse -Because '¬$psitem is the correct one to use'\n        }\n        It \"Should Contain a Context Block\" -ForEach ($psitem.Where{ $PsItem.GroupName -ne 'Agent' }.Statement) {\n            $PSItem.text -match 'Context' | Should -BeTrue -Because 'This helps the Power BI'\n        }\n        It \"Agent Should Contain a Context Block\" -ForEach ($psitem.Where{ $PsItem.GroupName -eq 'Agent' }.Statement) {\n            $PSItem.text -match 'Context' | Should -BeTrue -Because 'This helps the Power BI'\n        }\n\n    }\n}\nDescribe 'Each Config referenced in a check should exist' -Tags UnitTest {\n    BeforeDiscovery {\n        $dbcCheck = Get-DbcCheck\n\n    }\n    BeforeAll {\n        $dbcConfig = Get-DbcConfig\n    }\n\n    It \"Config Value <_> Should exist in Get-DbcConfig\" -ForEach ($dbcCheck.Config.Split(' ') | Sort-Object -Unique).Where{ $Psitem -ne '' } {\n        $Psitem | Should -BeIn $dbcConfig.Name -Because 'You need to look at the configurations as there appears to not be a unique tag'\n    }\n}\n\n<#\nDescribe 'Checking that each dbachecks Pester test is correctly formatted for Power Bi and Coded correctly' -Tags UnitTest {\n    $Checks.ForEach{\n        $CheckName = $psitem.Name\n        $Check = Get-Content $PSItem.FullName -Raw\n        Context \"$($PSItem.Name) - Checking Describes titles and tags\" {\n            $UniqueTags = (Get-DbcCheck).UniqueTag\n            ## This gets all of the code with a describe\n            $Describes = [Management.Automation.Language.Parser]::ParseInput($check, [ref]$tokens, [ref]$errors).\n            FindAll([Func[Management.Automation.Language.Ast, bool]] {\n                    param ($ast)\n                    $ast.CommandElements -and\n                    $ast.CommandElements[0].Value -eq 'describe'\n                }, $true) |\n                ForEach-Object {\n                    $CE = $PSItem.CommandElements\n                    $secondString = ($CE | Where-Object { $PSItem.StaticType.name -eq 'string' })[1]\n                    $tagIdx = $CE.IndexOf(($CE | Where-Object ParameterName -EQ 'Tags')) + 1\n                    $tags = if ($tagIdx -and $tagIdx -lt $CE.Count) {\n                        $CE[$tagIdx].Extent\n                    }\n                    New-Object PSCustomObject -Property @{\n                        Name = $secondString\n                        Tags = $tags\n                    }\n                }\n            @($describes).ForEach{\n                $title = $PSItem.Name.ToString().Trim('\"').Trim('''')\n                It \"The Describe Title - $title - Should Use a double quote after the Describe\" {\n                    $PSItem.Name.ToString().Startswith('\"') | Should -BeTrue -Because 'You need to alter the title of the Describe - We need use double quotes for titles'\n                    $PSItem.Name.ToString().Endswith('\"') | Should -BeTrue -Because 'You need to alter the title of the Describe - We need use double quotes for titles'\n                }\n                It \"The Describe Title - $title - should use a plural for tags\" {\n                    $PSItem.Tags | Should -Not -BeNullOrEmpty -Because 'You need to alter the tags parameter of the Describe - We use the plural of Tags'\n                }\n                # a simple test for no esses apart from statistics and Access!!\n                if ($null -ne $PSItem.Tags) {\n                    $PSItem.Tags.Text.Split(',').Trim().Where{ ($PSItem -ne '$filename') -and ($PSItem -notlike '*statistics*') -and ($PSItem -notlike '*BackupPathAccess*') -and ($PSItem -notlike '*OlaJobs*') -and ($PSItem -notlike '*status*') -and ($PSItem -notlike '*exists') -and ($PSItem -notlike '*Ops') }.ForEach{\n                        It \"The Describe Title - $title - Tags parameter $PSItem should be Singular\" {\n                            $PSItem.ToString().Endswith('s') | Should -BeFalse -Because 'You need to alter the tags for this Describe OR alter this test if the tag makes sense - Our coding standards say tags should be singular'\n                        }\n                    }\n                    It \"The Describe Title - $title - The first Tag $($PSItem.Tags.Text.Split(',')[0]) should be in the unique Tags returned from Get-DbcCheck\" {\n                        $UniqueTags | Should -Contain $PSItem.Tags.Text.Split(',')[0].ToString() -Because 'We need a unique tag for each test - Format should be -Tags space UniqueTag comma - Also if you are running this on a machine where dbachecks has already been imported previously try running reset-dbcconfig, which will create a new checks.json for Get-DbcCheck'\n                    }\n                } else {\n                    It \"The Describe Title - $title - You haven't used the Tags Parameter so we can't check the tags\" {\n                        $false | Should -BeTrue -Because 'You need to alter the Describe - We use the Tags parameter'\n                    }\n                }\n            }\n        }\n        Context \"$($PSItem.Name) - Checking Contexts\" {\n            ## Find the Contexts\n            $Contexts = [Management.Automation.Language.Parser]::ParseInput($check, [ref]$tokens, [ref]$errors).\n            FindAll([Func[Management.Automation.Language.Ast, bool]] {\n                    param ($ast)\n                    $ast.CommandElements -and\n                    $ast.CommandElements[0].Value -eq 'Context'\n                }, $true) |\n                ForEach-Object {\n                    $CE = $PSItem.CommandElements\n                    $secondString = ($CE | Where-Object { $PSItem.StaticType.name -eq 'string' })[1]\n                    New-Object PSCustomObject -Property @{\n                        Name = $secondString\n                    }\n                }\n\n            @($Contexts).ForEach{\n                $title = $PSItem.Name.ToString().Trim('\"').Trim('''')\n                It \"The Context Title - $Title - Should end with `$PSItem (or `$clustername) So that the PowerBi will work correctly\" {\n                    $PSItem.Name.ToString().Endswith('psitem\"') -or $PSItem.Name.ToString().Endswith('clustername\"') -or $PSItem.Name.ToString().Endswith('SqlInstance\"') | Should -BeTrue -Because 'You need to alter the title of the Context - This helps the PowerBi to parse the data'\n                }\n            }\n        }\n        Context \"$($PSItem.Name) - Checking the Its\" {\n            $CheckName = $psitem.Name\n            ## Find the Its\n            $Its = [Management.Automation.Language.Parser]::ParseInput($check, [ref]$tokens, [ref]$errors).\n            FindAll([Func[Management.Automation.Language.Ast, bool]] {\n                    param ($ast)\n                    $ast.CommandElements -and\n                    $ast.CommandElements[0].Value -eq 'It'\n                }, $true) |\n                ForEach-Object {\n                    $CE = $PSItem.CommandElements\n                    $secondString = ($CE | Where-Object { $PSItem.StaticType.name -eq 'string' })[1]\n                    New-Object PSCustomObject -Property @{\n                        Name = $secondString\n                    }\n                }\n\n\n            @($Its).ForEach{\n                $title = $PSItem.Name.ToString().Trim('\"').Trim('''')\n                It \"The It Title - $Title - Should end with the right ending so that the PowerBi will work correctly\" {\n                    $Lower = $PSItem.Name.ToString().ToLower()\n                    $Lower.Endswith('psitem\"') -or $Lower.Endswith('clustername\"') -or $Lower.EndsWith('server)\"') -or $Lower.EndsWith('name)\"') -or $Lower.EndsWith('name\"') -or $Lower.EndsWith('instance\"') -or $Lower.EndsWith('instance)\"') -or $Lower.EndsWith('domain)\"') -or $Lower.EndsWith('domain\"') -or $Lower.EndsWith('replica)\"') | Should -BeTrue -Because 'You need to alter the title of the It, it should end with the instance name or computername - This helps the PowerBi to parse the data'\n                }\n                if ($CheckName -eq 'Database.Tests.ps1') {\n                    It \"The It Title - $Title - Should begin with - Database\" {\n                        $PSItem.Name.ToString().StartsWith('\"Database') -or $PSItem.Name.ToString().StartsWith('\"Can') | Should -BeTrue -Because 'You need to alter the It Title to start with Database (or Can t Connect) - For the database checks we can parse them and make magic'\n                    }\n                }\n            }\n        }\n        Context \"$($PSItem.Name) - Checking Code\" {\n            $CheckName = $psitem.Name\n            ## This just grabs all the code\n            $AST = [System.Management.Automation.Language.Parser]::ParseInput($Check, [ref]$null, [ref]$null)\n            $Statements = $AST.EndBlock.statements.Extent\n            ## Ignore the filename line\n            @($Statements.Where{ $PSItem.StartLineNumber -ne 1 }).ForEach{\n                # make sure we only regex if the title contains a describe\n                if ($PSItem.Text -match 'Describe') {\n                    $title = [regex]::matches($PSItem.text, 'Describe(.*)-Tag').groups[1].value.Replace('\"', '').Replace('''', '').trim()\n                    if ($title -ne 'Cluster $clustername Health using Node $clustervm') {\n                        It \"Describe - $title - Should Use Get-Instance or Get-ComputerName\" {\n                            ($PSItem.text -Match 'Get-Instance') -or ($PSItem.text -match 'Get-ComputerName') | Should -BeTrue -Because 'These are the commands to use to get Instances or Computers'\n                        }\n                    }\n                    if ($title -ne 'Cluster $clustername Health using Node $clustervm') {\n                        It \"Describe - $title Should use the ForEach Method\" {\n                            ($PSItem.text -match 'Get-Instance\\).ForEach{' ) -or ($Psitem.text -match 'Get-ComputerName\\).ForEach{' ) | Should -BeTrue # use the \\ to escape the ) -Because 'We use the ForEach method in our coding standards'\n                        }\n                    }\n                    It \"Describe - $title Should not use `$_\" {\n                        ($PSItem.text -match '$_' ) | Should -BeFalse -Because '¬$psitem is the correct one to use'\n                    }\n                    if ($CheckName -ne 'Agent.Tests.ps1') {\n                        It \"Describe - $title Should Contain a Context Block\" {\n                            $PSItem.text -match 'Context' | Should -BeTrue -Because 'This helps the Power BI'\n                        }\n                    } else {\n                        $Contexts = [Management.Automation.Language.Parser]::ParseInput($check, [ref]$tokens, [ref]$errors).\n                        FindAll([Func[Management.Automation.Language.Ast, bool]] {\n                                param ($ast)\n                                $ast.CommandElements -and\n                                $ast.CommandElements[0].Value -eq 'Context'\n                            }, $true) |\n                            ForEach-Object {\n                                $CE = $PSItem.CommandElements\n                                $secondString = ($CE | Where-Object { $PSItem.StaticType.name -eq 'string' })[1]\n                                New-Object PSCustomObject -Property @{\n                                    Name = $secondString\n                                }\n                            }\n                        It \"$CheckName should have the right number of Context blocks as the AST doesnt parse how I like and I cant be bothered to fix it right now\" {\n                            $Contexts.Count | Should -Be 27 -Because 'There should be 27 context blocks in the Agent checks file'\n                        }\n                    }\n                }\n            }\n        }\n    }\n    (Get-DbcCheck).ForEach{\n        It 'Should have one Unique Tag for each check' {\n            $psitem.UniqueTag.Count | Should -Be 1 -Because \"You need to check that the tags for this check -  We want to only have one Unique Tag per test and we got $($psitem.UniqueTag) instead\"\n        }\n    }\n}\n\nDescribe 'Checking that there is a description for each check' -Tags UnitTest {\n    (Get-DbcCheck).ForEach{\n        It \"$($psitem.UniqueTag) Should have a description in the DbcCheckDescriptions.json\" {\n            $psitem.description | Should -Not -BeNullOrEmpty -Because \"We need a description in the .\\internal\\configurations\\DbcCheckDescriptions.json for $($psitem.uniquetag) so that Get-DbcCheck shows it\"\n        }\n    }\n}\n\nDescribe 'Each Config referenced in a check should exist' -Tags UnitTest {\n    $dbcConfig = (Get-DbcConfig).Name\n    ((Get-DbcCheck).Config.Split(' ') | Sort-Object -Unique).Where{ $Psitem -ne '' }.ForEach{\n        It \"Config Value $psitem Should exist in Get-DbcConfig\" {\n            $Psitem | Should -BeIn $dbcConfig -Because 'You need to look at the configurations as there appears to not be a unique tag'\n        }\n    }\n}\n\nDescribe 'Database Tests Exclusions' {\n    $DbChecks = (Get-ChildItem $ModuleBase\\checks).Where{ $PSItem.Name -eq 'Database.Tests.ps1' }\n    $Check = Get-Content $DbChecks.FullName -Raw\n\n    $Describes = [Management.Automation.Language.Parser]::ParseInput($check, [ref]$tokens, [ref]$errors).\n    FindAll([Func[Management.Automation.Language.Ast, bool]] {\n            param ($ast)\n            $ast.CommandElements -and\n            $ast.CommandElements[0].Value -eq 'describe'\n        }, $true) |\n        ForEach-Object {\n            $CE = $PSItem.CommandElements\n            $secondString = ($CE | Where-Object { $PSItem.StaticType.name -eq 'string' })[1]\n            [PSCustomObject] @{\n                Name   = $secondString.Value\n                Extent = $secondString.Parent.Extent.Text\n            }\n        }\n\n    $Describes.ForEach{\n        It \"$($Psitem.Name) should reference the global exclude configuration\" {\n            $psitem.Extent -like \"*`$ExcludedDatabases*\" | Should -BeTrue -Because 'We need to exclude the databases specified in the config command.invokedbccheck.excludedatabases'\n        }\n    }\n}\n\n$Describes.ForEach{\n    It \"$($Psitem.Name) should reference the global exclude configuration\" {\n        $psitem.Extent -like \"*`$ExcludedDatabases*\" | Should -BeTrue -Because 'We need to exclude the databases specified in the config command.invokedbccheck.excludedatabases'\n    }\n}\n\n\n#>\n\n"
  },
  {
    "path": "tests/readme.md",
    "content": "# Tests Folder\n\n## Description\n\nThis folder holds the Unit and integration tests for the dbachecks module\n\n## assertions\n\nThis holds the functions to be able to run the unit tests for the checks\n\n## checks\n\nThis holds the Pester Tests for the checks\n\n## functions\n\nThis holds the Pester Tests for the external adn internal functions\n\n## This folder\n\nholds the generic tests for the module, the help, the script analyzer, the generic unit tests for the checks layout "
  },
  {
    "path": "xml/dbachecks.Format.ps1xml",
    "content": "﻿<?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<ViewSelectedBy>\n\t\t\t\t<TypeName>dbachecks.Check</TypeName>\n\t\t\t</ViewSelectedBy>\n\t\t\t<TableControl>\n\t\t\t\t<AutoSize/>\n\t\t\t\t<TableHeaders>\n\t\t\t\t\t<TableColumnHeader/>\n\t\t\t\t\t<TableColumnHeader/>\n\t\t\t\t\t<TableColumnHeader/>\n\t\t\t\t\t<TableColumnHeader/>\n\t\t\t\t\t<TableColumnHeader/>\n\t\t\t\t\t<TableColumnHeader/>\n\t\t\t\t</TableHeaders>\n\t\t\t\t<TableRowEntries>\n\t\t\t\t\t<TableRowEntry>\n\t\t\t\t\t\t<TableColumnItems>\n\t\t\t\t\t\t\t<TableColumnItem>\n\t\t\t\t\t\t\t\t<PropertyName>Group</PropertyName>\n\t\t\t\t\t\t\t</TableColumnItem>\n\t\t\t\t\t\t\t<TableColumnItem>\n\t\t\t\t\t\t\t\t<PropertyName>Type</PropertyName>\n\t\t\t\t\t\t\t</TableColumnItem>\n\t\t\t\t\t\t\t<TableColumnItem>\n\t\t\t\t\t\t\t\t<PropertyName>UniqueTag</PropertyName>\n\t\t\t\t\t\t\t</TableColumnItem>\n\t\t\t\t\t\t\t<TableColumnItem>\n\t\t\t\t\t\t\t\t<PropertyName>AllTags</PropertyName>\n\t\t\t\t\t\t\t</TableColumnItem>\n\t\t\t\t\t\t\t<TableColumnItem>\n\t\t\t\t\t\t\t\t<PropertyName>Config</PropertyName>\n\t\t\t\t\t\t\t</TableColumnItem>\n\t\t\t\t\t\t\t<TableColumnItem>\n\t\t\t\t\t\t\t\t<PropertyName>Description</PropertyName>\n\t\t\t\t\t\t\t</TableColumnItem>\n\t\t\t\t\t\t</TableColumnItems>\n\t\t\t\t\t</TableRowEntry>\n\t\t\t\t</TableRowEntries>\n\t\t\t</TableControl>\n\t\t</View>\n  </ViewDefinitions>\n</Configuration>\n"
  }
]