Skip to content

Instantly share code, notes, and snippets.

🦄
Generally bearding

Rob Sewell SQLDBAWithABeard

🦄
Generally bearding
Block or report user

Report or block SQLDBAWithABeard

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@SQLDBAWithABeard
SQLDBAWithABeard / notebook agent job .ps1
Created Mar 31, 2020
notebook Agent job powershell
View notebook agent job .ps1
$TargetDatabase = "DBA"
$JobId = "$(ESCAPE_SQUOTE(JOBID))"
$StartTime = "$(ESCAPE_SQUOTE(STRTTM))"
$StartDate = "$(ESCAPE_SQUOTE(STRTDT))"
$JSONTable = "select * from notebooks.nb_template where job_id = $JobId"
$sqlResult = Invoke-Sqlcmd -Query $JSONTable -Database $TargetDatabase -MaxCharLength 2147483647
$FirstNotebookError = ""
function ParseTableToNotebookOutput {
param (
[System.Data.DataTable]
@SQLDBAWithABeard
SQLDBAWithABeard / Grouping logins by day.ipynb
Created Mar 31, 2020
Extended Event group logins by day Notebook
View Grouping logins by day.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View Extended Event Creation.sql
CREATE EVENT SESSION [MonitorWindowsLogins] ON SERVER
ADD EVENT sqlserver.login(
ACTION(sqlserver.client_hostname,sqlserver.database_name,sqlserver.session_id,sqlserver.session_nt_username,sqlserver.session_server_principal_name)
WHERE ([sqlserver].[not_equal_i_sql_unicode_string]([sqlserver].[session_nt_user],N'')
AND [sqlserver].[not_equal_i_sql_unicode_string]([sqlserver].[session_server_principal_name],N'THEBEARD\gsartori')
AND [sqlserver].[not_equal_i_sql_unicode_string]([sqlserver].[session_server_principal_name],N'THEBEARD\wdurkin')
AND [sqlserver].[not_equal_i_sql_unicode_string]([sqlserver].[session_server_principal_name],N'THEBEARD\Rob')
AND [sqlserver].[session_nt_user]<>N'THEBEARD\gfritchey'
AND [sqlserver].[session_server_principal_name]<>N'THEBEARD\SQL_SVC'
AND [sqlserver].[session_server_principal_name]<>N'THEBEARD\SQL2014SER12R2$'))
View calm.ps1
function Calm {
for ($i = 0; $i -le 4; $i++) {
$x = 1
while ($x -le 4) {
"In through the nose - $x"
Start-Sleep -Seconds 1
$x ++
}
$x = 1
while ($x -le 7) {
@SQLDBAWithABeard
SQLDBAWithABeard / DMA PowerShell notebook.ipynb
Last active Mar 1, 2020
DMA PowerShell and Azure Data Studio Notebook
View DMA PowerShell notebook.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View pesterwontrun.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View dbatools.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@SQLDBAWithABeard
SQLDBAWithABeard / fail.ipynb
Created Feb 7, 2020
Failing .NET POwerShell Notebook
View fail.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@SQLDBAWithABeard
SQLDBAWithABeard / weird.ipynb
Last active Jan 30, 2020
strange behaviour in PowerShell Notebook with function and comment code
View weird.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@SQLDBAWithABeard
SQLDBAWithABeard / luhn.ipynb
Created Jan 30, 2020
Because Bob is awesome - Even my wife says so
View luhn.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
You can’t perform that action at this time.