Add-LocalGroupMember does not work properly

This topic contains 1 reply, has 1 voice, and was last updated by  Rainer 2 weeks, 2 days ago.

  • Author
    Posts
  • #81065

    Rainer
    Participant

    Hi,

    I reduced the code sniplet I am reffering to to some lines:

    $UserName         = "A6-R306TN97"
    $UserPassword     = "depp"
    $UserPasswordEnc  = $UserPassword | ConvertTo-SecureString -AsPlainText -Force
    New-LocalUser -Name $UserName -Password $UserPasswordEnc
    Add-LocalGroupMember -Member $UserName -Group Benutzer
    

    We are having about 450 PCs for students and since a long time, the computername is the same as the local username.

    When I add a user to the machine with the script above, the user is added, but it is not visible in the user Access control.
    We found out (via computermanagement -> compmgmt.msc), that the user is not Show als a member of the Group "Users".

    Although: When I do retype the Add-LocalGroupMember line it says, that it is already there.
    Adding Users with the same username as the machine Name in the UAC works fine.

    Any idea?

  • #81083

    Rainer
    Participant

    Forgot to mention: OS is Win 7 64bit.

You must be logged in to reply to this topic.