Skip to content

Instantly share code, notes, and snippets.

View SMSAgentSoftware's full-sized avatar

Trevor Jones SMSAgentSoftware

View GitHub Profile
@SMSAgentSoftware
SMSAgentSoftware / New-MEMAdminAuditReport.ps1
Created September 25, 2020 12:34
Script to send a daily audit report for admin activities in MEM/Intune
# 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-WoodyRestartNotification.ps1
Created May 11, 2020 08:54
Creates a Toy Story-themed restart notification in top left of primary screen
Add-Type -AssemblyName PresentationFramework,System.Windows.Forms
# Set screen working area, and start and finish location of the window 'top' property (for animation)
$workingArea = [System.Windows.Forms.Screen]::PrimaryScreen.WorkingArea
$TopStart = $workingArea.Top - 449
$TopFinish = $workingArea.Top + 10
[xml]$Xaml = @"
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
@SMSAgentSoftware
SMSAgentSoftware / Upload-CMClientLogsToAzureStorageAccount
Created May 1, 2020 10:39
Uploads ConfigMgr client log files to an Azure storage account. Requires a Shared access signature.
## Uploads client logs files to Azure storage
$Logs = Get-ChildItem "$env:SystemRoot\CCM\Logs"
$Date = Get-date -Format "yyyy-MM-dd-HH-mm-ss"
$ContainerURL = "https://mystorageaccount.blob.core.windows.net/mycontainer"
$FolderPath = "ClientLogFiles/$($env:COMPUTERNAME)/$Date"
$SASToken = "?sv=2019-10-10&ss=b&srt=o&sp=c&se=2030-05-01T06:31:59Z&st=2020-04-30T22:31:59Z&spr=https&sig=123456789abcdefg"
$Responses = New-Object System.Collections.ArrayList
$Stopwatch = New-object System.Diagnostics.Stopwatch
# User-context script to set the Language List
# Language codes
$PrimaryLanguage = "en-GB"
$SecondaryLanguage = "en-US"
$PrimaryInputCode = "0809:00000809"
$SecondaryInputCode = "0409:00000409"
# Set preferred languages
$NewLanguageList = New-WinUserLanguageList -Language $PrimaryLanguage
# Admin-context script to set the administrative language defaults, system locale and install optional features for the primary language
# Language codes
$PrimaryLanguage = "en-GB"
$SecondaryLanguage = "en-US"
$PrimaryInputCode = "0809:00000809"
$SecondaryInputCode = "0409:00000409"
$PrimaryGeoID = "242"
# Enable side-loading
@SMSAgentSoftware
SMSAgentSoftware / Delete-DeviceRecords.ps1
Last active April 22, 2024 02:18
Deletes device records in AD / AAD / Intune / Autopilot / ConfigMgr. Useful for Autopilot test deployments.
[CmdletBinding(DefaultParameterSetName='All')]
Param
(
[Parameter(ParameterSetName='All',Mandatory=$true,ValueFromPipelineByPropertyName=$true,ValueFromPipeline=$true)]
[Parameter(ParameterSetName='Individual',Mandatory=$true,ValueFromPipelineByPropertyName=$true,ValueFromPipeline=$true)]
[string[]]$ComputerName,
[Parameter(ParameterSetName='All')]
[switch]$All = $True,
[Parameter(ParameterSetName='Individual')]
[switch]$AD,
@SMSAgentSoftware
SMSAgentSoftware / Get-HPDriverPacks.ps1
Created January 28, 2020 15:38
Returns driver pack info for HP workstations by scraping the HP driver packs web pages.
[CmdletBinding()]
Param
(
[Parameter(Mandatory=$false)]
[ValidateSet('64-bit','32-bit')]
$Architecture = "64-bit"
)
# Load the HP driver pack web page
If ($Architecture -eq "64-bit")
[CmdletBinding()]
Param
(
[Parameter(Mandatory=$false,ValueFromPipelineByPropertyName=$true,ValueFromPipeline=$true)]
[string[]]$ComputerName = $env:COMPUTERNAME
)
Begin
{
@SMSAgentSoftware
SMSAgentSoftware / Get-CMBaselineEvaluations.ps1
Last active May 1, 2020 08:27
Reads the most recent and next scheduled evaluation times on the local machine for ConfigMgr Compliance Baselines
##############################################################
## ##
## Reads the most recent and next scheduled evaluation time ##
## for deployed Compliance Baselines from the Scheduler.log ##
## ##
##############################################################
#requires -RunAsAdministrator
# Get Baselines from WMI
@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