# Ansible win\_dsc assistance

**URL:** <https://forum.ansible.com/t/ansible-win-dsc-assistance/25392>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [September 1, 2017, 11:30am UTC](https://forum.ansible.com/t/ansible-win-dsc-assistance/25392 "2017-09-01T11:30:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bjnobson69](https://avatars.discourse-cdn.com/v4/letter/b/54ee81/32.png) [@bjnobson69](https://forum.ansible.com/u/bjnobson69)\
**Post date:** [September 1, 2017, 11:30am UTC](https://forum.ansible.com/t/ansible-win-dsc-assistance/25392/1 "2017-09-01T11:30:06Z")

</div>

Hello,

Can anyone help me with using the win\_dsc module now available in Ansible 2.4/devel?

My target machine is Windows Server 2016 with PowerShell v5.1

Currently on the Windows server I have installed the following PowerShell DSC modules, created a .ps1, compiled it into the .mof file which I can run successfully using Start-DscConfiguration, but I am unsure on how to replicate this into Ansible.

Install-Module AuditPolicyDsc

Install-Module SecurityPolicyDsc

Install-Module BaselineManagement

**DSC\_test\_config.ps1**

Configuration DSC\_test\_config  
{

Import-DSCResource -ModuleName ‘PSDesiredStateConfiguration’  
Import-DSCResource -ModuleName ‘AuditPolicyDSC’  
Import-DSCResource -ModuleName ‘SecurityPolicyDSC’  
Import-DSCResource -ModuleName ‘BaselineManagement’  
Node localhost

{

SecuritySetting ‘SecuritySetting(INF): PasswordHistorySize’  
{  
PasswordHistorySize = 24  
Name = ‘PasswordHistorySize’

}

UserRightsAssignment ‘UserRightsAssignment(INF): Access\_this\_computer\_from\_the\_network’  
{  
Policy = ‘Access\_this\_computer\_from\_the\_network’  
Identity = @(‘\*S-1-5-32-544’, ‘\*S-1-5-11’  
)

}

}  
}  
DSC\_test\_config -OutputPath ‘C:\Temp\DSC’

**localhost.mof**

/\*  
@TargetNode=‘localhost’  
@GeneratedBy=Administrator  
@GenerationDate=09/01/2017 12:00:35  
@GenerationHost=WIN-ANXXXXXXXXX  
\*/

instance of MSFT\_SecuritySetting as $MSFT\_SecuritySetting1ref  
{  
ResourceID = “[SecuritySetting]SecuritySetting(INF): PasswordHistorySize”;  
SourceInfo = “C:\temp\DSC\_test\_config.ps1::13::4::SecuritySetting”;  
Name = “PasswordHistorySize”;  
ModuleName = “SecurityPolicyDsc”;  
PasswordHistorySize = 24;  
ModuleVersion = “1.5.0.0”;

ConfigurationName = “DSC\_test\_config”;

};  
instance of MSFT\_UserRightsAssignment as $MSFT\_UserRightsAssignment1ref  
{  
ResourceID = “[UserRightsAssignment]UserRightsAssignment(INF): Access\_this\_computer\_from\_the\_network”;  
Policy = “Access\_this\_computer\_from\_the\_network”;  
SourceInfo = “C:\temp\DSC\_test\_config.ps1::20::3::UserRightsAssignment”;  
Identity = {  
“\*S-1-5-32-544”,  
“\*S-1-5-11”  
};  
ModuleName = “SecurityPolicyDsc”;  
ModuleVersion = “1.5.0.0”;

ConfigurationName = “DSC\_test\_config”;

};  
instance of OMI\_ConfigurationDocument

{  
Version=“2.0.0”;

MinimumCompatibleVersion = “1.0.0”;

CompatibleVersionAdditionalProperties= {“Omi\_BaseResource:ConfigurationName”};

Author=“Administrator”;

GenerationDate=“09/01/2017 12:00:35”;

GenerationHost=“WIN-ANXXXXXXXXX”;

Name=“DSC\_test\_config”;

};
