GuessMyOS Plug-in from H9Labs

So it seems that Andrew Kutz is having a nice time since he joined Hyper9. He has released a
new plug-in for all our use.

So what does it do? It changes the icons for the VM that you have to reflect their OS. There are Icons for Windows and Linux at the moment.

Seamless download at 1mb (zip file enveloping an msi file) – Installed within 2 minutes and working perfectly. It is not earth shattering – but it gives you a nice visual about which OS you are looking at.

Here is the before and after

Before After

Plug-in can be downloaded here

Andrew and H9Labs are promising some good things for the future – so stay tuned..

vSphere Beta and the NDA

In the past 2 weeks or so there has been a lot of info that is starting to be posted about the next generation of ESX. Just to name a few Duncan EppingEric Sloof, Rich Brambley, MalaysiaVM, have all posted some extremely interesting content with previews of features and new additions to vSphere – which is currently in private Beta.

Now the question came up in the forums about the NDA (and righteously so!)

Hi all,

It is my understanding that the vSphere is still in private beta and that we are not allowed to publish any tutorials or even screenshots in public, however, i can see that there are many blogs publishing lately many information and screenshots about vSphere and showing many features about it. Am i missing something here? am i allowed to start creating demos and tutorials for vSphere or it's still under NDA ?

Interesting question here – I mean – those who are in the Beta program all signed this NDA – but all this content is still coming out.

Today John Troyer (Sr Mgr, VMware Communities) gave us (I suppose) VMware’s official answer on the subject. Answer quoted  below:

As stated above, here are the current ground rules: you can post about any thing that has been disclosed publicly. That includes the vmware.com website, VMworld presentations, non-NDA briefings, and non-NDA labs. (I believe there was at least one lab at VMworld that was considered under NDA - please correct me if I'm wrong.) My understanding is that it also includes things that others have disclosed, whether it was in compliance with their NDA or not, because that information is now public.
In general, though, the NDA on the beta still holds.
This is tricky, because that line is not explicit -- what exactly was shown in each lab isn't immediately obvious, especially if you weren't there. I appreciate that we've put everybody in a bit of a bind by releasing some information but insisting that other information is confidential. Eric Sloof (NTPRO.NL), for instance, is very carefully going through and posting tidbits inspired by the lab manuals.
So at this point just be conservative, and know that this will be over as we get ready to announce this thing. If possible, indicate the source of your posting and you'll have no questions. (Hm, indicating your source is a good policy in general -- I'm going to ask the current bloggers if they can do that for the moment.)

So my fellow bloggers out there in the “sphere” … let’s all abide by the rules.


Hyper-V Live Migration – Fail!

It seems that Microsoft have a knack of demoing products to the public that “don’t do what they are supposed to” -  and it happened again.

When?: Friday, March 20, 2009 8:00 PM Pacific Time (US & Canada)

Where?: TechNet Webcast: Road Map for the Future of Virtualization (Level 300)

To see what happened you will have to register to see the recording – and move over to minute 38:00 to see exactly what happened.

To save you the trouble of having to go through the registration – I recorded the juicy parts – pausing only so do some time travelling – no editing was done on my part (forgive the audio quality though).

In short – Live Migration did not work.

Short note to myself – during a demo – check that what you want to do actually works before showing it to hundreds or thousands of people.
Microsoft – You should do the same


I Wonder what HP have planned?

Hp started a new campaign "The Guy Who Lives in the Server Room"

How you can follow us to freedom

Step 1: Admit you have a problem
Fear not, HP is here; seek refuge from your data center woes on our HP ProLiant Facebook page. Share your stories, post your pictures, help a fellow “Guy Who Lives in the Server Room,” but best of all – sign up to watch releases of all 6 episodes. Will he find his way out?

Step 2: Plan your escape
Join our viewing party on 03.30.09 to be enlightened by HP ProLiant’s newest generation of servers. Be the first to watch the world premiere of Episode 2. Need we say more?

Step 3: Share the sanity
Do you know someone else who lives in their server room? Start them on the path to freedom by sharing these resources:


Azure… and Hyper-V

Last week Azure went down for 22 hours – and this Microsoft’s Cloud solution.

Reading Hoff’s post I learned that the reason that this happened was:

What Happened?

During a routine operating system upgrade on Friday (March 13th), the deployment service within Windows Azure began to slow down due to networking issues.  This caused a large number of servers to time out and fail.

How much do you all want to bet that this “routine operating system upgrade” was a patch installation that Microsoft released? Bets please….

This has been mentioned in several places ..


If you have to patch your host for vulnerabilities that are discovered every second day (and that is not say that Microsoft does not do a good job in fixing them) and are patched for stupid things like this? (yes the patch is relevant for Windows Server 2008 – and it requires a reboot!!)

VMware vCenter Mobile Access

So today a little surprise was released by VMware, vCenter Mobile Access.

Below is a short demo released with the announcement.


A small excerpt from the product overview:

Ever wish you could restart a virtual machine or migrate it to another host from the convenience of your mobile phone? With VMware vCenter Mobile Access, you can...

VMware vCenter Mobile Access allows you to monitor and manage VMware Infrastructure from your mobile phone with an interface that is optimized for such devices. Specifically, it allows you to:

  •    Search for virtual machines in your data center
  •    Migrate virtual machines from one host to another using vMotion
  •    Execute recovery plans using VMware Site Recovery Manager
  •    Access Scheduled Tasks, Alarms and Events

   And much more...

The release date for the technology preview is set for April 2009.

I wonder how much more we think we can squish into such a small screen???


SCVMM 2008 R2 Beta

I found this in my inbox this morning ( I saw that this was mentioned here as well:
Dear SCVMM beta tester, As a past beta tester of the System Center Virtual Machine Manager 2008 software, we wanted to notify you at that new Beta release of the "R2" release for VMM 2008 is now available on Microsoft Connect for download. What is VMM 2008 R2 Beta and what are its new capabilities? VMM 2008 R2 Beta is a comprehensive management solution for virtualized infrastructure that takes advantage of many of the great new features of Windows Server 2008 R2 Beta including:
  • Live Migration: Enables the movement of running virtual machines from one virtual host to another with no downtime.
  • Clustered Shared Volumes: Helps enable Live Migration and eliminates the previous one LUN per virtual machine requirement thus simplifying SAN administration.
  • Hot addition/removal of storage: Allows the addition and removal of new virtual hard disks (VHDs) and iSCSI pass-through disks running on virtual infrastructure.
  • Networking optimizations: two new technologies -- Virtual Machine Queue (VMQ) and Chimney - provide increased network throughput while reducing CPU load.
So who is ready or will to try it out? You can sign up for the Beta here


Renaming your vCenter Update Manager Server

I have the VUM (vCenter Update Manager) Server installed on a seperate machine (vm of course) than my vCenter Server.

Now this of course is the most natural and logical way to patch your ESX servers, all you need to do it create your baselines, remediate your servers and hey presto, after a reboot you are fully patched. so this was working for a while on a test machine using an MSDE database. Now since this has become a essential part of the infrastructure it was time to move off of the MSDE and the test server.

So the plan was pretty simple:
  1. Rename the server to reflect the production task it was performing
  2. Move the database to production SQL 2005 server

Seems simple enough - don't you think? (but.... if life was simple we would not have job security!!!)

  1. Worked very easily, I mean renaming a windows server is something I can do with my eyes closed, my hands tied behind my back and with 4 big football players holding me back.

  2. Also pretty straight forward.

  • Stop the Update Manager Service.

  • Detach the Database from the MSDE instance - copy it to its new home.

  • Attach the Database.

  • Work some magic with credentials and security.

  • Change the ODBC to point to the new server.

  • And last but not least - start the service.

Now all should be fine and dandy. So I start up my VIC again and lo and behold - It does not work!

I was getting "the request failed because the server name could not be resolved". Hmm. DNS resolving works forward and reverse so what was the problem?

Like any good troubleshooter - reinstall the plugin was the next step. So 2 minutes later, I wanted to add in the plugin back in and I was presented with a new error message "The remote name could not be resolved: 'oldhostame.xx.xx.xx'". which led me to start thinking that vCenter did not update the name change of my VUM server.

I had to dig into the SQL database and find where the settings of the old hostname were still hiding. so to save you the digging, the entries were located in two locations:

I changed the entries to reflect the name change. Restarted the Virtual Center Service and the Update Manager service on the other server - and VOILA!

Hope you enjoyed the ride!


New VI-Plugin - hyper9 Client Search

Well yes it is experimental, but if you have tried their product, I am sure that you will see the benefit of what it can do for you. Now they have also released a plugin that will allow you to utilize the full power right in your VIC. Thanks to Alex Barett for bringing this to my attention. Plugin can be downloaded here. they also have the H9Labs Alert & Monitoring Applet as well


Excessive CPU usage on Domain Controllers

Now this has nothing to do with Virtualization, but it is still very handy, so I thought I would share it with you all. Yesterday I started to receive alerts from our monitoring system that our DC's were constantly using almost 100% CPU. Now of course this is not normal. Because of the high CPU usage I started to get more alerts of FRS replication issues, DNS problems and I saw a snowball slowly gathering momentum. First off, let me state that I am happy that our monitoring system notified us of a problem. Next, let me state I am not happy to announce that our monitoring system could not identify what the problem was, so I had to dig further (we are looking into a better monitoring solution). Time to put on my detective's cap and go to work (Sorry for the shameless rip-off Gabrie!!) The process that was eating up so much CPU was lsass.exe. Now of course as you can see, this process is responsible for domain authentication, and it was happening on both DC's at the same time, no viral activity was detected on our network, so I was thinking that something is causing this due to authentication problems. Therefore, I came to Windows Server 2003 Performance Advisor (SPA), for some more wisdom and enlightenment. A quick overview as how to use this utility can be found here. This tool is highly useful in diagnosing what is causing load on your server and can be used in many different ways to report problems and trends. Now after gathering the info and the reports on the DC's (which was not that easy running at almost 100% CPU) the results showed that one user account was trying to validate against the DC's at a rate of over 220 times/sec (which is NOT NORMAL). To make things more complicated, most of the load on the second DC was coming from the first. So after some investigation, it turned out that the user's account password had expired. According to Microsoft
When a domain controller detects that an authentication attempt did not work and a condition of STATUS_WRONG_PASSWORD, STATUS_PASSWORD_EXPIRED, STATUS_PASSWORD_MUST_CHANGE, or STATUS_ACCOUNT_LOCKED_OUT is returned, the domain controller forwards the authentication attempt to the primary domain controller (PDC) emulator operations master. Essentially, the domain controller queries the PDC to authoritatively determine if the password is current. The domain controller queries the PDC for this information because the domain controller may not have the most current password for the user but, by design, the PDC emulator operations master always has the most current password.
Aha! That is why it was effecting both DC's (why it did not lock out the account? - I still have to find out). But once we found that the problem was coming from a certain account, confirmed also by running a quick network capture on the DC to see which IP all this traffic was coming from. The offending services were shut down and peace and calm has returned to the land of of the Domain Controllers.
Now comes the stage that I go out with my big virtual cannon and boink some people over the head!!!


VMUG Israel March 2009

Today was our Israeli Quarterly VMUG in Tel-Aviv Lead by Ben Hagai. About 75 people there (the group is growing every time) Schedule was:
  1. Re-cap from VMWorld in Cannes
  2. Cisco Nexus 1000V
  3. ESX Storage Best Practices
  4. VMware Appspeed
  5. New Technologies Demonstration
1. Re-Cap - quick overview of technologies from Cannes. Well nothing really new here that has not been posted all over the internet over the past week. One thing that I did learn that was new, that with Vmware Fault Tolerance - If the host fails, the second VM will take over (become the primary) and a new secondary VM will be created on another host in the cluster. 2. Storage best Practices (Yes they switched the order - Cisco guy was late) This was given by Yaniv Weinberg who is a Senior VMware Consultant. This was an interesting session with a few points I took with me to reserach further. VM Pagefile - perhaps to install on a different VMDK on a different volume - (SRM reasons, Load) Partition Allignment - This has being going around the forums/blogs lately no need to go into more detail SCSI Reservations - Explanations about what causes them, and how they effect your environment 3. AppSpeed - Since I have heard the product presentation on the VMTN Podcast - I got some work done during this presentation and did not really pay attention 4. Cisco NEXUS 1000V - Overview This seems to be a big WOW!!! Strangely enough though, Even though I am participating in the Beta for vSphere, I could not find a way to test this product as well. Well It will be relased together with vSPhere, my Network Administrator will be in 7th Heaven to have such a product for our Virtualization Environment, and I now have a contact in Cisco that, I hope, will allow me to test this product as well. 5. PCoIP short explanation - and how VMware would like this to replace RDP, this will support HD video (which is a big plus) - Chris Wolf recently posted about this. 6. Client Hypervisor - CVP - Also has been mentioned a few times this past week, this one I will really be interested in - so I will be keeping a close watch on this.... And of course - almost forgot - We all got this t-shirt :) Thanks for a great productive session!!

My Visio Stencils work - VIOPS

*****Update June 11, 2012******

The new version is available here


It seems that my work was recognized on VIOPS

Congratulaitions to Rodos for being announced as moderator, Rob Ford, Rob Waite, Greg Patras, and Ken Thacker on their contributions as well.

Is is a great source of info, that is growing rapidly as you can see from the report.

Drop by, contribute and help out

Thanks to Steve Chambers for all the hard work


A (tiny) bit of Powershell..

Even though I was not there - the VI Toolkit lab, Lab 11 was highly popular and you can voice your opinion on that if you would like. Now Carter Shanklin was so kind to give me permission to publish the VI toolkit examples that were presented on the Hands-on Lab at this session. Luc Dekens , Hugo Peeters and Stephen Campbell also got an honorable mention in the document. This is more of a note to myself of how to perform common tasks with the VI Toolkit and a historical reference. It is a great list of examples collated in to one place. Of course credit goes to the team that made the lab such a success:
  • Aidan Dalgleish - Senior Consultant
  • Carter Shanklin - Product Manager, End User Enablement
  • Reg Hall – Senior Systems Engineer
  • Hardev Sanghera – Lead Partner, Systems Engineer
  • Yavor Boychev – VI Toolkit QA Lead
  • Andrey Anastasov – VI Toolkit Architect
So thank very much Carter - and of course the full PDF can be found here Get a listing of all VMs on all hosts. Get-VM Get a listing of all VMs on esx35-02.vitoolkit.local. Get-VMHost esx35-02.vitoolkit.local| Get-VM Get a listing of all VMs that reside in the “student-resourcepool-01” resource pool. Get-ResourcePool student-resourcepool-01 | Get-VM Create a new VM on esx35-02.vitoolkit.local. Give it 1 gigabyte of RAM and 10 megabytes of disk space. Call it StudentVm1. Get-VMHost esx35-02.vitoolkit.local | New-VM -Name "StudentVm1" ` -DiskMB 10 -MemoryMB 1024 Create 10 new VMs on esx35-02.vitoolkit.local. Give them all 1 gigabyte of RAM and 5 megabytes of disk space. Name the VMs student1 through student10. Foreach ($i in 1..10) {Get-VMHost esx35-02.vitoolkit.local | New-VM -Name "student$i” ` -DiskMB 5 -MemoryMB 1024} Reconfigure each VM to use 256 megabytes of RAM rather than its current memory setting. Get-VM | Set-VM -MemoryMB 256 –confirm:$false Reconfigure each VM to have 2 virtual CPUs rather than 1. Get-VM | Set-VM –NumCpu 2 –confirm:$false Power on all VMs of form student-vm-* Get-VM student-vm-* | Where { $_.PowerState –eq “PoweredOff”} | Start-VM Get a listing of all VMs that have connected CD-ROM drives. Get-VM | where {($_.CDDrives)[0].ConnectionState.Connected} Disconnect any connected CD-ROM drives. Get-VM | Get-CDDrive | Set-CDDrive -Connected $false ` –confirm:$false Get a listing of all VMs along with the sizes of their hard drives. Get-VM | select Name, @{ Name="DatastoreCapacityKB"; Expression = { $_.Harddisks | foreach { $_.CapacityKb }} } Get a listing of all VMs along with the datastores on which they reside. Get-Vm | select Name, @{ Name = "Datastore"; Expression = {$_ | Get-Datastore} } Get a listing of all available templates. Get-Template Get a listing of all available customization specifications. Get-OSCustomizationSpec Create a clone of the template, using the available customization specification. Deploy the template to the nas_system_datastore2 datastore. $template = Get-Template $spec = Get-OSCustomizationSpec New-VM -Name "vmFromTemplate" -VMHost esx35-02.vitoolkit.local ` -Template $template -OSCustomizationSpec $spec ` -Datastore nas_system_datastore2 Create a new VM on esx35-02.vitoolkit.local, attaching it to the nas_student_datastore1 datastore. Give it 10 megabytes of disk. Get-VMHost esx35-02.vitoolkit.local| ` New-VM -Name "vmOnDatastore" -Datastore nas_student_datastore1 ` -diskmb 10 Create a new VM on esx35-02.vitoolkit.local, attaching it to the Internal network. Give it 10 megabytes of disk. Get-VMHost esx35-02.vitoolkit.local| ` New-VM -Name "vmOnNetwork" -NetworkName Internal ` -diskmb 10 List all network interfaces on the ESX host esx35-01.vitoolkit.local. Get-VMHost 'esx35-01.vitoolkit.local' | Get-VMHostNetwork | foreach { $_.PhysicalNic } List all network interfaces defined on all ESX hosts. Get-VMHost | foreach { Write-Host "`nNics at host $_ :" –ForegroundColor Yellow $_ | Get-VMHostNetwork | foreach { $_.PhysicalNic } } List available virtual switches on all hosts. Get-VMHost | Get-VirtualSwitch List available portgroups on all hosts. Get-VMHost | Get-VirtualSwitch | Get-VirtualPortGroup Find all network interfaces that are not currently used in a virtual switch on esx35-03.vitoolkit.local. $vmhost = Get-VMHost esx35-03.vitoolkit.local foreach ($pnic in $hostNetwork.PhysicalNic) { $switchesUsingPnic = Get-VirtualSwitch $vmHost | where { $_.Nic -ne $null -and $_.Nic -contains $pnic.DeviceName } if ($switchesUsingPnic -eq $null) { $pnic } } On esx35-03.vitoolkit.local, create a new virtual switch called “New Switch”. Assign 64 ports to the switch and assign two interfaces to the switch. $pnic = (Get-VMHostNetwork -VMHost ` 'esx35-03.vitoolkit.local').PhysicalNic[1] New-VirtualSwitch -VMHost 'esx35-03.vitoolkit.local' ` -Nic $pnic.DeviceName -NumPorts 64 -Name 'New Switch' Create a new portgroup named “New Group”. Create it on New Switch and give it a VLAN ID of 100. $switch = ` Get-VirtualSwitch -VMHost esx35-03.vitoolkit.local -Name 'New Switch' New-VirtualPortGroup ` -Name 'New Group' -VirtualSwitch $switch -VLanId 100 Create a new VM with a single network adapter attached to the New Group portgroup. New-VM -Name MyVM -VMHost esx35-03.vitoolkit.local ` -NetworkName 'New Group' -DiskMB 8 Move the VM you created to the External network. (Get-VM MyVM).NetworkAdapters[0] | ` Set-NetworkAdapter -NetworkName 'External' –confirm:$false Move student-vm-01 virtual machine to esx35-03.vitoolkit.local esx host. $vm01 = Get-VMHost esx35-02.vitoolkit.local | Get-Vm "student-vm-01" $vm01 | Get-NetworkAdapter | Set-NetworkAdapter ` -Connectedfalse -Confirm:$false $vm01 | Move-Vm -Destination esx35-03.vitoolkit.local Move student-vm-01 virtual machine back to esx35-02.vitoolkit.local esx host. $vm01 = Get-VMHost esx35-03.vitoolkit.local | Get-Vm "student-vm-01" $vm01 | Move-Vm -Destination esx35-02.vitoolkit.local Get a listing of all VMs and the datastores where they reside. Get-VM | Select Name, { $_ | Get-Datastore } Move student-vm-01, student-vm-02 and student-vm-03 from nas_student_datastore1 to nas_system_datastore1 Get-VM student-vm-01,student-vm-02,student-vm-03 | Move-Vm -datastore nas_system_datastore1 Move all powered off VMs from esx35-03.vitoolkit.local to esx35-02.vitoolkit.local. Get-vmhost esx35-03.vitoolkit.local | get-vm | where-object {$_.Powerstate -eq "PoweredOff"} | move-vm -destination esx35-02.vitoolkit.local Enable VMotion esx35-01.vitoolkit.local. Create VMKernels on the vswitch0 switch. The VMKernel IP for esx35-01 should be The netmask should be $vs = Get-VMHost esx35-01.vitoolkit.local | Get-VirtualSwitch –Name vswitch0 Get-VMHost esx35-01.vitoolkit.local | New-VMHostNetworkAdapter -PortGroup VMKernel -VirtualSwitch $vs ` -IP -SubnetMask –VmotionEnabled:$true Enable VMotion at the host level for esx35-01.vitoolkit.local. get-vmhost esx35-01.vitoolkit.local | set-vmhostadvancedconfiguration ` -Name Migrate.Enabled -Value 1 Ensure that VMotion is enabled. # When you run these commands you should see one line of output each. Get-VMHost esx35-01.vitoolkit.local | Get-VirtualPortGroup | Where { $_.Port } | Where { $_.Port[0].Type -eq "host" } List all datastores along with their capacity and free space. Get-vmhost | get-datastore An NFS datastore has been created at Add this datastore to esx35-02.vitoolkit.local and esx35-03.vitoolkit.local Call the datastore DS_NFS. new-datastore -nfs -vmhost esx35-03.vitoolkit.local ` -name NFS -path /mnt/shared/nfs1/student_nfs -nfshost An iSCSI datastore has been created at port 3260. Add this datastore to esx35- 02.vitoolkit.local and esx35-03.vitoolkit.local. Call it DS_iSCSI. # Get lunPath and create new storage $lunpath = Get-ScsiLun -VmHost (Get-VMHost esx35-02.vitoolkit.local) | where {$_.CanonicalName.StartsWith('vmhba32:0:7')} | Get-ScsiLunPath New-Datastore -Vmfs -VMHost $h -Path $lunpath.LunPath -Name DS_iSCSI Rescan storage on all hosts. Get-VMHost | Get-VMHostStorage -RescanAllHba List all SCSI LUNs defined on all hosts as well as their multipath policies. Get-VMHost | Get-ScsiLun List all SCSI LUN paths. Get-VMHost | Get-ScsiLun | Get-ScsiLunPath Display hard disk sizes for all available VMs. Get-VM | Get-HardDisk # Or! Get-VM | Select Name, @{Name = "CapacityKB"; Expression = {$_ | Get-HardDisk | foreach {$_.CapacityKB}}} Add a second hard disk to student-vm-03. Allocate 10Mb to the hard disk. Get-VM student-vm-03 | New-HardDisk -CapacityKB 10000 Create a new cluster named “New Cluster” with HA and DRS disabled. New-Cluster "New Cluster" -Location StudentLab Move all ESX hosts into New Cluster. Move-VMHost ESX* -Destination "New Cluster" Enable HA on New Cluster. When enabling HA, set admission control on the cluster. Set-Cluster "New Cluster" –HAAdmissionControlEnabled $true ` –confirm:$false Enable DRS on New Cluster. When enabling DRS, set the automation level to partially automated. Set-Cluster "New Cluster" -DrsAutomationLevel PartiallyAutomated ` -confirm:$false Change the DRS automation level of all VMs currently on esx35-01 to fully automated. Get-VM -Location "ESX35-01*" | Set-VM -DrsAutomationLevel FullyAutomated Change the HA restart priority of all VMs currently on esx35-02 to High. Get-VM -Location "ESX35-02*" | Set-VM -HARestartPriority High Try to move all hosts out of New Cluster. (will not work with Running VM's!) Move-VMHost ESX* -Destination "StudentLab" Suspend all running VMs on all hosts. Get-VM | Where { $_.PowerState –eq “PoweredOn” } | Suspend-VM –confirm:$false Put all hosts into maintenance mode. Get-VMHost ESX* | Set-VMHost -State Maintenance Move all hosts out of New Cluster. Move-VMHost ESX* -Destination "StudentLab" Take all hosts out of maintenance mode. Get-VMHost ESX* | Set-VMHost -State Connected Resume all suspended VMs. Get-VM | Where { $_.PowerState –eq “Suspended” } | Start-VM Create new snapshots of all VMs. Get-VM student-vm*| New-Snapshot -Name Snapshot1 Find VM snapshots “Snapshot1” and display VM Name and Snapshot Name Get-VM | Get-Snapshot -Name Snapshot1 | Select VM, Name Start VMs, as memory state Snapshot only available for Powered On VMs Get-VM student-vm* | Start-VM # To save memory state when creating snapshots use the –Memory option. Revert all VMs to the state they were in before taking the snapshot. Get-VM student-vm* | foreach {$_ | Set-VM -Snapshot (Get-Snapshot -VM $_ -Name Snapshot2) -Confirm:$false } Get a listing of all snapshots, including the time when they were created. Get-VM | Get-Snapshot | Select VM, Name, Created Remove all snapshots older than 1 week. Get-VM | Get-Snapshot | where {$_.Created -le (Get-Date).AddDays(-7)} | Remove-Snapshot –confirm:$false Get all processes running in win2k3-student{n}. *Where n is your student number $hostCred = Get-Credential $guestCred = Get-Credential $vmName = “win2k3-student{n}” Get-VM $vmName | Invoke-VMScript –HostCredential $hostCred ` -GuestCredential $guestCred Get-Process # Note: The remaining solutions assume these variables are defined! List all services running inside win2k3-student{n}. Get-VM $vmName | Invoke-VMScript –HostCredential $hostCred ` -GuestCredential $guestCred Get-Service Restart the DHCP service within win2k3-student{n}. Get-VM $vmName | Invoke-VMScript –HostCredential $hostCred ` -GuestCredential $guestCred “Get-Service Dhcp | Restart-Service ` -force” List the names of all available eventlogs available within win2k3-student{n}. Get-VM $vmName | Invoke-VMScript –HostCredential $hostCred ` -GuestCredential $guestCred “Get-EventLog –list” Retrieve all security events from win2k3-student{n}. Get-VM $vmName | Invoke-VMScript –HostCredential $hostCred ` -GuestCredential $guestCred “Get-EventLog Security” Retrieve all application events from win2k3-student{n} of type Information. Get-VM $vmName | Invoke-VMScript –HostCredential $hostCred ` -GuestCredential $guestCred ` “Get-EventLog Application | Where { `$_.EntryType –eq ` ‘Information’ }” Determine the version of VMware Tools installed on a VM. $vm = Get-VM Win2k3-01.vitoolkit.local $vmView = $vm | Get-View $vmView.Config.Tools.ToolsVersion Change the amount of memory assigned to a VM. $vm = Get-VM Win2k3-01.vitoolkit.local $vmView = $vm | Get-View $spec = New-Object VMware.Vim.VirtualMachineConfigSpec $spec.MemoryMB = 2048 $vmView.ReconfigVM($spec) Set per-VM CPU and memory reservations. $vm = Get-VM Win2k3-01.vitoolkit.local $vmView = $vm | Get-View $cpuAllocationInfo = New-Object VMware.Vim.ResourceAllocationInfo $cpuAllocationInfo.shares = “High” $cpuAllocationInfo.reservation = 2000 $memAllocationInfo = New-Object VMware.Vim.ResourceAllocationInfo $memAllocationInfo.shares = “High” $memAllocationInfo.reservation = 2kb $configSpec = New-Object VMware.Vim.VirtualMachineConfigSpec $configSpec.cpuAllocation = $cpuAllocationInfo $configSpec.memoryAllocation = $memAllocationInfo $vmView.ReconfigVM($configSpec) Create a virtual switch with custom teaming properties. $networkView = Get-VMHost | Get-VMHostNetwork | Get-View $switch = $networkView.NetworkInfo.Vswitch | Where { $_.Name –eq “New Switch” } $spec = $switch.spec $spec.policy.nicTeaming.policy = "loadbalance_ip" $view.UpdateVirtualSwitch($switch.Name, $spec) Manage licenses. # The ScheduledTaskManager is in the Service Instance. $si = get-view ServiceInstance $scheduledTaskManager = Get-View $si.Content.ScheduledTaskManager # We need to identify the VM and the host where it will be powered on. $vmView = Get-VM PowerOnTest | Get-View $esxView = Get-VMHost esx35-01.vitoolkit.local | Get-View # Now we construct the task argument. $arg = New-Object VMware.Vim.MethodActionArgument $arg.Value = $esxview.MoRef $action = New-Object VMware.Vim.MethodAction $action.Argument = $arg $action.Name = "PowerOnVM_Task" $scheduler = new-object VMware.Vim.OnceTaskScheduler $scheduler.runat = (get-date).addminutes(5) $task = New-Object VMware.Vim.ScheduledTaskSpec $task.Action = $action $task.Description = "Start a VM with a scheduled task." $task.Enabled = $true $task.Name = "Power On Virtual Machine" $task.Scheduler = $scheduler $scheduledTaskManager.CreateScheduledTask($vmView.MoRef, $task) Create functions to make automation easy. # Part 1. # Define our reusable function. function Set-VMCpuReservation { param ($vm, $shares, $reservation) $vmView = $vm | Get-View $allocationInfo = New-Object VMware.Vim.ResourceAllocationInfo $allocationInfo.shares = “High” $allocationInfo.reservation = 2000 $configSpec = New-Object VMware.Vim.VirtualMachineConfigSpec $configSpec.cpuAllocation = $allocationInfo $vmView.ReconfigVM($configSpec) }


Statistics for February 2009

Busy month it has been... (Sounds a bit too much like Yoda) The increase in my blog traffic was quite large this month. The most popular item was of course the VMware Visio stencils which have been downloaded almost 7,000 times in the last 10 days. A good boost was also the addition of my blog to Planet V12n. Thanks for the vote of confidence!