Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...Congratulations on a brilliant idea and a great site..."

Geography

Where in the world do Tek-Tips members come from?

VBScript FAQ

Imaging and Archiving Systems

Simple & Free XP Imaging Solution
Posted: 30 Jan 08

Every wanted to automate the imaging of your mom's XP system?  How about that friend that always seems to mess up his computer and you have to reload the OS.  Well never fear!!  This little script, along with DriveImageXML (it is free by the way), will automatically image that XP machine to the same drive or another drive.  You pick.  Make sure DriveImageXML is installed and adjust the path if necessary.  I use the task scheduler and set this run once a month.  You could even modify this script to map a netwrk drive and image it there.  Good luck!!

Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objWshShell = WScript.CreateObject("WScript.Shell")
Set objNetwork = CreateObject("WScript.Network")

' // Path to the dixml.exe file (Drive Image XML is a free imaging product)
DIXMLPath = """c:\program files\runtime software\driveimage xml\dixml.exe"""
' // Path to where you will be imaging the system to.  Cannot us UNC pathnames for this.
oldImagePath = "D:\Backups\"

' // This section assumes that the clock on your PC is somewhat accurate
CurrentYear = Year(Date) & MonthName(Month(Date),true)

' \\ Check to see if the current year directory exists
' \\ -1 = exists    0 = doesn't exist
isFolder = objFSO.FolderExists(oldImagePath & CurrentYear)

if isFolder = 0 then
    'wscript.echo "Doesn't Exist"
    set makeFolder = objFSO.CreateFolder(oldImagePath & CurrentYear)
end if


' \\ Checking to see if the computer has already been archived once.
' \\ Check to see if the current directory exists
' \\ -1 = exists    0 = doesn't exist
isFolder = objFSO.FolderExists(oldImagePath & CurrentYear)

if isFolder = 0 then
    set makeFolder = objFSO.CreateFolder(oldImagePath & CurrentYear & "\" & UCase(computerName))
    dirPath = oldImagePath & CurrentYear & "\" & computerName
else
    i = 1
    dirExists = "no"
    Do Until dirExists = "yes"
        isFolder = objFSO.FolderExists(oldImagePath & CurrentYear & "\" & computerName & i)
        if isFolder = 0 then
            set makeFolder = objFSO.CreateFolder(oldImagePath & CurrentYear & "\" & UCase(computerName & i))
            dirPath = oldImagePath & CurrentYear & "\" & computerName & i
            dirExists = "yes"
        else
            i = i + 1
        end if
    Loop
end if


' // This section will open up the drive C image on the local machine to make sure it s good and to let you know that it worked.
objWshShell.Run DIXMLPath & "/bC /s- /v /c /t" & dirPath & "\Drive_C"


Back to VBScript FAQ Index
Back to VBScript Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close