Mythicsoft Knowledge Base

Full Text Search
»

Controlling FileLocator Network using PowerShell

RSS
FileLocator Network ships with a number of .NET libraries which can be used to control the application through .NET aware environments such as PowerShell.

Example 1: PowerShell script to list all saved searches in the database

[System.Reflection.Assembly]::LoadFrom("c:\program files\mythicsoft\filelocator network\Mythicsoft.flr.core.dll")
$dataSearch = new-object -typename Mythicsoft.FLR.Data.Manage.SearchData
$search = $dataSearch.getSearch("%")
$search.Rows | foreach-object { $_.SearchNm }



Example 2: PowerShell script to open a saved search called 'MySearch' and run it

[System.Reflection.Assembly]::LoadFrom("c:\program files\mythicsoft\filelocator network\Mythicsoft.flr.core.dll")
[System.Reflection.Assembly]::LoadFrom("c:\program files\mythicsoft\filelocator network\Mythicsoft.flr.monitor.dll")
[Mythicsoft.FLR.Shared.ThreadObjectMgr]::init()
$dataSearch = new-object -typename Mythicsoft.FLR.Data.Manage.SearchData
$search = $dataSearch.getSearch("MySearch")[0]

$dataTarget = new-object -typename Mythicsoft.FLR.Data.Manage.SearchTargetData
$t = 0
$targets = $dataTarget.getActiveTargetsForSearch( $search.SearchId, [ref]$t )

				
$mgr = new-object -typename Mythicsoft.FLR.Core.Client.SearchMgr
$run = $mgr.startManualSearch( $search.SearchId, $search.SearchCriteriaDs, $search.TransportTypeCd, $true, "user", "password" )

$eventFinished = new-object -typename System.Threading.EventWaitHandle($false, [System.Threading.EventResetMode]::AutoReset )
$eventStop = new-object -typename System.Threading.EventWaitHandle( $false, [System.Threading.EventResetMode]::AutoReset )
$monitor = new-object -typename Mythicsoft.FLR.Monitor.Command.MonitorThread( $eventStop, $eventFinished )

$monitor.monitorSearchRun( $run )

[Mythicsoft.FLR.Shared.ThreadObjectMgr]::close()

Mythicsoft KB powered by ScrewTurn Wiki. Some of the icons created by FamFamFam.