NET START command not passing parameters in Windows Server 2008

Posted by Amanbbk on Server Fault See other posts from Server Fault or by Amanbbk
Published on 2012-08-31T10:08:28Z Indexed on 2012/09/04 15:42 UTC
Read the original article Hit count: 478

My application calls a Stored Procedure, through the stored procedure I am calling a Windows Service using the NET START command as follows:

SELECT @Cmd = 'Net Start ServiceName /"' + @param1 + '" /"' + @param2 + '"' 

Now the parameters passed here are not reaching the OnStart method. These values are blank.

Protected Overrides Sub OnStart(ByVal args() As String)
Try
service1= New Service
service1.param2 = args(1)
service1.param1 = args(0) 

Here I get args(0) as the name of service instead of the value that is passed, and args(1) is blank. Although the args.Getlength(0) returns 2.

The service starts successfully, it invokes the executable, but the parameters are not there.

What can be the reason?

  • Administrative access might be required in NET START command?
  • Has the syntax changed for NET START command in Windows Server 2008?
  • Windows Services do not accept parameters in Windows Server 2008?

The same thing is running fine on Windows Server 2003.

© Server Fault or respective owner

Related posts about Windows

Related posts about windows-server-2008