Control your SAP Instance with Microsoft PowerShell

We extended our cmShell4SAP with new features. This example shows how you can control your SAP Instance with PowerShell. Use Cases are Shutdown/Startup Scripts or use the Satus Query to Monitor your SAP Instance.

 

First Step: Connect to an SAP Host

$con = Connect-CmSAPHost -HostName erpdi01 -UserName admin –Password <YourPassword>

List all SAP Instances on this Host:

List-CmSAPInstance $con

Return

hostname : ERPDI01
instanceNr : 2
httpPort : 50213
httpsPort : 0
startPriority : 3
features : ABAP|GATEWAY|ICMAN|IGS
dispstatus : SAPControlGREEN

hostname : ERPDI01
instanceNr : 3
httpPort : 50313
httpsPort : 0
startPriority : 3
features : ABAP|GATEWAY|ICMAN|IGS
dispstatus : SAPControlGRAY

Start SAP Instance

Start-CmSapInstance -SapInstanceNumber 6 -SapControlConnect $con

–Return
True

Query SAP Instance Status

Test-CmSAPInstance -SapInstanceNumber 6 -SapControlConnect $con

–Return
SAPControlGREEN

Stop SAP Instance

Stop-CmSAPInstance -SapInstanceNumber 6 -SapControlConnect $con

 

Some Screenshots:

SAPControlCmdLet02_2_5C6DF17A

 

 

 

SAPControlCmdLet01_2_5C6DF17A