Saving a find list

Paul Watson (101 posts)
April 7, 2016 03:33 PM
Accepted Answer
I need to find "DW_Prod" in all paths. I can use Tools > Find and Replace..., but how can I save the list into a plain text file?
This topic has an accepted answer. Jump to it.
Bill Staff (599 posts)
April 7, 2016 03:38 PM
Accepted Answer
There is no way to save the search results. I will write that up as an enhancement request.
Paul Watson (101 posts)
April 8, 2016 06:39 AM
Accepted Answer
Saving the list in a CSV file format using tabs should be possible.
Paul Watson (101 posts)
April 8, 2016 02:20 PM
Accepted Answer

I exported from adTempus to a text file and did some parsing on it. Not pretty, but it did generate a list.

C:>type dw_prod_scan.shsed 's/</\'$'\n/g' dw_prod_export.adtexport4 | \

    grep -i "dw_prod" | \

    grep -v phs_dmx_config | \

    grep -v ^-- | \

    sed -f dw_prod_scan.sed  >dw_prod_scan.txt

C:>type dw_prod_scan.sed

s/</\'$'\n/gs/.*D:/D:/

s/^ExecutionTarget>//

s/^Value>//

s/^NotificationMessage>//

s/^CommandLineParameters>//

s/^Description>//s/^--//

Bill Staff (599 posts)
April 8, 2016 04:54 PM
Accepted Answer

I guess I should have asked more about your goals and level of need. The search can be done programmatically through the adTempus API, so it would be possible to build, say, a PowerShell script to do this.

Like this one:

param (
    [string]$server = ".",
    [string]$find = $(throw "-find is required.")
 )
add-type -path "c:\program files\arcana development\adtempus\4.0\ArcanaDevelopment.adTempus.Client.dll"
$adtempusapp=new-object ArcanaDevelopment.adTempus.Client.Application
$adtempus=$adtempusapp.Connect($server,[ArcanaDevelopment.adTempus.Shared.LoginAuthenticationType]::Windows,"","")
#write-host "Connected to adTempus as " $adtempus.ClientName
$context=$adtempus.NewDataContext()
$options=new-object ArcanaDevelopment.adTempus.Shared.ObjectSearchOptions
$options.Action=[ArcanaDevelopment.adTempus.Shared.SearchReplaceType]::SearchOnly
$options.ReturnObjects=$true
$options.IncludeObjects.Add([ArcanaDevelopment.adTempus.Shared.WellKnownOIDs]::RootGroup)
$options.SearchSubGroups=$true
$options.TextToFind=$find
$results=$null
$messages=$null
$context.SearchAndReplace($options,[ref] $results,[ref] $messages)
foreach($result in $results)
{
    write-output $result
}

Save that as "adt-search.ps1" and you can then run it from PowerShell:

If you're on the adTempus server:

.\adt-search -find "dw_prod"

If you need to connect to a different server:

.\adt-search -find "dw_prod" -server "servername"

You can modify the write-output line to include only the pieces you want and format them however you want. $result is a SearchReplaceResult.

Bill Staff (599 posts)
May 11, 2016 09:53 AM
Accepted Answer
See KB article K00000512 for the latest version of this script.

Replies are disabled for this topic.