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.

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.


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

I need to put this one in PowerShell but here it is in batch form for now. It wouldn't be hard to do. It uses OSQL.exe to create .bak files of the SQL databases then deletes any files older than 30 days. Instructions are in the batch 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: Schedule a Sonicwall Restart

I'll admit, I'm really not too proud of this one, let alone having to write it. I didn't want to do this, but the engineers over at Sonicwall decided to exclude use of a scheduled restart some of their firmware. Since the ones I've used tend to have lots of problems as the uptime gets around ~100 days, I decided that waiting until they crash is not an option.

So, I wrote this script that will manually log in and perform the proper keystrokes with PuTTY to restart them. You'll need PuTTY in your system32 folder and a computer that can remain logged into a desktop session when the task is scheduled to run since it won't work unless the user is logged in. Use the password encryption script above to create the router password for this.

Need a better example of why you should stick with Cisco equipment? Here you go.


PowerShell: Wordlock Decoder

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 a four dial lock, but you can easily edit it to work with a five dial lock.

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.


More to come!

Go Back > (index page)