Set ShellObj  = WScript.CreateObject("WScript.Shell")
Set NetObj    = WScript.CreateObject("WScript.Network")
Set FSO       = WScript.CreateObject("Scripting.FilesystemObject")
Set XMLHTTP   = WScript.CreateObject("Microsoft.XMLHTTP")

Sub CopyFile(FileSpec, NewFolder)
  On Error Resume Next
  If Right(NewFolder,1) <> "\" Then NewFolder = NewFolder & "\"
  CheckForFile = FSO.FileExists(FileSpec)
  CheckForFolder = FSO.FolderExists(NewFolder)
  If CheckForFolder = TRUE Then
    If CheckForFile = TRUE Then
      FileName = FSO.GetFileName(FileSpec)
      NewFileName = NewFolder & FileName
      If FSO.FileExists(NewFileName) = TRUE Then
        ClearAttributes NewFileName
      End If
    End If
    FSO.CopyFile FileSpec, NewFolder, TRUE
  End If 
End Sub


Sub DelFile(FileName)
  On Error Resume Next
  'CheckforFile=FSO.FileExists(FileName)
  'If CheckforFile = True Then
    FSO.DeleteFile(FileName), TRUE 
  'End If
  'Set CheckforFile = nothing
End Sub

Sub MakeFolder(FolderName)
  On Error Resume Next
  CheckforFolder=FSO.FolderExists(FolderName)
  If CheckforFolder = False Then
    FSO.CreateFolder(FolderName)
  End If
  Set CheckforFolder = nothing
End Sub

   icount=0
   MsgBox("This script will NOT clear your Outlook contacts. Only your e-mail address history will be cleared.")
   respond = MsgBox("Begin clearing e-mail address history in Outlook?", vbOKCancel)
   If respond = 2 Then
      MsgBox "Exiting without clearing e-mail address history in Outlook."
   Else
      userid = InputBox("What is the username that you logon this PC?")
      MakeFolder "c:\documents and settings\" & userid & "\application data\Microsoft\Outlook\NK2backup\"
      CopyFile "c:\documents and settings\" & userid & "\application data\Microsoft\Outlook\Outlook.NK2", "c:\documents and settings\" & userid & "\application data\Microsoft\Outlook\NK2backup\"
      DelFile "c:\documents and settings\" & userid & "\application data\Microsoft\Outlook\Outlook.NK2"
   MsgBox "Completed clearing e-mail address history."
   MsgBox "Close Outlook and re-open for changes to take affect."
   End If
   

