Skip to content

Instantly share code, notes, and snippets.

Avatar

Peter Schott paschott

View GitHub Profile
View sp_DBPermissions.sql
IF OBJECT_ID('tempdb..#sp_DBPermissions') IS NOT NULL DROP PROCEDURE #sp_DBPermissions
GO
/*********************************************************************************************
sp_DBPermissions V6.1
Kenneth Fisher
http://www.sqlstudies.com
https://github.com/sqlstudent144/SQL-Server-Scripts/blob/master/sp_DBPermissions.sql
This stored procedure returns 3 data sets. The first dataset is the list of database
@jborean93
jborean93 / Invoke-WithImpersonation.ps1
Last active Dec 9, 2020
Invoke a scriptblock in powershell with impersonation
View Invoke-WithImpersonation.ps1
# Copyright: (c) 2020, Jordan Borean (@jborean93) <jborean93@gmail.com>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
Function Invoke-WithImpersonation {
<#
.SYNOPSIS
Invoke a scriptblock as another user.
.DESCRIPTION
Invoke a scriptblock and run it in the context of another user as supplied by -Credential.
@paschott
paschott / ChangeSSISProtectionLevel.ps1
Created Mar 9, 2020
Changes SSIS Protection Level for all packages and project
View ChangeSSISProtectionLevel.ps1
#PowerShell script
################################
########## PARAMETERS ##########
################################
$projectFolder = "C:\SSIS\myProject\myProject"
$dtutilPath = "C:\Program Files\Microsoft SQL Server\130\DTS\Binn\dtutil.exe"
# The number changes per SQL Server version
# 130=2016, 120=2014, 110=2012
# Also check the drive where SQL Server is
# installed
@bertwagner
bertwagner / RSSFeeds.opml
Created Jul 15, 2019
The OPML file of all of the SQL Server (and some other) RSS feeds I subscribe to as of 2019-07-01.
View RSSFeeds.opml
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>Bert's mostly SQL subscriptions in feedly Cloud</title>
</head>
<body>
<outline text="Marketing" title="Marketing">
<outline type="rss" text="Signal v. Noise" title="Signal v. Noise" xmlUrl="https://signalvnoise.com/posts.rss" htmlUrl="https://m.signalvnoise.com"/>
<outline type="rss" text="Austin Kleon" title="Austin Kleon" xmlUrl="http://feeds2.feedburner.com/AustinKleon" htmlUrl="https://austinkleon.com"/>
@SQLvariant
SQLvariant / Mmmm_Chocolatey.ps1
Last active Feb 24, 2021
Install SQL / Data Developer Desktop Tools from Chocolatey
View Mmmm_Chocolatey.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco install chocolatey -y
choco install sql-server-management-studio -y
choco install azure-data-studio -y
choco install azuredatastudio-powershell -y
choco install git.install -y
choco install vscode -y
choco install vscode-powershell -y
choco install powerbi -y
View wwi_ssis_assistDeploy.ps1
cls
get-date
Import-Module AssistDeploy -Force
$thisSsisPublishFilePath = "C:\Users\SQLTraining\Documents\bob.json"
$thisIspacToDeploy = "C:\Users\SQLTraining\Downloads\sql-server-samples-master\sql-server-samples-master\samples\databases\wide-world-importers\wwi-ssis\wwi-ssis\bin\Development\Daily ETL.ispac"
$svr = "Server=.\hh;Integrated Security=True"
$myJsonPublishProfile = Import-Json -jsonPath $thisSsisPublishFilePath -ispacPath $thisIspacToDeploy -localVariables
$ssisdb = Connect-SsisdbSql -sqlConnectionString $svr
Publish-SsisFolder -jsonPsCustomObject $myJsonPublishProfile -sqlConnection $ssisdb
Publish-SsisEnvironment -jsonPsCustomObject $myJsonPublishProfile -sqlConnection $ssisdb
@wpsmith
wpsmith / Set-SQLAutoGrouth.ps1
Created May 19, 2015
PowerShell: Set AutoGrowth for SQL Server cycling through the individual filegroups as well as excluding system databases.
View Set-SQLAutoGrouth.ps1
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO") | out-null
$server = New-Object ("Microsoft.SqlServer.Management.Smo.Server") "localhost"
$databases = $server.Databases;
foreach ($db in $databases ) {
#Set Log File growth
if ($db.Status -eq 'Normal' -and -$db.IsSystemObject -eq $false) {
$l = $db.LogFiles[0]
$l.GrowthType = "KB"
$l.Growth = "51200"
$l.Alter();