Skip to content

Instantly share code, notes, and snippets.

View wsmelton's full-sized avatar
🦆
Little bit of this, little bit of that

Shawn Melton wsmelton

🦆
Little bit of this, little bit of that
View GitHub Profile
@Badabum
Badabum / Merge-Json.ps1
Created August 8, 2017 14:40
Merge two .json objects using PowerShell
function Join-Objects($source, $extend){
if($source.GetType().Name -eq "PSCustomObject" -and $extend.GetType().Name -eq "PSCustomObject"){
foreach($Property in $source | Get-Member -type NoteProperty, Property){
if($extend.$($Property.Name) -eq $null){
continue;
}
$source.$($Property.Name) = Join-Objects $source.$($Property.Name) $extend.$($Property.Name)
}
}else{
$source = $extend;
@NickCraver
NickCraver / Windows10-Setup.ps1
Last active April 1, 2024 10:52
(In Progress) PowerShell Script I use to customize my machines in the same way for privacy, search, UI, etc.
##################
# Privacy Settings
##################
# Privacy: Let apps use my advertising ID: Disable
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo -Name Enabled -Type DWord -Value 0
# To Restore:
#Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo -Name Enabled -Type DWord -Value 1
# Privacy: SmartScreen Filter for Store Apps: Disable
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost -Name EnableWebContentEvaluation -Type DWord -Value 0
@SQLDBAWithABeard
SQLDBAWithABeard / prompt.ps1
Last active March 21, 2024 07:16
new improved colourful prompt
######## POSH-GIT
# with props to https://bradwilson.io/blog/prompt/powershell
#
#
# Now for this to work most beautifully - you will need to have the latest posh-git module
#
# You will also need the MesloLGM Nerd Font Mono font
# from here https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/Meslo/M/Regular/complete/Meslo%20LG%20M%20Regular%20Nerd%20Font%20Complete.ttf
# if you are super nerdy
# or
@SteveL-MSFT
SteveL-MSFT / profile.ps1
Last active March 11, 2024 01:21
PowerShell Prompt
#Requires -Version 7
# Version 1.2.13
# check if newer version
$gistUrl = "https://api.github.com/gists/a208d2bd924691bae7ec7904cab0bd8e"
$latestVersionFile = [System.IO.Path]::Combine("$HOME",'.latest_profile_version')
$versionRegEx = "# Version (?<version>\d+\.\d+\.\d+)"
if ([System.IO.File]::Exists($latestVersionFile)) {
@jborean93
jborean93 / Trace-TlsHandshake.ps1
Last active December 7, 2023 14:49
Debug TLS Handshakes using .NET
# Copyright: (c) 2022, Jordan Borean (@jborean93) <jborean93@gmail.com>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
Function Trace-TlsHandshake {
<#
.SYNOPSIS
TLS Handshake Diagnostics.
.DESCRIPTION
Performs a TLS handshake and returns diagnostic information about that
@jborean93
jborean93 / Get-SqlServerTlsCertificate.ps1
Last active October 4, 2023 17:46
Gets the certificate used by a MS SQL Server
# Copyright: (c) 2023, Jordan Borean (@jborean93) <jborean93@gmail.com>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
Function Get-SqlServerTlsCertificate {
<#
.SYNOPSIS
Gets the MS SQL X509 Certificate.
.DESCRIPTION
Gets the X509 Certificate that is being used by a remote MS SQL Server.
@jstangroome
jstangroome / gist:3087453
Created July 11, 2012 01:58
Change your own Active Directory password from PowerShell without any special permissions
([adsi]'WinNT://domain/username,user').ChangePassword('oldpassword','newpassword')
@ninmonkey
ninmonkey / Powershell Performance testing -- adding to arrays is slow.md
Last active July 29, 2022 01:44
Powershell Performance -- Adding elements to arrays is **very** slow

Powershell Performance: Adding to arrays is slow

powershell array performance results

A common pattern in many languages adds an element to an array or list

elements = []
for x in range(10000):
 elements.append(x)
@SQLDBAWithABeard
SQLDBAWithABeard / Get-MicrosoftTags.ps1
Last active May 27, 2022 15:25
get microsoft tags
function Get-MicrosoftTags {
$AllRepos = (iwr https://mcr.microsoft.com/v2/_catalog).content | ConvertFrom-Json
# $AllRepos.Repositories | where{ $_ -like '*sql*'}
if ($IsCoreCLR) {
$repo = $AllRepos.Repositories | Out-ConsoleGridView -OutputMode Single
}
else {
$repo = $AllRepos.Repositories | Out-GridView -Passthru
}
$Url = "https://mcr.microsoft.com/v2/{0}/tags/list" -f $repo
@potatoqualitee
potatoqualitee / findshit.ps1
Created February 5, 2020 16:25
findshit.ps1
function findshit ($str) {
$str = [regex]::escape($str)
Select-String -Pattern $str -Path (Get-ChildItem C:\github\dbatools\*.ps* -Recurse -Exclude 'allcommands.ps1', '*.dll', "*psproj")
}