Announcement

Collapse
No announcement yet.

Using executable via login script

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using executable via login script

    I am trying to use a tool called NK2View in order to delete an NK2 file entry from a group of user computers and their profiles. Basically, I need to verify if something like this would work. The following example is in KiXtart

    Code:
    ;kixtart script version 1.0 for kixtart v4.5+
    ;------------------------------------------------------------------------------------------------------------------------------------
    ;Modified By: Zach Crawford, ALFA Insurance Companies
    ;------------------------------------------------------------------------------------------------------------------------------------
    Dim $ServerName, $nk2, $ProfilePath, $SearchString, $Username, $ComputerName, $Date, $SharePath, $ProgramPath, $CmdString, $RunLine, $CmdLine, $V[2], $Str, $Position, $StrA, $StrB	
    ;
    ;Edit Variables
    ;
    $ServerName = 
    ;For example $ServerName = "Server1" or "Server1.yourdomain.com"
    $nk2 = ReadValue('HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders', 'AppData')
    $ProfilePath = $nk2+"\Microsoft\Outlook\Outlook.nk2"
    ;For example $ProfilePath = "%USERPROFILE%\Application Data\Microsoft\Outlook\Outlook.NK2", or "Null"
    $SearchString = 
    ;
    ;-------------------------------------------------------------------------------------------------------------------------------------------
    ;-------------------------------------------------------------------------------------------------------------------------------------------
    If @KIX < 4.5
    	MessageBox("Your version of KiXtart is out of date.  This script requires at least version 4.5.  Download the" +		" correct version of KiXtart or modify this script to run on your version.","Script  Error",64)
    	Goto EOF
    EndIf
    $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\*.nk2')=1  
    ;Searches for files ending with .NK2 and creates backup.  
    	Move($nk2+'\Microsoft\Outlook\*.nk2') ($nk2+'\Microsoft\Outlook\*[email protected][email protected][email protected][email protected]')
    EndIf
    
    $CmdString = $ProgramPath + "/nk2file " + $ProfilePath
    
    :SearchDelete
    $Runline = $CmdString + " /delete " + $SearchString
    GoTo CmdLine
    
    :CmdLine
     Shell $Runline
    
    :EOF
    Exit
    Exit
    I am trying to run this against people who have multiple versions of Outlook and who are a mix of XP and Vista. Any help is appreciated!

  • #2
    Re: Using executable via login script

    This is a modified version of what I am trying to do, so I need some serios help. I tried to run this from the command line using the KIX32 executable, but I keep getting a zero (0) after it runs. It doesn't make any changes:

    Code:
    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\*[email protected][email protected][email protected][email protected]')
    EndIf
    
    $CmdString = $ProgramPath + "/nk2file " + $ProfilePath
    
    :SearchDelete
    $Runline = $CmdString + " /delete " + $SearchString
    GoTo CmdLine
    
    :CmdLine
     Shell $Runline
    
    :EOF
    Exit
    Exit

    Comment

    Working...
    X