validate paths collecting from variable
Hi,

I have a Powershell script (paths.ps1) that has around 30 variables containing different paths. few variables are dependent on other variables to get part of the path and make the full path. Several other Powershell scripts actually use the script paths.ps1 to get the location of the different executable. What I want is to validate all paths under the variable and make sure all actually exist. I can use test-path command to validate the paths, but it's bit tricky to get the full paths from the variables. You can there are 3 level of dependency are available in the script. All I need to make sure is all paths are exist and print the full paths in a log with result.

----------------------------------
$AppServer = "\\FTS52009\"
$DbServer = "\\FTS53009\"
$FtpServer = "\\FTS72009\"

$automation = $AppServer + "automation\"
$loggen = $automation + "loggen.exe"
$FxTrading = $AppServer + "apps\fxtrading.exe"
$calc = $AppServer + "apps\calc.exe"
$surge = $DbServer + "process\data\surgeapp.exe"
$ftpincoming = $FtpServer + "incoming\"
$ftpoutgoing = $FtpServer + "outgoing\"
----------------------------------

I tried to read the content of the paths.ps1 by using Get-Content command and put all rows into an array. But how to deal with the dependency so one variable can get the path definitions from the variable it's dependent to?



  • Edited by cloudify Tuesday, August 25, 2015 2:01 PM
August 25th, 2015 1:50pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics