Skip to main content

ExportUtil

Function description

The application is used to export objects from the ALVAO Asset Management system to a standard CSV file. It exports only assets of the active inventory, i.e. excluding "discarded assets", "basket" and other system objects. This function is available for on-premise users only.

Command line syntax

ExportUtil /csv "path and name of CSV file" {/con "<connection_string>"| /server "<database_server_name>" /db"<database_name>"} /cols "<list_of_columns>" [ /NotEmpty "<column_name>"] [ /TemplateFolder "<folder_name>"] [/where {[@class] | [@name] | [@path] | [<object_property_name>]}<operator><value>]

Parameters

ParameterDescription
/csvThe path and name of the CSV file where the object information will be saved.
/con /server /db

These parameters are used to set the connection to the Alvao database. It is possible to use a connection string (e.g. /con "Data source=.\sqlexpress;Initial Catalog=test;Integrated Security = True;TrustServerCertificate=True"), or simply specify a specific SQL server and DB (e.g. /server ".\sqlexpress" /db "test").

In case you use the /server parameters and /db, the database connection is made using Windows Integrated Authentication. If you specify all these parameters, only /con is used parameter, /server and /db will be ignored.

/colsColumn definitions that will be exported to the output file. See below.
/NotEmpty

This parameter is for backwards compatibility and will be removed in future versions. We recommend using the /where parameter instead. It only exports objects where the value of a specific object property is not an empty value.

Note: The property name can be written without diacritics.

/TemplateFolder

This parameter is for backwards compatibility and will be removed in future versions. We recommend using the /where parameter instead. It only exports certain types of objects lying in object templates under a certain folder. The parameter is the folder name.

Note: The folder name can be written without diacritics.

/where

Used to filter exported objects by type, name, path in the tree, and property values. Follow the switch with the logical filter expression in quotes. All objects for which the expression is satisfied will be exported.

You can use the following variables in the expression:

  • [@class] - object type
  • [@name] - name of the object in the tree
  • [@path] - path in the tree, the "/" character is used as a level separator
  • [<object_property_name>] - value of a certain object property, e.g. [Serial number].

Note: property names can be entered without diacritics.

Constants:

  • N'<text constant>' - text in unicode, e.g. N'David Cooper'.
  • '<text constant>' - text in ASCII (without diacritics), e.g. '47E57AD47764'.
  • <numeric constant> - e.g. 12.

Operators:

  • = - equals, e.g., [@class]=N'Computer/server'
  • !=, <> - does not equal, e.g. [@class]<>N'Computer/server'
  • IN - value equals one of the specified values, e.g. [@class]IN (N'Computer/server', N'Computer/virtual')
  • LIKE - string comparison with the possibility of using simple regular expressions. E.g., object type starting with 'Computer/': [@class] LIKE N'Computer/%')
  • NOT - negation of IN or LIKE operators, e.g. [@class] NOT LIKE N'Computer/%')
  • IS NULL - the value is NULL - e.g. the object does not have the property Serial number: [Serial number] IS NULL.

You can concatenate parts of an expression using AND and OR operators.

note

The format of the expression corresponds to the WHERE expression in SQL.

Description of supported columns

Columns are set in the /cols parameter are separated by a comma. We recommend enclosing the entire parameter value in quotes.

ColumnDescriptionExample value
@idThe unique identifier (INT number) of the object in the Asset Management database (NodeId)1245
@nameThe name of the object in the object treeHP LP2475w, LCD, 24"
@classobject typeMonitor
@pathThe path to the object in the object tree.Contoso/London/Peter Jenkins
@adguidGUID identifier of the object from Active Directory (contains the value if the object was created or paired using an AD import).{f50c0d0f-fede-4aaa-9509-7632e48251cc}
[object property]

Any object property. Properties must be written in square brackets.

Note: The property name can be accented or unaccented.

SN1234

Example of parameter value: "@id,@name,@path,@class,[Serial number],[Inventory number],[Hostname]"

Scenarios

Export objects that have a value in the property "Inventory number"

ExportUtil.exe /csv "c:\data\objects.csv" /server server\sql2005 /db alvao /cols "@id,@name,@path,@class,[serial number],[inventory number],[hostname]" /where "[inventory number]!=''"

Export all objects where the object template is in the folder "IT assets" in object templates

ExportUtil.exe /csv "c:\data\objects.csv" /server server\sql2005 /db alvao /cols "@id,@name,@path,@class,[serial number],[inventory number],[hostname]" /where "[@class] IN (SELECT txtClass FROM vNodeClass WHERE txtPath LIKE N'Object Templates/Inventory IT%')"

Export all mobile phones

ExportUtil.exe /csv "c:\data\objects.csv" /server server\sql2005 /db alvao /cols "@id,@name,@path,@class,[serial number],[inventory number],[hostname]" /where "[@class]=N'Mobile phone'"

Export all iPhone 7 mobile phones

ExportUtil.exe /csv "c:\data\objects.csv" /server server\sql2005 /db alvao /cols "@id,@name,@path,@class,[serial number],[inventory number],[hostname]" /where "[@class]=N'Mobile phone' AND [Model]=N'iPhone 7'"

Export of all mobile phones in London branch

ExportUtil.exe /csv "c:\data\objects.csv" /server server\sql2005 /db alvao /cols "@id,@name,@path,@class,[serial number],[inventory number],[hostname]" /where "[@class]=N'Mobile phone' AND [@path] LIKE N'Contoso/London/%'"