Skip to content

Instantly share code, notes, and snippets.

View joeyaiello's full-sized avatar

Joey Aiello joeyaiello

View GitHub Profile
@joeyaiello
joeyaiello / WMF5Latest.ps1
Created October 19, 2015 02:05 — forked from mgreenegit/WMF5Latest.ps1
Get latest WMF5 and quietly install, reboot suppressed
# Use shortcode to find latest TechNet download site
$confirmationPage = 'http://www.microsoft.com/en-us/download/' + $((invoke-webrequest 'http://aka.ms/wmf5latest' -UseBasicParsing).links | ? Class -eq 'mscom-link download-button dl' | % href)
# Parse confirmation page and look for URL to file
$directURL = (invoke-webrequest $confirmationPage -UseBasicParsing).Links | ? Class -eq 'mscom-link' | ? href -match "Win8.1AndW2K12R2-KB\d\d\d\d\d\d\d-x64.msu" | % href | select -first 1
# Download file to local
$download = invoke-webrequest $directURL -OutFile $env:Temp\wmf5latest.msu
# Install quietly with no reboot
if (test-path $env:Temp\wmf5latest.msu) {
start -wait $env:Temp\wmf5latest.msu -argumentlist '/quiet /norestart'
}
<#
.SYNOPSIS
Fans of (Linux/UNIX) GNU findutils' locate will appreciate Invoke-Locate, which provides similar functionality. "locate" and "updatedb" aliases are automatically created.
.DESCRIPTION
This script was made in the spirit of GNU locate. While the name of this script is Invoke-Locate, it actually creates two persistent aliases: locate and updatedb. A fresh index is automatically created every 6 hours, updatedb can be used force a refresh. Indexes generally takes less than three minutes. Performing the actual locate takes about 300 milliseconds. Invoke-Locate supports both case-sensitive, and case-insensitive searches, and is case-insensitive by default.
locate queries a user-specific SQLite database prepared by updatedb (Task Scheduler) and writes file names matching the pattern to standard output, one per line. Since the back-end is SQL, SQL "LIKE" syntax can be used for the search pattern (ie % and _). Asterisks are automatically translated to % for people who are used to searching with