Hello community,
I presented here and here the possibility how to use PowerShell script inside ABAP and I presented here and here how to combine PowerShell script with Visual Basic Script (VBS), in the context of SAP GUI Scripting and GuiXT. Also I presented here the review how to us PowerShell script version 4, in all cases I use SAPIENs ActiveXPosh library. Two weeks ago I updated my system to PowerShell version 5 with dotNET framework 4.6 and check the functionality of ActiveXPoshV3 library. All works well and as expected.
'-Begin-----------------------------------------------------------------
'-Directives----------------------------------------------------------
Option Explicit
'-Constants-----------------------------------------------------------
Const OUTPUT_BUFFER = 2
'-Sub Main------------------------------------------------------------
Sub Main()
'-Variables-------------------------------------------------------
Dim PS, PSCode, PSVersion
Set PS = CreateObject("SAPIEN.ActiveXPoSHV3")
If IsObject(PS) Then
PS.OutputMode = OUTPUT_BUFFER
If PS.Init(vbFalse) = 0 And PS.IsPowerShellInstalled() <> 0 Then
PSCode = "Write-Host -Separator '' " + _
"$PSVersionTable.PSVersion.Major . " + _
"$PSVersionTable.PSVersion.Minor . " + _
"$PSVersionTable.PSVersion.Build . " + _
"$PSVersionTable.PSVersion.MinorRevision"
PSCode = PSCode & vbCrLf
PS.Execute(PSCode)
PSVersion = PS.OutputString()
PS.ClearOutput()
MsgBox PSVersion, vbOkOnly, "PowerShell version"
End If
Set PS = Nothing
Else
MsgBox "Can't create ActiveXPoSH", vbOkOnly, "Important hint"
End If
End Sub
'-Main----------------------------------------------------------------
Main
'-End-------------------------------------------------------------------
Enjoy PowerShell inside ABAP and SAP GUI Scripting furthermore.
Cheers
Stefan