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. In all cases I use SAPIENs ActiveXPosh library. Two weeks ago I updated my system to PowerShell version 5.1 with dotNET framework 4.6.2 and check the functionality of ActiveXPoshV3 library. All works well and as expected.
Enjoy PowerShell inside ABAP and SAP GUI Scripting furthermore.
'-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.