SEARCH

How-To Geek

Use BGInfo to Build a Database of System Information of Your Network Computers

One of the more popular tools of the Sysinternals suite among system administrators is BGInfo which tacks real-time system information to your desktop wallpaper when you first login. For obvious reasons, having information such as system memory, available hard drive space and system up time (among others) right in front of you is very convenient when you are managing several systems.

A little known feature about this handy utility is the ability to have system information automatically saved to a SQL database or some other data file. With a few minutes of setup work you can easily configure BGInfo to record system information of all your network computers in a centralized storage location. You can then use this data to monitor or report on these systems however you see fit.

BGInfo Setup

If you are familiar with BGInfo, you can skip this section. However, if you have never used this tool, it takes just a few minutes to setup in order to capture the data you are looking for.

When you first open BGInfo, a timer will be counting down in the upper right corner. Click the countdown button to keep the interface up so we can edit the settings.

image

Now edit the information you want to capture from the available fields on the right. Since all the output will be redirected to a central location, don’t worry about configuring the layout or formatting.

image

Configuring the Storage Database

BGInfo supports the ability to store information in several database formats: SQL Server Database, Access Database, Excel and Text File. To configure this option, open File > Database.

image

Using a Text File

The simplest, and perhaps most practical, option is to store the BGInfo data in a comma separated text file. This format allows for the file to be opened in Excel or imported into a database.

To use a text file or any other file system type (Excel or MS Access), simply provide the UNC to the respective file. The account running the task to write to this file will need read/write access to both the share and NTFS file permissions.

image

When using a text file, the only option is to have BGInfo create a new entry each time the capture process is run which will add a new line to the respective CSV text file.

image

Using a SQL Database

If you prefer to have the data dropped straight into a SQL Server database, BGInfo support this as well. This requires a bit of additional configuration, but overall it is very easy.

The first step is to create a database where the information will be stored. Additionally, you will want to create a user account to fill data into this table (and this table only). For your convenience, this script creates a new database and user account (run this as Administrator on your SQL Server machine):

@SET Server=%ComputerName%.
@SET Database=BGInfo
@SET UserName=BGInfo
@SET Password=password
SQLCMD -S “%Server%” -E -Q “Create Database [%Database%]”
SQLCMD -S “%Server%” -E -Q “Create Login [%UserName%] With Password=N’%Password%’, DEFAULT_DATABASE=[%Database%], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF”
SQLCMD -S “%Server%” -E -d “%Database%” -Q “Create User [%UserName%] For Login [%UserName%]”
SQLCMD -S “%Server%” -E -d “%Database%” -Q “EXEC sp_addrolemember N’db_owner’, N’%UserName%'”

Note the SQL user account must have ‘db_owner’ permissions on the database in order for BGInfo to work correctly. This is why you should have a SQL user account specifically for this database.

image

Next, configure BGInfo to connect to this database by clicking on the SQL button.

image

Fill out the connection properties according to your database settings.

image

Select the option of whether or not to only have one entry per computer or keep a history of each system.

image

The data will then be dropped directly into a table named “BGInfoTable” in the respective database.

image 

Configure User Desktop Options

While the primary function of BGInfo is to alter the user’s desktop by adding system info as part of the wallpaper, for our use here we want to leave the user’s wallpaper alone so this process runs without altering any of the user’s settings.

Click the Desktops button.

image

Configure the Wallpaper modifications to not alter anything.

image 

Preparing the Deployment

Now we are all set for deploying the configuration to the individual machines so we can start capturing the system data.

If you have not done so already, click the Apply button to create the first entry in your data repository. If all is configured correctly, you should be able to open your data file or database and see the entry for the respective machine.

image

Now click the File > Save As menu option and save the configuration as “BGInfoCapture.bgi”.

image 

Deploying to Client Machines

Deployment to the respective client machines is pretty straightforward. No installation is required as you just need to copy the BGInfo.exe and the BGInfoCapture.bgi to each machine and place them in the same directory.

Once in place, just run the command:

BGInfo.exe BGInfoCapture.bgi /Timer:0 /Silent /NoLicPrompt

Of course, you probably want to schedule the capture process to run on a schedule. This command creates a Scheduled Task to run the capture process at 8 AM every morning and assumes you copied the required files to the root of your C drive:

SCHTASKS /Create /SC DAILY /ST 08:00 /TN “System Info” /TR “C:BGInfo.exe C:BGInfoCapture.bgi /Timer:0 /Silent /NoLicPrompt”

Adjust as needed, but the end result is the scheduled task command should look something like this:

image

 

Download BGInfo from Sysinternals

Jason Faulkner is a developer and IT professional who never has a hot cup of coffee far away. Interact with him on Google+

  • Published 01/27/11

Comments (15)

  1. RussianBoy

    great tutorial, but I wasn’t able to create a new SQL user account Bginfo. I have done everything exactly as you wrote and got the following error:
    Connection failed:
    SQLState: ‘28000’
    SQL Server Error: 18452
    [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for
    BGinfo2′. The user is not associated with a trusted SQL Server
    connection.
    So I had to check “Use trusted connection” box. I guess this defaulted me to using Windows Authentication. When I try to connect to my bginfo database via Management Studio or Excel, I have to use Windows Authentication rather than SQL Server Authentication and it works OK, but only for my computer, not for remote computers.

  2. Jason Faulkner

    @RussianBoy – I’m guessing the DB script wasn’t processed correctly. When you pasted into notepad, did you remove the “slanted” double and single quotes in favor of the “straight” quotes? If not, try deleting your existing DB and doing that (you have to edit the text manually).

    On the “Database Settings” screen, the connection string listed (“Driver=SQL Server……”) should define the UserName (UID=) and Password (PWD=) exactly as you set it up in the previous screen. This is key to the connection across multiple machines.

  3. Jay

    Why not using Spiceworks? Install, and it will scan ALL your computers hardware in your network.. and the user won’t end up with crappy wallpaper :P

  4. RussianBoy

    @Jason Faulkner – yeah, I replaced all the quote marks, and it didn’t help, the same mistake.
    Also, I have two SQL instances on my server – one is SQLEXPRESS, the other one is AUTODESKVAULT (it got installed with my Autodesk software). When I use just %ComputerName% with sqlcmd command, it’s not even able to connect. So, I use the following:
    SQLCMD -S “%ComputerName%SQLEXPRESS”

  5. Tina Thorsen

    Hi Jason, thanks for tutorial! I’m including our link on my website. I love BGinfo. So convenient!

  6. Tina Thorsen

    Hi Jason, sorry about the typo. I’m including YOUR link on my website!

  7. DoubleJava

    Nice article. Been using BGInfo for several years, but haven’t used the SQL option before…I’ll have to give that a try.

    RE: Running as a scheduled task: This used to work great for me, but after MS acquired the product, they added the license acceptance piece to the code. Yes, there is the “nolicprompt” cmd line option (mentioned in the article); however, I’ve never been able to get that option to work when running BGInfo as a scheduled task via a profile-less account (i.e. service account). If you create a scheduled task to run BGInfo using an account that has logged into the machine before (and therefore has an associated profile), then the nolicprompt switch seems to work fine. But, when deploying BGInfo to more than a couple of machines, it is definitely preferable to use a service account.

    Anyone else have this issue? Is there a “fix”?

  8. Jason Faulkner

    @DoubleJava – The problem with using a Service Account is there is no user profile associated with the account. Since the license acceptance is stored in the registry, I imagine this fails because the respective registry path doesn’t exist.

  9. Josh

    For our dells to include the service tag I added a custom WMI query:

    SELECT SerialNumber FROM Win32_BIOS

    Felt like that was an important part of system information to add that’s not canned with it.

  10. JR

    I have configured BGInfo to run on our company machines successfully. I just recently have started using the app to get asset information on our machines for inventory – this was a godsend. I only have one issue and I’m hoping there’s a fix for it. My laptop users get an error when they are not in the office and it runs at boot. Is there any way to suppress the can’t connect to database error message?

  11. Jason Faulkner

    @JR – In Windows 7 under the Conditions tab of Task Scheduler, you can set the task to run only when connected to your work network. This should take care of it.

  12. JR

    Hmmm…right now I’m using a shortcut placed in the Startup folder and 98% of the machines are still running Windows XP. Is the WinXP Task Scheduler capable of this logid? Also, if I moved this to a scheduled task, is there any way to automate the install of the task so I don’t have to visit 100+ machines?

  13. Jason Faulkner

    @JR – I included a command you can run on XP to create a scheduled task in the article above.
    If you want more details about creating scheduled task from the command line, I have written another article about this here: http://www.howtogeek.com/51236/how-to-create-modify-and-delete-scheduled-tasks-from-the-command-line/

  14. Kitchen Support

    I have been looking for a way to capture some information that Spiceworks has not been able to. I am wanting to know which of my machines are Capable of supporting a 64-bit OS, not just whether one is installed. The only field Spiceworks currently supports is ‘Processor Type’, but it is not really designed for what I want to use it for. I guess it will have to be a WMI query into bginfo saved to a .csv…

  15. Dan Wheatley

    This is brilliant :) just created a GPO script that runs on every machine when they login, This keeps track of all users on the network and handy for remote desktoping onto users who are having problems.

    Just need to make a web front end now for the IT intranet :)

Enter Your Email Here to Get Access for Free:

Go check your email!