Skip to content

Instantly share code, notes, and snippets.

View JustinGrote's full-sized avatar

Justin Grote JustinGrote

View GitHub Profile
@JustinGrote
JustinGrote / Watch-UBreakIFix.psm1
Last active May 15, 2025 20:32
UBreakIFix Monitor
function Watch-UBreakIFix ($TrackingCode) {
while ($true) {
$result = foreach ($code in $TrackingCode) {
$response = Invoke-RestMethod "https://www.ubreakifix.com/api/v1/tracker/info?code=$code"
$status = $response.work_orders.work_order_status
[PSCustomObject]@{
'Customer' = $response.customer.full_name
'Device' = $response.work_orders.device.device_type.name
'Fixer' = $response.user.email
'Status' = $status.name
@JustinGrote
JustinGrote / Start-MSIEmulator.ps1
Last active April 16, 2025 18:35
A Managed Identity Emulator for testing Managed Identities locally. Returns a token from your currently logged in Azure PowerShell context
#requires -Module Az.Accounts
$verbosePreference = 'continue'
function ConvertFrom-JWTtoken {
<#
.NOTES
Lovingly borrowed from: https://www.michev.info/blog/post/2140/decode-jwt-access-and-id-tokens-via-powershell
#>
[cmdletbinding()]
param([Parameter(Mandatory = $true)][string]$token)
#requires -module Az.Functions
function Write-CmdletError {
param($message, $cmdlet = $PSCmdlet)
$cmdlet.ThrowTerminatingError(
[Management.Automation.ErrorRecord]::new(
$message,
'CmdletError',
'InvalidArgument',
@JustinGrote
JustinGrote / New-JAzDataCollectionRule.ps1
Last active August 3, 2024 08:19
Create a Data Collection rule with embedded Ingestion DCRs
using namespace Microsoft.Azure.PowerShell.Cmdlets.Monitor.DataCollection.Models
using namespace System.Management.Automation
function New-JAzDataCollectionRule {
<#
.SYNOPSIS
Create a new Data Collection Rule in Azure Monitor. Uses 2023 API for direct DCRs
.NOTES
The MS Documentation on this sucks but the reference has a good example which is how I figured it out: https://learn.microsoft.com/en-us/rest/api/monitor/data-collection-rules/create?view=rest-monitor-2023-03-11&tabs=HTTP#create-or-update-data-collection-rule-with-embedded-ingestion-endpoints
#>
@JustinGrote
JustinGrote / Arcify.ps1
Last active April 24, 2024 16:16
Better Azure Arc Agent Onboarding Script
#Requires -Version 5.1 -RunAsAdministrator
using namespace System.IO
using namespace System.Net
#NOTE: The core code flow in is in the Main region at the bottom of the script.
<#
.SYNOPSIS
This is a script that unifies the Azure Arc and AKS Edge Essentials installation process. You can use this script to connect a server to Azure Arc as well as AKS Edge Essentials.
#>
@JustinGrote
JustinGrote / ScreenConnect.psm1
Last active January 3, 2025 15:29
ScreenConnect Client
#requires -version 7
using namespace Microsoft.PowerShell.Commands
using namespace System.Text
$ErrorActionPreference = 'Stop'
#Suppress useless IRM Verbose output
$PSDefaultParameterValues['Invoke-RestMethod:Verbose'] = $false
$PSDefaultParameterValues['Invoke-WebRequest:Verbose'] = $false
$DebugPreference = 'SilentlyContinue'
@JustinGrote
JustinGrote / PowerAltoPlus.psm1
Last active February 26, 2024 17:16
An extension of the PowerAlto module to enable running "ssh" commands via RPC-XML thru panorama to managed devices without having direct line of sight to the managed firewalls. A sample report dump of the Arp/Route/Interface/VPN is included
#requires -module PowerAlto, ImportExcel
$ErrorActionPreference = 'Stop'
if (-not $MacVendorCache) {
Write-Warning 'MacVendorCache not found, downloading from maclookup.app. This is common on the first run.'
$SCRIPT:MacVendorCache = @{}
foreach ($entry in $(ConvertFrom-Csv (Invoke-RestMethod 'https://maclookup.app/downloads/csv-database/get-db'))) {
$MacVendorCache[$entry.'Mac Prefix'] = $entry.'Vendor Name'
}
}
@JustinGrote
JustinGrote / Get-OpenApiDefinition.ps1
Created February 15, 2024 02:40
Download multiple parts of an OpenAPI spec
using namespace System.Collections.Generic
function Get-OpenApiDefinition {
<#
Fetches the OpenAPI definition from the specified URI and for every ref, downloads the relative file to the destination folder. Currently only works with relative refs
#>
param (
#The source
[Parameter(Mandatory)]
[Uri]$Uri,
@JustinGrote
JustinGrote / eyecancer.txt
Created January 31, 2024 05:36
Dumpling Week 2024 Data
var _pageData = "[[1,null,null,null,null,null,null,null,null,null,\"at\",\"AAX3J7BhCRC7IVYMba1r7wDXuj920s9Frw:1706679164531\",\"10080040042915956860\",1706679164532,\"0\",\"en\",false,[null,null,\"[email protected]\",\"https://lh4.googleusercontent.com/-R4mL1JYgKEs/AAAAAAAAAAI/AAAAAAAAAAA/-74UcaDbnzk/s32-c/photo.jpg\",\"https://plus.google.com/100005784601014694175/about\",\"Justin Grote\",\"https://lh4.googleusercontent.com/-R4mL1JYgKEs/AAAAAAAAAAI/AAAAAAAAAAA/-74UcaDbnzk/s64-c/photo.jpg\",\"https://lh3.googleusercontent.com/c5dqxl-2uHZ82ah9p7yxrVF1ZssrJNSV_15Nu0TUZwzCWqmtoLxCUJgEzLGtxsrJ6-v6R6rKU_-FYm881TTiMCJ_\\u003ds1600\"],\"https://www.google.com/maps/d/viewer?mid\\u003d1ydRiXegNnQcXEw-KLmsldBty7_xmedM\",\"https://www.google.com/maps/d/embed?mid\\u003d1ydRiXegNnQcXEw-KLmsldBty7_xmedM\\u0026ehbc\\u003d2E312F\",\"https://www.google.com/maps/d/edit?mid\\u003d1ydRiXegNnQcXEw-KLmsldBty7_xmedM\",\"https://www.google.com/maps/d/thumbnail?mid\\u003d1ydRiXegNnQcXEw-KLmsldBty7_xmedM\",null,null,true,\"https:/
@JustinGrote
JustinGrote / ConvertTo-Markdown.ps1
Created January 27, 2024 00:25
Convert PowerShell Objects to Markdown Display by screen-scraping Format-Table
using namespace System.Collections.Generic
using namespace Microsoft.PowerShell.Commands.Internal.Format
#Inspired by: https://gist.github.com/aaroncalderon/09a2833831c0f3a3bb57fe2224963942
<#
.Synopsis
Converts PowerShell Objects or Format-Table output to Markdown
#>
Function ConvertTo-Markdown {
[CmdletBinding()]