Connect with us

Hi, what are you looking for?

Citrix Provisioning Services

Microsoft BGInfo for Windows 7 VMs running in Citrix PVS XenDesktop environments

If you’re running a Citrix VDI implementation using Provisioning Services (PVS) and XenDesktop, you need a way for your help desk and even the end user to easily identify the VM and pertinent system info easily. BGInfo is the tried and true way of doing this in a corporate environment. A simple overlay for the wallpaper. In a PVS environment, a lot of the info you would need to grab from a physical desktop are useless since it all goes away after the VM reboots and you’re back to a clean image. A lot of companies use BGInfo to quickly see troubleshooting data without having to use a management tool or agent. With PVS VMs, troubleshooting itself is rarely necessary. You just tell the user to reboot and they’re back to a clean slate. So BGInfo can be leveraged as more of an identification tool for when the user calls in than a troubleshooting tool. Download BGInfo from Microsoft here:

http://technet.microsoft.com/en-us/sysinternals/bb897557.aspx

I did a little custom BGInfo configuration to capture just the important pieces of info for my Windows 7 PVS XenDesktop environment. Of course this might differ for your environment and you might need more fields but this is a good starting point:

1. A Title – let’s the user know they are on a Windows 7 VM and not a workstation. Users can get confused when switching back and forth.

2. Host name – for when the help desk asks the user the name of their VM

3. IP addresses – both the streaming NIC and LAN NIC IPs. Not really necessary in a PVS environment obviously, but nice to have it displayed.

4. User Name – good to know what account the user is logging in with

5. Boot Time – very important to know in a PVS environment. You know those calls you get saying a person’s desktop looks completely different from everyone else and after you investigate a bit you figure out they’re on an old version of the image because they haven’t rebooted in forever. Yeah, this will help with that.

6. Write Cache free disk space left – another very important piece of info in a PVS environment. Once the write cache gets filled up, the VM is done and users start calling in. Good to know how much the user has left. Also a good way to gauge if your allocated write cache is truly enough for your environment or if you need to think about growing it.

So here’s how my desktop looks, very simple and clean:

1

I like to bake BGInfo into my images. I just create a folder called c:\BGInfo and copy Bginfo.exe in there. I’ll get to the other 2 files in a second.

2

Run Bginfo.exe and you get all the default stuff, delete it all and start clean adding just the stuff you need. Here’s how mine looks:

3

Don’t forget to set your settings under Position > Multiple Monitor Configuration for people with more than 1 monitor. I like mine to just be on the primary screen:

4

And under Desktops, you’ll want to change it for pretty much anyone that hits the VM using any method. I set mine to “Update this wallpaper” for all scenarios and prompt if it has an issue setting it (so I can investigate if anyone reports an issue):

5

Then go to File > Save As and save your configuration file. It will be saved with the .bgi extension.

That’s it for the implementation side. For PVS though, you’re going to have a lot of different NICs and you don’t want a bunch of “0.0.0.0” IPs being displayed. I just wanted my streaming IP and LAN IP displayed. So under Fields click Custom:

6

and then click New. You will need to create a new field called “IP Addresses” and do a WMI query to pull the IPs of only the active NICs. I used the following query:

SELECT IPAddress FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled=TRUE

Which will look like this when you are entering and Evaluating it:

7

Make sure to name the Identifier when you are saving it:

8

Then just add the field and hit apply and you should see both IPs appear.

Now the last part is the Write Cache free disk space percentage. I could not find a way to do it from just a simple WMI Query. So I wrote this little .vbs script and stuck it in c:\BGInfo. As you can see, my write cache drive is the Z: so you will need to change the code to whatever drive letter you are using:

Then just create a new Field and set the VB Script for it:

9

Add the field to your config and hit Apply and it should show the percentage free on your desktop. Now just create a group policy to run it every 5 min. Or you can schedule a task to run it every 5 minutes in the VM itself. I like to use these switches:

If you want BGInfo to run just once, it is very easy to do via scheduled task, GPO, login script, registry, or even adding it as a shortcut under Startup. Just Google it, tons of ways out there. But if you want it to run every 5 minutes and refresh the info, the only way to do it is via GPO. If you bake in into a local scheduled task in the image like I mentioned above, it will not work in a provisioned environment. It will attempt to run under the Administrator account of the maintenance image. So if you baked it in as “VM0001\Administrator”, a provisioned VM named VM0054 will not have this account. This will cause the scheduled task to fail. It won’t run under the System account either. The System account won’t run interactively. The task will start but stay running indefinitely and you will get an error like this in the BGInfo log:

An error occured while attempting to set the new desktop settings.
Please ensure the current user has rights to change desktop settings:
This operation requires an interactive window station.

To get around all this, use group policy. By default group policy will run the scheduled task under “%LogonDomain%\%LogonUser%” which is exactly what you want. Here is how my group policy looks:

10

Notice I have 2 triggers. The first trigger is to run BGInfo at login and update the wallpaper. But when opening a VDI session from a Win 7 host, it may open in Desktop Viewer but not in full screen. When the user goes full screen, the desktop wallpaper will not resize automatically and instead appear as tiled. So to get around this, I have a second trigger that runs BGInfo again 30 seconds into the session and runs every 5 min from then on. Hopefully within that 30 seconds, the user will have gone full screen and BGInfo will get a chance to run at the resolution the user will use throughout their session. One thing to note, I suggest adding a 3rd trigger that runs BGInfo on workstation unlock like this:

12

This is very useful in VDI when you go from a Desktop to an iPad for example. Upon login, it will immediately update the wallpaper resolution and run indefinitely every 5 minutes. This is a lot of triggers but it covers all your bases. I really wish BGInfo had a “Fit” setting for the wallpaper like Windows 7 has by default. It would avoid this whole resize mess. Right now BGInfo 4.16 only supports Center, Tile, and Stretch for the wallpaper.

Also if you decide to store the Bitmap BGInfo creates in a central place like c:\BGInfo, make sure Users and/or Authenticated Users have Full Control to c:\BGInfo and all child objects and change the location the .bmp is stored to under this folder. Othwerwise the background may not change for users that are not admins on the VMs:

11

Lastly, you might get an error like below, but the wallpaper does in fact update.

An error occured opening the Default Desktop registry key.
Please ensure the current user has rights to change Logon Desktop settings:
Access is denied.

This is because the user is not an admin and does not have rights to change the Logon Desktop settings. Either give permissions to do this or go back into your .bgi and uncheck the “Display an error when user permissions prevent a Logon Desktop from being modified” option that you had set before for troubleshooting purposes under the Desktops settings in BGInfo. Then the popup will stop.

One thing I’ve been trying to do is brand BGInfo with my company logo. But I don’t want a big white box around it like when you use a jpg. I want to use a transparent gif. BGInfo does not support this from all the things I’ve tried so far. For example, here is the Amazon logo as a transparent gif:

amazon_logo_transparent

Looks great on a white background but I want to use it with the standard Windows 7 wallpaper which has a gradient. It looks pretty awful because BGInfo flattens it somehow when creating the bmp causing there to be a black background around the logo:

13

But if your company chooses to use a standard wallpaper with no gradient, like a solid white background for example, just edit the background of your logo to match the color of the background and save it as a jpg. Add it to BGInfo and it will look perfect. Here is the Amazon logo (jpg with white background) with BGInfo set to white for the background wallpaper:

14

Hope this helps. Let me know if you have any questions or suggestions for custom fields to add that might be handy in a PVS XenDesktop environment.

3 Comments

3 Comments

  1. Daniel Ruiz

    December 28, 2012 at 2:07 PM

    Excellent and great idea to configure this… thanks for sharing.

    Daniel

  2. Jason Samuel

    December 28, 2012 at 10:34 PM

    @Daniel Ruiz
    Glad to help Daniel!

  3. Mike

    October 12, 2016 at 7:18 AM

    This is similar to the way I have it configured. If there were event that logged when a resolution changed that would be great. Then we could have it run when the resolution changed instead of everyone 5 minutes.

Leave a Reply

Your email address will not be published. Required fields are marked *

You May Also Like

Apache

Today I would like to go over proper URL redirection when using SSL but first I would like to preface this by describing what...

Citrix Workspace

You can use FIDO2 hardware security keys plugged into your physical desktop over the Citrix HDX remoting protocol for use with virtualized Windows Desktop...

Exchange 2003

A useful Exchange 2003 guide I wrote for a friend’s blog originally but I am posting it here on mine now for your viewing...

Apache

In a worst case scenario and all your web servers have failed, what do you do? You could have a standby group of servers...

JasonSamuel.com began in 2008 as a way for me to give back to the IT community. This website features the latest news and how-to's on enterprise mobility, security, virtualization, cloud architecture, and other technologies I work with. This website has evolved over time to become a go-to reference hub for these technologies. It receives hundreds of thousands of unique visitors from all over the world each month. More details on the About Me page.
Copyright © 2008-2023 JasonSamuel.com