Skip to content

Instantly share code, notes, and snippets.

🎉
powershell and chill

Chrissy LeMaire potatoqualitee

🎉
powershell and chill
Block or report user

Report or block potatoqualitee

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
@potatoqualitee
potatoqualitee / Invoke-WsusDbQuery.ps1
Created Aug 1, 2019
Create a connection to a WSUS database using PowerShell
View Invoke-WsusDbQuery.ps1
# No longer used but didn't want to throw it away.
function Invoke-WsusDbQuery {
[CmdletBinding()]
param (
[string]$ComputerName = $script:WsusServer,
[PSCredential]$Credential = $script:WsusServerCredential,
[string]$Pattern,
[string]$UpdateId,
[switch]$EnableException
)
@potatoqualitee
potatoqualitee / Save-KBFile.ps1
Last active Jul 28, 2019
Download Windows patch files / KB (patchid like KBxxxxx) and save them to disk using PowerShell
View Save-KBFile.ps1
function Save-KBFile {
<#
.SYNOPSIS
Downloads patches from Microsoft
.DESCRIPTION
Downloads patches from Microsoft
.PARAMETER Name
The KB name or number. For example, KB4057119 or 4057119.
View gallery.ps1
@potatoqualitee
potatoqualitee / sql2014.AdventureWorks2014.tables.json
Last active Dec 21, 2018
Modified New-DbaDbMaskingConfig output
View sql2014.AdventureWorks2014.tables.json
{
"Name": "AdventureWorks2014",
"Tables": [
{
"Name": "Employee",
"Schema": "HumanResources",
"Columns": [
{
"Name": "NationalIDNumber",
"ColumnType": "nvarchar",
View sql2014.AdventureWorks2014.tables.json
{
"Name": "AdventureWorks2014",
"Tables": [
{
"Name": "AWBuildVersion",
"Schema": "dbo",
"Columns": [
{
"Name": "Database Version",
"ColumnType": "nvarchar",
View publish.ps1
Set-Content -Encoding UTF8 -Path C:\github\dbatools\allcommands.ps1 -Value "### DO NOT EDIT THIS FILE DIRECTLY ###"
Get-ChildItem -Path "C:\github\dbatools\functions\*.ps1" -Recurse | Get-Content | Add-Content C:\github\dbatools\allcommands.ps1
Get-ChildItem -Path "C:\github\dbatools\internal\functions\*.ps1" -Recurse | Get-Content | Add-Content C:\github\dbatools\allcommands.ps1
Remove-Item -Path C:\github\dbatools\allcommands.zip -ErrorAction Ignore
Compress-Archive -Path C:\github\dbatools\allcommands.ps1 -DestinationPath C:\github\dbatools\allcommands.zip
Remove-Item -Recurse C:\github\dbatools\allcommands.ps1 -ErrorAction Ignore
Remove-Item -Recurse C:\gallery -Force
mkdir C:\gallery\dbatools
View package.json
{
"name": "search",
"displayName": "dbatools simple search",
"description": "search right from your code: dbatools, microsoft docs and google",
"version": "1.0.0",
"icon": "resources/search.png",
"publisher": "dbatools",
"engines": {
"vscode": "^1.11.0"
},
View filestream_enable.vbs
'
' USAGE:
'
' cscript filestream_enable.vbs [/Machine:<MachineName>] [/Instance:<InstanceName>] [/Level:<0|1|2|3>] [/Share:<ShareName>]
' from the codeplex site https://archive.codeplex.com/?p=sqlsrvengine
'
InstanceName = "MSSQLSERVER"
MachineName = "."
TargetLevel = 3
View sql-enums.xml
# from https://hic.dundee.ac.uk/Installers/RDMP/2.7.3.1/RDMPAutomationService/Microsoft.SqlServer.SqlEnum.xml
<doc>
<assembly>
<name>Microsoft.SqlServer.SqlEnum</name>
</assembly>
<members>
<member name="P:Microsoft.SqlServer.Management.Smo.AvailableSQLServers.ResultTypes">
<summary>
return what types of results does this object support
</summary>
@potatoqualitee
potatoqualitee / format-cbh.ps1
Last active Oct 7, 2018
reformat and standardize comment based help in powershell
View format-cbh.ps1
function Get-Header ($text) {
$start = $text.IndexOf('<#')
$text.SubString(0, $start - 2)
}
function Format-Help ($text) {
$start = $text.IndexOf('<#')
$end = $text.IndexOf('#>')
$help = $text.SubString($start + 2, $end - $start - 2)
You can’t perform that action at this time.