PowerShell – ReadHost Continue on ‘y’

Occasionally, we are required to gather data from the most unreliable element of the computing milieu: the user.  The goal is to acquire to appropriate response, while discarding junk reponses, and preventing the user from blowing up the entire automation process.  The while loop below does just that, while maintaining its girlish figure. $query = … [Read more…]

PowerShell Remoting to Azure VM

In order to connect to an Azure Windows VM (tested image was 2016 core with Containers), perform the following: On the Azure VM, add a firewall rule to allow remote management traffic inbound: New-NetFirewallRule -Name PSRemote -DisplayName ‘PS Remoting’ -Enabled true -Profile any -Direction Inbound -LocalPort 5985 -Protocol TCP For Nano server, run the following command: []: … [Read more…]

PowerCLI – Function to Wait for Windows VM to Reboot

Sometimes VMWare Tools will report that a Windows VM is running before all the services are actually running.  I created the following simple PowerCLI function to poll for VMWare Tools status, then wait an extra 5 seconds before returning in order to ensure that all services are, in fact, operational: wait-reboot VMName function wait-reboot { … [Read more…]

Powershell – Automating HP c7000 Virtual Connect Domain Configuration

In preparation for private cloud deployment, our HP c7000 BladeSystem Virtual Connect domain needed configuration.  Of course, the VCEM modules allow CLI interaction, so I figured I could automate the process using a script.  Problem is, the SSH buffer maxes out after about 50-60 lines from the script, resulting in catastrophic configurations.  As always, PowerShell has … [Read more…]

Create Self-Signed Certificate for Windows

I ran into an issue with a Windows server that lost its self-signed certificate (the circumstances surrounding this event are embarrassing, and therefore, irrelevant).  I needed to recreate the self-signed cert in order to Remote Desktop to the machine, but could not find a lot of references on doing so after a moderately exhaustive search … [Read more…]

PowerShell – Remote Session to Domain Controller

Sometimes you need to run Active Directory scriptlets in PowerShell, but logging into your DC takes too long, there are too many RDCs already, or you’re just lazy.  Regardless, the following script will allow you to initiate a remote PowerShell session to your DC and import the ActiveDirectory module, so you can perform AD administration … [Read more…]

PowerShell – Roll Microsoft Print Cluster

In later releases of Microsoft’s print clustering service, moving the primary node of a cluster requires setting up dependencies correctly, otherwise, node splitting occurs.  Instead of fixing the improper cluster configuration, I wrote the following PowerShell script to roll each cluster group required to the standby node.  This script was written with a 2 node … [Read more…]

PowerShell – New NetApp LUN

Sometimes you need a LUN quickly.  In cases like these, it’s helpful to be able to use PowerShell instead of NetApp’s GUI.  Fortunately, there is a way (requires downloading the NetApp DataOnTap PowerShell Module ver 3.x, which requires you to create an account and sign in).  The following script will create a Volume and LUN of … [Read more…]