Skip to content

Instantly share code, notes, and snippets.

View JustinGrote's full-sized avatar

Justin Grote JustinGrote

View GitHub Profile
@JustinGrote
JustinGrote / AksEdgeEssentialsOnboard.ps1
Last active April 18, 2024 22:35
Better Azure Arc Agent Onboarding Script
<#
QuickStart script for setting up Azure for AKS Edge Essentials and deploying the same on the Windows device
#>
param(
[Parameter(Mandatory)]
[String] $AideUserConfigFilePath,
[Parameter(Mandatory)]
[string] $AksEdgeConfigFilePath,
[string] $Tag
@JustinGrote
JustinGrote / ScreenConnect.psm1
Last active February 28, 2024 07:50
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,\"justingrote@gmail.com\",\"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()]
@JustinGrote
JustinGrote / Update-HelpFast.ps1
Last active March 9, 2024 14:37
Update Help More Quickly using ThreadJob
#Requires -module ThreadJob
param(
#Filter modules to update by name, otherwise will update all modules
[string[]]$Name = @(),
[ValidateSet('AllUsers', 'CurrentUser')]
$Scope = 'CurrentUser',
$ThrottleLimit = 30
)
try {
@JustinGrote
JustinGrote / NinjaOne.cs
Created January 17, 2024 20:07
NinjaOne AutoGen Module using nswag
This file has been truncated, but you can view the full file.
//----------------------
// <auto-generated>
// Generated using the NSwag toolchain v13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org)
// </auto-generated>
//----------------------
#nullable enable
#pragma warning disable 108 // Disable "CS0108 '{derivedDto}.ToJson()' hides inherited member '{dtoBase}.ToJson()'. Use the new keyword if hiding was intended."
#pragma warning disable 114 // Disable "CS0114 '{derivedDto}.RaisePropertyChanged(String)' hides inherited member 'dtoBase.RaisePropertyChanged(String)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword."
@JustinGrote
JustinGrote / EquatableAndHashSetDemo.ps1
Last active December 21, 2023 20:49
Equatable and HashSets Demo
using namespace System.Collections.Generic
class Pet {
[string]$Name
[string]$Type
hidden [int] GetHashCode() {
$uniqueString = $this.Name + $this.Type
return $uniqueString.GetHashCode()
}
@JustinGrote
JustinGrote / GetAllPSGalleryPackages.ps1
Last active December 12, 2023 17:23
Get All Packages from the PowerShell Gallery
using namespace System.Management.Automation
using namespace System.Collections.Generic
[List[Job2]]$jobs = @()
[List[Object]]$Result = @()
$baseUri = 'https://www.powershellgallery.com/api/v2/Packages?$skip='
$maxPackages = 309000
for ($i = 0; $i -lt $maxPackages; $i += 100) {