start-transcript does not capture 'Read-Host' in powershell

Viewed 221

I am trying to capture of logs of powershell Script but it does not capture "Read-Host" information. My Code looks like this:

#setting log files and path
$a=(Get-Date).ToString('MM-dd-yyyy-hhmm')
$B='Fresh'+'-'+$a
$Logfile = ".\$B.log" 
Start-Transcript -Path $Logfile   

Write-Host -BackgroundColor White -ForegroundColor Blue "What is the name of the target RDS to be refreshed?"
$rdsid=Read-Host "Unique ID""

Stop-Transcript

But it does not log what was given against Read Host. My logs looks like this :


Transcript started, output file is .\refreshv5-05-26-2020-0827.log What is the name of the target RDS to be refreshed?


and it does contain what value was passed against $rdsid

0 Answers
Related