.PS1 Not being picked up when PS Launching

PS Users,

I am a newbee to PS.
I have a simple Ps script. It was created in Notepad and saved as “profile.ps1”. The file is exactly as named- profile.ps1. All that is in it is CD\

1 - set-executionpolicy was RemoteSigned. I have confirmed it.
2 - The ps1 file is put “exactly” in the first folder path location I can see in psmodulepath. (i.e. c:\users\myname\documents\WindowsPowerShell\Modules
3 - When I launch the ISE, it is not getting run.
4 - When I launch native ps, it is not getting run.
5 - I am launching both ise and native ps as administrator.
6 - When I am in PS, I can run the script manually and it works perfectly.
7 - I also put the ps1 script in C:\Program Files\WindowsPowerShell\Modules and it did not run it either.
7 - I am using PS 5.1.14393.693 on Windows 10. I am the admin to the laptop.

Can someone give me a hint on what I may be missing?

thanks MG

Get-Help about_profiles


$FolderName = Split-Path $profile
if (-not (Test-Path $FolderName)) { 
    New-Item -Path (Split-Path $FolderName) -Name 'WindowsPowerShell' -ItemType Directory -Force 
if (-not (Test-Path $profile)) { "cd c:\" | Out-File $profile -Force }
powershell_ISE.exe $profile

and put in what you want for PS startup in the file that opens in ISE. Save, exit, re-open Powershell_ISE to test…

Fellow Powershellers

I found the problem. It was where I had placed the Ps1 file.
I thought that the ps1 file should be in one of the paths from psmodulepath - wrong.
I dug deeper looking at the $profile location; put the ps1 file in that folder referenced in $profile and it ran perfectly.
Thanks for everyone’s observations.


Powershell has a really helpful help system. You should learn how to use it. You might start with:

Get-Help about_profiles
… or even more basic
help help
:wink: :wink: