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?
try this:
[Environment]::GetFolderPath("MyDocuments")
When supplying it to a command, make sure to place it into parentheses:
cd ([Environment]::GetFolderPath("MyDocuments"))