Quantcast
Channel: Virtual Machine Manager – General forum
Viewing all articles
Browse latest Browse all 728

Virtual Machine Manager - PowerShell Script to run setup file (exe) on VMs

$
0
0

Hello,

i have a powershell script which creates muliple VMs (see below)

my question is:

which powershell command should i add to the script below in order to run setup file (exe) on each machine?

e.g: i created 20 VMs and now i want to run setup file (exe) on each of these VMs after they created (20 exe file to execute)

Thanks in advance.

[int]$VMcount =Read-host InputNumber of VMs


$Templatename =Read-host "Input VMTemplate Name"
$VMTemplate =Get-SCVMTemplate|where{$_.Name-eq "$Templatename"}

$VMName =Read-host InputBaseName

$Hostname =Read-host "Input Host Name"
$VMHost =Get-SCVMHost-ComputerName $Hostname

$VMPath =Read-host "Input VM Path (example: C:\Clusterstorage\Volume1)"

$Total =1While($total -le $VMCount){$NewVMName =$VMName-”+ $totalWrite-Output $virtualMachineConfigurationNew-SCVirtualMachine-Name $NewVMName -VMHost"$VMHost"-path "$VMPath"-VMTemplate"$VMTemplate"-ReturnImmediately-DelayStartSeconds0"

$Total++

}


Viewing all articles
Browse latest Browse all 728

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>