Automatic WebSphere plugin modification II – PowerShell for Windows

Automatic WebSphere plugin modification II – PowerShell for Windows

Hi,

some months ago I published a shell script to automatically modify the Primary / BackupServer definition in a WebSphere plugin-cfg.xml file.

As we have several Windows customers we decided to transfer this script to PowerShell so that it is also useable for a Windows Cluster installation. My colleague Jan Bruns did a great job implementing this script.

It basically works the same way as the Linux script:

modifywasplugin-ps1

Please note that using the script is at your own risk! You should carefully test the script! It might need some more error handling!

This script has four different operation modes:

  • ./modifyWasPlugin.ps1 -manual –> Manual selection process
  • ./modifyWasPlugin.ps1 -automatic –> Automatic execution process. Modify array “backupServerList” in this script.
  • ./modifyWasPlugin.ps1 -setbackup SERVER –> Remove SERVER from PrimaryServer definition and declare it as BackupServer
  • ./modifyWasPlugin.ps1 -list –> List all servers declared as PRIMARY

Preparation

Open the script and modify the variable “fileToUse” && “outputPath” to match your plugin-cfg.xml

#Path to the plugin-cfg.xml file
$filetoUse = "D:\IBM\WebSphere\Plugins\webserver1\plugin-cfg.xml"

#Path to the Output XML file
$outputPath = "D:\IBM\WebSphere\Plugins\webserver1\plugin-cfg.xml"

For the automatic mode, please fill the variable with the BackupServers:

[System.Array]$BackupServerList = "ic55Node02_CommonCluster_server2", "xxx", "yyy"

Then add the script to your Windows Task Scheduler and run it each 10 minutes or so…

Hope this helps someone out there 😉

Leave a Reply

Your email address will not be published. Required fields are marked *