Skip to content

PowerShell Interface

The LOGINventory PowerShell add-on provides you with a full script interface for Windows PowerShell 4.0 or later. This makes it possible to specifically access all data in the LOGINventory database and process and prepare them as required.

The add-on consists of a PowerShell Provider to move in the tree structure of LOGINventory and several CommandLets (also: CmdLets), which cover certain functions (reports, mail, setting own properties, etc.) and are continuously extended.

In addition to the special LOGINventory CmdLets, all standard CmdLets can also be used, such as Export-Csv.


PS LI:\> cd '.\IT Inventory\Assets'
PS LI:\IT Inventory\Assets> Get-LiData | Export-Csv c:\temp\export.txt

System Requirements

Windows PowerShell version 3.0 (already installed on Windows 8 or later and Windows Server 2012 or later) or newer must be installed. The default setting of Windows PowerShell is to prevent the execution of scripts (ExecutionPolicy = Restricted)! You must first enable this function, e.g. via an administrative PowerShell:

C:\> Powershell -command Set-ExecutionPolicy ByPass -scope LocalMachine

Call PowerShell

The LOGINventory PowerShell can be called either via the ribbon menu under Extras or via the supplied program PSC.exe, optionally with specification of the ExecutionPolicy, a script file or other parameters, e.g..:

C:\> "%ProgramFiles%\LOGIN\LOGINventory8\PSC.exe" -ExecutionPolicy bypass -file "C:\myscript.ps1" [parameter]

Scripts can be executed within the LOGINventory PowerShell without restrictions.

PowerShell Samples

With the installation of LOGINventory also some sample scripts are delivered. The LOGINventory PowerShell Samples shortcut (found in the Start menu) gives you an overview of the available examples in an Explorer window.

To start one of the example scripts, it is sufficient to:

  • open the PowerShell LOGINventory8 console,
  • drag & drop a .ps1 file of the script into the opened LOGINventory PowerShell window,
  • to press the ENTER button.

The InitOtherClients.ps1 example can be used to initialize the LOGINventory PowerShell Provider within the Windows PowerShell. How this must be done in detail is described in this file.

The scripts may have to be adapted to your environment:

  • You may not be able to start the sample scripts because you do not have permission to start scripts from the program directory. Therefore, copy the entire samples directory to a local path (e.g. c:\Scripts).
  • During the update to a new LOGINventory version, the supplied PowerShell samples are overwritten in the installation directory, which means that changes and additions by the user are lost. For this reason, we also recommend that you do not revise the samples in the original directory!
  • In the scripts, filters are set to asset names ('Device.Name' -like "DE*"), which you have to adjust accordingly.

The example scripts are structured according to the following scheme:

1   # Call these scripts:
2   # [ProgDir]\PSC.exe -file "path\scriptname.ps1" [parameter]
3   # Save current path, to restore at the end ...
4   $savePath=$PWD
5   cd "LI:\Software Licenses"
6   Get-LiData | Where {$_.'License.Required' -gt $_.'License.Available'}
7   cd $savePath
  • First, the current path is saved (line 4).
  • Then change to the desired evaluation path (line 5).
  • Then the desired CmdLets are executed
  • Finally the original path restored (line 7)

The Concept of the LOGINventory PowerShell Provider

Navigation through the LOGINventory tree structure is done with the commands CD (or: Set-Location) and DIR (or: Get-LiData) known from the DOS-Box. The names of the nodes in the tree are not localized in the PowerShell, so they always correspond to the English name; exception: "License Management" means "Software Licenses" in the PowerShell. When navigating with CD, auto-completion with the TAB key also works. Thus the directory names do not need to be written out completely.


The result list of each node can be retrieved with the CmdLet Get-LiData.

Available Commands

Besides the general Windows PowerShell CmdLets ( there are LOGINventory specific commands. In general, the output of the command is filtered via a where-CmdLet and used as an input parameter for other CmdLets.

Retrieve Data

Syntax: Get-LiData - View <String>

Returns the information of the detail view for the selected node in the LOGINventory tree, for the standard view.

Parameters Possible values Required?
-View <String> ChangeLog, ComputerAccounts, UserAccounts, LicenseConsumer, LicenseList, LicensProductList, LicenseVersionDetails, UsageResults no

Example: Get-LiData -view ComputerAccounts.

Archive Devices

Syntax: Disable-LiAsset [-AssetName 'String'] [-InputObj 'PSObject[]']

Archives the corresponding assets.

Parameter Explanation Required?
-InputObject 'Object' List of devices yes

Example (pipe): Get-LiData | ? name -like DES* | Disable-LiAsset Example (direct): Disable-LiAsset -AssetName MyDevice

Reactivate Devices

Syntax: Enable-LiAsset [-AssetName 'String'] [-InputObj 'PSObject[]']

Reactivates selected assets from the archive.

Parameters as for archiving.

Example (pipe): Get-LiData | ? name -like DES* | Enable-LiAsset Example (direct): Enable-LiAsset -AssetName MyDevice

Delete Devices

Syntax: Remove-LiAsset [-AssetName 'String'] [-InputObj 'PSObject[]']

Deletes the selected assets permanently.

Parameters as for archiving

Example (pipe): Get-LiData | ? name -like DES* | Remove-LiAsset Example (direct): Remove-LiAsset -AssetName MyDevice

Setting Custom Properties

Syntax: Set-LiCustomProperty -Name 'String' -Value 'String|DateTime|Int64'[-AssetName 'String'] [-InputObj 'PSObject']

Assigns a Custom property to the specified asset.

Parameter Explanation Required?
-Name <String> Name of the (new) property, no special characters or spaces yes
-Value 'String/DateTime/Int64' Value of the property to be set yes
-AssetName <String> Name of the device to which the property is to be assigned yes


  • Set-LiCustomProperty -Name "RoomNr" -Value "R 317" -AssetName "Server01"
  • Set-LiCustomProperty -Name "InstDatum" -Value 15.02.2013 -AssetName "Server01"

Query Custom Properties

Syntax: Get-LiCustomProperty -Name 'String' [-AssetName 'String'] [-InputObj 'PSObject[]']

Reads the value of a custom property.

Parameter Explanation Required?
-Name <String> Name of the property to be read out yes
-AssetName <String> Name of the device from which the property is to be read yes


  • Get-LiCustomProperty -Name "RoomNr" -AssetName "Server01"
  • Get-LiData| ? name -eq DESTINY | Get-LiCustomProperty -Name "InstDatum"

Emptying Custom Properties

Syntax: Remove-LiCustomProperty -Name 'String'

Clears all entries in the Custom Property in the entire database.

Parameter Explanation Required?
-Name <String> Name of the property to be emptied yes

Example: Remove-LiCustomProperty -Name "RoomNr"

Deleting Entries from "Failed Inventory"

Syntax: Remove-LiInventoryInfo

Deletes entries from the "Failed Inventory" query.


CD "\Failed Inventory"
get-lidata | ? targetname -like CL* | Remove-LiInventoryInfo

Add Journal Entry


Adds a journal entry with the specified values.


get-lidata | ? name -like Des* | Add-LiJournalEntry -Subject Repair -Start 15.11.2018 -End 18.11.2018 -Body "CPU has been replaced" -End 18.11.2018

Combination of Commands

As shown in the examples above, individual CmdLets can be combined using the Pipe |. The output of the command to the left of | is used as input parameter for the command to the right.

Example task

"In all assets whose name begins with "DES", add an Own property "PriceInEuroCent" with the price of the device:


PS LI:\> cd '.\IT Inventory\Assets'
PS LI:\IT Inventory\Assets> Get-LiData  | where {$_.'name' like "DES*"} | Set-LiCustomProperty –Name "PreisInEuroCent" –Value 78999