Create windows user with chef and add user to the local Administrators group

Mike Robinet

Chef documentation for the user resource: http://docs.getchef.com/resource_user.html

Doing this works:

user "TestUser" do
  password "p@ssw0rd"
end

But when I add a gid it fails:

user "TestUser" do
  password "p@ssw0rd"
  gid "Administrators"
end

I've also tried passing .\Administrator, but get the same result:

[2014-08-08T14:00:11-07:00] FATAL: ArgumentError: user[TestUser] (test::users line 11) had an error: ArgumentError: The user does not belong to this group.

Is the purpose of gid not to specify group membership?

Mike Robinet

Eventually figured it out. The trick is to modify the group like so:

user "TestUser" do
  password "p@ssw0rd"
end

group "Administrators" do
  action :modify
  members "TestUser"
  append true
end

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to add a domain user to Administrators group in Windows 10

From Dev

How do I add Azure Active Directory User to Local Administrators Group

From Dev

Access denied adding domain user to local administrators group

From Dev

cygwin: Administrator user not a member of Administrators group

From Dev

Chef Windows: Create the home directory when creating Windows User

From Dev

Chef Windows: Create the home directory when creating Windows User

From Dev

Adding group to local administrators

From Dev

A bit more challenging - Batch script to add domain user to local administrator group Windows 7

From Dev

Add domain group to local computer administrators command line

From Dev

Chef knife create failing to create an API user

From Dev

How to add LDAP user to existing local group in RHEL?

From Dev

Windows 10: Force logged on user to update its local group membership

From Dev

unable to create a user in chef ( ruby error )

From Dev

create no-login user using chef

From Dev

Adding System user to local group

From Dev

Create specific GID for a group and add a user to it on Mac OS X 10.5

From Dev

How to create user having member in multiple groups in chef user resource

From Dev

How to create a local windows user account using remote powershell?

From Dev

Can powershell be used to create local user accounts in windows?

From Dev

How do I create a local user in Windows 8.1?

From Dev

How to create a user group in Windows 7 machine that belongs to a domain?

From Dev

Add group to system user on Android

From Dev

Add user to SSH group safe?

From Dev

Add user to default "Users" group

From Dev

How to add a user to a group in FreeBSD

From Dev

AWS IAM add user to group

From Dev

Create a file as a different user and group

From Dev

Change Password of a local windows user

From Dev

In Windows Adding a domain account to the local administrators group. What problems can arise?

Related Related

  1. 1

    How to add a domain user to Administrators group in Windows 10

  2. 2

    How do I add Azure Active Directory User to Local Administrators Group

  3. 3

    Access denied adding domain user to local administrators group

  4. 4

    cygwin: Administrator user not a member of Administrators group

  5. 5

    Chef Windows: Create the home directory when creating Windows User

  6. 6

    Chef Windows: Create the home directory when creating Windows User

  7. 7

    Adding group to local administrators

  8. 8

    A bit more challenging - Batch script to add domain user to local administrator group Windows 7

  9. 9

    Add domain group to local computer administrators command line

  10. 10

    Chef knife create failing to create an API user

  11. 11

    How to add LDAP user to existing local group in RHEL?

  12. 12

    Windows 10: Force logged on user to update its local group membership

  13. 13

    unable to create a user in chef ( ruby error )

  14. 14

    create no-login user using chef

  15. 15

    Adding System user to local group

  16. 16

    Create specific GID for a group and add a user to it on Mac OS X 10.5

  17. 17

    How to create user having member in multiple groups in chef user resource

  18. 18

    How to create a local windows user account using remote powershell?

  19. 19

    Can powershell be used to create local user accounts in windows?

  20. 20

    How do I create a local user in Windows 8.1?

  21. 21

    How to create a user group in Windows 7 machine that belongs to a domain?

  22. 22

    Add group to system user on Android

  23. 23

    Add user to SSH group safe?

  24. 24

    Add user to default "Users" group

  25. 25

    How to add a user to a group in FreeBSD

  26. 26

    AWS IAM add user to group

  27. 27

    Create a file as a different user and group

  28. 28

    Change Password of a local windows user

  29. 29

    In Windows Adding a domain account to the local administrators group. What problems can arise?

HotTag

Archive