I'm trying to create a function with the parameters to create the VM this is where I'm at.
I don't get any errors but nothing executes.
Function Create-VM {
param (
[string] $SRV1 = "Windows7",
[string] $SRAM = "512",
[string] $SRV1VHD = "41943040000",
[string] $VMLOC = "C:\users\Public\documents\hyper-v\virtual hard disks",
[string] $Network1 = "Local Area Connection – Virtual Switch")
# Create Virtual Machines
MD $VMLoc –erroraction silentlycontinue
new-vm $SRV1 -path $VMLoc
new-vhd -vhdpaths $VMLoc\$SRV1 -size $SRV1VHD
add-vmdisk -vm $SRV1 -controllerid 0 -lun 0 -path $VMLoc\$SRV1
get-vm $SRV1 | add-vmdrive -controllerid 1 -lun 0 -dvd
get-vm $SRV1 | set-vmmemory -memoryinbytes $SRAM
get-vm $SRV1 | add-vmnic -virtualswitch $Network1
}