Skip to content

Instantly share code, notes, and snippets.

@jborean93
jborean93 / AsyncPSCmdlet-Examples.cs
Created July 1, 2026 05:41
A POC to illustrate how a binary cmdlet could change how cmdlets are defined and written in C#
using System;
using System.Management.Automation;
using System.Threading;
using System.Threading.Tasks;
using Jborean.PwshAsync.Generators;
namespace SampleCmdlet.Examples;
[AsyncPSCmdlet(VerbsDiagnostic.Test, "SimpleNoOutput")]
public partial class SimpleCmdletNoOutput
@jborean93
jborean93 / SMBIOS.ps1
Created May 18, 2026 03:36
Get and parse SMBIOS data using PowerShell
# Copyright: (c) 2026, Jordan Borean (@jborean93) <jborean93@gmail.com>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
function Get-RawSmbiosData {
[OutputType([byte[]])]
[CmdletBinding()]
param ()
Add-Type -TypeDefinition @'
using System;
@jborean93
jborean93 / credssp_server.py
Created March 18, 2026 10:32
CredSSP Test Server
#!/usr/bin/env -S uv run --script
# Copyright: (c) 2026, Jordan Borean (@jborean93) <jborean93@gmail.com>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
# /// script
# dependencies = [
# "gssapi",
# "krb5",
# "cryptography",
@jborean93
jborean93 / Get-LogonSessionData.ps1
Last active October 16, 2025 21:21
Gets the LSA logon session data
# Copyright: (c) 2025, Jordan Borean (@jborean93) <jborean93@gmail.com>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
# Added GetLastErrorRecord
#Requires -Module @{ ModuleName = 'Ctypes'; ModuleVersion = '0.3.0' }
using namespace System.ComponentModel
using namespace System.Management.Automation
using namespace System.Runtime.InteropServices
using namespace System.Security.Principal
@jborean93
jborean93 / Add-DebuggableType.ps1
Last active August 20, 2025 12:08
Compiles C# code that can be debugged through a .NET Debugger
# Copyright: (c) 2025, Jordan Borean (@jborean93) <jborean93@gmail.com>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
using namespace Microsoft.CodeAnalysis
using namespace Microsoft.CodeAnalysis.CSharp
using namespace Microsoft.CodeAnalysis.Emit
using namespace Microsoft.CodeAnalysis.Text
using namespace Microsoft.PowerShell.Commands
using namespace System.Collections.Generic
using namespace System.IO
@jborean93
jborean93 / Disable-CertTrustCallback.ps1
Created July 1, 2025 21:40
Various ways of ignoring self signed certificates in Windows PowerShell 5.1
# Copyright: (c) 2025, Jordan Borean (@jborean93) <jborean93@gmail.com>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
using namespace System.Net
using namespace System.Net.Security
Function Disable-CertificateTrust {
[CmdletBinding()]
param ()
@jborean93
jborean93 / Import-PemEncodedRsaKey.ps1
Created June 30, 2025 20:21
Imports a PEM encoded RSA private key in PowerShell, supports PowerShell 5.1
# Copyright: (c) 2025, Jordan Borean (@jborean93) <jborean93@gmail.com>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
using namespace System.IO
using namespace System.Management.Automation
using namespace System.Net
using namespace System.Security.Cryptography
Function Import-PemEncodedRsaKey {
<#
@jborean93
jborean93 / Get-CertificateTemplateInformation.ps1
Last active October 3, 2025 13:10
Gets the Certificate Template Information from an X509Certificate2 object
# Copyright: (c) 2025, Jordan Borean (@jborean93) <jborean93@gmail.com>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
using namespace System.DirectoryServices
using namespace System.Formats.Asn1
using namespace System.Management.Automation
using namespace System.Numerics
using namespace System.Security.Cryptography.X509Certificates
Function Get-CertificateTemplateInformation {
@jborean93
jborean93 / Get-LapsADUpdateTime.ps1
Last active March 25, 2025 07:39
Gets the LAPS UpdateTime attribute for AD computer accounts
# Copyright: (c) 2025, Jordan Borean (@jborean93) <jborean93@gmail.com>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
Function Get-LapsADUpdateTime {
<#
.SYNOPSIS
Gets the Windows LAPS Update Time.
.DESCRIPTION
Gets the Windows LAPS Update Time for the specified computer account. The output value is a DateTime object representing the update time as a UTC date time.
@jborean93
jborean93 / New-ScheduledTaskTrigger.ps1
Created March 21, 2025 05:38
PowerShell script to create a state change, idle, or event trigger
# Copyright: (c) 2025, Jordan Borean (@jborean93) <jborean93@gmail.com>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
Function New-CommonTaskTriggerProp {
[OutputType([hashtable])]
[CmdletBinding()]
param (
[Parameter()]
[switch]
$Disable,