This file contains 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
function Global:Get-DscSplattedResource { | |
[CmdletBinding()] | |
Param( | |
[String] | |
$ResourceName, | |
[String] | |
$ExecutionName, | |
[hashtable] |
This file contains 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
foreach($Node in $ConfigurationData.AllNodes) { | |
# Retrieving the DSC Composite Resource name to include | |
$configurations = $ConfigurationData.Roles.($Node.Role).configurations | |
foreach($ConfigurationName in $configurations) { | |
$ConfigurationParameters = $ConfigurationData.Roles.($Node.Role).($ConfigurationName) | |
# Splat the Configuration Parameters defined in the Role to the Composite resource | |
&$ConfigurationName @ConfigurationParameters | |
} | |
} |
This file contains 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 MyDSCConfig { | |
Node $ConfigurationData.AllNodes.nodename { | |
if($Node.roles -contains 'MyRole') { | |
# do stuff here, like calling DSC Resources | |
MyCompositeResource StuffForMyRole { | |
# ... | |
} | |
} |
This file contains 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 MyConfig { | |
Param() | |
if($Node.Role -contains 'DHCPData' -and $Node.Customers -eq 'CustomerA') { | |
$Domain = $ConfigurationData.customerA.Domain | |
} | |
else { | |
$Domain = $ConfigurationData.DefaultDomain.Domain | |
} | |
File MyDomainFile { | |
Ensure = 'Present' |
This file contains 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
#Assuming you already have this hashtable | |
$MyHashes = @( | |
@{ | |
Ensure = 'Present' | |
Name = 'Putty' | |
Version = 'Latest' | |
ChocolateyOptions = @{ source = 'https://chocolatey.org/api/v2/' } | |
}, | |
@{ | |
Ensure = 'Absent' |
This file contains 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
#Assuming you already have this hashtable | |
$MyHashes = @( | |
@{ | |
Ensure = 'Present' | |
Name = 'Putty' | |
Version = 'Latest' | |
ChocolateyOptions = @{ source = 'https://chocolatey.org/api/v2/' } | |
}, | |
@{ | |
Ensure = 'Absent' |
This file contains 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
#Assuming you already have this hashtable | |
$MyHash = @{ | |
Ensure = 'Present' | |
Name = 'Putty' | |
Version = 'Latest' | |
ChocolateyOptions = @{ source = 'https://chocolatey.org/api/v2/' } | |
} | |
Configuration MyDscConfig { | |
$Allnodes.nodename { |
This file contains 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 MyDscConfig { | |
$Allnodes.nodename { | |
ChocolateyPackage Putty { | |
Ensure = 'Present' | |
Name = 'Putty' | |
Version = 'Latest' | |
ChocolateyOptions = @{ source = 'https://chocolatey.org/api/v2/' } | |
} | |
} | |
} |
This file contains 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
Function Export-StructuralUnitTestFromCommand { | |
param( | |
[parameter(Mandatory=$true,ValueFromPipelineByPropertyName = $true,ValueFromPipeline = $true)] | |
[System.Management.Automation.CommandInfo[]] | |
$command | |
) | |
begin { | |
$stringBuilder = New-object -TypeName System.Text.StringBuilder | |
$BuiltInParameters = ([Management.Automation.PSCmdlet]::CommonParameters + [Management.Automation.PSCmdlet]::OptionalCommonParameters) | |
} |
This file contains 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
Invoke-Expression (New-Object Net.WebClient).DownloadString(‘https://raw.githubusercontent.com/kilasuit/PoshFunctions/Dev/Scripts/Install-WMF5.ps1’) |