Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a virtual server running with Hyper-v r2 sp1 (standalone product). I imagine it applies also to W2K8 Core install.

When I connect to the remote desktop, both sconfig.cmd and cmd.exe are launched for the admin shell.

I'd like to launch (beside or in replacment of cmd.exe) a powershell session whenever a user log on to the server.

How can I do that ?


share|improve this question
up vote 1 down vote accepted

From the command prompt, run regedit. Browse to Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run. Add a new string value with name PowerShell and value cmd.exe /k C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe.

The original command prompt is launched from Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Shell. You can change that value if you want, too.

share|improve this answer
simply and working. Thanks. Do you know if it's possible to replace the cmd.exe (as it's not ran from the Run key). I vaguely remember there is Shell value somewhere in the registry, but didn't remember which one – Steve B Jul 27 '11 at 15:51
For diagnosing all auto run issues I highly recommend Autoruns from formerly sysinternals now from MS: – EBGreen Jul 27 '11 at 15:54
@SteveB I added the shell location to my answer. – William Jackson Jul 27 '11 at 15:55
thx :) I'm sometimes wondering why MS has not done this by default (maybe the lack of PowerShell skills for most admins) ? – Steve B Jul 27 '11 at 16:00

To keep the solution in the PS house, just do this at the powershell prompt:

New-ItemProperty -path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\run -Name Powershell -Value C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -Type string
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .