Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8769523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:21:58+00:00 2026-06-13T17:21:58+00:00

I created the below function to pass memory from a csv file to create

  • 0

I created the below function to pass memory from a csv file to create a VM in Hyper-V Version 3

Function Install-VM {
param (
[Parameter(Mandatory=$true)]
[int64]$Memory=512MB
)
$VMName = "dv.VMWIN2K8R2-3.Hng"

$vmpath = "c:\2012vms"


New-VM -MemoryStartupBytes ([int64]$memory*1024) -Name $VMName -Path $VMPath  -Verbose

}

Import-Csv "C:\2012vms\Vminfo1.csv" | ForEach-Object { Install-VM -Memory ([int64]$_.Memory) }

But when i try to create the VM it says mismatch between the memory parameter passed from import-csv, i receive an error as below

VERBOSE: New-VM will create a new virtual machine "dv.VMWIN2K8R2-3.Hng".
New-VM : 'dv.VMWIN2K8R2-3.Hng' failed to modify device 'Memory'. (Virtual machine ID
CE8D36CA-C8C6-42E6-B5C6-2AA8FA15B4AF)
Invalid startup memory amount assigned for 'dv.VMWIN2K8R2-3.Hng'. The minimum amount of memory you can assign to
a virtual machine is '8' MB. (Virtual machine ID CE8D36CA-C8C6-42E6-B5C6-2AA8FA15B4AF)
A parameter that is not valid was passed to the operation.
At line:48 char:9
+         New-VM  -ComputerName $HyperVHost -MemoryStartupBytes ([int64]$memory*10 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (Microsoft.HyperV.PowerShell.VMTask:VMTask) [New-VM], VirtualizationOpe
   rationFailedException
    + FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.NewVMCommand

Also please not in the csv file im passing memory as 1,2,4.. etc as shown below, and converting them to MB by multiplying them with 1024 later

Memory
1

Can Anyone help me out on how to format and pass the memory details to the function

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T17:21:59+00:00Added an answer on June 13, 2026 at 5:21 pm

    If you pass 1 and multiply it by 1024 you’re actually asking to assign 1024 bytes (kb) of memory and the error message state that the minimum amount you can give is 8 mb.

    If the number you pass is meant to be in GB, multiply it tree times by 1024, (1024*1024*1024).
    If you want to pass a value such as ‘3gb’, you’ll need to expand it first:

    New-VM -MemoryStartupBytes (Invoke-Expression $memory) -Name $VMName
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created a custom function shown below with code I copied from a button
I have a function to create a pdf which should return bitarray. Below is
InSymfony (Doctrine) I am trying to create a public function with the code below.
I have the below configuration where I'm trying to create a test C function
I have created below bat file to run my RMI server @echo Off set
Below is a VBA function that I created for use in Excel for converting
Hi I have the following function created in Oracle. i will have to pass
consider the two template functions below: template <typename T, typename A> T* create(A i)
//I have created below snippet to let the sensor to be detected. -(void)addProximitySensorControl {
I have created button 2 below: <input id=Button1 type=button value=Stop onclick=alert('hello world');/> <input id=Button2

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.