Run script after VM is created from VMM side
-
Friday, February 17, 2012 8:44 PM
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?
All Replies
-
Thursday, February 23, 2012 8:06 AMModerator
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 )
- Proposed As Answer by Murat Demirkiran Wednesday, May 16, 2012 8:22 PM
-
Thursday, February 23, 2012 3:14 PMModerator
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
Mohamed Fawzi | http://fawzi.wordpress.com
- Proposed As Answer by Murat Demirkiran Wednesday, May 16, 2012 8:22 PM

