Skip to content

Instantly share code, notes, and snippets.

@cyberautomate
Last active December 18, 2021 00:34
Show Gist options
  • Select an option

  • Save cyberautomate/d321cb0b41102a4fec445759c5d512ab to your computer and use it in GitHub Desktop.

Select an option

Save cyberautomate/d321cb0b41102a4fec445759c5d512ab to your computer and use it in GitHub Desktop.
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