System status backup script

Source: Internet
Author: User

System status backup script
Save the following script as 'backup system status in vbs format, name it by Date, and delete the backup file strFolder = "D: \ SystemBackup" strFileName = Date ()&". BAK "intKeepDay = 4 strBackupCmd =" Ntbackup.exe backup systemstate/J "" timed backup system status "_ &"/F "" & strFolder & strFileName & "Set objFSO = CreateObject ("Scripting. fileSystemObject ") Set objFolder = objFSO. getFolder (strFolder) Set objFiles = objFolder. filesFor Each objFile In objFilesIf objFile. dateCreated <D Ate ()-intKeepDay And Right (objFile. name, 3) = "BAK" ThenobjFile. deleteEnd IfNext Set ob1_shshell = CreateObject ("WScript. shell ") Return = obw.shshell. run (strBackupCmd, 0, True) If Return = 0 thenob1_shshell. logEvent 0, Now () & "backup system status succeeded" elseobw.shshell. logEvent 1, Now () & "backup System status failed" End If script Description: Script Function: Back up Windows System status (System State) to the specified directory, and delete the backup that is earlier than the specified number of days. Usage: (1) create a directory SystemBackup on the partition with sufficient disk space and copy the script to the directory. Generally, the size of each system status backup file is 600-1000 MB. Make sure that there is sufficient disk space. (2) modify the following part of the script, set the backup file storage directory, file name suffix, and backup file retention days as needed: strFolder = "D: \ SystemBackup" strFileName = Date ()&". BAK "intKeepDay = 4 (3) After the configuration is complete, you can directly run the script. After the test is normal, we recommend that you configure the script to run as a scheduled task; (4) make sure that the system service "Task Scheduler" has been started and the startup mode is set to "automatic". (5) Add a scheduled Task from "Control Panel" to "scheduled Task, enter C: \ Windows \ system32 \ cscript.exe "D: \ SystemBackup \ SysBackup in" run. enter "D: \ systemBackup" in "starting from" vbs "and" running mode "to configure a user account with sufficient permissions (Administrator Account or account already added to Ba Ckup Operators group user account ). Set "Schedule" to "once a day" and "Start time" to idle time. For example, check whether the task is correctly configured between-(6. If the script runs successfully or not, you can view the "application" log of Windows logs.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.