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
| IF( SERVERPROPERTY('EngineEdition') = 8 ) | |
| BEGIN | |
| /* | |
| Description: | |
| Script based on Dimitri Furman's dbo.sp_readmierrorlog procedure. | |
| dbo.sp_readmierrorlog is a stored procedure that returns the contents of SQL Server and SQL Agent error logs on an MI instance. | |
| The procedure filters out debug-level messages logged for service operation and troubleshooting purposes, | |
| in order to make the error log more readable and actionable for MI users. | |
| The procedure can be customized to add/remove specific filter strings. |
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
| #https://twitter.com/guyrleech/status/1322118170002468864 | |
| Start-Job -Name "Logoff when done" { sleep (("23:59 30/10/2020" -as [datetime]) - (date)).TotalSeconds ; logoff } |
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
| $SQLInstances = | |
| $webhookurl = "" | |
| $startdate = (Get-Date).AddHours(-1) | |
| Import-Module 'C:\Program Files\WindowsPowerShell\Modules\dbatools\1.0.107\dbatools.psd1' | |
| $AllFailedJobs = foreach ($Instance in $SQLInstances) { | |
| Write-Host "Connecting to $instance" | |
| try{ |
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
| $SQLInstances = | |
| $startdate = (Get-Date).AddHours(-12) | |
| $TeamsWebHook = "" | |
| # Import-Module 'C:\Program Files\WindowsPowerShell\Modules\dbatools\1.0.107\dbatools.psd1' | |
| $AllJobs = " | |
| SqlInstance...|...Total...|...Successful...|...FailedJobs...|...FailedSteps...|...Canceled... | |
| --------------------------------------------- | |
| " | |
| foreach ($Instance in $SQLInstances) { |
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
| # based on https://github.com/guillermo-musumeci/terraform-update-version/blob/master/update-terraform.ps1 | |
| # Adding version so we dont get a beta version! | |
| # download the page of Terraform releases | |
| [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 | |
| $WebResponse = Invoke-WebRequest "https://releases.hashicorp.com/terraform" | |
| # Version = | |
| $Version = '0.12.28' |
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
| ## DO NOT SAVE THE tfvars file with values in it | |
| ## I have added them to a local key vault following this blog post https://sqldbawithabeard.com/2020/07/18/good-bye-import-clixml-use-the-secrets-management-module-for-your-labs-and-demos/ | |
| # This file will enable you to run terraform plan or import resources into terraform state locally | |
| # You will need to create a directory called ignorevariables and copy the dev-backend-config.tfvars into it | |
| <# | |
| The dev-backend-config.tfvars file should look like this with the required values set for the environment you are using |
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
| 1..100 | ForEach-Object { | |
| $number = $Psitem | |
| switch (($number % 5) -eq 0 -and ($number % 3 -eq 0)) { | |
| $true { 'FizzBuzz' } | |
| Default { | |
| switch ($number % 3) { | |
| 0 { 'Fizz' } | |
| Default { | |
| switch ($number % 5) { | |
| 0 { 'Buzz' } |
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
| $shell = New-Object -com shell.application | |
| $rb = $shell.Namespace(10) | |
| $rb.Items() | Sort ModifyDate -Descending | Select -first 10 | ft |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.