Thursday, April 17, 2014

VM Console from PowerCLI

Neat little trick within PowerCLI 5.5R1:

$VM = "your vm"

Get-VM $VM| Open-VMConsoleWindow


And now your webbrowser will open and a console will start.

Getting a list of vm's with OS'es

I wanted to do a Get-VM|select name, GuestOSFullname, but that doesn't work. So some googling gave me this little gem on the vmware forum:

New-VIProperty -Name GuestFullName -ObjectType VirtualMachine -ValueFromExtensionProperty 'Guest.GuestFullName' -Force

Now I can do a Get-VM | Select Name, GuestFullName and I get an overview of which machines have which OS.

I'm sure there are other ways of getting this too, but this was what I was looking for.

P.S., if I do Get-VM | Select Name,Guest , I do get the OS, but it is prepended with the hostname.

Tuesday, April 15, 2014

Add PowerCLI modules to Powershell console

I've recently become a fan of the Powershell ISE, especially from V3 on. To load VMware PowerCLI module and to have VMware cmdlets available in powershell console:

Add-PSSnapin VMware.VimAutomation.Core


The same can be done with the update manager:

Add-PSSnapin VMware.VumAutomation