- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You have to use the ReconfigVM_Task method from the SDK for that.
$VMname = <VMname>
$vmImpl = Get-VM $VMname
$vm = $vmImpl | Get-View
$spec = new-object VMware.Vim.VirtualMachineConfigSpec
foreach($dev in $vm.Config.Hardware.Device){
if($dev.DeviceInfo.Label -like "Serial Port*"){
$temp = New-Object VMware.Vim.VirtualDeviceConfigSpec
$temp.device = [http://VMware.Vim.VirtualDevice|http://VMware.Vim.VirtualDevice]$dev
$temp.device.connectable.connected = $false
$temp.device.connectable.StartConnected = $false
$temp.operation = "edit"
$spec.deviceChange += $temp
}
}
$vm.ReconfigVM_Task($spec)
This changes all serial ports to "disconnected" and will also unselect "Connect at power on".
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference