I hereby claim:
- I am schwartzmx on github.
 - I am schwartzmx (https://keybase.io/schwartzmx) on keybase.
 - I have a public key whose fingerprint is 5FD3 7845 FB08 46F6 6D0F CC00 3B5C B261 00D2 E70F
 
To claim this, I am signing this object:
| $code = @" | |
| [DllImport("user32.dll")] | |
| public static extern bool BlockInput(bool fBlockIt); | |
| "@ | |
| $userInput = Add-Type -MemberDefinition $code -Name UserInput -Namespace UserInput -PassThru | |
| Function Disable-UserInput { | |
| param([int]$Seconds=5) | |
| $userInput::BlockInput($true) | out-null | 
| -- check if they own any databases | |
| select d.datname as name, | |
| pg_catalog.pg_get_userbyid(d.datdba) as db_owner, | |
| 'alter database '+d.datname+' owner to <user>;' as chg_owner | |
| from pg_catalog.pg_database d | |
| where pg_catalog.pg_get_userbyid(d.datdba) = '<user>' | |
| order by d.datname; | |
| -- check if they own any schemas | |
| select nspname, usename, 'alter schema '+nspname+' owner to <user>;' as chg_owner | 
I hereby claim:
To claim this, I am signing this object:
| $LogTimeSpanMinutes = 10 | |
| $AfterDate = (Get-Date).AddMinutes(-$LogTimeSpanMinutes) | |
| $SQLMailProfile = "DoNotReplyNotification" | |
| $recipients = "[email protected]" | |
| $subject = "Failover Cluster ERRORS" | |
| $body = "<!DOCTYPE html><html><head></head><br><body> {0} </body></html>" | |
| $LocalServer = hostname | |
| Function DBA-SendMail { | |
| param( | 
| <# | |
| Transfer SSIS Folders and Projects from a source server to a destination server. | |
| Mostly taken from http://widba.blogspot.com/2013/02/moving-SSIS-projects-in-sql-server-2012.html with some added functionality for copying ALL SSIS packages and folders to the destination | |
| Note this does have to use SSPI Integrated Security for copying from the Source to Dest | |
| Author: Phil Schwartz | |
| #> | 
| <# | |
| Note: Before running, make sure you have any relevant Credentials copied over and maintenance plans, or referenced objects could cause failures in the script. | |
| Author: Phil | |
| #> | |
| $Source = "" # ex. "Source-SQL" | |
| $SQLUser = "" # user | |
| $SQLPassword = "" # password | |
| $Targets = "" # ex. "Target-SQL" | |
| [System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SqlServer.SMO') | out-null | 
| from bs4 import BeautifulSoup | |
| import requests as r | |
| from json import dumps | |
| class Country: | |
| def __init__(self, country, place, gold, silver, bronze, total_medals): | |
| self.country = country | |
| self.place = place | |
| self.gold = gold | |
| self.silver = silver | 
| <# | |
| Author: Phil Schwartz | |
| Description: A simple script to read the RSS feed for SQL Server KB support updates | |
| - Allows stepping through the feed and opening in browser, if specified | |
| #> | |
| [xml]$xmldoc= Invoke-WebRequest 'https://support.microsoft.com/en-us/rss?rssid=1044' | |
| $feed = $xmldoc.rss.channel | |
| $lid = 0 | 
| # Quick abstraction test | |
| $d = (Get-Date) | |
| $frequency = "Weekly" | |
| $query = "exec prc_ReportXYZ {0}, {1};" | |
| switch ($frequency) { | |
| "Weekly" { | |
| $beginDate = $d.AddDays(-$d.DayOfWeek).ToString('MM/dd/yy') | |
| $endDate = (Get-Date $beginDate).AddDays(7).ToString('MM/dd/yy') | |
| } | |
| "Monthly" { | 
| create procedure [prc_Magic8Ball] | |
| ( | |
| @question varchar(100) | |
| ) | |
| -- Author: Phil | |
| -- Example: exec prc_Magic8Ball 'Will I make it into the office on time today?'; | |
| as | |
| begin | |
| set nocount on; | |
| declare @phrase as table (name varchar(50)); |