To use,

Import-Module -Force Hyper-V\libVM.psm1

Possible Arguments

-vmName: The name of the VM to create. If not specified, this will be automatically generated from the CMDB SharePoint list.
-vmType: Currently not implemented, defaults to Server. This would select the proper naming convention if another VM type was specified.
-parentContent: The name of the content of the parent. For instance W2012R2
-parentVersion: The label of the version to use. For instance 2013-10-17
-processorCount: The number of virtual processors assigned to the VM. If not specified, this will default to the number specified in the parent definition in OSParentDefinitions.xml
-vmStartupMemoryGB: The startup memory assigned to the VM. If not specified, this will default to the number specified in the parent definition in OSParentDefinitions.xml
-vmMinimumMemoryGB: The minimum memory assigned to the VM in regards to dynamic memory. If not specified, this will default to the number specified in the parent definition in OSParentDefinitions.xml
-vmMaximumMemoryGB: The maximum memory assigned to the VM in regards to dynamic memory. If not specified, this will default to the number specified in the parent definition in OSParentDefinitions.xml
-hyperVClusterName: The Hyper-V cluster the VM will be part of.
-selectedCSVName: The name of the CSV onto which the differencing disk of the VM will be stored.
-networkName: The network label the VM will be part of. This is configured in Networks.xml
-domainName: The name of the Active Directory domain to which the VM will be joined.
-useDefaultCSV: (switch) This will use the CSV name specified as the default in the environment file
-credential: The credential to use for the various operations involved in the script.
-useDynamicIP: (switch) If specified the VM will use DHCP for IP address assignment.
-staticIPAddress: The static IP of the VM to assign.
-description: The description of the VM that will be stored in the description field of the Active Directory computer object.

Examples

For a vanilla VM based on the OS parent definition:
New-RemoteVM -parentContent W2012R2 -networkName PROD_NYC -domainName contoso.com -credential (get-credential) -staticIPAddress 10.10.10.10 -description "Production file server in Windows Server 2012 R2" -parentVersion 2013-10-17

For a more custom VM:
New-RemoteVM -parentContent W2012R2 -networkName PROD_NYC -domainName contoso.com -processorCount 2 -vmStartupMemoryGB 1 -vmMaximumMemoryGB 16 -credential (get-credential) -staticIPAddress 10.10.10.10 -description "Production file server in Windows Server 2012 R2" -parentVersion 2013-10-17

Once the VM is created you can apply security group templates using Apply-SecurityTemplateGroupMemberships

Last edited Jul 10, 2014 at 8:40 PM by misabel_gem, version 5