Lina administration using powershell

A PowerShell Module is available to manage Lina configurations (agents, strategies, protections, tenants etc).

This module is published online and can be installed using a single command on recent PowerShell versions (5.0+).

The module itself is compatible with PowerShell for Windows versions 3.0+ and PowerShell Core  6.0+. Please note that PowerShell Core can be installed on Windows, MacOS or Linux so this module can be used on most OS.

How to check my version of PowerShell ?

PowerShell is installed by default on most WIndows OS :

PowerShellVersion Default Windows Versions

PowerShell2.0 Windows 7 Windows Server 2008 R2 (**)
PowerShell3.0 Windows 8 Windows Server 2012
PowerShell4.0 Windows 8.1 Windows Server 2012 R2
PowerShell5.0 Windows 10
PowerShell5.1 Windows 10 Anniversary Update Windows Server 2016

To check the version installed, open a PowerShell Terminal then type$PSVersionTable

Module Release Notes

Release notes can be found on PowerShell Gallery (where the module is published online) : https://www.powershellgallery.com/packages/Atempo.Linathen unfold “Package Details” to see the release notes.

Module Installation

To install the module :

  • On recent versions of PowerShell with internet access : Install-Module -Name Atempo.Lina

 

Module update

Module update are not automatic. Module should only be updated if you have an issue or if you update the Lina Version.

Module versioning matches major versions of Lina. For example : Module version 5.1.0.2 is knwon to work with Lina 5.1.

This script will automatically update the module to latest version :

Uninstall-Module -Name Atempo.Lina -AllVersions -ErrorAction SilentlyContinue

Install-Module -Name Atempo.Lina -Force

If you don’t have internet access, use the same method as for the installation but update the module on your workstation thenremove the old Atempo.Lina folder then replace it with the new one.

How to use the module ?

First time use :  Manually run the Get-LinaHelpcommand. This will ensure that the module is correctly installed and loaded and should open the Module Help (HTML format). Note : If this command is not recognized try to run Import-Module Atempo.Lina thenGet-LinaHelp. You can also use the built-in help usingGet-Help command.For example :Get-Help Connect-LinaServer All commands provided by thie module follow the standard PowerShell naming (Verb-Noun).

  • Get-LinaOBJECT: get a list of object or a single object. Example : Get-LinaAgent / Get-LinaStrategy
  • Set-LinaOBJECT: modify the configuration of an object. Example : Set-LinaAgent / Set-LinaProtection
  • New-LinaOBJECT: create a new object. Example : New-LinaAgent / New-LinaTenant
  • Remove-LinaOBJECT: delete an object. Example : Remove-LinaAgent / Remove-LinaAgentGroup
  • Connect-LinaServer/ Disconnect-LinaServer: manage connection to a Lina Server.

OBJECT can be :

Agent
AgentGroup
Tenant
Strategy
Protection
CurrentTenant
GlobalStats (get only)
more to come

Commands can be pipelined. For example if you want to remove all agents with “TEST” in their names :

Get-LinaAgent -Name “*TEST*” | Remove-LinaAgent

Example

This is a basic example :

# Connect to a lina server, use french language for default elements

Connect-LinaServer -Server “https://10.10.10.10:8181” -User “superadmin” -Password “superadmin” -Locale “fr”

# Get list of objects

Get-LinaGlobalStats

Get-LinaAgent

Get-LinaAgentStats

Get-LinaCurrentTenant

Get-LinaStrategy Get-LinaTenant

# Create a new Agent

New-LinaAgent -Name “TEST-QA-API”

# Rename an agent

Set-LinaAgent -Name “TEST-QA-API” -NewName “TEST-QA-API-RENAMED”

# Delete an agent

Get-LinaAgent -Name “TEST-QA-API-RENAMED” | Remove-LinaAgent

# Disconnect from server

Disconnect-LinaServer

 

Spread the love

Contact




    Aller au contenu principal