Blog

Scripting the Installation of Supplemental Language Support

I've spent a lot of time lately working on automating server builds. One of my TODOs which I finally tackled today was installing support for the Complex Script and East Asian language packs which you normally have to manually check off in the regional control panel:

If you have run Active Directory in a large environment, particularly with domain controllers in Asia or the Middle East, chances are you've gotten this event before (or a similar one):

Event Type:    Error
Event Source:    NTDS ISAM
Event Category:    General
Event ID:        604
Date:            11/17/2008
Time:            12:23:28 AM
User:            N/A
Computer:        TOKYO-DC02

Description:
NTDS (648) NTDSA: Locale ID 0x00000411 (Japanese Japanese) is either invalid or not installed on this machine.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

You get these when Outlook clients connect via NSPI and they're running one of the languages you need to manually install support for with the UI above. Checking the boxes, providing Windows with your install CD, and rebooting will take care of these errors. There's no particularly easy way to do this from a script though. Some Google searching revealed that KB289125 discusses how to do this. This blog entry also has a lengthy discussion in the comments.

I came up with the following little script which works properly on Windows Server 2003 (x86 and x64 versions). Note you'll need to reboot for these changes to be complete:

Dim shl
Set shl = WScript.CreateObject("WScript.Shell")

Dim fso
Set fso = WScript.CreateObject("Scripting.FileSystemObject")

' install complex character & far east support
WScript.Echo "Installing Complex Script and East Asian language support"
Dim intlConfig
Set intlConfig = fso.CreateTextFile("c:\scripts\intlunattend.txt")

intlConfig.WriteLine "[RegionalSettings]"
intlConfig.WriteLine "LanguageGroup = 7,11" ' 7 = Japanese, 11 = Thai
intlConfig.Close    

shl.Run "cmd /c start /wait rundll32 shell32,Control_RunDLL intl.cpl,,/f:""c:\scripts\intlunattend.txt""", 0, True

NOTE: On Windows Server 2003 x64, you need to have access to the AMD64 and i386 folders in order for this to work. I spent a bunch of time running in circles on this.

The entry point called here will use the base Windows Setup APIs, so, it will reference these two registry keys by default:

  • HKLM\Software\Microsoft\Windows\CurrentVersion\Setup\SourcePath
  • HKLM\Software\Microsoft\Windows\CurrentVersion\Setup\ServicePackSourcePath

The correct syntax for these is to point to the parent folder containing the setup files. So, if your setup files are in C:\i386, you would set these registry keys to "C:\".

If you want to specify a custom path to the installer (let's say E:\AMD64), you should add /s:"E:\AMD64" to the command (remember to double quote in VBScript) right after the /f call:

shl.Run "cmd /c start /wait rundll32 shell32,Control_RunDLL intl.cpl,,/f:""c:\scripts\intlunattend.txt"" /s:""e:\amd64""", 0, True

You can also do all this during unattended setup. Take a look at the [RegionalSettings] section of deploy.chm if you're planning on doing this as there are some caveats and additional steps (nothing complex though). Also note that I believe all this is totally different in Vista/2008 so I don't think any of this will work in that scenario

Posted Sunday, November 16 2008 by Brian Desmond | 1 Comment
Filed under: it,active-directory,scripts


Updated Attachments and Links

I just went through and fixed all of the posts (mostly scripts I shared) which referred to attachments which weren't there anymore. When I migrated this site to the new software I'm using a couple months ago, the migration tool didn't migrate attachments. All of the attachments from before are now back where they were, just as normal links since this new software platform doesn't support attachments directly. I apologize for any inconvenience encountered if you found a broken link.

Posted Saturday, November 15 2008 by Brian Desmond | No Comments
Filed under: scripts,active-directory,it


Amazon EC2 on Windows

Amazon announced the ability to run Windows virtual machines on their cloud computing platform, EC2, a few weeks ago. I had the opportunity to play with the technology for a few weeks and I was really impressed all around with the experience. If you're looking at solutions for on demand computing or want to have a relatively inexpensive and flexible hosting solution you can control completely, you should definitely take a look at EC2.

I wrote a couple of articles for Amazon as part of the launch of Windows on EC2. The articles cover deploying an ASP.Net app on an EC2 instance and configuring SQL Server 2005 to work with the Amazon EC2 platform. If you're interested in getting a quick feel for how the platform works, check these articles out:

Posted Saturday, November 15 2008 by Brian Desmond | 1 Comment
Filed under: it


Retrieving Machine Serial Numbers from the Command Line

Here's a handy trick I discovered recently when I needed to get a lot of server serial numbers pretty quickly. Normally you have to login to the Dell or HP management website and dig around before you can get the serial number. Sometimes the website doesn't work and you're either negotiating with the local support guy to go find it for you (and then the data's suspect by definition), or you're just out of luck.

You can grab this easily from the command prompt. Look up the wmic switches for info on connecting remotely to a machine:

C:\>wmic

wmic:root\cli>systemenclosure get serialnumber

SerialNumber
ABC12345

wmic:root\cli>exit

C:\>

Posted Saturday, November 15 2008 by Brian Desmond | 1 Comment
Filed under: it,scripts


Zune Error

Apparently the error below from Zune is indicative of some sort of problem with your DRM data. The redirect is to KB 929642 which of course doesn't list the error message, but it was a useful clue.

---------------------------
Zune
---------------------------

Zune encountered a critical error and needs to close. For instructions on correcting this error, open the URL below in a web browser.

http://go.microsoft.com/fwlink/?
LinkId=105744&locale=409&geoid=f4&version=2.5.447.0&userlocale=409&system=ZuneClient

---------------------------
OK
---------------------------

On my x86 box which hosts the Zune software, C:\Documents and Settings\All Users\DRM is where all this stuff is. You can check by going to HKLM\Software\Microsoft\DRM and looking at the DataPath value. If you double click it, the registry editor is kind enough to decode the binary data to ASCII. The KB referenced above also has some info on where to find this folder on other platforms.

I simply opened a command prompt, renamed my DRM folder, and let the Zune software rebuild it:

C:\Documents and Settings\bdesmond>cd\

C:\>cd "Documents and Settings"

C:\Documents and Settings>cd "All Users"

C:\Documents and Settings\All Users>cd DRM

C:\Documents and Settings\All Users\DRM>dir /a

Volume in drive C has no label.

Volume Serial Number is F8EB-D584

Directory of C:\Documents and Settings\All Users\DRM

12/18/2007 05:44 PM <DIR> .
12/18/2007 05:44 PM <DIR> ..
05/25/2008 12:48 AM <DIR> Cache
08/06/2008 03:35 PM 3,739,648 drmstore.hds
12/18/2007 02:43 PM 1,536 drmv2.lic
12/18/2007 02:43 PM 1,536 drmv2.sst
05/25/2008 12:48 AM 1,194,512 IndivBox.key
12/18/2007 05:29 PM 4,867 migration.log
12/18/2007 03:53 PM 312 v2ks.bla
12/18/2007 03:53 PM 48 v2ks.sec
05/25/2008 12:48 AM 13,579 v2ksndv.bla
12/18/2007 05:29 PM 9,722 v3ks.bla
12/18/2007 05:29 PM 740 v3ks.sec

10 File(s) 4,966,500 bytes
3 Dir(s) 27,084,025,856 bytes free

C:\Documents and Settings\All Users\DRM>cd ..

C:\Documents and Settings\All Users>attrib drm
SH C:\Documents and Settings\All Users\DRM

C:\Documents and Settings\All Users>attrib -s -h drm

C:\Documents and Settings\All Users>move DRM DRM2
1 file(s) moved.

C:\Documents and Settings\All Users>

Posted Sunday, August 31 2008 by Brian Desmond | 1 Comment
Filed under: it


Word Tip - The Draft View Gutter

Since I've been living in Microsoft Word lately, I figured why not take some time for a couple more handy Word tricks. This one is about getting a gutter to show up in Draft view so you can see what styles have been applied to text. If you've ever worked with a complex stylesheet before, especially one which is post-processed by some other tool, getting the styles properly applied to your content, and also debugging messed up styles is important. The display I'm talking about looks something like this in my sample document:

You'll notice the various style names which apply to that particular line (and all the lines until the next style name). If you could see my document, you'd be able to see all the different text formatting in my document. If you're looking to get this functionality, it's pretty easy, actually. Go to the Office button and then Word Options. Select Advanced on the left and scroll down to the display section in the main pane.

Set your style area pane width to something like 2". You can drag the divider in Word once you get the pane showing (only in Draft and Outline views, accessible via the Draft button on the View tab of the ribbon).

Posted Monday, August 25 2008 by Brian Desmond | No Comments
Filed under: it,word


Word Tip - Outline View and Document Map

Another handy Word tip today is using Outline view to work with big documents. If you've got a sizeable document, chances are your document is also structured hierarchically. By this I mean that you are probably using multiple levels of Heading styles to organize your content. If you flip to Outline view (on the View tab of the ribbon), Word will give you a collapsed view of your document based on these heading style elements.

You can use the Show Level option on the Outlining ribbon to manage how deep the outline is, and you can also expand and collapse sections using the +/- buttons embedded in the document. The main use I have for Outline view is actually for rearranging documents for flow. You can drag the expand collapse buttons for different sections around in the Outline and Word will rearrange your document based on those actions. If you move a level 1 heading, everything below that heading will be moved as well.

You can also edit document text in Outline view although I've never really been comfortable doing this compared to working in Draft mode or the usual Print layout view.

Similar to the outline view is the document map. If you check the Document Map checkbox on the View tab of the ribbon, the document outline will appear in a task pane to the left of the main text editor and you can click on the different headings to jump around the document.

Posted Monday, August 25 2008 by Brian Desmond | No Comments
Filed under: it,word


Slick Site - GrubHub.com

If you happen to live in Chicago, New York, Boston, or San Francisco, GrubHub.com is definitely a site worth checking out. I'd heard of it but never tried it until last night, and it's great. The site has a very extensive collection of restaurants (at least for me in Chicago) which deliver based on my address. You can filter on cuisine and a number of other parameters. One of the most useful filter parameters is the "currently delivering" one which at 2AM this morning when I decided it was time for dinner, was very helpful. I found a Mexican place in the filtered list and ordered through their interactive menu on GrubHub.com. My food showed up well within the prescribed time and was quite good actually. I would have never known of the restaurant without this site as it's not really near anyplace I ever go.

I did a bit more poking around on the site and their business model is around a commission they collect for orders placed to restaurants which allow you to order online through GrubHub.com. They also list restaurants that don't allow this which is nice, but I'll certainly remember that the site only makes money with the restaurants which support online ordering.

Posted Saturday, August 23 2008 by Brian Desmond | 1 Comment
Filed under: none-of-the-above,reviews


MSDTC Exits on PDCe Transfer

One of my colleagues reported an issue at a customer this past weekend where every time he transferred FSMO roles, MOM would report that the MS DTC (distribution transaction coordinator) service had terminated unexpectedly on all the domain controllers in a domain at this customer. At this particular customer that bought us about 350 emails from MOM since the roles got transferred twice over the weekend in each domain. For reference, it's a highly distributed Windows Server 2003 SP1 environment with a mix of x86 and x64 installations.

A quick look at MOM & the event viewer on a suspect machine showed a standard event from the SCM, and an MSDTC event about a dc promotion/demotion:

Event Type:    Information
Event Source:    MSDTC
Event Category:    SVC
Event ID:    4145
Date:        8/5/2008
Time:        4:54:10 PM
User:        N/A
Computer:    SOMEDC

Description:
MS DTC has been notified that a DC Promotion/Demotion has happened. It is shutting down as a result.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

And from MOM:

Severity: Service Unavailable
Status: New
Source: Service Control Manager
Name: The service terminated unexpectedly.
Description: The Distributed Transaction Coordinator service terminated unexpectedly. It has done this 1 time(s). The following corrective action will be taken in 1000 milliseconds: Restart the service.
Domain: ASIA
Agent: SOMEDC
Time: 8/2/2008 13:07:58
Owner:

(Yes the times don't match - just grabbed the first samples I could find)

I decided to take a look at this today, and bounced the FSMOs around until I determined that the PDCe specifically was the root cause here. I was able to kill the MSDTC service on every DC in the domain by moving the PDCe around. This ruled out that it wasn't some weird quirk from the patching activities that were going on this weekend when this symptom presented.

My first troubleshooting step was to see if the service was actually crashing, so, I setup Dr. Watson to collect full dumps and installed it as the default debugger on a problem machine and moved the PDCe. The service terminated as expected but nothing in Dr. Watson. This was annoying but not entirely unexpected. If a service just exits like a normal process does then we'd get this event too.

I xcopy'ed the x64 debug package to this particular machine from a utility box that had the debug tools installed (note you can just copy and paste the tools - no need to run the MSI) and fired up windbg. If you're following along at home, do this:

  1. Press F6 and find msdtc.exe and select it
  2. The debugger will break in and likely complain about symbols
  3. Issue a .symfix C:\symbols
  4. Issue a .reload
  5. Issue a g

At this point you're ready to go and when something interesting happens the debugger should break in (you'll know when the textbox at the bottom of the screen becomes enabled). I wanted to collect a process dump for this and I had a suspicion I knew what was happening, so, I also did this:

  1. Issue a bp ntdll!NtTerminateProcess

This tells the debugger to breakin on a call to NtTerminateProcess. As soon as I transferred the PDCe, my breakpoint got hit. I saved a dump (.dump /mf c:\msdtcissue.dmp) as this particular environment has Internet issues and I was having problems getting to the symbol server. When I opened it up on my workstation (Press Ctrl+D and browse in windbg), I located this stack (Issue a k):

11 Id: 1550.1590 Suspend: 1 Teb: 000007ff`fff9a000 Unfrozen
Child-SP RetAddr Call Site
00000000`0165fd78 00000000`77d5a316 ntdll!ZwTerminateProcess
00000000`0165fd80 000007ff`7fc4069b kernel32!ExitProcess+0x25
00000000`0165fed0 000007ff`7fc40863 msvcrt!_crtExitProcess+0x3b
00000000`0165ff00 000007ff`66fd25f5 msvcrt!cinit+0x143
00000000`0165ff40 00000000`77d6b69a msdtctm!DCPromoThreadFunction+0x124
00000000`0165ff80 00000000`00000000 kernel32!BaseThreadStart+0x3a

Note if you're wondering how to find the correct thread, you can issue a ~*k to dump the stack of every thread. To switch to the thread (11 here), you'd do a ~11s.

I got zero hits on this on Google searching for this, so I had a quick chat with a PSS friend who dug something up on this. It's a known bug in Windows Server 2003 and presently there's no QFE. MSDTC subscribes to dcpromo's (which I knew), but, because of the manner in which it does this, it also catches PDCe changes. This behavior is fixed in Windows Server 2008, though. If you've got a good reason you can call and try and make the case for a QFE, but, seeing as the service restarts straight away, I just am going to go tweak my monitoring so MOM ignores this.

Posted Tuesday, August 05 2008 by Brian Desmond | 1 Comment
Filed under: it,active-directory


Formulas in Word

I discovered this afternoon that you can insert simple formulas in Microsoft Word tables, at least in Word 2007. This is really pretty helpful when you just need to do something simple like sum a column or row and don't want to build the table in Excel, copy it into Word, and then format it.

I had a table something like this:

 

Foo

Bar

Snafu

Total

X

Y

X

Y

X

Y

Day 1

.5

1.5

0

1

1.25

.5

 

Day 2

.5

1.5

0

1

1.25

.5

 

Day 3

.5

1.5

0

1

1.25

.5

 

Total

       

 

I needed to add totals for rows and columns so it would look like this:

In order to do this, click in one of the total cells, and then click the formula button on the Layout tab on the ribbon: .

You'll get a dialog something like this - it defaults to the SUM formula, and automatically figures out whether you want "ABOVE" or perhaps "LEFT". If you need a different function (like to take the average or something), use the Paste function combobox.

You'll note if you look at the screenshot of my resulting table that the sums are highlighted in gray. This is because I have Field Shading enabled in Word. When you print they won't actually be highlighted. One difference from Excel here is that the fields won't automatically recompute if you update one of the cells. In order to do this, you need to right click and select Update Field:

Cool feature - enjoy.

Posted Saturday, August 02 2008 by Brian Desmond | No Comments
Filed under: it