Archive for the ‘Tools’ Category.

Add “VS.NET Command Prompt Here” to Windows Explorer

I was browsing one of my new favorite websites, Microsoft’s Script Repository, when I came upon the Add “Command Prompt Here” to Windows Explorer” Web page.  This script adds a “Command Prompt Here” command to the Windows Explorer system menu, so that if you select the command, a command window will open up in the same folder.  Nifty, eh?  Yes, I know, this has been around for quite awhile and is nothing new.  But, with a little twist, this can become a lot more useful.

Personally, I never use “cmd.exe” by itself.  I always use the ”Visual Studio 2005 Command Prompt”, as it has all the useful and fun PATHs already added to it.  So, with a small tweak to the script, we get the following enhancement:

Very handy!

Here’s the script (it’s so simple that I’m embarassed to share it!):

Set objShell = CreateObject(“WScript.Shell”)

objShell.RegWrite “HKCRFolderShellMenuTextCommand”, _
    “cmd.exe “”C:Program FilesMicrosoft Visual Studio 8VCvcvarsall.bat”" x86 /k cd “ & chr(34) & “%1″ & chr(34)
objShell.RegWrite “HKCRFolderShellMenuText”, “VS.NET Command Prompt Here”

As I said, pretty simple, but oh so useful!

CommandPromptHere.vbs (.29 KB)

I hope this helps!

Script the creation of local user accounts for Commerce Server 2007

I’ll be honest … I’m lazy.  I hate doing repetitive things over, and over, and over again.  So, while I was going through and installing Commerce Server 2007 on a new virtual machine, I decided to script out the creation of the local user accounts.  Before we get to the script, a little background …

It is recommended that you create multiple accounts to handle the various roles within Commerce Server (such as the four web services, staging, etc).  In a production environment, these should be created as Domain accounts; however, in development (or the virtual world) you may not have access to, or wish to use, a domain. Consequently, you can create these users as local accounts as well.

Below is a script that will go ahead and create these local users for you (if I have time I’ll create a similar script for domain accounts).  Copy the text (or download the link) and save it to a .vbs file.  You should be able to simply double-click the file, and then open up Local Users and Groups under Computer Management to double-check.

‘ =====================================================
‘ Author:        Wade Wegner
‘ Create date:   06/13/2007
‘ Description:   Automate the creation of CS 2007 users
‘ File Name:     CreateCS2007LocalUsers.vbs

‘ =====================================================

‘ Set the local computer name
strComputer = “.”

‘ Run the Load method
Load

‘ Encapsulates the processing of this script
Sub Load()

   ’ Create the CS 2007 users
   CreateUser “CatalogWebSvc”,“Pa$$w0rd”,“Account for running the Catalog Web service”
   CreateUser “CSDMSvc”,“Pa$$w0rd”,“Account for running the Commerce Server Direct mailer service”
   CreateUser “CSHealthMonitorSvc”,“Pa$$w0rd”,“Account for running the Commerce Server health Monitoring service”
   CreateUser “CSLOB”,“Pa$$w0rd”,“Account for running the Commerce Server adapters”
   CreateUser “CSStageSvc”,“Pa$$w0rd”,“Account for running the Commerce Server Staging service”
   CreateUser “MarketingWebSvc”,“Pa$$w0rd”,“Account for running the Marketing Web service”
   CreateUser “OrdersWebSvc”,“Pa$$w0rd”,“Account for running the Orders Web service”
   CreateUser “ProfilesWebSvc”,“Pa$$w0rd”,“Account for running the Profiles Web service”
   CreateUser “RunTimeUser”,“Pa$$w0rd”,“IIS account for accessing a Commerce Server site or application”

   MsgBox “Complete!”

End Sub

‘ Create the local user
Sub CreateUser(userName, password, description)

   ’ Check to see if the user exists; if so, then skip
   If NOT CheckIfUserExists(userName) Then
      Set objComputer = GetObject(“WinNT://” & strComputer & “”)
     &
nbsp;Set
objUser = objComputer.Create(“user”, userName)

      objUser.SetPassword password
      objUser.FullName = userName
      objUser.Description = description
      objUser.Put “UserFlags”, 65600 ‘ Sets Password Never Expires to TRUE
      ’ and sets User Can’t Change Password to TRUE
      objUser.SetInfo
   Else
      MsgBox userName & ” already exists!”
   End If

End Sub

‘ Check to see if user exists
Function CheckIfUserExists(userName)

   Set objComputer = GetObject(“WinNT://” & strComputer & “”)
   objComputer.Filter = Array(“user”)
   intFound = 0

   For Each User In objComputer
      If lcase(User.Name) = lcase(userName) Then
         intFound =
      End If 
   Next

   If intFound = 1 Then
      CheckIfUserExists = True
   Else
      CheckIfUserExists = False
   End If

End Function

And there you have it!

CreateCS2007LocalUsers.vbs (2.46 KB)

I hope someone else finds this useful!

What’s your Google rank or page position?

I often find myself curious as to what my rank/position on Google is, given a set of keywords.  For example, I know that if I search on my name “Wade Wegner” this blog comes up second (my personal site being first).  However, I sometimes wonder where my blog falls for other keywords, such as “commerce server 2007″ or “biztalk server 2006″.

So, I wrote this little tool to tell me!

This tool allows you to specify your URL (e.g. “http://www.wadewegner.com/“) and some keywords (e.g. “commerce server 2007″) and tells you what number you are.  Currently, I have it scan only the first 1000 Google entries.

Useful, yes?

I realize it’s a simple interface, but I just quickly slapped it together.

Any one know if this violates any of Googles terms of use?  I hope not!

Enjoy!

Troubleshooting with the Sysinternals utilities

As a consultant, I often have to spend a great deal of time diagnosing issues that are confronting my clients.  Over the years I’ve used some of the tools available from Sysinternals, but I honestly never put a lot of energy or time into really learning to use them.  On my most recent project, however, I’ve found them to be tremendously helpful, and I’m now a confirmed believer!

There are a number of useful tools available, and I don’t profess to have used or mastered them all.  There are a few, however, that I strongly encourage you to familiarize yourself with:

  • Process Monitor – This montioring tool monitors the file system, Registry, processes, threads, and DLL activity in real-time.  Ever need to track down where data is getting written?  Ever wonder why you try to write or read from the Registry and receive errors?  This utility will help you track that down.  Process monitor is a combination of two older tools (Filemon and Regmon), and adds a whole slew of additional features such as rich and non-destructive filtering, comprehensive event properties such session IDs and user names, reliable process information, full thread stacks with integrated symbol support for each operation, simultaneous logging to a file, and more.

  • Process Explorer – Find out what files, registry keys and other objects processes have open, which DLLs they have loaded, and more. This utility will even show you who owns each process.  This tool is excellent for tracking down programs or processes that have locked files and directories.  It also has some powerful search capability that shows you which processes have handles opened or DLLs loaded.

  • BlueScreen Screen Saver – Okay, so this isn’t a monitoring tool, but it’s part of the Sysinternals suite and it’s great!  Just load this up as the screen saver for your favorite person at work, sit back, and enjoy the show!

Take the time to explore the various tools that are available on the Sysinternals Web site.  There are a lot of tools that will make debugging and problem solving less of a hassle.

Best of luck!

Creating a Universal Data Link (UDL)

It’s often nice, while working with BizTalk (or any other MS product, for that matter) to have UDL files available to allow you to quickly setup your connections to various databases.  A UDL file is essentially a file that saves connection information, making it available for future use.

To create a UDL file, follow these steps:

  1. Open a folder (or use the desktop) and create a new text file (right-click –> New –> Text Document).
  2. Rename the extension from “.txt” to “.udl”.  Ignore the warning message.
  3. Double-click the new UDL file.
  4. Configure your database connection settings.

  5. Once you’ve been able to successfully test your connection, click the OK button.

That’s it!  It’s that simple!  Now your UDL file is available for future use.

Best of luck!