Monthly Archive

Path cmdlets: 6 Convert-Path

The last of the path cmdlets is Convert-Path. 

The Convert-Path cmdlet converts a path from a Windows PowerShell path to a Windows PowerShell provider path.

I can’t remember using this one.  Building on the examples in the help file we can expand the current folder.

PS> Convert-Path -Path .

We can expand a registry path

PS> Convert-Path -Path HKLM:\software\Microsoft

The certificate store doesn’t give us much.

PS> Convert-Path -Path cert:\localmachine\ca


One interesting thought is the Windows 2008 R2 AD provider – but convert-path doesn’t appear to work. Shame would have been a good way to get a distinguished name however

PS> Split-Path -Path (Get-Location) -NoQualifier

is close and

PS> (Split-Path -Path (Get-Location) -NoQualifier ).SubString(1)

is even closer.

PS> Split-Path -Path (Get-Location) -Leaf

gives the current OU


PS> (Split-Path -Path (Get-Location) -Parent ).SubString(3)

should give the parent.

Leave a Reply