Skip to content

Instantly share code, notes, and snippets.

@AlexSen
Created June 3, 2017 13:49
Show Gist options
  • Save AlexSen/bb50666e950ac099c46ced0820e63d6e to your computer and use it in GitHub Desktop.
Save AlexSen/bb50666e950ac099c46ced0820e63d6e to your computer and use it in GitHub Desktop.
Script prepares arguments for external script, than runs external script and shows output
# Define external script paths and arguments
$ExternalScript_FullPath = "$((Get-Item $MyInvocation.MyCommand.Path).Directory.FullName)\ExternalScript.ps1"
$ExternalScript_Args = @{
$param = $value
}
# Run External Script and save output to variable
Invoke-Expression "$ExternalScript_FullPath @ExternalScript_Args" | Tee-Object -Variable ExternalScript_Output
# Show output
$ExternalScript_Output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment