Run script after VM is created from VMM side


  • 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: )

    Thursday, February 23, 2012 8:06 AM
  • 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

    You can try something like MDTImageFactory

    Mohamed Fawzi |

    Thursday, February 23, 2012 3:14 PM