GetRootProperty

SpaceObServer.Application.GetRootProperty

Description

Queries a certain property for one root in the currently connected database.

Syntax

GetRootProperty(RootID : <Integer>, PropertyName : <String>): <OLEVariant>;

Parameters

RootID

The index of the root (starting with 0 to RootCount-1)

PropertyName

The name of the property you want to query. This parameter can be one of the following strings:

  • “ChangeJournal”: Returns a boolean value indicating if NTFS Change Journals are activated for this root.

  • “Database”: The database used for the scan to store the scan data in.

  • “DisplayName”: Returns the display name of this root (by default the full path)

  • “HistoryIntervalBegin”: Returns the first possible date for the history of this root.

  • “HistoryIntervalEnd”: Returns the last possible date for the history of this root.

  • “LastError”: Returns the error code of the last scan error. 0 if there was no error.

  • “LastScan”: Returns the last scan date and time of the given root.

  • “NextScan”: Returns the expected next scan date and time of the given root.

  • “ObservingServer”: The observing server(s),which is allowed to execute a scan of the scan location.

  • “ScanInterval”: Returns the interval in days configured for the scheduled scan of this root.

  • “ScanPercentDone”: Returns the percentage value of a currently running scan for this root.

  • “ScanState”: Returns a string indicating the current state of the scan.

Example

PowerShell:

$Path = "C:\SpaceObServer_Exports\ScanStates.txt";
$SOS = New-Object -com SpaceObServer.Application;
$RootCount = $SOS.RootCount;
for(($RootIndex = 0);($RootIndex -lt $RootCount);($RootIndex++))
{
    Out-File -FilePath $Path -Append -NoNewLine -InputObject "Root path: ";
    Out-File -FilePath $Path -Append -NoNewLine -InputObject $SOS.RootPaths($RootIndex);
    Out-File -FilePath $Path -Append -NoNewLine -InputObject "Scan State: ";
    Out-File -FilePath $Path -Append -NoNewLine -InputObject $SOS.GetRootProperty($RootIndex,"ScanState");
}
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($SOS)

VBS:

Dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim objCTF
Set objCTF = objFSO.CreateTextFile("C:\SpaceObServer_Exports\ScanStates.txt", True)
Dim SOS
Set SOS = CreateObject("SpaceObServer.Application")

RootCount = SOS.RootCount
RootIndex = 0
Do While RootIndex<RootCount
    objCTF.Write "Root path: "
    objCTF.Write SOS.RootPaths (RootIndex)
    objCTF.Write "Scan state: "
    objCTF.Write SOS.GetRootProperty(RootIndex, "ScanState")
    RootIndex = RootIndex+1
Loop

Writes the current root paths with their current scan states to a text file named “C:SpaceObServer_ExportsScanStates.txt”.