Skip to content

Instantly share code, notes, and snippets.

View SMSAgentSoftware's full-sized avatar

Trevor Jones SMSAgentSoftware

View GitHub Profile
@SMSAgentSoftware
SMSAgentSoftware / Export-CMConfigurationItemScripts.ps1
Created February 21, 2017 11:35
Exports all scripts (discovery and remediation) used in all SCCM Compliance Setting Configuration Items
<#
.Synopsis
Exports all scripts (discovery and remediation) used in all SCCM Compliance Setting Configuration Items
.DESCRIPTION
This script connects to the SCCM database to retrieve all Compliance Setting Configuration Items. It then processes each item looking for
discovery and remediation scripts for the current (latest) version. It will export any script found into a directory structure.
.NOTES
Requirements - 'db_datareader' permission to the SCCM SQL database with the account running this script.
Parameters - set the parameters below as required
#>
@SMSAgentSoftware
SMSAgentSoftware / Backup-CMSiteMaintenanceTaskSettings.ps1
Created April 6, 2017 10:56
Backs up ConfigMgr Site Maintenance Task settings from WMI to json files
## Saves ConfigMgr Site Maintenance Task settings from WMI to json files ##
## Should be run on the Primary Site Server ##
## Should be run as administrator ##
[cmdletbinding()]
Param(
[Parameter(Position=0,Mandatory=$True)]
[ValidateNotNullorEmpty()]
[string]$SiteCode,
[Parameter(Position=1,Mandatory=$True)]
@SMSAgentSoftware
SMSAgentSoftware / Set-W10DefaultWallpaper.ps1
Created July 6, 2017 10:51
Used to set the default wallpaper images for Windows 10 during MDT-integrated ConfigMgr OS deployment
# Get the TS variables
$tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
$ScriptRoot = $tsenv.Value("ScriptRoot")
$OSDTargetSystemRoot = $tsenv.Value("OSDTargetSystemRoot")
# Rename default wallpaper
Rename-Item $OSDTargetSystemRoot\Web\Wallpaper\Windows\img0.jpg img1.jpg -Force
# Copy new default wallpaper
Copy-Item $ScriptRoot\img0.jpg $OSDTargetSystemRoot\Web\Wallpaper\Windows -Force
@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 / Restore-CMSiteMaintenanceTaskSettings.ps1
Last active November 21, 2017 11:02
Restores ConfigMgr Site Maintenance Task Settings backed up using the 'Backup-CMSiteMaintenanceTaskSettings' script
## Restores ConfigMgr Site Maintenance Task settings from json files (backed up using the 'Backup-CMSiteMaintenanceTaskSettings' script ##
## Should be run on the Primary Site Server ##
## Should be run as administrator ##
[cmdletbinding()]
Param(
[Parameter(Position=0,Mandatory=$True)]
[ValidateNotNullorEmpty()]
[string]$SiteCode,
[Parameter(Position=1,Mandatory=$True)]
@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-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 / 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-ADSiteAndSubnetChangeReport.ps1
Created February 11, 2019 18:36
Sends an email report with any changes made to Active Directory Sites and Subnets. Run regularly with automation.
######################################################################################
## ##
## This script compares the current list of AD sites and subnets with a cached list ##
## If anything has changed, the cached list will be updated and the changes emailed ##
## ##
######################################################################################
################
## PARAMETERS ##
@SMSAgentSoftware
SMSAgentSoftware / Get-OfficeC2RConfiguration.ps1
Created September 3, 2018 15:46
Gets the Office 365 / Click-to-run configuration from local or remote computers
<#
.Synopsis
Retrieves O365/C2R info from a local or remote registry
.DESCRIPTION
Retrieves some basic info on the Office 365 / Click-to-run installation on the local or remote computer/s, such as products installed, version number, activation account, bitness etc.
Requires PS remoting to be enabled for remote computer access.
.PARAMETER ComputerName
[Optional] the name or names of remote computers
.EXAMPLE
Get-OfficeC2RInfo