{"id":9788,"date":"2024-06-18T19:04:06","date_gmt":"2024-06-18T19:04:06","guid":{"rendered":"https:\/\/cheapwindowsvps.com\/blog\/streamline-your-workflow-adding-or-removing-pinned-folders-to-quick-access-using-powershell-and-gpo\/"},"modified":"2025-01-20T11:37:08","modified_gmt":"2025-01-20T11:37:08","slug":"streamline-your-workflow-adding-or-removing-pinned-folders-to-quick-access-using-powershell-and-gpo","status":"publish","type":"post","link":"https:\/\/cheapwindowsvps.com\/blog\/streamline-your-workflow-adding-or-removing-pinned-folders-to-quick-access-using-powershell-and-gpo\/","title":{"rendered":"Streamline Your Workflow: Adding or Removing Pinned Folders to Quick Access Using PowerShell and GPO"},"content":{"rendered":"<p>Windows File Explorer has a separate panel that displays a list of favorite folders and locations called <strong>Quick Access<\/strong>. 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.<\/p>\n<p>By default, the Quick Access panel displays only the standard user profile libraries (<em>Desktop<\/em>, <em>Downloads<\/em>, <em>Pictures<\/em>, <em>Documents<\/em>). 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 <strong>Pin to Quick Access<\/strong> option. A pushpin icon will appear next to the folder name in this case.<\/p>\n<div>\n<p>If your Windows doesn\u2019t display the Quick Access pane, go to the <em>HKLMSOFTWAREMicrosoftWindowsCurrentVersionExplorer<\/em> registry key and delete the <strong>HubMode<\/strong> registry parameter with a value of <strong>1<\/strong> (File Explorer hides the Quick Access panel when this option is set). Previously, we showed <a href=\"https:\/\/woshub.com\/hide-library-folders-file-explorer\/\" target=\"_blank\" rel=\"nofollow noopener\">how to hide the library and special folders in Windows File Explorer<\/a>.<\/p>\n<\/div>\n<p>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\u2019t have the built-in tools to centrally manage Quick Access, so PowerShell had to be used.<\/p>\n<p>To add (pin) a specific folder to the Quick Access List, specify the path to the folder in the command:<\/p>\n<p><code>$quickaccess = new-object -com shell.application<\/code><\/p>\n<p>$quickaccess.Namespace(&#8220;C:CorpAppReport&#8221;).Self.InvokeVerb(&#8220;pintohome&#8221;)<\/p>\n<div>The list of items in the Quick Access pane is stored in the <code>%AppData%MicrosoftWindowsRecentAutomaticDestinationsf01b4d95cf55d32a.automaticDestinations-ms<\/code> file. To quickly clear the Quick Access list, delete this file by running the command:<\/div>\n<p><code>del \/f \/s \/q \/a \"%AppData%MicrosoftWindowsRecentAutomaticDestinationsf01b4d95cf55d32a.automaticDestinations-ms\"<\/code><\/p>\n<p>A local folder or a shared network folder (by UNC path) can be added to the Quick Access:<\/p>\n<p><code>$quickaccess.Namespace(\"\\munfs01publicsales\").Self.InvokeVerb(\"pintohome\")<\/code><\/p>\n<p>Any user profile folder can be pinned<\/p>\n<p><code>$quickaccess.Namespace(\"C:Users$($env:USERNAME)AppDataRoamingMyApp\").Self.InvokeVerb(\"pintohome\")<\/code><\/p>\n<p>Remove (unpin) a folder from Quick Access:<\/p>\n<p><code>($QuickAccess.Namespace(\"shell:::{679f85cb-0220-4080-b29b-5540cc05aab6}\").Items()\u00a0|\u00a0where\u00a0{$_.Path\u00a0-eq\u00a0\"C:CorpAppReport\"}).InvokeVerb(\"unpinfromhome\")<\/code><\/p>\n<p>You can remove any of the profile library folders that are pinned to Quick Access by default:<\/p>\n<p><code>$quickaccess = new-object -com shell.application<br \/>\n$results=$QuickAccess.Namespace(\"shell:::{679f85cb-0220-4080-b29b-5540cc05aab6}\").Items()<br \/>\n$DeleteDefaultItems = @(\"Desktop\",\"Documents\",\"Pictures\",\"Videos\",\"Downloads\")<br \/>\n($results| where {$_.name -in $DeleteDefaultItems}).InvokeVerb(\"unpinfromhome\")<\/code><\/p>\n<p>Remove all pinned items from Quick Access:<\/p>\n<p><code>($quickaccess.Namespace(\"shell:::{679f85cb-0220-4080-b29b-5540cc05aab6}\").Items() | where { $_.IsFolder -eq \"True\"}).InvokeVerb(\"unpinfromhome\")<\/code><\/p>\n<p>The following PowerShell script adds folders to the Quick Access pane only if the user is a member of a specific AD group:<\/p>\n<pre>$usergroups=(New-Object System.DirectoryServices.DirectorySearcher(\"(&amp;(objectCategory=User)(samAccountName=$($env:username)))\")).FindOne().GetDirectoryEntry().memberOf<\/pre>\n<p>if ($usergroups.Contains(&#8216;CN=MUN_SaleManagers,OU=Groups,OU=MUN,DC=woshub,DC=loc&#8217;))<\/p>\n<p>{<\/p>\n<p>$AddItems = @(<\/p>\n<p>[pscustomobject]@{Name=Report;Path=&#8221;\\woshub.locDFSReports&#8221;}<\/p>\n<p>[pscustomobject]@{Name=&#8217;Scans&#8217;;Path=&#8221;\\woshub.locDFSScans&#8221;}<\/p>\n<p>[pscustomobject]@{Name=&#8217;Test1&#8242;;Path=&#8221;$env:USERPROFILEDownloads&#8221;}<\/p>\n<p>)<\/p>\n<p>ForEach ($Item in $AddItems)<\/p>\n<p>{<\/p>\n<p>if (($Item.Name -notin $results.Name) -and (Test-Path -Path $Item.path)) {<\/p>\n<p>$QuickAccess.Namespace($Item.path).Self.InvokeVerb(&#8220;pintohome&#8221;)<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>If the user is a member of the <em>MUN_SaleManagers<\/em> group, this PowerShell script will check if the user\u2019s QuickAccess list contains pinned folders from the <code>$AddItems<\/code> 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.<\/p>\n<p>&#8220;`html<\/p>\n<p>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\u2019s Quick Access list based on their AD group membership.<\/p>\n<p>Save this PowerShell to the <code>\\woshub.locNETLOGON<\/code> 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 <a href=\"https:\/\/woshub.com\/running-powershell-startup-scripts-using-gpo\/\" target=\"_blank\" rel=\"nofollow noopener\">running PowerShell scripts via GPO<\/a>).<\/p>\n<p>&#8220;`<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":9789,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[143,117,98,99],"tags":[],"class_list":["post-9788","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-group-policies","category-powershell","category-windows-10","category-windows-11"],"_links":{"self":[{"href":"https:\/\/cheapwindowsvps.com\/blog\/wp-json\/wp\/v2\/posts\/9788","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cheapwindowsvps.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cheapwindowsvps.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cheapwindowsvps.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cheapwindowsvps.com\/blog\/wp-json\/wp\/v2\/comments?post=9788"}],"version-history":[{"count":2,"href":"https:\/\/cheapwindowsvps.com\/blog\/wp-json\/wp\/v2\/posts\/9788\/revisions"}],"predecessor-version":[{"id":10458,"href":"https:\/\/cheapwindowsvps.com\/blog\/wp-json\/wp\/v2\/posts\/9788\/revisions\/10458"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cheapwindowsvps.com\/blog\/wp-json\/wp\/v2\/media\/9789"}],"wp:attachment":[{"href":"https:\/\/cheapwindowsvps.com\/blog\/wp-json\/wp\/v2\/media?parent=9788"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cheapwindowsvps.com\/blog\/wp-json\/wp\/v2\/categories?post=9788"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cheapwindowsvps.com\/blog\/wp-json\/wp\/v2\/tags?post=9788"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}