This project is read-only.
8
Vote

In Windows 8, module load fails with 'Missing argument in parameter list' error.

description

PowerShell V3 in Windows 8 seems to be more strict about syntax and HyperV module fails to load:
 
PS>Import-Module .\HyperV.psd1
At D:\HyperV\Menu.ps1:276 char:79
  • 20 { $SelectedVHD = (Select-List -InputObject $vhd -Property ,@ ...
  • ~
    Missing argument in parameter list.
    At D:\HyperV\Menu.ps1:1141 char:79
  • 20 { $SelectedVHD = (Select-List -InputObject $vhd -Property ,@ ...
  • ~
    Missing argument in parameter list.
    • CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
    • FullyQualifiedErrorId : MissingArgument

comments

vladimia wrote Sep 5, 2012 at 7:09 PM

Suggested fix:

change from
          20   {  $SelectedVHD = (Select-List -InputObject $vhd -Property ,@{Name="Name"; expression={$_.Name -replace ($folder+"\").replace("\","\\"),""}}).name     }
to
          20   {  $SelectedVHD = (Select-List -InputObject $vhd -Property @(@{Name="Name"; expression={$_.Name -replace ($folder+"\").replace("\","\\"),""}}).name)     }

wrote Sep 26, 2012 at 5:11 PM

johnroster wrote Oct 3, 2012 at 10:43 AM

This worked for me. It appears in two places within the menu.ps1 file

wrote Jan 23, 2013 at 5:14 PM

andreww9r wrote Jan 23, 2013 at 5:15 PM

Got the same on 2008 R2 as well. Not just Windows 8 by the look of it.

wrote Feb 22, 2013 at 1:24 AM

wrote May 31, 2013 at 7:41 PM

wrote Jun 24, 2013 at 9:04 PM

Tekkie wrote Jul 19, 2013 at 8:54 PM

Actually the problem is not related to Windows 8 as such but to PowerShell 3.x as I get the same error on Windows 7 with PS3:

At WindowsPowerShell\Modules\HyperV\Menu.ps1:276 char:79
  • 20 { $SelectedVHD = (Select-List -InputObject $vhd -Property ,@ ...
  • ~
    Missing argument in parameter list.
    At WindowsPowerShell\Modules\HyperV\Menu.ps1:1141 char:79
  • 20 { $SelectedVHD = (Select-List -InputObject $vhd -Property ,@ ...
  • ~
    Missing argument in parameter list.
    • CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
    • FullyQualifiedErrorId : MissingArgument

wrote Jul 19, 2013 at 11:03 PM

wrote Apr 1, 2014 at 8:54 PM

russds wrote May 16, 2014 at 6:29 PM

Same here. This worked for me, and I'm on 2008 R2. Thanks!

wrote Oct 6, 2014 at 3:29 PM

mps_surcouf wrote Oct 6, 2014 at 3:48 PM

Worked for me.
Thanks for that.
Be nice if someone could apply this small patch?
Its not much work.

Mike