Helper Commands
Windows
Uninstall Windows Updates:
Run the following (update the list to contain valid KB numbers) to uninstall updates on a local system:
@ECHO OFF
SET list=3133977 3137061 3138612 3138901 3139923
for %%a in (%list%) do (
%windir%\syswow64\wusa.exe /uninstall /kb:%%a /quiet /norestart /log
)Run-As Session
runas /user:burmat.local\nathan /netonly powershellGet Remote Host Windows Updates
Run the following (update the hosts list with valid hostnames) to get .CSV output of updates on remote systems:
@echo off
SET dFormat=_%date:~-4,4%%date:~-10,2%%date:~-7,2%
SET sCMDparams=qfe get Caption, Description, HotfixID, InstallDate, InstalledBy /format:csv
SET hosts=HOSTNAME1 HOSTNAME2
ECHO %dFormat%
ECHO .
FOR %%f in (%hosts%) DO (
ECHO Processing %%f
ECHO Output file: %%f_%dFormat%.csv
wmic /NODE:%%f /output:%%f_%dFormat%.csv %sCMDparams%
)
ECHO .
ECHO Remember to delete the first blank line
ECHO .
ECHO .
ECHO Finished.
ECHO .Send a Message to Remote Computer
Or you can launch it to all users on a given computer if you don't know the username. Enable verbose mode (/V) and wait for a callback (/W) to get a callback when the user closes it: msg * /V /W /SERVER:WKST-123 This is a test message
Restart Remote Machine (With Warning)
This script is better kept out in a public place and called with the a remote command utility to loop through a list of hostnames. You can just replace the %1 to hardcode a host if you want though.
Windows Firewall
Enable Network Discovery
Enable File and Printer Settings
Allow All Inbound
Allow All Output
PowerShell
Remotely Log User Out
Creating an SMB Share
Sending an Email
Leveraging an M365 mail relay:
Retrieve Exchange Version
Users that have Reversible Encryption Enabled
Base64 Encoding PowerShell
Renaming Files to MD5 Value
Getting PowerShell Versioning
Listing Recycle Bin Contents
Creating a Bunch of Domain Users
Keep a Computer Awake
Enumerate Child Processes
The following will show you the children executed under the parent process ID provided
DNS Reverse Lookup for Hostname List
AES Encrypt & Decrypt Text
Encrypting
Decrypting
Loading PowerShell ActiveDirectory Module Manually
No administrative access is required.
PowerShell Terminal Profile
In the works, goes in your ~/WindowsPowerShell directory.
Bash
SMTP
Comment / Uncomment Lines
When you need to comment out or uncomment out a line, sed makes it pretty easy. Just change the word pattern to something identifiable:
Loops
Reading a File
Loop an Array
Resolving Hostnames
Rudementary Port Scanner
Network Time Protocol (NTP)
Because setting the clock is fucking painful:
NTP Mode 6 Check:
ntpq -c rv <IP>
If there is output, it is susceptible to this: https://scan.shadowserver.org/ntpversion/
DNS Host Discovery
Installing Ruby
Certificate Fingerprint
Last updated