Windows OS Hub
  • Windows
    • Windows 11
    • Windows Server 2022
    • Windows 10
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
  • PowerShell
  • Linux
  • Home
  • About

Windows OS Hub

  • Windows
    • Windows 11
    • Windows Server 2022
    • Windows 10
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
  • PowerShell
  • Linux

 Windows OS Hub / PowerShell / How to Add or Remove Pinned Folders to Quick Access with PowerShell and GPO

August 11, 2024 Group PoliciesPowerShellWindows 10Windows 11

How to Add or Remove Pinned Folders to Quick Access with PowerShell and GPO

Windows File Explorer has a separate panel that displays a list of favorite folders and locations called Quick Access. Many users and administrators unjustly ignore this handy Windows tool for quickly accessing your favorite folders. This article describes how to use PowerShell and Group Policies to automate the configuration of the Quick Access pane and pinned folders on Windows.

By default, the Quick Access panel displays only the standard user profile libraries (Desktop, Downloads, Pictures, Documents). Windows automatically adds folders the user has opened frequently (or recently) to Quick Access. The user can also manually pin any folder to the Quick Access pane. To do this, select the required folder on your computer or a shared folder on a remote computer and select the Pin to Quick Access option. A pushpin icon will appear next to the folder name in this case.

Pin a Folder to the File Explorer Quick Access

If your Windows doesn’t display the Quick Access pane, go to the HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer registry key and delete the HubMode registry parameter with a value of 1 (File Explorer hides the Quick Access panel when this option is set). Previously, we showed how to hide the library and special folders in Windows File Explorer.

In my case, I want to pin certain folders to Quick Access, depending on the access groups (roles) that are assigned to the users. For example, accountants need one list of favorite folders, sales managers need another, and so on. Group Policy doesn’t have the built-in tools to centrally manage Quick Access, so PowerShell had to be used.

To add (pin) a specific folder to the Quick Access List, specify the path to the folder in the the command:

$quickaccess = new-object -com shell.application
$quickaccess.Namespace("C:\CorpApp\Report").Self.InvokeVerb("pintohome")

pin folder to quick access using powershell

The list of items in the Quick Access pane is stored in the %AppData%\Microsoft\Windows\Recent\AutomaticDestinations\f01b4d95cf55d32a.automaticDestinations-ms file. To quickly clear the Quick Access list, delete this file by running the command:

del /f /s /q /a "%AppData%\Microsoft\Windows\Recent\AutomaticDestinations\f01b4d95cf55d32a.automaticDestinations-ms"

A local folder or a shared network folder (by UNC path) can be added to the Quick Access:

$quickaccess.Namespace("\\munfs01\public\sales").Self.InvokeVerb("pintohome")

Any user profile folder can be pinned

$quickaccess.Namespace("C:\Users\$($env:USERNAME)\AppData\Roaming\MyApp").Self.InvokeVerb("pintohome")

Remove (unpin) a folder from Quick Access:

($QuickAccess.Namespace("shell:::{679f85cb-0220-4080-b29b-5540cc05aab6}").Items() | where {$_.Path -eq "C:\CorpApp\Report"}).InvokeVerb("unpinfromhome")

You can remove any of the profile library folders that are pinned to Quick Access by default:

$quickaccess = new-object -com shell.application
$results=$QuickAccess.Namespace("shell:::{679f85cb-0220-4080-b29b-5540cc05aab6}").Items()
$DeleteDefaultItems = @("Desktop","Documents","Pictures","Videos","Downloads")
($results| where {$_.name -in $DeleteDefaultItems}).InvokeVerb("unpinfromhome")

Remove all pinned items from Quick Access:

($quickaccess.Namespace("shell:::{679f85cb-0220-4080-b29b-5540cc05aab6}").Items() | where { $_.IsFolder -eq "True"}).InvokeVerb("unpinfromhome")

The following PowerShell script adds folders to the Quick Access pane only if the user is a member of a specific AD group:

$usergroups=(New-Object System.DirectoryServices.DirectorySearcher("(&(objectCategory=User)(samAccountName=$($env:username)))")).FindOne().GetDirectoryEntry().memberOf
if ($usergroups.Contains('CN=MUN_SaleManagers,OU=Groups,OU=MUN,DC=woshub,DC=loc'))
    {
      $AddItems = @(
        [pscustomobject]@{Name=Report;Path="\\woshub.loc\DFS\Reports"}
        [pscustomobject]@{Name='Scans';Path="\\woshub.loc\DFS\Scans"}
        [pscustomobject]@{Name='Test1';Path="$env:USERPROFILE\Downloads"}
  )
       ForEach ($Item in $AddItems)
        {          
            if (($Item.Name -notin $results.Name) -and (Test-Path -Path $Item.path)) {
            $QuickAccess.Namespace($Item.path).Self.InvokeVerb("pintohome")
         }
        }
    }

If the user is a member of the MUN_SaleManagers group, this PowerShell script will check if the user’s QuickAccess list contains pinned folders from the $AddItems array. If such a folder is missing from the Quick Access, the script will check the availability of the specified path and pin the folder.

You can add several conditions to the script to check if the user is a member of other AD security groups. As a result, the PowerShell script will pin folders to the user’s Quick Access list based on their AD group membership.

Save this PowerShell to the \\woshub.loc\NETLOGON folder on the AD domain controller (this allows ignoring PowerShell execution policy settings.) and run it as a user logon script using Group Policy (more information about running PowerShell scripts via GPO).

Add/remove favorite pinned folders to/from Quick Access using a GPO

1 comment
6
Facebook Twitter Google + Pinterest
previous post
How to Assign (Passthrough) a Physical GPU to a Hyper-V Virtual Machine
next post
Install Any OS from ISO Image over Network with iVentoy

Related Reading

Configure NTP Time Source for Active Directory Domain

May 6, 2025

How to Cancel Windows Update Pending Restart Loop

May 6, 2025

View Windows Update History with PowerShell (CMD)

April 30, 2025

Change BIOS from Legacy to UEFI without Reinstalling...

April 21, 2025

Remove ‘Your License isn’t Genuine’ Banner in MS...

April 21, 2025

1 comment

Scott July 2, 2024 - 8:42 pm

This is great! How would I added a network file location to pinned for say Outlook (6d2bac8f1edf6668.automaticDestinations-ms)?

I haven’t quite figured out how the script knows to use QuickAccess in file explorer and not one of the other apps with Jump Lists stored at %AppData%\Roaming\Microsoft\Windows\Recent\AutomaticDestinations

Reply

Leave a Comment Cancel Reply

join us telegram channel https://t.me/woshub
Join WindowsHub Telegram channel to get the latest updates!

Categories

  • Active Directory
  • Group Policies
  • Exchange Server
  • Microsoft 365
  • Azure
  • Windows 11
  • Windows 10
  • Windows Server 2022
  • Windows Server 2019
  • Windows Server 2016
  • PowerShell
  • VMware
  • Hyper-V
  • Linux
  • MS Office

Recent Posts

  • Cannot Install Network Adapter Drivers on Windows Server

    April 29, 2025
  • Change BIOS from Legacy to UEFI without Reinstalling Windows

    April 21, 2025
  • How to Prefer IPv4 over IPv6 in Windows Networks

    April 9, 2025
  • Load Drivers from WinPE or Recovery CMD

    March 26, 2025
  • How to Block Common (Weak) Passwords in Active Directory

    March 25, 2025
  • Fix: The referenced assembly could not be found error (0x80073701) on Windows

    March 17, 2025
  • Exclude a Specific User or Computer from Group Policy

    March 12, 2025
  • AD Domain Join: Computer Account Re-use Blocked

    March 11, 2025
  • How to Write Logs to the Windows Event Viewer from PowerShell/CMD

    March 3, 2025
  • How to Hide (Block) a Specific Windows Update

    February 25, 2025

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • Fix: Remote Desktop Licensing Mode is not Configured
  • How to Delete Old User Profiles in Windows
  • Allow Non-admin Users RDP Access to Windows Server
  • How to Backup and Copy Local Group Policy Settings to Another Computer
  • How to Allow Non-Admin User to Start/Stop Service in Windows
  • How to Reset the Group Policy Settings on Windows
  • How to Disable NTLM Authentication in Windows Domain
Footer Logo

@2014 - 2024 - Windows OS Hub. All about operating systems for sysadmins


Back To Top