VMware Cloud Community
hazo
Contributor
Contributor

Invoke-VMScript - Failing to authenticate

Hi, Would anyone know how I can set a hostname variable in a powercli script when deploying from a template and attemtping to run inguest operations to stop the error "Invoke-VMScript  Failed to authenticate with the guest operating system using the supplied credentials" as the virtual machines are deploying with a generic hostname like "WIN-B2GUQBPMU6S" so my variable for the account to authenticate with "localhost\administrator" or "administrator" is not working?

Thanks, Paul

0 Kudos
5 Replies
LucD
Leadership
Leadership

Aren't you creating the VM from a Template with an OSCustomizationSpec?

Then you can easily set the hostname


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

0 Kudos
hazo
Contributor
Contributor

Hi Luc, I tried that but it timed out on the customisation and the script failed,  so I #'d that out.  I created the guest customisation using the html5 connection to vcsa 65 and it's for w2016, could either of these be the issue?  I've had same issue trying to call guest customisation using vra also, maybe something stupid I'm doing.

Thanks, Paul

0 Kudos
hazo
Contributor
Contributor

Meant to add it's also a nested esxi 65 / vcsa 65 test environment in vmware workstation and I'm calling the scripts from my own laptop using powershell.
0 Kudos
LucD
Leadership
Leadership

I don't think the way through which you created the OSCustomizationSpec has anything to do with it.

But if you do it through PowerCLI, you have documentation how it was done (the New-OSCustomizationSpec cmdlet and it's parameters).

I would suggest to go that way, and then we can try to figure out why it is not doing what you want it to do.

Is probably a lot easier than trying to logon to a host with a random name :smileygrin:


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

0 Kudos
hazo
Contributor
Contributor

Thanks Luc, will try that.

Paul

0 Kudos