Giter Club home page Giter Club logo

dbatools-scripts's Introduction

dbatools-scripts

Holds a number of scripts for use with dbatools mainly from the blog posts at https://sqldbawithabeard.com/tag/dbatools

Pester Tests

At present there are the following tests

  • Pester Test Backup Share - Server level.Tests.ps1
  • Pester Test Database Collation - Database Level.Tests.ps1
  • Pester Test Database Collation - Databases detailed.Tests.ps1
  • Pester Test Database collation - Server level.Tests.ps1
  • Pester Test Identity Usage - Column Level.Tests.ps1
  • Pester Test Identity Usage - Database Level.Tests.ps1
  • Pester Test Identity Usage - Server Level.Tests.ps1
  • Pester Test Last Backup - Individual.Tests.ps1
  • Pester Test Last Known good DBCC CheckDB - Database Level.Tests.ps1
  • Pester Test Last Known good DBCC CheckDB - Server Level and - Time.Tests.ps1
  • Pester Test Last Known good DBCC CheckDB - Server Level.Tests.ps1
  • Pester Test Network Latency.Tests.ps1
  • Pester Test SPNs.Tests.ps1
  • Pester test TempDb.Tests.ps1

All require dbatools and PowerShell version 4 or above. You can get dbatools from https:\dbatools.io

The pester tests are controlled by the TestConfig.Json file.

Alter the values or settigns to fit what you need to test. Setting the Skip value to true will skip the entire test

Then change directory to the folder holding the files and run

$Config = (Get-Content TestConfig.JSON) -join "`n" | ConvertFrom-Json

Then all you need to do is run

Invoke-Pester

These scripts use gather Server names from a Hyper-V host so if you wish to use that then set the HyperV to your Hyper-V Hostname and NameSearch to perform a wildcard search on your VM Names

            "HyperV": "beardnuc",
            "NameSearch":"SQL2016N3",

If you wish to use a different method to gather your SQL instances then you will need to open the folder in VS Code and use the search and replace to replace the below code

# $SQLServers = (Get-VM -ComputerName $Config.Network.HyperV -ErrorAction SilentlyContinue| Where-Object {$_.Name -like "*$($Config.Network.NameSearch)*" -and $_.State -eq 'Running'}).Name

with the method you choose. You can use the TestConfig.Json to filter in the same way if you wish

You can also output to HTML using reportunit.exe in the Pester Test To XML and HTML file

dbatools-scripts's People

Contributors

sqldbawithabeard avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.