Using the PowerGUI, you can list all snapshots, but unfortunately, it doesn’t list the parent VM.
I wrote a quick little function to search all VMs that have snapshots and list them.
In this post I talked about automated deployment that launches the remote console for me. Since I had 24 hosts that need the user & role, I created a script that does it for me. Nothing special, just something quick that works…
This is a follow-up to my last post about fully automated deployment
Below is the script. After it pulls the information from you, it creates the VM, adds the second disk, sleeps for 15 seconds, pulls the MAC from the new VM, creates the computer object in SCCM, adds it to the collection, sleeps for 15 seconds, refreshes the collection, sleeps for 15 seconds, then powers on the VM. If you’ve got a mandatory OSD advertised to the collection specified, and the OSD is fully automated, it will lay down the OS and the computername will be the name you provided to the script.
So I’m creating a script that builds a VM for you, imports the NetBIOS name & MAC address into SCCM, adds it to a specific collection, and then powers on the VM. If you have a mandatory OS Deployment for that collection, you don’t have to do anything but sit back and watch (given your Task Sequence is fully automated).
It prompts you for vCenter name, VM name, cpu, ram, description, disk size, queries vcenter for clusters, networks, datastores (sorted by free space), and verifies with you before building…
I’m excited & pleased that it’s actually working. It’s currently proprietary to my work environment, but I will try to strip all that out and let you change what needs to be changed to use it where you like.
Happy Scripting!!!
I’ve recently had a ton of requests for information about specific VMs. They want to know how many disks they have, CPU count, how much RAM, and which environment the VM resides in.
Instead of constantly searching vCenter, I wrote this quickly during the meeting to query multiple servers.
I recently had a requirement to build a script that listed all PST files on some of our DFS folders. I know there are a bunch of ways to get this done, but I wanted to build my own way. Since we needed to search roughly 20 directories, I decided to play with the Start-Job cmdlet so I could have one script to spawn multiple worker processes. At first, it was tricky (since I had never even messed with it), but anyone can easily pick it up.
A reader on a previous post asked about pulling host UUIDs, so I wipped together this script.
Usage is like this:
Get-VMHostUUID.ps1 -vmhosts ("host1","host2","host3")
or
Get-VMHostUUID.ps1 -vc vcenterserver -container cluster1/folder/dc/etc
Lets face it, repetition sucks. When provisioning ESX hosts, using such things as the EDA make life easier, but it only does so much for ESXi.
The install for ESXi is simple and straight forward, but when done, you have to go and set everything else (IP, hostname, DNS, local users, etc…). Doing this for 20 hosts could be a PITA (Pain In The A..), so I set out on writing a script that does all of this for you.
All you have to do is set the IP & root password, then verify you can ping the host by it’s hostname (set host/A record in DNS). Once that’s verified, here’s what the script does for you:
This is a slightly more advanced script, and it’s not fully polished, but works.
I wanted to expand This Script to allow you to specify hosts as well, instead of just vCenter.
This came about because we have 20 new hosts that need storage so we can build our new vCenter server on them, and my old script wouldn’t suffice.
I know you can rescan at the container level (cluster, folder, datacenter), but sometimes the processes would hang on large clusters, other times I’d have to rescan twice. I like this script because it rescans all HBAs one by one, then rescans VMFS after. One could probably add the -runasync, but then it’s the same as the right-click in vCenter.
So, without further ado, here’s the updated script:
**Update May 07, 2012 – Use the new script here: Updated: Finding WWNs for HBAs in ESXi hosts, now with Get-VMHostHba
When building a new cluster, your storage team (or you) may need to add several hosts into the shared storage zone. It’s a pain to go to each host, configuration, storage adapters, then copy out the WWN.
With this script, you can supply a vCenter server and Cluster/Folder/Datacenter (any logical container) and it will list all the WWNs for Fibre Channel devices. But what if you don’t have vCenter stood up yet? No problem, you can also supply a list of ESX/ESXi hosts to scan.
Shawn & I built this because we have 20 hosts we need the WWNs from to provide to our storage team, and vCenter isn’t alive yet.