Cmdlet parameter options reduced in PowerShell 4.0!

This topic contains 9 replies, has 3 voices, and was last updated by Profile photo of sponsen sponsen 3 years, 5 months ago.

  • Author
    Posts
  • #11192
    Profile photo of sponsen
    sponsen
    Participant

    This made me a little annoyed; apparently MS reduces cmdlet options in 4.0...

    After upgrading to Win 8.1 (including PS 4.0) i'm no longer able to: Get-ADUser username -Property *

    -Property no longer accepts wildcard according to the online help, witch is updated 17. oct, and the help now applies to PS 4.0..

    I don't like that MS are reducing features... whats next..? If this is the trend, then scripts will become unstable and unusable... Anyone know why they are doing this?

  • #11193
    Profile photo of Richard Siddaway
    Richard Siddaway
    Moderator

    This is confusing because Get-AdUser isn't part of PowerShell 4 – its part of the Active Directory toolset.

    The online help for get-AdUser states "Specify properties for this parameter as a comma-separated list of names. To display all of the attributes that are set on the object, specify * (asterisk). "
    http://technet.microsoft.com/en-us/library/hh852208.aspx

    The text for the -property parameter shows some examples using -Property *

    and that's dated 17 October

    Where is the version of the help that states wildcards aren't supported

  • #11194
    Profile photo of Dave Wyatt
    Dave Wyatt
    Moderator

    There's a bug that's currently causing that command to fail on PowerShell 4; I've seen a few references to it on the TechNet forums and the Connect site. Not sure if / when it's going to be fixed, but for now, you'll need to work around it by not using the wildcard if you've upgraded to PowerShell 4.

  • #11195
    Profile photo of sponsen
    sponsen
    Participant

    [quote=11193]This is confusing because Get-AdUser isn’t part of PowerShell 4 – its part of the Active Directory toolset.
    The online help for get-AdUser states “Specify properties for this parameter as a comma-separated list of names. To display all of the attributes that are set on the object, specify * (asterisk). ”
    http://technet.microsoft.com/en-us/library/hh852208.aspx
    The text for the -property parameter shows some examples using -Property *
    and that’s dated 17 October
    Where is the version of the help that states wildcards aren’t supported
    [/quote]

    I know its part of the AD tool set, but as Dave pointed out, this is only affecting PS4.

    In the help-page you linked to, look in the table under the "-Properties" section, it is stated there: Accept Wildcard Characters? false
    I would just guess that they forgot to change the text example that you are referring to.

    Or have i totally misunderstood the meaning of the table?

  • #11215
    Profile photo of Richard Siddaway
    Richard Siddaway
    Moderator

    The online help was only partially updated because the text for -Properties still says you can use wildcards.

    A workaround is to use Get-AdObject either directly

    get-adobject -identity "cn=richard,cn=users,dc=manticore,dc=org" -properties *

    of piped from get-aduser

    get-aduser -identity richard | get-adobject -properties *

  • #11299
    Profile photo of Richard Siddaway
    Richard Siddaway
    Moderator

    I posted about this on my blog and had a comment back that it is because PowerShell 4 is aware of the schema changes in Windows 2012 R2 and fails if those properties aren't available. A schema upgrade is supposed to fix the problem. I'll try and test that over the weekend

  • #11303
    Profile photo of Richard Siddaway
    Richard Siddaway
    Moderator

    Just tested it and performing a schema upgrade fixes the problem running Get-AdUser with -property * (or -properties *) on a Windows 2012 R2 machine with PowerShell 4. Don't have a Windows 8.1 VM handy but I'd be very surprised if that combination didn't work after a schema upgrade

  • #11345
    Profile photo of sponsen
    sponsen
    Participant

    Thanks a lot for solving this issue!

    But as a side note, isn't it strange that they marked Accept Wildcard Characters? false ?

  • #11346
    Profile photo of Richard Siddaway
    Richard Siddaway
    Moderator

    The accept wildcards false is a documentation bug – the text for the parameter plainly states wildcards are accepted. The error was also present in earlier versions of the documentation

  • #11347
    Profile photo of sponsen
    sponsen
    Participant

    Ah. As long as it works, that's the important part 🙂

You must be logged in to reply to this topic.