# Correct way to use the Group Resource

**URL:** <https://forums.powershell.org/t/correct-way-to-use-the-group-resource/3132>\
**Category:** DSC\
**Created:** [September 18, 2014, 9:45am UTC](https://forums.powershell.org/t/correct-way-to-use-the-group-resource/3132 "2014-09-18T09:45:43Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![michael-felkins](https://avatars.discourse-cdn.com/v4/letter/m/a9adbd/32.png) [@michael-felkins](https://forums.powershell.org/u/michael-felkins)\
**Post date:** [September 18, 2014, 9:45am UTC](https://forums.powershell.org/t/correct-way-to-use-the-group-resource/3132/1 "2014-09-18T09:45:43Z")

</div>

Hi,

I am trying to create some local groups and add Domain members to those groups.

So far I have this:

$systemID = $env:COMPUTERNAME

$ConfigurationData = @{  
AllNodes = @(  
@{  
NodeName=$systemID  
PSDscAllowPlainTextPassword=$true  
}  
}  
}

$securedstring = ConvertTo-SecureString -String $Password -AsPlainText -Force  
[PSCredential]$cred = New-Object System.Management.Automation.PSCredential ($UserName, $securedstring)

Group sitecore\_ro {  
GroupName = “sitecore\_ro”  
Ensure = “Present”  
Description = “sitecore\_ro”  
Members = “$Domain\Dept\_IT Dev”  
#Members = @(“$Domain\Dept\_IT Dev”)  
Credential = $cred  
}

It creates the group but does not add the members to the group.

Could some one post an example of the correct way to write this?  
Also, I need to add more than one user or group, so is the Members = @(“$Domain\Dept\_IT Dev”,“user1”,“user2”)  
format the correct way to do this?

TIA

The Old Dog

---

<div class="post-metadata">

**Author:** ![matt-thompson](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@matt-thompson](https://forums.powershell.org/u/matt-thompson)\
**Post date:** [September 19, 2014, 3:00am UTC](https://forums.powershell.org/t/correct-way-to-use-the-group-resource/3132/2 "2014-09-19T03:00:41Z")

</div>

I’ve had the same issue as discussed in my post here - [https://powershell.org/forums/topic/issue-adding-users-to-a-group/](https://powershell.org/forums/topic/issue-adding-users-to-a-group/)

Don replied to me and pointed me towards some info that may help you. I’ve been busy and haven’t had a chance to dig back into it myself so I can’t really help you out any further than to point you to my thread and Dons reply.

---

<div class="post-metadata">

**Author:** ![windows-liveuser78](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/windows-liveuser78/32/702_2.png) [@windows-liveuser78](https://forums.powershell.org/u/windows-liveuser78)\
**Post date:** [September 19, 2014, 3:30am UTC](https://forums.powershell.org/t/correct-way-to-use-the-group-resource/3132/3 "2014-09-19T03:30:51Z")

</div>

Are you getting an error? If so, can you post it?

---

<div class="post-metadata">

**Author:** ![michael-felkins](https://avatars.discourse-cdn.com/v4/letter/m/a9adbd/32.png) [@michael-felkins](https://forums.powershell.org/u/michael-felkins)\
**Post date:** [September 19, 2014, 9:17am UTC](https://forums.powershell.org/t/correct-way-to-use-the-group-resource/3132/4 "2014-09-19T09:17:21Z")

</div>

I get this error message:

The PowerShell provider MSFT\_GroupResource threw one or more non-terminating errors while running the  
Set-TargetResource functionality. These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational  
Refer to this channel for more details.  
+ CategoryInfo : InvalidOperation: (🙂 , CimException  
+ FullyQualifiedErrorId : NonTerminatingErrorFromProvider  
+ PSComputerName : DSCTESTIAPP

One more thing, I am trying this on Windows 2008R2 server. I have noticed that some of the resources only work on 2012 servers.

---

<div class="post-metadata">

**Author:** ![windows-liveuser78](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/windows-liveuser78/32/702_2.png) [@windows-liveuser78](https://forums.powershell.org/u/windows-liveuser78)\
**Post date:** [September 19, 2014, 9:38am UTC](https://forums.powershell.org/t/correct-way-to-use-the-group-resource/3132/5 "2014-09-19T09:38:34Z")

</div>

What is the error in the Microsoft-Windows-DSC/Operational (Applications and Services Logs \> Microsoft \> Windows \> Desired State Configuration \> Operational) event log?

---

<div class="post-metadata">

**Author:** ![michael-felkins](https://avatars.discourse-cdn.com/v4/letter/m/a9adbd/32.png) [@michael-felkins](https://forums.powershell.org/u/michael-felkins)\
**Post date:** [September 22, 2014, 6:14am UTC](https://forums.powershell.org/t/correct-way-to-use-the-group-resource/3132/6 "2014-09-22T06:14:19Z")

</div>

This event indicates that a non-terminating error was thrown when DSCEngine was executing Set-TargetResource on MSFT\_GroupResource provider.  
FullyQualifiedErrorId is COMException. ErrorMessage is Exception calling “FindByIdentity” with “2” argument(s): “Unknown error (0x80005000)”.

Old Dog

---

<div class="post-metadata">

**Author:** ![michael-felkins](https://avatars.discourse-cdn.com/v4/letter/m/a9adbd/32.png) [@michael-felkins](https://forums.powershell.org/u/michael-felkins)\
**Post date:** [September 22, 2014, 7:35am UTC](https://forums.powershell.org/t/correct-way-to-use-the-group-resource/3132/7 "2014-09-22T07:35:09Z")

</div>

If I comment out the members line, the script runs without an error. It can’t seem to find the members…  
The members are on a different, trusted domain and I can add them to the groups with a simple

Net localgroup “Performance Log Users” “[otherdomain.com](http://otherdomain.com)\user” /add

I wonder if this is a “feature” of DSC?

BTW, the Group Resource adds the group and description with no problems.

Mike

---

<div class="post-metadata">

**Author:** ![windows-liveuser78](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/windows-liveuser78/32/702_2.png) [@windows-liveuser78](https://forums.powershell.org/u/windows-liveuser78)\
**Post date:** [September 22, 2014, 1:09pm UTC](https://forums.powershell.org/t/correct-way-to-use-the-group-resource/3132/8 "2014-09-22T13:09:55Z")

</div>

That’s what I thought. The Group resource only works when everything is on the same domain. Computer, members, etc. Sad trombone. I’m not sure there is any workaround. It doesn’t look like anyone has contributed a fix.

Here is a PowerShell Connect issue I’ve filed about this. It covers two issues: you have to supply credentials when talking to any AD, even if that instance is world readable, and those credentials and the members being added to the group must be on the same domain. Feel free to give it an up vote:  
[https://connect.microsoft.com/PowerShell/feedbackdetail/view/957378/dsc-group-resource-fails-to-add-a-domain-user-to-a-local-group-without-domain-credentials](https://connect.microsoft.com/PowerShell/feedbackdetail/view/957378/dsc-group-resource-fails-to-add-a-domain-user-to-a-local-group-without-domain-credentials)

---

<div class="post-metadata">

**Author:** ![aubrey-ekstrom](https://avatars.discourse-cdn.com/v4/letter/a/b782af/32.png) [@aubrey-ekstrom](https://forums.powershell.org/u/aubrey-ekstrom)\
**Post date:** [January 21, 2015, 7:56am UTC](https://forums.powershell.org/t/correct-way-to-use-the-group-resource/3132/9 "2015-01-21T07:56:31Z")

</div>

I had problems with this myself, and I finally figured it out and got it working! Using your code as an example. My 2 “minor” changes (not minor when your pulling your hair out) in BOLD:

```
$systemID = $env:COMPUTERNAME

$ConfigurationData = @{
 AllNodes = @(
 @{
 NodeName=$systemID
 PSDscAllowPlainTextPassword=$true
 }
 }
 }

$securedstring = ConvertTo-SecureString -String $Password -AsPlainText -Force
 [PSCredential]$cred = New-Object System.Management.Automation.PSCredential ([b]$Domain\[/b]$UserName, $securedstring)

Configuration AddUsersToGroup

        Node $systemID {

Group sitecore_ro {
 GroupName = "sitecore_ro"
 Ensure = "Present"
 Description = "sitecore_ro"
 Members[b]ToInclude[/b] = "$Domain\Dept_IT Dev"
 Credential = $cred
 }
}

AddUsersToGroup -ConfigurationData $ConfigurationData
```

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 9:17pm UTC](https://forums.powershell.org/t/correct-way-to-use-the-group-resource/3132/10 "2024-05-16T21:17:24Z")

</div>

Closed on May 16, 2024, 9:17pm UTC


