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: [10.0.0.6]: … [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…]

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 – Install SCCM 2012 R2 Prerequisites

This is a fairly complicated script that will install the required prerequisites to install SCCM 2012 R2 on a server.  It was designed under the functional model in order to compartmentalize each step required, reducing the overall complexity.  The script requires media in order to complete successfully, detailed in the Script Media Requirements section below. … [Read more…]

Use PowerShell to Add Permissions to AD Container Objects for Machine Accounts Without using the AD Module

I am taking on SCCM 2012 at work, so currently, I’m working on a PowerShell script that installs all the prerequisites before installing the actual product. The list of prereqs is about a mile long, but so far, I’m batting 1.000. One of the prereqs is to add Full Control permissions on the System Management … [Read more…]

Removing Lingering Object from AD: The Layadmin’s Version

On Friday afternoon, a schema update was performed in our lab. On Monday, DC replication was halting on a majority of the DCs. I was able to detect this instantly because I monitor the health of the DCs using PowerShell.  DCDIAG on the affected servers would report the following message: The replication generated an error (8606): … [Read more…]