The script appears to run just fine, the file count is correct, and logging indicates that all files were copied. However the backup folder has far fewer files in it that the original folder, and the number indicated by the script/log.
New to script and powershell so bear with me. I noticed that the script has two source dirs listed... $BackupDirs="C:\Users\Michael\ AppData\Roaming \TaskUnifier", "C:\Users\Micha el", ... I would assume that if I list a directory then it's subdirs are also copied? But then why is the AppData subdir listed above? Also, is there a way to exclude dir's like robocopy? Thanks
Hi, you are absolut correct, in this case the first directory is not necessary
Hello Michael, First, this is a wonderful script. I would like to implement this as scheduled task, though, for some computers. With that in mind, how can I set the script to close automatically when done? Thanks, Michael
First of all thanks for the Scritp, it's very usefull. I'll like to have the possibility to copy ACL's as well and Log Path Files +256 Caracters and save in Log file the Full Path for each file in order to identify the source if some error apear in any file copy. Thanks a lot for the help.
Hi, thanks for your question, will add the ACL feature to the next version. 256 characters is a limit of Powershelgl, so not sure how to deal with it, will give it a try. please rate
Please see excerpt of log file below. All files are being skipped when running your script. I have tried this on various servers and OS versions, and the problem persists. Any ideas as to where it is going wrong? 23.11.2015-15:16:19 - INFO: --------------- ------- 23.11.2015-15:1 6:19 - INFO: Start the Script 23.11.2015-15:1 6:19 - INFO: Check if there are more than 7 Directories in the Backupdir 23.11.2015-15:1 6:19 - INFO: Create Backupdir g:\Backups\Back up-2015-11-23-4 264\ 23.11.2015-15:1 6:19 - INFO: Move Log file to g:\Backups\Back up-2015-11-23-4 264\ 23.11.2015-15:1 6:19 - INFO: Continue with Log File at g:\Backups\Back up-2015-11-23-4 264\ 23.11.2015-15:1 6:19 - INFO: Check if BackupDir and Destination exists 23.11.2015-15:1 6:19 - INFO: Started the Backup 23.11.2015-15:1 6:19 - INFO: Count all files and create the Top Level Directories 23.11.2015-15:1 6:19 - INFO: There are 48 Files with 1.41 MB of Files to copy 23.11.2015-15:1 6:19 - ERROR: antenna returned an error and was not copied 23.11.2015-15:1 6:19 - ERROR: images returned an error and was not copied 23.11.2015-15:1 6:19 - ERROR: about.htm returned an error and was not copied 23.11.2015-15:1 6:19 - ERROR: antenna.css returned an error and was not copied 23.11.2015-15:1 6:19 - ERROR: contact.htm returned an error and was not copied
Hi, maybe you have no access to source or destination, start Script as admin.
Your script appears to work but I notice the following error that appears after every file that is copied. Cannot find an overload for "IndexOf" and the argument count: "2". At C:\software\BackupScript\Backu pScript.ps1:145 char:36 + $Index=[array]: :IndexOf <<<< ($BackupDirs,$B ackup)+1 + CategoryInfo : NotSpecified: (:) [], MethodException + FullyQualifiedE rrorId : MethodCountCoul dNotFindBest Any ideas? Thanks Bruce
Hi, what PowerShell Version are you running? Run "$host.version" in PowerShell Window, maybe you are running 2.0, ther could be the Problem, please install PowerShell v3 http://www.microsoft.com/en-us /download/detai ls.aspx?id=3459 5