Edwin Daniel's profileMicrosoft technologies a...BlogLists Tools Help

Custom HTML

Microsoft technologies and what I do for fun

This space is mostly regarding Microsoft technologies and what I do for fun, as I consider my work as fun and exciting.
October 06

Who says only databases can be mirrored?

I have decided to mirror this blog to http://bassplayerdoc.blogspot.com It took me quite a while to make that decision but eventually, I did.  For those of you who have benefited from my blog entries, you can still do so on the other site. I still hope to see your positive support over that site as well.
September 06

Making a fool out of MSDB

I was restoring a SQL Server instance on a different server for DR purposes including system databases. What I have overlooked was the fact that restoring the msdb database would mean keeping the existing settings of the old instance into the new one. While I was trying to delete the database maintenance plans and the jobs, I keep getting an MSX-related error which prevents me from deleting the jobs.  I looked at the jobs by running the sp_help_job system stored procedure and found out that the originating_server column happens to be the name of my old SQL Server instance.  This was the primary reason why I could not delete the jobs either from Enterprise Manager or running the sp_delete_job system stored procedure.  To workaround that issue, I simply modified the originating_server column of the sysjobs table to the name of the current instance.  After that, I was able to delete the database maintenance plans and the jobs. Now, my server is ready for DR. Log shipping configuration is the next thing to do.
August 31

Installing SCCM 2007 Clients using Software Update Point

After installing System Center Configuration Manager 2007, we need to deploy the SCCM client. There are a lot of ways to deploy the SCCM client but I will be focusing more on using the Software Update Point as I have been using Windows Server Update Services (WSUS) for patch management. The first thing you need is to make sure that you already have a WSUS 3.0 in your infrastructure as you will be using this as your Software Update Point. The nice thing about this approach is that you already have your infrastructure set for software update management. 
 
  1. Install Software Update Point.
    • You need to install the Configuration Manager Software Update Point Site Role on top of your WSUS 3.0.  This could also be on another machine which points to a remote WSUS 3.0. If you are going to install this on a server separate from your WSUS 3.0 server, you need to have the WSUS 3.0 admin console prior to installing the software update point. If you want to use your primary site server as your software update point as well, you just need to add a new role and define it as a Software Update Point. The typical configurations for WSUS 3.0 will be used for this configuration, such as if you are using a proxy server to connect to Microsoft Updates, whether you are using an upstream WSUS 3.0 server, etc.  You can also enable a synchronization schedule.  A recommended schedule for this is on a weekly basis and after patch Tuesday (Tuesday afternoon my time).  In my case, I do manual synchronization and run once after patch Tuesday or anytme I get an email alert from Microsoft for Critical Security updates. You also define the classification - critical updates, service packs, etc. - the same way you do in WSUS. Then you specify the products which you need to configure the updates for.  Since you have Microsoft as the vendor by default, you can select which products are installed within your enterprise - Office 2003, SQL Server, Windows, etc. Then, you specify the different languages you need for those updates.
    • Note that the steps are similar to that of the WSUS 3.0 configuration. If you have configured yor WSUS 3.0 prior to deploying your software update point, those will be overwritten by your new configuration.
  2. Validate your configuration in the Software Update Point Component
    • Any configuration you've made in setting up your software update point can be validated in the Software Update Point Component under the Component Configuration.  So, if you need to do some modifications in the long run, this is the right place to do it.
  3. Configure the Software Update Point Client Installation
    • At this point, we still have to deploy the SCCM client in order to use our software update point for patch management. Under the Client Installation Methods, make sure that Software Update Point Client Installation is enabled. This is to publish the SCCM client to WSUS 3.0 as a mandatory update. Together with this, the appropriate BITS component will be downloaded by the client as well.
  4. Configure the Software Update Client Agents
    • Although we haven't really installed the SCCM clients at this point, we can already configure how our clients will behave like enforcing all mandatory deployments and deployment re-evaluation
  5. Configure a Group Policy for Windows Update
    • Similar to how we configure a group policy to point clients to download updates from a WSUS server, we need to do the same.  If you already have this in place, you can skip this portion. For a more detailed description on how to do this, check out this Microsoft TechNet documentation.  Make sure that you treat servers and workstations differently so you definitely need separate GPOs for these.
  6. Import the SCCM 2007 ADM Template

Now, we're ready to deploy the SCCM client and our Software Update Point has been configured as well. It's like hitting two birds with one stone. The best way to test whether our configuration is to log in to one of the machines in your domain and run a group policy update (gpupdate /force for Windows XP and Windows Server 2003 or secedit /refreshpolicy machine_policy /enforce for Windows 2000) and manually run a force detect of the Windows Update client (wuauclt /detectnow) If you open your Task Manager, you will see ccmsetup.exe in the Image name under the Processes tab.  Another way to find out if the SCCM client is being deployed thru WSUS 3.0 is to look at the WindowsUpdate.log file which contains information regarding the installation of Configuration Manager Client

Classic Active Server Pages Allowed? I have ASP.NET 2.0

Durnig my installation of System Center Configuration Manager 2007, I intentionally had the Active Server Pages setting to Prohibited in IIS 6.0.  This is because I always limit my configuration to only those that I use.  Since I assumed that .NET 2.0 is required to install SCCM 2007, I was assuming that it is using ASP.NET 2.0 in the reports.  To my surprise, when I launched the Virtual Machine provided for the online virtual hands-onlabs, the URL contains a .asp?some_value.  Being a part-time developer as I am, my instincts tell me that I need to Allow Active Server Pages on my IIS for this feature to work.  I just don't understand why Microsoft opted for classic ASP when they already have a rich-feature set available from ASP.NET 2.0 to use for generating those reports. 
August 23

Installing System Center Configuration Manager 2007

I am building my image to test System Center Configuration Manager 2007 (SCCM).  SCCM 2007 is the next generation SMS 2003 and is currently on RC1. Since I was responsible for maintaining the WSUS server in our infrastructure, I decided to take a peek at what SCCM 2007 has got to do with making my life easier with patch management. I've listed down a few things I did to prepare for SCCM 2007 installation.
 
  1. Windows Server 2003 SP1, SP2 or R2
    • Since I was doing a fresh installation, I chose Windows Server 2003 and installed SP2, although you can do this on a Windows Server 2008 as well.  This will act as my domain controller, my database server, my WSUS 3.0 server and my SCCM 2007 server. In a typical setup, you would want to offload your SCCM 2007 and have a separate WSUS 3.0 server and database server (I am assuming that you do not want to run anything on your domain controller machine aside from AD).
  2. IIS 6.0
    • You need to install IIS 6.0 if you want to take advantage of BITS technology for clients on low bandwidth connection. There are a lot of reasons for using IIS and this is just one of them. Make sure to enable WebDAV and install BITS Extensions for IIS.  I've learned this the hard way as my SCCM 2007 installation was not making any progress because of this.  Since I was concerned about security, I did not install those components which I don't need (ASP.NET, SMTP, FTP, NNTP, etc.)  The ASP.NET version which I need is v2.0.  The one which comes with Windows Server 2003 is v1.1. Another reason I am installing this first before any ASP.NET 2.0 component is that I no longer have to do anything related to ASP.NET 2.0 later on (like running aspnet_regiis.exe -i to install ASP.NET v2 on IIS). We just need to allow ASP.NET 2.0 later on in IIS after installing SQL Server 2005
  3. SQL Server 2005 with SP2
    • This will be my database server. Since SQL Server 2005 comes with .NET Framework 2.0, this takes care of my ASP.NET 2.0. Now since I will also host my WSUS 3.0 server on this machine, I can use this as the database server as well. Most of the time, I would work on different instances to identify which one is for what function since SCCM 2007 and WSUS 3.0 would require a database server. For this particular setup, I will just install one instance which will be used by both WSUS 3.0 and SCCM 2007. This makes management a lot easier for me. SP2 is definitely a must for SCCM 2007.  
    • After SQL Server 2005 has been setup, ASP.NET 2.0 needs to be allowed in IIS
    • If SQL Server 2005 will be on a different machine, you need to set the Service Principal Name (SPN) as well.  This is discussed in detail in this Microsoft KB article
  4. MMC 3.0
    • This will be required by both WSUS 3.0 and SCCM 2007.  MMC 3.0 requires .NET Framework 2.0 which was already installed because of SQL Server 2005
  5. BITS 2.5
    • This is a new download available since June 26, 2007.  It's a required component for SCCM 2007 and Windows Live OneCare (which I don't really need). There are a lot of versions for this but the one I installed is the one for Windows Server 2003.  We are definitely going to need the Windows XP version as well for client management
  6. WSUS 3.0
    • Since I will be doing patch management with SCCM 2007, I definitely need WSUS 3.0. WSUS 3.0 is required to setup a Software Update Point.  This is required for every primary site server that is managing software updates. SCCM 2007 is now tightly integrated with WSUS 3.0 for patch management.  WSUS 3.0 requires MMC 3.0 and .NET Framework 2.0 which has already taken cared of
  7. Run extadsch.exe
    • Similar to what you do in SMS 2003, you need to extend your Active Directory schema. You definitely need schema admins permission on your AD to do this
  8. Give the SCCM 2007 machine Full Control permissions on the System container in your Active Diectory
    • This procedure will allow your SCCM 2007 machine to create the Systems management container and its necessary objects. Since by default, the System container is not shown, you have to enable the Advance Options in your Active Directory Users and Computers
  9. Install System Center Configuration Manager 2007
    • Once you reach the system checker portion of the installation, it will give you some information on whether or not you can proceed with the installation. This was my hint that BITS Extensions for IIS was not installed
  10. Configure your Site Boundaries
    • In order for your clients to be able to find your management point with the help of Active Directory(and vice versa), you have to define your Site Boundary. Under Boundaries, create a new boundary.  You can specify whether your boundary type will be an Active Directory site,  an IP subnet, an IP Address Range or an IPv6 prefix. If you select an Active Directory site, you can browse thru your AD sites and read the information from there, taking advantage of your existing AD configuration.
  11. Configure the Discovery Method
    • If you will be using Active Directory as your discovery method, you need to configure this as well.  Under the Discover Methods, modify the proerties of the Active Directory System Discovery.  Make sure to enable Active Directory System Discovery.  You can also modify the Polling Schedule but for the purpose of testing, you can check the Run discovery as soon as possible checkbox so you can see later on when you start deploying your clients whether or not it is working.

It took me a couple of days to finish my installation as I still had to configure my WSUS 3.0 to download the patches I need. September security patches from Microsoft will be the next in the queue  

August 08

It's officially unofficial - DBCC PAGE

If you search for information about the DBCC PAGE command, the only Microsoft official document you'll find refers to a SQL Server version older than v7. One blog post  I found was from Paul Randall of the SQL Server Storage Engine Team which explains how to use DBCC PAGE in conjunction to using DBCC CHECKDB. DBCC PAGE is used to obtain the data that is contained in a SQL Server page structure. Before you can really take advantage of this tool, you need to run the DBCC TRACEON(3604).

Exchange Server 2003 Remote Wipe/MobileAdmin problem

When you deploy Windows Mobile on an Exchange environment, one of the things that you may want to configure is remote wipe.  This will enable administrators to wipe the device over-the-air. This is very helpful in cases where a Windows Mobile device is lost or stolen and you want to simply protect company-related data like emails and attachments.  While I was testing a device with an Exchange installation, I encountered an error on the site which does the remote wipe.
 

Server Error in '/MobileAdmin' Application.
--------------------------------------------------------------------------------

The remote server returned an error: (403) Forbidden.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Net.WebException: The remote server returned an
error: (403) Forbidden.

Now from the looks of it, this seems like a permission/security error on the site. Either this is a web application permission problem or something else. I found this site which solved my problem. It basically recommends that you uncheck the "Require secure channel (SSL)" option on the exadmin virtual directory.  This did the trick. Afterwhich, I was able to do a remote wipe on the device I was testing. The only worry I have is that now this web application is no longer secured unless you block access from the public Internet    

August 05

Disk Defragmenter Analyzer - Windows Vista

I was working on my laptop at home which runs Windows Vista Home. I was thinking of doing a disk defragmentation just to check.  I haven't defragmented my disks since I bought my laptop. So I used the familiar tools I used - Disk Defragmenter.  To my surprise, I don 't see the option to do an analysis first before doing a defragmentation. After a quick search on the Internet, I found out that you still can do analysis before you defragment your hard drive in Windows Vista. Below are the steps outlined to do so.
  1. Open the Command Prompt using the Administrator user context.  This is important as you definitely need administrator privileges to run the disk defragmenter
  2. Run this command: defrag C: -a (change C: to any drive you wish to analyze)
  3. Hit Enter and wait for a few minutes

This will display some statistics of how much your drive is fragmented.  This will give you an idea whether or not to perform defragmentation.  I was thinking of a thousand and one easons why Microsoft would take this out of the UI for Disk Defragmenter. I found a decent explanation here

July 31

Dynamic port detection

As a follow-up on my blog entry yesterday, I was doing more research on SQL Server port usage when I chanced upon this Microsoft KB. SQL Server clients use DBNETLIB to perform port detection.  This is either thru ODBC or SQLOLEDB componentes which loads DBNETLIB.  SQL Server clients can use the Client Network Utility for dynamic port detection.  This is to make sure that in case SQL Server uses a different port number during service startup or is configured to user dynamic port assignments, the client can map to the port number that a specific instance uses. Now, what if the client is a third party application running on a non-Microsoft platform(like a JSP application running on top of Apache on a Linux box?)  How does this port resolution work?
July 30

What? I lost my port on a named instance?

One thing I realized is that SQL Server port numbers will not be the same for I don't know what reason.  I found this out while rebuilding a SQL Server named instance. We had standard settings in setting up SQL Server. But since I am rebuilding my test environment, I just used the default port number settings (which is 1433) during the process. To my surprise, it was using port number 3080 when the service started. Apparently, SQL Server dynamically determines the port it listens on. It will try to listen on the port it used previously. If for some reason it cannot bind to that port, the named instance may bind to a different port - which is obviously the case for my setup. Now this would cause a lot of problems if your SQL Server is interacting with a lot of servers, services and applications as you need to either change the port number to it's original value (which I think would be more appropriate) or change the clients to use the new port number. I have yet to dig up more details on this as to why SQL Server behaves that way. At least I know another place to look at when troubleshooting connectivity problems
July 27

The Pains of Collation Settings

Collation settings define the physical storage of character strings in SQL Server. It specifies the bit patterns that represent each character and the rules by which characters are sorted and compared. Collation settings have a direct impact on the databases if you configure them to use a different collation other than the default. When you configure a different collation setting during the installation, the rest of the databases (system and user-defined) will have this setting was their default when you create them unless you specifically defined something different from the default. One case I encountered was that the tempdb database had a different collation setting compared to the user databases. This is because SQL Server was reinstalled and the master and msdb databases were restored from backup together with the user-defined databases. This made the collation settings of the entire database server back to their original configuration - well, almost. Since the model database was not restored (and obviously, the tempdb database does not require a backup), collation settings for the both would be the settings defined during re-installation. A script executed in one of the user-databases would require the use of the tempdb and since they do not have the same collation settings, queries will fail unless the queries themselves take into account collation setting differences. The next best bet is to rebuild the master database and change the collation settings and go through all the grueling task of restoring the system databases, provided that the user-defined databases are still intact. Well, another approach would be to simply restore the model database if you have a backup (or simply look for the old MDF and LDF files if they are still working fine). This is because tempdb database takes the settings of the model database everytime SQL Server service starts.  This will resolve collation problems should you encounter a similar case  
July 26

When backups can't be restored

We always think that having a backup is more than enough to keep us afloat during a disaster. I always say that any backup will be useless unless it is tested.  I came across one case where a SQL Server 2000 backup for the master database cannot be restored because it was generated using a different patch set for SQL Server 2000. The backups were generated before applying SQL Server 2000 hotfix 2191.  After the patches were applied, a restore was attempted but failed.  An error was encountered which specifies that the backup was generated by an earlier version of SQL Server. A best practice approach is to generate backups before and after a patch will be applied. This makes sure that you have valid backups in case something happened.  It may be a bit costly as far as disk space is concerned but it sure beats not having a valid backup. It may even save you from spending sleepless nights trying to rollback to the patchset which generated the backups.   
July 25

Importing Word and Excel as InfoPath 2007 Forms

If you have been working with business forms, you probably have created a few in either Microsoft Word or Excel.  One thing to make managing business forms a lot easy is to upload them in your Sharepoint portal.  This makes it easy to have a standardized form easily available to the rest of the organization. You can also port them over as InfoPath forms. In Sharepoint 2007, you have the option to use Forms Services instead of individual forms.  This makes it easy for users to have a unified and standardized format plus the advantage of binding the form to a backend database for data collection. If you have existing Word or Excel forms, you can easily import and convert them in InfoPath. Just run the Import Form Wizard in InfoPath to convert your existing Word and Excel forms to InfoPath forms - no need to re-create those forms.  For more information, check out the Introduction to importing and exporting form data and form templates
 

Security Configuration Manager for Windows Mobile

I was preparing my demos using .NET Compact Framework 3.5 and Visual Studio Orcas. I was using 2 devices for testing - an O2 XDA II mini running Windows Mobile 2003 and an O2 Atom Life running Windows Mobile 6 which I upgraded from v5.  I created a very simple PocketPC 2003 project in Visual Studio Orcas - a form with UI like buttons and drop-down lists. Deployment was straight forward in Windows Mobile 2003. So I ported the same project to a Windows Mobile 6 Professional project. Upon deployment on the O2 Atom Life, I get this error:
 
 Installation error. Stop all applications and processes,
maximize available storage space, and run installation again. Support info: 4
What I thought was a simple project turned out to be a nightmare. I checked the program Files folder and found out that my application was deployed as I see my EXE file. So I decided to run the EXE file and I got this error.

An unexpected error has ocurred in app.exe. Select Quit and
then restart this program, or select Details for more information.

This application requires a newer version of the .NET Compact
Framework than the version installed on this device

I checked the Microsoft.NET CF 3.5.LOG file and it looks like I have deployed the .NET Compact Framework 3.5 properly. I was beginning to think that the device has something to do with it as I tried using a Dopod PDA phone and didn't have any problems. I suspect this has something to do with the device security. Upon persistent inquiry (thanks to the guys from Microsoft APAC and Singapore),  I was led to do two things - either sign the cab with a test certificate which ships with Visual Studio Orcas and the Windows Mobile SDK using the cabsigntool.exe or disable the device security. Option 1 is not a choice for developers as you will be doing this on a regular basis - creating projects, deploying the projects on the device for testing, etc. Besides, you don't want to be doing this every time you come up with a new project or re-deploy a modified project. So option 2 looks like a preferred choice. In order to disable the device security, you need the Security Configuration Manager tool for Windows Mobile. In Visual Studio Orcas, this is already available. You can check the security level of your device and can be used to turn it off (only possible with Pocket PC - Windows Mobile 6 Professional and Windows Mobile 5 PocketPC). I managed to turn off my device's security and deployment worked like a charm.  For more information on these, you can check out the following websites

 

http://blogs.msdn.com/windowsmobile/archive/2007/04/25/security-configuration-manager-powertoy-an-orcas-feature.aspx

http://blogs.msdn.com/hegenderfer/archive/2007/05/23/a-windows-mobile-security-primer-for-developers.aspx

http://msdn2.microsoft.com/en-us/library/bb278115.aspx


June 29

Managing the Windows Internal Database (SQL Server 2005 Embedded Edition)

I keep getting questions on the Windows Internal Database. The first time I heard about this, I thought Microsoft may have missed out on informing me about the SQL Server 2005 Embedded Edition as this does not appear in the list of Editions for SQL Server 2005 ;-). This is the replacement for WMSDE which a few of the Microsoft products - Windows Sharepoint Services 3.0 and Windows Software Update Services 3.0, for example- use as a backend database. Most of the questions I get are administration related like how to shrink the database files, move them on a different partition, etc. By default, there is no tool available to manage the database hosted in this instance (MICROSOFT#SSEE).  But you can use the available SQL Server 2005 tools to do administration and maintenance.  The simplest there is will be to install SQL Server 2005 Management Studio Express.  This is an available download from the Microsoft Download Center. You just have to register this instance on the Management Studio Express to be able to administer it. One thing to remember is that during the registration process, you have to specify the Network Protocol option in the New Server Registration window to be Named Pipes as this is the one being used by this instance. Once connected, you can now start managing the databases running on this instance.  Another way is to use the sqlcmd tool.  This is the command-line utility of choice for SQL Server 2005, although you can still use the osql utility. You need to download the SQL Server 2005 Native Client and SQL Server 2005 Command Line Query Utility from the Microsoft Download Center. You need to install the Native Client first before installing the Command Line Query Utility.  Once installed, you can run sqlcmd.exe from the command line.  This is typically installed in this directory 

C:\Program Files\Microsoft SQL Server\90\Tools\binn


To connect to the Windows Internal Database instance (MICROSOFT##SSEE), run this command
sqlcmd -S \\.\pipe\MSSQL$MICROSOFT##SSEE \sql\query –E
Once connected, you can now execute those TSQL scripts that you are familiar with to manage and administer databases in this instance.
June 20

Views in SQL Server 2005

I normally get inquiries regarding migration from SQL Server 2000 to SQL Server 2005.  Most of which have something to do with security mechanisms.  Introduced in SQL Server 2005 is the new concept of schemas.  Objects are now grouped in schemas unlike in SQL Server 2000 where we refer to objects using their owners. Now, most vendors who did not define their objects in this manner will have problems when they migrate to SQL Server 2005 as their owners are now converted to schemas.  This is going to be a big headache if there are a lot of owners owning different objects.  One way to do this is to create those schemas if they are not created assign users permissions to those schemas. Another way to do it is to create views.  Views provide backward compatibility by defining a view to emulate a table that used to exist but whose schema has changed. This also helps users go through the upgrade process, especially those who frequently access the database by executing TSQL queries. It may be a lot of work but this is what one has to work with if databases have to be migrated to SQL Server 2005. I never thought that this could be a possible inclusion in the migration process from the point of view of both applications and end users

Creating Windows Vista Sidebar Gadgets (for infrastructure guys...and gals)

As Windows Vista has been being pushed by OEM vendors in both the desktop and mobile computers, application developers are leveraging on the platform to build applications. Windows Vista introduced the Sidebar – an anchored panel on the Windows desktop that can host mini-applications known as gadgets. Gadgets are “mini-applications” presenting functionality and are small, lightweight specialized, residing on the local computer which responds to user interaction They can be created using HTML/DHTML, JavaScript and CSS. Now you might be thinking why I had this under the .NET Development category when I only need HTML to create gadgets.  This is because there are .NET APIs which can be accessed by these gadgets.  Windows Vista ships with gadgets that can track stock prices, display news feeds, and deliver weather forecasts. Of course, application developers can think of just about anything these gadgets can do like communicating with an aggregated web service and stuff like that. You can check out these references on how to create Windows Sidebar gadgets
 
 
As an infrastructure guy, I am more concerned about leveraging gadgets to make my life a bit easier as a systems engineer. This is when I created a gadget that uses WMI. Since I do regular auditing of all our servers within our domain, I created a script which automates just that. I had this initially in VBScript which writes information in a text file (see my previous blog post on this topic). What I simply did was to convert my existing script to a gadget. Do take note that gadgets only run on Windows Vista and not not previous Windows versions. Below is a snippet from my script
 
<html>
<head>
    <title>My Gadget</title>
    <style>
        body{width:120;height:80}
    </style>
</head>
<script language="VBScript">
    Sub Window_Onload
        GetMemory
        iTimerID = window.SetInterval("GetMemory", 10000)
    End Sub
    Sub GetMemory
        Set objLocator = CreateObject("WbemScripting.SwbemLocator")
        Set objWMIService = objLocator.ConnectServer(".", "root\cimv2")
        Set colItems = objWMIService.ExecQuery("Select * From Win32_OperatingSystem")
        For Each objItem in colItems
            DataArea.InnerHTML = objItem.FreePhysicalMemory
        Next
    End Sub
    Sub RunSub
        Set objLocator = CreateObject("WbemScripting.SwbemLocator")
        Set objWMIService = objLocator.ConnectServer(".", "root\cimv2")
        Set colItems = objWMIService.ExecQuery("Select * From Win32_ComputerSystem")
        For Each objItem in colItems
            strHTML = "Computer Name: " & objItem.Name & "<br>"
            strHTML = strHTML & "User Name: " & objItem.UserName & "<br><br>"
        Next
        Set colItems = objWMIService.ExecQuery("Select * From Win32_OperatingSystem")
        For Each objItem in colItems
            strHTML = strHTML & "Operating System: " & objItem.Caption & "<br>"
            strHTML = strHTML & "Service Pack: " & objItem.ServicePackMajorVersion & "<br><br>"
        Next
        Set colItems = objWMIService.ExecQuery("Select * From Win32_Processor")
        For Each objItem in colItems
            strHTML = strHTML & "Processor: " & objItem.Caption & "<br><br>"
        Next
        Set colItems = objWMIService.ExecQuery _
            ("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
        For Each objItem in colItems
            strHTML = strHTML & objItem.Caption & "<br>"
            For Each strAddress in objItem.IPAddress
                strHTML = strHTML & "IP Address: " & strAddress & "<br>"
            Next
        Next
        Set objIE = CreateObject("InternetExplorer.Application")
        objIE.Navigate("about:blank")
        objIE.Toolbar = 0
        objIE.StatusBar = 0
        Set objDoc = objIE.Document.Body
        objDoc.InnerHTML = strHTML
        objIE.Visible = True
    End Sub
</script>
<body>
    <span id="DataArea"></span><p>
    <input type="button" value="Information" name="run_button" onClick="RunSub">
</body>
</html>
  
This simply displays hardware information from the local machine and displays it in an HTML page (with a little monitor on the available memory resource). Next thing I would probably do is query Active Directory for the registered servers in the domain and execute the same set of functions to retrieve hardware information. This highlights how we can take advantage of Windows Vista as an application platform - not just for developers but also for infrastructure guys who simply want to make their lives a lot easier. Scripting skills are definitely a must here :)
May 11

Need to script your SQL Server Database schema with data?

This used to be one of my problems before. Whenever we do some tests on custom applications which require backend SQL Server databases, we had to generate the script to create the database schema and populate the database. The problem is that SQL Server does not have this feature. Either you create the database schema script and use DTS to import the data from the old database to the new one. The problem most of the time is that the old and the new databases are not in the same network - probably being deployed to a hosting service provider. There's no way you can do this in DTS. I created a .NET/VB application to do this for me. My application generates a text file which contains INSERT statements for all the data in all of the tables inside the database. This output, together with the script generated by SQL Server has to be both executed on the target database server. Microsoft came up with the Microsoft SQL Server Database Publishing Wizard 1.1. This enables the deployment of SQL Server databases into a hosted environment on either a SQL Server 2000 or 2005 server. It generates a single SQL script file which can be used to recreate a database (both schema and data) in a shared hosting environment where the only connectivity to a server is through a web-based control panel with a script execution window. If supported by the hosting service provider, the Database Publishing Wizard can also directly upload databases to servers located at the shared hosting provider. I wish Microsoft had something like this 7 years ago. It would have probably made my life and a lot of developers' and DBAs' life a lot easier.
May 09

Need a new face for your Remote Web Workplace?

Remote Web Workplace is one of those cool features in Windows that only Small Business Server has. Using the Remote Web Workplace, you can access your company's server from any Internet-enabled computer such as a home computer, Internet kiosk, or laptop. By default, all users created using a Windows Small Business Server 2003 user template can access the Remote Web Workplace. There are a lot of people who wanted to customize how the Remote Web Workplace looks like when users have successfully logged in. If you're comfortable with HTML and ASP.NET coding, you can modify the admin.aspx (for administrators logging in) and/or client.aspx (for anybody else) inside C:\Inetpub\Remote folder. The web.config file also includes some of the configuration settings for these pages so you might want to have a look at it as well. Just make sure you backup these files before you start making modifications so that you can always revert back to the originals if things screw up.

WSUS client not updating? Here's a script to test

One prerequisite for your Windows Update to work is for the Automatic Updates and BITS services to be both started and set to automatic. In some cases, these may be configured not to run due to some security policies being implemented internally. One way to find out is to go to the Services applet and check whether they are started and set to automatic. Being a lazy guy as I am, I always find ways to make life a lot easier (even if doing this is jus a few mouse clicks away). So I wrote a script to do this for me. The script checks if both these services are stopped and if they are will start them.  It also includes forcing the group policy just in case something was changed with respect to the GPO for WSUS and forcing the WSUS client to detect new updates. Checking for either Windows 2000, Windows XP and Windows 2003 is also included. Of course, if your WSUS client is totally screwed, you will have to re-register some of the DLLs in order for it to work.
 
'Script to change the startup type of Automatic Updates and Background Intelligent Transfer Service

'Variable to specify computer name. To run on a remote machine, change the . to IP Address
strComputer = "."
'Create a WMI object for the specified computer
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
'Query the Win32_Service namespace and search for the service name Alerter. Change to appropriate service name when necessary
Set colServiceList = objWMIService.ExecQuery _
    ("Select * from Win32_Service WHERE DisplayName='Background Intelligent Transfer Service' OR DisplayName='Automatic Updates'")

'******************************************************************
'Iterate thru the Win32_Service namespace to find the BITS and AU services
For each objService in colServiceList
 'Check for StartMode
 'if not Automatic then change to Automatic
 'Change the startup type to Disabled. You can also set it to either Manual or Automatic
 If objService.DisplayName="Automatic Updates" Then
        If objService.StartMode="Auto" Then 
                  objService.StopService() 
                  objService.ChangeStartMode("Disabled")
        Else
                  objService.ChangeStartMode("Automatic")
                  objService.StartService() 
        End if
 Else
        If objService.StartMode="Auto" Then 
                 objService.StopService() 
                 objService.ChangeStartMode("Manual") 
        Else
                 objService.ChangeStartMode("Automatic")
                 objService.StartService() 
        End if
 End If
 
Next
SET objShell = CreateObject("Wscript.Shell")
'Get OS Information
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSettings = objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem")
For Each objOperatingSystem in colSettings
 If INSTR(objOperatingSystem.Name,"Windows 2000") <> 0 Then
       'run secedit /refreshpolicy machine_policy /enforce
       objShell.Run("%COMSPEC% /c secedit /refreshpolicy machine_policy /enforce & wuauclt /detectnow")
 ElseIf INSTR(objOperatingSystem.Name,"Windows Server 2003") <> 0 Then
       'run gpupdate /force
       objShell.Run("%COMSPEC% /c gpupdate /force & wuauclt /detectnow")
 Else
       'run gpupdate /force - this is for Windows XP clients as Windows 2000 Professional also uses secedit
       objShell.Run("%COMSPEC% /c gpupdate /force & wuauclt /detectnow")
 End If
Next
Set objWMIService=NOTHING
SET objShell=NOTHING
'******************************************************************
'Just a notification that the script has finished executing
WScript.Echo "FINISHED"

April 24

SERVERENTERPRISE or SERVERENTERPRISECORE?

One of the options that you will encounter when you setup Windows Lonhorn Server CTP is to choose between SERVERENTERPRISE and SERVERENTERPRISECORE. But what is really the difference between the two? Administrators can choose to install only the core server functionalities without the additional overhead using the SERVERENTERPRISECORE option. This limits the roles that can be performed by the server but can improve security and reduce management.  Imagine a stripped-down version of the server product with this option. You can consider this as a subset of the Longhorn full product package. This is useful for large organizations with many servers performing very specific roles like DNS, DHCP, Terminal Service, etc. Choosing the SERVERENTERPRISE option gives you all of the features that you may want to run similar to that of Windows Server 2003. This is for small to medium sized organizations with few servers running many services in a single machine.

Listing Running Web Applications in IIS 6.0

Identifying which web application is eating up your server resources is troublesome as the Task Manager will only show you the w3wp.exe process with its corresponding process ID (PID).  Good thing that Windows has a script named iisapp.vbs which is stored in the systemroot\system32 folder which you can execute to identify the web application your w3wp.exe process is associated with.  Best practices tell us that a web application should be assigned an application pool and identifying the application pool on which a web application runs is just a matter of running the iisapp.vbs script.  A full details of the script can be found on the Microsoft TechNet site
 
A sample output of the script is shown below
 
W3Wp.exe PID:    1234    AppPoolID:  AppPoolNameYouCreated
W3Wp.exe PID:    5678    AppPoolID:  DefaultAppPool
This will identify which application is eating up your server resources, probably caused by a bug or inefficient code.  This is of course just part of solving the problem of performance issues with web applications. Different platforms behave differently - PHP, JSP, ASP, ASP.NET, etc.  the important thing here is we've already narrowed down which one to debug
April 09

Uninstalling SQL Server 2005 Embedded Edition

I thought I was just seeing things when I saw this in the Services applet - SQL Server 2005 Embedded Edition(MICROSOFT##SSEE).  This is the version of SQL Server 2005 that Windows Sharepoint Services 3.0 installs on your server if you simply choose all the defaults. The problem with this is that there is no way for you to manage it from the SQL Server tools we are all familiar with (I tried it with Management Studio and sqlcmd but with no luck as it just throws an error saying that the server instance does not exist).  Besides, if you want to scale up your database, you would have to migrate it to either Standard or Enterprise Edition.  This renders this instance useless. Most of us will simply recommend uninstalling this version.  The problem is, you won't see this in your Add/Remove Programs applet in Windows. It's an invisible instance that the only way to uninstall this is to uninstall Windows Sharepoint Services as well (unless you want to go through the process, I suggest not doing a complete reinstall).  So how do you uninstall SQL Server 2005 Embedded Edition?  I found it through this website.
 
1. Start Registry Editor, and then locate the following registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
2. In the left pane, click each GUID. For each GUID that you click, look for a display name in the right pane that matches “Microsoft SQL 2005 Embedded Edition…”.
3. When you see a display name that matches the name, copy the value of the Key named “UninstallString
4. Open a Command-Window (Start->run->cmd)
5. Paste the Copied string. It should be something like this: MsiExec.exe /X{BDD79957-5801-4A2D-B09E-852E7FA64D01}
6. Append “ CALLERID=OCSETUP.EXE” at the end of the MsiExec.exe eg “MsiExec.exe /X{BDD79957-5801-4A2D-B09E-852E7FA64D01} CALLERID=OCSETUP.EXE”
7. Run the command. This will go through the process of uninstalling SQL Server 2005 Embedded Edition
8. Reboot.

To verify, you can check the Services applet and see if the SQL Server 2005 Embedded Edition (MICROSOFT##SSEE) service is no longer there
April 07

It Is Screwed (IIS) v6- Installing Microsoft Office Sharepoint Server 2007

I was playing around with Microsoft Office Sharepoint Server 2007 and installing it on a virtual machine running Windows Server 2003 R2. I followed the Microsoft documentation on installing MOSS 2007 as a stand-alone server, installing the prerequisites - IIS, .NET Framework 2.0 and 3.0. Installing MOSS2007 went fine until the time that I needed to test the installation by accessing the website.  To my surprise, I had a Service Unavailable error on my browser.  I checked the Event Log for some clues, restarted a few services, re-installed ASP.NET 2.0, and all sorts of stuff but to no progress. The only option I have left is reinstalling from scratch.  Good thing about my virtual setup is that I have a base image of Windows Server 2003 R2 which I am ready to startup anytime. While I was getting ready to re-install, my gut feel prompted me to test IIS before installing .NET Framework 2.0.  That's when I found out that it was my IIS that wasn't installed properly. I ran a few tests like creating a simple ASP and HTML pages to view. Re-installing IIS did the trick.  After I am sure that IIS is working fine,  I went through installing MOSS2007 quick and easy.  Installation is one thing, managing is another.  I'll work on that in a couple of hours.