Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple & Free XP Imaging Solution

Imaging and Archiving Systems

Simple & Free XP Imaging Solution

by  computerhighguy  Posted    (Edited  )
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"

Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top