I have been constantly trying to figure out the best way to deploy updated agents to some of our virtual desktops. It isnt a large environment so I have no need for SCCM or other deployment tools, but its big enough having to RDP to each VM was a pain. I finally decided to bang out a script, and surprised how well it works. Pre-Requsites VMware PowerCLI Link to Script InstallVMSoftware.
We have multiple clusters within our vCenters that are defined as a rack. Each rack has its own storage, so storage is not shared between clusters. I needed to develop a way to easily replicate templates between clusters, so a local copy existed on each cluster to take advantage of VAAI. I really wanted to utilize the vSphere Content Libary for these, but there is currently no publicly available documentation on how to deploy a VM from a Content Library via a Script.
For the past week, I have been troubleshooting the strangest issue. I have been attempting to move some Windows 8.1 VM’s from our legacy datacenter(iSCSI) to our new datacenter(FC). Whenever I would move the VM to our new DC, it would fail to boot properly. It would boot straight to Windows Recovery. If I moved the same VM to any other type of storage(NFS, iSCSI, Local) the VM would boot perfectly fine.
Normally when i need to install and update a host VIB I use Update Manager. However there is currently a bug with Cisco’s latest enic/fnic drivers that wont let you install them via UM. I had to run these updates on over 50 hosts and I really didn’t want to have to ssh and install it manually. Lucky I remember Brian Graf’s Host Client Install Fling and borrowed some of the code to come up with the below script.
Ever wonder why a VM isn’t on the network? I was working on deploying some test VM’s and for some reason all the VM’s that were cloned decided to start with the network disconnected, and the connect on power on was also not selected. I decided to throw together this quick one-liner that will make sure every VM is set to start connected on power on and is currently connected.
I wanted to share this handy script i created when you have a need to build out a new vCenter. This script can be extremely handy as it will take care of creating the datacenter, cluster, adding hosts, creating datastores and then applying the appropriate host profile. It is all done via CSV files so it is extremely customizable. Files to modify to customize your configuration createdatacenter.csv - Contains the name of the datacenter to create.
I wanted to share this handy script i created when you have a need to extend a disk. This script can be extremely handy as it will take care of extending the VMDK and then going to the OS and then performing the expansion there as well. This has been helpful when needing to extend a large batch of servers (60+). Syntax: .\ExtendVMDKandGuest VMNAME You will then be prompted to enter in the Hard Disk #, the size you want to be extended, and then which drive letter that volume belongs to.
I thought I would share this script, its been circulating a bit but I feel it is a nice one to have in your toolkit. Have you ever had to remove a LUN from a cluster and thought “Do I really need to detach all the LUN’s, before un-mapping from my SAN?” Unmount Datastore Detach LUN Un-map from SAN Rescan Cluster Well here is a handy script with output.
So as always things change across multiple Window’s operating systems and VMware revisions. I had a need to extend the drives on about 50 VMs today and really didn’t want to do all that clicking. I remember awhile back it was easy to do this with a Basic Set-Harddisk and use the -ResizeGuestPartition but alas that has been removed from the current functionality. So I took my search to google and found a couple scripts that worked ok, but nothing that was a seamless experience.
I use a customized version of <a href="http://www.virtu-al.net/vcheck-pluginsheaders/vcheck/">http://www.virtu-al.net/vcheck-pluginsheaders/vcheck/</a> by Alan Renouf to connect to multiple servers. However a coworker of mine was trying to run it, and the script would only return data from the 2nd vCenter we were connecting to. Doing some troubleshooting we noticed their DefaultVIServerMode was set to single. This means that only a single servers connection will occur at once. Changing this setting is very easy, there are 3 scopes, but only one really needs to be set.