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\LOGINventory9\PSC.exe" -ExecutionPolicy bypass -file "C:\myscript.ps1" [parameter]

Scripts can be executed within the LOGINventory PowerShell without restrictions.

Calling the LOGINventory PowerShell from the Windows PowerShell

To call the LOGINventory PowerShell from the Windows PowerShell, it must first be initialized.

The following script is installed by default and can be found under the name InitOtherClients.ps1 from the 'LOGINventory PowerShell Samples' folder in the Start menu. Please note that also the commented out commands at the beginning of the script must be executed according to your environment!

# Init Loginventory environment for other clients like powershell_ise.exe ...

# First, you have to install LOGINventory PowerShell compononets by using installutil in an administrative command promptfor the 64 bit Version of the PowerShell:
# installutil /i [LoginventoryBinaryPath]\Login.Ventory.PowerShell.CmdLets.dll
# installutil /i [LoginventoryBinaryPath]\Login.Ventory.PowerShell.Provider.dll

# For example: 
# C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe /i "C:\Program Files\LOGIN\LOGINventory9\Login.Ventory.PowerShell.CmdLets.dll"
# C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe /i "C:\Program Files\LOGIN\LOGINventory9\Login.Ventory.PowerShell.Provider.dll"

# If you experience problems, try also the 32 bit version:
# C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe /i "C:\Program Files\LOGIN\LOGINventory9\Login.Ventory.PowerShell.CmdLets.dll"
# C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe /i "C:\Program Files\LOGIN\LOGINventory9\Login.Ventory.PowerShell.Provider.dll"

Add-PSSnapin loginventory
Add-PSSnapin loginventorycmdlets

# Set culture to english (no data translation)
[System.Threading.Thread]::CurrentThread.CurrentUICulture = "en-US"


#[System.AppDomain]::CurrentDomain.SetData("APPBASE", "[LoginventoryBinaryPath]"), for example:
[System.AppDomain]::CurrentDomain.SetData("APPBASE", "C:\Program Files\LOGIN\LOGINventory9")

New-PSDrive  -Scope global -Name LI -PSProvider LOGINventory -Root ""

cd LI:

# have fun :)

Now you can navigate in the tree structure using the commands explained below.

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 LOGINventory9 console,
  • drag & drop a .ps1 file of the script into the opened LOGINventory PowerShell window,
  • to press the ENTER button.

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 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'] [-Category '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 no
-Category <String> Assignment of the new property to be created to a category. Attention: Once a property has been created, the category can no longer be changed afterwards via this command; this is only possible in the widget. no


If you want to assign a value via the PowerShell to a custom property that only offers a certain set of choices (=Enum), such as "FunctionalRole", the parameter Value must use the following syntax: -Value [Login.Ventory.Data.Model.FunctionalRole]::Testing) (if the role "Testing" is to be assigned)
By the way, the possible values can be queried with the command [Enum]::GetValues([Login.Ventory.Data.Model.FunctionalRole]).


  • Set-LiCustomProperty -Name "RoomNr" -Value "R 317" -AssetName "Server01"
  • Set-LiCustomProperty -Name "InstDatum" -Value 15.02.2013 -AssetName "Server01" -Category "Date Values"
  • Set-LiCustomProperty -Name "FunctionalRole" -value ([Login.Ventory.Data.Model.FunctionalRole]::Production) -AssetName "Server01"
  • Get-LiData | ? name –like DES* | Set-LiCustomProperty –Name "PriceInEuro” –Value 799


Even if the inventory number is not a custom property, it can still be set using this command. For example, you can define your own pattern for assigning inventory numbers in a script for each device type and then set it as follows: Set-LiCustomProperty -Name InventoryNumber -Value MyNumber123 -AssetName PC123

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 Lifecycle Entry

Syntax: Add-LiLifecycleEntry -Subject ‹String› -Start ‹DateTime› [-End ‹DateTime›] [-Body ‹String›] [-Important ‹Boolean›] [-Category ‹String›] [-Username ‹String›] [-AssetName ‹String›]

Adds a lifecycle entry with the specified values.


get-lidata | ? name -like Des* | Add-LiLifecycleEntry -Subject Repair -Start 15.11.2022 -End 18.11.2022 -Body "CPU was repaired." -Important $false -Category Maintenance -Username "my.domail.local\user01"

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