locked
Argument was specified as a script block, and no input exists RRS feed

  • Question

  • I was curious about this published script:

    New-StoragePool –FriendlyName "My Storage Pool" -StorageSubSystemFriendlyName {Get-StorageSubsystem –FriendlyName *space*} –PhysicalDisks {Get-PhysicalDisk –CanPool $True}

    When I try to run it I get the following output:

    The parameter "StorageSubSystemFriendlyName" can not be evaluated
    Because its argument was specified as a script block, and no input exists

    Any ideas why?

    Monday, July 10, 2017 2:24 PM

All replies

  • You really need to take the time to learn PowerShell.  You are just guessing and blindly copying things without any idea of how they work.

    Do this to see what is happening:

    Get-StorageSubsystem FriendlyName *space*

    It is likely not going to return anything if you don't have any names like that.


    \_(ツ)_/

    Monday, July 10, 2017 2:37 PM
  • lol I'm trying ;) but thanks for the advice ;)
    Monday, July 10, 2017 2:39 PM
  • You really need to take the time to learn PowerShell.  You are just guessing and blindly copying things without any idea of how they work.

    Do this to see what is happening:

    Get-StorageSubsystem FriendlyName *space*

    It is likely not going to return anything if you don't have any names like that.


    \_(ツ)_/

    Actually you know what I changed the criteria from "space" to "windows" and it still didnt work.  So I ran the Get-StorageSubsystem FriendlyName *Windows* and this did return something.  So I guess there must be an issue with how the subcommand is presented?
    Monday, July 10, 2017 2:41 PM
  • It is not a subcommand.  This is why you need to learn PowerShell.

    The * is a wildcard.  Without a wild card in most of Windows commands you will not get a match if the string is not exact.  This is actually not PowerShell but is basic to almost all of Windows.

    If you learn how to use PS help you can check what a parameter requires for an argument.  This should be your first step in any new CmdLet.


    \_(ツ)_/

    Monday, July 10, 2017 2:48 PM
  • It is not a subcommand.  This is why you need to learn PowerShell.

    The * is a wildcard.  Without a wild card in most of Windows commands you will not get a match if the string is not exact.  This is actually not PowerShell but is basic to almost all of Windows.

    If you learn how to use PS help you can check what a parameter requires for an argument.  This should be your first step in any new CmdLet.


    \_(ツ)_/

    ok I understand what you are saying.  Look at this, its the link you gave me earlier.  He mentions subcommand:

    fully interact with Windows Storage Spaces

    Monday, July 10, 2017 2:52 PM
  • He was referring to the parens around the command and calling it a sub-command.  I almost never use that as it can do exactly what you see and can be hard to find in a script.

    You are getting into some very technical areas of PowerShell, programming and Windows.  You need to do a bit of homework before you can decode what is happening.'


    \_(ツ)_/

    Monday, July 10, 2017 3:02 PM