Hi,
I have difficulty creating new virtual machine. I always get this error when invoking the powershell codes:
An exception of type 'System.Management.Automation.ParameterBindingException' occurred in System.Management.Automation.dll but was not handled in user code
PowerShell ps = PowerShell.Create(); ps.AddCommand("New-VM"); ps.AddParameter("Name", "TestVM"); ps.AddParameter("VHDPath", "C:\Users\Public\Documents\Hyper-V\Virtual hard disks\Win8.vhdx"); ps.AddParameter("SwitchName", "TestSwitch"); ps.AddParameter("MemoryStartupBytes", "512MB"); var result = ps.Invoke();
The error occurs when I specify the memory size. When I comment out the following line, a virtual machine is created successfully without any error:
ps.AddParameter("MemoryStartupBytes", "512MB");
However, when I want to specify the memory size, I will get an error.
How should I proceed from here? I want to be able to specify the memory size without any error.
Can someone help me out on this as I'm in deep need of assistance to overcome this problem?
Any help is greatly appreciated.
Thanks.