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…

Set Hyper-V Boot Order with PowerShell

By default new VMs are created with a network adapter as the primary boot device. If you want to boot from DVD image, then HDD, as I do most of the time. It's a bit cumbersome, but you can do that in bulk with: Get-VM | Get-VMFirmware | ForEach-Object { $boot…

How to Disable Secure Boot in Hyper-V with PowerShell

If you're creating Linux VMs in Hyper-V, you need to disable SecureBoot. You can do this in bulk. Get-VM | Set-VMFirmware -EnableSecureBoot Off If you want to do that for a specific VM you can use the -VMName flag. Set-VMFirmware -VMName <VMName> -EnableSecureBoot Off…