Getting any special folder path in Powershell using folder GUID
I want to use a PowerShell script to automate tasks related to the user when the user logs in. Sometimes a user will have moved his Documents folder from the default location. How can I determine the location of the user's Documents folder in PowerShell with a method that will work for all special folders? I tried to use SHGetKnownFolderPath calls from PowerShell based on Lee Holmes work As pinvoke website C# sample doesn't use StringBuilder, I assumed it was not required and stripped builder + "-Using" references param($KNOWNFOLDERID) $Pinvoke = @’ [DllImport("shell32.dll")] public static