Hi,
If anybody knows how to get the domain name(only domain name) of the
system pls let me know.
Thanks and Regards,
Vinothkumar B bv*****@tvsinfo tech.com 8 37037
it is located in registry
in key
HKLM\SOFTWARE\M icrosoft\Window s
NT\CurrentVersi on\Winlogon\Def aultDomainName
read this key and you have it
Hope this helps
Galin Iliev[MCSD.NET] www.galcho.com
Console.WriteLi ne(Environment. UserDomainName) ;
None wrote: Hi,
If anybody knows how to get the domain name(only domain name) of the system pls let me know.
Thanks and Regards, Vinothkumar B bv*****@tvsinfo tech.com
Hi,
This is giving me the username only not domain name. I want only the
domain name.
"None" <vi********@gma il.com> wrote in message
news:11******** *************@i 40g2000cwc.goog legroups.com...
| Hi,
|
| This is giving me the username only not domain name. I want only the
| domain name.
|
No, it's returning the domain name not the user name.
Willy.
"Galcho[MCSD.NET]" <ga****@gmail.c om> wrote in message
news:11******** **************@ i40g2000cwc.goo glegroups.com.. .
| it is located in registry
|
| in key
| HKLM\SOFTWARE\M icrosoft\Window s
| NT\CurrentVersi on\Winlogon\Def aultDomainName
|
| read this key and you have it
|
| Hope this helps
| Galin Iliev[MCSD.NET]
| www.galcho.com
|
Sure, almost all configuration parameters are stored in the registry, but
you better use the appropriate API's to get this kind of info instead of
reading directly from the registry.
The reason is simple, their location is not documented and is not guaranteed
to remain the same across OS versions, and the registry is subject to access
privilege restrictions.
Willy.
You're right, Thanks for advise
I did not take a look at Environment class
regards
Galin Iliev[MCSD.NET] www.galcho.com
"jeremiah johnson" <na*******@gmai l.com> wrote in message
news:uq******** ********@TK2MSF TNGP02.phx.gbl. .. Console.WriteLi ne(Environment. UserDomainName) ;
None wrote: Hi,
If anybody knows how to get the domain name(only domain name) of the system pls let me know.
....
However, there are two domain names involved: domain that computer belongs
to and domain current logged user belongs to. Two may not be the same (in
case there are domain trusts between domains). It is not clear what original
poster wanted though.
Regards,
Goran
"Goran Sliskovic" <gs******@yahoo .com> wrote in message
news:eW******** ******@TK2MSFTN GP04.phx.gbl...
|
| "jeremiah johnson" <na*******@gmai l.com> wrote in message
| news:uq******** ********@TK2MSF TNGP02.phx.gbl. ..
| > Console.WriteLi ne(Environment. UserDomainName) ;
| >
| > None wrote:
| > > Hi,
| > >
| > > If anybody knows how to get the domain name(only domain name) of
the
| > > system pls let me know.
| > >
| ...
|
| However, there are two domain names involved: domain that computer belongs
| to and domain current logged user belongs to. Two may not be the same (in
| case there are domain trusts between domains). It is not clear what
original
| poster wanted though.
|
| Regards,
| Goran
|
|
That's right. To get Domain info it's better to use WMI or ADSI, both are
accessible from .NET through the System.Manageme nt and
System.Director yServices namespaces.
To get the machine account domain for instance you can query the
'Win32_Computer System' WMI class like this:
SelectQuery query = new SelectQuery("Wi n32_ComputerSys tem");
using(Managemen tObjectSearcher searcher = new
ManagementObjec tSearcher(query ))
{
foreach (ManagementObje ct mo in searcher.Get()) {
if((bool)mo["partofdoma in"] != true)
Console.WriteLi ne("Workgroup: {0} ",mo["workgroup"]);
else
Console.WriteLi ne("Domain: {0} ",mo["domain"]);
}
}
To get the interactive logon account domain, you can query the
Win32_LogonSess ion and it's associated Win32_Account instance.
If all you need is to get the logon account domain from a program running in
the logon session of an iteractive user, just read the
Environment.Use rDomainName property. In all other cases, that is,
applications running in non interactive logon sessions, you cannot rely on
the Environment class to get this kind of info, so you will need to use one
of the above.
Willy. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jordan |
last post by:
Suppose I register a domain name, MyDomain.com, through register.com (or any
other of the many domain name registrars).
I own the domain name. The domain name goes into the global DNS database.
As the facilitator in this process, exactly what does the registrar *own*
with respect to my specific domain name and/or the registration process?
Briefly, what role does InterNIC play in all of this?
|
by: Bruno |
last post by:
Hello Friends
I have a big problem. I can't retrieve the domain name (example:
contoso.com) using visual basic.net language. I'm very appreciate if anyone
give me an example how can I solve this.
Im new on this language and and perhaps this is very easy for all of you :)
Thanks for help
Bruno R.
|
by: Bruno |
last post by:
Hello friends
I need to create a simple application that returns the domain name where the
user name logs in. For example, if I acccess in a computer with the domain
user Contoso\bruno, my application should return the value "CONTOSO".
Basically, my application when executed in a pc that belongs to a domain,
must return the CONTOSO.COM (domain name). All this in Visual Basic.net.
Thank you for help
|
by: Michael |
last post by:
Does someone have a reliable routine to get the domain name of the current
user of a web page? Something like NSLookup. I have no problem getting
their IP address, but I also want the domaine name.
Thanks,
-Michael
|
by: Anders K. Olsen |
last post by:
Hello group
I'm trying to list the users and groups who has read access to a file.
I use .NET 2.0 and FileInfo.GetAccessControl().GetAccessRules(...) and then
loop through the FileSystemAccessRule objects. Using these objects, it is
easy to use rule.IdentityReference.Translate(typeof(NTAccount)) to get the
NTAccount object.
I have noticed that some of the NTAccounts can belong to BUILTIN domains,
| |
by: Adam Tibi |
last post by:
Hello,
I want to get the right most name of the a domain name, for example:
if the domain is www.myweb.com , I want to get myweb.com
something.myweb.com --> myweb.com
www.myweb.com.au --> myweb.com.au
something.myweb.com.au --> myweb.com.au
www.myweb.tv --> myweb.tv
www.something.myweb.net --> myweb.net
|
by: Spyder |
last post by:
When you go to "MyComputer" and get properties and select "Computer Name",
you get the Domain or Workgroup a computer belongs to.
I have looked thru MSDN library, the Internet, the Registry and in all files
on my computer and cannot find how to retrieve this information in VB.Net
2005.
This information is essential for our system implementation.
I have tried:
NetworkInformation.IPGlobalProperties.GetIPGlobalProperties
but it does not...
|
by: tim.mayo |
last post by:
I'm trying to write a component in VB.NET that takes a user account and
returns the Active Directory domain name of the user account. Since
it's not a windows/web application, I can't use
System.Security.Principal.WindowsIdentity.GetCurrent.Name or
HttpContext.Current.User.Identity.Name to get the domain.
I found some examples that use the System.DirectoryServices namespace
and the DirectorySearcher to lookup user properties in AD...
|
by: Sam |
last post by:
Validate domain name context
Hello , Today I want to make sure from a given text is a domain style
or not.
for example : the domain can be
example.com or example.com.us or example.us so , what is the pattren
to check the given string is a domain style or not?
|
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...
|
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,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |