Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ansemjo
Created December 20, 2018 06:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ansemjo/7384b24b4dcd6a58422ff5c759ff5b0e to your computer and use it in GitHub Desktop.
Save ansemjo/7384b24b4dcd6a58422ff5c759ff5b0e to your computer and use it in GitHub Desktop.
Install and update Lexware Warenwirtschaft premium via GPO startup scripts
# Install & update Lexware Warenwirtschaft Premium in server/client-setup at startup via GPO startup scripts.
# This should update the Lexware client whenever you update the server, without needing to login to every single
# computer in the domain with Administrator credentials.
# registry persistence path and Lexware setup path
$REG = "HKLM:\Software\myCorp"
$LEX = "\\LEXWARE\lexware_premium_setup"
$APP = "warenwirtschaft premium"
# get current version from payload xml
$payload = [xml]@(cat "$LEX\payload\client_package.xml")
$version = $payload.lxsetuppackages.package.Attributes["requiredversion"].'#text'
# check if version exists
if ($version -eq "") {
echo "version could not be parsed from $LEX\payload\client_package.xml"
exit 1
}
# create registry path for persistence if it does not exist
if (!(Test-Path $REG)) {
echo "create registry path $REG ..."
New-Item -Path $REG >$null
}
# action to be run
function lxsetup {
# I would prefer to '-Wait' here but the setup launches the Lexware Info Service and Start-Process
# won't return until that process is also stopped, since it is a child process.
Start-Process "$LEX\$APP\LxSetup.exe" -ArgumentList "-automation"
}
# check if registry key exists and is current version
if ((Get-ItemProperty $REG $APP 2>$null) -And ((Get-ItemProperty $REG $APP) -eq $version)) {
echo "already on current version: $version"
exit 0
} else {
# otherwise run setup and save version
lxsetup
Set-ItemProperty $REG $APP $version
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment