Skip to content

Instantly share code, notes, and snippets.

@gwblok
gwblok / RunScripts-GetCCMCacheInfo.ps1
Created December 19, 2019 21:35
RunScripts-GetCCMCacheInfo
#GARYTOWN - 2019.12.19 - @GWBLOK
#Connect to Cache
$CMObject = New-Object -ComObject 'UIResource.UIResourceMgr'
$CMCacheObjects = $CMObject.GetCacheInfo()
$CacheUsedStart = $CMCacheObjects.TotalSize - $CMCacheObjects.FreeSize
$CacheTotalSizeStart = $CMCacheObjects.TotalSize
$CMCacheObjectsElements = $CMCacheObjects.GetCacheElements()
$CacheCountStart = $CMCacheObjectsElements.Count
if ($CMCacheObjects.TotalSize -lt 25600)
@gwblok
gwblok / GetMachineDatabase-WithPrompts-FromCM.ps1
Last active April 16, 2021 07:47
Dynamically create Collections based on your Hardware Inventory in CM
<#V2020.01.27
Updated Script to Create "Operational" Folder and then move newly created Collections there.
Borrowed Code from Benoit Lecours
Made script pull addtional info dynamic, you shouldn't have to make any environmental chanages for script to work.
Script now also creates an "All Workstation" Collection and uses that as the limiting collection, unless one with that name already exist, then uses that.
Change the Limiting Collection info by updating: $LimitingCollection
You can easily modify the Collection Prefix now by changing these below:
$ModelColPrefix = "ModelCol"
$ManufacturerColPreFix = "ManufacturerCol"
@gwblok
gwblok / RunScripts-TriggerBaseline.ps1
Last active October 7, 2021 10:10
This will trigger the Configuration Baseline based on a parameter.
#For using in "Run Script" Node. Has Exit At end... will exit your ISE if you run in ISE. :-)
#Adopted from another script, so it has some Write-Hosts that don't really make sense in a CI, deal with it.
[CmdletBinding()]
Param (
[Parameter(Mandatory=$true)]
$BaselineName="WaaS Pre-Assessment"
)
@gwblok
gwblok / Test-CustomActions.ps1
Created January 8, 2020 18:30
Windows 10 Upgrades - Test Custom Actions Script (Run during TS)
<# GARYTOWN.COM / @gwblok
Custom Actions in the Setup Process
This script creates each of the 6 batch files, along with associated powershell files.
It then populates the Batch file to call the PS File
It then populates the PS File with the command to create a time stamp.
Note, assumes several task sequence variables (SMSTS_BUILD & RegistryPath) as the location to write the data to
Goal: Confirm when the Scripts run and compare to other logs