Posts Tagged ‘PowerShell’

PowerCLI: Match VM and Windows harddisks – Part 2

Tweet
This is a follow up on a post I did a couple of weeks ago to create a mapping table between Windows- and VMware hard disks. In another previous post PowerCLI: Get WMI info from isolated guests, I showed you how to get WMI info from a guest without using the guest’s network. I used this [...]

PowerShell / PowerCLI linkage

Tweet
Since I started looking into PowerShell and PowerCLI, I gathered a couple of links which I found interesting and useful. I needed a way for them to be accessible anytime anywhere. Obviously the first thing that came across my mind was putting them on my blog somewhere.
I decided to dedicate a page on my blog [...]

PowerCLI: Get WMI info from isolated guests

Tweet
A few weeks back I posted an article on matching Windows and VMware disks. Unfortunately this would work only if you could remotely query WMI information from that VM. If you have any VM that’s isolated or behind a firewall, you are out of luck. This bothered me, so I started looking for a uniform [...]

Match VM and Windows harddisks using PowerCLI

Tweet
Today I was asked to extend a disk of a Windows virtual machine. Normally this is a standard procedure and finished within minutes. The hardest part of the procedure is to check the scsi id from within Windows and match the Windows disk to the corresponding virtual disk in the virtual machine’s hardware settings. Unfortunately [...]

$Null or Nothing?

Tweet
When looking at a lot of PowerCLI scripts available I noticed that people tend to forget to validate their output. For example let’s look at the following piece of code:
$Vms = Get-VM
Although this command will return a collection in almost all cases, it can however return 3 different output types. It can return a collection, [...]

How big is my VM?

Tweet
If you want to know the size of your vm, you probably first look at the size of the virtual disks in the vm’s settings, but there’s more to it. A virtual machine consists of the following set of files:

Config files (.vmx, .vmxf, .vmsd, .nvram)
Log files (.log)
Disk files (.vmdk)
Snapshots (delta.vmdk, .vmsn)
Swapfile (.vswp)

To make things more complicated, these [...]

List HBA WWPNs and LUNs using Powershell

Tweet
Lately I’m moving around my VMs and storage luns between my ESX clusters a lot to accomplish a complete redesign of my Virtual Infrastructure. At some point I got lost and didn’t had the complete overview anymore. Which luns were attached to which cluster? To remove(unpresent) a lun from an ESX host/cluster on the storage [...]

Export and import customization profiles using Powershell

Tweet
One great thing in the automation of VM deployments is the use of customization profiles. These profiles are stored inside the vCenter Server database. However, when you loose the database, you also loose your customization profiles. Having customization profiles exported as xml files is always useful as a backup and luckily you can export and [...]

Reconnect ESX hosts using PowerShell

Tweet
This week I ran into problems with vCenter server and almost all of my VMs were orphaned in vCenter. To resolve this issue I needed to disconnect/connect each ESX host. Because I hate doing repetitive tasks I created a little PowerShell script that I wanted to share with you.

# Variables
$VCServer = “vcserver.yourdomain.local”
$password = “rootPassword”

#Connect to [...]

Setting custom attributes with VMware PowerCLI

Tweet
Last week I wanted to extend my vCenter with some extra custom attributes on my VMs. This would extend the usability of the Export List feature for reporting purposes. So together with Hal Rottenberg’s “Managing VMware Infrastructure with Windows PowerShell TFM” book in my hand, I took a dive into VMware PowerCLI (formerly known as [...]