July 21st, 2015

PowerTip: Find Name and Location of PowerShell Profiles

Doctor Scripto
Scripter

Summary: Learn how to find the name and location of various Windows PowerShell profiles.

Hey, Scripting Guy! Question How can I find the name and location of various Windows PowerShell profiles?

Hey, Scripting Guy! Answer Use the $profile automatic variable to see what profiles are available for your particular Windows PowerShell
           host (for example, the console host or the ISE). To find only the name and the location of the profiles,
           you need to return only the properties from the object and then look for names that  begin with A or C,
           for example:

(($PROFILE).psobject.Properties).where({$_.name -match 'a|c'}) | select name, value

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.

Feedback