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

Change default VMware Remote Console Application

Have you ever tried to open the VMware Remote Console and have it launch VMware Workstation and NOT the VMware Remote Console application? This is set via two keys in the Windows Registry. HKEY_LOCAL_MACHINE\SOFTWARE\CLASSES\VMRC\DEFAULTICON and HKEY_LOCAL_MACHINE\SOFTWARE\CLASSES\VMRC\SHELL\OPEN\COMMAND. You can get these values via POWERSHELL. As you can see, my Remote Console is currently set to VMware Workstation. I prefer to use…

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 set the Global System Log Location

Are you seeing an error stating that the System Logs on your host(s) are stored on non-persistent storage. Following THIS VMware KB article, I knew I had to change the Global Logdir. What we did was create a shared datastore called ESXiScratch. On this datastore, we created folders for each host. .locker-lab01.locker-lab02etc. Next, I ran the following PowerCLI command to…

Share This:
Read More

PowerShell Scripting with SCCM

Until now, I’ve done my SCCM patching with the NO REBOOT option set and servers were rebooted manually.  Because of this, we were getting further and further behind due to servers requiring multiple reboots each month.  In order to resolve this, we decided to go about using the Auto-Reboot option in SCCM and letting SCCM reboot however many times is…

Share This:
Read More

Using vSphere Tags to Check for Pending Reboot State

You may have seen my blog post on the Test-PendingReboot PowerShell module.  I’ve been using it a lot lately and had the thought to use vSphere Tags to check pending reboot state.  In my environment, we normally check for pending reboot states before patching.  If a server is in a pending reboot state, it won’t receive the patches from SCCM,…

Share This:
Read More

The Pending Reboot Nightmare… PowerShell to the Rescue!

My company has been having issues dealing with servers in a pending reboot state for quite a while.  Part of it stems from using SCCM to deploy patches and having the patch deployment set to suppress the reboot and our Operations Team reboots the servers manually.  Well, some months require multiple reboots and we get stuck in the rabbit hole…

Share This:
Read More

PowerShell Script To Get vMotion Events

Recently, I had the need to get a list of vMotion events to pass to management.  I attempted to use the Get-VIEvent cmdlet for this, but found it wasn’t easy to only pull logs from one specific cluster.  I attempted to use the -Entity option and direct it to the cluster I wanted, but that didn’t work well.  So I…

Share This:
Read More

Create an ISO file with PowerShell!

I received a request at work to transfer 5+gb from the internal network, to a server in the DMZ.  Our DMZ networks are locked down, so I cannot copy the files directly.  I have the trial version of UltraISO that I’ve used for tasks like this in the past, but it’s limited to 300mb in the trial version.  Previously, we’ve…

Share This:
Read More