accessing a new vm's terminal without using the console in UI - vmware

I'm new to vmware and i'm trying to do some automation when creating a vm from an OVA file. Essentially, I have an OVA that I need to get into the console and run a script so I can get to it via the internet...the script is this (runs a netplan config and some iptable commands), I just don't know how to execute or run the commands manually without having to get into the UI via the console.
I'm just trying to figure out how I can run this without having to access the console via the vmware esxi UI.
I'm using packet.com's environment to provision a server with vmware esxi on it via terraform, and then use ansible to deploy a few ova's on it.
The problem then is though that I can't access the newly deployed vm's unless I go into the console of the vm via the UI. I'm trying to see how I can do that either via an api or some other fashion so I can do some further automation after the VM's come up.

Assuming the VM has VMware Tools running, that would give you access to run a process/command/script in the Guest OS using the GuestProcessManager object in the vSphere Web Services API. More specifically, using the StartProgramInGuest method: http://pubs.vmware.com/vsphere-6-5/topic/com.vmware.wssdk.apiref.doc/vim.vm.guest.ProcessManager.html#startProgram

Related

How to run .exe file on startup on gcp windows instance

I am having a VM, windows instance (GCE) on google cloud platform. I want to run a program(.exe) every time at the start of the instance.
I am able to run the file by putting it in the startup folder. but I want to run it using startup script as suggested by google here: running startup scripts on a google compute engine
To run .exe on GCP when Windows VM instance start/restart.
Click edit on VM instance
Expand Management, security, disks, networking, sole tenancy section
In the Metadata section, provide windows-startup-script-cmd as the metadata key.
In the Value box, provide /path/to/exe-file

Invoking Windows EC2 terminal remotely

I need to connect to my Windows EC2 terminal to invoke a local script on it from a different machine CMD.
I tried to search and I 'v found the following: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Connect-using-EC2-Instance-Connect.html. This solves the problem for Linux, not windows. Any suggestion or lead for a solution?
On Windows machines, you can remotely SSH onto your EC2 instance using a bash shell, which supports SSH.
If you have git bash installed, it can do the trick for you.
You will need the pem file which you can generate before launching your EC2 instance, at the very last step. Else, you can also use your own key - see docs from AWS here.
You can look into the option of session manager.
Please refer: https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager.html
To give you a brief, Session Manager is a fully managed AWS Systems Manager capability that lets you manage your Amazon EC2 instances, on-premises instances, and virtual machines (VMs) through an interactive one-click browser-based shell or through the AWS CLI.

How to connect GCP VM instance using android Cloud Console?

I've just created a VM instance at GCP with os-login feature enabled. I can connect via ssh using web browser console, SDK, but, I can't connect using the android app called Cloud Console.
Is there any extra step while configuring os-login to use the offical google android app?
Thanks.
I believe everything should work out of the box. There certainly isn't mention of any extra documentation on the Cloud Console Mobile App landing page.
I spun up a new instance (europe-west4-b, n1-standard-1, debian-9-stretch-v20190813) and set the metadata to enable-oslogin = TRUE and I managed to connect right away, albeit from an iOS device.
I would suggest trying different networks (WiFi, 3G/4G), double check any suspicious firewall tags on the instance, maybe even try from a different device. If the connection attempt did reach the server, chances are there's at least one log entry mentioning it in /var/log (/var/log/auth.log in Debian is a good place to start).

Programmatically Download RDP file from AWS once a EC2 instance its launch with it java sdk

There are a few things I require help on, I am currently working with AWS ec2 instances. I have successfully started a server using an Image I have created in AWS and launch the image to multiple instances with the help of the Java SDK. To let me access these instances that I have launched, I understand that in the aws console I am able to get RDP File when I click on download Remote Desktop File when I click on the instance but I am checking if the java SDK provides a way to get the RDP file directly without having me to go into the console.

Using the vSphere SDK to run a script on a host

I've written applications making use of the vCloud SDK in the past, and it provided the ability to provide a guest customization script that would be run on the VM when you provisioned. This let me automate VM provisioning from code along with a few per-host customizations, which was great. Since these VMs were running on ESXi, this told me that passing in a script to be run on the VM was a capability of ESXi and the VMWare Tools.
Now I'm working with the vSphere SDK, and I can't a similar capability anywhere. I want to be able to provide a script to my hosts that joins them to my domain, but I can't figure a way to pass a script that does this from the SDK. Is this possible? Or is this capability somehow unique to vCloud?