Thursday, 27 May 2010

different users with different shells

in windows the original registry for loading user shell
HKLM\Software\Microsoft\Windows NT\CurrentVersion\IniFileMapping\system.ini\boot\Shell
REG_SZ
SYS:Microsoft\Windows NT\CurrentVersion\Winlogon

HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\Shell
REG_SZ
Explorer.exe

HKCU\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\Shell
REG_SZ
c:\windows\system32\account shell.exe,where account shell.exe is the name of the application


to use different shell for different user, modify the reading path from HKLM to HKCU, thats SYS: to USR:

now
HKLM\Software\Microsoft\Windows NT\CurrentVersion\IniFileMapping\system.ini\boot\Shell
REG_SZ
USR:Microsoft\Windows NT\CurrentVersion\Winlogon

HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\Shell
REG_SZ
cmd.exe

in my current user session
HKCU\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\Shell
REG_SZ
Explorer.exe

then all users except "current user" will use cmd.exe as shell (USR: means reading HKCU shell settings, with no HKCU shell settings configured for the user, it will fall back to reading the HKLM shell settings) , and "current user" will remain using Explorer.exe (because I added HKCU shell settings for current user)


so , make it simple
reg.exe ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\IniFileMapping\system.ini\boot" /v Shell /t REG_SZ /d "USR:Microsoft\Windows NT\CurrentVersion\Winlogon" /f
reg.exe ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /t REG_SZ /d "cmd.exe" /f
reg.exe ADD "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /t REG_SZ /d "Explorer.exe" /f

and, to restore
reg.exe ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\IniFileMapping\system.ini\boot" /v Shell /t REG_SZ /d "SYS:Microsoft\Windows NT\CurrentVersion\Winlogon" /f
reg.exe ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /t REG_SZ /d "Explorer.exe" /f
reg.exe DELETE "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /f


http://msdn.microsoft.com/en-us/library/ms838576%28WinEmbedded.5%29.aspx

No comments:

Labels

Search This Blog