Any 2 or more computers with PowerShell can use Invoke-Command. So all you need is network access and a known credential on the target computer, and you'll get in.
You can have a dedicated Windows machine to store all your scripts that you use to manage your PVE hosts and templates, or you can install PowerShell Core on the PVE hosts themselves and work from there. I do a mix of both, PowerShell on Linux has made tremendous strides in the past 3-4 years imo.
On the PVE hosts of course there will be more mixed bash/PowerShell use which is OK. On a Windows system I use the Posh-SSH module to interact with my hosts via SSH.
Here is an example of how I use Invoke-Command
Code:
$targetComputer = "TEMPLATE" ### Could be a FQDN, name, IP address, etc
$user = "TEMPLATE\Administrator" ### Storing creds in your script is not ideal but another issue to deal with separately
$password = "yTkuMfQeZNhtRf4z"
### Encode the user and password into a PowerShell "pscredential" object so that you can work with it
$secureString = $password | ConvertTo-SecureString -AsPlainText -Force
$credential = New-Object pscredential($user, $secureString)
$scriptBlock = {
### Everything you want to run on the $targetComputer goes in here, it could be simple commands or complex logic
$computerName = hostname
$systemTime = Get-Date
$whats_on_the_C_drive = Get-ChildItem -Path C:\
$computerName
$systemTime
$whats_on_the_C_drive
### and so on
}
### Issue the remote commands and store the output in a $result variable for further processing
$result = Invoke-Command -ComputerName $targetComputer -ScriptBlock $scriptBlock -Credential $credential
So there could be a PowerShell or bash script on the host (or elsewhere) that handles the cloning and deployment of your template and once
the cloned template VM is online, with some default IP address, you can get into it, change the hostname, change the IP, reboot, wait for it to come back at its deployed IP address, and continue with whatever configuration remains.
The $scriptBlock can also be dynamic and receive arguments from Invoke-Command for more advanced stuff.