Forum / Remote Desktop Manager - Macro/Script/Tools

Palo Alto GlobalProtect script

  • Create an Issue
  • Cancel

UPDATE: Since GlobalProtect cannot be trusted to keep the cursor in a reliable location I have changed the process with a msgbox and the disconnect simply loads the program to be manually disconnected.
EDIT: Error in script. Whoops

Hi all,

I have been damned with the new Palo Alto GlobalProtect VPN which is a very poorly supported client.

Here is how I got it to mostly play nicely with Remote Desktop Manager.

Install AutoHotKey and create the following script files in the install directory,
PaloAltoOpen.ahk
----

run "C:\Program Files\Palo Alto Networks\GlobalProtect\PanGPA.exe"
Sleep, 1000

MsgBox, 1,, Put cursor in the password field of the GlobalProtect then click OK
IfMsgBox, OK
Send, +{tab}+{tab}%3%{tab}%2%{tab}%1%{tab}{space}{tab}{space}

----

PaloAltoClose.ahk
----

run "C:\Program Files\Palo Alto Networks\GlobalProtect\PanGPA.exe"

----

Then on your connection use the following VPN options,
General > Type = Custom
Settings > Host = Portal line in GlobalProtect
Settings > Executable = C:\Program Files\AutoHotkey\AutoHotkey.exe
Settings > Opening arguments = "C:\Program Files\AutoHotkey\paloaltoopen.ahk" $VPN_PASSWORD$ $VPN_USERNAME$ $VPN_HOST$
Settings > Closing arguments = "C:\Program Files\AutoHotkey\paloaltoclose.ahk"
Settings > Username = username
Settings > Password = password


Note: at the time of writing this the $VPN_PASSWORD$ variable was not working and I have logged a bug notification for it. While it is broken replace the variable with the actual password in the opening arguments line.
EDIT: Okay so it is not broken but it is a security option that has to be ticked on in the security tab of each connection.

This was tested on GlobalProtect, Version 3.1.4-7

Let me know what you think and if you have any other ideas.

Clock3 yrs

Thank you for sharing.

Stefane Lavergne

signaturesignature

Clock3 yrs

I'm getting "Win32Exception - The system cannot find the file specified".


at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at Devolutions.RemoteDesktopManager.Business.VPNOpeners.VPNCustomOpener.c8f52be6e3e016b2653a6440e08cc4ae7(Connection c11777b2865ab7cf712fd453f27da2541)
at Devolutions.RemoteDesktopManager.Business.VPNOpeners.VPNCustomOpener.Open(Connection vpn)
at Devolutions.RemoteDesktopManager.Managers.VPNManager.OpenVPN(Connection connection)
at Devolutions.RemoteDesktopManager.Business.Connectors.VPNConnector.Connect(Connection connection, OpenConnectionMode openConnectionMode)
at Devolutions.RemoteDesktopManager.Managers.ConnectionManager.OpenConnection(Connection connection, OpenConnectionParameter parameter)
at Devolutions.RemoteDesktopManager.Managers.ConnectionManager.OpenConnections(Connection[] connectionList, OpenConnectionParameter parameter)
at Devolutions.RemoteDesktopManager.Managers.ActionManager.c2d3a897d165d9e56a0d53f388986ac51(Connection[] cfabc0254f46d7d8ae5a71db9e5a0b5b5, OpenConnectionMode c602973c05c2f5870e41c508b048b13c5, IConnectionSource c5b7a41272702648f46cf77ee6b3a92cb)
at Devolutions.RemoteDesktopManager.Managers.ActionManager.OpenConnections(OpenConnectionMode openConnectionMode, IConnectionSource source, Boolean checkOpenedConnection)
at Devolutions.RemoteDesktopManager.Managers.SessionMenuManager.c552f6de7933b91b08a4107f7410f30d0(Object c19f185fd70cefc696ba148af1c4faf54, EventArgs cf1018bb83ec7debd818319fd3cb4844e)
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.PerformClick()
at Devolutions.RemoteDesktopManager.Frames.FreDashBoardBase.ButtonOnClick(Object sender, EventArgs eventArgs)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at DevExpress.XtraEditors.BaseButton.OnClick(EventArgs e)
at DevExpress.XtraEditors.BaseButton.OnMouseUp(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at DevExpress.Utils.Controls.ControlBase.WndProc(Message& m)
at DevExpress.XtraEditors.BaseControl.WndProc(Message& msg)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Clock3 yrs

Also with the PaloAltoClose.ahk shouldn't there be some parameter that "Disconnects" the VPN session?

Clock3 yrs

Sadly I found the GlobalProtect client too unreliable to trust where the cursor would be when the window was loaded so I do not use this method anymore. I think it would be easier to load the client and launch notepad with the connection details and then manually copy and paste the details across.

I think the disconnect script was intended to simply present the VPN window for manual disconnection.

Basically the client is a piece of crap and very frustrating to use...

Clock3 yrs

No biggie, I only have one client that uses it luckily. I sell Sophos firewalls so luckily they just use OpenVPN which makes things a lot easier.

Clock3 yrs