How to configure a scheduled tasks to move files from one location to another. We all of the files located on the reports drive in the source folder to the target folder, which is located on another machine in the same network. One important note to make is that both the source and the target folder have to be shared in order for the scheduled tasks to access them. So we just make sure that the source folder is shared. We go to reports, properties sharing and, as you can see, this is shared. We have to do the same for the target folder. This, however, is not shared, so I have to share it. We go to advanced, sharing check. This leave the share name as give permissions in this case I'll grant everyone full control.
I click apply, ok, apply, ok, and this is the target network fat which can be accessed from the other server. Let'S test it, so it was lab hyper-v or 1c. This is the admin share target so yeah. This is okay. This can the exit over the network. Now we will make use of a visual basic script in order to move the files from a location to another. I have already created the script, so I'll just explain to you guys to create it just go ahead and make a new text document and write this. So you write great object. Scripting file system object, move file, you'll have to replace this with your own pad. So this is the pad where the source for load folder is located, and this is the path where the target folder is located. We will implement this in our scheduled tasks, to save it as the visual basic script.
You go to file save as all files, and you have to give the extension of VBS save okay egos, so you go to start and by peon task. Scheduler open it in the library go, create basic tasks. You can aim select. When do you want tasks to run in this case, I will run it daily, so I go next. This is the time and the date of when this should start I'll leave it as it is for now action. It has to be start a program. Now we browse for the visual basic script, open it next change. So now we have tasks, configured go to properties, and we must make sure that this is set to run whether the user is logged in or not. This is basically allowing the task to run, even if the user specified above here, in this case it's not active on the computer or is not logged in run with highest privileges. If we want this task to run before everything else,
I will configure it for Windows Server. 2012 r2, because this is the version I'm using triggers this you can. This is where you can edit the start date and the are when this will start I'll, set it to 22. We occur every one day, stop tuskys, runs longer than say eight hours. They want to stop it automatically, not leave it running. If there's an error or something else, so you make sure that it's stopped. I click. Ok, here actions we are all set here. Conditions start the task. Only the computer is on AC power. You have a laptop and it's connected on the AC. The task will start, but if you disconnect it, as you can see here, the task will stop. So we make sure that this is not checked. We have. We need to run the task, even if the computer is on AC or battery power on settings.
You have to make sure that this is checked all the tasks to be run on the map. This will allow you to run the task whenever you want, and you don't have to wait for the schedule to trigger just click. Ok here and the credentials okay - and we all said now - we just need to test this, so I'm gon na have say I'll. Just like this file, the reports folder source, okay and run schedule, tasks to see if it gets moved to the target location which is on the other stuff, so go run refresh. As you can see the folder. The file is not here anymore, and it's here. Alright guys thank you for watching.