Skip to content

Commit 889d06d

Browse files
committed
Add new Get-ConfigFromXml and Get-InstallUtil
1 parent facb2ea commit 889d06d

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<#
2+
.SYNOPSIS
3+
Will return a psobject from XML file generated by EnvironementSettingsGenerator
4+
.DESCRIPTION
5+
Will return a new psobject of format
6+
Property name being the settings name (i.e. Column A)
7+
Property Value is Innertext of generated xml node.
8+
.PARAMETER Xml
9+
Contents of an XML file passed as xml
10+
.EXAMPLE
11+
Get-ConfigFromXml -Xml ([xml](Get-Content $pathToXmlFile))
12+
Explanation of what the example does
13+
.NOTES
14+
EnvironmentSettingsGenerator is a tool authored by Thomas F. Abraham under MIT license
15+
Available at : https://github.com/tfabraham/EnvironmentSettingsManager
16+
Documentation : http://www.tfabraham.com/BTDFDocs/V5_0/DeploymentFrameworkForBizTalkDocs.html?EnvironmentSettingsExporterEnvir.html
17+
#>
18+
function Get-ConfigFromXml{
19+
param(
20+
$Xml
21+
)
22+
23+
process{
24+
foreach ($Setting in @($Xml.settings)) {
25+
$psobject = New-Object psobject
26+
foreach($Node in @($Setting.property)){
27+
$psobject | Add-Member NoteProperty $Node.name $Node.InnerText
28+
}
29+
return $psobject
30+
}
31+
}
32+
}
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<#
2+
.SYNOPSIS
3+
Will return full path to the installutil.exe on the executing machine
4+
.DESCRIPTION
5+
Will retrive full path to installutil.exe as not available as standard in %PATH%
6+
.PARAMETER x86
7+
If provided will retrieve the x86 (32bit) version
8+
.EXAMPLE
9+
Set-Alias installutil (Get-InstallUtil)
10+
Will set an alias installutil to have the value returned by this function.
11+
#>
12+
function Get-InstallUtil {
13+
param(
14+
[switch] $x86
15+
)
16+
17+
$runTimeDir = [System.Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory()
18+
$exe = Resolve-Path (Join-Path $runTimeDir 'installutil.exe')
19+
20+
if($x86){
21+
return $exe.Path.Replace('Framework64', 'Framework')
22+
}
23+
else{
24+
return $exe.Path
25+
}
26+
}

0 commit comments

Comments
 (0)