Hello Simon,
it works, I tried it. All you have to do is to set up two things in the registry:
- Add the entry DllSurrogate in the key HKCR\Wow6432Node\AppID\{E2779C61-F87E-4038-98A0-1D9E71334706} without any values.
- Create a new key in HKLM\Software\Classes\AppID with the GUID {E2779C61-F87E-4038-98A0-1D9E71334706} without any values.
Now you can enjoy the SAP GUI ROT Wrapper in an x64 environment.
Here my test script:
#-Begin----------------------------------------------------------------- #-Sub Main------------------------------------------------------------ Function Main() { [Reflection.Assembly]::LoadFile($PSScriptRoot + "\saprotwrlib.dll") > $Null [Reflection.Assembly]::LoadFile($PSScriptRoot + "\sapfewselib.dll") > $Null $Wrapper = New-Object -ComObject "SapROTWr.SapROTWrapper" #[Reflection.Assembly]::LoadWithPartialName("Microsoft.VisualBasic") > $Null #$Wrapper = [Microsoft.VisualBasic.Interaction]::CreateObject("SapROTWr.SapROTWrapper") If ($Wrapper -eq $Null) { Break } $RotSAPGUI = $Wrapper.GetROTEntry("SAPGUI") If ($RotSAPGUI -eq $Null) { Break } $Application = $RotSAPGUI.GetType().InvokeMember("GetScriptingEngine", [System.Reflection.Bindingflags]::InvokeMethod, $null, $RotSAPGUI, $null, $null, $null, $null) [sapfewselib.GuiApplication]$Application = [System.Runtime.InteropServices.Marshal]::CreateWrapperOfType($Application, [sapfewselib.GuiApplicationClass]) If ($Application -eq $Null) { Break } $Connection = $Application.Children.Item(0) [sapfewselib.GuiConnectionClass]$Connection = [System.Runtime.InteropServices.Marshal]::CreateWrapperOfType($Connection, [sapfewselib.GuiConnectionClass]) If ($Connection -eq $Null) { Break } $Session = $Connection.Children.Item(0) [sapfewselib.GuiSession]$Session = [System.Runtime.InteropServices.Marshal]::CreateWrapperOfType($Session, [sapfewselib.GuiSessionClass]) If ($Session -eq $Null) { Break } $SessionInfo = $Session.Info [sapfewselib.GuiSessionInfo]$SessionInfo = [System.Runtime.InteropServices.Marshal]::CreateWrapperOfType($SessionInfo, [sapfewselib.GuiSessionInfoClass]) If ($SessionInfo -eq $Null) { Break } Write-Host $SessionInfo.SystemName Write-Host $SessionInfo.Client Write-Host $SessionInfo.Transaction } #-Main---------------------------------------------------------------- Main #-End-------------------------------------------------------------------
It is possible that your SAP GUI ROT wrapper has another GUID, you can find it in the GuidAttribute of the manifest of the assembly.
Let us know your results.
Cheers
Stefan