AEM Service on a Remote Server — PowerShell & Jenkins

Disclaimer:
This is just a custom guide to start, stop and restart AEM Author/Publish service on remote windows server, this could be more technical and advanced guide, if you do not understand or don’t know what you are doing, I kindly request you to take extreme caution. The components used here are billable. SKYDEVOPS/I/WE do not take any responsibility if the guide causes any serious damage or issues, which you have to take full responsibility.
Step-01: Create a Free style Job on Jenkins
Step-02: Setup a parameterised build job, create a string parameter for remote Host
Step-03: Setup a string parameter for remote User
Step-04: Setup a String parameter for Remote User Password
Step-05: Create a Powershell script to Start/Stop AEM service on a Remote Server
[code lang=powershell]
# stopping the job if it encounters error
$ErrorActionPreference = ‘Stop’
# Credentials are stored in env and dynamic variables
$SecurePassword = $env:Password | ConvertTo-SecureString -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential -ArgumentList $env:User, $SecurePassword
# Invoke a command on the remote machine.
Invoke-Command -ComputerName $env:Computer -Credential $cred -ScriptBlock {
Start-Service -Name AEM6A
}
[/code]
Categories
Adobe Experience Manager, Adobe Experience Manager 6.x, AEM, aem63, CI-CD, java, Jenkins, Linux, Powershell, Windows Server, Windows Service