Debugging bash scripts

If you want to see the output of a bash script as it's being executed you can use set -x to enable debugging and set +x to turn it off again. This is particularly handy when you're trying to debug why variables aren't being…

Modify Class Templates

When you create a new class in Visual Studio, it gets created as internal class <classname>. Most of the time you'll want it created as a public class. While it's a minor change, if you're sick of having to change it every…

When did a server boot or restart

If you want to find when a server last rebooted, or a short history of reboots to establish a pattern or cause of a problem you can use the following powershell command. Get-EventLog -LogName System -After $(Get-Date).AddDays(-1) ` | Where-Object { $_.EventId -in (6008,6009,6005,6006) } This searches the System…

Checking for open ports

Sometimes you can't access a website, or remote service and want to check whether it's a network problem or something at the server end. Nmap is the most common way of doing that and is usually one of the first things installed in Linux. If not…

Monitor a Process in PowerShell

Sometimes you have a process, such as an Exchange Mailbox Export, which has a progress counter that you want to keep an eye on. This is a simple way to keep an eye on it so you don't have to constantly hit up, then enter to get an…