Skip to content

Instantly share code, notes, and snippets.

@w0
w0 / Get-ContainerNodes.ps1
Created November 9, 2023 18:03
Returns all nodes inside a folder
function Get-ContainerNodes {
<#
.SYNOPSIS
Returns all nodes inside a folder
.DESCRIPTION
Returns all nodes inside of a 'folder' as a IResultObject.
These IResultObjects are for use with the ConfigurationManager PowerShell Modules.
Requires a path to work. You can use the name switch to get a parent directory only.
.PARAMETER SitePath
@w0
w0 / Get-ForcastedTemperature.ps1
Created June 8, 2021 17:49
Get your forcasted temperature!
function Get-ForcastedTemp {
$whereami = Invoke-RestMethod -Uri 'http://ip-api.com/json/' | select lat, lon
$grid = Invoke-RestMethod -Uri "https://api.weather.gov/points/$($whereami.lat),$($whereami.lon)"
$hourly = Invoke-RestMethod -Uri $grid.properties.forecast
$current = $hourly.properties.periods[0]
Write-Host ('Forcasted temperature is {0}F {1}' -f $current.temperature, $current.name.tolower())
}
@w0
w0 / Install-VaultCLI.ps1
Created June 8, 2021 17:39
Install and update vault cli
$releases = 'https://www.vaultproject.io/downloads'
$YOUR_VAULT_INSTANCE = 'https://your.vault.com:8200'
function Get-Latest {
$download_page = (Invoke-WebRequest -Uri $releases -UseBasicParsing).links
$url = $download_page | ? href -match 'windows_amd64.zip$' | select -expand href
$version = $url -split '/' | select -Last 1 -Skip 1
return @{
url = $url
version = $version
@w0
w0 / Find-References.ps1
Created June 8, 2021 17:32
Find Task Sequences that reference a application
<#
Find all task sequences where a application is referrenced.
$App name should match the admin console name
#>
$App = Get-CMApplication -Name 'AppName'
$TaskSeqIDs = (Invoke-CMWmiQuery -Query "select * from SMS_TaskSequenceAppReferencesInfo where RefAppModelName like '$($App.Modelname)'").PackageID
foreach ($TS in $TaskSeqIDs) {
$TaskName = (Get-CMTaskSequence -Fast -TaskSequencePackageId $TS).Name
Write-host ('App: {0} found in: {1}' -f $App.LocalizedDisplayName, $TaskName)