Skip to content

Instantly share code, notes, and snippets.

View asheroto's full-sized avatar
😎

asheroto

😎
View GitHub Profile
@asheroto
asheroto / Extract-IP-Addresses-and-Count.ps1
Last active July 7, 2024 00:40
PowerShell script to extract IP addressees from a file and count the number of occurrences of each IP address.
function ExtractIPaddressesAndCount {
[CmdletBinding()]
param(
[Parameter(Position = 0, mandatory = $true)]
[string] $InputFile,
[Parameter(Position = 1, mandatory = $true)]
[string] $OutputFile
)
If (-Not(Test-Path -Path $InputFile -PathType Leaf)) {
@asheroto
asheroto / TacticalRMM One-Line Agent Deployer.md
Last active June 18, 2024 18:36
Creates a one-line command to download and install a TacticalRMM agent.

TacticalRMM One-Line Agent Deployer

Creates a one-line command to download and install a TacticalRMM agent. It works by creating a script and converting it into a base64 command. It then copies the command to your clipboard, so you can paste it / save it as needed.

It also adds a temporary exclusion in Windows Defender to ensure the agent installs without any false positives. The exclusion is removed after the agent download is deleted.

Example

example

@asheroto
asheroto / CustomProtocol.ps1
Created December 24, 2021 03:53
PowerShell script to configure a custom protocol in Windows.
# Custom Protocol
#
# Description:
# Creates a new custom protocol in Windows
#
# Note:
# Be sure to change the variables before running!
#
# Author: asheroto
# Author GitHub: https://github.com/asheroto
@asheroto
asheroto / Remove-Duplicate-Entries-From-Path-Variables.ps1
Last active November 25, 2024 01:48
PowerShell script to remove duplicate entries from PATH environmental variables in Windows.
Clear-Host;
# Begin
Write-Output "⏲️⏲️⏲️ Starting ⏲️⏲️⏲️"
Write-Output ("-" * 50)
Write-Output ""
# System PATH
Write-Output "🖥️ Checking System PATH 🖥️"
$TempMachinePath = [System.Environment]::GetEnvironmentVariable("Path", "Machine");
@asheroto
asheroto / Disable Hyperlinks for Specific Domain in Outlook.md
Last active March 7, 2022 05:11
This is an Outlook macro that will disable hyperlinks for a specific sender domain. The example disables hyperlinks for e-mails from ebay.com, but of course you can change it to anything you'd like.
@asheroto
asheroto / RunWithPowerShell7.reg
Last active April 6, 2022 12:43
Add "Run with PowerShell 7" to the context menu of PS1 scripts.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\SystemFileAssociations\.ps1]
[HKEY_CLASSES_ROOT\SystemFileAssociations\.ps1\Shell]
[HKEY_CLASSES_ROOT\SystemFileAssociations\.ps1\Shell\Edit]
"NoSmartScreen"=""
[HKEY_CLASSES_ROOT\SystemFileAssociations\.ps1\Shell\Edit\Command]
@asheroto
asheroto / RenameComputerToServiceTag.ps1
Last active April 19, 2022 10:16
Rename a Dell computer to the computer's service tag
#Requires -RunAsAdministrator
# Get Dell Service Tag
# If empty or serial number is greater than 7 characters, exit script
$serial = (get-wmiobject win32_systemenclosure | select serialnumber).serialnumber
if ($serial.length -eq 0 -or $serial.length -gt 7) { Write-Output "Service tag not detected! Failed rename."; exit; }
Write-Output "Dell Service Tag: $serial"
Write-Output ""
# Rename
@asheroto
asheroto / Sort-Custom.md
Last active March 16, 2023 13:23
Sort/alphabetize a custom PowerShell object by property name such as when using a command line Get-Host.

Sort-Custom

Sort/alphabetize a custom PowerShell object by property name such as when using a command line Get-Host.

Example

Before:

PS C:\> Get-Host

Name : ConsoleHost

@asheroto
asheroto / Check-For-PowerShell-Invoke-Command.ps1
Created June 30, 2022 01:29
PowerShell script to check for the presence of Invoke-Command, such as that ran by Empire and other fileless malware.
$result = Get-WinEvent -FilterHashTable @{LogName="Microsoft-Windows-Sysmon/Operational"; StartTime=(get-date).AddHours(-1); EndTime=(Get-Date); ID=1}| ?{$_.Message -match "Invoke-Command" }
if($result.Count -gt 0) {
# PUT YOUR SCRIPT ACTION HERE WHEN DETECTED IN THE LAST HOUR
}
@asheroto
asheroto / 1-Windows-Setup-TPM-Bypass-Internet-Bypass.md
Last active April 14, 2025 19:41
Windows setup answer file working on Windows 11. Skips OOBE (EULA, networking) and pretty much everything else during normal setup.

Windows 10/11 Setup Answer File + TPM Bypass + CPU requirement + storage requirement + Internet requirement bypass + disable BitLocker automatic encryption

This is a Windows setup answer file working on Windows 10 and 11.

What it does:

  • Skips OOBE (EULA, networking) and pretty much everything else during normal setup
  • Sets Keyboard + Language to English (US)
  • Set timezone to Central Standard Time
  • Creates user "User" with password of "password"