How create a script or set a group policy to force Microsoft Edge to clear a spesifc website cookies after closing Microsoft Edge?

AliUrz 1 Reputation point


I was able to find a setting in Microsoft Edge settings to clear cookies for a specific website after closing Microsoft Edge, but how I can apply this to few machines using Group Policy (I couldn't find anything in Edge ADMX that can do this) or any kind of scripts?


Microsoft Edge
Microsoft Edge
A Microsoft cross-platform web browser that provides privacy, learning, and accessibility tools.
2,229 questions
A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.
5,042 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,448 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. XuDong Peng-MSFT 10,341 Reputation points Microsoft Vendor

    Hi @AliUrz ,

    Base on your description, have you tried the policy CookiesSessionOnlyForUrls. I think it should meet your requirement.

    When you enable this policy and configure the required site list, cookies created by websites that match a URL pattern you define are deleted when the session ends (when the window closes).

    For more details, please refer to this doc: Microsoft Edge Policy - CookiesSessionOnlyForUrls.

    By the way, if you haven't installed Microsoft Edge Policy Template, please refer to this tutorial.

    Xudong Peng

  2. Limitless Technology 39,506 Reputation points

    Hi there,

    You can use ClearBrowsingDataOnExit to Clear browsing data when Microsoft Edge closes.

    If you enable this policy, all browsing data is deleted each time Microsoft Edge closes. Note that if you enable this policy, it takes precedence over how you configured 'DefaultCookiesSetting' (Configure cookies).

    Enabled Value 1
    Disabled Value 0

    To exclude cookies from being deleted on exit, configure the 'SaveCookiesOnExit' (Save cookies when Microsoft Edge closes) policy.

    --If the reply is helpful, please Upvote and Accept it as an answer–

    0 comments No comments