One of the very nifty features in RES Workspace Manager is the ability to set up a bunch of configuration sets for an application. This was highlighted recently in the updated Workspaces Inside-Out article. By using this feature of Workspace Manager, you can avoid having to create multiple application instances. Instead, when the user starts the application, he’s presented with a menu which will list a set of options to him.
This is quite useful for, say a client-server application, where the application may be pointed to different environments (think development, test and production). This could for example be a SAP/Baan/Great Plains client. In the pharmaco world it could be separation of clinical environments. For certain financial apps and some laboratory applications it’s quite complex to change the target environment to which a client application is pointing, i.e. it’s reasonable to conclude it is beyond the capability of the average task-based user. The changes required may include registry tweaks, ODBC connections, ini-file changes, etc.
Using user-selectable workspaces will defeat this problem. The user will just see one icon in their start menu and/or desktop. When they click it, a menu like the one shown above will be displayed and the user can select the environment he needs. You can actually restrict which environments he will have available using access control on the workspace containers!), and Workspace Manager 2010 will take care of everything else. Yessir, it slices – it dices! ;-)
So how to we configure this? Easy, just follow the example steps in this article and you’ll be well on your way configuring user-selectable workspaces in no time! In the example here we will do something extremely simple, specifically changing the font in Notepad, depending on what environment you chose. Remember, this can be used for practically anything. Use your imagination!
- First of all, we need to make a set of workspace containers that will be placeholders for our settings. Go to Context|Workspace Containers and add 3 new workspaces. Let’s call them respectively NP Development, NP Test and NP Production.
- In this example we will not be concerned about what computer this applies to as it’s all about getting some application settings into an app. On each of the 3 new workspaces’ Computer Control tab, make sure you select the Include all computers tick box at the bottom. This effectively puts this tab out of the game as we do not need it for this example.
- On the workspace containers Access Control tab, you would add the specific groups to which this workspace applies. For example, if we are preparing for some sort of sales app, then the Production workspace would be assigned all the sales folks, the Test workspace assigned only to a couple of trusty test sales users and the developers, and finally the Development workspace would be only assigned to developers. In this example for simplicity, I will leave workspaces Production and Test open for everybody and assign a specific user (test2) to Development. The expected end result is that if test1 and everyone else starts the demoapp Notepad, they will be presented with only two workspaces. However if test2 logs in, he should see all 3 workspaces.
- At this point you should also consider if currently other workspaces are attached to the application for other purposes. A plausible reason for this could be to broker access based on something else. Let’s say that you have 3 platform determining workspace containers, such as Laptops, Workstations, and SBC. Let’s for arguments sake imagine that Notepad is already attached to all 3 workspaces. That’s fine, but these workspaces are not describing what environment (dev/test/prod) the application is running in. Therefore we don’t want the workspaces Laptops, Workstations and SBC to show up on the list of available workspaces when the application starts. This is easily circumvented, but you have to edit all existing workspace containers which you don’t want displayed. For each of these workspace containers, edit their properties and on the Properties tab, tick the box for Hide this workspace container if user needs to select one. This will hide those workspace containers from selection menus even though they may apply to the user’s current environment.
- Once this is done, we need to edit the app which should have the environment selection menu available. Go to the applications properties and navigate to Access Control | Workspace Containers. Select the radio button for specific workspace containers and tick the box for the 3 workspace we created in steps 1-4.
- Tick the box for Let user decide which accessible workspace container to use.
- Optionally enter an alternative prompt. In our case, let’s put in: Please chose work environment for Notepad
- Optionally tick the box for Select a default workspace container after timeout expires. This will make sure a certain workspace is used, if the user doesn’t select one. Also remember to fill out the amount of seconds you want to wait.
Now we have set up the basic structure for using the workspace container prompt. At this point, you could just as well login as the user, fire up notepad and see the resulting prompt. But before we do this, let’s put a little more meat on the bones. We will add 3 registry settings to Notepad and assign them to the workspaces. In our little example scenario we are just going to mess around with the font in the notepad app.
In order to get the required settings, we are however going to employ one of the new and very cool features of Workspace Manager 2010 when it comes to capturing registry settings which is Registry Tracing. For the uninitiated, this is essentially just the equivalent of RegMon built into the Workspace Manager console, but it’s more than meets the eye.
For years, RES has maintained its own kernel filter driver, which initially in previous Workspace Manager versions, could monitor file and network access. The new filter driver is able to also monitor the registry. The Registry Tracing feature uses this rather smartly, as it only looks for writes and actual changes. This drastically reduces the amount of stuff to sift through, in order to get to the secret sauce that makes an application do what you want it to do
In our example here we are going to grab the font setting and perhaps some position data from Notepad without actually knowing and/or caring where this information actually is located in the registry. This has enormous potential to cut down on the complexity of packaging applications. This is how to do it:
- In the RES management console, go to Composition|Applications|Managed applications, and find Notepad. Double-click on it.
- Go to Configuration|Actions and add a new User Registry setting.
- Once inside the editor, press CTRL+T to start the registry Tracer. Click the miniature on the right to see what it looks like. The tracer may also be accessed through the menu in Action|Registry|Trace registry changes. Note: Registry Tracing cannot be done on a console-only installation of Workspace Manager 2010. The reason is that we need a full Workspace Manager install complete with kernel driver to be able to trace. It should not be a big issue as you typically want to run the trace where the app is already installed, right?
- The registry tracer loads up a list of currently active processes. As mentioned before, this effectively means that in order to use the registry tracer, you need to run the RES console on a machine where the target application is already installed. Per default %SystemRoot%\SYSTEM32\notepad.exe will be selected (because it’s defined as the main executable on the Properties|General tab). Click on the Start trace button. Then click on the Run now… button to launch the app. Note, if you’ve already set up the workspaces for the app, you will be prompted to select one of the workspaces. Ignore this as it doesn’t have any impact on the tracing at the moment.
- Now it’s time to change the settings. In Notepad, change the font of the application, perhaps move and resize the window. This is just to generate some registry settings to capture. When you’re satisfied, just exit Notepad. Note: It’s important to realize that different apps may write settings back to the registry at different times. In our example, notepad only writes config settings back to HKCU upon exit, where other apps, such as WinWord, will write it back upon clicking OK on the Tools|Options dialog.
- As soon as you exit notepad, or whenever the app writes the changes to the registry, these will appear in the console. Click the Stop trace button when done.
- Mark all the changes you want to apply. Here’s a tip for you: Press CTRL+A to mark all items, and then just click one of them to select all.
- Now hit the Add button in the lower right corner to bring all the selected items back into the registry buffer. Note: The Add button will be disabled as long as the trace is running. Click the Stop trace button to finish and reenable the add button.
- Give the registry settings a reasonable name and description, for example Production settings for application X or whatever. Note that currently Workspace Manager overwrites whatever you may have previously put into the name field, with the path+process name you traced. That’s probably a little bug.
- Go to the Workspace Control tab of the registry setting, and apply it to the workspace in question.
- Repeat steps 2-10 for every workspace which needs configuration settings. The same applies if you are going to attach, say Home Directory or Profile directory rules, ODBC settings, or pretty much anything else you can think of.
At the end of it, you will have 3 separate registry hacks assigned to 3 workspace containers. When a user launches the target application he will get prompted for what workspace should be used. Any settings you’ve attached to the workspace container will be applied at this point. Any workspace container, which the user does not have access to, will not be displayed in the launch menu for the application.
On a final note, I would recommend you to name your user-selectable workspace containers in a manner that makes sense to the users who will be seeing them.