Skip to content

Instantly share code, notes, and snippets.

@Laim
Last active Jul 29, 2021
Embed
What would you like to do?
Copy Log files from Source Directory to Destination Directory via PowerShell
#<----------------------------------------->#
# > Author: Laim McKenzie
# > Date: 29-07-2021
# > Description: This script can be ran under a Scheduled Task and collect log files from the Source Directory and copy to the Destination Directory
# > Pre-requisites:
# > 1. You need to ensure the Source Directory exists
# > 2. You need to ensure the Desitnation Directory exists
# > 3. The account running the scheduled task (if ran under one) needs to have access to both directories
# > Copyright (c) 2021 Laim McKenzie
#<----------------------------------------->#
[string]$source = "C:\ProgramData\ApplicationName\Logs\*"
[string]$destination = "C:\temp\"
Copy-item -Force -Recurse -Verbose $source -Destination $destination
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment