locked
Powershell script for data copy and event log RRS feed

  • Question

  • Hi,

    I need copy files from one(source) server to another(destination) server and want to log an event in case any failure happens for example if destination server is not available.

    I have tested the following command in a powershell script and its just working fine for copy to destination and then moving the files to archive. 

    Copy-Item "c:\copy\*" -Destination "\\server1\d$\testcopy" 
    Move-Item "c:\copy\*" -Destination "c:\Archive" 

    Please advise how can i log event in eventviewer in case of error or if script is not executed.

    Wednesday, April 20, 2016 4:08 PM