Skip to content

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

Screen Shot 2018-05-03 at 3.05.26 PM.png

Step-02: Setup a parameterised build job, create a string parameter for remote Host

Screen Shot 2018-05-03 at 3.07.01 PM

Step-03: Setup a string parameter for remote User

Screen Shot 2018-05-03 at 3.33.27 PM.png

Step-04: Setup a String parameter for Remote User Password

Screen Shot 2018-05-03 at 3.34.21 PM.png

Step-05: Create a Powershell script to Start/Stop AEM service on a Remote Server


# 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

}

 

 

 

Shashi View All

A passionate devops and automation engineer

Leave a comment