VMware Cloud Community
drivera01
Enthusiast
Enthusiast
Jump to solution

change shortname to FQDN

how can I change my hostname's SHORT NAME to its FQDM.

$short = disney

want:

$FQDN = disney.land.com

thanks

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Did you already try with the Set-VMHostNetwork cmdlet ?

Something like

Get-VMHost MyESx | Get-VMHostNetwork | 
Set-VMHostNetwork
-DomainName "land.com"


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
8 Replies
LucD
Leadership
Leadership
Jump to solution

Did you already try with the Set-VMHostNetwork cmdlet ?

Something like

Get-VMHost MyESx | Get-VMHostNetwork | 
Set-VMHostNetwork
-DomainName "land.com"


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
drivera01
Enthusiast
Enthusiast
Jump to solution

I seen that but isn't that just for the esx nodes? This is a vm. I need it because I'm calling another script that requires the FQDN as one of the args.

0 Kudos
drivera01
Enthusiast
Enthusiast
Jump to solution

Not sure if this is the best way to acheive these results... but it works..

$short = "disney"

$fqdn = $short | ForEach-Object{ $_ + '.land.com' }

0 Kudos
RvdNieuwendijk
Leadership
Leadership
Jump to solution

One of the following looks easier to me:

$short = "disney"
$fqdn = "$short.land.com"

or:

$fqdn = $short + ".land.com"

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
LucD
Leadership
Leadership
Jump to solution

Do you only want to set the FQDN in a variable, or set it in the OS of the guest ?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
drivera01
Enthusiast
Enthusiast
Jump to solution

Only in a variable to be use elsewhere

0 Kudos
LucD
Leadership
Leadership
Jump to solution

And do you know the domainname ? Is it always the same ?

In that case the solution from Robert will work.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
drivera01
Enthusiast
Enthusiast
Jump to solution

yes the domainname is always the same... Robert's will work just find.

thank you

0 Kudos