You are here: cyanghost > Scripts


Here are some downloadable scripts I wrote for various uses. I hope you find them beneficial. Please run them in an isolated test environment before rolling them out to your production servers. Please note that I consider myself pretty green at this, so if you find a way to make them better, I'd be happy to hear from you.

As a safety precaution, Windows may not allow some scripts to run by default. In an elevated PowerShell session, you may need to type Set-ExecutionPolicy Unrestricted and/or Set-ExecutionPolicy Unrestricted -Scope CurrentUser to run some of these scripts. Before doing that, please read more about that here and understand the risks involved with doing so.

PowerShell: Create Encrypted Password for PowerShell

One line, but I'm putting it here anyway for future reference. If you need to put a password in a PS script, you can use this to encrypt the password. Places Password.txt in your current working directory. Instructions for use are commented out in the script.


PowerShell: Backup Microsoft SQL Server Databases and delete them after 30 days

This PowerShell script uses the sqlcmd utility to create .bak files of the SQL databases then deletes any files older than 30 days. Instructions are commented in the file and are pretty easy to follow.


PowerShell: Monitor Ping Status w/ Email Alert

This one will send a ping out to any specified IPs and will notify you via email if one of the hosts don't respond. Useful for monitoring critical routers, switches, servers, etc. in an environment.


PowerShell: Remote into Remote Desktop Session

Allows you to remotely view and control a user's Remote Desktop Session. The server(s) must be running Remote Desktop Services for it to work.


PowerShell: Wordlock Decoder

DISCLAIMER: Please do not use this for malicious intent. I made this simply for fun because I was challenged to crack someone else's lock with their permission. Please make sure you do the same as stealing just isn't a nice thing to do and there's far too much of it as it is.

Ever wanted to manually brute force a word lock? I was challenged by someone to do so once, little did they know I could use PowerShell to list all possible combinations. So, that's exactly what this script will do. Imagine their surprise when I gave it back to them, unlocked.

This will work with 4-dial and 5-dial locks.

Instructions: Download the wordlock-decoder.ps1 file below (right click it and then click Save link as...) to your computer. Navigate to it, right click on the file and then click Run with PowerShell. From there, you can follow the onscreen instructions.


For simplicity, I also compiled an exe file of the Wordlock Decoder. You may download it here.

If Windows Defender SmartScreen states that it's an unrecognized app, you may click More info and then Run anyway to bypass the warning. Otherwise, you will need to use the PowerShell method above.

PowerShell: Add Computer to the Domain

This PowerShell script will join a computer to a domain.


PowerShell: Migrate User Profile Contents to Network Folder

This PowerShell script will migrate the local user's Desktop, Documents, Downloads and Favorites folder to a network drive.


PowerShell: Copy new INI file for ClinicTracker EHR program

This PowerShell script will copy a new ClinicTrackerOptions.ini file to the specified user's directory onto multiple Remote Desktop servers (using a UNC path) if you're using a connection broker. You can also modify this for your own use by simply modifying the server list and the file name.


PowerShell: Generate an HTML file list of files in a directory

This script will simply output a list of all files in a folder and output the list to an HTML file. This is based of a similar function that the now defunct Winamp program offered. It's pretty basic right now but I plan to add more functionality to it later on.

You may run it with the "-help" parameter for examples and explanations.


PowerShell: PC Inventory to CSV

Here's one that will gather the Date, IP, Serial Number, Model, CPU, RAM, Storage, OS and OS Build of a Windows computer and will export it to a CSV file.

I know there are at least a million inventory scripts out there but I wrote this one because I couldn't find one that just worked out of the box and gathered the info I needed.

This is designed to be run as a login script/scheduled task. First, it will check the CSV file to see if the computer's hostname already exists. If it does, the script will end. If it's not, it will gather the information with WMI and will simply export it to the CSV file. You will just need to make sure the CSV file is publicly accessible and that everyone has Write permissions allowed.

Please note that this script does not inventory monitors. For that, I recommend the script located here.


More to come!

Go Back > (index page)