on ‎2021 Sep 03 7:46 AM
I have no experience with SAP, but I should create a PowerShell script. I've taken a look at the SAP community and found some examples like https://blogs.sap.com/2015/09/26/how-to-use-powershell-for-automated-login-to-sap/ which explain how to log on to the SAP GUI. In addition to that, I should be able to execute a command from CLI. The command is:
.\sapshcut -system=EHD -client=102 -user=myUserName -PW=myPass -maxgui -command="va03"
Is it possible to execute this command after the logon thru the PowerShell script?
Thanks
Request clarification before answering.
Hi Stefan,
thanks for the code, I tried but get an error when tried to create a $session with the following code:
$SapGuiAuto = [microsoft.visualbasic.Interaction]::GetObject("SAPGUI")
$application = Invoke-Method $SapGuiAuto "GetScriptingEngine"
$connection = Get-Property $application "Children" @(0)
$session = Get-Property $connection "Children" @(0)
It failed on the first line with the error message:
"Cannot create ActiveX component"
I research community and Internet articles and found that Visual Basic assembly needs to be loaded but even after I add this additional line of code still same error message.
Do I need to install additional SAP components to be able to create a session?
If it matters I'm using SAP NetWeaver (SAP GUI), Release 760 Final Release, File Version 7600.1.11.1160 Build 2065455 Patch Level 11.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 15 | |
| 9 | |
| 6 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.