This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 | |
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) | |
choco install chocolatey -y | |
choco install 1password -y | |
choco install azure-data-studio -y | |
choco install azure-functions-core-tools-3 -y | |
choco install azure-cli -y | |
choco install bicep -y | |
choco install chocolatey-core.extension -y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# from https://raw.githubusercontent.com/Microsoft/vsts-tasks/master/Tasks/SqlAzureDacpacDeploymentV1/FindSqlPackagePath.ps1 | |
# | |
function Get-SqlPackageOnTargetMachine | |
{ | |
try | |
{ | |
$sqlDacPath, $sqlVersion = Locate-HighestVersionSqlPackageWithSql | |
$sqlVersionNumber = [decimal] $sqlVersion |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[System.Console]::OutputEncoding = [System.Text.Encoding]::ASCII | |
# borrowing heavily from https://dbatools.io/prompt but formatting the execution time without using the DbaTimeSpanPretty C# type | |
function Prompt { | |
if($PSVersionTable.PSVersion.Major -eq 6){ | |
Write-Host (Get-Date -Format "PS 6 ") -ForegroundColor Yellow -NoNewline | |
} | |
elseif($PSVersionTable.PSVersion.Major -eq 5){ | |
Write-Host (Get-Date -Format "PS 5 ") -ForegroundColor Yellow -NoNewline | |
} | |
elseif($PSVersionTable.PSVersion.Major -eq 7){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.7' | |
services: | |
sql2012: | |
image: dbafromthecold/sqlserver2012dev:sp4 | |
ports: | |
- "15589:1433" | |
environment: | |
SA_PASSWORD: "Password0!" | |
ACCEPT_EULA: "Y" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Downloads the Failover Detection Utility from the Tiger Team GitHub repo | |
https://github.com/Microsoft/tigertoolbox/tree/master/Always-On/FailoverDetection, | |
creates the configuration json and gathers all the required data | |
.DESCRIPTION | |
Downloads the Failover Detection Utility from the tiger teams GitHub Repo, | |
https://github.com/Microsoft/tigertoolbox/tree/master/Always-On/FailoverDetection | |
creates the configuration json dynamically depending on the SQL Instance |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Function = 'Get-DbcCheck' | |
Describe "$Function" { | |
Context "Checking $Function Examples" { | |
$Examples = Get-Help $Function -Examples | |
foreach ($examplecode in $Examples.examples.example.Code) { | |
It "Example Code $examplecode should not throw" { | |
{$examplecode} | Should -Not -Throw | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$vms.ForEach{ | |
Write-Output "Looking at VM $psitem" | |
# Get the Engine Services | |
$EngineServices = Get-DbaService -ComputerName $psitem -Type Engine | |
# Loop through the engine services | |
$EngineServices.ForEach{ | |
$ComputerName = $psitem.ComputerName | |
$Name = $Psitem.ServiceName | |
$InstanceName = $psitem.InstanceName |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$file = ## whatever Get-ChildItem or path | |
$Instance | |
$JobName = 'Restore' + (Get-Random).ToString() | |
$Date = (Get-Date).DateTime.ToString() | |
$msg = "$Date - Starting Job $JobName to restore the database" | |
## LoggingFunction $msg | |
$pscmdlet.WriteVerbose($msg) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Describe " This is a test"{ | |
Context "Scoping my tests" { | |
$Drives = (Get-PSDrive -PSProvider FileSystem | Where-Object {$_.Name.Length -eq 1}).Name | |
$TestCases = @() | |
$Drives.ForEach{ | |
$Testcases += @{'DriveLetter' = "$($_):"} | |
} | |
It "Checking if bitlocker is fully encrypted on Drive <DriveLetter>" -TestCases $Testcases { | |
Param($DriveLetter) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Test-PsRemoting | |
{ | |
# Written by Lee Holmes - http://www.leeholmes.com/blog/2009/11/20/testing-for-powershell-remoting-test-psremoting/ | |
param( | |
[Parameter(Mandatory = $true)] | |
$computername | |
) | |
try | |
{ |