Skip to content

Instantly share code, notes, and snippets.

Last active July 29, 2021 13:53
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Laim/41986376d0cb6f434dca7a3ec19f6c49 to your computer and use it in GitHub Desktop.
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