aspx of a test web site and you should get similar
results to those in Figure 17-2.
Figure 17-2
Part IV: Automating Administration
492
You can take this example a little further and allow the user to select a number of properties to filter by.
As shown in Figure 17-3, add a drop - down list named DropDownList1 to provide a list of properties to
filter. Then add a text box named TextBox2 so that the user can type the filter criteria. The drop - down list
control should be pre - populated with values such as DisplayName , ServerName , IsMailboxEnabled ,
and Database .
After you add the controls, you need to modify the code used to generate the ScriptBlock so that it
will take input from the drop - down list and text box. The code would look something like this:
ScriptBlock sBlock = (ScriptBlock)rsi.Invoke(???{$_.??? +
DropDownList1.SelectedValue + ??? -match \?????? +
TextBox2.Text. Replace(???\\???,???\\\\???) + ???\???}???)[0].BaseObject;
The Replace method is used to allow a user to specify the full database path which includes the ??? \ ???
character.; however, with any software development care needs to be taken to ensure that users are
unable to input malicious code into the text box. This should be done with proper bounds checking and
security best practices. The results of a search from the new page would look like Figure 17 - 4 .
Pages:
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685