user shell

Upload: mertol-serban

Post on 02-Jun-2018

215 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/10/2019 User Shell

    1/6

    1. Change HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\IniFileMapping\system.ini\boot\Shell

    Old value: String: "USR:Microsoft\Windows NT\CurrentVersion\Winlogon"New value: String: "USR: Software\Microsoft\Windows NT\CurrentVersion\Winlogon"

    2. HKCUUSERS \Software\Microsoft\Windows NT\CurrentVersion\Winlogon\ShellValue: String: "notepad.exe" (The alt shell)

    3. Set HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced SeparateProcess REG_DWord = 1 (Tells Explorer to launch as a new process)

    4. Rebooted and Logged in as the test user and try.

    Different Shells for Different Users16 out of 26 rated this helpful - Rate this topic

    Sean Liming

    A7 Engineering

    August 2003

    Applies to: Microsoft Windows XP Embedded

    Summary:

    The ability to make your application the shell is one of key features of WindowsXP Embedded. Devices can start in a custom shell instead of starting in the Explorer shell, which provides two benefits. The first benefit is that the system will start faster. The Explorer shell takes a significant amount of time to load

    all of the support libraries and files, whereas a specific application will mostlikely have fewer libraries to load. The second benefit is that access to a device's administrative functions can be limited, depending entirely on how the custom shell application is written.

    Limiting a user's access to administrative functions such as Control Panel can be a benefit, but there is a small drawback: The administrator is also limited unless the administrator can start in a different shell.

    The ideal solution would be to set up Windows XP Embedded so that the user account can start in the application shell and the administrator account can start inan administrative shell. Security features built in to Windows XP Embedded would then prevent users from accessing administrative functions. This article descr

    ibes how this solution can be implemented.Contents

    Registry Is the KeyHow It WorksSetup for Windows XP EmbeddedExtra NotesConclusionRegistry Is the Key

  • 8/10/2019 User Shell

    2/6

    Microsoft Windows XP has a feature that can provide the solution through the registry. The registry for each user account and administrator account can be set upto start a user-specific shell. There are three keys that must be set up. The first two are generic for all users. This article refers to the keys as "Key1," "Key2," and "Key3" for simplicity.

    Key1 is a string value. When Windows XP starts, Key1 is called and the default Windows shell is started. However, if the default value is changed to USR:Software\Microsoft\Windows NT\CurrentVersion\Winlogon, Windows looks in the HKEY_Current_User key to start a specific shell for the user logging on. If the specific user shell is not found, Key2 is called and a default shell is started.

    Key: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\IniFileMapping\system.ini\boot\Shell

    Type: REG_SZ

    Value: SYS:Microsoft\Windows NT\CurrentVersion\Winlogon

    Key2 provides a default shell if the user shell application cannot be found. When you select a shell component for a Microsoft Windows XP Embedded configuration, Key 2 is set up to the shell application as the default shell.

    Key: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogo

    n\Shell

    Type: REG_SZ

    Value: Explorer.exe (or this can be a different default application)

    Key3 sets up a shell for the current user or logged-on user. Thus, the only wayto change a particular user's shell is to log on to the user account and createthis registry entry.

    Key: HKEY_Current_User\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\Shell

    Type: REG_SZ

    Value: c:\windows\system32\account shell.exe, where account shell.exe is thename of the application

    How It Works

    When the user logs on, Windows uses Key1 to determine which key holds the shellinformation. Normally, Windows uses Key2 next. However, if the value of Key1 ischanged to USR:Software\Microsoft\Windows NT\CurrentVersion\Winlogon, Windows will use Key3 for the user logging on to start the user's specific shell.

    Changing the registry key values in a system with a registry already set up is f

    airly straightforward. The challenge is how to do this in Windows XP Embedded, where the registry is set up during the First Boot Agent (FBA) process.

    HKLM keys can be set up in Target Designer because they are computer specific. Setting up the HKCU keys, however, is impossible in Target Designer because the accounts will not be created until after FBA runs. The user account and administrator account components create only the accounts, user names, and passwords. These components cannot be used to set up a specific shell. The only solution is toset up the specific shells after the Windows XP Embedded image has completed the FBA process.

  • 8/10/2019 User Shell

    3/6

    Setup for Windows XP Embedded

    The trick to making different shells for different users in Windows XP Embeddedis in the setup. There are a few components that need to be part of the configuration so that Key3 can be set up for the user's account:

    Windows Logon. Because different accounts will be part of the image, WindowsLogon (Standard) is a required component for the configuration. Windows Logon supports the ability to log on to different accounts locally and remotely. By contrast, the Minlogon component supports only logon to a single administrator account. Two User Account components. Two computer accounts are required at a minimum; at least one account must be an administrator account. The User Account component can be set up to be an administrator account through the Extended Propertiespage. When a user account is set up as an administrator account, it replaces the generic "Administrator" account, just as in other versions of Windows XP. Because of the elimination of the administrator account, you may want to consider using two instances of the User Account component. You can set up one component asan administrator (which will have the administrator shell), and you can set upthe other component as a regular user (which will have the system shell). Automatic Logon. Most original equipment manufacturers (OEMs) want their systems to start directly in the application. The Automatic Logon component can beadded to the configuration to start directly in the user account, whose shell will be the system's application.

    Default Shell. Windows XP Embedded comes with several shells: Explorer, TaskManager, and Command. You can also create a custom shell. A shell component isrequired in the configuration. When you select a shell component for the configuration, the shell will be the default shell for the Windows XP Embedded image, so you do not need to set up Key2.

    For setting up different shells for different users, the chosen shell component will be the administrator shell, and the shell must allow access to configure the registry to set up Key3. Task Manager may be a good choice. TaskManager issmall shell that you can use to start other applications, such as Control.exe (Control Panel) or Regedit.exe (Registry Editor). You may want to create your ownadministrative shell if the TaskManager shell is not appropriate. After the FBAprocess is completed, all accounts will have the same administrator shell. You

    can then log on to any account and set Key3.

    User Shell. The last component is the user or system application, which willbe the second shell. Your second shell component should not be set up as a shell component or be grouped with the other shell components. Rather, the second shell component should be treated like any other application component, such as Windows Accessories or Transmission Control Protocol/Internet Protocol (TCP/IP) utilities. After the FBA is completed, you can log on to the user account and setup Key3 to point to the application. If the application component is missing, the default administrator shell component will appear. Other components. Windows Script Engine and Registry Editor can be includedto help with creating Key3. You can create a custom application to perform thistask.

    Setting Up Key1

    You must set up Key1. In the Extra Registry Data, found at the top of the configuration, add Key1 as described earlier, with the value set for USR:Software\Microsoft\Windows NT\CurrentVersion\Winlogon. To see the Extra Registry Data resource, you may have to enable resources by clicking View, pointing at Resources, andthen clicking Target Designer.

    After the configuration has been set up, built, and downloaded to the target, an

  • 8/10/2019 User Shell

    4/6

    d after the FBA process is completed, the last step is to set up the user account for the system shell. Because you initially set up the image to start in the administrator shell, you should be able to access the registry.Setting Up Key3

    To set up the user account with the unique shell, you must log on to the user account and add Key3 to set the path to the system application. Note that you cannot log on to the administrator account to change the user account's shell. Afteryou log on to the user account, you can use Regedit.exe, Windows Script, or another application to create Key3 and set the path to the application.

    The following is an example of WScript.

    'Windows Script to set a user shellset shell = CreateObject("WScript.shell")

    shellpath = InputBox ("Enter the path and name of the EXE applicationto be this user's shell. Example: c:\windows\system32\cmd.exe:")

    if shellpath "" then Shell.RegWrite"HKCU\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\Shell", shellpath, "REG_SZ"

    The following is an example of CScript.

    'Windows Script to set a user shellset shell = CreateObject("WScript.shell")

    wscript.stdout.WriteLine "Change the Shell for this user."wscript.stdout.WriteLineChangeReg

    sub ChangeRegwscript.stdout.WriteLine "Enter the path and name of the EXE application to be this user's shell."wscript.stdout.WriteLine "Example: c:\windows\system32\cmd.exe or type QUIT to exit: "

    if wscript.stdin.AtEndOfStream then exit subshellpath = wscript.stdin.ReadLineif ucase(shellpath) = "QUIT" then exit sub

    Shell.RegWrite "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\Shell", shellpath, "REG_SZ"

    wscript.stdout.WriteLine "User will now have a new shell"wscript.stdout.WriteLineend sub

    After you set Key3, you can log off and log on again to the user account and/or

    the administrator account. The user account's specific shell will be started when you log on to the user account. The default/administrator shell will be started when you log on to the administrator account.Extra Notes

    By default, Windows Script engine is set up for WScript. WScript uses dialog boxes for input and output messages. CScript uses only a command prompt, which is ideal for headless systems. You can change to CScript only from an administratoraccount. If you decide to use a Windows Script Engine, you must modify the registry data for the Windows Script Engine component for the Microsoft Visual Basic S

  • 8/10/2019 User Shell

    5/6

    cripting Edition (VBScript) file. Change HKEY_CLASSES_ROOT\VBSFile\Shell\Open\Command and add %1 to the end of the value %11%\WScript.exe, as shown in Figure 1.

    ms838576.shellsfig01(en-US,WinEmbedded.5).gif

    Figure 1. Changing the registry value for the Windows Script Engine component

    After Key3 has been created, you can log on again to the user account and see the new shell for the account. When you log on to the administrator account, the default or administrator shell will still be started.

    If you are using remote administration features, be aware that Telnet allows more than one user to be logged on to the same computer, but Remote Desktop Connection or Microsoft NetMeeting allows only one user to be logged on to the computer.Remote Desktop Connection takes control of the desktop and logs off users froma system. If you plan to use Remote Desktop Connection, your system must not beaffected by an administrator logon and a logoff of the user account.

    In addition, after Key3 has been set up, you can use FBresealfound with the Cloning componentto reseal the image for duplication. The registry key information forthe user account will be preserved.Conclusion

    Windows XP Embedded provides a flexible way to deploy the popular Windows XP ope

    rating system into a number of embedded devices. The ability to have two accounts with different shells allows OEMs to build systems that prevent users from accidentally accessing administrative functions. The solution is to define the administrative shell as the default shell in the system and change the user account's registry keys to point to a second shell.

    Microsoft Corporation. All rights reserved.

    AutoLOGON

    You can use Registry Editor to add your log on information. To do this, follow these steps:

    Click Start, click Run, type regedit, and then click OK. Locate the following registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon Using your account name and password, double-click the DefaultUserName entry, type your user name, and then click OK. Double-click the DefaultPassword entry, type your password under the value data box, and then click OK.

    If there is no DefaultPassword value, create the value. To do this, follow these steps:

    In Registry Editor, click Edit, click New, and then click String Value. Type DefaultPassword as the value name, and then press ENTER. Double-click the newly created key, and then type your password in the Value Data box. Note: If the DefaultPassword registry entry does not exist, Windows XP automatically changes the value of the AutoAdminLogonregistry key from 1 (true) to 0(false) to turn off the AutoAdminLogon feature after the computer is restarted. Double-click the AutoAdminLogon entry, type 1 in the Value Data box, and then click OK.

  • 8/10/2019 User Shell

    6/6

    If there is no AutoAdminLogon entry, create the entry. To do this, follow these steps: In Registry Editor, click Edit, click New, and then click String Value. Type AutoAdminLogon as the value name, and then press ENTER. Double-click the newly created key, and then type 1 in the Value Data box. Exit Registry Editor. Click Start, click Restart, and then click OK.

    After your computer restarts and Windows XP starts, you can log on automatically.

    If you want to bypass the automatic logon to log on as a different user, hold down the SHIFT key after you log off or after Windows XP restarts. Note that thisprocedure applies only to the first logon. To enforce this setting for future logoffs, the administrator must set the following registry key:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon

    Value:ForceAutoLogonType: REG_SZData: 1