powershell - Issues understanding ProgressBar -
i have script need insert gui style progress bar into, @ end of it. script automated account creation. having issue understand how insert different messages box, example @ 15 seconds "creating account" display in progress bar, @ 30 seconds, "setting acl" display , on. below have far, might need take in different direction.
$progressbar = new-object system.windows.forms.progressbar $progressbar.location = new-object system.drawing.size(10,10) $progressbar.size = new-object system.drawing.size(280,10) $progressbar.name = "progressbar" $objform.controls.add($progressbar)
i able progress bar below show correctly not able write process, example @ 10% " creating user" written bar. help?
bfunction updateprogressbar{ # divide number of items processed far total number of items process, times 100 $progress = $global:progresscurrent /$global:progresstotal*100 # update progressbar value $progressbar.value = $progress
}
function testbar { # create basic form
$objform = new-object system.windows.forms.form $objform.startposition = 1 $objform.clientsize = new-object system.drawing.size(300,50) $objform.name = "form1" $objform.text = "example progressbar" $objform.label = ($i = 1; $i -le 100; $i++) {write-progress -activity "testing" -status "$i% complete:" -percentcomplete $i;} $progressbar = new-object system.windows.forms.progressbar $progressbar.location = new-object system.drawing.size(10,10) $progressbar.size = new-object system.drawing.size(280,10) $progressbar.name = "progressbar" $objform.controls.add($progressbar) $objform.showdialog() | out-null
} testbar
Comments
Post a Comment