Author Archives: nunop81

WMI is a powerful tool provided by Microsoft that provides component information and notificaiton. Below is a snippet on how you can query WMI to retrieve the Dell Service Tag of a single computer. You can easily extend this sample via Directory Service (LDAP) to query all PCs in your network. Please Note:  Make sure you add a reference to System.Management and place using System.Management; to the top of your code file. We start by setting the computerName string to you PC’s name. You can press and hold window key on your keyboard then press the Pause/Break key to load the System Properties . If Windows XP you’ll want to click on the Computer Name tab. On Windows 7/Vista machines you will see the computer name right on System window that pops up somewhere near in the middle of the screen. string computerName = “<Your PC Name>”; Next you’ll want to create a ManagementScope object by…

Read more

A co-worker (Rob Yacullo) and I wrote the following utility to help us figure out which directories consumed the most drive space. With this tool you can easily figure out which directories are consuming high amounts of disk space without having to drill down each individual directory in Windows Explorer. The following link is the executable only: Folder Sizes The following link contains the full source code: Folder Sizes Source This applicaton was built on top of the .NET Framework 3.5. Enjoy! -Nuno

Often in the web world developers are asked to add Excel exporting capabilities to their web application or web services. The following demonstration shows you how you can implement a decent solution that is both quick and easy to implement in you own code. I built a class named DirectExcel that inherits the ASP.NET GridView control. The reason it inherits the GridView is because this exporting technique requires that our data be databound to a grid. First lets take a look at a snippet of code on how we can use this class.   Usage Snippet: SqlCommand oCmd = new SqlCommand(“usp_get_data “); oCmd.CommandType = CommandType.StoredProcedure;  // The report name will also be used as the filename when saving. DirectExcel directExcel = new  DirectExcel(“Report Name”);  // oCmd is a SqlCommand that contains the Query you want executed against the database  directExcel .Export(oCmd);   You will need to add a connectionString key to your web.config…

Read more

This is an example page.  For more information about pages and how to use them, visit the BlogEngine.NET wiki.