Vbs script works for Edge Chromium but not for the older Microsoft Edge

Exc_Ad 41 Reputation points
2021-01-03T14:48:04.95+00:00

Hello.
I am using a vb script to get my application to prompt me for the smart card upon its removal instead of keeping me signed in.
The authentication to this app is managed by adfs as my idp (Saml 2.0) certificate based authentication only.
The idea was to set the vbs in a schedules task that- when detects smart card is removed- does particular actions:
Delete cookies on the browser
Delete my certificate from the personal store, so that adfs prompts me for my identity again.

On computers with edge chromium, it works perfectly:

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "msedge.exe https://myRP/logoutpage"
Wscript.Sleep 900
WshShell.SendKeys "^+{DELETE}"
Wscript.Sleep 900
WshShell.SendKeys "{TAB 10}"
Wscript.Sleep 300
WshShell.SendKeys "{ENTER}"
Wscript.Sleep 300
WshShell.SendKeys "^w"

Set objShell = CreateObject("Wscript.Shell")
objShell.Run("powershell.exe -windowstyle hidden -command Get-ChildItem -recurse cert:\currentuser\My | ? subject -match 'my_username' | remove-item")

But on computers with the older microsft edge, same script doesnt work, as in it keeps my identity somewhere other than in the cookies and cert store.

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "cmd.exe /C start microsoft-edge:http://myapp/logout"
Wscript.Sleep 900
<<Correspondant Key Strokes to delete Cookies>>

Set objShell = CreateObject("Wscript.Shell")
objShell.Run("powershell.exe -windowstyle hidden -command Get-ChildItem -recurse cert:\currentuser\My | ? subject -match 'my_username' | remove-item")

My question is: how to get the microsoft edge script to behave like the edge chromium one?

I am missing a command to completely delete my identity from the legacy browser.

Ps: my Rp does not supprort SLO, so i cant go
with that solution
Edited

Microsoft Edge Microsoft Edge development
{count} votes

Accepted answer
  1. Anonymous
    2021-01-05T07:25:21.597+00:00

    Hi @Exc_Ad

    I made a test with outlook login and I think I can understand what do you mean.
    I sign in with outlook account on https://outlook.live.com/owa/, then clear the browser data with Ctrl Shift Del keys. When I refresh the page after clearing, I was logged out on Edge Chromium, but I was still logged in on Edge Legacy.
    I found that, on Edge Legacy, you can only delete the cookies using F12-Debugger-Cookies then you can log out totally without closing the browser. That's why the vbs script can't work with Edge Legacy.

    53330-image.png

    So if you want to simulate log out on Edge Legacy without closing the browser, I think you can only delete all the cookies under F12-Debugger-Cookies.


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Regards,
    Yu Zhou


1 additional answer

Sort by: Most helpful
  1. Reza-Ameri 17,336 Reputation points Volunteer Moderator
    2021-01-03T16:39:49.61+00:00

    The recommendation is to use new Microsoft Edge because it has more functionality and supports more standards.
    It is recommended to ask your user to upgrade to new Microsoft Edge instead of resolve this issue in Legacy Microsoft Edge.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.