Link to home
Start Free TrialLog in
Avatar of Anthony Lucia
Anthony Lucia

asked on

FQDN and hostname

On WIndows 2008 I perform the following:

c:\>hostname
cont6

Open in new window


What I actually need is the fully qualified host name

How can I get that , what command should I run
ASKER CERTIFIED SOLUTION
Avatar of Mazdajai
Mazdajai
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Anthony Lucia
Anthony Lucia

ASKER

I performed th efollowing within PowerShell

Copyright (C) 2009 Microsoft Corporation. All rights reserved.

PS C:\Users\benchmarking> $env:computername.$env:userdnsdomain
PS C:\Users\benchmarking>
PS C:\Users\benchmarking>
PS C:\Users\benchmarking>
PS C:\Users\benchmarking> $env:computername.$env:userdnsdomain
PS C:\Users\benchmarking>
PS C:\Users\benchmarking>
PS C:\Users\benchmarking>

Open in new window



but did not get the domain
Run the command I provided:
(gwmi WIN32_ComputerSystem).Domain  from a powershell window, it should give you the domain of the computer.
Is the pc a domain member?

If the computer in the workgroup it will display a blank line.
(gwmi WIN32_ComputerSystem).Name + "." + (gwmi WIN32_ComputerSystem).Domain

Will return the fqdn of the computer