Forum Discussion

goatboy's avatar
goatboy
Level 6
10 years ago

EVSVR - extract multiple files in batch mode

Hi EV 9.0.2 I need to use EVSVR to extract 1000s of files. e.g. evsvr interactive ds 1B12861C18E81BC4DAF1E6A2602E0ECBF1110000vaultamericas 201408168190507~201408160406260000~Z~7...
  • goatboy's avatar
    10 years ago

    One of my scripting gurus came up with this powershell script, in case anyone is interested. Change F:\temp and data.csv as needed. Data.csv should look like:

    1A37922FFA291944494A84F24515820B91110000vaultamericas,201312197433041~201312172129370000~Z~4005840D68DE14BB8B1F5A4F80E15AE1
    1A37922FFA291944494A84F24515820B91110000vaultamericas,201312207525766~201312191625230000~Z~504D79DE7B77BE51572720F5A2D92D31
    1B12861C18E81BC4DAF1E6A2602E0ECBF1110000vaultamericas,201312177281316~201312171045530000~Z~714ED6511C67D129E2DDFCAB229124F1

    ----------START OF SCRIPT-------------

    $out = "F:\temp"
    $ErrorActionPreference= 'silentlycontinue'

    foreach($line in gc data.csv){
     $tID = $line.split(",")[0] -replace "~", "{~}"
     $sID = $line.split(",")[1] -replace "~", "{~}"

     $id = (start-process "D:\Program Files (x86)\Enterprise Vault\evsvr.exe" -passthru).id
     start-sleep -s 2

     [void] [System.Reflection.Assembly]::LoadWithPartialName("'Microsoft.VisualBasic")
     [Microsoft.VisualBasic.Interaction]::AppActivate("D:\Program Files (x86)\Enterprise Vault\evsvr.exe")

     [void] [System.Reflection.Assembly]::LoadWithPartialName("'System.Windows.Forms")
     [System.Windows.Forms.SendKeys]::SendWait("Interactive")

     [void] [System.Reflection.Assembly]::LoadWithPartialName("'System.Windows.Forms")
     [System.Windows.Forms.SendKeys]::SendWait("~")

     [void] [System.Reflection.Assembly]::LoadWithPartialName("'System.Windows.Forms")
     [System.Windows.Forms.SendKeys]::SendWait("ds $tID $sID -o $out")

     [void] [System.Reflection.Assembly]::LoadWithPartialName("'System.Windows.Forms")
     [System.Windows.Forms.SendKeys]::SendWait("~")

     [void] [System.Reflection.Assembly]::LoadWithPartialName("'System.Windows.Forms")
     [System.Windows.Forms.SendKeys]::SendWait("exit")

     [void] [System.Reflection.Assembly]::LoadWithPartialName("'System.Windows.Forms")
     [System.Windows.Forms.SendKeys]::SendWait("~")

     [void] [System.Reflection.Assembly]::LoadWithPartialName("'System.Windows.Forms")
     [System.Windows.Forms.SendKeys]::SendWait("exit")

     [void] [System.Reflection.Assembly]::LoadWithPartialName("'System.Windows.Forms")
     [System.Windows.Forms.SendKeys]::SendWait("~")

     while(get-process -id $id){
      start-sleep -s 2
     }

     stop-process -id $id
     start-sleep -s 2
    }