VMware Cloud Community
TDRoy
Enthusiast
Enthusiast

Assistance with Wait and Win VM

So two questions here:

1.) This is less related to PowerCLI but still an issue Im having and maybe you fine people can assist. I am able to run scripts through PS and Powercli on a Win Server 2k8 Im using. When trying to do the same on a newer Win 7 laptop I get the following:

Add-PsSnapin : No snap-ins have been registered for Windows PowerShell version 5.

And now that I believe I resolved this particular issue (by uninstalling and messing with some folder paths etc) Im receiving the following:

Cannot find file specified.

Ive never experienced issues with using PS/CLI before and this is just a pain.

2.) This is scripting related so no more common Windows issues here:

I have a deployed Windows VM that is templated at the stage prior to accepting EULA and setting a password. I want to include in a script the following:  (also, is there a way t automate EULA acceptance etc?)

1.) Power ON VM

2.) Wait (presumably until I manually go through EULA acceptance and set password, which will then put me at the desktop)

     - I tried the following (roughly):  $waitfor = ($ping = do(test-connection "vmname") until ($ping))

                                                         Wait-Task $waitfor

3.) I believe the VM will grab a DHCP address on a private 192.x address.

4.) Break the Wait condition upon ping or any other reliable means (maybe check VM tools availability?)

5.) Continue with the script to assign IP addresses, drives etc.

Im having a hard time figuring out how I should tackle this.

Reply
0 Kudos
1 Reply
LucD
Leadership
Leadership

1) Which PowerCI are you using?
Since 6.5.1 it's all modules, you can install them from the PSGallery, and they can live in whatever folder you want.

2) Do you use an OSCustomizationSpec when you create the new VM from a template?
Once the guest OS is up and running, you could use the Invoke-VMScript cmdlet to run scripts inside the guest OS.


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

Reply
0 Kudos