1

I am passing a powershell script through userdata to terraform ec2 windows instance, should I use Write-Host or Write-Output, so that the output from the script gets written to the execution log file.

if (!(Test-Path -Path $outputFile)) {
  Write-Warning "$outputFile does not exist`r`n"
}
else {
  Write-Host "$outputFile exists`r`n"
}
1
  • so that the output from the script gets written to the execution log file. is a loaded question. Are you looking for something similar to: https://www.powershellgallery.com/packages/ScriptLogger/1.1.1/Content/Functions%5CWrite-Log.ps1? If you want a less complicated version: stackoverflow.com/questions/7834656/… Commented Jun 18, 2020 at 3:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.