473,324 Members | 2,581 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Determining the computer's domain

JZ
Hi,

At run-time, I need to determine the domain on which the server is currently
joined. System.Environment doesn't provide me with the information that I
need through the UserDomainName property because that is the network domain
name associated with the current user. I need to know the domain (if the
server is currently logged on) like "mydomain.com".

Thank you in advance.

JZ
Nov 15 '05 #1
2 12879
string domain = Environment.UserDomainName;

GP

"JZ" <jo**********@hotmail.com.removethis> wrote in message
news:uD**************@TK2MSFTNGP12.phx.gbl...
Hi,

At run-time, I need to determine the domain on which the server is currently joined. System.Environment doesn't provide me with the information that I
need through the UserDomainName property because that is the network domain name associated with the current user. I need to know the domain (if the
server is currently logged on) like "mydomain.com".

Thank you in advance.

JZ

Nov 15 '05 #2
Ok. I should read to the end, before I click the "Reply Group" - Button!
"JZ" <jo**********@hotmail.com.removethis> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
Jerry's suggestion of using DsRoleGetPrimaryDomainInformation worked like a charm. Thank you very much.

Gunter - see my original post for why UserDomainName did not meet my needs.
If anyone is curious, I also tried using the System.Management namespace. I believe that it could have provided me with the information that I was
looking for but permissions on "root\CIMV2" wouldn't allow ASPNET to
retrieve the information (and I didn't feel like changing the security).

"Günter Prossliner" <g.**********@gmx.at> wrote in message
news:#A*************@TK2MSFTNGP10.phx.gbl...
string domain = Environment.UserDomainName;

GP

"JZ" <jo**********@hotmail.com.removethis> wrote in message
news:uD**************@TK2MSFTNGP12.phx.gbl...
Hi,

At run-time, I need to determine the domain on which the server is currently
joined. System.Environment doesn't provide me with the information that I
need through the UserDomainName property because that is the network

domain
name associated with the current user. I need to know the domain (if

the server is currently logged on) like "mydomain.com".

Thank you in advance.

JZ



Nov 15 '05 #3

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

Similar topics

5
by: Ondrej Sevecek | last post by:
Hello, there were Win32 API functions suchs as GetComputerName(), GetUserName(), NetUserEnum(), NetDomainEnum(), ... Where are those functions available through .NET framework? Ondra.
6
by: Gawel | last post by:
Hajo, I am searching solution for this proble over 2 days. I need to be able to create mailboxes on exchange server that is in domain. I need to do it outside of domain. What is more I can...
3
by: Jonny Wilkinson | last post by:
Hi I need to be able to determine the domain name the web page has been called from. I have a site that can be accessed through different domain names (they all point to the same IP address) ...
1
by: Paul | last post by:
Hi all, Thanks in advance for your help. I would like to know how to add a computer to a domain, and a domain user to a local group. Cheers Paul
3
by: ad | last post by:
Hi Everyone! How can I get the name of computer and domain in vbnet
0
by: wifetalks | last post by:
I'm enumerating the computers in the domain to a listview control on my form, but how do I include the comments. Like what you would see in Windows Explorer when you browse the domain. On our...
5
by: Rocky | last post by:
Hi, I have a webform, with 2 textboxs and a submit button. In the text box1, i enter a username and in textbox2 I enter the computer name. Both the username and computer name is in active...
6
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...
10
usafshah
by: usafshah | last post by:
Hi I want to add a computer to domain but its giving me problem like: Network path cannot be reached.... I tried to run TCP Helper service but that was already running. I restarted the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.