Skip to content

Instantly share code, notes, and snippets.

View SMSAgentSoftware's full-sized avatar

Trevor Jones SMSAgentSoftware

View GitHub Profile
@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 / 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
@SMSAgentSoftware
SMSAgentSoftware / Get-PatchStatus.ps1
Created May 22, 2017 17:07
Gets the status of software update/s on remote system/s. This is the MULTI-THREADED version.
# Get-PatchStatus.ps1
# Gets the status of software update/s on remote system/s
#
# The is the MULTI-THREADED version
#
# IMPORTANT: Requires my [BackgroundJob] custom class, available here: http://smsagent.wordpress.com/posh-5-custom-classes/background-job/
#
# Author: Trevor Jones
# May-2017
@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-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 / 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-WPFClock
Created September 15, 2017 13:53
A clock widget for PowerShell using the free Arction Gauge control
Function New-WPFClock {
## Generates a clock displaying the current system time
## Requires the Arction WPF Gauges, a free download from https://www.arction.com/free-gauges/
## Set the location of the Arction Gauges dll on line 26
[CmdletBinding()]
Param
(
[Parameter(Mandatory=$false,Position=0)]
@SMSAgentSoftware
SMSAgentSoftware / New-CMApplicationDeploymentNotification.ps1
Created June 14, 2018 16:46
Displays a Windows 10 toast notification in conjunction with Application deployments in ConfigMgr
## 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"
@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
[CmdletBinding()]
Param
(
[Parameter(Mandatory=$false,ValueFromPipelineByPropertyName=$true,ValueFromPipeline=$true)]
[string[]]$ComputerName = $env:COMPUTERNAME
)
Begin
{