我在PS中创建一个脚本,它将在1小时内每隔3分钟将进程信息添加到.log文件中。这是我的代码。我究竟做错了什么?
$w3wpproc = Get-Process -Name w3wp | ft -View process
$ieproc = Get-Process -Name iexplore | ft -View process
$data = Get-Date
For($data; $data.ToShortTimeString() -le "15:00"; $data.AddMinutes("3"))
{
$w3wpproc | Out-File "c:\logs_proces\iis_worker.log" -Append | Add-Content "c:\logs_proces\iis_worker.log `n"
$ieproc | Out-File "c:\logs_proces\iexplorer.log" -Append | Add-Content "c:\logs_proces\iexplorer.log `n"
}