This blog provides an example of how to use PowerShell to block IP addresses (Fail2ban) from gaining access to a Windows server. Use PowerShell to Block IP Addresses (Fail2ban) Web can servers constantly get brute force attacks from unscrupulous people … Continue reading →
Here we provide an example of how we can use PowerShell to find the user profile last use time. The reason we were doing this was to purge any local profiles that hadn’t been used for, say, 4 weeks or … Continue reading →
Here we describe how to generate a PDF using PowerShell and Microsoft Edge. It’s been a while since i knocked this script up, but i recall having issues printing to the PDF printer using System.Drawing.Printing.PrintDocument. It required creating a handler … Continue reading →
There are a couple of different ways we can use PowerShell to read remote registry. The first method requires that the RemoteRegistry service is started, otherwise you will see an error message similar to: Exception calling “OpenRemoteBaseKey” with “2” argument(s): … Continue reading →
This is a simple PowerShell script that enables you to find Group Policy Objects (GPO) modified in the last X days. Unfortunately it doesn’t tell us who modified the GPO or what specific configuration was changed, but it’s a start! … Continue reading →
Standard message box popups using Wscript.Shell look boring, ugly, a bit 1990s and aren’t very flexible. So we’ve created our own PowerShell GUI message box popup. **UPDATED** – Now supports multiline messages that are too long for the default text … Continue reading →
Sometimes when I’m analysing data, we need to use PowerShell to import data from Microsoft Excel. We generally have two quick options to do this. Let’s take this sample data: Save As a Comma Delimited CSV We can save our … Continue reading →
I’ve recently come across an issue where PowerShell ISE crashes when loading. Bizarrely, it only failed to launch when using ‘RunAs’ to elevate it as a different (admin) user. It worked fine if i ran it as the logged in … Continue reading →
Here’s a useful snippet of code allowing us to create a registry value and path in one line using PowerShell. In this example, we’re trying to write a registry name called “AlkaneName” with a value of “AlkaneValue” to a registry … Continue reading →
I was recently getting access denied when calling Remove-Item to delete a directory, even though the directory permissions were fine and I could delete the folder manually! An example piece of code was simply: Remove-Item -LiteralPath “C:\Users\AlkaneUser\Desktop\Alkane” -Force -Recurse Yes, … Continue reading →