Powerchute Business Edition Installation Automation

Foreword


Recently, my manager set the task to automate the installation and configuration of the Powerchute Business Edition product on a large number of servers, with a different interface for connecting UPS, USB, COM. Previously, I was engaged in the automation of various software installation, but I was faced with the type of configuration files that this product uses for the first time. The thing is that as a configuration file, java binary files are involved, which the utility with the GIU interface can modify, it is not suitable for solving the problem.

Powerchute Business Edition Inside


Consider the product in more detail, it can be obtained on the official APC website in the download section . After downloading, we get the pcbesetup.exe file with which it is possible to install three components, an agent, a server, a console. The agent installs drivers on the UPS and is responsible for automatically shutting down the server in case of power failure. The server connects to the agent and reads the status of the UPS; in case of problems, it can send an alert to the mail. Console, GUI interface for configuring the server and agent. There are three components but one file, to get them separately , we will use the usual WinRAR , open the downloaded file, go to the bin folder. We see three of our components, but there are four folders, more on that later.



Automate component installation


Since inhaler files are made in InstallShield, it is possible to create an answer file, as described on the manufacturer’s website. From the beginning it is necessary to put all the files unzipped for example in the following way the C: \ the APC , after a predetermined order to install components from the command line:

1. the C: \ the APC \ agent-upslink \ -r the setup.exe to install the agent version 9.0.3
2 . C: \ APC \ agent \ setup.exe -r updating the agent to version 9.1.1
3. C: \ APC \ server \ setup.exe -r installing the server version 9.1.1
4. C: \ APC \ console \ setup .exe -r console installation 9.1.1

After each installation, a response file C: \ Windows \ setup.iss will be created, which must be copied to the directory with the installer. It is important that during the installation of the agent, the UPS detection will be automatic, this will later enable the agent to be installed with various USB, COM connection interfaces, it will detect the UPS itself. Now check that the response files are working, remove the installed components, install again with the s key.

1. C: \ APC \ agent-upslink \ setup.exe -s
2. C: \ APC \ agent \ setup.exe -s
3. C: \ APC \ server \ setup.exe -s
4. C: \ APC \ console \ setup.exe -s

As you can see, the installation was successful:



The components are installed, now you need to configure them. The agent is configured at the time of installation, a username and password are set, which is saved in a fileC: \ Windows \ setup.iss , we already configured it earlier when we created the answer file. Now comes the most interesting setup of a server with a binary java file. Open the console and delete the previously configured UPS.



after we add a new client, it is important to specify 127.0.0. * in the search range , this is necessary for automation, since there will be different agent addresses on different servers, and we will not edit the configuration file manually.



We set up sending alerts to e-mail, in the Tools> Chenge Configuration Profile section, I will not describe each field, and so everything is clear.



Everything necessary for automation is there, we copy it into files with server settings, following the path C: \ Program Files (x86) \ APC \ PowerChute Business Edition \ server, files m11.bak, m11.cfg. to the directory C: \ APC \ server \, delete all previously installed PowerChute components, and install them using a script on PowerShell, I list below. The script logic is as follows, go to the directory where the script file is located, install and update the agent, install the server, stop the server service, change the configuration files, start the server service, install the console.

function InstallPowerShute{
     .\APC\agent-upslink\setup.exe -s | Out-Null
     .\APC\agent\setup.exe -s | Out-Null
     $PowerChuteServerFolder= ${env:ProgramFiles(x86)} + "\APC\PowerChute Business Edition\server"
     $PowerChuteServerFile1= $PowerChuteServerFolder + "\m11.bak"
     $PowerChuteServerFile2= $PowerChuteServerFolder + "\m11.cfg"
     .\APC\server\setup.exe -s | Out-Null
    Stop-Service APCPBEServer -Force | Out-Null
    remove-item -path $PowerChuteServerFile1 -force
    remove-item -path $PowerChuteServerFile2 -force
    Copy-Item ".\APC\server\m11.bak" -Destination $PowerChuteServerFolder
    Copy-Item ".\APC\server\m11.cfg" -Destination $PowerChuteServerFolder
    Start-Service APCPBEServer | Out-Null
     .\APC\console\setup.exe -s | Out-Null
}
function Get-ScriptPath{
Split-Path -Path $MyInvocation.ScriptName
}
$path = Get-ScriptPath
cd $path
InstallPowerShute


I hope you succeed.

Thank you for your attention.

Also popular now: