Windows® Virtual PC (WVPC) provides a feature called virtual applications, using which you can access applications running in a Virtual Machine (VM) seamlessly from Windows® 7 host Start menu. These applications get added to the host start menu automatically upon installing inside the VM using a feature called Auto Publish.
Preparing a VM for Auto Publish
For a Windows based VM (XP SP3 and higher versions), you need to install “Update for Windows® XP SP3 or above to enable RemoteApp™” or “Update for Windows® Vista SP1 or above to enable RemoteApp™” inside the VM. Windows® XP mode VHD has this package preinstalled. Also, you need to ensure auto-publishing is enabled in the virtual machine settings. Open ‘Virtual Machines’ folder and select the VM à right click à settings à Auto Publish.
Fig. 1. Enabling Auto Publish using WVPC settings dialog
Publishing an application
By default, applications installed under ‘All users’ profile are auto-published to the Windows 7 host. So, if an application has created its shortcuts in ‘All users’ profile, no action is required from user. There are applications which don’t install for “All users” and get installed for current user only. Follow the steps as below to publish such applications
- Click on the Start Menu button
- Right Click on Programs
- Click open. You'll see the start menu open up as a folder. This is the start menu folder in the user's profile
- You will see the application folder/shortcut appearing here. Copy that folder/shortcut (Ctrl+C)
- Right Click on programs again and then Click on "Open All Users"
- Now paste the above folder/ application shortcut to this folder (“All users” start menu)
- In a few moments the application will get published to the host start menu
Let’s take an example for publishing command prompt. To publish it simply create a new shortcut to cmd.exe at "C:\Documents and Settings\All Users\Start Menu\Programs" inside the VM. That is all you need to do for publishing the command prompt (Fig 2).
Fig. 2. Adding a virtual application (cmd.exe) to All User programs folder to Auto Publish it
Using this shortcut, now you can launch any application inside VM as remote app or install new applications.
Though auto-publishing works totally automatically, with virtually no user intervention required; there are ways in which publishing can be controlled.
You may want some applications that you install in the guest to not get published to the host Start menu. For this we maintain a list inside the guest registry called the “Exclude List”. This list contains full paths of applications that we do not want to publish to the host start menu. The Exclude List is present in the guest registry at HLKM\Software\Microsoft\Windows NT\CurrentVersion\Virtual Machine\VPCVAppExcludeList.
This is illustrated by an example below (Fig 3). For example you install Microsoft Security Essentials (http://www.microsoft.com/security_essentials/ ) to secure your VM. This would publish the anti-virus’s UI to the host start menu which you might not want. You need to add this application to the exclude list. This is illustrated below.
1. Right-click on the Microsoft Security Essentials® shortcut on the Start menu and click on properties
Fig. 3. Microsoft Security Essentials dialog
2. Retrieve the full path of the application.
Fig 4. Retrieving the application path for adding it to the Exclude list
3. Add this path to the exclude list (remember to get rid of the quotes) and restart the guest.
Fig 5. Using Exclude list to prevent a virtual application from getting Auto published
4. Consequently you may want some application which is present in the All-User’s start menu but did not get published. These are windows default application which we have excluded by default. For that just delete the entry of that application from the exclude list and restart the guest. For example for publishing the XP MSPaint.exe to Windows 7 start menu, just delete the mspaint.exe entry from the exclude list.
5. Restart the Virtual Machine.
Another way you can control the applications that get published to the host Start menu is through manual publishing. Here, the user disables auto-publishing and takes total control of what gets published to the host start menu. This is very useful for IT-Administrators who want to restrict applications that get published, irrespective of the number of applications that the user installs inside the guest.
Steps to manually publish the applications
Applications that get published to the host Start menu have an entry in the guest registry which is managed by the WMI class Win32_TSPublishedApplication. Scripting can be used to manipulate this WMI class to manually publish and unpublish application. This is illustrated below.
- Shutdown the VM. Disable the Auto Publishing setting and then restart the VM.
- Log in to the virtual machine as an administrator.
- Install the application
- Save the following VBScript to a .vbs file and execute it.
- Do remember to replace the “App Name” with the name of the application and “App Path” with the full application path.
- If you run it on a Vista on Windows 7 Virtual Machine, then run in on an elevated command prompt.
7. Restart the guest.
Note: - This is an indicative script and you might have to customize it according to your requirements. E.g., if the icon is not present in the executable file itself but is part of some other file, then that file path needs to be provided for the value of “IconPath”. Details of the various fields can be found at http://msdn.microsoft.com/en-us/library/bb736365(VS.85).aspx .
Steps to manually unpublish the applications
Similarly, you can manually unpublish an application using the following script.
To remove all the virtual applications, use the modified script below:
Another way to do the same is through WMI management tools like wbemtest.exe or WMI Administrator tools (http://www.microsoft.com/downloads/details.aspx?familyid=6430F853-1120-48DB-8CC5-F2ABDC3ED314&displaylang=en ).
Using these tools, you can list the instances of the class Win32_TSPublishedApplication in the namespace root\cimv2\TerminalServices and then delete one or more of the instances to manually unpublish those applications. This is illustrated here http://technet.microsoft.com/en-us/library/cc738926(WS.10).aspx
Microsoft Virtualization Team