Windows 10: start PowerShell session at Startup as Admin.

I have done ‘shell:startup’ in the Run box and created a shortcut to PowerShell there but it never starts! I am using …powershell.exe -NoExit -WindowsStyle minimized. If I click this shortcut manually then it runs, so what is missing please?
(It also works but only if I uncheck the Run As Administrator box in the shortcut properties, but this is not what is required.)

I am not sure of your goal here.

So, if you have this as a shortcut on your desktop / taskbar. Why are you going to the Run dialog box?
That seems a bit counterintuitive.

Like you said, you can just click the shortcut and it works. You, of course could also, just assign it a shortcut keyboard as well.

On my default Win10 rig, shell:startup, opens Windows Explorer to the current user ‘\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup’. Just as it would if one did it directly in the Windows Explorer input box.

Is your goal to override this for some reason?

I am trying to start an Admin PowerShell Session when the computer starts, that is all. I was trying to use shell:startup to create the shortcut there but it fails; so I have done a workaround: Create a scheduled task (Logon) using …powershell.exe -NoExit -WindowsStyle minimized -ExecutionPolicy remotesigned. Then check the Run With Highest Privileges box and an Admin PowerShell session is created.
My question is why is this failing if I put a shortcut for this in the Startup folder?

Yea, that whole throwing things in that folder like we used to do back in the day, on Windows 10 is really not much of a thing that I’ve seen folks do or want to do any more.
That’s not saying it should not work however, well, with the exception to how .lnk files are handled. Meaning, they are not executables, and the Startup folder is looking for .cmd, .bat, .com ,.exe.

Like the workaround (Logon scripts) you decided to go with, that is what I’ve been using since Windows 7 SP1, because I can do this via GPO directly to system in my lab.

Others have been taking that route as well. See…
Configuring the automatic start of PowerShell at every logon – SID-500.COM

There are other ways of course to do this other than using the startup folder or scheduled task.
Yet, that means hacking at the registry…


…and the other work around if you are insistent on the Startup folder, is to create a .cmd or .bat file that uses the good old DOS start command to fire off your shortcut.

So, say create a start.cmd file, located in the StartUp folder with your shortcut, which contains…

@echo off
cd “C:\Users.…\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup”
start WindowsPowerShellISE

… or whatever other program(s) you wish to start that has a shortcut there.

Point of Note:
Notice, the no spaces allowed in the PoSH shortcut name and note in the .cmd file, there is no extension on the shortcut, though the shortcut of course does. If you put one in that command in that .cmd file, it will fail.

…and scheduled task is just more direct and prudent IMHO.