Skip to content

Instantly share code, notes, and snippets.

View Windos's full-sized avatar

Josh King Windos

View GitHub Profile
@Windos
Windos / 2016-03-Beginner.ps1
Created March 12, 2016 02:56
Beginner entry for March 2016 PowerShell.org scripting games
# Beginner Puzzle
(Get-ChildItem C:\FileShare -Recurse).Where({$_.Name -match "[\u00C0-\u00FF]"}) |
Select-Object -Property Name,
Directory,
@{n="Creation Date";e={$_.CreationTime}},
@{n="Last Modification Date";e={$_.LastWriteTime}},
@{n="File Size";e={$_.Length}} |
Format-Table
@Windos
Windos / runOnOccurance.ps1
Created March 7, 2016 05:39
Simple logic to emulate running a script monthly.
# Set powershell job to run Weekly, on on the desired day.
# Wrap the code the job is running with the below so that it will only run
# when intended.
# e.g. Last Wednesday of month:
#
# $DayToRun = 'Wednesday'
# Occurance = -1
#
# The scheduled job still runs once a week, but will only execute your code
# if the date is validated.
Verifying that +windos is my blockchain ID. https://onename.com/windos
@Windos
Windos / Windos-ScriptingGames-2015-12.ps1
Last active December 7, 2015 22:50
December 2015 Scripting Games Submission, Windos
$list = @"
1 Partridge in a pear tree
2 Turtle Doves
3 French Hens
4 Calling Birds
5 Golden Rings
6 Geese a laying
7 Swans a swimming
8 Maids a milking
9 Ladies dancing
@Windos
Windos / Windos-ScriptingGames-2015-10
Created October 16, 2015 10:04
October 2015 Scripting Game Submissions, Windos
function Get-RSSFeed
{
<#
.SYNOPSIS
Gets data from a RSS Feed.
.DESCRIPTION
The Get-RSSFeed function retrieves the title, link and excerpt from a specified rss feed.
Multiple URIs can be provided as parameters or piped to the function.
@Windos
Windos / SamAccountNameSpeed.ps1
Created September 30, 2015 01:56
It turns out there are a few different ways to search for a given SamAccountName ($user) using the Get-ADUser cmdlet. As part of a bigger project, I decided to find out which method was faster.
# Speeds are measured in milliseconds and are the average over 256 test runs
# 6.3 ms
Get-ADUser -Filter { SamAccountName -eq $user }
# 6.7 ms
Get-AdUser -LDAPFilter "(SamAccountName=$user)"
# 8.5 ms
Get-ADUser -Identity $user
@Windos
Windos / Windos-ScriptingGames-2015-07
Created July 5, 2015 01:40
July 2015 Scripting Game Submissions, Windos
gwmi Win32_OperatingSystem -cn localhost | select PSC*, S*aj*, V*, @{N='BIOSSerial';E={(gwmi Win32_Bios -cn $_.__Server).SerialNumber}}