Skip to content

Instantly share code, notes, and snippets.

@romero126
romero126 / CommandLookup_ApplockerSignedScriptRestrictions.ps1
Last active June 4, 2025 19:36
Command LookupAccelerator (PreCommandLookupAction)
if ($ExecutionContext.SessionState.LanguageMode -ne 'FullLanguage') {
throw "This script requires `$ExecutionContext.SessionState.LanguageMode to be FullLanguageMode but got '$($ExecutionContext.SessionState.LanguageMode )'"
}
$global:PSPreCommandLookupAction += @{
Name = "ApplockerSignedScriptRestrictions"
Description = "This will bypass Applocker's Signed Script Restrictions by loading the script directly into memory as if it was dot sourced"
Filter = { $command -like "*.ps1" }
Priority = -1
StopSearch = $true
@romero126
romero126 / Get-PSBoundParameters.ps1
Last active May 28, 2025 06:01
Get-PSBoundParameters
function Get-PSBoundParameters {
<#
.SYNOPSIS
Get-PSBoundParameters
.DESCRIPTION
Get the bound parameters of the current command
.PARAMETER ParameterSetName
Filter the bound parameters by the specified ParameterSetName
class FrameBuffer : IDisposable {
[System.Int32] $Width
[System.Int32] $Height
[System.Boolean] $Disposed
hidden [System.Int32[]] $buffer
hidden [System.Runtime.InteropServices.GCHandle] $bufferHandle
hidden [System.Drawing.Image] $bitmap
FrameBuffer([System.Int32]$w, [System.Int32]$h) {
@romero126
romero126 / RemoteDesktopAppInstaller.ps1
Last active July 24, 2024 17:38
Invoke-RemoteDesktopAppInstaller
function Invoke-RemoteDesktopAppInstaller
{
[CmdletBinding()]
param(
[Parameter(Mandatory)]
[System.Management.Automation.Runspaces.PSSession] $Session
)
$installShortcutDirectory = "$($env:USERPROFILE)\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Remote App\"
$installResourceDirectory = "$($env:USERPROFILE)\AppData\Roaming\Microsoft\Workspaces\"
@romero126
romero126 / readme.md
Last active May 28, 2025 05:59
ConvertFrom-CidrToIPvNetwork
PS> ConvertFrom-CidrToIPvNetwork -vlsm "10.202.84.0/25"

IpAddress        : 10.202.84.0
AddressFamily    : InterNetwork
Prefix           : 25
Network          : 10.202.84.0
SubnetMask       : 255.255.255.128
BroadcastAddress : 255.255.255.255
@romero126
romero126 / Examples.md
Last active May 28, 2025 05:53
Monitor-Object

Example Expression

image

$splat = @{
    Title           = 'Monitor-Workflow';
    PropertyKey     = 'Value';
    Property        = 'Value', 'Iteration';
    InputPattern    = "(\d+)";
@romero126
romero126 / Import-ModuleManually
Created July 19, 2023 18:20
Import-Module Manually
function Import-ModuleManually {
param(
[Parameter(Mandatory=$true)]
[string]$Module,
[Parameter(Mandatory=$false)]
[switch]$Force
)
$moduleExists = Get-Module -Name $Module -All
function Invoke-ForEachObjectWithProgress {
[CmdletBinding()]
[Alias("ForEachWP")]
param(
[Parameter(Mandatory, ValueFromPipeline)]
[object] $InputObject,
[Parameter()]
[string] $Activity = "Processing items",
@romero126
romero126 / Code.ps1
Created September 30, 2022 01:28
NamedPipelines
function New-NamedPipeServer {
param(
[Parameter(Mandatory)]
[string] $PipeName,
[Parameter(Mandatory)]
[scriptblock] $ScriptBlock
)
Start-Job -Name $PipeName -ScriptBlock {
@romero126
romero126 / text.md
Created August 6, 2022 09:46
Scratch
[
{
"S": [
{
"N": "G0",
"T": 1,
"DN": "D0"
},
{
"N": "G1",