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 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
$containerPrefix = '10.111.110.0/24' | |
$sharedPrefix = '10.111.0.0/16' | |
$vmprefix = '10.111.111.0/24' | |
$vmPrefixLength = 24 | |
$SharedGw = '10.111.111.1' | |
$vmNatSwitchName = 'NAT' | |
$null = Get-ContainerNetwork | Remove-ContainerNetwork -Force -ErrorAction SilentlyContinue | |
$null = Get-NetNat | Remove-NetNat -Confirm:$false -ErrorAction SilentlyContinue | |
$null = Get-VMSwitch -Name $vmNatSwitchName -ErrorAction SilentlyContinue | Remove-VMSwitch -Force -Confirm:$false -ErrorAction Stop |
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
$deserialized = [psobject][ordered]@{ | |
'string' = 'this is a string' | |
'double' = [double]::MaxValue | |
'fileInfo' = 'C:\' | |
'__castme' = { | |
param($myself) | |
switch (($myself|Get-Member -MemberType NoteProperty).Name) | |
{ | |
'string' {$myself.string = $myself.string } | |
'double' {$myself.double = [double]($myself.double) } |
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
$pshost = get-host | |
$pswindow = $pshost.ui.rawui | |
$newsize = $pswindow.windowsize | |
$newsize.height = 8 | |
$newsize.width = 80 | |
$pswindow.windowsize = $newsize | |
$pswindow.buffersize = $newsize | |
cls;while ($true){ | |
$temp = gwmi MSAcpi_ThermalZoneTemperature -Namespace "root/wmi" | |
$ProgressParams = @{ |