-Passthru
parameter with the Start-VM
cmdlet. Here's an example of how you can start a VM in headless mode:
$vmName = "YourVMName" Start-VM -Name $vmName -Passthru
Start-VM
cmdlet will return the VM object once it has started. By using the -Passthru
parameter, the Virtual Machine Connection window will not open, and the VM will be started in headless mode. You can store the returned VM object in a variable and use it to perform additional operations or retrieve information about the VM. If you don't want to store the VM object, you can simply use the following command: Start-VM -Name "YourVMName" -Passthru
Note that when starting a VM in headless mode, you won't have any graphical interface to interact with the VM. You can use other methods such as PowerShell Remoting or Remote Desktop Protocol (RDP) to access and manage the VM.