How can i get the name of my computer?
Is there any class that gives me access to properties like ComputerName,
Workgroup, Domain?
thnaks,
Gonçalo Boléo 5 71435
On Sat, 13 Nov 2004 19:59:55 -0000, "Gonçalo Boléo" <go*****@kaid4. pt>
wrote: How can i get the name of my computer? Is there any class that gives me access to properties like ComputerName, Workgroup, Domain?
thnaks, Gonçalo Boléo
Hello Goncalo,
Try this.
using System.Security .Principal;
WindowsIdentity .GetCurrent().N ame.ToString();
This returns a string computer/username.
Also check out the System.Windows. Forms.SystemInf ormation class. It has a
static property that returns the computer name.
Thomas P. Skinner [MVP]
<Arne Schittenhelm> wrote in message
news:l7******** *************** *********@4ax.c om... On Sat, 13 Nov 2004 19:59:55 -0000, "Gonçalo Boléo" <go*****@kaid4. pt> wrote:
How can i get the name of my computer? Is there any class that gives me access to properties like ComputerName, Workgroup, Domain?
thnaks, Gonçalo Boléo
Hello Goncalo,
Try this.
using System.Security .Principal; WindowsIdentity .GetCurrent().N ame.ToString();
This returns a string computer/username.
Using System.Manageme nt and WMI (WinMe, W2K, XP and W2K3).
ManagementObjec t cs;
using(cs = new ManagementObjec t ("Win32_Compute rSystem.Name='" +
System.Environm ent.MachineName + "'"))
{
cs.Get();
if ((bool)cs["partOfDoma in"] != null)
{
if ((bool)cs["partOfDoma in"] == true)
{
Console.WriteLi ne("Domain: {0}",cs["domain"]);
}
else
Console.WriteLi ne("Workgroup: {0}",cs["workgroup"]);
}
else
Console.WriteLi ne("No domain/Workgrup member");
}
Willy.
"Gonçalo Boléo" <go*****@kaid4. pt> wrote in message
news:e4******** ******@TK2MSFTN GP10.phx.gbl... How can i get the name of my computer? Is there any class that gives me access to properties like ComputerName, Workgroup, Domain?
thnaks, Gonçalo Boléo
(1) // Gets the string containing the DNS host name of the local computer.
String hostName = Dns.GetHostName ();
(2) // Gets the NetBIOS name of this local computer
String hostName = Environment.Mac hineName;
----
Sharon G.
Environment.Mac hineName
--
William Stacey, MVP http://mvp.support.microsoft.com
"Gonçalo Boléo" <go*****@kaid4. pt> wrote in message
news:e4******** ******@TK2MSFTN GP10.phx.gbl... How can i get the name of my computer? Is there any class that gives me access to properties like ComputerName, Workgroup, Domain?
thnaks, Gonçalo Boléo
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Maverick |
last post by:
I'm trying to get the " Computer Name " of a client accessing my web
site,
is there a way to do this ? not ip...
tia
|
by: RR |
last post by:
I'm developing a web app and, for the user's convenience, I'd like to
display their local computer name (i.e. the name of the computer the browser
is running on).
I've looked very hard to find a script that will deliver this and I've also
tried some VBScript (which I know nothing about).
I found a script that did this:
var oShell = new ActiveXObject("Shell.Application");
|
by: Dr. StrangeDub |
last post by:
Leaving network identification/DNS out of the picture, how does one
change the name of a computer in a local Workgroup (in C#)?
I implemented the SetComputerName() API call and that only seems to
change the NetBIOS Computer Name. I've verified that the underlying
registry key value that gets changed is:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName\ComputerName
Is there a recommended API (via Active...
|
by: Uzi Baruch |
last post by:
Hi!
i want to know if i have an ip address of a computer and its DNS server
name, if their is an windows API
that can resolve the computer name of the given ip address.
or vice verca - given a computer name and it's DNS server, i need to obtain
the IP address.
|
by: z. f. |
last post by:
i need to get the computer name from an aspx page.
i use System.Windows.Forms.SystemInformation.ComputerName()
and it's working fine,
but in second thought, it might not be recomended to use the
system.windows.forms.dll
inside an asp-dot-net code.
any information here will help.
TIA, z.
| |
by: greg chu |
last post by:
Hi, I tried to use
Private Declare Function SetComputerName Lib "kernel32" Alias
"SetComputerNameA" (ByVal lpComputerName As String) As Long
SetComputerName(newname)
newname is the name I want to change to.
But after I reboot the windows 2000 prof. the computer name remained
the same.
|
by: ThunderMusic |
last post by:
Hi,
I want to find the computer name and the company name from the network
indentification informations.
For the computer name, I found System.Net.Dns.GetHostName(), but I fgound
nothing for the company name.
Can someone help me plz?
Thanks
|
by: Hani Atassi |
last post by:
I am developing a secured Web Service that only specific Windows role can
access it. I have the following in the configuration file:
<authentication mode="Windows" />
<identity impersonate="true" />
<authorization>
<allow roles="WDInterfaceWebService" />
<deny users="*" />
</authorization>
|
by: BrianT |
last post by:
I'm trying to build code that allows the computer name to be changed, then asks the user to reboot to make the change affective. I got the code working when logged in as the local computer administrator or a domain administrator, but a regular domain user (with administrator privileges on the local machine) can't run the code successfully. They get error 1219, which I believe means "Multiple connections to a server or shared resource by the same...
|
by: =?Utf-8?B?QkRSaWNoYXJkc29u?= |
last post by:
I am aware that is is possible to determine the web client computer name
using DNS, i.e. invoke System.Net.Dns.GetHostEntry(
System.Web.HttpRequest.UserHostAddress). However, this only seems to work if
the client computer resides within the same domain as the web server.
Is it possible to determine the computer name for a web client which resides
in a different domain to the web server?
|
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: 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,...
|
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: 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...
|
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.
|
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...
| |