Skip to content

Instantly share code, notes, and snippets.

View biacz's full-sized avatar

Nikolas Beutler biacz

View GitHub Profile
@biacz
biacz / diskspace.ps1
Created August 15, 2019 12:05
Checking disk space
function CleanVariables { Get-Variable | Where-Object { $startupVariables -notcontains $_.Name } | ForEach-Object {
try { Remove-Variable -Name "$($_.Name)" -Force -Scope "global" -ErrorAction SilentlyContinue -WarningAction SilentlyContinue }
catch { }
}
}
CleanVariables
<# This form was created using POSHGUI.com a free online gui designer for PowerShell
.NAME
@biacz
biacz / slowAF.ps1
Last active August 16, 2019 11:20
SLOW AF
$output = get-childitem -force \\$computer\c$\users\$user -Directory |
foreach-object {
$len = 0
measure-childitem $_.FullName -ErrorAction SilentlyContinue | foreach-object { $len += $_.Size }
[pscustomobject]@{
Name = $_.FullName
SizeGB = [math]::round($len / 1Gb, 2)
}
}
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"artifactsLocation": {
"defaultValue": "https://wvdportalstorageblob.blob.core.windows.net/galleryartifacts/Configuration.zip",
"type": "String",
"metadata": {
"description": "The base URI where artifacts required by this template are located."
}
@biacz
biacz / main.ps1
Created January 22, 2022 15:45
AzureFunction - Turn off inactive AVD SessionHosts
<#
.SYNOPSIS
Automated process to stop unused session hosts in a Azure Virtual Desktop (AVD) personal host pool.
.DESCRIPTION
This script is intended to automatically stop personal host pool session hosts in a Azure Virtual Desktop
host pool. The script will evaluate session hosts in a host pool and create a list of session hosts with
active connections. The script will then compare all session hosts in the personal host pool that are
powered on and not in drain mode. The script will shut down the session hosts that have no active connections.
.NOTES