Hi all, I was using the cAdministrativeTemplateSetting DSC Resource part of PolicyFileEditor module ( https://github.com/dlwyatt/PolicyFileEditor) in a DSC script and it works fine. Here are the resource's properties:
cAdministrativeTemplateSetting [String] #ResourceName { KeyValueName = [string] PolicyType = [string]{ Administrators | Machine | NonAdministrators | User } [Data = [string[]]] [DependsOn = [string[]]] [Ensure = [string]{ Absent | Present }] [PsDscRunAsCredential = [PSCredential]] [Type = [Int32]{ Binary | DWord | ExpandString | MultiString | None | QWord | String | Unknown }] } It has a property called Type which is a map of strings to integers ( https://github.com/dlwyatt/PolicyFileEditor/blob/master/DscResources/PshOrg_AdminTemplateSetting/PshOrg_AdminTemplateSetting.schema.mof ): [write,ValueMap{"0","1","2","3","4","7","11","-1"},Values{"Unknown","String" ,"ExpandString","Binary","DWord","MultiString","QWord","None"}] sint32 Type; When using in my DSC script it works fine, I can use *DWord *or *String *as an argument for the *Type *property. Check my Script: Configuration LocalGPO { param ( [string[]] $NodeName = 'localhost' ) Import-DSCResource -ModuleName PolicyFileEditor Node $NodeName { cAdministrativeTemplateSetting "RDP Users Home Directory Path" { # SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services!WFHomeDirUNC # SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services!WFHomeDir # SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services!WFHomeDirDrive KeyValueName = "SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services\WFHomeDir" PolicyType = "Machine" Data = "\\servershare\test" Ensure = "Present" Type = "String" } cAdministrativeTemplateSetting "RDP Users Home Directory Letter" { KeyValueName = "SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services\WFHomeDirDrive" PolicyType = "Machine" Data = "X:" Ensure = "Present" Type = "String" } cAdministrativeTemplateSetting "RDP Users Home Directory UNC boolean" { KeyValueName = "SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services\WFHomeDirUNC" PolicyType = "Machine" Data = "1" Ensure = "Present" Type = "Dword" } } } LocalGPO Start-DscConfiguration -Path .\LocalGPO -Wait -Force -Verbose My Ansible Script (first attempt): --- - hosts: windows-ansible tasks: # GPO rule - name: "RDP Users Home Directory Path" win_dsc: resource_name: cAdministrativeTemplateSetting Ensure: "Present" KeyValueName: "SOFTWARE\\Policies\\Microsoft\\Windows NT\\Terminal Services\\WFHomeDir" PolicyType: "Machine" Data: "\\\\servershare\\test" - name: "RDP Users Home Directory Letter" win_dsc: resource_name: cAdministrativeTemplateSetting Ensure: "Present" KeyValueName: "SOFTWARE\\Policies\\Microsoft\\Windows NT\\Terminal Services\\WFHomeDirDrive" PolicyType: "Machine" Data: "X:" - name: "RDP Users Home Directory UNC boolean" win_dsc: resource_name: cAdministrativeTemplateSetting Ensure: "Present" KeyValueName: "SOFTWARE\\Policies\\Microsoft\\Windows NT\\Terminal Services\\WFHomeDirUNC" PolicyType: "Machine" Data: 1 #Also tried with: "1" Type: Dword # Also tried with: "DWord"; "[Microsoft.Win32.RegistryValueKind]::DWord" ... But in Ansible, using win_dsc I can't use these keywords (*Dword, String*). It will fail with the error: fatal: [mymachine.mydomain.com]: FAILED! => {"Data": "1", "Ensure": "Present", "KeyValueName": "SOFTWARE\\Policies\\Microsoft\\Windows NT\\Terminal Services\\WFHomeDirUNC", "PolicyType": "Machine", "Type": "Dword", "attributes": [{"Key": "Type", "Name": "Type", "Value": "Dword"}, { "Key": "Ensure", "Name": "Ensure", "Value": "Present"}, {"Key": "Data", "Name": "Data", "Value": "1"}, {"Key": "KeyValueName", "Name": "KeyValueName", "Value": "SOFTWARE\\Policies\\Microsoft\\Windows NT\\Terminal Services\\WFHomeDirUNC"}, {"Key": "PolicyType", "Name": "PolicyType", "Value": "Machine"}], "changed": false, "dsc_attributes": { "Data": "1", "Ensure": "Present", "KeyValueName": "SOFTWARE\\Policies\\Microsoft\\Windows NT\\Terminal Services\\WFHomeDirUNC", "PolicyType": "Machine", "Type": "Dword"}, "failed": true, "msg": "Convert property 'Type' value from type 'STRING' to type 'SINT32' failed\r\n At line:12, char:2\r\n Buffer:\r\nirectResourceAccess\";\n};^\n\ninsta\r\n", "reboot_required": null, "resource_name": "cAdministrativeTemplateSetting"} In the end, I managed to put it to work using the *integer *value that corresponded to *DWord*, but I would expect that *DWord *keyword would work on win_dsc. - name: "RDP Users Home Directory UNC boolean" win_dsc: resource_name: cAdministrativeTemplateSetting Ensure: "Present" KeyValueName: "SOFTWARE\\Policies\\Microsoft\\Windows NT\\Terminal Services\\WFHomeDirUNC" PolicyType: "Machine" Data: "1" Type: 4 #DWord #"[Microsoft.Win32.RegistryValueKind]::DWord" # ## from the MOF file: ## [write,ValueMap{"0","1","2","3","4","7","11","-1"},Values{"Unknown","String","ExpandString","Binary","DWord","MultiString","QWord","None"}] sint32 Type; ... -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/b72d4e37-c47b-4759-9d17-320a3238dde0%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.