Last active
December 18, 2021 00:34
-
-
Save cyberautomate/d321cb0b41102a4fec445759c5d512ab to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| configuration DisableFirewall { | |
| param () | |
| Import-DscResource –ModuleName 'NetworkingDsc' | |
| Node localhost | |
| { | |
| FirewallProfile DisableFirewall | |
| { | |
| Name = 'Domain' | |
| Enabled = 'True' | |
| } | |
| } | |
| } | |
| # **NOTE:** The code above is the actual node configuration, everything below is used to create and stage the mof files | |
| # Set the output path | |
| $outputPath = 'C:\DSC\Node_Configs' | |
| # Generate the MOF | |
| DisableFirewall -outputPath $outputPath | |
| # Generate the Checksum for the MOF | |
| New-DscChecksum -Path $outputPath -OutPath $outputPath -Verbose | |
| # Move Config to Configurations folder on Pull Server | |
| # $session = New-PSSession SVR19 | |
| $source = "$outputPath\*" | |
| $Dest = 'C:\Program Files\WindowsPowerShell\DscService\Configuration' | |
| Copy-Item -Path $Source -Destination $Dest -Recurse -Force -Verbose | |
| # Package and Publish the NetworkingDsc Module | |
| $ModuleList = @("NetworkingDsc") | |
| Publish-DscModuleAndMof -Source C:\DSC -ModuleNameList $ModuleList -Force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment