Output Get-ADUser data to rich text box
hi all,
i have created form want use ad properties users , display them in form.
i can data outputs distinguished name rich text box.
how can display information ad?
here code have far -
#generated form function function generateform { ######################################################################## # code generated by: sapien technologies primalforms (community edition) v1.0.10.0 # generated on: 18/10/2012 09:58 # generated by: adminnp ######################################################################## #region import assemblies [reflection.assembly]::loadwithpartialname("system.windows.forms") | out-null [reflection.assembly]::loadwithpartialname("system.drawing") | out-null #endregion #region generated form objects $form1 = new-object system.windows.forms.form $richtextbox1 = new-object system.windows.forms.richtextbox $textbox1 = new-object system.windows.forms.textbox $button1 = new-object system.windows.forms.button $initialformwindowstate = new-object system.windows.forms.formwindowstate #endregion generated form objects #---------------------------------------------- #generated event script blocks #---------------------------------------------- #provide custom code events specified in primalforms. $processdata= { #todo: place custom script here $user=($textbox1.text) get-aduser -filter {samaccountname -eq $user} -properties * -outvariable data foreach ($line in $data) { $richtextbox1.appendtext($line) } } $onloadform_statecorrection= {#correct initial state of form prevent .net maximized form issue $form1.windowstate = $initialformwindowstate } #---------------------------------------------- #region generated form code $system_drawing_size = new-object system.drawing.size $system_drawing_size.height = 262 $system_drawing_size.width = 284 $form1.clientsize = $system_drawing_size $form1.databindings.defaultdatasourceupdatemode = 0 $form1.name = "form1" $form1.text = "primal form" $richtextbox1.anchor = 15 $richtextbox1.databindings.defaultdatasourceupdatemode = 0 $system_drawing_point = new-object system.drawing.point $system_drawing_point.x = 8 $system_drawing_point.y = 56 $richtextbox1.location = $system_drawing_point $richtextbox1.name = "richtextbox1" $system_drawing_size = new-object system.drawing.size $system_drawing_size.height = 194 $system_drawing_size.width = 263 $richtextbox1.size = $system_drawing_size $richtextbox1.tabindex = 2 $richtextbox1.text = "" $richtextbox1.font = "courier new" $form1.controls.add($richtextbox1) $textbox1.anchor = 13 $textbox1.databindings.defaultdatasourceupdatemode = 0 $system_drawing_point = new-object system.drawing.point $system_drawing_point.x = 8 $system_drawing_point.y = 12 $textbox1.location = $system_drawing_point $textbox1.name = "textbox1" $system_drawing_size = new-object system.drawing.size $system_drawing_size.height = 20 $system_drawing_size.width = 190 $textbox1.size = $system_drawing_size $textbox1.tabindex = 1 $form1.controls.add($textbox1) $button1.anchor = 9 $button1.databindings.defaultdatasourceupdatemode = 0 $system_drawing_point = new-object system.drawing.point $system_drawing_point.x = 209 $system_drawing_point.y = 12 $button1.location = $system_drawing_point $button1.name = "button1" $system_drawing_size = new-object system.drawing.size $system_drawing_size.height = 24 $system_drawing_size.width = 63 $button1.size = $system_drawing_size $button1.tabindex = 0 $button1.text = "go" $button1.usevisualstylebackcolor = $true $button1.add_click($processdata) $form1.controls.add($button1) #endregion generated form code #save initial state of form $initialformwindowstate = $form1.windowstate #init onload event correct initial state of form $form1.add_load($onloadform_statecorrection) #show form $form1.showdialog()| out-null } #end function #call function generateform
thanks advance
nix151
this behavior inherited way powershell exposes adsi data host (console)
play line appends text
e.g.:
$richtextbox1.appendtext(($line | select * | out-string))
Windows Server > Windows PowerShell
Comments
Post a Comment