Jump to content

Recommended Posts

Posted

Here's what I do with my System State backups:

I have two scripts that are task scheduled to run daily.

 

The 1st script backs up the System State and stores it on another server (else what's the point - if the server failed and you cannot recover your system state backups!)

To stop these backup files clogging up the destination server's drives, the second script deletes all such files older than a configurable number of days.

 

If you'd like I can post the actual scripts here.

Posted
I'm always up for reading someone else's scripts. Ta. :D

 

Here is a nice simple one for you then....

 

ntbackup backup systemstate /J "stjohns01_systemstate_friday" /F "z:\stjohns01\system state\friday\stjohns01_systemstate_friday.bkf"  /V:yes /L:f /M normal

  • Thanks 1
Posted

Don't forget that if you backup the systemstate you don't need a second job to backup the c: drive or systemdrive as that's done at the same time.

 

Ben

Posted
Don't forget that if you backup the systemstate you don't need a second job to backup the c: drive or systemdrive as that's done at the same time.

 

Ben

 

I have a belt and braces approach, the system state daily [ so I always have 7 copies ] to a NAS box, then a FULL back using Backup exec to tape......[ including the system state again....]

Posted
Don't forget that if you backup the systemstate you don't need a second job to backup the c: drive or systemdrive as that's done at the same time.

 

Ben

 

That's not correct. System State backs up AD (if run on a DC), the registry and some system files but in no way does it back up the entire system drive.

 

Anyway, here are the scripts I use. I didn't write the 1st - the author's details are in it:

'===========================================================================
' Name: SystemStateBackup.vbs
' Version: 2.0
' Author: Jeremy Lawrence
' Bug Reports & Enhancement Req: [email protected]
'
' Main Function:	Performs a System State Backup on WinXP, Win2K, and Win2k3
'===========================================================================
DIM strDate
DIM strComputerName
DIM strBytes

Set WshNetwork = WScript.CreateObject("WScript.Network")
strComputerName = WshNetwork.ComputerName
strDate = month(Now) & "-" & day(Now) & "-" & year(Now)
Const HARD_DISK = 3


strComputer = "."

Set objWMIService = GetObject("winmgmts:" _
   & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colDisks = objWMIService.ExecQuery _
   ("SELECT * FROM Win32_LogicalDisk WHERE DriveType = " _
       & HARD_DISK & "")
For Each objDisk in colDisks
   strBytes = FormatNumber((objDisk.FreeSpace / 1073741824),2)
   If strBytes <= 0.30 then
   Wscript.Echo "You do not have enough disk space to place the System State backup on this drive.  Please find another location."
Else

  '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  '@ Uncomment this line if you want an interactive process
  '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
   'Wscript.Echo objDisk.DeviceID & " has " & " " & strBytes & "GB of space available"
End If

Next

Set oWshShell = CreateObject("WScript.Shell")


'@@@@@@@@@@@@@@@@@@@@@@@@@
'@ Comment one of the next two statements out, depending on your
'@ preferences. Also, you must change the path if using the 1st statement
'@@@@@@@@@@@@@@@@@@@@@@@@@
strDest="Your path here" 
'strDest= inputbox("Please enter the location you would like to save the system state.  The location must have a minimum 300MB of space." & vbCr & vbCr & "Example:  C:\Systemstate","CSC System State Backup","C:\systemstate")



oWshShell.Run "ntbackup backup systemstate /f " & strDest & "\Systemstate" & "_" & strDate & "_" & strComputerName & ".bkf /m copy"

 

As I've stated before, these backup files will rapidly clog drive space, so I use the 2nd script to delete any such files older than seven days. Here's the script to do that:

'========================================================

' This script removes SystemState

' backups from a directory that are older than 7 days.

'========================================================

 

Set fso = CreateObject("Scripting.FileSystemObject")

olddate = DateAdd("d", -7, date)

 

'@@@@@@@@@@@@@@@@@@@@@@@@@@@

'@ Change the path below to match your setup

'@@@@@@@@@@@@@@@@@@@@@@@@@@@

 

Set folder = fso.GetFolder("Your path here")

Set fc = folder.Files

For Each f1 In fc

if f1.DateLastModified < olddate Then

'wscript.stdout.write "Removing: " & f1.DateLastModified & vbtab & f1.name & VbCrLf

fso.deletefile(f1)

End if

Next

 

This can of course be used for all sorts of purposes, like a drop-box folder that acts as a tempory storage facility.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...