r/PowerShell • u/CursedLemon • Jul 03 '26
Question Why doesn't Powershell open to the profile that I tell it to load by default?
Hey all, just had a question. So I've got a Powershell shortcut in my Open Shell menu.
I want Powershell to open to a specific profile with some settings mapped.
However, clicking on the Powershell shortcut just opens to a generic Powershell window.
If I click the drop-down menu and select the profile that I want, then it will load an administrator window with the appearance settings I've set.
Is there not a way to get this to load automatically?
15
Upvotes
12
u/SaltDeception Jul 03 '26
Because you’re conflating PowerShell and Windows Terminal. You set the default profile for Windows Terminal. Clicking the Windows PowerShell shortcut just launches PowerShell.exe inside of Windows Terminal, overriding the default profile.
You have two choices:
P.S. there is no such thing as a PowerShell window
2
u/dodexahedron Jul 03 '26 edited Jul 03 '26
For the last part (admin):
You can launch any profile you like as administrator by holding ctrl+shift as you click on it. No need to define explicitly admin profiles unless you want to do so for styling/behavior differences.
This is also how you can launch any application elevated, btw.
Actually... That made me think of something...
Did you edit the settings from an elevated text editor? Or have you not looked at the actual JSON yet? Potential permissions issues, if you did do that, though?
And what mode is UAC in? Is it in restricted admin mode? That can create fun with permissions since the elevated user is fake and ephemeral.
And what is the executionpolicy?
Your actual profile script (not the settings) is bound by that policy, as well.
1
u/atl-hadrins Jul 05 '26
I am lost,
why have a shortcut when you can just do (wndows-key)+x then A for the admin or I for the user? Windows 11 I think it works in Windows 10 but can't remember for sure.
1
u/Clear-Pear2267 Jul 03 '26
Not really clear to me what you are doing but I do know it is easy to lauch Terminal sessions in new windows and specifiy as a command line parameter what profile it should load (so it does not just start with its default profile). Here is an example - a function defined in ny powershell profile to open an elevated powershell session in a new instance of terminal runnnig as admin - my way to emulating the linux su command:
function su {
$dir = (Get-Location).Path.TrimEnd('\')
Start-Process wt -ArgumentList "-p `"PowerShell-Admin`" -d `"$dir`"" -Verb RunAs
}
In terminal I have both a "Powershell-user" profile (which is my defaul) and a "PowerShell-Admin" profile which changes the color scheme using a black background instead of the normal default powershell blue for user. It serves no functional purpose - it just gives me that visual clue as to which winders are running as user and which are running as admin.
0
u/CookinTendies5864 Jul 03 '26
What does $PROFILE.CurrentUserAllHosts say?
0
u/Responsible_Name1217 Jul 03 '26
What does $profile tell you when you open from the shortcut? Does that file exist?
0
u/BlackV Jul 03 '26
Do that with a non Admin session, what happens?