Last active
July 29, 2021 13:53
-
-
Save Laim/41986376d0cb6f434dca7a3ec19f6c49 to your computer and use it in GitHub Desktop.
Copy Log files from Source Directory to Destination Directory via PowerShell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#<-----------------------------------------># | |
# > 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