Rebuilding Distributed Switch on New vCenter Instance Using a Backup

As you may have seen, I recently had a vCenter fail and after working with VMware Support it was determined that the vCenter should be rebuilt from scratch. Rebuilding the vCenter and adding the hosts that were in it was fairly easy. However, restoring their networking was another story. The hosts retained their previous network configuration, but I was unable…

Share This:
Read More

PowerShell Script to Login to Multiple vCenter Servers

Do you have multiple vCenter servers that you interact with on a daily basis? Do you like to use PowerShell to manage them? I was opening a PowerShell window, and doing a connect-viserver for each and having to enter my PW over and over again. First, I tried to use the New-VICredentialStoreItem command to store my PW, but with security…

Share This:
Read More

Schedule Service Restarts with PowerShell

Have you ever had a service randomly stop on you over and over again?! In my homelab environment, I use a company called Itarian to patch my servers, control them remotely, etc. One thing I found is that the main Itarian service, ITSMService, keeps crashing! You can see below, a few of the servers are grey. I wrote a quick…

Share This:
Read More

Upgrading VMware Tools on each ESXi Host via ESXCLI

Have you ever wanted to upgrade the version of VMware Tools on your hosts but you’re having an issue with Update Manger/Lifecycle Manager? I ran into this problem recently. I was attempting to upgrade my hosts to the latest version of VMware Tools and even though the remediation completed successfully via Lifecycle Manger finished successfully, each host still reported at…

Share This:
Read More

List Scheduled Tasks for Remote Servers

Recently, I was asked to find out of a certain service account was being used in scheduled tasks on any server. Being a PowerShell guy, I turned to the Get-ScheduledTask cmdlet. I tried querying a list of scheduled tasks by Author. I created a variable $VMs and used it to filter any Powered on Windows VM. I then checked each…

Share This:
Read More

Save Credentials to File in PowerShell

Have you ever wanted to schedule a script to run overnight but need to pass secure credentials? You may do it once in open-text, but after that you say to yourself… There has to be a more secure way! Well, you were right! See how I saved my credentials to a file to use later. Remember, you need to remember…

Share This:
Read More

Running VMFS Unmap via PowerCLI

Starting in vSphere 5.5, VMware introduced a new command in the esxcli namespace that allows deleted blocks to be reclaimed on thin provisioned LUNs that support the VAAI UNMAP primitive. You can run the command without any maintenance window, and the reclaim mechanism has been enhanced: Reclaim disk space size can be specified in blocks instead of a percentage value…

Share This:
Read More

Using PowerCLI to Create a Local Scratch Partition

My company recently purchased some Dell Servers with ESXi installed to local SD cards. The issue we had was that the 8gb SD cards that came with the server and there wasn’t enough space on the cards for a scratch partition.  We ordered the servers with a single 300gb HD in order to get the RAID controller, so we decided…

Share This:
Read More

Script to disable protocols older than TLS 1.2 and turn off RDP

My InfoSec team came to us asking we disable anything older than TLS 1.2 and turn off RDP on our servers in the DMZ.  We don’t allow RDP in the DMZ anyway, and they found that leaving RDP on when not using it poses a security risk. To do this, it involved multiple registry changes.  With several servers to do…

Share This:
Read More

PowerCLI Script to Check Host Over-commitment Percentage & Ratios

At my previous employer, we had a Dev/QA vSphere environment that was very over provisioned.  The environment had lots of CPUReady issues with VMs having to wait for CPU time, which caused things to be slow, etc.  We knew this but the application teams didn’t understand.  I ended up writing a PowerCLI script to check the CPU overcommitment and sent…

Share This:
Read More