Skip to content

Instantly share code, notes, and snippets.

Avatar

Trevor Jones SMSAgentSoftware

View GitHub Profile
@SMSAgentSoftware
SMSAgentSoftware / Invoke-HPBIOSUpdate.ps1
Last active Oct 20, 2021
Silently updates an HP BIOS using HP Image Assistant
View Invoke-HPBIOSUpdate.ps1
#####################
## HP BIOS UPDATER ##
#####################
# Params
$HPIAWebUrl = "https://ftp.hp.com/pub/caps-softpaq/cmit/HPIA.html" # Static web page of the HP Image Assistant
$BIOSPassword = "MyPassword"
$script:ContainerURL = "https://mystorageaccount.blob.core.windows.net/mycontainer" # URL of your Azure blob storage container
$script:FolderPath = "HP_BIOS_Updates" # the subfolder to put logs into in the storage container
$script:SASToken = "mysastoken" # the SAS token string for the container (with write permission)
@SMSAgentSoftware
SMSAgentSoftware / Delete-AutopilotedDeviceRecords.ps1
Created Mar 17, 2020
Deletes device records in AD / AAD / Intune / Autopilot / ConfigMgr for Autopilot Test Deployments
View Delete-AutopilotedDeviceRecords.ps1
[CmdletBinding(DefaultParameterSetName='All')]
Param
(
[Parameter(ParameterSetName='All',Mandatory=$true,ValueFromPipelineByPropertyName=$true,ValueFromPipeline=$true)]
[Parameter(ParameterSetName='Individual',Mandatory=$true,ValueFromPipelineByPropertyName=$true,ValueFromPipeline=$true)]
$ComputerName,
[Parameter(ParameterSetName='All')]
[switch]$All = $True,
[Parameter(ParameterSetName='Individual')]
[switch]$AD,
View Get-CMClientExecutionHistory.ps1
[CmdletBinding()]
Param
(
[Parameter(Mandatory=$false,ValueFromPipelineByPropertyName=$true,ValueFromPipeline=$true)]
[string[]]$ComputerName = $env:COMPUTERNAME
)
Begin
{
@SMSAgentSoftware
SMSAgentSoftware / New-CMOverlappingBoundariesReport.ps1
Created Sep 3, 2021
Send an html email report containing a list of overlapping IP range boundaries in MEMCM
View New-CMOverlappingBoundariesReport.ps1
# MEMCM database params
$script:dataSource = 'myMEMCMSQLserver' # MEMCM SQL server name, include instance if needed
$script:database = 'CM_ABC' # MEMCM database name
# Html CSS style
$Style = @"
<style>
table {
border-collapse: collapse;
font-family: sans-serif
@SMSAgentSoftware
SMSAgentSoftware / New-WPFMessageBox
Last active Aug 27, 2021
PowerShell function to display a customizable WPF message box / window
View New-WPFMessageBox
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()]
@SMSAgentSoftware
SMSAgentSoftware / Get-CurrentPatchInfo.ps1
Last active Aug 26, 2021
Gets the current software update level of a Windows 10 workstation and compares with the latest available updates. Can also list all available updates for the current build.
View Get-CurrentPatchInfo.ps1
[CmdletBinding()]
Param(
[switch]$ListAllAvailable,
[switch]$ExcludePreview,
[switch]$ExcludeOutofBand
)
$ProgressPreference = 'SilentlyContinue'
$URI = "https://aka.ms/WindowsUpdateHistory" # Windows 10 release history
Function Get-MyWindowsVersion {
@SMSAgentSoftware
SMSAgentSoftware / New-MEMAdminAuditReport.ps1
Created Sep 25, 2020
Script to send a daily audit report for admin activities in MEM/Intune
View New-MEMAdminAuditReport.ps1
# Script to send a daily audit report for admin activities in MEM/Intune
# Requirements:
# - Log Analytics Workspace
# - Intune Audit Logs saved to workspace
# - Service Principal with 'Log Analytics reader' role in workspace
# - Azure Az PowerShell modules
# Azure resource info
$ApplicationId = "abc73938-0000-0000-0000-9b01316a9123" # Service Principal Application Id
$Secret = "489j49r-0000-0000-0000-e2dc6451123" # Service Principal Secret
@SMSAgentSoftware
SMSAgentSoftware / New-WizTreeDiskUsageReport.ps1
Created Aug 15, 2018
Creates csv and html disk usage reports using WizTree portable
View New-WizTreeDiskUsageReport.ps1
# 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 / New-HtmlSQLEmailReport.ps1
Created Apr 5, 2018
PowerShell template for sending an html report with SQL data by email
View New-HtmlSQLEmailReport.ps1
###################################################################################
## Script to send an html-formatted email report containing data from SQL Server ##
## ##
## Author: Trevor Jones ##
## Version 1.0 (5th Apr 2018) ##
###################################################################################
# Database info
$script:dataSource = 'SQLSERVER\INSTANCE'
$script:database = 'DATABASE'
@SMSAgentSoftware
SMSAgentSoftware / New-CMApplicationDeploymentNotification.ps1
Created Jun 14, 2018
Displays a Windows 10 toast notification in conjunction with Application deployments in ConfigMgr
View New-CMApplicationDeploymentNotification.ps1
## Displays a Windows 10 Toast Notification for a ConfigMgr Application deployment
## To be used in a compliance item
## References
# Options for audio: https://docs.microsoft.com/en-us/uwp/schemas/tiles/toastschema/element-audio#attributes-and-elements
# Toast content schema: https://docs.microsoft.com/en-us/windows/uwp/design/shell/tiles-and-notifications/toast-schema
# Datetime format for deadline: Ref: https://msdn.microsoft.com/en-us/library/system.datetime(v=vs.110).aspx
# Required parameters
$Title = "Enterprise Vault Outlook Add-in"