# Issue with dsc\_resource string to string\[\]

**URL:** <https://discourse.chef.io/t/issue-with-dsc-resource-string-to-string/13933>\
**Category:** Chef Infra (archive)\
**Created:** [November 2, 2018, 5:47pm UTC](https://discourse.chef.io/t/issue-with-dsc-resource-string-to-string/13933 "2018-11-02T17:47:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![itjarl1984](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/itjarl1984/32/2309_2.png) [@itjarl1984](https://discourse.chef.io/u/itjarl1984)\
**Post date:** [November 2, 2018, 5:47pm UTC](https://discourse.chef.io/t/issue-with-dsc-resource-string-to-string/13933/1 "2018-11-02T17:47:54Z")

</div>

I am attempting to use the PowerShell DSC resource xSmbShare in a dsc\_resource. It has a property that requires a powershell string array.

Using DSC directly, you would specify like this: FullAccess = @("User1")

so I attempt to use dsc\_resource "" do property :FullAccess, "User1" but I get a powershell error when running the resource stating "cannot convert string to string"

So i attempted to modify this:  
class WebsiteBindings  
@bindings =   
def initialize(bindings)  
@bindings = bindings  
end  
def to\_psobject()  
bindings = Array.new()  
@bindings.each do |b|  
bindings.push("(new-ciminstance -classname MSFT\_xWebBindingInformation -Namespace  
root/microsoft/Windows/DesiredStateConfiguration -Property @{Protocol=#{b[:protocol]};IPAddress=#  
{b[:ip]};Port=#{b[:port]}} -ClientOnly)")  
end  
"ciminstance[]"  
end  
end  
bindings = WebsiteBindings.new([  
{ protocol: 'HTTP', ip:'127.0.0.1', port: 8080},  
{ protocol: 'HTTP', ip: '127.0.0.1', port: 8081} ])

To just create a powershell string array rather than an array of powershell ciminstances, but I am unable to get it to work.

Any suggestions?

---

<div class="post-metadata">

**Author:** ![stankmaster](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/stankmaster/32/2181_2.png) [@stankmaster](https://discourse.chef.io/u/stankmaster)\
**Post date:** [November 2, 2018, 6:00pm UTC](https://discourse.chef.io/t/issue-with-dsc-resource-string-to-string/13933/2 "2018-11-02T18:00:11Z")

</div>

I have several DSC resources that I've used where certain properties have required array values. In these instances, I simply wrapped the values in brackets '[' ']' within the dsc\_resource construct, which is the way to express array literals in Ruby. Have you given that a try?

---

<div class="post-metadata">

**Author:** ![itjarl1984](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/itjarl1984/32/2309_2.png) [@itjarl1984](https://discourse.chef.io/u/itjarl1984)\
**Post date:** [November 2, 2018, 6:12pm UTC](https://discourse.chef.io/t/issue-with-dsc-resource-string-to-string/13933/3 "2018-11-02T18:12:33Z")

</div>

This has at least changed the error. Thank you for the help. Should have looked for the simple solution before the complex one.
