PowerShell for Windows Admins

Mar 4 2018   10:41AM GMT

Finding special folders

Richard Siddaway Richard Siddaway Profile: Richard Siddaway


Windows has a number of special folders. These can be accessed either directly through the file system – for example the Documents special folder is C:\<user>\Richard\Documents or through code. But how do you go about finding special folders.

The easiest way is to use this script

1..1000 |
ForEach-Object {
$shell = New-Object -ComObject Shell.Application
$sf = $shell.NameSpace($psitem)

if ($sf) {

$props = [ordered]@{
Value = $psitem
Name = $sf.Title
Path = $sf.Self.Path

New-Object -TypeName PSobject -Property $props

Looping through the values 1-1000 the Shell.Application COM object is used to find the namespace corresponding to that number. If it exists, the value, name and path are output.

In the Path property you’ll either get a normal looking path e.g. C:\Windows\System32 or something like this – ::{645FF040-5081-101B-9F08-00AA002F954E} – which is the CLSID or Windows Class Identifier

 Comment on this Post

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: