Samples/ImportCallhomeDetails/main.ps1

# ------------------------------------------------------------------
# Lenovo Copyright
#
# (C) Copyright Lenovo 2024 - present.
#
# LIMITED AND RESTRICTED RIGHTS NOTICE:
# If data or software is delivered pursuant a General Services
# Administration (GSA) contract, use, reproduction, or disclosure
# is subject to restrictions set forth in Contract No. GS-35F-05925.
# ------------------------------------------------------------------

param (
    [Parameter(Mandatory = $true)] [string] $InFile,
    [Parameter(Mandatory = $true)] $LxcoIp
    )

. $PSScriptRoot\InFile\ProcessData.ps1
. $PSScriptRoot\lxco\connectToLXCO.ps1
. $PSScriptRoot\lxco\GetDevicesFromLXCO.ps1
. $PSScriptRoot\lxco\lxcoContacts.ps1
. $PSScriptRoot\lxco\lxcoResourcesGroup.ps1

Clear-Host

<#
    Update this field with desired company name.
#>

$Global:CompanyName = "Add here Company Name"
$Global:preferredContactMethod = "Email"

[hashtable] $devices = @{}
[hashtable] $addresses = @{}

<#
    Initial data can be stored in a xlsx or csv file.
    To process the input file, a third party module is used: ImportExcel (released under 'Apache License 2.0' license).
    The module can be installed from https://www.powershellgallery.com/packages/ImportExcel.
 
    If the module is not installed, an exception is thrown.
#>

ProcessData -InFile $InFile -OutAddressList $addresses -OutDeviceList $devices

$conn = ConnectToLXCO -LxcoIp $LxcoIp
$addressesRequired = GetLXCODevices -Connection $conn -Devices $devices

<#
    - get existing contact info from LXCO,
    - verify if there are new contact info that should be added
    - add non existing contacts info
#>

UpdateContacts -Connection $conn -RequiredAddresses $addressesRequired -Addresses $addresses

<#
    - update groups for call home
#>

UpdateGroupsInfo -Connection $conn -RequiredAddresses $addressesRequired -Addresses $addresses -Devices $devices

# diconnect
DisconnectFromLXCO -Connection $conn

# EOF