File management tasks have the advantage of automating file management, such as transferring outdated files, copying important files, and so on. It performs a scheduled task on the specified file, in conjunction with the file classification feature.
Lab Environment:
LON-DC1 WIN2012R2 domain Controller
LON-SVR1 WIN2012R2 member Server
One, expired file transfer
First set up the Docs folder and the Expired Files folder in the C drive, and create a new File1,file2,file3 file, file1 and file2 input "inquiry", File3 content is empty. We then set the File1 and File2 's properties to Yes by using the FSRM classification feature. (Refer to the first post in this series for specific steps)
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/4D/D9/wKioL1RbCxjDQvxiAAPmVXuWIeM874.jpg "title=" QQ picture 20141106134305.jpg "alt=" Wkiol1rbcxjdqvxiaapmvxuwiem874.jpg "/>
Let's start with a file expiration test, create a new task in the File Management task test Expired file, scope set to C:\Docs, action select "File Expires", file expiration directory is set to C:\Expired files.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/4D/DA/wKioL1RbDTPSdoC9AAMmqczPSX8190.jpg "title=" QQ picture 20141106135208.jpg "alt=" Wkiol1rbdtpsdoc9aammqczpsx8190.jpg "/>
Set the conditions because our files are new, so set the number of days since last modified file to 0, the actual environment needs to be set according to their requirements, or you can set "days since last access to the file" as a condition.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/4D/DB/wKiom1RbEJDQhY6xAAT0EdwviIQ605.jpg "title=" QQ picture 20141106140707.jpg "alt=" Wkiom1rbejdqhy6xaat0edwviiq605.jpg "/>
Set up an execution plan
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/4D/DB/wKiom1RbDkTjJHHlAAPSAOgmZcw606.jpg "title=" QQ picture 20141106135822.jpg "alt=" Wkiom1rbdktjjhhlaapsaogmzcw606.jpg "/>
Right click on the Set up task, select "Run File Management task now", if you want to see the report you can select "Wait for task complete" in the pop-up option.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/4D/DA/wKioL1RbEofCtp_eAAQu4wlGV5Q576.jpg "title=" QQ picture 20141106141455.jpg "alt=" Wkiol1rbeofctp_eaaqu4wlgv5q576.jpg "/>
After the completion of the task, we open the Expired Files folder of the C drive, you can see a series of subfolders, the first layer of the sub-folder on behalf of the server name, the second level of sub-folders on behalf of the task run time, the third layer of sub-folders to represent the expired file of the letter, The fourth-tier subfolder represents the folder to which the expired file belongs. You can see that the file1,file2,file3 have been transferred to the expired files file.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/4D/DB/wKiom1RbFD3ieZezAARNGUVFlT8549.jpg "title=" QQ picture 20141106142354.jpg "alt=" Wkiom1rbfd3iezezaarnguvflt8549.jpg "/>
Open the Docs folder and the expired files have been transferred to the expired Files folder, so there are no files in the Docs folder.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/4D/DA/wKioL1RbFRPCP1oXAAP94JFICRY905.jpg "title=" QQ picture 20141106142547.jpg "alt=" Wkiol1rbfrpcp1oxaap94jficry905.jpg "/>
Ii. Copy of documents
If we don't want to move the source files, just want to copy one copy for archiving or backup, then we can't use the file expiration function, here we can set up PowerShell in the operation options to achieve the purpose.
First Open Notepad, write the code in, then save it as a Copyitem.ps1 file and save it in the C drive. In addition, set up a backup folder in the C drive, which is used to store the copy file after performing the file management task.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/4D/DB/wKiom1RbFsOQTgqnAAP-aPyqpFc069.jpg "title=" QQ picture 20141106143430.jpg "alt=" Wkiom1rbfsoqtgqnaap-apyqpfc069.jpg "/>
Then we open FSRM, new file Management task copy files, scope C:\Docs, action select "Custom", executable: C:\Windows\System32\WindowsPowerShell\v1.0\ Powershell.exe, Parameter:/C c:\copyitem.ps1-sourcefile, choose Insert variable to select the source file path to insert it behind-sourcefile
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/4D/DB/wKiom1RbGBexcx-zAAUoO5fEJUQ178.jpg "title=" QQ picture 20141106144014.jpg "alt=" Wkiom1rbgbexcx-zaauoo5fejuq178.jpg "/>
And then we set the condition, I only copy the classification properties of the file with the "Yes" value.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/4D/DA/wKioL1RbGO_hpEbGAAPbrB1xCPM458.jpg "title=" QQ picture 20141106144215.jpg "alt=" Wkiol1rbgo_hpebgaapbrb1xcpm458.jpg "/>
Finally, the scheduled execution time is specified, and the management task is completed. We immediately run this new management task to see if File1 and File2 are still present in the Docs folder, and whether File1 and File2 files appear in the backup folder.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/4D/DB/wKiom1RbGYWRB02YAARjNLb6iqM098.jpg "title=" QQ picture 20141106144620.jpg "alt=" Wkiom1rbgywrb02yaarjnlb6iqm098.jpg "/>
Through the above experiment, you can see the powerful file management task, it greatly reduces the time IT staff to maintain file data, and do not have to write long script files, as long as the simple in FSRM set a few steps to achieve the desired purpose.
This article is from the "Dry Sea Sponge" blog, please be sure to keep this source http://thefallenheaven.blog.51cto.com/450907/1573431
Windows Server 2012 File Server Resource Manager (FSRM) (3)---file management tasks