While it’s normally best practice to not display anything on the host and to batch as much as possible with PowerShell; sometimes you need a UI. Here’s a pair of functions to display a menu on the screen, automatically number the possible responses and only return when a valid choice is made. Continue reading “PowerShell: Display A Menu And Get a Valid Choice”
I run some Azure Virtual Machine’s for work stuff (testing, remote access) and non-work stuff (game servers). The specification is pretty low but I like to shut it down from Azure to reduce any charges from it. This might lose their currently allocated IP address (they might get a different one on restart) but that’s not an issue for me. Over the weekend is a good time as I almost never use Azure then.
Unfortunately my memory is pretty rubbish especially during the Friday afternoon excitement/rush. What I want is a script that will run on my home machine, check the time and then shut my VMs down if we’re out of working hours.
The script follows with the explanation afterwards. Continue reading “PowerShell: Shutdown Azure VMs Outside Working Hours”