Skip to content

Instantly share code, notes, and snippets.

Avatar

Trevor Jones SMSAgentSoftware

View GitHub Profile
@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-WoodyRestartNotification.ps1
Created May 11, 2020
Creates a Toy Story-themed restart notification in top left of primary screen
View New-WoodyRestartNotification.ps1
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
Uploads ConfigMgr client log files to an Azure storage account. Requires a Shared access signature.
View Upload-CMClientLogsToAzureStorageAccount
## 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
View Apply-UserLanguagePreferences-en-GB.ps1
# 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
View Apply-AdministrativeLanguageDefault-enGB.ps1
# 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-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,
@SMSAgentSoftware
SMSAgentSoftware / Get-HPDriverPacks.ps1
Created Jan 28, 2020
Returns driver pack info for HP workstations by scraping the HP driver packs web pages.
View Get-HPDriverPacks.ps1
[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")
View Get-CMClientExecutionHistory.ps1
[CmdletBinding()]
Param
(
[Parameter(Mandatory=$false,ValueFromPipelineByPropertyName=$true,ValueFromPipeline=$true)]
[string[]]$ComputerName = $env:COMPUTERNAME
)
Begin
{
@SMSAgentSoftware
SMSAgentSoftware / Get-CMBaselineEvaluations.ps1
Last active May 1, 2020
Reads the most recent and next scheduled evaluation times on the local machine for ConfigMgr Compliance Baselines
View Get-CMBaselineEvaluations.ps1
##############################################################
## ##
## 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 Sep 25, 2019
Script to create a system tray icon with a custom Windows 10-style context menu
View New-TrayIconCustomContextMenu.ps1
##################################################################
## 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
You can’t perform that action at this time.