$ASCIIART = "ICAgICAgICAgICAgICAgICAgIExPQURJTkcuLi4gICAgICAgICAgICAgICAgICAK4pWU4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWQ4pWXCuKVkSAwJSDilojilojilojilojilojilojilojilojilojilojilojilojilojilojilojilojilojilojilojilojilojilojilojilojilojilojilojilojilojilojilojilojilojilojilojiloggMTAwJSDilZEgCuKVmuKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVkOKVnQogICAgICAgICAgICAgICAgICAgQ09NUExFVEVEISAg"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-WindowsVersion | |
{ | |
[CmdletBinding()] | |
Param | |
( | |
[Parameter( | |
Mandatory = $false, | |
ValueFromPipelineByPropertyName = $true, | |
ValueFromPipeline = $true | |
)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# powershell cheatsheet | |
############################################## | |
# restart computer | |
Restart-Computer -Force # force restart | |
# handbrake batch processing | |
$filelist = Get-ChildItem D:\Video\ -Filter *.wmv | |
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
https://devdojo.com/hcritter/3-ways-to-sort-a-list-unique
Sort-Object -Unique Get-Unique HashSet-Class First we will create 3 different lists containing random strings in several sizes (small, medium, large)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .NET Types | |
$([System.Char]) | |
$([System.Char]::ConvertFromUtf32()) | |
$([System.Char]0x2013) | |
$([System.Char]0x00A9) | |
# Start a new process (e.g., Notepad) | |
$process = [System.Diagnostics.Process]::Start("notepad.exe") | |