Skip to content

Instantly share code, notes, and snippets.

@joegasper
joegasper / Update-AfsStorageSyncAgent.ps1
Last active February 16, 2024 12:22
PowerShell function to update Azure File Sync (AFS) Storage Agent on computer(s).
<#
.SYNOPSIS
Updates the Azure Files Storage Sync Agent on specified computers.
.DESCRIPTION
This cmdlet updates the Azure Files Storage Sync Agent on the specified computers by retrieving the installation directory from the registry, importing the update agent module DLL, and running the update process.
.PARAMETER ComputerName
Specifies the computer name on which the Azure Files Storage Sync Agent will be updated.
@joegasper
joegasper / Get-M365GroupsForUser.ps1
Created October 31, 2023 02:14
Microsoft 365 Group memberships for a user or summary report using ActiveDirectory module
<#
.Synopsis
Microsoft 365 Group memberships for a user or summary report
.DESCRIPTION
Output a list of a user's modern group memberships (Teams, Engage, Planner, Groups) or summary report
.EXAMPLE
Get-M365GroupsForUser -UserName pvenkman | sort DisplayName | select DisplayName,Description
.EXAMPLE
Get-M365GroupsForUser -UserName pvenkman -Report | where Owners -like "*rsantz*"
.EXAMPLE
@joegasper
joegasper / Get-M365GroupsOwned.ps1
Created October 31, 2023 02:10
Display Microsoft 365 Groups owned by a user using the ActiveDirectory module and msExchCoManagedByLink attribute
<#
.Synopsis
Display Microsoft 365 Groups owned by a user.
.DESCRIPTION
Display modern groups (Microsoft 365 Group, Microsoft Teams, Planner, Viva Engage, etc.)
of which the user is an owner. Script requires synchronization of modern groups to the
operator's Active Directory and the operator has permissions to read user object attributes.
The script requires the PowerShell module "ActiveDirectory".
.EXAMPLE
Get-M365GroupsOwned -UserName pvenkman | select DisplayName,Name
@joegasper
joegasper / PS-BGInfo.ps1
Created October 31, 2023 01:36 — forked from dieseltravis/PS-BGInfo.ps1
update wallpaper background image with powershell (like Sysinternals BGInfo)
# PS-BGInfo
# Powershell script that updates the background image with a random image from a folder and writes out system info text to it.
# run as a lower priority task
[System.Threading.Thread]::CurrentThread.Priority = 'BelowNormal'
# Configuration:
# Font Family name
$font="Input"
@joegasper
joegasper / GPU-P-Partitioning.ps1
Last active September 19, 2023 15:57
GPU-P Partitioning Script
# Name of Hyper-V VM
$vm = "MyVMName"
# Total VRAM of physical GPU (GPU-P)
$TotalGPUpVram = 6Gb
# Percent of physical GPU resources to allocate to virtual GPU in the VM
[int]$GPUpAllocationPercent = 25
# Calculate the high memory mapped IO value based on total GPU-P VRAM
@joegasper
joegasper / Get-PHPVersion.ps1
Created February 4, 2023 18:04
Given a path, determine installed version of PHP
function Get-PHPVersion {
<#
.SYNOPSIS
Given a path, determine installed version of PHP.
.DESCRIPTION
The provided path will be searched for php.exe files and return the version of found PHP executables.
.PARAMETER Path
Path to search
.EXAMPLE
Get-PHPVersions -Path E:\PHP
@joegasper
joegasper / Get-TeamsReactionImages.ps1
Created February 2, 2023 16:07
Download reaction images for Microsoft Teams plug-in for Stream Deck
### Download reaction images for Microsoft Teams plug-in for Stream Deck
$csv = @"
"URL","FileName"
"https://github.com/microsoft/fluentui-emoji/blob/main/assets/Raised%20hand/Default/3D/raised_hand_3d_default.png","RaiseHand.png"
"https://github.com/microsoft/fluentui-emoji/blob/main/assets/Thumbs%20up/Default/3D/thumbs_up_3d_default.png","Like.png"
"https://github.com/microsoft/fluentui-emoji/blob/main/assets/Red%20heart/3D/red_heart_3d.png","Love.png"
"https://github.com/microsoft/fluentui-emoji/blob/main/assets/Clapping%20hands/Default/3D/clapping_hands_3d_default.png","Applause.png"
"https://github.com/microsoft/fluentui-emoji/blob/main/assets/Face%20with%20open%20mouth/3D/face_with_open_mouth_3d.png","Wow.png"
"https://github.com/microsoft/fluentui-emoji/blob/main/assets/Grinning%20squinting%20face/3D/grinning_squinting_face_3d.png","Laugh.png"
"@
@joegasper
joegasper / wp-cli-install-on-windows.md
Created January 21, 2023 05:59
WordPress WP-CLI Installation on Windows

WordPress WP-CLI Installation on Windows

Prerequisites: Chocolatey, PHP, Composer

Use an elevated PowerShell console

Install chocolatey

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
@joegasper
joegasper / winget-update-manifest.md
Last active November 13, 2023 01:51
winget - Update Existing Package Manifest
# Convert-ADName.ps1
# Written by Bill Stewart (bstewart@iname.com)
# PowerShell wrapper script for the NameTranslate COM object.
#requires -version 2
<#
.SYNOPSIS
Translates Active Directory names between various formats.