Skip to content

Instantly share code, notes, and snippets.

@bigbadmoshe
bigbadmoshe / PowerShell 3 ways to sort a list unique.md
Last active March 15, 2026 09:24
PowerShell 3 ways to sort a list unique
@bigbadmoshe
bigbadmoshe / Powershell_Dotnet_or_not_Dotnet.md
Last active March 15, 2026 10:22
Powershell Dotnet or not Dotnet

Dotnet or not Dotnet this is the question we will ask in this post

Lets find out if the .NET .Where() method is significantly faster than their equivalent in native PowerShell In this post, we'll compare the performance of native PowerShell methods with their .NET counterparts, specifically focusing on the .Where() method. We'll also use the .net[Linq.Enumerable] class to analyze a different dataset - passenger data from the Titanic - instead of the usual Active Directory user data.

The Code We'll be using three different methods to compare performance:

# Define a collection of objects
@bigbadmoshe
bigbadmoshe / ps_cheatsheet.ps1
Last active June 29, 2023 14:24
powershell cheatsheet
# powershell cheatsheet
##############################################
# restart computer
Restart-Computer -Force # force restart
# handbrake batch processing
$filelist = Get-ChildItem D:\Video\ -Filter *.wmv
@bigbadmoshe
bigbadmoshe / Powershell_Get-WindowsVersion.md
Last active March 15, 2026 09:36 — forked from SMSAgentSoftware/Get-WindowsVersion.ps1
Powershell Finds the Windows version including Edition, Version and OS Build numbers for local or remote computers
function Get-WindowsVersion
{
    [CmdletBinding()]
    Param
    (
        [Parameter(
            Mandatory = $false,
            ValueFromPipelineByPropertyName = $true,
            ValueFromPipeline = $true
@bigbadmoshe
bigbadmoshe / New-WPFMessageBox.ps1
Last active January 8, 2026 06:24 — forked from SMSAgentSoftware/New-WPFMessageBox
PowerShell function New-WPFMessageBo
Function New-WPFMessageBox {
# For examples for use, see my blog:
# https://smsagent.wordpress.com/2017/08/24/a-customisable-wpf-messagebox-for-powershell/
# CHANGES
# 2017-09-11 - Added some required assemblies in the dynamic parameters to avoid errors when run from the PS console host.
# Define Parameters
[CmdletBinding()]
@bigbadmoshe
bigbadmoshe / Powershell_New-CustomToastNotification.ps1
Last active March 15, 2026 09:26 — forked from SMSAgentSoftware/New-CustomToastNotification.ps1
Powershell Create your own toast notification with WPF and PowerShell
# Demo script to display a custom 'toast' notification
# Load required assemblies
Add-Type -AssemblyName PresentationFramework, System.Windows.Forms
# User-populated variables
$WindowHeight = 140
$WindowWidth = 480
$Title = "New Blog Post by SMSAgent!"
$Text = "Trevor Jones has posted a new blog: Create a custom toast notification with WPF and PowerShell. Click here to read."
@bigbadmoshe
bigbadmoshe / Powershell_New-WoodyRestartNotification.ps1
Last active March 15, 2026 09:25 — forked from SMSAgentSoftware/New-WoodyRestartNotification.ps1
Powershell Creates a Toy Story-themed restart notification in top left of primary screen
Add-Type -AssemblyName PresentationFramework,System.Windows.Forms
# Set screen working area, and start and finish location of the window 'top' property (for animation)
$workingArea = [System.Windows.Forms.Screen]::PrimaryScreen.WorkingArea
$TopStart = $workingArea.Top - 449
$TopFinish = $workingArea.Top + 10
[xml]$Xaml = @"
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
@bigbadmoshe
bigbadmoshe / Charachters.ps1
Last active January 27, 2026 06:32
PowerShell Snippets
# https://symbl.cc/en/
# Heart Symbol (💗)
$heart = [System.Char]::ConvertFromUtf32(0x1F497)
$heartCodePoint = [int][char]$heart
Write-Host "Heart Symbol Code Point: 0x$($heartCodePoint.ToString("X4"))"
# Copyright Symbol (©)
$copyright = [System.Char]0x00A9