Dim $ServerName, $nk2, $ProfilePath, $SearchString, $SharePath, $ProgramPath, $CmdString, $RunLine, $CmdLine
;
;Edit Variables
;
$ServerName =
;For example $ServerName = "Server1" or "Server1.yourdomain.com"
$nk2 = ReadValue('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders', 'AppData')
$ProfilePath = $nk2+"\Microsoft\Outlook\"
;For example $ProfilePath = "%USERPROFILE%\Application Data\Microsoft\Outlook\Outlook.NK2", or "Null"
$SearchString =
;
;-------------------------------------------------------------------------------------------------------------------------------------------
;-------------------------------------------------------------------------------------------------------------------------------------------
$SharePath = "\\" + $ServerName + "\nk2view\"
$ProgramPath = $SharePath + "nk2view.exe"
;This section fills in the default NK2 path
If $ProfilePath = "Null"
$ProfilePath = "%USERPROFILE%\Application Data\Microsoft\Outlook\Outlook.NK2"
EndIf
If Exist($nk2+'\Microsoft\Outlook\*.bak*')=1
;Searches for files ending with .BAK and that may have anything appended and then stops script if condition is true
Goto EOF
EndIf
If Exist($nk2+'\Microsoft\Outlook\*.nk2')=1
;Searches for files ending with .NK2 and creates backup.
Move($nk2+'\Microsoft\Outlook\*.nk2') ($nk2+'\Microsoft\Outlook\*.bak+@YEAR+@MONTHNO+@MDAYNO+@TIME')
EndIf
$CmdString = $ProgramPath + "/nk2file " + $ProfilePath
:SearchDelete
$Runline = $CmdString + " /delete " + $SearchString
GoTo CmdLine
:CmdLine
Shell $Runline
:EOF
Exit
Exit