Hello,
By InstallUtil, I assume you mean the Installer Tool (Installutil.exe) -
http://msdn.microsoft.com/en-us/libr...95(VS.90).aspx. However, this
tool does not have the '/name' argument. If I have misunderstood you,
please let me know.
For a windows service with multi-instance running at the same time, we can
use WMI Win32_Service
class(
http://msdn.microsoft.com/en-us/libr...18(VS.85).aspx) to
query the DisplayName of a service by specifying the Process ID of the
running service. And I write a code snippet:
using System;
using System.Diagnostics;
using System.Management; // Add System.Management as reference to the
project.
{
// Get process ID of current running service instance
int Pid = Process.GetCurrentProcess().Id;
ManagementObjectSearcher searcher = new ManagementObjectSearcher(
"root\\CIMV2", "SELECT DisplayName FROM Win32_Service WHERE
ProcessId = " + Pid);
foreach (ManagementObject queryObj in searcher.Get())
{
String displayName = queryObj["DisplayName"].ToString();
break;
}
Debug.WriteLine( "Display name of the current service: " + displayName
);
}
Please try the code above and let me know if it does not help you you need
any other help.
Best regards,
Feng Chen
Microsoft Online Community Support
=========================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.
This posting is provided "AS IS" with no warranties, and confers no rights