Skip to content

Instantly share code, notes, and snippets.

View SMSAgentSoftware's full-sized avatar

Trevor Jones SMSAgentSoftware

View GitHub Profile
@SMSAgentSoftware
SMSAgentSoftware / Get-CMClientVersions.ps1
Created August 31, 2017 15:52
Function that gets the current count and percentage of ConfigMgr Client Versions in the site
Function Get-CMClientVersions {
# Requires the "New-WPFMessageBox" function available at https://gist.github.com/SMSAgentSoftware/0c0eee98a673b6ac34f5215ea6841beb
# Requires minimum "db_datareader" SQL role in the ConfigMgr database
# Usage: Get-CMClientVersions -SQLServer "SQLServer" -Database "Database"
[CmdletBinding()]
Param
(
[Parameter(Mandatory=$True,Position=0)]
@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-IntuneDataWarehouseAccessToken.ps1
Last active December 11, 2017 17:13
Gets an access token to allow access to the Intune Data Warehouse
Function New-IntuneDataWarehouseAccessToken {
# Function to get an access token for the Intune Data Warehouse
# To be used in conjunction with the function Get-IntuneDataWarehouseData
# Will download NuGet if required to install the latest Active Directory Authentication Library package
[CmdletBinding()]
Param(
[Parameter()]
$NuGetDirectory = "$Env:USERPROFILE\NuGet",
@SMSAgentSoftware
SMSAgentSoftware / Get-IntuneDataWarehouseData.ps1
Last active December 10, 2017 20:43
Retrieves data from the Intune Data Warehouse
Function Get-IntuneDataWarehouseData {
# Function to query the Intune Data Warehouse for data
# Requires an access token to be created first via the New-IntuneDataWarehouseAccessToken function
[CmdletBinding()]
Param(
[Parameter()] # this is the custom feed URL for your for your tenant for the InTune Data Warehouse
$WarehouseUrl = "https://fef.msun02.manage.microsoft.com/ReportingService/DataWarehouseFEService?api-version=beta",
[Parameter()]
@SMSAgentSoftware
SMSAgentSoftware / New-SingleSeriesSplineChart.ps1
Last active June 13, 2018 05:25
PowerShell function to create a single-series spline chart from .Net chart controls and display in a WPF window
Function New-SingleSeriesSplineChart {
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true)]
$Title,
[Parameter(Mandatory=$true)]
$Data,
[Parameter(Mandatory=$true)]
$AxisX,
@SMSAgentSoftware
SMSAgentSoftware / New-CustomToastNotification.ps1
Last active April 21, 2024 11:41
Create your own toast notification with WPF and PowerShell
# Demo script to display a custom 'toast' notification
# Load required assemblies
Add-Type -AssemblyName PresentationFramework, System.Windows.Forms
# User-populated variables
$WindowHeight = 140
$WindowWidth = 480
$Title = "New Blog Post by SMSAgent!"
$Text = "Trevor Jones has posted a new blog: Create a custom toast notification with WPF and PowerShell. Click here to read."
@SMSAgentSoftware
SMSAgentSoftware / New-HtmlSQLEmailReport.ps1
Created April 5, 2018 13:25
PowerShell template for sending an html report with SQL data by email
###################################################################################
## 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 / Run-SetupDiag.ps1
Created May 15, 2018 15:21
PowerShell wrapper to run Microsoft's SetupDiag utility for troubleshooting Windows 10 setup. For use in an SCCM task sequence.
# Script to run SetupDiag to troubleshoot Windows 10 Setup
# Download SetupDiag.exe from https://go.microsoft.com/fwlink/?linkid=870142 and place in same directory as this script
# Get the CCM Logs location from registry
$LogLocation = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\CCM\Logging\@Global" -Name LogDirectory | Select -ExpandProperty LogDirectory
#$LogLocation = "$env:SystemRoot\CCM\Logs"
# Get the location we're running from (or use $PSScriptRoot)
$ScriptPath = Split-Path $MyInvocation.MyCommand.Path -Parent
@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-InteractiveDataDisplayChart.ps1
Created June 20, 2018 16:43
Creates a simple interactive bar chart using Microsoft's opensource Interactive Data Display project
## Example of how to use the opensource InteractveDataDisplay module from Microsoft to create a WPF chart in PowerShell
Add-Type -AssemblyName PresentationFramework
Add-Type -AssemblyName System.IO.Compression.FileSystem
# Location to download the required libraries and reference them from
$Source = "C:\Users\tjones\OneDrive\PowerShell\POSH Projects\Interactive Data Display"
#region DownloadDependencies
$URLs = @(