How to redirect and append output to a log file from the copy-item -verbose command?


(1) not using powershell 3.0 cannot use 4>&1 > $logfilename

(2) tried using start-transcript , stop-transcript still output sceen on screen.


below copy-item.....
copy-item -path $sourchpath -destination $destinationpath  -force -recurse –verbose

the work around know of call script within instance of 'powershell.exe'. catch output simple redirecting logfile:

powershell.exe -noprofile -executionpolicy bypass -file "your script full path" > "your log file full path"
need full access directory contains log file. powershell.exe bit picky that.

wizend



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Edit Group Policy

Hyper-V VM not reaching OS 'Logon' screen

DNS question...