473,785 Members | 2,395 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Service name

Hi,

I would like to ask how can I with C# find out the service name on
non-English Windows OS.

Thanks,

Lubomir
Sep 14 '07 #1
6 5226
"Lubomir" <Lu*****@discus sions.microsoft .comwrote in message
news:D7******** *************** ***********@mic rosoft.com...
I would like to ask how can I with C# find out the service name on
non-English Windows OS.
ServiceControll er.GetServices( ) returns an array of ServiceControll er
objects that represent all the services running in the computer.
Each ServiceControle r has the properties ServiceName and a DisplayName.
DisplayName is the one that should be localized for different language
versions.
Sep 15 '07 #2
Thanks fro answer.

My problem is, that I need to find some particular service. For exmaple I
need to work with "Network Service" and I need to pass its name to some
function.

If U run a non English version of OS, the name if this service will not be
"Network Service". So when I use the method you recommended, I gte a list of
non-english names. How I will know, which one of them is "Network Service" ?

I think I should be able to find any particular service by his SID. This SID
I guess is the same on all Windows OS. So using this SID I would get the
"Network Service" name is the particular localized language.

I don't know how to work with SIDs in C#. I didn't find any methods that
would use it for returning a service name.

Regards,

Lubomir

"Alberto Poblacion" wrote:
"Lubomir" <Lu*****@discus sions.microsoft .comwrote in message
news:D7******** *************** ***********@mic rosoft.com...
I would like to ask how can I with C# find out the service name on
non-English Windows OS.

ServiceControll er.GetServices( ) returns an array of ServiceControll er
objects that represent all the services running in the computer.
Each ServiceControle r has the properties ServiceName and a DisplayName.
DisplayName is the one that should be localized for different language
versions.
Sep 16 '07 #3
On Sep 14, 4:56 pm, Lubomir <Lubo...@discus sions.microsoft .comwrote:
Hi,

I would like to ask how can I with C# find out the service name on
non-English Windows OS.

Thanks,

Lubomir
You may be able to use WMI - select * from Win32_Service then check
the pathname? (assuming this doesn't vary from language to language).

Sep 16 '07 #4
"Lubomir" <Lu*****@discus sions.microsoft .comwrote in message
news:92******** *************** ***********@mic rosoft.com...
My problem is, that I need to find some particular service. For exmaple I
need to work with "Network Service" and I need to pass its name to some
function.

If U run a non English version of OS, the name if this service will not be
"Network Service". So when I use the method you recommended, I gte a list
of
non-english names. How I will know, which one of them is "Network Service"
?
The idea is that you have the two properties ServiceName and a DisplayName.
While DisplayName is different in different languages, ServiceName is not.
ServiceName is supposed to be the same in all the versions of the OS.
Sep 16 '07 #5
"Lubomir" <Lu*****@discus sions.microsoft .comwrote in message
news:92******** *************** ***********@mic rosoft.com...
Thanks fro answer.

My problem is, that I need to find some particular service. For exmaple I
need to work with "Network Service" and I need to pass its name to some
function.

If U run a non English version of OS, the name if this service will not be
"Network Service". So when I use the method you recommended, I gte a list
of
non-english names. How I will know, which one of them is "Network Service"
?

I think I should be able to find any particular service by his SID. This
SID
I guess is the same on all Windows OS. So using this SID I would get the
"Network Service" name is the particular localized language.

I don't know how to work with SIDs in C#. I didn't find any methods that
would use it for returning a service name.
Network Service is a windows account name, not a service name. Services are
"background processes" that have a non localized "Service Name" and a
localized "Display Name".

When looking for services, you use the "Service Name" because that does not
change across different localizations. However, the Display Name can be
(not necessarily is) different accross the different localizations.

That being said, if you want to get the "name" of the Network Service
account, you could do something like
using System.Security .Principal;
....

SecurityIdentif ier id = new
SecurityIdentif ier(WellKnownSi dType.NetworkSe rviceSid, null);
NTAccount acct = (NTAccount)id.T ranslate(typeof (NTAccount);
string networkServiceA ccountName = acct.Value;

I don't know if that final result is localized or not (I cannot remember
offhand). However, the first line creates the SID representation of the
account. I don't know what you'd want to do with this particular account
name, since you originally asked about finding services, not accounts.

--
Doug Semler, MCPD
a.a. #705, BAAWA. EAC Guardian of the Horn of the IPU (pbuhh).
The answer is 42; DNRC o-
Gur Hfrarg unf orpbzr fb shyy bs penc gurfr qnlf, abbar rira
erpbtavmrf fvzcyr guvatf yvxr ebg13 nalzber. Fnq, vfa'g vg?

Sep 16 '07 #6
Thanks for help.

Lubomir

"Doug Semler" wrote:
"Lubomir" <Lu*****@discus sions.microsoft .comwrote in message
news:92******** *************** ***********@mic rosoft.com...
Thanks fro answer.

My problem is, that I need to find some particular service. For exmaple I
need to work with "Network Service" and I need to pass its name to some
function.

If U run a non English version of OS, the name if this service will not be
"Network Service". So when I use the method you recommended, I gte a list
of
non-english names. How I will know, which one of them is "Network Service"
?

I think I should be able to find any particular service by his SID. This
SID
I guess is the same on all Windows OS. So using this SID I would get the
"Network Service" name is the particular localized language.

I don't know how to work with SIDs in C#. I didn't find any methods that
would use it for returning a service name.

Network Service is a windows account name, not a service name. Services are
"background processes" that have a non localized "Service Name" and a
localized "Display Name".

When looking for services, you use the "Service Name" because that does not
change across different localizations. However, the Display Name can be
(not necessarily is) different accross the different localizations.

That being said, if you want to get the "name" of the Network Service
account, you could do something like
using System.Security .Principal;
....

SecurityIdentif ier id = new
SecurityIdentif ier(WellKnownSi dType.NetworkSe rviceSid, null);
NTAccount acct = (NTAccount)id.T ranslate(typeof (NTAccount);
string networkServiceA ccountName = acct.Value;

I don't know if that final result is localized or not (I cannot remember
offhand). However, the first line creates the SID representation of the
account. I don't know what you'd want to do with this particular account
name, since you originally asked about finding services, not accounts.

--
Doug Semler, MCPD
a.a. #705, BAAWA. EAC Guardian of the Horn of the IPU (pbuhh).
The answer is 42; DNRC o-
Gur Hfrarg unf orpbzr fb shyy bs penc gurfr qnlf, abbar rira
erpbtavmrf fvzcyr guvatf yvxr ebg13 nalzber. Fnq, vfa'g vg?

Sep 17 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
528
by: PatrickSA | last post by:
Hi, Am new to web services, so apologies for the basic nature of the question - and apologies in advance if this is the wrong newsgroup. We're building a new web service and I'm looking around for documentation on a number of issues, including versioning of web service interfaces... I've spent the last few hours looking through books, Google, MSDN and surprisingly I have found little or nothing that explains/shows how to practically...
9
7028
by: Hardy Wang | last post by:
Hi all: I read an article from http://www.c-sharpcorner.com/Code/2003/Sept/InstallingWinServiceProgrammatically.asp about how to install a windows service programmatically. Based ont the code sample, it provides the feature to install service under LocalSystem account. What I need is to install service under some other certian account. By further studying the code, and MSDN...
3
57004
by: Jeremy S. | last post by:
On my dev machine (XP/Pro with VS.NET 2003) I have been developing a Windows Service and installing it on the local machine by opening the Visual Studio Command Prompt and then executing . Now I want to test this service on a Windows Server 2003 box that doesn't have the Visual Studio Command prompt. How do I go about installing the service on the Windows Server 2003 box? Thanks!
3
5076
by: Jerome Cohen | last post by:
AI am trying to call a third-party web service. this service expects an XML fragment that contains the request plus other parameter. adding the web reference created the syntax below(reference.vb). I changed the data type for the structure that contains the XML data from the default "String" to "xml.xmldocument" to enable easy filling of the data. my client code creates an XML document class, fills the data using standard xml dom...
3
3148
by: GT | last post by:
I have a .NET client that consumes an Axis web service. A change was made recently to the AXIS web service, and ever since then my .NET proxy class has been throwing an InvalidCastException. The proxy class was auto-generated by Visual Studio from WSDL provided by people who provide the Axis service, and I have not modified it (except to add code for a build that includes a SOAP trace). The only difference I see in the messages is that...
4
4184
by: tshad | last post by:
What would be a good way to check programmatically whether a service was running? We have a service that dies periodically and I need to check to see if this service is running. I know how to check to see if the status is in stopped or running mode. But that doesn't tell me if it is actually running. I need to know this so that if it happens I can programmatically start the same service on another machine.
3
6627
dmjpro
by: dmjpro | last post by:
plz send me a good link which can clearify me how the J2EE framework works i want the details information .... plz help thanx
20
6753
by: =?Utf-8?B?cmtibmFpcg==?= | last post by:
I was executing the steps given in http://suppor.microsoft.com/kb/308359 for testing a sample web service application. However, the following line gives a compilation error: localhost.Service1 xxx = new localhost.Service1(); localhost is not recognized by the compiler.
5
3308
by: dm3281 | last post by:
I'm really starting to hate writing services -- or trying to, anyway. Why do I need to rename my project to the service name? Why do I need to set the "ServiceName" property to my service name? Why do I need to set a property within my code to the service name? Are all these required or am I just doing this for consistency purposes?
0
2843
by: =?ISO-8859-1?Q?Jan_Thom=E4?= | last post by:
Hi, I've been trying like a madman to make my WSDL work with .net, but it seems I am out of luck. Whenever I add a service reference to Visual C#, the code gets generated fine, however all operations miss their parameters, which is very weird. I have stripped down the WSDL to an example of a singe simple function. Before I post all the WSDL, here is what I tried. I loaded the WSDL using the "add service reference" function. I got code...
0
9647
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9485
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10161
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10098
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9958
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7506
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5390
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2890
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.