Skip to content

Instantly share code, notes, and snippets.

View SMSAgentSoftware's full-sized avatar

Trevor Jones SMSAgentSoftware

View GitHub Profile
@SMSAgentSoftware
SMSAgentSoftware / Get-W10UpgradeHardBlockers.ps1
Created August 2, 2018 11:25
Searches the Windows 10 Setup Compatibility logs for upgrade hard blockers
# Searches the Windows 10 Setup Compatibility logs for upgrade hard blockers
# Find all the compatibility xml files
$SearchLocation = 'C:\$WINDOWS.~BT\Sources\Panther'
$CompatibilityXMLs = Get-childitem "$SearchLocation\compat*.xml" | Sort LastWriteTime -Descending
# Create an array to hold the results
$Blockers = @()
# Search each file for any hard blockers
@SMSAgentSoftware
SMSAgentSoftware / New-WizTreeDiskUsageReport.ps1
Created August 15, 2018 13:27
Creates csv and html disk usage reports using WizTree portable
# Script to export html and csv reports of file and directory content on the system drive
# Use to identify large files/directories for disk space cleanup
# Uses WizTree portable to quickly retrieve file and directory sizes from the Master File Table on disk
# Download and extract the WizTree64.exe and place in the same directory as this script
# Set the running location
$RunLocation = $PSScriptRoot
#$RunLocation = "C:\temp"
$TempLocation = "C:\temp"
@SMSAgentSoftware
SMSAgentSoftware / Get-OfficeC2RConfiguration.ps1
Created September 3, 2018 15:46
Gets the Office 365 / Click-to-run configuration from local or remote computers
<#
.Synopsis
Retrieves O365/C2R info from a local or remote registry
.DESCRIPTION
Retrieves some basic info on the Office 365 / Click-to-run installation on the local or remote computer/s, such as products installed, version number, activation account, bitness etc.
Requires PS remoting to be enabled for remote computer access.
.PARAMETER ComputerName
[Optional] the name or names of remote computers
.EXAMPLE
Get-OfficeC2RInfo
@SMSAgentSoftware
SMSAgentSoftware / New-HTMLDeliveryOptimizationReport.ps1
Created February 4, 2019 14:29
Generates an HTML-styled report with Delivery Optimization statistics for local or remote Windows 10 computers
<#
.Synopsis
Generates an HTML-styled report with Delivery Optimization statistics for local or remote Windows 10 computers
.DESCRIPTION
Uses the built-in Windows 10 cmdlets for delivery optimization to generate a DO report in html format. Can run against the local or remote computers. Optionally sends the report as an email.
.EXAMPLE
New-HTMLDeliveryOptimizationReport
Creates an HTML DO report for the local machine and invokes it.
.EXAMPLE
New-HTMLDeliveryOptimizationReport -ComputerName "PC001","PC002"
@SMSAgentSoftware
SMSAgentSoftware / New-ADSiteAndSubnetChangeReport.ps1
Created February 11, 2019 18:36
Sends an email report with any changes made to Active Directory Sites and Subnets. Run regularly with automation.
######################################################################################
## ##
## This script compares the current list of AD sites and subnets with a cached list ##
## If anything has changed, the cached list will be updated and the changes emailed ##
## ##
######################################################################################
################
## PARAMETERS ##
@SMSAgentSoftware
SMSAgentSoftware / Create-CMSUPErrorCollections.ps1
Created February 28, 2019 12:03
Creates collections in SCCM for software update installation errors by error code and enforcement state
##########################################################################
## Script to create collections for Software Update installation errors ##
##########################################################################
<#
Find SUP error codes in your environment (SQL):
"
Select Count(ResourceID),LastEnforcementErrorCode
@SMSAgentSoftware
SMSAgentSoftware / New-CMComponentStatusReport.ps1
Created April 1, 2019 14:42
Generates an html email report for SCCM Site Server components in an error or warning state.
#####################################################################################################
## ##
## This script checks for any SCCM Site Server components currently in an error or warning ##
## state and emails it as an html report, including the latest status messages for each component. ##
## ##
#####################################################################################################
################
## PARAMETERS ##
@SMSAgentSoftware
SMSAgentSoftware / New-RemoteToastNotification.ps1
Created June 11, 2019 12:59
Displays a toast notification on a remote computer
$Sender = "Trevor Jones"
$Message = "Hey buddy - ready for lunch?"
$RemoteComputer = "PC001"
Function New-ToastNotification {
Param($Sender,$Message)
# Required parameters
$AudioSource = "ms-winsoundevent:Notification.Default"
$HeaderFormat = "ImageAndTitle" # Choose from "TitleOnly", "ImageOnly" or "ImageAndTitle"
@SMSAgentSoftware
SMSAgentSoftware / Get-CMUserLogonEvents.ps1
Created June 17, 2019 13:25
Retrieve user logon events from SCCM WMI
Function Get-CMUserLogonEvents {
[CmdletBinding()]
Param
(
[Parameter(Mandatory=$false,ValueFromPipelineByPropertyName=$true)]
$ComputerName,
[Parameter(Mandatory=$false,ValueFromPipelineByPropertyName=$true)]
$MaximumEvents = 50
)
@SMSAgentSoftware
SMSAgentSoftware / New-TrayIconCustomContextMenu.ps1
Created September 25, 2019 21:49
Script to create a system tray icon with a custom Windows 10-style context menu
##################################################################
## PS Script to create a custom WPF content menu for a tray app ##
##################################################################
# Add assemblies
Add-Type -AssemblyName System.Windows.Forms,PresentationFramework
# Create a WinForms application context
$appContext = New-Object System.Windows.Forms.ApplicationContext