Installing Windows Service programatically

>>>> I can install a service as localsystem successfully as follows:

Dim context As New System.Configuration.Install.InstallContext("install.log", Nothing)
context.Parameters.Add("assemblyPath", ServicePath)
Dim serviceProcessInstaller1 As New System.ServiceProcess.ServiceProcessInstaller
serviceProcessInstaller1.Account = ServiceProcess.ServiceAccount.LocalSystem
'serviceProcessInstaller1.Account = ServiceProcess.ServiceAccount.User
'serviceProcessInstaller1.Username = "User1"
'serviceProcessInstaller1.Password = "pw1"
Dim serviceInstaller1 As New System.ServiceProcess.ServiceInstaller
With serviceInstaller1
.StartType = ServiceStartMode.Automatic
.Context = context
.ServiceName = ServiceName
.DisplayName = ServiceName
.Parent = serviceProcessInstaller1
End With

serviceInstaller1.Install(New Hashtable)

>>>>> But when I try to use a user account instead I get this error:

An unhandled exception of type 'System.NullReferenceException' occurred in system.serviceprocess.dll

Additional information: Object reference not set to an instance of an object.

>>>>>> Here's the code I'm trying to run:

Dim context As New System.Configuration.Install.InstallContext("install.log", Nothing)
context.Parameters.Add("assemblyPath", ServicePath)
Dim serviceProcessInstaller1 As New System.ServiceProcess.ServiceProcessInstaller
' serviceProcessInstaller1.Account = ServiceProcess.ServiceAccount.LocalSystem
serviceProcessInstaller1.Account = ServiceProcess.ServiceAccount.User
serviceProcessInstaller1.Username = "User1"
serviceProcessInstaller1.Password = "pw1"
Dim serviceInstaller1 As New System.ServiceProcess.ServiceInstaller
With serviceInstaller1
.StartType = ServiceStartMode.Automatic
.Context = context
.ServiceName = ServiceName
.DisplayName = ServiceName
.Parent = serviceProcessInstaller1
End With

serviceInstaller1.Install(New Hashtable)

[2139 byte] By [TerryTAtl] at [2007-12-16]