Skip to content

Instantly share code, notes, and snippets.

View Jaykul's full-sized avatar
😀
Learning

Joel Bennett Jaykul

😀
Learning
View GitHub Profile
@JustinGrote
JustinGrote / ProfileBenchmark.ps1
Last active March 20, 2025 12:47
Benchmark your profile using Profiler
#region ProfileBenchmark
if ($ENV:PWSH_PROFILE_BENCHMARK -and -not $ENV:PWSH_PROFILE_BENCHMARK_RUN) {
Write-Host -Fore Magenta '👷‍♂️ BENCHMARKING PROFILE SETUP'
Invoke-WebRequest bit.ly/modulefast | Invoke-Expression
Install-ModuleFast profiler
# This will ensure we don't end up in a setup loop
Write-Host -Fore Magenta '📈 BENCHMARKING PROFILE'
$profilePath = $MyInvocation.MyCommand.Source
$profileTrace = Trace-Script -ExportPath TEMP:/pwsh-profile -ScriptBlock {
@halr9000
halr9000 / README.md
Last active March 12, 2025 21:15
Ollama AI / LLM Utility Functions for PowerShell

Utility functions for use with Ollama in PowerShell

Want to run AI Large Language Models (LLM) locally? One great way is with Ollama, which can host many state of the art LLMs. Ollama is a command-line utility (CLI) that can be used to download and manage the model files (which are often multiple GB), perform the actual LLM inference, and provide a REST API to expose the LLMs to other applications on your system. Ollama is quick to install.

This repo contains functions for PowerShell. You can dot source this file to make the functions available in your current PowerShell session, or add it to your profile to make them available for every session. This was developed on Windows, but should work as-is on a Linux or [MacOS]

@jborean93
jborean93 / New-ScheduledTaskSession.ps1
Last active April 7, 2025 18:56
Creates a PSSession that targets a scheduled task process
# Copyright: (c) 2024, Jordan Borean (@jborean93) <[email protected]>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
Function New-ScheduledTaskSession {
<#
.SYNOPSIS
Creates a PSSession for a process running as a scheduled task.
.DESCRIPTION
Creates a PSSession that can be used to run code inside a scheduled task
@jborean93
jborean93 / Get-SqlServerTlsCertificate.ps1
Last active May 20, 2024 19:27
Gets the certificate used by a MS SQL Server
# Copyright: (c) 2023, Jordan Borean (@jborean93) <[email protected]>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
Function Get-SqlServerTlsCertificate {
<#
.SYNOPSIS
Gets the MS SQL X509 Certificate.
.DESCRIPTION
Gets the X509 Certificate that is being used by a remote MS SQL Server.
using namespace System
using namespace System.Linq
using namespace System.Collections
using namespace System.Collections.Generic
using namespace System.Management.Automation
using namespace System.Management.Automation.Language
using namespace System.Reflection
# Hey person reading this! Don't do this, alright? You'll have a bad time. ty
@jborean93
jborean93 / Trace-TlsHandshake.ps1
Last active December 7, 2023 14:49
Debug TLS Handshakes using .NET
# Copyright: (c) 2022, Jordan Borean (@jborean93) <[email protected]>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
Function Trace-TlsHandshake {
<#
.SYNOPSIS
TLS Handshake Diagnostics.
.DESCRIPTION
Performs a TLS handshake and returns diagnostic information about that
@jborean93
jborean93 / Get-ItemMetadata.ps1
Created February 1, 2021 04:12
Get Windows Explorer metadata properties
# Copyright: (c) 2021, Jordan Borean (@jborean93) <[email protected]>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
Update-TypeData -TypeName 'Shell.Metadata' -DefaultDisplayPropertySet 'Name', 'Item type' -Force
Function Get-ItemMetadata {
<#
.SYNOPSIS
Get shell explorer metadata for a file.
class ConstrainedVariableInterpolation : System.Management.Automation.Language.AstVisitor {
hidden [Hashtable] $Property
[System.Collections.Generic.List[PSCustomObject]] $Result
hidden [System.Management.Automation.Language.Ast] $Ast
[System.Management.Automation.Language.AstVisitAction] CheckForPostAction([System.Management.Automation.Language.Ast] $ast, [System.Management.Automation.Language.AstVisitAction] $action)
{
throw 'CheckForPostAction not supported'
}
using namespace System.Management.Automation
using namespace System.Collections.Generic
class ArgumentCompleterBase : IArgumentCompleter {
hidden [List[CompletionResult]] $Results = [List[CompletionResult]]::new()
[string] $WordToComplete
[Language.CommandAst] $commandAst
# override in child class
[void] AddCompletionsFor([string] $commandName, [string] $parameterName, [Collections.IDictionary] $fakeBoundParameters) {}
@Agazoth
Agazoth / Get-MonitorInfo.ps1
Last active April 15, 2023 23:24
Iron Scripter 2018 Puzzle 1 for multiple machines
function Get-MonitorInfo {
[CmdletBinding()]
param ([string[]]$ComputerNames = $env:computername)
foreach ($ComputerName in $ComputerNames){
try {
$CimSession = New-CimSession -ComputerName $ComputerName
} catch {
Write-Warning "Please make sure PSRemoting is enabled on $ComputerName"
Continue
}