start-transcript无法在Powershell中捕获“读取主机”

时间:2020-05-26 12:30:21

标签: powershell

我正在尝试捕获powershell脚本的日志,但是没有捕获“读取主机”信息。我的代码如下:

#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

但是它不会记录针对读取主机给出的内容。我的日志如下:


脚本已启动,输出文件为。\ refreshv5-05-26-2020-0827.log 要刷新的目标RDS的名称是什么?


它确实包含针对$ rdsid传递了什么值

0 个答案:

没有答案