Created
December 18, 2017 09:26
-
-
Save poojarsn/b80cbd9f597b72a3aa07c8ff2dc8f3f3 to your computer and use it in GitHub Desktop.
Powershell Read xml configuration
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
<?xml version="1.0" encoding="utf-8"?> | |
<InstallSettings> | |
<WebsiteRootPath>C:\inetpub\wwwroot\my\website</WebsiteRootPath> | |
</InstallSettings> | |
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
$ConfigPath = "C:\Software\Sitecore\SIMS\Script\InstallConfiguration.config" | |
#region Global Variable | |
$global:websiteRootPath =""; | |
#endregion | |
#region functions | |
function New-ConfigSettings([string] $configPath) | |
{ | |
Write-Host "Started: Intialise and reading of configuration is in progress..."; | |
[xml]$configXml = Get-Content ($configPath); | |
$global:websiteRootPath = $configXml.InstallSettings.WebsiteRootPath | |
Write-Host "End: Intialise and reading of configuration is completed successfully"; | |
} | |
#endregion | |
New-ConfigSettings $ConfigPath | |
#read global variable | |
write-host $global:websiteRootPath |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment