Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function LoadParameters {
- if ($PSScriptRoot) {$ScriptPath = $PSScriptRoot} else {$ScriptPath = "C:\EIC\Deploy"}
- [xml]$Script:XML = Get-Content "$ScriptPath\Settings.xml"
- $SpecialNodes = @("Hosts","DNSRecords","DerivedParameters")
- $ExclusionXPath = ""
- $SpecialNodes | % { $ExclusionXpath += "[not(self::$_)]" }
- $ConfigNodes = $XML | Select-XML -XPath "//Configuration/*$ExclusionXpath"
- $ConfigNodes | % { $_.Node.ChildNodes.Name | % { Set-Variable $_ -Value ($xml.SelectSingleNode("//$_").innertext) -Scope Script } }
- $XML.Configuration.Hosts.ChildNodes | % { Set-Variable $_.Name -Value $_ -Scope Script }
- $DerivedParameters = $xml | Select-XML -XPath "//Configuration/DerivedParameters"
- $DerivedParameters | % { $_.Node.ChildNodes.Name | %{ Set-Variable $_ -Value (& ([scriptblock]::create("$($xml.SelectSingleNode(""//$_"").innertext)"))) -Scope Script -Force }}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement