Skip to content

Instantly share code, notes, and snippets.

Avatar

Trevor Jones SMSAgentSoftware

View GitHub Profile
@SMSAgentSoftware
SMSAgentSoftware / Export-CMConfigurationItemScripts.ps1
Created Feb 21, 2017
Exports all scripts (discovery and remediation) used in all SCCM Compliance Setting Configuration Items
View Export-CMConfigurationItemScripts.ps1
<#
.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 / SQLQuery.ps1
Created Mar 20, 2017
A custom class for PowerShell 5+ to query a SQL Server
View SQLQuery.ps1
class SQLQuery
{
# Properties
[string]$SQLServer
[string]$Database
[string]$Query
[string]$QueryFile
[string]$Path
[int]$ConnectionTimeout = 5
@SMSAgentSoftware
SMSAgentSoftware / Backup-CMSiteMaintenanceTaskSettings.ps1
Created Apr 6, 2017
Backs up ConfigMgr Site Maintenance Task settings from WMI to json files
View Backup-CMSiteMaintenanceTaskSettings.ps1
## 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 / Restore-CMSiteMaintenanceTaskSettings.ps1
Last active Nov 21, 2017
Restores ConfigMgr Site Maintenance Task Settings backed up using the 'Backup-CMSiteMaintenanceTaskSettings' script
View Restore-CMSiteMaintenanceTaskSettings.ps1
## 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 / Download-LatestDellDriverPack.ps1
Created Apr 25, 2017
Downloads the latest driver pack from Dell for any model or models you specify
View Download-LatestDellDriverPack.ps1
[CmdletBinding()]
Param
(
[Parameter(Mandatory=$true,
ValueFromPipelineByPropertyName=$true,
ValueFromPipeline=$true,
Position=0)]
[String[]]$Model,
[Parameter(Mandatory=$true,
@SMSAgentSoftware
SMSAgentSoftware / Get-WindowsVersion.ps1
Last active Feb 18, 2021
Finds the Windows version including Edition, Version and OS Build numbers for local or remote computers
View Get-WindowsVersion.ps1
[CmdletBinding()]
Param
(
[Parameter(Mandatory=$false,
ValueFromPipelineByPropertyName=$true,
ValueFromPipeline=$true
)]
[string[]]$ComputerName = $env:COMPUTERNAME
)
@SMSAgentSoftware
SMSAgentSoftware / Get-PatchStatus.ps1
Created May 22, 2017
Gets the status of software update/s on remote system/s. This is the SINGLE-THREADED version.
View Get-PatchStatus.ps1
# Get-PatchStatus.ps1
# Gets the status of software update/s on remote system/s
#
# The is the SINGLE-THREADED version
#
# Author: Trevor Jones
# May-2017
[CmdletBinding()]
@SMSAgentSoftware
SMSAgentSoftware / Get-PatchStatus.ps1
Created May 22, 2017
Gets the status of software update/s on remote system/s. This is the MULTI-THREADED version.
View Get-PatchStatus.ps1
# 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 / Set-W10DefaultWallpaper.ps1
Created Jul 6, 2017
Used to set the default wallpaper images for Windows 10 during MDT-integrated ConfigMgr OS deployment
View Set-W10DefaultWallpaper.ps1
# 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 / New-WPFMessageBox
Last active Aug 27, 2021
PowerShell function to display a customizable WPF message box / window
View New-WPFMessageBox
Function New-WPFMessageBox {
# For examples for use, see my blog:
# https://smsagent.wordpress.com/2017/08/24/a-customisable-wpf-messagebox-for-powershell/
# CHANGES
# 2017-09-11 - Added some required assemblies in the dynamic parameters to avoid errors when run from the PS console host.
# Define Parameters
[CmdletBinding()]