Create a local Admin user from AD with power shell script

PerserPolis-1732 1,971 Reputation points
2022-03-16T15:50:27.72+00:00

Hi,

I want to create a local Admin user on the client machine from existing AD user. For example the AD user is called "smustermann" but the local admin user on the client machine should be called "smustermannChief"

The password should be the same password as Windows domain user password.

Can I do that with a power shell script?

Regards

Windows for business | Windows Server | User experience | PowerShell
Windows for business | Windows Server | User experience | Other
0 comments No comments

13 answers

Sort by: Most helpful
  1. PerserPolis-1732 1,971 Reputation points
    2022-03-17T07:21:57.683+00:00

    Hi,

    I know what you mean. I have a domain group with domain user or I have a CSV file. The computer are all in domain. I have a OU named "CO" with all computers from the Department "CO" and the same OU "CO" which are all the ad users from that Department "CO"

    For example

    The user "smustermann" has the computer (is called srv02)

    Regards

    Was this answer helpful?

    0 comments No comments

  2. Andreas Baumgarten 133.1K Reputation points MVP Volunteer Moderator
    2022-03-17T07:03:01.657+00:00

    Hi @PerserPolis-1732 ,

    do you have some kind of "mapping/reference table" which user is mapped/related to which computer?
    I think this is required because how you know which local user should be created on which computer?

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten

    Was this answer helpful?

    0 comments No comments

  3. PerserPolis-1732 1,971 Reputation points
    2022-03-17T06:52:00.5+00:00

    Hi Andreas, Thameur,

    I know how I can add a domain user in local Administrator. I can do that with GPO. But as I mention the domain is called "smustermann" and I want to have so that the local admin should be called from "smustermann" but "smustermannChief". What I mean with password I do not want to import the password.

    The domain ad user is called "smustermann" and is created on AD. The local admin user should be called on the client machine "smustermannChief" and it should be come from AD based of "smustermann". Is that possible?

    Regards

    Was this answer helpful?

    0 comments No comments

  4. Andreas Baumgarten 133.1K Reputation points MVP Volunteer Moderator
    2022-03-16T18:11:27.81+00:00

    Hi @PerserPolis-1732 ,

    in addition to Thameur-BOURBITA: It's not possible to "read" the password of a domain user to use it in a script to create a local user.
    In my opinion it doesn't make sense anyway because there will be no sync if the domain user password is changed.

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten

    Was this answer helpful?

    0 comments No comments

  5. Thameur-BOURBITA 36,536 Reputation points Moderator
    2022-03-16T17:32:31.757+00:00

    Hi
    You can add the domain user in local administrators group. You don't need to create a local for that.

    Please don't forget to mark helpful reply as answer

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.