This file contains 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 Prompt { | |
<# | |
.Synopsis | |
Your custom PowerShell prompt | |
# borrowing heavily from https://dbatools.io/prompt but formatting the execution time without using the DbaTimeSpanPretty C# type | |
.Description | |
Custom prompt that includes the following features: |
This file contains 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 Update-SysInternals { | |
<# | |
.Synopsis | |
PowerShell script to update Sysinternals tools | |
.DESCRIPTION | |
Creates a PSDrive mapped to '\\live.sysinternals.com\tools' and then copies tools that are new or have a different byte length | |
NOTE: Needs to run with elevated permissions. |
This file contains 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
# i - copy the complete URL from your browser | |
# ii - run this line of powershell | |
# iii - go to document and paste | |
# iv - content pasted is the title of the web page | |
# useful for when you want to build aset of reference and need page title and url in the document | |
(((Get-Clipboard).Split('/')[-1]).Split('?')[0]).Replace("-", " ") | Set-Clipboard | |
This file contains 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
Need an offline version of a WSUS update file ? | |
Go to: | |
https://blogs.technet.microsoft.com/mempson/2011/08/23/wsusscn2-cab-manual-download-location/ | |
the link then takes you to where the CAB actually comes from: | |
http://go.microsoft.com/fwlink/?LinkId=76054 |
This file contains 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
PowerShell that references SQL Server Configuration properties and compares RunValue to ConfigValue and shows of there are pending changes | |
[System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SqlServer.SMO') | Out-Null | |
[System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SqlServer.SMOExtended') | Out-Null | |
$Server = "$ENV:COMPUTERNAME\sql2016" | |
$SMOServer = new-object ('Microsoft.SQLServer.Management.Smo.Server') $Server | |
$($smoserver.Configuration | Select-Object -ExpandProperty properties | Select-Object displayname, runvalue, configvalue, @{name = "Diff"; expression = {$(if($_.runvalue -ne $_.configvalue){"* difference *"}else{"same"})}}) | Format-Table -a |
This file contains 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
# ref https://docs.microsoft.com/en-us/sql/relational-databases/system-dynamic-management-views/sys-dm-db-persisted-sku-features-transact-sql | |
# script to locate Enterprise features that are in use | |
# might be something that forces an upgrade path | |
# might be worth running this in Dev and in CI pipeline to ensure no non-licensed features are incorporated into system development | |
$Server = "$ENV:COMPUTERNAME\sql2016" | |
$SMOServer = new-object ('Microsoft.SQLServer.Management.Smo.Server') $Server |
This file contains 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 TimeToSanta { | |
<# | |
.Synopsis | |
Show how long you have to wait to open your presents | |
.DESCRIPTION | |
Be able to leave your shopping to the very last minute with this state-of-the-art function to show | |
how long is left to 25th Dec 09:00. Two variations exist depending on whether the information is to be shown | |
at the console prompt or as a message | |
.EXAMPLE | |
TimeToSanta -purpose console |
This file contains 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
"A curmudgeon’s reputation for malevolence is undeserved. They’re neither warped nor evil at heart. They don’t hate mankind, just mankind’s absurdities. They’re just as sensitive and softhearted as the next guy, but they hide their vulnerability beneath a crust of misanthropy. They ease the pain by turning hurt into humor. They attack maudlinism because it devalues genuine sentiment. Nature, having failed to equip them with a serviceable denial mechanism, has endowed them with astute perception and sly wit. Curmudgeons are mockers and debunkers whose bitterness is a symptom rather than a disease. They can’t compromise their standards and can’t manage the suspension of disbelief necessary for feigned cheerfulness. Their awareness is a curse. Perhaps curmudgeons have gotten a bad rap in the same way that the messenger is blamed for the message: They have the temerity to comment on the human condition without apology. They not only refuse to applaud mediocrity, they howl it down with morose glee. Their versions |
This file contains 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 Change-Time { | |
<# | |
.SYNOPSIS | |
To convert a larger time measure to a smaller measure ie how many milliseconds in an hour | |
.DESCRIPTION | |
Function takes a duration(a) and a measure(b) and returns an amount in a preferred measure(c) | |
eg 4(a) hours(b) milliseconds(c) |
This file contains 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 TimeToSQLBits { | |
<# | |
.Synopsis | |
Show how long you have to wait for the biggest data conference in Europe | |
.DESCRIPTION | |
Make sure you get prepared for the next SQLBits conference. | |
.EXAMPLE | |
TimeToSQLBits -purpose console |
OlderNewer