View Full Version : computer name and start service?

05-14-2004, 12:01 PM
How do I get the name of the computer my installscript is running on? I need it to start the MSDE named instance : computername\instancename.

And is there an installscript built in function to start a service a la NET START ?

05-14-2004, 01:33 PM
Please see InstallShield Knowledge Base article Q102469 for one approach to getting the current computer's name.

As far as starting a service goes, perhaps see if the ServiceStartService function does what you want.

05-23-2004, 03:58 PM

I can't find the article you said. Is there any link.
Thank you...

05-23-2004, 06:09 PM
I think this post has the general idea:


05-24-2004, 03:39 AM
I am not prof. with the codes. Can you say where an I put those codes.

Thank you...

05-24-2004, 09:03 AM
You should put the prototype---

prototype BOOL Kernel32.GetComputerNameA(BYREF STRING, BYREF INT);

---near the top of your script, below #include "ifx.h"; you should place the actual call to GetComputerNameA wherever you need the value...

11-04-2004, 04:31 PM
As far as starting a service goes, perhaps see if the ServiceStartService function does what you want.

ServiceStartService does not appear to work reliably.

I'm working on a Windows 2000 setup, using the version of MSDE that ships with SQL Server 7. On some machines, the MSSQLSERVER service will start fine using ServiceStartService. On other machines with the same version of the OS, the service does not start.

Are there known issues with ServiceStartService and older versions of MSDE?

02-18-2005, 01:53 PM
I'm constantly experiencing the same issue that "net start <service>" simply doesn't work reliably on all Windows machines. On two, what I belive to be identical Windows systems, one will always work, the other never will. I can't figure out what is the determining factor and really need a more reliable way to start a windows service as a product action.

Does anyone have a solution they've implemented they'd be willing to share? What I could really use is just a couple lines of code pointing me at any java class, either from InstallShield or from another source, that allows me to programatically start a Windows service from some API.


02-18-2005, 01:56 PM
Perhaps use Universal's Win32Service interface? Javadoc help is here: ...Universal Installer\HelpLibrary\platforms\windows\api\com\installshield\wizard\platform\win32\win32service.html

02-18-2005, 02:05 PM
Fantastic! I just checked out the java docs you specified and this is exactly what I've been asking for help in finding for weeks! I'm back in business :)

02-18-2005, 04:24 PM

What I found was that after executing "NET START <service>", it was sometimes necessary to wait a few moments before attempting to use the service. Code example below:

svProgram = "net";
svCommandLine = "start mssqlserver";
LaunchAppAndWait(svProgram, svCommandLine, LAAW_OPTION_HIDDEN);
SetupLog("Delaying twelve seconds to allow service to start");

I found that this gives just about any machine enough time to "catch its breath" after installing a service.

Hope this helps. I'm sure the abovementioned Java solution will work as well, but I hate Java. :)

02-18-2005, 04:29 PM
(Well, I mention the Java solution because I happened to remember the question from this Universal project thread: http://community.installshield.com/showthread.php?t=143526...)