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.