I know how to "draw" a window using powershell to display check boxes. However, that is about all I have been able to figure out. I want to display a list of virtual machines stored on an ESXI server (I can just set this statically as the list shouldn't change). What I need to figure out is how to make a check box cause vmrun to execute a power on for the machine. So basically I have four check boxes with say "VM01" , "VM02" , "VM03", "VM04". How can I have the checked boxes returned and say if VM01 & VM03 are checked turn on the machines. I have the power on scripts stored as variables
答案 0 :(得分:0)
You need to add an event handler to the Click event. Add your code to the handler scriptblock.
$checkboxAll.add_Click($handler_checkboxAll_Click)
$handler_checkboxAll_Click=
{
if ($checkboxAll.Checked)
{
#do stuff if the box is checked
}
}