none
Run script after VM is created from VMM side

    Question

  • Is there a way to run a powershell script on the VMM server when a VM is created?

    Here's what I want to do.  Immediately after a VM is created on the Self Service Portal, I want to mount the VHD and drop files onto the VHD.  Is that possible?

    Friday, February 17, 2012 8:44 PM

All replies

  • You can do everything and even more, by using powershell in the first place.

    A common scenario when powershell is needed during VM deployment from the library, is when the VHD files in the library is defined as dynamical expanding disks, and you want to convert the disks to Fixed Sized Disk as part of the deployment. This is an example where powershell comes to your rescue.

    I`m not sure how you intend to drop files onto the VHD, but as part of the script, you could boot the VM and copy the required files into the OS etc.


    Kristian (Virtualization and some coffee: http://kristiannese.blogspot.com )

    Thursday, February 23, 2012 8:06 AM
    Moderator
  • you have 2 ways for that

    1- Using System center orchestrator (Opalis) to automated VM creation and all action after that

    2- using powershell to achieve that using GUIRunOnce Commands - Commands to be executed the first time a user logs into the guest operating.

    Also check http://technet.microsoft.com/en-us/library/bb740784.aspx

    You can try something like MDTImageFactory

    http://blogs.technet.com/b/mniehaus/archive/2009/09/23/setting-up-an-image-factory-part-1-using-mdt-2010-lite-touch-with-scvmm-2008-r2.aspx


    Mohamed Fawzi | http://fawzi.wordpress.com

    Thursday, February 23, 2012 3:14 PM
    Moderator