So I need to add a domain user to the local machines administrators group. Luckily, or so I thought, I could simply use Chef's group provider to do this.
I wrote the step in my cookbook as follows:
This works great the first time, but will fail after that with the following error:
ArgumentError: The specified account name is already a member of the group.
A quick search, and you'll find that this is a known issue, open since end of March.
So until Windows support becomes a priority, we are stuck with a workaround. We have some options, WMI, .Net, Ruby, or Net.exe calls.
I am sure there is a better way, but I went with the following: