0
votes

I created a profile.ps1 in the same directory that contains the powershell executable, which on my machine is C:\Windows\System32\WindowsPowerShell\v1.0

The profile file is definitely executed when I run powershell.exe

However when I enter $profile at the powershell prompt, the following non-existent filename is returned

C:\Users\richard\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.psi

Does anyone know how this inconsistency may have happened and what steps should I take to resolve it?

1
that is where it is SUPPOSED to be. you only happened to drop yours in just the right place to be accidentally loaded. i would move it to where it otta be. [grin]Lee_Dailey

1 Answers

1
votes

$Profile is a string, but it has 4 note properties with possible locations to put profile scripts. Each is selected depending on which user and which host is being executed.

To see all 4, use something like this

$profile| select-object *Host* | format-list

The list you get will show profile script locations that would be run for you and this host.