Tag Archives: Windows 7

Windows 7 new user profile – MSOE.DLL could not be loaded error

Since my Windows 7 deployment I get an error every time a new user logs in (or logs in following a profile reset).

Windows Mail could not be started because MSOE.DLL could not be loaded

Since you can click past it I wasn’t initially too concerned but I soon came to realize that there’s pretty much no information on the Web about this problem. Anything the search engines turn up is invariably about Outlook Express on Windows 98/Me.

It seems to be caused when some kind of IE First Run process opens Internet Explorer with an MSN page and presumably tries to register the default email client (which is not yet set to Outlook, despite it being installed). The strange thing is that Windows Mail is not even available on Windows 7. Microsoft discontinued it after Vista in favour of Windows Live Mail. WinMail.exe is present on the system but it’s hidden, and that MSOE.DLL has been purposely omitted. Apparently you can get it working again by supplying a copy from a Vista PC.

The problem is that this error looks important enough for a new user to contact the helpdesk about. The other issue is that it significantly delays that first logon, sometimes by several entire minutes. The error occurs immediately after you enter your credentials (you can hear the alert sound) but it happens while the desktop is still hidden from view by the Windows 7 splash screen. Eventually the Preparing your desktop splash screen times out and you can click OK:

Windows Mail could not be started because MSOE.DLL could not be loaded

Notice the label in that floating window – it’s setting up a component which is titled as Microsoft Windows.

Eventually I discovered a KB article relating to Internet Explorer 5 personalized settings, which was when Microsoft introduced this method of installation.

Having consulted that document I viewed HKLM\SOFTWARE\Microsoft\ActiveSetup\InstalledComponents in Regedit and saw that there is indeed a component with the name “Microsoft Windows” which is invoking WinMail.exe, intending to register it as a mail and news (nntp) client:

WinMail.exe ActiveSetup parameters

I have no idea why it’s doing this since WinMail.exe is intentionally disabled in Windows 7. It would seem logical that deleting this whole key should fix the problem (I backed it up first of course). In testing this didn’t seem to work though.

However I did notice that sometimes I got the error on screen twice and other times only once. Exasperated I searched the registry for instances of WinMail.exe until I discovered the reason: the entire ActiveSetup branch of the registry also exists under HKLM\Software\WOW6432Node\Microsoft, for the 32bit version of Internet Explorer on 64bit systems. Once both keys had been deleted the error disappeared.

I was then able to refine this – instead of deleting the whole key you only need to set to the single DWORD value IsInstalled to zero. Do this to both instances and the problem is fixed! In my environment I used my existing VBScript startup script which worktations inherit by Group Policy. Excerpt below:

If InStr (strOS,"Microsoft Windows 7") Then
  'Prevent Windows from trying to invoke the non-existent Windows Mail for new user profile setup
  On Error Resume Next
  strKey = "SOFTWARE\Microsoft\Active Setup\Installed Components\{44BBA840-CC51-11CF-AAFA-00AA00B6015C}"
  objReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKey,"IsInstalled",0
  strKey = "SOFTWARE\Wow6432Node\Microsoft\Active Setup\Installed Components\{44BBA840-CC51-11CF-AAFA-00AA00B6015C}"
  objReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKey,"IsInstalled",0
  On Error Goto 0

5.1 channel audio through ordinary headphones using MPC-HC

Blown-Away Man

Though I have owned a surround sound system before, I don’t currently have the space for one. I was recently considering buying gaming headphones with support for Dolby Digital 5.1 channel audio which I could also use for watching films. With some more reading I discovered that these hardware solutions will only work with a Dolby Digital source (AC-3). The problem is that I have a lot of content with DTS audio which the chips in these products don’t support, not to mention MP4 files with multichannel AAC audio.

Reading the specs of these headphones, I discovered that they license a technology called Dolby Headphone – some clever signal processing developed by Lake DSP in Sydney. Early 5.1 channel headphones actually contained multiple tweeters mounted at different positions inside each ‘can’ which apparently weren’t very convincing, but this better approach is more of an emulation – one that relies on the fact that you only have two ears. It’s able to model the audio delays and reflections of a room containing a 5.1 setup, plus it seems to boost up the low frequencies so you’re really aware of the LFE channel. I don’t really understand why there isn’t much awareness of Dolby Headphone. It’s not at all new – look at this 1998 press release!

What’s also not very widely known is that Dolby Headphone can be encoded in software, through the likes of PowerDVD’s audio decoder, regardless of whether your sound chip is Dolby Headphone certified (as some now are). It’s also not particularly processor intensive – my Sony Vaio P can play H.264 movies and process DH with its Intel GMA 500 GPU and meagre 1.33GHz Intel Atom Z520 CPU.


What does Dolby Headphone sound like?

Listen for yourself – plug in some headphones and try these DH encoded samples. The choice of movie trailer isn’t exactly showcasing the 360 degree soundstage, but it was quite tricky to encode so I didn’t want the hassle of sampling a scene from an actual film. I can assure you that the action sequences in District 9 for instance sound a whole lot better with Dolby Headphone enabled.

5.1 channel test Dolby Headphone DH1

I Am Legend trailer 2ch downmix by FAAD decoder normalized (no DH)

I Am Legend trailer 5.1ch Dolby Headphone DH1

These samples are 192Kbps MP3 files for size reasons. The slight metallic high-end ringing to the deep bass is an encoder artifact from the conversion to MP3 using the LAME encoder, and it was still present when I tried 320Kbps. The channel test clip was taken from http://www.lynnemusic.com/surround.html and the I Am Legend trailer was from http://www.h264info.com/clips.html.


How to get it working for AC-3, AAC, and DTS multichannel sources

In a previous post I explained how to setup Media Player Classic Home Cinema to use a third party h.264 decoder with DXVA support. MPC-HC has several key advantages as a media player – it’s open source, it’s lean, it’s extremely configurable, and it plays pretty much any format. I use it for my Sony Vaio P to keep CPU use as low as possible on its rather limited Intel Atom processor. Many people use MPC-HC for their Home Theatre PCs, hence this article.

A guide for configuring Dolby Headphone using PowerDVD’s CyberLink Audio Decoder already exists (with files):

However that information isn’t sufficient. The complication is that when this decoder is used outside the PowerDVD software, it only works with DTS audio streams even though it should also support AC-3. Reading around, it seems that the AC-3 support works in Windows XP but not in Vista nor in Windows 7.

The next piece of the puzzle can be found here on the forum for Zoom Player, a commercial media player:

The important point is that the CyberLink decoder can accept a multichannel LPCM input, so you can use another decoder (ffdshow tryouts in this case) to convert the source bitstream into LPCM first, then feed that to the CyberLink decoder. This means that multichannel AAC audio found in MP4 containers could have Dolby Headphone applied too. The above post describes how to do this for Zoom Player, but we’re interested in MPC-HC. The next obstacle is figuring out how to link multiple decoders together in MPC-HC – something I couldn’t find any info about despite spending hours searching online.

The key to understanding this is knowing how the modular Windows DirectShow media layer works. If you’ve already played with MPC-HC you will be familiar with adding and removing filters, as well as the concepts of ones that are built into MPC-HC and those that are external. All these DirectShow filters have ‘pins’ which are their inputs and outputs – their connection points in other words. Each pin has a defined list of media types it will and won’t accept. As long as you comply with this, they can be threaded together to create a ‘graph’. The simplest way to illustrate this is with a screenshot of the aptly named GraphStudio, and this example shows the combination of filters I used to make one of the sample audio clips earlier in this post:

So how can we construct a similar sequence in MPC-HC? In the end I finally found the crucial bit of information in a single sentence of the excellent self-explanatory and unofficial All the things you may want to know about Media Player Classic – HomeCinema:

When a video file is loaded in MPC-HC, MPC-HC will run through this list from top to bottom and load the relevant filter(s), create a graph from them and play the file.

Bingo! All you need to do is explicitly list them in the right order in MPC-HC’s External Filters window and MPC-HC should thread them together, compatible pins permitting. Sure enough, it works.

Would you believe it, there is yet another hitch – the CyberLink Audio Decoder expects LPCM input channels to be in a certain order, one that differs from the default order in ffdshow. This is trivial to fix, though it will mess things up if you rely on ffdshow to decode other media formats.


The guide

You’ll need MPC-HC obviously, the CyberLink Audio Decoder will need to be installed (from PowerDVD), and you’ll need ffdshow tryouts installed (I used the SVN release, since the beta is years old).

Once ffdshow is installed, open up its Audio Decoder configuration utility from the Start Menu. In the Output section select 16bit LPCM and apply.

Disable the Mixer and configure the Swap Channels menu as follows. Note the different order:

Open MPC-HC and hit O to bring up the options menu. In the Internal Filters section de-select AAC, AC3 and DTS from Transform Filters on the right.

UPDATE – Contrary to what I had originally written here, do not disable the built-in audio switcher! I hadn’t understood that this is needed for when you have a video file with multiple audio tracks. If it’s not enabled then all audio tracks play simultaneously. You could consider disabling Regain volume if you want to minimize the amount of additional processing.

Audio switcher settings

In the External Filters section make sure that ffdshow is set to prefer, and is listed above CyberLink Audio Decoder (also set to prefer). Use Add Filter… to set Microsoft DTV-DVD Audio Decoder to Block.

Remember that DTS audio bitstreams don’t require the ffdshow treatment. To avoid having to reconfigure this for different movie formats we can customize the recognized media types for the ffdshow filter. As per the screenshot above, select ffdshow Audio Decoder then scroll down until you find MEDIASUBTYPE_DTS and delete it. DTS files will now skip ffdshow and will be entirely handled by CyberLink Audio Decoder. If you ever need to revert this change click Reset List.

Open a movie file in MPC-HC, then select Play -> Filters -> CyberLink Audio Decoder and you will be able to select Dolby Headphone like so:

On the next tab you can choose between three DH modes. I found a nice succinct guide to the three modes here:

Sadly it seems that every time you load a new file into MPC-HC you need to re-enable Dolby Headphone (the setting doesn’t stick for some reason). Also, owing to the channel order swapping in ffdshow you’ll find that in ordinary stereo mode you’re only getting the Front Left and Front Center channels. As a result you’ll probably want to de-select the Swap Channels setting in the ffdshow Audio decoder tool when you’re not using headphones. A small price to pay though… Enjoy!


Further reading

There is a guide to using Dolby Headphone for listening to two channel music in the audio player foobar2000 here:

I’ve given it a try and I don’t really think it’s worth it. When I had a actual surround system I used to play all my music on Dolby Pro Logic IIx and it sounded very good using all the speakers. It meant you could be sitting anywhere in the room and still get nice separation and so on. However, creating those additional channels only to merge them back down to two channels often doesn’t seem to add much since they were virtual to start with. In side by side listening comparisons I often preferred the original stereo mix, but admittedly it does seem to vary with the way they’ve been mastered (remember, to hear the original stereo you have to remove all selected DSPs, not just DH).

Enabling Network Level Authentication on Windows XP by script

Migrating to Windows 7 has thrown up another problem – users wanting to connect from home computers running XP cannot use the Remote Desktop Client to connect to their newly upgraded office PCs. The Network Level Authentication change to the Remote Desktop Client was made because the original RDP is susceptible to Man-in-the-middle attacks.

Rather than leaving the new systems vulnerable by allowing connections from all clients in Computer Propertes > Remote settings, I discovered that Windows XP SP3 does in fact offer NLA support however it’s disabled by default. Somewhat frustratingly, the steps outlined in Microsoft KB 951608 require Registry edits which I would not want to encourage non-IT-savvy people to try. Giving out a .reg file is not really a good idea here either since these are additions to existing values, so forced replacements could interfere with certain vendors’ VPN clients etc.

Here’s a VBScript for the task which will only install on XP SP3 and will detect if the modifications have already been made. You could easily target it at a whole group of PCs by iterating through an array of hostnames.

'Enables Network Level Authentication on XP SP3 (disabled by default)
'which allows you to use the Remote Desktop Client 6.1 to connect to
'Windows 7 and Windows Server 2008 R2 without degrading security

Option Explicit

Const HKEY_LOCAL_MACHINE = &H80000002

Dim strLsaKey, strLsaValue, strHostname, size, arrMultiRegSZ, objReg, objWMI, colItems, i, found, modified
Dim objItem, SPlevel, strOSVer, strSecProvKey, strSecProvValue, strValue

strLsaKey = "SYSTEM\CurrentControlSet\Control\Lsa"
strLsaValue = "Security Packages"
strSecProvKey = "SYSTEM\CurrentControlSet\Control\SecurityProviders"
strSecProvValue = "SecurityProviders"
strHostname = "."
modified = false
found = false

Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strHostname & "\root\cimv2")
Set colItems = objWMI.ExecQuery("SELECT * FROM Win32_OperatingSystem")
For Each objItem In colItems
  strOSVer = objItem.Version
  SPlevel = objItem.ServicePackMajorVersion
If Not Left(strOSVer,3) = "5.1" Then
  WScript.Echo "This script is only intended for Windows XP."
End If
If Not SPlevel >= 3 Then
  WScript.Echo "Please install the latest Windows XP Service Pack from Windows Update."
End If

Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strHostname & "\root\default:StdRegProv")
objReg.GetMultiStringValue HKEY_LOCAL_MACHINE, strLsaKey, strLsaValue, arrMultiRegSZ
size = Ubound(arrMultiRegSZ)
For i=0 to size
  If arrMultiRegSZ(i) = "tspkg" Then
    found = true
  End If
If found Then
  WScript.Echo "tspkg already added to HKLM\SYSTEM\CurrentControlSet\Control\Lsa"
  ReDim Preserve arrMultiRegSZ(size + 1)
  arrMultiRegSZ(size + 1) = "tspkg"
  objReg.SetMultiStringValue HKEY_LOCAL_MACHINE, strLsaKey, strLsaValue, arrMultiRegSZ
  modified = true
End If

objReg.GetStringValue HKEY_LOCAL_MACHINE, strSecProvKey, strSecProvValue, strValue

If Instr(strValue,"credssp.dll") Then
  WScript.Echo "credssp.dll already added to HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders"
  strValue = strValue & ", credssp.dll"
  objReg.SetStringValue HKEY_LOCAL_MACHINE, strSecProvKey, strSecProvValue, strValue
  modified = true
End If
If modified Then
  WScript.Echo "Settings updated. You will need to restart for the changes to become active."
End If

Set objReg = nothing
Set objWMI = nothing

Migrating roaming profiles to Windows 7

Though a Microsoft user migration tool exists, I only want the bare minimum to be carried across from XP and I definitely want automation to ensure consistency. I made this script to be run by support technicians while logged in on newly installed Windows 7 as the user being migrated. The My Documents folder redirection is particularly important – the script mounts the old XP profile’s registry hive from the server, and checks whether My Documents was correctly redirected to the home drive. If not, the script will migrate the files from the old location. This tidies up any old inconsistent user profiles. Having My Documents on the home drive keeps profile size down for faster logins when roaming and helps to reduce the chance of a user losing data if their hard disk fails.

I spent a while wondering how to keep this as a single script despite the need to use RunAs for the Registry hive mount before hitting on the idea of recursion – see highlight below (%0 is the running script’s full name with path, %~nx0 is just the filename and extension). Despite the /env in the command which is supposed to make the invoked process share the main user environment, only some things are in fact shared. %TEMP% is for instance, though environment variables are not. So I pass the username as a command line, and recover the results of the Registry parse from a temporary file.

UPDATE – Since the file copying can take a long while I have made the My Documents path checking the first task, a failure of which will quit the script. There is now a five second delay between mounting the Registry hive and querying it) which should stop the script having to be run twice.

@echo off
set FServer=YourServerHere
echo .:: User profile migration script for user %USERNAME%

if not "%1" == "" goto checkxpreg

echo .:: We need admin rights to mount and check the user's XP profile registry hive
runas /env /noprofile /user:%USERDOMAIN%\Administrator "%~nx0 %USERNAME%"

if exist %TEMP%\XPMyDocsPath.txt type %TEMP%\XPMyDocsPath.txt
if not exist %TEMP%\XPMyDocsPath.txt (
  echo .:: ERROR the XP profile registry hive has not mounted - run the script again!
  goto :eof

if exist %TEMP%\DocsNeedMoving.txt (
  echo .:: Migrating content to H:\ ready for Windows 7
  xcopy /y /e /c "\\%FSERVER%\profiles$\%USERNAME%\My Documents\*.*" "H:\"
if not exist %TEMP%\DocsNeedMoving.txt (
  echo .:: No documents need moving

echo .:: My Documents redirection to root of H: drive
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v Personal /t REG_SZ /d "H:" /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v Personal /t REG_EXPAND_SZ /d %%HOMEDRIVE%% /f

echo .:: IE Favorites
xcopy /y /e /c \\%FSERVER%\profiles$\%USERNAME%\Favorites\*.* %USERPROFILE%\Favorites\

echo .:: Outlook signatures
xcopy /y /e /c "\\%FSERVER%\profiles$\%USERNAME%\Application Data\Microsoft\Signatures\*.*" %USERPROFILE%\AppData\Roaming\Microsoft\Signatures\

echo .:: Outlook nicknames file
if not exist %USERPROFILE%\AppData\Roaming\Microsoft\Outlook\*.* md %USERPROFILE%\AppData\Roaming\Microsoft\Outlook
copy /y "\\%FSERVER%\profiles$\%USERNAME%\Application Data\Microsoft\Outlook\*.nk2" %USERPROFILE%\AppData\Roaming\Microsoft\Outlook\

echo .:: Word user templates
xcopy /y /e /c "\\%FSERVER%\profiles$\%USERNAME%\Application Data\Microsoft\Templates\*.*" %USERPROFILE%\AppData\Roaming\Microsoft\Templates\

echo .:: Desktop files and shortcuts
xcopy /y /e /c \\%FSERVER%\profiles$\%USERNAME%\Desktop\*.* %USERPROFILE%\Desktop\

:: Stop the shell from changing the display name of the folder to My Documents on the fileserver
if exist H:\Desktop.ini (
  attrib -r -s -h H:\Desktop.ini
  del H:\Desktop.ini
:: Cleanup
if exist %TEMP%\DocsNeedMoving.txt del %TEMP%\DocsNeedMoving.txt
del %TEMP%\XPMyDocsPath.txt

goto :eof

if exist del %%TEMP%\DocsNeedMoving.txt
reg load "HKEY_USERS\TempXPRegHive" "\\%FSERVER%\profiles$\%1\NTUSER.DAT"
echo .:: Waiting 5 seconds - Registry hive mount seems unreliable if queried immediately
ping -n 1 -w 5000 > nul
for /f "tokens=2* delims= " %%a in ('reg query "HKEY_USERS\TempXPRegHive\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v Personal') do set TempMyDocs=%%b
echo XP profile My Documents=%TEMPMYDOCS%> %TEMP%\XPMyDocsPath.txt
echo %TEMPMYDOCS% | find /I "%1" && date /t> %TEMP%\DocsNeedMoving.txt
reg unload "HKEY_USERS\TempXPRegHive"
set TempMyDocs=

Dell OptiPlex GX620 Windows 7 drivers

Dell do not make any Windows 7 drivers available for the OptiPlex GX620 even though this machine is still a perfectly capable workstation. Where I work they make up most of our inventory and they are all being upgraded to 3GB of RAM ready for the roll-out. The Pentium D CPU runs in x64 mode, and even the Pentium 4 HT 3.40GHz sold in early configs is 64bit capable.

Windows 7 includes a driver for the Intel 945G integrated video card, though Windows Update will suggest a newer one. There is an issue with this (see my post for details), so you should use version instead which you can find at Microsoft Update Catalog using a search string of Intel 82945G Express and sorting by version number. You’ll need to use Internet Explorer because it requires an ActiveX control to be installed.  Download both of the two matches – one is x86, the other x64 but you can’t tell them apart until they are downloaded.

The SoundMAX Integrated Audio is detected and installed by Windows Update, but if you’re maintaining a WIM image or building an unattended install you’ll need to isolate the driver files. These are also available at Microsoft Update Catalog – search for SoundMAX Integrated Digital Audio, order by version and look for version for x64 and for x86.

Printing and Windows 7 rollout

The goal is installing drivers automatically as printers are connected at logon, without user interaction.
If your users are non-privileged, you will need to add a Group Policy setting to suppress the elevation prompts. Using a PC running Vista or later with the Group Policy Management MMC tool, set:

  • Computer Configuration > Policies > Administrative Templates > Printers > Point and Print Restrictions

If your print servers are likely to remain on Windows 2003, you will most likely need to find a way of loading Windows 7 drivers for x86 and x64 architectures. You can’t do this on the Windows 2003 host, however you can accomplish this by using a Windows 7 machine and loading Print Management from Administrative Tools. Then right-click on Print Servers branch and add your 2003 print server. Now you can add the necessary drivers.

Print Management

The final problem is an intermittent one. Occasionally you will find that documents won’t print, and when you investigate, you will find a document in front of the print job in the print queue called Local Downlevel Document.

According to this thread, it transpires that Windows Vista and newer introduced a new protocol (Asynchronous RPC) and for some reason the OS is too stupid to actually check whether the remote print server supports it before attempting to use it (Windows 2003 does not support it).

The workaround is to set to disable Async RPC on Vista/Windows 7 clients, again by Group Policy. Set the following Registry value:

HKLM\Software\Policies\Microsoft\Windows NT\Printers\EnabledProtocols
Data: 6

Sony VAIO P Windows 7 clean install guide

Sony VAIO laptops come installed with lots of bloatware and, given the VAIO P series’ low power CPU, this really ruins it. Out of the box running Vista my P11Z was barely usable. Here’s how to clean install Windows 7 and the minimal amount of Sony software, which results in a striking improvement.

I wrote this up for the forum at Pocketables.net (the main forum it seems for the VAIO P), but I’ll post it here too. I once had a bad experience with sudden forum deletion – In 2003 I wrote an IPSec VPN guide on the official Netgear forums and one day when I needed it I discovered that they’d relaunched the forums, and deleted all the old content! Needless to say I didn’t have my own copy and web.archive.org didn’t have it either…

Back to the VAIO:

Before you start, use the GlobeTrotter Connect software to check the firmware version of your Option GTM382 HSDPA + GPS card. If it’s lower than, this update will vastly improve your GPS signal strength. Mine went from not working at all, even outside, to being able to get a fix in VisualGPS indoors. You can search for the firmware file by name but it’s not legitimately available – Sony does not distribute the update, despite Option’s official documentation stating that the version they shipped with is non-working. More details in this thread.

You can use the Sony Windows 7 Upgrade media to carry out a clean install.

Using another PC with a DVD drive, make a bootable 4GB USB stick from your Windows 7 upgrade kit DVD 2 using these instructions.

Boot from USB (enable ‘Boot from external’ in the BIOS), select Custom once Windows Setup launches, completely wipe the drive (assuming you no longer care about the Vista recovery partition) and continue. When the Vaio reboots remove the USB stick or it will boot from it and re-launch Setup. Do not enter a product key and make sure you uncheck the Activate Windows Online Automatically option. Next, install Service Pack 1, then once that is done you can remove the uninstall files from the disk to save space. Disabling hibernation will also save you 2GB of disk space:
dism /online /cleanup-image /spsuperseded
powercfg -h off

Now that Windows is fully installed, make sure you have no Windows Updates with pending restarts, and go to right-click on Computer in the Start Menu and select Properties. Scroll down and Activate, using the product key from the DVD case. It took a good few minutes but worked for me.

Use Windows Update and in the Optional Updates select the two Sony devices (Sony Firmware Extension Parser Device, and Sony Programmable I/O Control Device), and the updated Atheros Wifi drivers. Install. These are the same versions that are on the Sony driver site.

Install the most recent Intel GMA 500 driver from Intel.com > Downloads > Graphics > Laptop graphics controllers > Graphics Media Accelerator 500 > Windows 7

Now go to the Sony Vaio support page for your model and download and install the following Windows 7 drivers, in order:

  • Sony Shared Library – restart, as a precaution
  • Setting Utility
  • VAIO Event Service (needed for volume and brightness keys)
  • VAIO Control Center
  • VAIO Smart Network – (needed to enable the Option card) – restart

When Windows reloads, the Option WWAN card will be detected and it will fail to find drivers. Download the Windows 7 Mobile Broadband mode driver package only (not the Globetrotter Connect software) for a P11Z from here. No IMEI is required for this download. Drivers for other Option WWAN cards are available in the Embedded Devices section at the bottom of this page. Windows 7 has a built-in framework for managing mobile broadband connections so we can avoid Option’s terrible GlobeTrotter bloatware, which uses 20% of a 1.33GHz CPU even when idle. In Device Manager, find the non-installed device and select Update Driver, pointing it at the files you just downloaded and unzipped. On the next reboot I think, you’ll have a whole load more unidentified devices. These are all the parts of the Option card like the GPS serial ports, the Network device etc. For each one repeat the same steps as you did for the parent device, pointing it at the downloaded driver folder. Now, when you insert a SIM card you will notice that Windows 7 will offer a new network in the wireless icon in the System Tray which will have your cellular network carrier as its name. All you need is the APN name and username/password – nice and simple. If you want to have the WWAN card disabled by default as Windows starts (to save power) you will need to use the full Smart Network UI to disable both the GPS and the WWAN. This wasn’t clear and took me some considerable time to figure out.

Install the HDD Protection Driver from the Originally Installed downloads section on the Sony site. This adds some options to the VAIO Control Center, and I think is a useful addition for a mobile PC.

Install the Chipset driver, also from Originally Installed too. These Intel chipset drivers aren’t really drivers – they just title up certain devices in the Device Manager to have their correct names. So PCI-PCI Host Device (or whatever) becomes Intel(R) SCH Family PCI Express Root Port 1 – 8110. I had a hunt around for more up to date ones for Poulsbo systems but there are none, not even with Dell, so don’t worry that it’s a Vista driver. On the Sony US support site they’re more organized and both the HDD Protection driver and Chipset drivers are correctly listed in the Windows 7 section (same exact versions).

Do not install the Battery Check. It’s a driver that checks to make sure you are not using a third party battery and wastes system resources. As I also found out, it lacks an uninstall option and it took me a while to remove it from my system last time around.

From the Windows 7 section of the Sony site install Instant Mode, the RealTek audio driver, and the Alps stick pointer driver. Although scrolling by holding the middle button does already work without the Alps driver, it is still useful to install because it offers sensitivity options, and tap-to-click functionality which I find very worthwhile. If you’re using them a lot the button clicks can get tedious and loud. The RealTek audio driver offers one particularly useful feature over the stock Windows audio driver – the ability to use Dynamic Range Compression to amplify very quiet audio, which can often be a problem when watching movies using the speakers. To enable this when you need it, open Sound in Control Panel. In the Playback tab select Speaker/HP and click Properties. In the Enhancements tab scroll down and you’ll find Loudness Equalization.

If you don’t use the LAN connection, open Device Manager and disable Intel(R) SCH Family PCI Express Root Port 1 – 8110 in System Devices. This is how Sony shipped the factory-installed Vista build, so I guess it uses less power that way.

For lean software I recommend:

  • Chromium web browser (open source Google Chrome – no behaviour profiling)
  • Sumatra PDF instead of an increasingly malware-vulnerable/targeted Adobe Reader
  • This fantastic sidebar gadget which shows CPU temp and SpeedStep clockspeed – very useful for a Vaio P user

Additional guides

DXVA H.264 playback on Intel GMA 500 with subtitles (Windows 7)
DXVA VC-1 playback on Intel GMA 500

Windows 7 login scripts and missing network drives

Most Windows sysadmins use a Group Policy object to launch their login script. You may have noticed that Windows 7 and Vista fail to connect network drives defined in the login script if the user is a local admin and UAC is enabled. The script completes successfully and no error condition is encountered, but no drive mappings. Run it again manually and everything’s fine.

This is in fact by design, and it’s caused by the way UAC works. When you’re a member of the Administrators group and you log in, your account is busted down to a non-privileged user by UAC. This running context is completely separate from the context you get when you right-click Command Prompt and launch as an administrator. As you’ll probably have noticed, network drives connected in one context are not visible in the other. The problem is that GPO-based login scripts are being executed in the Administrator context – not the ordinary user context.

So, how do we get it working? Microsoft offer an unsupported kludge in KB937624 – getting around the issue by weakening Windows security and forcing network connections to be common to both user contexts. They carefully designed this not to be the case, so modifying the behaviour does seem like a bad idea.

However, Microsoft’s preferred solution (example launchapp.wsf script in the appendix of that page) is to use the GPO-triggered script to set a Scheduled Task to run immediately in the other (non-admin) context, and run your login script from there – much better.
The reasons I’m writing all this up are that:

  • Microsoft’s example script has some illegal character/line-wrap in there – copying and pasting it won’t work!
  • This method doesn’t work with XP so some forking logic is needed if you have mixed clients.
  • They make no allowances for multiple admin/non-admin users sharing the same PC.
  • This appears to be Microsoft’s sole example document of how to program using the Task Scheduler 2.0 API, and it neglects to define several absolutely essential object properties if you want to do something more useful than simply open Notepad.

My particular problem was that I needed to launch a script with a space character in the path, e.g.:

cscript.exe //nologo "\\domain.com\netlogon\departmentX users\logon.vbs"

For me changing this path name was not an option as there were many other dependencies. I spent a long time wondering why the API was eating my quotes as I fed it the above string and I tried various ways to escape them. Eventually I launched the Scheduled Tasks MMC tool (click on the root of Task Scheduler Library to see the job). Looking in the Action properties I realised that there are separate fields for the starting directory and for the arguments. Manually editing the job to use these got it working:
Task Properties Dialog
Frustratingly, there don’t seem to be any examples on the Web showing you how to populate these fields programmatically. Guessing the Arguments property was straighforward but StartIn is not a valid propery name. I read on Wikipedia that Task Scheduler 2.0 uses XML to store its jobs so I exported the job and viewed it. Luckily they used consistent property names in the XML (Arguments and WorkingDirectory) and I was able to set them in VBScript (see highlighted lines below).

There was an additional complication though. Once a user has run the Scheduled Task, it’s left behind on the system. In my initial testing this wasn’t a problem because I was testing admin users, but I soon discovered that a non-privileged user cannot delete and recreate the task if one created by another user already exists. So we need only schedule the task if the current user is running in an elevated security context. By far the simplest method is to parse the output of the whoami /groups command, as explained in this post:

UPDATE – added some logic to prevent the login script from launching for RemoteApp sessions to Terminal Servers.

'launchapp.vbs, modified from Microsoft's launchapp.wsf
'launches a process as interactive user, NOT as the elevated privilege user context

Option Explicit

Const TriggerTypeRegistration = 7
Const ActionTypeExecutable = 0
Const FlagTaskCreate = 2
Const LogonTypeInteractive = 3

Dim strWorkingDirectory, strHostname, strOSVer, colProcessList, strUser, strDomain
Dim objNetwork, objComputer, objShell, objExec, objWMI, objItem, strScriptName, strStdOut

strWorkingDirectory = "\\domain.com\netlogon\DepartmentX Users"

'launch this login script
strScriptName = "logon.vbs"

Set objNetwork = CreateObject("WScript.Network")
Set objShell = CreateObject("WScript.Shell")
Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2") 
strHostname = objNetwork.ComputerName
Set objComputer = GetObject("WinNT://" & strHostname & ",computer")
strOSVer = objComputer.OperatingSystemVersion

If strOSVer >= "6.0" Then
  If IsElevated() Then
    'Machine has UAC and user is elevated so use LAUNCHAPP.WSF Task Scheduler method based
    'on appendix from http://technet.microsoft.com/en-us/library/cc766208(WS.10).aspx

    'Are we launched in a RemoteApp session on a Terminal Server? If so, quit.
    Set colProcessList = objWMI.ExecQuery("Select * from Win32_Process Where Name = 'rdpshell.exe'")
    For Each objItem In colProcessList
      objItem.GetOwner strUser, strDomain
      'If we're an admin we can see all users' processes so we need to check only our own
      If strUser = objNetwork.UserName Then
      End If  

    'User is not elevated, so launch the script normally
    objShell.Run "cscript.exe //nologo " & Chr(34) & strWorkingDirectory & "\" & strScriptName & Chr(34), 1
  End If
  'This is a Windows XP/2003 machine, so launch the script normally
  objShell.Run "cscript.exe //nologo " & Chr(34) & strWorkingDirectory & "\" & strScriptName & Chr(34), 1
End If

Set objNetwork = nothing
Set objComputer = nothing
Set objShell = nothing

Function IsElevated()
  IsElevated = False
  strStdOut = ""
  Set objExec = objShell.Exec ("whoami /groups")
  Do While (objExec.Status = 0)
    WScript.Sleep 100
    If Not objExec.StdOut.AtEndOfStream Then
      strStdOut = strStdOut & objExec.StdOut.ReadAll
    End If
  If InStr(strStdOut,"S-1-16-12288") Then
    IsElevated = True
  End If
  Set objExec = nothing
End Function

Sub LaunchApp
  Dim objTaskService
  Dim strTaskName, rootFolder, taskDefinition, triggers, trigger, Action

  'Create the TaskService object
  Set objTaskService = CreateObject("Schedule.Service")
  Call objTaskService.Connect()
  strTaskName = "Launch App As Interactive User"

  'Get a folder to create a task definition in
  Set rootFolder = objTaskService.GetFolder("\")

  'Delete the task if already present
  On Error Resume Next
  Call rootFolder.DeleteTask(strTaskName, 0)

  'Create the new task
  Set taskDefinition = objTaskService.NewTask(0)

  'Create a registration trigger
  Set triggers = taskDefinition.Triggers
  Set trigger = triggers.Create(TriggerTypeRegistration)

  'Create the action for the task to execute
  Set Action = taskDefinition.Actions.Create(ActionTypeExecutable)
  Action.Path = "cscript.exe"
  Action.Arguments = "//nologo " & strScriptName
  Action.WorkingDirectory = strWorkingDirectory

  'Register (create) the task
  call rootFolder.RegisterTaskDefinition(strTaskName, taskDefinition, FlagTaskCreate,,, LogonTypeInteractive)

  Set objTaskService = nothing
End Sub