# Salted PsDscRunAsCredentials considered conflicting values

**URL:** https://forums.powershell.org/t/salted-psdscrunascredentials-considered-conflicting-values/9241
**Category:** DSC
**Created:** [August 27, 2017, 2:44pm UTC](https://forums.powershell.org/t/salted-psdscrunascredentials-considered-conflicting-values/9241 "2017-08-27T14:44:01Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![makediablogreatagain](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@makediablogreatagain](https://forums.powershell.org/u/makediablogreatagain)
#### Post date: [August 27, 2017, 2:44pm UTC](https://forums.powershell.org/t/salted-psdscrunascredentials-considered-conflicting-values/9241/1 "2017-08-27T14:44:01Z")

</div>

```
foreach ($node in $nodes) {
            Script $node {
                DependsOn = xxx
                PsDscRunAsCredential = $DomainCreds
                GetScript = { xxx }
                TestScript = { xxx }
                SetScript = { xxx }
            }
        }
}
```

The above code fails to run when credentials are encrypted. This looks like a bug, is it? why does it even complain, as those resources have different ID’s. Using wmf 5.1

error:

```
The resources ('[script]node1' and '[script]node2') have conflicting values of following properties: 'PsDscRunAsCredential'. Ensure that their values match.
```

on the mof itself it says something like:

PsDscRunAsCredential = MSFT\_CREDENTIAL\_REF1 for the first resource and PsDscRunAsCredential = MSFT\_CREDENTIAL\_REF2 for the second. Which makes little sense (i understand why it says so, but I mean, why would it complain about that), but I cant control it anyway so, wth?

---

<div class="post-metadata">

### Author: ![donj](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/donj/32/137_2.png) [@donj](https://forums.powershell.org/u/donj)
#### Post date: [August 28, 2017, 10:12am UTC](https://forums.powershell.org/t/salted-psdscrunascredentials-considered-conflicting-values/9241/2 "2017-08-28T10:12:09Z")

</div>

I’m not sure why they’re taking PsDscRunAsCredential as a key property - that does seem wrong. I’d file an issue on GitHub. But the ID isn’t the problem - that isn’t a key property, so its uniqueness doesn’t matter here.

---

<div class="post-metadata">

### Author: ![makediablogreatagain](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@makediablogreatagain](https://forums.powershell.org/u/makediablogreatagain)
#### Post date: [August 28, 2017, 10:51am UTC](https://forums.powershell.org/t/salted-psdscrunascredentials-considered-conflicting-values/9241/3 "2017-08-28T10:51:28Z")

</div>

what do you mean resourceId uniquness doesnt matter? I cant have 2 script resources in the same configuration unless they are identical (so useless)?

But anyway, how do I create several script resources if this behaves like this?

ps. there was an issue already ([Salted PsDscRunAsCredentials considered conflicting values across DSC resource instances · Issue #4138 · PowerShell/PowerShell · GitHub](https://github.com/PowerShell/PowerShell/issues/4138)) which got closed… so any point in opening another one?

---

<div class="post-metadata">

### Author: ![donj](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/donj/32/137_2.png) [@donj](https://forums.powershell.org/u/donj)
#### Post date: [August 28, 2017, 12:49pm UTC](https://forums.powershell.org/t/salted-psdscrunascredentials-considered-conflicting-values/9241/4 "2017-08-28T12:49:05Z")

</div>

Each resource defines for itself one or more “key properties.” Like, with the File resource, it’s the UNC, I think. Anyway, you can only define one resource block with a given key property value. Yes, the ID you assign - Node1, Node2 - does have to be unique, but that isn’t the only thing which has to be unique. No given resource can share the same key property values.

In this case, it would seem that the PSRunAsCredential is somehow being taken as a key property, meaning you can only use it once per configuration. That’s obviously dumb.

That issue was correct, but it was opened in the wrong place. I think you need to open it at [GitHub - PowerShell/DscResources: Central repository for PowerShell Desired State Configuration (DSC) resources.](https://github.com/PowerShell/DscResources).

---

<div class="post-metadata">

### Author: ![makediablogreatagain](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@makediablogreatagain](https://forums.powershell.org/u/makediablogreatagain)
#### Post date: [August 28, 2017, 1:17pm UTC](https://forums.powershell.org/t/salted-psdscrunascredentials-considered-conflicting-values/9241/5 "2017-08-28T13:17:37Z")

</div>

but the set-script properties are also different (at least when expanded). so how does it check for uniqueness?

---

<div class="post-metadata">

### Author: ![donj](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/donj/32/137_2.png) [@donj](https://forums.powershell.org/u/donj)
#### Post date: [August 28, 2017, 1:48pm UTC](https://forums.powershell.org/t/salted-psdscrunascredentials-considered-conflicting-values/9241/6 "2017-08-28T13:48:20Z")

</div>

The schema MOF for the resource determines what’s considered a key property. The Get/Set/Test aren’t, so they don’t count.

---

<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:16pm UTC](https://forums.powershell.org/t/salted-psdscrunascredentials-considered-conflicting-values/9241/7 "2024-05-16T21:16:38Z")

</div>


