Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Bring up log file

$
0
0

Good Morning i have the below powershell script, in the function -robocopy i set up a log file to be created if the directory does not exist which works great 

 

but what i would also like to be able to do is that when i run the function install after it copy everything to its right place it will bring up the log file that was created from the function _robocopy 

 

Thank you in Advance for you help.

 

Function _roboCopy 

{

 

    [CmdletBinding()]

param

(

[Parameter(Mandatory = $true, Position = 1)]

[string]

$sourceDir,

[Parameter(Mandatory = $true, Position = 2)]

[string]

$destDir

)

    if (Test-Path $sourceDir)

    {

        Robocopy.exe $sourceDir $destDir /e /purge

    }

    else

    {

        $_logString = "Non-Exist [$sourceDir]"

        _writeToLogFile ERROR $_logString

        return $false

    }

}

 

function _install

{

$_appEnvs = "development","uat","production"

foreach ($_appEnv in $_appEnvs)

{

    _roboCopy -sourceDir $_rootPath\$_appName\$_appEnv -destDir "$LocalDirectory\$_appEnv\ctp"

}

 

}


Viewing all articles
Browse latest Browse all 6937

Trending Articles