<< Zum Inhaltsverzeichnis >> Navigation: OLE Automation > Examples |
Here is a simple example (PowerShell) of how to use the OLE Automation interface of SpaceObServer to generate an Excel export of a scanned share:
# Declare variables
$SOS;
# Initialize variables
$SOS = New-Object -com SpaceObServer.Application;
$SOS.ROOTDirectory = "\\Server1\Share1\"; |
#Use the scanned share "\\Server1\Share1\" as root directory |
$SOS.SizeUnit = "MB"; |
#Set the unit type for size values to "MB" |
$SOS.ExpandToLevel(2); |
#Expand the root directory to the second level |
$SOS.SortBy = "Allocated"; |
#Sort the exports by "allocated space" |
#Export tree, details and charts to Excel
$SOS.ExcelExport("C:\Temp\SOS\ExcelExport.xlsx", "SpaceObServer %DATE%", $True, $True, $False, $False, "scantree; detailslist; piechart; historychart");
Here is the same example in VBScript:
' Declare variables
Dim SOS
' Initialize variables
Set SOS = CreateObject("SpaceObServer.Application")
SOS.ROOTDirectory = "\\Server1\Share1\" |
'Use the scanned share "\\Server1\Share1\" as root directory |
SOS.SizeUnit = "MB" |
'Set the unit type for size values to "MB" |
SOS.ExpandToLevel 2 |
'Expand the root directory to the second level |
SOS.SortBy = "Allocated" |
'Sort the exports by "allocated space" |
'Export tree, details and charts to Excel
SOS.ExcelExport "C:\Temp\SOS\ExcelExport.xlsx", "SpaceObServer %DATE%", True, true, False, False, "scantree; detailslist; piechart; historychart"
Please find several code examples in PowerShell, VBScript and C# in the subdirectory "Demos" of your SpaceObServer installation directory.
Multiple scans be added easily by using the script "ConfigureScansViaTextFile.vbs" in the subdirectory "Demos" of your SpaceObServer installation directory. You can add, delete or modify
scans via a separate text file (ConfigureScansViaTextFile.txt in this example):
ADD;C:\;
MOD;C:\;administrators§usergroup§userA§userB
ADD;C:\temp;
DEL;D:\;
will add the scans C:\ and C:\temp and delete an existing scan D:\. Additionally, users who should have access to the C:\ scan are explicitely set (See also: User Access).