Skip to content

Instantly share code, notes, and snippets.

View jpritchard's full-sized avatar

Jonathan Pritchard jpritchard

View GitHub Profile
@jpritchard
jpritchard / Get-ContentFunction.ps1
Created November 26, 2016 01:51
Print the contents of a Function. Useful for debugging
# Debug function will print out the contents of the function if successful
#Get-Content Function:\Get-CountPendingUpdates
function Get-WIAStatusValue($value){
switch -exact ($value) {
0 {"NotStarted"}
1 {"InProgress"}
2 {"Succeeded"}
3 {"SucceededWithErrors"}
4 {"Failed"}
5 {"Aborted"}
}
}
@jpritchard
jpritchard / PSWindowsUpdate-Example3.ps1
Last active November 13, 2016 03:05
ADDED: 1. $ErrorActionPreference 2. $? -eq false 3. Attempt to fetch log Get-Content
<#
.Synopsis
Install all updates on a remote machine. A test script for PSWindowsUpdate
.DESCRIPTION
Uses the Invoke-WUInstall to remotely execute a Scheduled Task on a target machine.
Then executes Get-WUInstall to install all available updates and reboot if necessary.
.NOTES
Author: TDT
#>
@jpritchard
jpritchard / Uninstall-Hotfix.ps1
Last active November 13, 2016 02:37
Uninstall a Hotfix patch from a computer. Requires -HotFixID
<#
.Synopsis
Uninstall a hotfix patch update from a target computer. Requires the HotfixID
.DESCRIPTION
Uninstall a hotfix patch update from a target computer.
Requires the HotfixID (-HotfixID)
.EXAMPLE
Uninstall-HotFix -ComputerName PC1 -HotfixID KB123456
.SOURCE
http://techibee.com/powershell/powershell-uninstall-windows-hotfixesupdates/1084