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?