Automation

 View Only
  • 1.  Inconsistent parameter naming: New-VMHostAccount

    Posted Aug 30, 2008 06:14 PM

    @vmware, regarding the new-vmhostaccount cmdlet and these params:

       ParameterSet: User
    
    Name         Type     IsMandatory Pipeline
    ----         ----     ----------- --------
    Id           String          True    False
    Password     String          True    False
    Description  String         False    False
    UserAccount  Boolean        False    False
    AssignGroups String[]       False    False
    Server       VIServer       False     True
    
    
       ParameterSet: Group
    
    Name         Type     IsMandatory Pipeline
    ----         ----     ----------- --------
    Id           String          True    False
    GroupAccount Boolean        False    False
    AssignUsers  String[]       False    False
    Server       VIServer       False     True
    • I think Id should be renamed to Name. I know that we call them user IDs at the OS level (esp on Unix), but in Windows and hence VC, they are referred as user_names_. Plus you have to consider that this is overloading the ID parameter in comparison to many of the Get cmdlets which of course use ID to mean the MoRef (in string format).

    • as mentioned in another thread, Server should accept arrays pretty please.

    • Having two params which are used to select the right parameter set (UserAccount and GroupAccount) is confusing I think. What if someone were to type "new-vmhostaccount -useraccount:$false"? I'll tell you--it creates a user account anyway.

    PS > New-VMHostAccount -Id "bob"
    New-VMHostAccount : Parameter set cannot be resolved using the specified named parame
    ters.
    At line:1 char:18
    + New-VMHostAccount  <<<< -Id "bob"
    PS > New-VMHostAccount -Id "bob" -UserAccount:$false
    
    cmdlet New-VMHostAccount at command pipeline position 1
    Supply values for the following parameters:
    Password: foo
    
    Id              Description          Groups
    --              -----------          ------
    bob                                  {users}

    Please consider re-working this set of params.

    Author of the upcoming book: Managing VMware Infrastructure with PowerShell

    Co-Host, PowerScripting Podcast (http://powerscripting.net)



  • 2.  RE: Inconsistent parameter naming: New-VMHostAccount

    Posted Aug 30, 2008 06:46 PM

    Wow, I just realized that this also collides with the user or group ID in the /etc/passwd sense. If you use VI Client to connect directly to an ESX server (which of course is the same context you have when using new-vmhostaccount), the VIC will allow you to create users and groups and specify the UID or GID...This makes my point even more important.






    Author of the upcoming book: Managing VMware Infrastructure with PowerShell

    Co-Host, PowerScripting Podcast (http://powerscripting.net)