January 4, 2021
Estimated Post Reading Time ~

AEM Service on a Remote Server PowerShell & Jenkins

Step-01: Create a Free style Job on Jenkins


Step-02: Setup a parameterized 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 an 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]


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.