Tips and tricks of the trade

Recently we had an issue where one of our remote sites had frequent power failures.

Upon closer investigation it was found that the 3kVa UPS was overloaded (with 3.4kVa) instead of a healthy 2.2kVa.

This caused the servers to yoyo down and up, which’s Not A Good Thing.

On this site we had a cluster setup (two blades, server2016 and a 2k16 NAS). One of the iSCSI virtual drives got corrupted (vhdx virtual disk)

The easiest (and quickest) way out of this mess was to start up diskpart, attach the corrupted VHDX image and run CHKDSK on it, and we were home free.

Steps :

  1. Create a backup of the affected VHDX file.
  2. Open an elevated command prompt.
  3. Type in diskpart and press enter.
  4. Before mounting or unmounting virtual disk, you need to specify the location of your vhd/vhdx file. Type the following command and hit Enter.
    select vdisk file=“[location of vhd]”
  5. Once that is done, type in attach vdisk
    The disk should show up in Drive Manager or Windows Explorer. You can then run a regular chkdsk /f on it.
    mount-vhd-from-command-line

To unmount it, either right-click on it and eject it, or type in detach vdisk and press Enter.

You can also use PowerShell to do the same job, but you’ll need Hyper-V installed for this to work (which I could not do as it was on the NAS and the NAS does not need Hyper-V installed) :

  1. Open PowerShell as Administrator.
  2. When the command-line window opens, you can run the Mount-VHD cmdlet to mount your vhd/vhdx file.
    Mount-VHD –Path “[location of vhd]”
    To unmount your virtual hard disk, just run the Dismount-VHD cmdlet instead.
    Dismount-VHD –Path “[location of vhd]”

If you get the error message like “Mount-VHD is not recognized as the name of a cmdlet“, you need to add a feature named “Hyper-V Module for Windows PowerShell” to your server.

Gratuitiously copied from 2 Ways to Mount and Unmount VHD / VHDX from Command Line | Password Recovery without permission.

4 Likes

Some user managed to flip the screen upside down?
Ctrl+arrow down should return it to normal configuration.
Then disable the hotkeys in the video control panel (intel/nvidia etc)

1 Like

Gummed-up laptop CPU fan not working properly? A few generous spritzes with a can of carburetor cleaner (take care to spray and drain the fluids away from the motherboard) then apply some electrical cleaner (for lubrication).

A word to the wise - do not, never ever, use WD40 or any oil-based lube on a fan as it will attract dust and cause a bigger problem than before.

1 Like

I’ve seen that one before. I tell my classes about that one because it happens pretty often since a lot of laptops have the arrow keys right next to the delete, so they type Ctrl+Alt+Arrow instead of Ctrl+Alt+Delete.

Another thing I teach my classes is RATS (Read ALL The Screen). That tells you what’s going on most of the time.

1 Like

I used to hit these combos a lot… Muscle memory from MacOS where they do different functions.

1 Like

Too many colours on the screen causing colourblind people to faff around?

Then use Crtl+win key+C (for Win10 only)

It removes colours from the screen. Supposedly to help/assist colourblind people.

Also good at trolling people with Win10.

1 Like

As a color blind person… neat. Thanks for thinking of us MS.
As an ‘older’ color blind person… meh. I’ve developed other coping mechanisms that are second nature to me so I don’t really need it.

Excellent Powershell scripts for backing up your VM’s.

Obtained from this article : Two tricks to automate the export of live VMs in Windows Server | InfoWorld

I prefer having my VMs as replicating entities scattered across routers within my org.

I might be building skynet.

5 Likes

Not bad. I thought for sure I’d see the use of snapshots (If I walk into your environment and find you using snapshots as a backup method I will kick you in the leg!). I’m currently tweaking a PS script that shuts down an environment. Moves specific VM’s to a specific host, shutdown everything but vCenter, configure hosts for shutdown (disables DRS) and puts them into maintenance mode to power them off. We have a vSAN in some of our environments so it’s a little trickier than a straight shutdown. It’s supposed to be a script to run when the UPS detects a power outage so this version is a straight shutdown. But I have another version that reads an INI file for inputs that has a nice menu and gives you the option to both shutdown and power up an entire environment. The hosts do have to be powered on though.

I don’t believe in snapshots, but rather taking said VM offline, run an export-vm job, bring it back online and do whatever borkage you want to do.

Same for backups. Current script pauses the VM, backs it up, and resumes the VM.

That’s what I absolutely like about VM’s - the ease with which they can be backed up and restored…

We finally got twin 10Gb connections between everything in our server enclave. The speed is amazing.

1 Like

I’m red-blind (I was young, there were lasers, the obvious happened) and while mono wouldn’t be much good for me (messes with luma as it rebalances the greys) I always found Apple’s cmd+opt+ctrl+8 to flip colours rather useful. Not sure whether that hazy mess is pink or orange? Flip it. Now it’s either cyan or teal.

Thanks for reminding me of that key sequence. It’s rather trippy to flip between ‘normal’ and ‘inverse’ colours. I suspect it would be good for night-work in a dark room where the default colour scheme is too bright. (Although the ‘Night Shift’ setting helps a lot with that - all the colours gain a warm red/orange tint. Probably not much help if you’re red-blind, sadly)

Testing out a SMTP app/function?

smtp4dev is your friend. It basically emulates an SMTP server, and you can SMTP to it and inspect your headers, body and everything to see that the pesky program/function doing SMTP is doing it right.

Yay for not havening to set up a VM with an SMTP server and slogging through a ton of logs to find out just what went wrong.

Yes, but as a result of going Office 365.

We’ve managed to get $parent_company to set us up a connector, so that I can build a dedicated SMTP server, assign it an external IP and have O365 whitelist it. I got this working literally last Friday.

smtp4dev would have been very useful in troubleshooting what was required for a few of our apps…

It always is so - once you’ve gone through some backbreaking (not to mention ballbreaking) work, something turns up which would’ve made your work sooooo much easier… :roll_eyes:

Our devs love this app since I introduced them to it - makes their lives so much easier.

1 Like

Want to harass spambots?

Of course you do.

http://www.turnstep.com/Spambot/index.html

Veeam ONE for free monitoring of HyperV and ESXi servers (both free and licenced).

The free edition can give you an overview of CPU and RAM usage per host and per VM. Great to check if you’re not overcommitting memory and that there’s no bottlenecks.

Veeam Backup and Replication for backing up and restore of your HyperV and (licenced only) ESXi hosts.

With the free version you can backup selected VM’s to any suitable location, but only manually, whereas the licenced version can do it scheduled. A nice thing is that the backups are compressed and deduped, so as to take as little space as possible.

ESXi support is also included, but only for licenced hosts, the free version is NOT supported.

Netwrix Auditor to keep track of file accesses etc. The licenced version keeps a database so you can do all sorts of nifty reporting, whereas the free version only reports on activity.