[go: up one dir, main page]

100% found this document useful (2 votes)
2K views551 pages

PowerShell Studio - OCR

PowerShell Studio - OCR

Uploaded by

netgame76
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
2K views551 pages

PowerShell Studio - OCR

PowerShell Studio - OCR

Uploaded by

netgame76
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 551

Power_

A Comprehensive Guide

Jeff Holder

ISBN'-13:978-1542658010
ISBN'-10: 1542658012
Copyright 2016 - All rights reserved.

In no vvay is it legal to reproduce, duplicate, or transmit any part of this docume11t in either electronic means or in
printed format. Recording of this publication is strictly prohibited and any storage of this doctunent is not allowed
tutless with '.vritten permission fro1n the author. All rights reserved.
The information provided herein is stated to be truthful ru1d consistent, iI1 that any liability, in tem1s of inattention
or otherwise, by any usage or abuse of any policies, processes, or directions contained within is the solitary and utter
responsibility of the recipient reader. Under no circu111stances will any legal responsibility or bla1ne be held against
the publisher or author for any reparation, da1nages, or monetaiy loss due to the information herein, either directly
or indirectly.
The publisher and author disclaim any personal liability, directly or indirectly, for advice or information presented
within. Altl1ough the author and publisher have prepared this manuscript with utmost care and diligence and have
1nade every effort to ensure the accuracy and co1npleteness of the information contained within, vve assu1ne no
responsibility for errors, inaccuracies, omissions, or inconsistencies.
The information herein is offered for informational purposes solely, and is universal as so. The presentation of the
information is 'vithout contract or any type of guarantee assurance.
The trademarks that are used are vvithout any consent, and the publication of the trademark is ,;vithout permission or
backing by the tradernark ovvner. All traden1arks ru1d brru1ds vvitlrin tlris book are for clarifying purposes oruy and
are owned by the ovvners then1selves, 11ot affiliated vvith this document.
No warrai1ty 111ay be created or extended by sales or promotional inaterials. The advice ru1d strategies contained
herein may not be st1itable for every situation. This work is sold \.Vith the understanding that tl1e publisher is not
engaged in rendering legal, accounting, or other professional services. If professional assistance is required, the
services of a competent professional person should be sought. Neither the publisher nor the author shall be liable
for dainages arising herefrom. The fact that an organization or Web site is referred to in this work as a citation and/or
a potential source of further info1mation does not 111ean that the author or tl1e publisher endorses the info1mation tl1e
organ.izatio11 or Web site 1nay provide or recommendations it may make. Further, readers should be aware that
Inten1et Web sites listed in this work may have changed or disappeared between \V hen this \;vork \.Vas \.Vritten and
when it is read.
orewor
Ma11y Pov,;erSl1ell scripters will tell yot1 that the idea of creating GUI applications for PowerShell
scripts is abStud and breaks the very essence of scripting. Ho,vever, you must keep in mind that
eve11 thou.g h yotrr scripts may see1n logical and easy to use to you, tl1ey n1ay not be quite so
understandable or so easy to use for many that are not fanliliar with the Po\\1erShell language, or
in positions outside of system adn1inistration.

The purpose of sc1ipting is to provide a n1ore efficient, robust, auto111ated, custornizable solution
to tl1e inany repeatable processes that are involved in Infonnation Technology every day. The
purpose of creating PowerSl1ell GUI applications is to take the same PowerShell scripts that you
or others have created and present thern in a very easy to use and understandable GUI application
that cai1 be quickly deployed and used by others 'vith i10 scripti11g experience at all. That saves
trai11ing costs, reduces hu1nan errors, increases productivity, and helps overall lo"ver overhead.

PowerShell scripting has beco1ne a required skillset for any Windows System Administrator. We
can do tilings more efficiently, n1ore reliably with repeatable results, and gained tremendously
more power over local and remote systems tllan ever in the past. However, tills has also shifted
a lot of responsibilities to Syste1ns Adnunistrators that in tl1e past were handled by Helpdesk
persom1el, because many did not u11derstand the use of Po,verShell sc1ipts, paraineter
require1nents, etc. This i1nbalance of workload caused Syste1n Administrators with scripting
eA']Jerience to find a \;vay to utilize tJ1e inuch-needed PowerShell scripts but also at the same time
to e1npower less teclulicaJ perso1n1el with the ability to use the numerous scripts t11at developers
vvere churning out. This has caused a sllift towards PowerShell GUI applications.

I have been extensively using PowerShell Studio for several years, and have developed inany enterprise level
applications, and hundreds of sniaJler applications for both corporate and govennnent agencies. When I first staited,
there \Vas very little training docu1nentation outside of SAPIEN Teclu1ologies, and even tl1ough tl1ey did a great job
documenting 1nany of the countless feat11res in PowerShell Studio it vvas cumberso1ne fi11ding the infonnation and
there ,;vas still some undocumented areas.

It wasn' t until I was deep into "vriting this book that I stepped back and realized just ho\ inuch of a challenge this
was going to be. I was far too deep into it to ttrrn around so the only tiling to do was to push forward because it is
'vhat I would have \vanted an author to do for i11e.

I wrote this to be the kind of book tl1at I "votlld have "vanted to read \Vl1en learning to use Po\>verShell Studio. I hope
you enjoy!
Acknowledgements
First and fore1nost, this book is dedicated to my wile, Kathleen, and my children: Haley,
Matthe"v. Aaron, Cassandra and Ca11dice. This book \vould never have been possible
\vithout my wues extraordiJ1ary patience, support and encourage1nent to follow my heart.
She kept me fed. clothed, managed our home, cared for our children, and worked a full-
time job as an Occupational Therapist helping others overco1ne life's challenges. Kathleen
is an a1nazing giving person, dedicated n1other to 011r children, and a loving and caring
wife. I couldn't think of another person that I would rather spe11d the rest of my life with
than n1y best friend.
My children a1e iny life. they are the reason I get up every day. They represent the future
and I kno\v the future \Yill be great 'vith them in it. A parent cannot express i11 words what
they feel for their children because it 111ns so much deeper t11an \vords could ever express.
We all vva11t to leave behind a legacy. and rny children arc 1ny greatest legacy. I could not
be 1nore proud of each one of then1. I thank 111y children for their sacrifice in tin1c a\vay
fro1n gan1es and playing to give Daddy the tin1e he needed to complete tllis book.
I would like to thank n1y father and 111y 1not11er. God rest her soul, for teaching ine the
fo11itude and resilience, and for raising nle -vvith the values of hard \VOrk and the i1nportance
of a strong fan1ily. They are both an inspiration to n1e every day. I \vould also like to thank
my sister Sru1di. she 11as al\vays inspired me to be strong, keep persevering in the hardest tin1es. to love life and be
tn1e to yourself.
I would like to thank t11e SAPIEN tea.in, Ferdinand Rios (CEO). David Corrales (Lead Engineer), and Alexander
Riedel (CTO). All of \Vho1n \Vere insllumental in revie,ving the 1naterial in Ulis book. I 'vould especial1y like to
thaJtk, David Co1TaJes, \Vho always took the ti1ne to a1lS\ver n1y inany questions, and never failed to offer n1e as
1nuch guidance as I needed on tllis quest. Special thanks as \Veil to Alexa11der Riedel, for taking the time when I first
started approaching this book to speak ' vith me on many occasions.
A special thanks to Don Jones. a legend in the Po,verShell conununity ru1d a superb aut11or in his O\Vll right. Don
revie"ved this book and provided his great teclurical insights, he \vas al,vays \villing to put on his author hat and give
ine constructive advice \Vhich \Vas instn1mental in helping get this book out the door! Don Jones is one of the \Vorld's
leading expe11 on the Microsoft business technology platforn1. He's the author of more thai1 45 books ai1d the
President/CEO of Po,verShell.org.
Thanks lo J11ne Blender. who didn' t even kno'v n1e when I first contacted her to ask for her expert opi1rion and
advise for tJlis book. She \vitJ1out hesitation gladly offered to review tl1e book for 1ne. For ai1yone that does not know
Jm1e Blender, she is a Microsoft MVP, a for1ner Senior Programming Writer at Microsoft Corporation \Vhere she
worked on tl1e Po,verShell Tea1n developing the help system and 'vriting the Get-help help topics for Po\verShell
1.0 to 3.0. Her other "vorks incl1tde writing content for t11e Azure Active Directory SDK, Azure Po~erShell Help.
Windo'~'S Driver Kits, Windo\vs Suppo1t Tools, ru1d Windo"vs Resol1rce Kits. Jtme currently 'vorks at SAPIEN as
a technology evangelist ru1d trail1er.
About the Author
Jeff Holder bas over three decades of eA'J)erience as a Senior Level Systems Ad1ninistrator specializing in
Virtualization and Remote System Mai1age111ent. Prior to that, Jeff proudly served in the U.S. Naval service aboard
the U.S.S. Le,;vis and Clark ai1d U.S .S. Pe11nsylvania Submarines, as a Navigation Electronics Technician. Over the
last 30 years, Jeff has achieved a broad range of experience. and filled ma11y roles as an Active Directory Architect,
V111ware Virtualization Specialist, Cisco Unified Communications System SME. PowerShell Script Developer, and
author of five technical and outdoor books.
In his free ti1ne, he enjoys spending time \.Vith his family and the outdoors. As an avid angler. he can regularly be
found in and around the lakes of Southern California, or hiking in the surrounding inountains. Jeff and Kathleen
have been married for 13 wonde1ful years, and have nvo children together, Haley and Matthew.
Contents
GETTING STARTED WITH POWERS HELL STU 010 ............................... 15
1.1 WHATS NEW IN POWERSHELL STUDIO 2017 ..................................... ............ ... ....................~ 16
1. 1. 1 Updated Control Helper Functions................................................................................... 16
1. 1.2 Updated Editor Font and Coloring Settings Dialog ..................................... ................. .. 16
1. 1.3 New Office 2016 Themes ...................... ............................................................................. 17
1. 1.4 Prima/Sense Performance Improvement ......................................................................... 18
1.2 REQUIREMENTS............................................................................................................................... 19
1.3 INSTA LL_ATION ......................................................................... ......................................................... 19
1.4 FIREWALL CONSIDERATIONS ........................................................................................................ 20
1.5 ACTIVATE YOUR LICENSE ..................................................................... ......................................... 21
1.6 DEACTIVATELICENSE .................................................................................................................... 21
1. 7 OPTIONS AND CUSTOMIZATION .................................................................................................. 24
1.7. 1 General Settings.............................................................. ........ ........ ..... .................... .... ....... 24
1.7.2 Backup Settings ..... ............................................................................... .. .. ........................ ... 26
1.7.3 Console Settings.... ......................... ........ ................................. ............. ............................... 27
1.7.4 Debugger Settings .............................................................................................................. 28
1.7.5 Designer Settings................................................................................................. ............. ... 29
1.7.6 Ed it or Settings .......................................................................... ............................................ 32
1.7.7 Assemblies Settings ............... ............................................................... ................. .............. 40
1.7.8 Formatting Settings ................................ .... ......................................................................... 40
1.7.9 Panel Settings ...................................................................................................................... 48
1.7. 10 PowerShell Settings ........................................................................................................... 49
1.7. 1 l Source Control Settings ....... .... ......................................................................................... 50

BASIC ORIENTATION ...................................................................55


2.1 DOCUMENT EXPLORER ................................................................................................................. 55
2.2 RIBBON BAR AND TABS .................................................................................................................. 57
2.2.1 Home Tab ........ ....................................... ........ ..................... .... .... ........ ................. ............... 57
2.2.2 Designer Tab ........................................................................................................................ 68
2.2.3 DEPLOY TAB ......................................................................................................................... 79
2.2.4 Tools Tab ................ ................................. ................ ......... ........ ........ ..................... ............... 92
2.2.5 Source Control Tab .......................................................................... ................................... 99
2.2.6 Help Tab ................. ................................................................. .............. ............................. 103
2.2.7 View Tab ................ .................... ............. .... .... ............................ .......... ... .......................... 104
2.3 PANES ............................................................................................................................................ 107
2.3. l Call Stack Pane .................. ............................................................................................... 107
2.3.2 Console Pane .................................................................................................................... 107
2.3.3 Debug Pane ........................................................................................................................ 107
2.3.4 Debug Console Pane .................................... ........ ......................................... .................. 108
2.3.5 Find Results Pane .................................... .... ..................... ......... .... ...................................... 110
2.3.6 Function Explorer Pane ....................... ........ ..... ......... ,. .. .............................. ....................... 111
2.3.7 Help Pane ........................................................................................................................... 112
2.3.8 Object Browser Pane .................................. ...................................................................... 114
2.3.9 Output Pane .................................................................................. ............ .... ............. ....... 115
2.3. 10 Performance Pane .... ................. ..................................................................................... 116
2.3. 11 Project Pane ....................................... ................................. ..................... ....................... 117
2.3.12 Property Pane .................................................................................................................. 119
2.3.13 Snippets Pane ................................................................................................................. 12 1
2.3. 14 Toolbox Pane ......... . ...................................................................... ........ ..... ....................... 12 5

FORM DESIGN AND PROJECTS .......................................................... 137


INTRODUCTION TO FORMS ................................................................................ .......................... 137

FORM TEMPL.A TES ........................ ............ ..................................................................................... 138


Form Border Styles ....................................... .............................................. ........................ 139
Empty Form ................................................... ........ ............ ............ .. ....... ............................ 141
Dialog Style Form ............................................................................................................... 142
Explorer Style Form ............................................................................................................ 143
Full Grid Search Template ........................... ............................................ ......................... 144
Grid Job Template ................................................... ........................................................ . 145
Grid Search Template ............................................. .......................................................... 146
Grid Template .................................................................................................................... 147
Menu Template ................................................................................................................. 148
Tab Control Template ..................................................................................................... 149
Text Box Template .... ......................... ............ ..... .................... .... ......... ............................ 150
Text Box with Search Template ...................................................................................... 151
Wizard Template ........................................ .... ............................. ............. ....................... 152

Accessibility ........................................................................................................................ 153


Appearance .................................................................................. ..................................... . 153
Behavior ............................................................................................................................ . 155
Data ..................................................................................................................................... 155
Design .................................................... .................... .......................................................... 156
Focus ................................................................................................................................... 156
Layout ............... ............ .... .................................................................................................. 156
Misc ................................................................ ............ ........ ................. ......... ....................... 159

FOR.M PROJECTS .................................................................... ....................................................... 165


Multi-Form Projects ............................................................................................................ 166
Scope Variables ................................................................................................................ 170
Collection Project .............................................................................................................. 171
Module Projects ........................ .................... ..................................................................... 172
FORM CONTROLS .............................................................................. 179
4. 1 BUTION CONTROL ..... ........ .. .......... ................... ............ ........... ..................... ............ .......... ......... 179
4. I. I Button Events ............................................................................................................ ......... 180
4. 1.2 Button Manipulation ......................................................................................................... 182
4.2 C HART CONTROL ........................................................................................................................ 185
4.2. 1 Chari .E xample .................................................................................................................. 185
4.3 C HECKBOX CONTROL ............. .. .................. ................... .......................................................... .. 191
4.3.. 1 CheckBox Example ..... ........ .... ....... ........ .. ................................ .......................... ........... ... 192
4.4 CHECKEDLISTBOX CONTROL ..................................................................................................... 194
4.4. I CheckedListBox Example ... ......... ............ .... .................................................. .................. 194
4.5 COLORDIA LOG CONTROL......................................................................................................... 200
4.5. I ColorDialog Example ....................................................................................................... 200
4.6 COMBOBOX CONTROL.............. .. .................................. ..................... ................... ................ .... 20 1
4.6. I ComboBox Example ............................ ............................................................................ 20 I
4.7 CONTEXTMENUSTRIP CONTROL ...... ....................................................... .................................... 203
4.7.1 ShowCheckM argin and Showlm a geMargin .............. ..... .. ............... ................ ............. 204
4.7.2 ContextMenuStrip Example ............................................................................................. 205
4.7.3 Important Events ................................................................................................. .............. 206
4.7.4 Important Methods .. .. .. ..... .... .. .. ... ... .......... .. .. ... ............. .. .... ... .. .. ... ...... .... .... ... .. .... ........... .. 208
4.8 DATA GRID AND DA TAGRIDVIEW CONTROLS ....................... ..................... .......................... .... 209
4.8. 1 Dynamic Populated Example ............................................ ............................................. 210
4.8.2 Manually Populated Example ......................................................................................... 214
4.8.3 Important Methods............ .... .... ............................................ .......................................... . 215
4.9 DATETIMEPICKER CONTROL .................................... ............ ....................................................... 215
4.9. 1 DateTimePicker Example .......................................... ........................................... .......... .. 216
4. 9.2 Add Date Time Picker to DataGridView .......................................................................... 2 17
5.0 DOMA INUPDOWN CONTROL ... ... ............. .. ................... ........ ............ ................. .... ................. .. 217
5. 1 ERRORPROVIDER CONTROL ...................................................................................................... 218
5. I. I ErrorProvider Properlies .................................................................................................... 218
5. 1.2 Important Methods........................ ................................................................................... 219
5.1.3 Example Use .. ..................... ............................................................................................... 222
5.2 FILESYSTEM WATC HER CONTROL................................................ .... .............. .............................. 224
5.3 FLOWLA YOUTPANEL CONTROL...... .... ........ ................................................. .............................. 227
5.4 FOLDERBROWSERMODERNDIA LOG ......................................................................................... 228
5.5 FONTDIALOG CONTROL............................................................. ................................................ 229
5.5.1 Font Dialog Exa mple ......................................................................................................... 229
5.6 GROUPBOX CONTROL ......................... ........ ................... ............................................... ............. 230
5. 7 HE LPPROVIDER CONTROL ........................ ............ ................... ............ ................ .................... 231
5.8 IMAGELIST CONTROL ...................................................... ............................................................ 232
5.8. 1 Comparing Image Bit-Depth .......................................................................................... 233
5. 9 LA BEL CONTROL ................ ............ .................... ........... .............. .... ................ .. .......... ... .............. 234
6.0 LI NKLABEL CONTRO L................................................................................................................... 235
6. 1 LIST BOX CONTROL .................... ....................................... ............................................................ 236
6. 1.2 ListBox Control Example .. .. ...... ... .... .... .... ... ... .... .. .... .... .. .. ..... ....... .. ...... ... .... .... .. .. ..... .... .... ... 237
6.2 LISTVIEW CONTROL ......................................................................................................................238
6 ..2. 1 Important Properties ... ... ... .... .... .... .... ..... .... .. ... .. .. ... ...................... ... .... ............. ...... ... ... ..... 238
6.2.2 Important Methods ..... ................................. .................... ............ ........ ............................. 248
6.2.3 Important Events .......................... ................ ..................................................................... 249
6.3 MASKEDTEXTBOX CONTROL ...... ........................................... ............ ............................... ........... 252
6.3.1 Important Properties ......................................................................................................... 252
6.3.3 Important Methods ...................... ..................................................................................... 255
6.3.3 lmporfant Events ..... ............ .... .... .. .. ... .... .... .. ....... ... .. ... ... .. ....... .... .. ....... ... .. ....... .. .... .... .. ..... 256
6.4 MENUSTRIP CONTROL ..................... ....................................... ...................................................... 257
6.4.1 Add Icon to Menu Item .................................................................................................... 259
6.4.2 Adding Standard Menu Items .................... ........ .... ..................... ........ .... ......... .... ........... 260
6.5 MONTHCALENDAR CONTROL .................................................................................................... 260
6.6 NOTIFYICON CONTROL .................... ................... .................. ...................................... .. .............. 262
6.6. 1 Important Properties ... ................. .. ............ .. .......... ........ ......... ... .. ............................. .... .... 262
6.6.2 Important Events .......................................... ................. .................................................... 263
6.6.3 Important Methods ........................................................................................................... 264
6.7 NUMERICUPDOWN CONTROL .................................................................................................... 266
6.7.1 Important Properties ......................................................................................................... 266
6.7.2 lmport ant Event ...................... ....... .. ........... .. ..... .. ........... ....... ..... ........ ... ... .............. ........... 267
6.8 OPENFILEDIALOG CONTROL ...................................................................................................... 267
6.8. 1 OpenFileDialog Example......... .... ..................................................................................... 267
6.9 PANEL CONTROL .......... ........................................ ...................................... .................... .............. 269
7.0 PICTUREBOX CONTROL ...............................................................................................................270
7.1 PROGRESSBAR AND PROGRESSBAROVERLA Y ......................................................................... 271
7. 1. 1 Important Properties ... ... .. .. ...... ..... ... ...... .... .. .. .... .... .... ........ .. ...... .. ... ..... ... ... ..... .. ..... ...... ..... 271
7. 1.2 Important Methods ........................................................................................................... 272
7.2 PROPERTYGRID CONTROL ... ............. .. ............... .. ............... .. ........ ........ ....... ..... ............. .. .... ....... 273
7.3 RADIOBUTION CONTROL ............... ....................................... ...................................................... 275
7.3.1 Important Properties ... .... ........ .... ...................................................................................... 27 5
7.3.2 Important Events ........................................................................... .................................... 27 5
7.4 RICHTEXTBOX CONTROL.................................................... .......................................................... 276
7.5 SA VEFILEDIALOG CONTRO L ................................................. ...................................................... 277
7.6 SPLITCONTAINER CONTROL .................................................. ...................................................... 278
7. 7 SPLITIER CONTROL ....................................................................................................................... 280
7.8 STATUSBARCONTROL .................................................................................................................. 281
7. 9 STATUSSTR IP CONTROL .......................................................... ...................................................... 282
7.9.1 Important Properties ......................................................................................................... 283
7.9. 2 lmportant Events ............................................................................................................... 284
8.0 TABCONTROL CONTROL ............................. .......................... ...................................................... 284
8.0. 1 Important Events ...................... .................................................................................. ....... 285
8.1 TABLELA YOUTPANEL CONTROL ..... ....................................... ...................................................... 286
8.2 TEXTBOX CONTROL ......................................................................................................................288
8.3 TIMER CONTROL ...........................................................................................................................289
8.3. 1 Important Events .................................... ................ ......... .... ........ .... ...................... ............ 289
8.3.2 Timer Example 1 ................................................................................................................ 291
8.3.3 Timer Example 2 ......... .. ... ........ .. .. .. ......... ... ... .... .................... .. ... .. .. ............. ...... .... ... .... .... .. 291
8.4 TOOLBAR CONTROL ........................................................ ........................ ...................................". 292
8.5 TOOLSTRIP CONTROL .................................................................................... .............................. 293
8.6 TOOLTIP CONTROL ............... ............................... ........................ ................................................ 294
8. 7 TRACKBAR CONTROL ................................................................................................................. . 29 5
8.8 TREEVIEW CONTROL .................................................................................................................... 30 l
8.9 VSCROLLBA R CONTROL ................................................. ............ ................................................ 302
9 .0 WEBBROWSER CONTROL......... ................................................................................................... 303
9.0. 1 Example ............................................................................................................................. 303

EXAMPLE PROJECTS .......................................................................... 307


IP RANGE SCANNER ........... ................................................................. ............................................... . 307
DISPLAY AND KILL RUNN ING PROCESSES REMOTELY 315
FILESHARE ANALYZER .............................................................. ............ ................................................ 317

REFERENCE GUIDE ............................................................................. 327


EXPORTING CACHE FROM REMOTE MACHINE ........................................................................... .... 327
IMPORTING REMOTE CACHE FILE ...................................................................................................... 329
REMOTE SCRIPT EXECUTION ENGINE (RSEE) .............................................. ....................................... 331
SINGLE THREADED APARTMENT (STA) ............................................................................................... 336
PSSCRIPTANALYZER ............................................................................................................................. 337
SCRIPTPA TH IN HOST ............................................................... ............................................................ 337
CONVERTING HEX# COLOR NUMBERS ......................................... ................................................... 338
REQU IRE ADM INISTRATOR .................................................................................................................. 338
CONTROL PROPERTIES ............................................................ ............................................................ 339
BUTTON ........................................... .... ........................................................................................... 339
CHART ........................................................................................................................................... 343
CHECKBOX ................................................................................................................................... 347
CHECKEDLISTBOX ......................................................................................................................... 352
COLORDIALOG ................................................. .................................... ....................................... 356
COMBOBOX ................................................................................................................................. 357
CONTEXTMENUSTRIP .................................................................................................................... 363
DATAGRID AND DATAGRID VIEW................................................................................................ 368
DATETIMEPICKER .... ....................................................................................................................... 374
DOMAINUPDOWN ....................................................................................................................... 378
ERRORPROVIDER ....................................... ........................ ........................................................... 383
FILESYSTEMWATCHER ....... ................................. ........................................................................... 384
FLOWLA YOUTPANEL .......................................... ........ ........ .... .......................... ............................. 384
FOLDERBROWSERMODERNDIALOG ................................................ ........................................... 389
FONTDIALOG ..... ................................ ........................................................................................... 389
GROUPBOX ........................................................ ................................. .... ...................................... 390
HELPPROVIDER 395
/MAGEL/ST ....... .............................................................. ................................................................. 395
LABEL ....... ........................................................... ...................................................... ........................ 396
LINKL.ABEL ...................................................................................................................................... 401
LISTBOX......................... . ........... 405
LISTVIEW ............................................................................................. ............................................ 4 11
MASKEDTEXTBOX........................................................................................................................... 417
MENUSTRIP .................. ................................................................................................................... 42 2
M 0 NTHCA LENDAR ...... .................... ........... .. ............... ................ ................... .. ............ ................ 42 7
NOTIFY/CON .................................................................................................................................. 432
NUMERICUPDOWN .......................................................................................................................432
OPENFILEDIALOG ................................... .......................... ............................................................. 437
PANEL ............................................................................................................................................. 438
PICTUREBOX ............................................................................................. ..................................... 443
PROGRESSBAR AND PROGRESSBAROVERLA Y...................................... ............. . ................... .... 44 8
PROPERTYGRID .... ..... . ........................ . .... .......... ............ ....... .... ...... ........................ ......... .... ............ 452
RADIOBUTTON ............................................................................................................................... 457
RICHTEXTBOX .......................................................................................................... ........... ............. 462
SA VEDDIALOG ............................ .................................................................................................. 469
SPLITCONTAINER ................................................................................................... ........................ 470
SPLITTER .......... ............................................................................................ .... ........ ........................ 476
STATUSBAR ............................................ ........ .................................................................................... 48 1
STATUSSTRIP .. ....... ........................................................................................................................... 488
TABCONTROL .............. . ....... 494
TABLELA YOUTPANEL .................................................................................................................... . 498
TEXTBO X ........................................................................................................................................ .503
TIMER ............................................................................................................................................. . 510
TOOLBAR ......................................... . 511
TOOLSTRIP ....... ....................................................................................................... . ....................... 519
TOOLTIP ................................................. ............ ............................. .... .................... ..........."........... .524
TRACKBAR 525
TREEVIEW ...................................................................... ......................................... .... .................... 530
VSC ROLLBAR .. ...................................... ................................................................. . 536
WEBB ROWSER ................................................................................................................................540

IND EX ....................................................................................... 54 7
Chapter 1

POWERSHELL SrUJDIO

Bu'lt for Coders by Co ersl


PowerShell Studio - Introducing PowerShell Studio I 15

GETTING STARTED WITH POWERSHELL STUDIO

Po,verShell Studio is a product of SAPIEN Technologies, Inc.. and is one of tlle most premier Integrated
De elopment Environments (IDE) designed for Windo,vs Po"verShell scripting. It combines the po,ver of a fully-
featured Windo,vs Po,verSlleU editor \.vilh a robust fean1re-rich GUI Designer, and U1e u1ost po,verful Sc1ipl
Debugger available today.
Fe\v \Vit:hin the Po,verShell co1mnunity have not heard the naines Don Jones. Jeff Hicks, Jason Helrnick, all of,vhich
\>Vere fom1er SAPIEN ernployees. David Corrales is currenUy the Lead Developer for SAPIEN a11d June Blender is
currently a SAPIEN technical trainer ai1d "''rote the original Po,verSbell help files \Vb.en she \vorked on the Windo,vs
PowerShell team. All legends with the PowerShell Comnu1nity, and they have all \Yorked to make Po"erShell
Studio what it is today. an amazing Integrated Development Environment. b1Ult by scripters fo r scripters!
That \.Vas almost l 1 years ago, and since that tin1e Po,verShell has contir1ued to evolve and gro\v into \.\bat today is
one of t11e most po,verful scripting languages used by System Adnunistrators. On August 20 16, Microsoft
announced that Po,verShell had gone open-source ai1d cross-platfonn \ith support for Windo\VS. OS X, CentOS.
and Ublffitu. It wasn't long after the source code for PowerShell 'vas published on GitHub, that PowerShell Core
was born \hich nms 011 .NET Core and " 'ill start shlppit1g \Vith 1Windows Seiver 2016 Nru10 Server.
Windo\vs Po,verShell has quickly over the years become the de-facto scripting language for Windo\VS system
inanagement among ad1ninistrators \vorld-\vide. Today, Po,verShell has become a must-kno,_.,. skillset. and is one of
the first skills that an employer looks for"\\hen filling any IT System Ad1ninistration position.
System Ad1ninistrators have been creating Po,verShell scripts for years and they proved to be very efficient, Yery
reliable, and provided consistent results. The only do";nside " as that many of the scripts were complex,, and \Vithout
scripting kno,vledge it \Vas difficult for other employees to use them. including IT Helpdesks.
Thankfully \Vith PowerShell St11dio, very po,:verful complex Po,verShell scripts can no\v be integrated \Vithin a user-
friendly GUI application that requires Little if any scripting kno,vJedge to use.
You can do,vnload a fully functional. 45-day free tiial by visiting SAPIEN Po,verShell Studio hon1e page. Current
licensed cost is $389 wiU1 co1rununity suppo11, an addjtional $99 gets you Premium Support (Direct tech11ical
support frorn SAPIEN 'viU1 a guaranteed response tin1e of 24 hours).

Whenever you see this icon in the book it means that SAPIEN has created a Spotlight article on their
0-.. \vebsite for the topic. look in the footnotes for reference to the page.

Upon activation of Po"1erSheJl Studio, you 'vill also receive access to lhe free con1pJin1ental)1 Productivity Pack
\vllich includes:
PowerRegEx: Po,..verRegEx allo,vs you lo export your expression for Po,~erShell use.
Po,verSbell HeJp: Get help for Po,verShell U1e \Vay it \Vas meant to be.
Po\l erShcU Profile Editor: is a dedicated tool for J.lllU1aging and editing PowerShell profiles.
1

PrimaJPad: single file, color coding editor for VB Script, Jscript, HTML. C++. C#, SQL and Po,verShell .

1 https://en.wikipedia.org/wiki/Windows_Server_2016# Nano_Server
16 I PowerShell Studio - A Comprehensive Guide

1.1 WHATS NEW IN POWERSHELL STUDIO 2017

In the process of vvriting this book, SAPIEN released PowerShell Studio 2017, so I feel it is in1portant to point out
the nevv changes to you. SAPIEN doesn't wait to release major updates only once a year, instead they release the1n
as they are ready \Vhich gives you the ability to receive improvements and new feah1res withot1t having to wait
long pe1iods or purchase the latest major version release.

1.1. 1 Updated Control Helper Functions


One of the most i1nportant changes that needs to be pointed out is that in the 20 17 version SAPIEN has changed
the verb of the control helper functions.
2017 ver. 5.4.134 - Control Helper Functions now start with " Update" i.e. Update-DataGridView
2016 version and earlier - Control Helper Functions started with "Load", i.e. Load-DataGridView
The reason for this change was to co1nply with PSScriptAnalyzer's best practice, which has always stated that
Load is an unapproved verb.

1.1.2 Updated Editor Font and Coloring Settings Dialog


Editor Font and Color Settings X A language selection \Vas added to the Editor Font and Coloring
Presets: fuavea Settings) I Save As Preset.. J Settings dialog. The dialog novv distinguishes the syntax coloring
Font (bold type indicates fixed-w1chh fonts): Size:
for a plain text file fro1n a PowerShell file.
IConsolas , ( 10 TI
Edtor badqound: lnckator margn 1>6dcgound:
CJ Wh~ =tJ CJ 240, 240, 2.;o _E]
Modfied ine saved color: Oxrent li'le indicator color:
._g 108, 226, 108 I I CJ S4ver =tJ
Mo<ified line l.l1Saved color: Cobm gulcle color:
[CJ iss, 238, 98 =8 - Daridllue I I
L~: Pooeishel I
~y
r----------------1
items, Powershel
A5as '""'""
Plan~~=
~ ~==~r--rnz;-v.-v---~~
I_- ...,.-,- I
Code SnJlpet Field
Corrrnand Item badqound:
Command Argunent
Command As Paraml!ter
!CJ ----1-
I
Corrment
Oredrve [,a Bold C:::. I taK .] lk1derfne
External Tool
Ft.nctJon San"C)le:
l~tedReference

-~
-oop-Label
_ _ _ _ _.,, L
~-------

AaBbCcXxVyZz J
0( I ~ J
figure 1 - Font and Color Settings
PowerShell Studio - Introducing PowerShell Studio 17

1.1.3 New Office 2016 Themes


..

-- - -- - -
JI

..... ....

... _
____________ ...................

-- .. - ..... .. ... :.:::

-
... --
-------- .
I> -
~
.._
'ii
n - o -
-- ---... ~ ,. -
~-
,
Cl-

, "' "-
-
o-
-

.,_
.. ..
t
:)

. . ._....... --
.... ......
0--

... ...-.. ................. --- -


J ... ... ,...._
a ..,.
__ ..,_Ile....... .....
~._.,_..

--
-.
--
........

.........
WI b :ez a
-"""'
--C
......
--
.....
......... --_
-
~

..........
..................
-~
..._.._. .
- ....
............
~,_
._.
,. ,J_.__,
.,,,._...
'
.,,...
.,.~
- ..
''==
..,,,,...,
,,,_...._
..... --
..,.,,.........
.,.~

,,,,
.........
.....,:

., ____
,_...a..
,,,._
.,......
';.~~=~.~l"!;;':::::'.5 " - -
. ~ ....... ,........... ~
- ... ...... - .-.
Figure 2 - Office 2016 Colorful

. .. ' . ..--~-"1111 -----


.. - - - - -
I> ..
-

- - r-

-- ,,_ _
_.._.
_
_ __ -
................................... .__ ,
--~..,_.~~ .......

--
..,,.,.......
...
..,,._.,_
~

..
,......................
.,....
.,.~

"':::::
,.,,
.r......
T

Figure 3 - Office 2016 Dark


18 I PowerShell Studio - A Comprehensive Guide

1.1.4 PrimalSense Performance Improvement

Pri1na1Sense response time vvith this release has been improved. You may notice the improvement \Vhen triggering
PrilnalSense for .NET Types or when using general code completion.

fAbandonedMutexExc,pt1on
~ AccessedlhroughProp,rtyAttribut'
4$ Accessibl'bjttt
AccessRul'
AccessRu1,1
AccessViolationE.xc,ption
.. Ac,Enumerator
C...... Action
C Action 1
-
::; Action 10

Figure 4 - Code Completion


PowerShell Studio - Introducing PowerShell Studio I 19

1.2 REQUIREMENTS

As with every software there are minilnum reco1nmended requirements for installing PowerShell Studio:

Windovvs Server 2008 R2 I Windows Server 2012 I Windows Server 2012 R2 or Windows 7 I Windows 8
I Windows 8.1 I Windovvs 10, 32-bit ai1d 64-bit versions are supported.
200MB free disk space
2GBRAM
Processor capable of running Windows 7
.NET Fra1nework 4.5
Visual Studio 2012 Runtime

These are the niinimum requirement recommendations, ho111ever siniply having the mininium does not niean
PowerShell Studio, or any soff:l11are for that niatter, will operate at its peak performance. I recommend a
niinimum ofat least J6GB ofRAM to prevent issues ltllith application freezing and out ofn2en2ory errors.

1.3 INSTALLATION

There are three types of installation:

TYJ>ical
Reco1mnended for most users, it vvill install PowerShell Studio 2016, the component library, ScriptMerge
2016, the MS Chart Controls, the SAPIEN Docu1nent Explorer, and both the 32- and 64-bit versions of
Visual C++.
Custom
Tllis option alJows you to select whlch features to install. This option is recommended only for advanced
users since portions of Po,verShell Studio n1ay not be available if you do not select the appropriate
components at thls point.
Complete
Tllis option \Vill install all components, na1nely, PowerShell Studio 2016, the co1nponent library,
ScriptMerge 2016, the MS Chart Controls, the SAPIEN Document Explorer, and both the 32- and 64-bit
versions of Visual C++.

There have been instances 111here Jv!cAfee Anti-Virus produces a false positive for Trojan detection
specifzcallywith the.files (Win32.exe). These files can safely be excluded, and SAPIEN typically reports
these false positives to McAfee for updating their scanning engine and DAT files.
20 I PowerShell Studio - A Comprehensive Guide

1.4 FIREWALL CONSIDERATIONS

PowerShell Studio can install a small service to support the Re1note Script Execution Engine. This can result in a
fire"vall ,;vanling as the service atte1npts to open the port it listens on. The ports are configurable in the options under
debugger.

PowerShell Studio occasionally atte1npts to access a text file located on the sapien.co1n web site. Tllis text file
contains the version nu1nber of the current version of PowerShell Studio; your firewall software 1nay wan1 you when
Po,;verShell Studio attempts to read this file for the first time. PowerShell Studio does not trans1nit any personally-
identifiable information when 1naking tllis check-its sole purpose is to notify you when updates are available.

Many people have asked me how ca11 they add tllis type of update checking into their own GUI application, this is
ho"v:

First, create an index.ht1nl file within a folder on your website. Inside the Index.htinl enter only your latest version
nu1nber for your application (ex. 2.2.1), or whatever specific wording you want to check for.

1 Try
2 {
3 # Reference the folder location of the index.html file on your webserver.
4 $URL= http://www.poshcamp.com/update/
5 # Here we issue a request to check the URL and read the content in the
index.html file.
6 $data= lnvoke-WebRequest -Uri $URL
7
8 If ($data -notmatch "2.2. 1")
9 {
10 # If the version number online does not match 2.2.1 then we can either
issue a Notifylcon, set a picture visible about update available, or any other process you would
like to execute here.
11 $update_pic.Visible =$tru e
12 }
13 else
14 {
15 # If the versions are the same then we do nothing, in this case I am
simply making sure my update picture is not visible.
16 $update_pic.Visible =$false
17 }
18 }
19 catch
20 {
21 # If the website is unavailable or there is not internet connection we can do
nothing or you can execute any process that you like here.
22 $update_pic.Visible = $false
23 }
PowerShell Studio - Introducing PowerShell Studio I 21

PovverShell Studio also accesses the Web to display its product registration page (after initial installation), and to
display Web pages "vhen you click on links in the Info Browser.

1.5 ACTIVATE YOUR LICENSE


I. Enter your SAPIEN ID.
2. Enter your pass\.vord.
3. Enter your License No., this is the same nu1nber as your subscriptio11 nUinber.
4. Click " Activate"

Eacl1 license allows nvo activations, this is great especially if you do a lot of work from home as "vell, because it
will allow you to have PowerShell Studio on both your 'vork co1nputer and ho111e computer.

You 1'11ill not need to enter the SAPIEN ID or PasStt1ord ifyou are doing an offline activation.

Offline Activation - If you are unable to activation your licensed copy of PowerShell Studio online, possibly due
to network restrictions, you can request an offline activation k~ey. Log in to your account on SAPIEN' s \Vebsite, go
to "My Account/Registered Products", on the right side of the page look for the link "Click to request an offline
key". You will need to fill out a standard contact form, along with an explanation of why you need to activate
offline.

M any governnient restrictions do not allow online application registering/licensing and require ofjline keys. The
process is very si'tnple, contact SAPIEN to request an of/line key, they norrnally resp onded liVithin nzinutes l11ith an
email and an offline activation key will show up l11ithin your Registered Software Subscriptions page. We could only
wish that M icrosoft 's Ojjline Activation could be so sin1ple.

1.6 DEACTIVATE LICENSE

Ok, you 're thinking "Why would you ever \ant to deactivate your license?" One such t:ilne 1night be if you've
gotten a ne"v co1nputer and you want to install your copy of Po"verShell Sn1dio. You would first need to deactivate
your license to do this.

REAL-WORLD SCENARIOS

1. Your company purchased several licenses and employees created th eir Ol-Vn accounts on SAPIEN and
activated licenses untler those accounts, but one or more of those team members are no longer vith the
company, can you reuse those activations? Yes, it is possible, you should send the license infonuation to
sales@.sapien.com and eA']Jlain your issue, they 'vill discuss yotu options witl1 you.
2. You had PolverShell Studio installed on your computer but the hard drive crashed anti you ctmnot deactivate
it? Contact support at SAPIEN, they will be able to reset one of your activations for you.
22 I PowerShell Studio - A Comprehensive Guide

How to deactivate license lvithin PowerShell Studio:

1. Click on the License information in the top right of the Po,verShell Studio application.

Start Page SAPIEN ~ S1'1do 2!l 16 ("86) 0 x


D<ploy Tool$ Seu~ Cona-ol ...
- 0
G o..dcl'~b!< A+ kE>por!S

MrSAf@ A. mvt ... ,emtfQru;i;

Product 5<.wort
Ill iSJ Project Cl q x li S~t DaQe X
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
G"'""""' Cl q x
[ t)r.l
Ir p
~
Enter ~t to sear<ll
, [iii l <OITl'IY
b) Globols.psl
PowerShell
SAPI EN

2016
Bl
Bl
Morl'orm.psf
~.psf
fil Stor!IC>.pss
aa~~IJ
STU DION

Recently Opened News Feed

Bl M alnForm.esf
.,,,.-... SAPIEN Savings For Military Personnel
Bi
&l
MainForm.psf
MalnForm.psf
-
11/13/2016
ii
iii

SAPIEN Information Center-Articles vou may
have missed
G
y l'I_,_
(ii Snit>Oe!S

Cl x

Bl test.psf Happy Halloween from SAPIEN fill S'toro.p.pss


SAPIEN Script Pac!Giger updates and new
Bl ii features. Wjll"- l

-
MainForm.psf 11/2/2016
Ent,., ll!Xt :o stard .. p
t1J About Tqxs Bl M alnForro.psf 4/12/2016 ii Are you SAPIEN MVP material? Aeply here!
v Mlsc
lrdJde
.e i'l
I
Core Cmde!S MainForm.psl 11/13/2016
.r;-.... Bl Fade In Form.pH ii
Are you headed to Microsoft Ignite 2016?
Mv SAPIEN license Is expiring. No, it's not!
'"--.nc!ExteF-
File Pa~ F:\SAPtEN',.,oae: Shel St
' r; Appx Bl Oemo-FolderTreeView.psf Nim! StarluP."'
> (; Si!STr.,,.r.r ~Keyboard Shortcuts in PowerShell Studio Refe-~Nam
r. OmCmde!S Bl M alnForm.psf
r; Oore<tAcce<.aen~.
r; ""' Enable WMI Explorer Remote Connection

' r.
Permissions
DmOlont
September Online Savings
r. Even tTr~t
r. llSAOmonm
' r.; International View all articles related to this product

- - 1- i - - - + 19 LAVCU!S ... to t..avcut >. READ O\'R CM' NUM I

figure 5 - PowerShell Studio Welcome Screen

license information x
If you have ao.rrent s.bsaipbon rurber, Qlellse entl!r or paste yru riformationll the lieldsbelow.
SAPIB'l ID: Cr~ale ocr:IU!t..

Password:

tntlSeno:

Nole: SAP!!;N ID Olld 1>4S$W01d are not re<>ed when en~ .., offtrie .node key.

Yru anent subscription is valid tlTouli>: 8/"1D 17 Renew Now

Deactivating yru !leer= Y4 revert lhs prorurt to an e-ed tnaj vemon.


You no.ost be comected to the i'tternet to regal! an acl>vabon for another computer.

![ De~alekense ]

Figure 6 - Deactivate License

2. Within the License Information box, click on "Deactivate License".

Prior to version 5.3. 131 you could click on the "About" icon in the top right of the Po'\overShell Studio '\-Vindow.
PowerShel l Stud io - Introducing PowerShell Studio I 23
The "deactivate license " button and "copy info ,, button 111ere removed 1iVith the release ofversion 5.3. 131

1. Select your PowerShell Studio license fro1n the list of SAPIEN products. All SAJPIEN products that are
currently installed \vill be listed so be sure that you select the PowerShell Studio installation.

About SAPIEN PowerSh1>ll Sturlin 2016 x


S1\J>l I N



PowerShell
STUDIO..
2016
SAPIEN PowerShel Studio 2016 1hs product is licensed
Version 5. 2.129 Jeff
Copyright 2010-2016

---- ---
Select License
SAPIEN Tec:Mologies, Inc.
__ ... -
PowerSheJ Stuc:&o 2016 I _t: v- - Copy Info
ProductMty Pack 2016
SAPfEN Sofuvare Slite 2016 Trial Expred

\11/amuig: This computer program rs protected by copyright law and intemabonal treaties.
Unauthorized reproduction or distnbution of this program, or any porbon of 1t, may result in severe
dVi and 0'1mll'lal penalbes, and wil be proseruted to the
maxirrum extent possible under the law.

PowerShel Studio uses a subset of the \VIX Toolset to create MSI insta!er databases. The
complete \VIX Toolset rs open source and can be dov-.'nloaded from http://V\'ixtoolset.org.

,,- - - - - - L J
I
Deactivate LJCense OK
'

Figure 7 - Deactivate License

2. Click " Deactivate License". Now you are free to install and activate SAPIEN PowerShell Studio on
another co1nputer using your original license information.

"That was easy.'"


24 I PowerShell Studio - A Comprehensive Guide

1.7 OPTIONS AND CUSTOMIZATION


SAPIEN certainly tl1ought about flexibility \vhen they were designing their options for PowerShell Studio. In this
section, \Ve vvill go over the various options that are available and what they do.

1.7 .1 General Settings


- Settings
Show start page on startup ~ Enable remote file stab.JS check

l Restore open fies on startup ~ Show exported fies n Windows Explorer

Console
r Alow nU~ instances ~ Show the doa.ment selector when navigall"lg tabs

~ Enable deferred file loading Defa!At fie type: I ~ PowerShel Sa1>t v

I1 l Save Al Settings.. ~ Save Editor Settin9s [ Load Settings... _J


User Infurmabon
Username: Jeff I
Orgarizabon: I I
I Assembties
Olrectones

~~
Defa!At Fies Directory: C:';.Jsers\Jeff'4)ocunents\SAPIEN'PowerShel Stuclio\"ies I Q
Deraut Project Directory: C: VJsers \Jeff'4)ocunents\SAPiB"'fowerShel StudioV>ro.iects
I
Template Directory: C:VJsers\)eff\App()ata~oasmg\SAPiB"'fowerShel Stuclio 201J .J
I

I PowerShel Project Settings


Deraut acbon fur copy ll'f'C)Ol't fie to project:
Sou"ce Control

Figure 8 - General Settings

Sholv start page on startup


Enables or disables the start page.
Restore open files on startup
Reopens the files that were open \Vhen PowerShell Studio was last shut down.
Allow multiple instances
Allows for 1nore than one copy of PowerShell Studio n1mling at once.
Enable deferred file loading
Loads files on demand. Deferred loading ilnproves overall perfonnance when loading large groups of
files while reducing memory consu1nption and load times.
Enable remote file status check
PowerShell Studio "vill wan1 you if a file has been edited outside of its editor. Checki.J1g remote files can
cause Po\verShell Studio to slow down. This option allows you disable remote file checking if needed.
Sho\v ex1Jorted files in Windo\vs Explorer
After exporting files from PowerShell Studio, launch Windows Explorer focused on the export folder. If
you do not the Windo\tvs Explorer to open auto1natically every time you do a build or deploy, then
uncheck this box.
PowerShell Studio - Introducing PowerShell Studio I 25

Show the document selector 'vhen navigating tabs


When you press [Ctrl + Tab] to cycle behveen documents, the Document Selector appears, if you do not
\Vant this to appear and you wa11t to directly cycle through the document tabs without the selector then
uncheck tlris feature to disable it.
Default file type
Choose what gets created \Vhen you click on the ne\v button ( ) in the ribbon bar.
U sername and Organization
Enter your details here. This infonnation will be used in your templates.
Default Files Directory
Specifies the folders you would like Po\verShell Studio to use to store scripts.
Default Project Directory
Specifies the folders you would like PowerShell Studio to use to store projects.
Template Directory
Specifies the folders you would like PowerShell Studio to use to store templates.
Default action for copy im11ort file to project
When importing an existing file into a project, PowerShell Studio can 1nake a copy of the file and add it
to the pr~j e ct folder or create a link to tl1e original file.

IT Save AD Settings... ]_ _ _ _[ Save Editor Settings J___L_ Load Settings.. . JI


Figure 9 - Application Settings Save Options

Save All Settings - this buttons saves all application settings.


Save Editor Settings - this button will only save editor settings.

It can take a lot of time to get your environrnenf..just the way that you like it, and it would be very
disheartening to have something happen and lose your configuration. The configuration A.ML files are
stored at the locations listed below; it is highly recommended that you keep a copy these files in a safe
place.

%HOivlEPATH%\Documents\SAPIEN\Po,verShell Studio 2016\Files\PowerShellStudio.Settings.XInl


o/oHOMEPATH%\Documents\SAPIEN\Po\verShell Studio 2016\Files\PowerShellStudio .Editor.Settings.xml

Load Settings - this can be used to loading a previously saved settings XML file. *You will need to restart the
application after loading the XML file(s).
26 I PowerShell Studio - A Comprehensive Guide

1.7.2 Backup Settings

I-

Restore Points
v' Create a restore po11t as soon .-s a file is modified.

~ Remove restore po11ts when the appicabon do'..es.

Ver~ecal

U Automabealy submt to VersionReall reposotory "hen a tile tS dosed.

Panels

Figure 10 - Backup Settings

Auto save every [x] minutes


The frequency in minutes that files will be auto-saved. I personally set nrine at 5 ininutes, although inany
will say that is overkill, I have lost data in the past and we all know how that feels.
Create a restore point as soon as a file is modified
Create a restore point when you inodify a file to allow you to easily undo all cha11ges. The automatic
restore point is only created once, at the tiine of first edit (start of a session). This confuses a lot of
people, some might think this ineans that every time you 1nake a chaJ1ge to yotu project or file that it will
automatically create a restore point, however that would be wrong! When you create a pennanent restore
point, it only stores one. This is meant as a quick recovery tool ai1d not as a versioniI1g tool. So. if you
work on your script for a long time and you need to restore it to a point using this method. then it will
restore back to the begi1uling of vour session. You will lose everything you've done since.

Remove restore points when the a1Jplication closes


If you're about to do so1nething in your script that you 1nay want to roll back from, click the Create
button on the Restore Points inenu on the Tools ribbon.

Q
When you close PowerShell Studio, restore points 1'vill be removed.

Automatically submit to VersionRecall repository when a file is closed


VersionRecall is SAPIEN's version control syste1n. Tllis option allows you to save your script to
VersionRecall when it closes. *Thls is a separate SAPIEN application not included inPowerShell Studio.
PowerShel l Stud io - Introducing PowerShell Studio I 27

1.7.3 Console Settings

General Console Style


Font: SIZe:
[ Lucida Console v 8

I Console Bold L I tak


'

AaBbCCXXYyZZ

Ecitllf

Assel'rbM!s

Formattr.g

Panels

PowerShel

Sou'a Control

Figure 11 - Console Settings

Font
Sets yotrr preferred font for the PowerShell console.
Test Color, Size, Bold, Italic
Configures the display properties of the PowerShell console.
Enable enhanced console input line
Creates a separate input box to type, instead of typing directly into the console.

!l!console Cl x

Figure 12 - Switch between 32 and 64 bit PowerShell


28 I PowerShell Studio - A Comprehensive Guide

1. 7.4 Debugger Settings

These settings configure the net\;vork ports that PowerShell Studio uses to connect to a remote installation of the
Remote Scripting Execution Engine. You inust use the same port nu1nbers on any computer that you want to support
t11e re1note execution. When deciding on which ports to use, it is important to consult your network and security
tea1ns, as they will be able to advise you which ports are safe to use and, if required, reconfigure any firewalls. Port
nu1nbers are specified in the registry on a machine that is running the RSEE service.

' General Remote Ports

8adoJp
RSEERe~: '
9988 J:] RSEE S""9:
L 9987 tJ
1

Deb\Jgger Recevrig: 99861:1 Deix.gger Sending: [ iJ ~J


Clsole
- Note: lncOfTlll!j and outgo,ng por1$ are reversed on~ se1V0r Side. The ou19ol)g
Debugget Ill<!"'"''"
port here IS Ill<! -
'9 port on !llde and vice ver~.

E<lt<>r

FocmattJng
....
PrinlllS=e

P~s

PowerShel

S<lurce Centro!
"

Figure 13 - Debugger Settings

The key is HKEY _LOCAL_MACHINE\Software\Policies\SAPIEN. The Value name is InPort (for the inco1ning
port) and OutPort (for the outgoing port). Note that these values are most easily configured by means of a Group
Policy Object (GPO), SAPIEN can provide a template (ADM file) that cai1 be imported into a GPO to configure
RSEE.

The Re1note Script Execution Engine (RSEE) is an enterprise-level remote script execution enviromnent. It
consists of two components: The client, which is built into PowerShell St11dio, and a remote service that must be
deployed to each co1nputer where you will re1notely run scripts. RSEE is capable of deploying a script fron1 within
Po,verShe11 Studio out to remote computers where the script is executed, and bringing the scripts' output and results
back to Po,verShell Studio for your review.

RSEE is a co111plex tool and it interacts closely \-Vith Windows' security subsyste1ns. RSEE is recom1nended for use
only by experienced Windows administrators \-vho fully understand service deploy1nent and management, cross-
co1nputer security and authentication and, in the case of do1nain environments, Group Policy objects and Active
Directory administration. Apart from the guidelines in this manual, SAPIEN Teclmologies cannot assist you \.Yith
security issues caused by improper configuration nor can we assist with Active Directory, Group Policy, or local
coinputer config11ration tasks. See section 1.7 for details on RSEE.
PowerShell Studio - Introducing PowerShell Studio I 29

1.7.5 Designer Settings

General Oesigner Setmgs


Layout Mode: Snaplines v

I BadoJp v ShowGnd Gnd Size: s :


. _ I_ _


Con.sole Control Setttigs
v Sync event names 'Nith control v InsertTOOO comments 11 new events

\21 Sync control names with text 0 Insert end of event comments
Designer .::J Automaticaly insert defatJt events ~Insert control helper fl.rictions

I Editor Export
;2] Embed recovery data 11 exported scripts -iY Enable PowerShel V2 assembly compatibility.
Assembles .
- Formattng
'
Source fies

- PnmalSense j
DefatJt action for SOtXce file loads:

Defa~t acbon for source fie search:


Ask


Panels
-
PowerShel

Source Control

Figure 14 - Designer Settings

Layout Mode
Governs ho"v controls are aligned when added to a fonn.
o SnapLines
Allo\.vs you to precisely align controls. As you move a control around on a form, snap lines will
appear that show how the control aligns with its neighbors.
o Snap to Grid
Aligns controls to a grid overlaid on the fonn. You can increase or decrease the grid size to suit
your needs using the Grid Size.

Default action for missing events


This controls what happens when Po\verShell Studio cannot find the expected event handler code in your
scripts. It protects you fro1n accidental code deletion. There are tlrree options: Ask, Insert or Remove.
o Ask
Displays the nrissing event dialog. You can choose to Insert, Remove, or Ignore tl1e inissing
event from this screen.
30 I PowerShell Studio - A Comprehensive Guide

~1rss ng Event Handler - MyPrevte v.psf


Event~: fonnl_load
[ Inser~
OoJect ~e: ~ 1
Remove
\\'hat do you e to do '"'th the m ssing event>

0 Make s default acbon

Figure 15 - Missing Event Handler

o Insert
Will auton1atically recreate the event handler code.
o Remove
Will delete the event binding from the control properties.
Insert TODO comments in events
When enabled, Po,verShell Studio will add a comment to each event handler reminding you to provide
your code body.
Insert end of event comments
Adds a cormnent at the end of each event handler.
Insert control helper functions
Uncheck this option to prevent PowerShell Studio fro m inserting control helper functions into the script
Sync event names with control
Event handler names are generated using the pattern $<control name>_ <event name>. This option
ensures that when you rename a control its event handlers are also renained.
Sync control names \Vith text
Event handler names are generated using the pattern $<control name>_ <event name>. This option
ensures that when you rename a control its event handlers are also renained.
Automatically Insert Default Event
Many controls have a default event (click for a button, selected index changed for a Con1b0Box). This
option will ensure that the default event is always coru1ected to an event handler when you add a control
to a form.
Embed Recovery Data in Ex1lorted Scritlts
Enabling this option allows PowerShell Studio to add extra metadata to an exported script that allovvs it
to recreate the original project that was used to create the export. The recovery data is stored in multi-line
comment blocks in the exported script.

This also applies to recove1y of the original package script file (.pfs) \Vith its assembly references and
packager settings (excluding security information).

The data recovery feature also applies to projects as well. If all t.he vital information has not been altered
or removed, PowerShell Studio \Vill be able to recover the original project files fro1n the exported script.
PowerShel l Stud io - Introducing PowerShell Studio I 31

In the past if a user had exported a GUI script but had misplaced or lost the original form file (.pff) then
the form would to be recreated manually and event scripts pasted into the new form. This cm1 no"v be
avoided by enabling this feature.

Default Action for Source File Loads


This setting controls ho\v PowerShell Studio loads eArported scripts. It has three options: Load, Ignore,
and Ask.
o Load
Reloads the original files that were used to create the exported script.
o Ignore
Loads the exported script as is.
o Ask
Displays a dialog asking the user how they wish to proceed.

load the Source file? a


,.,.. '$ ,..IC ~ ~~ led IfOM o S<M CC oC
Do you wi:lh to load this :IOU"Ce f1Jc?
Ft~ Nalnr: YyPr~ .p!;f
IJ Mod.Scd: 10(20/20:5 3.45:06PM
' loaibon: C:~\,S&d~~~CfSl'd Studio 2015

[ Yes =i No

Figure 16 - Source File Loads

If the file contains recovery data, you will also get a second prompt asking if you vvish
to use the recovery data to reconstruct the original files.

ihs f .e eortans ret::.overy dtia


Re ~ eJq>Ol't ~9' I
.__ Mod',eel I.! 'OSl2012 22 19 34

Do you wish to nx:onshuct the Ofioiiwil file?

Figure 17 - Recovery

Default Action for Source File Search


This option controls how PowerShell Studio responds when it cam1ot find the original files for m1
exported script. It has the following three options: Search, Never, and Ask.
o Search
Tries to locate the 1uissing files.
o Never
Does not attempt to locate the 1nissing files.
o Ask
Displays a dialog asking the user hovv to proceed.
32 I PowerShell Studio - A Comprehensive Guide

Ths frle was elll)Olted ftOlll a SOU"Ce ~ bl.c ~ SOlJ'Ce fie v.as not f0!6ld
Do you wish to -d f the ~file?
Fie ~b'rlc
L1. Modf.ed ?
l.Dc:IJlion C Uses :b\Doc:uners\SAPIEtl\PoweShell S."Udo
2"'2\Plqects'a;>at

Ye. II No

Figure 18 - Search for source file

1. 7.6 Editor Settings

General Ecitor Se~


./ Enable automatic syntax chedang r.,/ Enable axle folclng
_.., Enable anent ine ~tng .., Enable track changes

Console D Use v.ntespaces instead of tabs 2J Show ine runbers


v Show crndet help whle typing J Show white spaces
V' Enable br~t ~tng V' Colapse regions on load
Cok.lm: 80 II [1 Show ce>Um ~
Tab Size:
Editor
Insert comment-based help: I Befo<e fl.rlcbol_n _ _ _ ___._I"_,I
Assemblies
A Font and Color... _J
Formatting
Auto-Insert
PrrnalSense ./J Auto11Sert dosing parentheses _] Auto-insert llll>O't commands foe used mod.ies

./ Auto-.isert dosr.g square br~ts


Panels
.,/ Auto~t dosing o.rly braces
PowerShel
./ Auto-mer-t dosr.g stmg quotes
"

I Sou"ce Conb"ol
Analysis
" Automaticaly analyze saipts on 1U1

Figure 19 - Editor Settings

Enable automatic syntax checking


Provides real-time syntax analysis as you type.
Enable Current Line Highlighting
Places a colored bar under the current line to provide a visual contrast.
Show cmdlet help lVhile typing
If you type a c1ndlet it will appear iI1 the Object Browser.
Enable bracket highlighting
When enabled if you place your cursor on a bracket it \ill highlight its corresponding bracket.
Use whitespaces instead of tabs
Inserts spaces rather than tabs into code \hen indenting.
Show column guide
Displays a vertical line at a specific column.
PowerShell Studio - Introducing PowerShell Studio I 33

Auto-insert closing parenthesis


Auto-completes parenthesis while you type
Auto-insert closing square bracl<ets
Auto-completes square brackets while you ty pe
Enable Code Folding
Allows function bodies to be collapsed to a single line in the code editor.
Enable Track Changes
A1111otates the source code vvith yellow and green bars to indicate changes inade in the current editing
session.
Auto-insert import commands for used modules
When you type a cmdlet that is part of a inodule that isn't imported in the script, PowerShell Studio vvill
automatically insert the Import-Module state1nent.
Show line numbers
Displays line numbers in the left margin of the code editor.
Sholv white spaces
Display whitespace characters, including tabs and retun1s.

23125 !G $buttonScanIPRange_Click = {~
231261 ~
23127 I I function Invoke- TSPingSweep~
23128 1$ > {~
23129 1 -~
231301 -- Param (~

~:~~~I
> -->[ para~eter (Mandatory= $true, ~

23133 1
--->
> --> > > Position = 0 ) ] ~
[ValidatePattern ( "\b\d{l, 3}\ . \d{l, 3}\. \d{l, 3}\. \d{l, 3}\b" ) ] ~
23134! --->[string ] $StartAddress ,~
23135 1 --->[ parameter (Ma ndatory = $true ,~
231361 ) >- > ) Po s ition = l ) ] ~
!
23137 1 ) ) - > [ValidatePattern ( "\b\d{l, 3}\ . \d{l, 3}\ . \d{l, 3}\. \d{l, 3}\b" ) ] ~
23138 ! ) >-[string]$EndAddress ,~
23139 1 ---[switch]$ResolveHost ,~
231401I
) - - > [switch)$ScanPort, ~

Figure 20 - Showing Whitespace


34 I PowerShell Studio - A Comprehensive Guide

23125 1EJ $buttonScanIPRange_Click = {


23126!
23127 ! function Invoke-TSPingSweep
23128!8' {
23129 1
231301; Param (
23131 1 [parameter (Mandatory = $true,
23132 ! Position = 0)]
23133 ! [ValidatePattern ( "\b\d{l,3}\.\d{l,3}\.\d{l,3}\.\d{l,3}\b" ))
231341 [string]$StartAddress,
2313S j [ paraneter(Mandatory = $true,
23136 l Position = 1)]
23137 1 [ValidatePatter'l ( "\b\d{l,3}\.\d{l,3}\.\d{l,3}\.\d{l,3}\b" )]
23138 1i [string]$EndAddress,

~~~!!I
[switch]$ResolveHost,
I
[switch]$ScanPort,

Figure 21 - Not Showing Whitespace

Collapse regions on load


This \vill load yo1u file with all regions collapsed.
Auto-insert closing string quotes
Auto-completes string quotes while you type
Auto-insert closing curly braces
Auto-co1npletes curly braces while you type
Column
Specifies the cohunn where the cohunn guide should be displayed.
Tab size
Specifies the tab size
Insert comment based help
Has 2 options:
o Before Function
o Inside Function

231261 GdItem
23127 1of2 Get Item (Path! <StringU> (Filttr <String>l (-lnclud <Stringll >) (Exclude <String[)>) (force} fCredontial <PSCredontial> J fUseT.. nsadion) fStroam <StringD>) f<CommonParamottrs> J
23128 Pross TAB to onttr paramoters.
23129 Pross Shift+ TAB to onttr mandatory parameters only.
"\31 , , ,

Figure 22 - Tab Completion

This will allow you to display and cycle through the co1mnand's parameter sets. Once you find the para1neter set
that you \!Vant you can press [TAB] to auto-insert them into the cofillnand.
PowerShell Studio - Introducing PowerShell Studio I 35

j i
!.................................................................................................................................................................................. ...................................................................................................................................................................................................................... ~...................................................................................................................!

Po"verShell Studio is very versatile when it comes to design customization, whether you like more traditional color
sty les or you have a unique flair of your own, it can be tailored to fit almost ai1yone's style. The Editor Font ai1d
Color Settings gives you the opportunity to show off your personal style by customizing the font and colors of
PowerShell Studio' s Editor.

Editor Font and Color Settings x


Presets: (Saved SettJngs) _.._Iv.......I [ Save As Preset. .~
Font (bold type &nd1cates fixed-width fonts): Size:
Consolas 10

Editor backgroood: Indcator margin background:


I I \Vhtte IvI I I 240, 240, 240 Iv I
Modified line saved color: CUrrent line indicator color:
fl: I 108, 226, 108 IvI I I saver IvI
Modified line unsaved color: Colulm guide color :
1I I 255, 2.38, 98 IvI 1
- DarkBlue ----1v-1
Syntax Co!onng
Display items: Item foreground:
A&as " I- 192, O, 0
Code Snippet Relcl
Command I tern background:
Command Argument
Command As Parameter I I
Comment
Dlrecbve It./ Bold [ I tabc 0 Underhne
External Tool
Funcbon Sample:
Htghhghted Reference

, Number
Loop LabeJ
~~~~~~~~-v~
I AaBbCcXxYyZz

[ Restore Defaults ] ~K ][ Cane~


Figure 23 - Default colors shown
36 I PowerShell Studio - A Comprehensive Guide

i
...................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................;
~ ~

If you are 1nore traditional or don't have the ti1ne to configure the Editor Font and Colors then you can select from
a preset list of the1nes, enabling you to quickly change the current color theme.

Edit or Font and Color Settings x


Presets: (Saved Settings) _ _ _ _ ____......"... [ Save As Preset .. ~
Font (bold {Saved Setti'lgs) Size:
Dark Theme
Consola Light Theme " 10 I" I
Ecitor ba PowerShell ISE Theme gin background:
a!L.: PowerSheD Studio daSSJC Theme 1::1
..___.I \!vr11 Prima1Saipt Theme 240, 240 ~
fY"odlfied line save co or: Curren e incficator color:
I I 108, 226, 108 Iv I l I Silver Iv I
Modified line unsaved color: Column gUlde color:
II I 255, 238, 98 - - ,....."-, ~ DarkBlue

Syntax Colomg
Display ttems: Item foreground:
Aias
Code Sll!ppet F1eld
"l i- 192, o, o

Corrvnand Item background:


Convnand Argument
Command As Parameter L!:
Comment
Drrective ..I Bold [ I tallC [ Underline
External Tool
Funcbon Sample:
tigh.'ighted Reference
Loop Label I
, Number ~~~~~~~~-"- AaBbCcXxYyZz

[ Restore Defaults ] [ OK J[ Cancel J


Figure 24 - Editor Preset Sc hemes
PowerShell Studio - Introducing PowerShell Studio I 37

If you spend hours staring at a co1nputer screen, you 1night find that the dark schen1e is much easier on your eyes.

Figure 25 - Dark Editor Scheme

22S4A ion 6c<tAdlootT


12C)) '.I ~-ton McAf-
22992 r.-ton u'"'" roo111
2!8J7
U116
"~on tu~c.
St~box'6_textCh1n1~
looloj
.(
L
23117 Sbut'tonSc61'1lPR~n1e .fnabl~d ((Stextbox~.Te:irt ne ) ond (Stextbox4?.T~t nr ) )
2S111
2Jl19
21120
2Jl21 1 Stt1Ctbox47_Text<h11n,cd
23122
.(
SbuttonScanlPR~.rige ,fnabled ((Stxt'box4'.Txt ne ) ltd (Stextbox4?.Tcxt Rt))
21121 I
I
2112 )
2J12S
2)126
23127 SbvttonS<nlPRange_Cllck (

~
2J128
2-!129 function Il"tvottTSP-tngs.e-cp
2Jll0 (
2StSJ
21112
' p.,.. (
231)) (PA<'611W-te (MAndatory Strue ,
nu Position >l
231)5 [valtd..t.l"P 4tt~Ml(.\b\d{1.J)\.\d(l.l)\.\d{l.J}\.\d{1.l)\b.)J
Zlll6 [ttrln1}SS t41"'t.Addre,.s,
2)1J7 c~ ra.-..ttf" (Mandatory Strue,
23111 Position 1)]
231)9 [Vall(latl!';i ("lb\d(l,))\.\d(l.l)\.\d(l,l)\.\d(l,l}lb")J
2314'0 [ strlllg]SfndAddl"'es,.
I (1wit<hJSRosolveHo,t,
""
21142
23141
[w!t<h]SScanPol"'t,
[int()JSPorts ... f( 21, 22, 21, S3, 69, 71. '8, 98, 118, tl9, 111, )89, 443, 445, 1080, 1431, 2001, 2M9, :9001, :9118, S222, '66?, 6868, 777?, 7811, SINO, 1S21, !J.06, :9189, S881~
2)144 [lnt)ST .t.eou"t 100
2J14S )
23146 ~11in
23147 (
21148 Spina '4.cwObJt Sy,.t.e-.Het, tlcC.Ol"'kinforNtion, Ptn1
2J149 )
2JJS.0 Pre<"'~
2l1Sl
2.31S2
lllSJ
' (
SrichtutboxS1.A4>?tndText("S<anning IP Ran~ 'n"')
Srlc;ht~bodl.Refl"'eSh()
2315-< [Syste..WindoMs.fOras.ApplicatlOft]:1Do.EYents()
2JJSS forc~c;h (S in (SStill"'tAckktts.Split( ... )[It} $!n6Addrtts.Split( ){t] ))
2s1se ) (
231S7 forcac
L, l-\.l c-. >

Figure 26 - Light Editor Scheme


38 I PowerShell Studio - A Comprehensive Guide

W hen you select a preset, the font and coloring settings are updated to the predefined preset. Silnply click the Apply
button and PowerShell Studio will use the ne' v coloril1g scheme. You ca11 also create your own presets and share
the1n with your colleagues if you wish. Si1nply configure the coloring setting and then press the Save As Preset ...
button. You will be presented vvith a Save As dialog.

Save Editor Style

t ~ SAJ>lEN Pov.t<SllcDStudto 201S Ed~oc Ptrt<U p

~ t;..,. folder .... I

,
Down-. ... r.i.- f)ll<
t; Otopt>o. (SAPUll.

.... C>.ctUlts
.._. RTAC6'W
~ s.ics {U:..pc) ..,

Figure 27 - Save Editor Style

Give the preset a name and press the Save button. Now the preset will be displayed in tl1e drop-down list:

Ed1t0t Font 4nd Color Setting~

IPresie~ IFY ~:D'!'I Pr~..tt =====. .: -) =~= ;:I ..=e=


As=Pr=esc .~
=t=..=
Fo. t (bod Sa.ec!Se~ Sl."I::
Conse>Q ~erShcl !SE Thcf"lc ... 10 ...
PowerShel S:udo "'he1ie
~t ~
f:o;:o
Cl 2SS, 255. :.'~~ -------'
Cl
_ ___.. v240, :'-!O,
bad.vOU'ld:
2~
_ _ ______,_v

Ordct
~
~'fd\'lotd
Ooera:or
Y'ari-'11""'
1-&rb:r
SIMO u-oti
Co "ieilt
Fune \'IOI ~=
Poron:!=r
CO'l't'l\at'd As ?111an"eti!f
Codie Snooet f,ecf A4BbCcXxVyZ:
I fitJ'Wl'i:cd Reftf C"ICC
Type -
B.esCCfeOefaJts J

Figure 28 - Custom Presets


PowerShell Studio - Introducing PowerShell Studio I 39

j i
!.................................................................................................................................................................................. ...................................................................................................................................................................................................................... ~...................................................................................................................!

You can quickly wrap selected text in the editor in brackets, quotes, braces, or parentheses, by using the shortcut
keys below.

Keyboard Shortcut Wrap Selection In


Ctrl + Shift + 9 ()
Ctrl + [ [J
Ctrl +Shift+ [ {}
Ctrl +' ''
Ctrl +Shift+' ""
40 I PowerShell Studio - A Comprehensive Guide

1. 7. 7 Assemblies Settings

General Default Editor Assemblies

+ -
-----1 ran mscori:>, Version=4.0.0.0, Oibse=neutral, Pub&d<eyToken=bnaSc56.193'te089
Console tJil System, VerS10n=4.0.0.0, CUlbse=neutral, PubkKeyToken=bnaSc561934e089
tJil System.\ftftndows.Forms, Veroon=4.0.0.0, Culture=neutral, Pub6d<eyToken=bnaSc561934e089
Debugger tJil System.Data, Version=4.0.0.0, Culbse=neutral, Pubid<eyToken=bnaSc561934e089
tJil System.Drawv;g, Version=4.0.0.0, CUlture=neutral, Pubhd<eyToken=b03fSf7flldSOa3a
tJil System.Xml, Version=4.0.0.0, Culbse=neutral, Pubbd<eyToken=bnaSc561934e089
tJil System.Core, Version=4.0.0.0, CUlhxe=neutral, Pubid<eyToken=bnaSc561934e089

Assemblies

Formatting

Panels

PowerShel

Sotrce Control

figure 29 - Assemblies Settings

These asse1nblies are used to prov ide Pri1nalSense support for Types and .NET objects. You can add assemblies to
the Default Asse1nblies to ensure that they are loaded every ti1ne PowerShell Studio is started.

1. 7.8 Formatting Settings

Have you ever tried copying/pasting code from the Inten1et or a docu1nent but it never seems to indent correctly in
code editors? PowerShell Studio takes care of this for you by auto1natically formatting pasted code. You can even
custonrize the formatting to fit your own needs.
There are two sections in Fom1atting settings, the first options serve as triggers for auto fonnatting, these tell
PowerShell Sn1dio "when" to fonnat your script. The second set of options tell PowerShell Stl1dio "how" to fonnat
your scripts.
PowerShell Studio - Introducing PowerShell Studio I 41

General Tnggers
~ Automabcaly format statement on new ine Z Automaticaly format statement on ;
~ Automabcaly format completed blodc on} ~ Automabcaly format on paste

Console
Rl Automabcaly l'ldent new fines
Formatting
Debugger
../ Place open brace on a new line ~ Leave block on the same ine
Designer ~Place statement keyword on a new line D Insert new line after Parameter type
P' Insert new line after Parameter attribute ~ Automabcaly expand aSases

../ Align parameter arguments on &ne continue 0 Convert curly quotes to straight quotes
Assemb6es Parameter ine spacing (0 disabled):
L
Formatting Parameter blodc indent: [ 1 :1
Attribute parameter indent: [ 2 j ]V Arigo attribute parameters

Panels

PowerShel

Sotxce Control

figure 30 - formatting Settings

The follo\lving triggers can be enabled:

Automaticall)1 format statement on new line


Fonnats the line when you press <enter>. You 1night not notice anyth.iI1g if the text is already fonnatted.
Automatically format completed block on }
Fonnats a code block when the close curly bracket is typed.
Automatically indent ne'v lines
Auton1atically indents the appropriate tab depth vvhen inserting a new line by pressing <enter>.
Automatically format statement on ;
For1nats the statement when the se1ni-colon is typed.
Automaticall)1 format on paste
Fonnats code when it is pasted into the script.
42 I PowerShell Studio - A Comprehensive Guide

Formatting Rules

The second set of options allows you to custo1nize the fonnatting rules of Po"verShell St11dio 2015.

Place open brace on a new line


Places new open curly braces on a new line.

Enabled Disabled
~ (" lue) I (S .. .&. ... e) (
( Out Dctoult 'Tr~c
Oot-Dcfnolt 'Tn:c' }
i el~e {
else Out Dcroult .olsc
( )
Out-Dc!ault 'Fcl~c
)

Insert ne'\I line after Parameter attribute


Places each parameter attribute in its own line.

48 f unc ion lODd ' rChnr t


.;g {
so Par (
s. [ Par ter{ Pos ition 1, Mandatory e Strue )](Alias ( 'Control )]
52 [ Syst . J ~.o t Visu li4ation.Ch rting.Ch rt)SChort'Cont ro l ,
53 (Par etc ( Po ~ition 2 1 ndatory $tr ue))
s~ S Poi nt s ,
55 [ P r eter(Position - 3, Mandatory - Struc )]SYPoi nt s,
S6 (P r tc (Po ~iti on 4, l ~ ndotory Sf l~c )]( ' ring ]SXT i t 1

57 ( P r ete ( Po ~iti on 5, ~ ndotory S fa l ~ e ))[ 5trin )SYTit l~

Figure 31 - Before

.:s fu ction Load-HyChat" t


49 {
50 p ,. (
Sl (P r cr ( Po~ it ion 1, nd t ory Struc )J
52 ( Alio~ ( 'Control' ) )
53 ( Sy~t . in .F s.D t Vi liz tion.Ch rting.Ch rt )SChart C01ltr-ol ,
54 [Par ter( Po s it io~ 2, ndatory Strue)]
55 SXPoint s ,
S6 (P r tcr ( Po ~it ion 3, ndotory $ rue ))
57 SVPoin t s ,

figure 32 - After

Align parameter arguments on line continue


When parameter arguments are continued to a new line using the back-tick line continuation character,
they are aligned on the sa1ne coltlffill.
PowerShell Studio - Introducing PowerShell Studio I 43

Enabled
-
,.. t

Disabled
-... ' .

Place statement keyword on a ne'v line


Places each statement key word on a new line, such as the if and the else in an if/else statement.

Enabled
! ($v lu
Ou De ul 'T:n;c'
}
l~ (
out I>crault ' .. lsc'
}

Disabled
.,.
- ($valu
Ou Oct olt 'True'
) l (
Out- ult I: l '
44 I PowerShell Studio - A Comprehensive Guide

Insert ne'v line after Parameter type


Inserts a new line after the type of the parameter

Before
se Para (
51 [ .. t (Position 1, ~ndatory = Strue)]{ ~li ( ol ) ]
SJ. [syst ,,... "'. 0 s.oa .... tion.C ing. JSC:hartCo'ltrol,
53 [Para .. ( Position 2, tandatory Strue)}
5 .: $XPoint~ ,

After
50f Param (
511 ( Para~eter ( Position = 1, Mandatory = $true)]
S2 i [Alias ( 'Control' )]
5 3i [System. \Jindo\'IS. Forms. DataVisualization. Charting. Chart ]
i
54 j $ChartControl ,

Parameter line spacing (0 disabled)


Governs the line spacing between paraineters. If set to a value greater than zero, Po,verShell Studio will
place the specified ntunber of new lines after the parameter. To disable this option (leave the spacing as
is), set the value to zero.

Before After
..,
.:9 ;i (
.m lo.tdllyC~1rt - 48
49
Sil
{
, Lol<lllyChrt

Por ( I
Sil Pa (
Sl [ (Posit ion 1, 144...Satory Svuc )) Sl (Por.o&e (Poltion I, x.ndotory Stt"U<"))
;,(. Sl [Alles( I ))
S2 [ >I (Sys te-.1111\dCo. o .oatavi~uli.ation.Chlrting.Chart )
S3
s.:
[Sy> ~ rOf"P'~ O.~eVi ul~ tlO<l.C .4' .ing.Ch1rt) S3
s SChor tCont rol ,
SChartContro1,
SS (Par t (Position 2, X.t>datory St rue) J SS
56 SXPoints, 56 [ P.r (Position 2, X.ndotory Struc))
5' (Pa r - (Posi tion 3, Kandatory Stru.-)) 57 SJCPoit1ts ,
58 SYPolnts, sa
59 (Pa (Position ' X.ndatory Sfalse) l S9 (Par (Position 3, x.ndatory Struc))
68 ( st ini; ) 68 SYPo!nH,
61 SXT!tl .-, 61
62 ( P (Position 5, ll.lndatory Sfohc) ) 62 (Par (Position , Xandatory Sfals.e))
61 [ st ini.J 63 [strina)
64 SYT!tl~ 64 SXTitt.-,

Parameter blocl{ indent


How nlany tab spaces a parameter block will be indented.
PowerShell Studio - Introducing PowerShell Studio I 45

Indent 1
J~uncc1on V'~:-b-Neun (
Per
(
(Pa- ~c- (Ma~dat o:y ~t:-~e ,
POS1t10~ 0,
P.clpXc:s:saoc pr ctcr l '
) )
( Vcl1dat: .iot:.lullO:!:ttpt: () J
iS&::-l.nQ' )~Pa'!'aml
)
)

Indent 2
l'" unctl.on :~:-b-.~oun (
P4r
(
( Pc.a: "'tC!' (~c~d<tt O:-y
Posltl.o~ 0,
- -
c ....u-..

P.elp.V.cssaqe Par ctcr


)J
( cl1dat:e." t: ullO:;- t ())
( St::-l.ng ) ~Pa '!'a.ml
)
l

Attribute 11arameter indent


How many tab spaces an attribute parameter \.vill be indented.
Align attribute parameters
Vertically aligns a paran1eter's attributes declarations. W11en disabled it uses the Attribute Parameter
indent value instead, to indent the s11bsequent lines of attributes.

Enabled

P4r
(
( Pa!'~ e- (~a~d 4t o:y St- ,
Pos1t1on o,
!-!clp!~c:s:sac;c Por ctcr l '
))
r i1d te: t.: i10:.:r.pt c>i
(Strino JSPa'!'aml
)
46 I PowerShell Studio - A Comprehensive Guide

Disabled
!uncc1on ;e:b-.:cu~ ( ,.
Por
(
( Pa: ~ter (~o~d~to:y St:. ,
Pos1c1on o,
HclpXe33aoc 'Poraccccr l'
) )
( ..olldate.' t ullO.!:n:;pt ())
fSt:rl.nQ )SPa:::aml
)
~~~~~~~~~~~~~~~~~~~~~~-
< >

Leave block on the same line


Contracts or Expands the block

Enabled
if ($value) { Out-Default 'True' }
else { Out -OeLault 'False' }

Enabled
if ($value)
{
Out-Default 'True'
}
else
{
Out-Default 'False'
}

Automatically Expand Aliases


It has been the progra1nmers goal to shorten code to the s1nallest a1nounts, for often it is like bragging
rights however it can also make code not as readable for others. The option allows you to automatically
eA'})and shortened aliases.
PowerShell Studio - Introducing PowerShell Studio I 47

Enabled
Get- Process "ame 'PowerShell Studio'

Disabled
ps !lame 'PowerShell Studio'

Convert curly quotes to straight quotes


If you often copy and paste VB Script code from .doc files into scripts, you've likely run into the proble1n
where a script fails because so1ne s1nart quotes snuck in. By default, Microsoft Word's AutoFonnat
feature changes straight quotes (" ") into sn1art quotes (" ").

Enabled
Out -Default "Curley Quotes"

Disabled
Out -Default "Curley Quotes"
48 I PowerShell Studio - A Comprehensive Guide

1.7. 9 Panel Settings


--..------'=-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ,
General Ribbon

I Bad<up
L ResetQuickAccessToobar J
- Panel Layout
L.:._onsole ../ Automabcaly show output panels when text is displayed.

Debugger l Reload PreVJOUs State _J L Reset to Oefatit State J


-
Designer Auto Layout
~ Enable Auto Layout
Editor Editor Layout: ~citor Layout
,..---

Assemblies Designer Layout: Designer Layout

Debugging Layout [Debug Layout


Formatt.lg
- Database Browser
PrimalSense
Show schemas Cache al fields

Panels
Snippet Browser

PowerShel Custom Directory: !_________________!D


Sotxce Control

Figure 33 - Panel Settings

Reset Quick Access Toolbar


Resets the Quick Access Toolbar to its default state.
Reload Previous State
Resets PowerShell Studio to the same state as the last time you opened it.
Restore to Default State
Configures PowerShell Studio to its default panel layouts.
Enable Auto Layout
Allows PowerShell Studio to display panels based on vvhat you are doing. For exa1nple, when debugging
inake all the debug related panels visible and hide others.
Editor Layout
Chooses yolrr preferred layout for editing code. Choosing (clirrent) will keep the layout you are currently
us mg.
Designer Layout
Chooses your preferred layout for designing forms. Choosing (current) \Vill keep the layout you are
currently using.
Debugging Layout
Chooses your preferred layout for debugging. Choosing (current) will keep the layout you are currently
usmg.
PowerShell Studio - Introducing PowerShell Studio I 49

Show Schemas
This setting configures how the object browser displays schen1a information from SQL server. If it is
cleared, then the object browser will ignore schema infon11ation and display database tables, stored
procedures etc. in a silnple flat list. Enabling Shovv Sche1na \\1ill cause the object browser to display
database objects in their respective sche1nas.
Cache all fields
This setting will cache everything within the database browser, for quick loading of recently used
information. Checking this option will take 1nore tin1e to load because it is caching everything upon start-
up.
Custom Directory
Adds an eA1ra folder to the snippet browser panel. You can provide a network path here to create your
own shared snippet repository.

1.7.10 PowerShell Settings

General PowerShel Settligs


_J Show heJp in Document Explorer v Update cache on modtJe export
v Enable execubon poky warning

Console Wndows PowerShel Secuity

Change Execubon Poky


Debugger
Certificate in local store:
Designer I (Leave empty to s9'l with the frst avaiable code signing
~ cerbficate)
Ed tor
PFX Certificate:

Assemblies Password: _J
Formatting Tme Stamp URL: [httP:fltmestamp.globalsign.com/S01Pts/tmstamp.dl ~

PnmalSense
External Signing Tool: [ ""]
(Using an external tool wi override all other settings.

Pares J Speofy 0/oReo/o for the S01Pt to sign.)

I AutomabcaJy sign .ps 1 saipts when savng


[ Powe-SheJ

Solxce Contr:;l

Figure 34 - PowerShell Settings

Show help in Document Explorer


Displays help in Docmnent Explorer instead of in the Help pane. Turning on this option disables context-
sensitive help in the Help pane.
Enable Execution Policy Warning
PowerShell Studio will warn you if the current PowerShell execution policy is set to Restricted and help
you to change it if required.
U11date cache on module export
Updates the stored cache when exporting modules when enabled.
50 I PowerShell Studio - A Comprehensive Guide

Change Execution Policy


Allows you to reconfigure the execution policy for both 32-bit and 64-bit shells from a si111ple GUI
interface.
Certificate in local store
The name of the certificate the PowerShell Studio will use for code signing.
PFX Certificate
Specifies a certificate stored in PFX format.
Password
The password required to access the certificate stored in PFX fonnat
Time Stamp URL
Used to add a timestamp to the signature block in a script. This provides an extra level of security as
PowerShell can detennine if the certificates used to sign a script were valid when the script \Vas signed.
External Signing Tool
Provides the name of an alternative code signing tool.
Automatically sign .psl script 'vhen saving
Enable this to ensure that all scripts are signed.

1. 7.11 Source Control Settings

General Settings
I
../ Enable source control ~ Prompt for check Ill

Automatic check in: Disable Automatic Check In v


Console Check out on edit: Automabcaly Oleck Out v

Debugger Direct info output: rSuppress nfo messages v


'

I Providers
I
1
I

I
I

Foonattng

PnmalSense
I

i
I
Panels

I
i
I
I
I
I

Figure 35 - Source Control Settings

2
Before configuring PowerShell Studio for source control, you must install your source control sofuvare's client.

2http://info.sapien .com/index.php/manuals/manual-powershell-studio/powershell-studio-cha pter- 10-


source-control-integration
PowerShell Studio - Introducing PowerShell Studio I 51
Your source control sojhvare niust either be T/ersionRecall froni SAPIEN Technologies or your source control
provider must provide an SSAP!-conzpatible client, such as 11tficrosoft T/isual Source Safe. You need to install and
configure per the nianufacturer's instructions, prior to integrating ivith Po1 11erShell Studio.
1

Check the Enable Source Control checkbox to enable source control. Note that your somce control provider must
be displayed in tl1e Provider list; if it is no~ then source control is not properly installed and will not be available to
PowerShell Studio.

PowerShell Studio will auto111atically detect tl1e presence of the sotrrce control client and auton1atically display it in
the Providers list box. If your source control client does not appear in this box, tl1en shutdown Po"verShell Studio
and it should appear on restart, if it does not then this likely meru.1s that you do not have the source provider properly
installed and configured, or it is not a SSAPI-compat:ible client.

GIT Source Control does not have a SSAPl-cornp atible client and y ou nzust use custonz nienus to use GIT
ivith Po111erShell Studio, 111e discuss this further in 2.2.5.

After enabling sotrrce control, you can configure the options however you like, including pron1pting before checking
files out and automatic check-in options.

Enable Source Control


Allows Po,verShell Studio to use source control if it is available.
Prompt for Check In
Tllis option works in co1"tjunction with Auto1natic check in:

Prom11t for Check-In Automatic Checl\.-ln Behavior


Cl1ecked Check in when file closed User is prompted to check in files
Unchecked Check in when file closed Auton1atically checks in files
Any Value Disable Automatic Check-In User must manually check files in

Automatic Check In
This controls check in behavio r ru.1d has follo\.ving two options:
o Disable automatic check in
Leaves you to decide when files should be checked in.
o Check in when a file is closed
Auto1nates the check iI1 process.
Chee){ Out On Edit
This co11trols check out behavior and has the follo,ving tvvo options:
o Automatically check out
PowerShell Studio 'vill check a file out as soon as you edit the file.
o Prompt for check out
Po\verShell Studio \Vill display a file chooser dialog in wllich you can choose the files you wish
to check out. The file you are curre11tly atte1nptiJ1g to edit \ill auton1atically be selected.
Providers
Displays the list of available sotrrce control providers and allo,vs the user to s\vitch between the1n.
52 I PowerShell Studio - A Comprehensive Guide
Chapter 2

You can't get there if you don't know where to start/


)(

'

..

11!81 =
PowerShell Studio - Basic Orientation I 55

BASIC ORIENTATION
You can't get somewhere if you don' t lrnow the way. Before we get down to the meat of building forms and
projects it is extremely important that you have a good tinderstanding of the layout PowerShell Studio, after all you
wouldn't go hiking out in the woods without knowing where you are going right? It is amazing how many users
hardly get past using the controls in the toolbox, wl1en there are so many great features that are being missed. This
book is going to take you tlrrough all of the1n!
Ok. so you 've fired up PovverShell Studio for the first time and you are staring at the screen wondering "Ok, ' vhere
do I start first?" . This book is a perfect start, so keep on reading! SAPIEN also did a great job adding a lot nlformation
right into PowerShell Studio \Vitl1 tl1e Docu1nent Explorer.

2.1 DOCUMENT EXPLORER

- 0 x

Smr&um

[ii t<oodv
~-''
i!i'j --.pc1
liill .,_.,.....,
rms...........
2018
Recently Opened
iJ ......
EiJ
Ml!inl'on.!kl!lf
Malnf9rm.oI ..... ii SAPIEN S..vtngs f0< Military Pe~onnel
SAPIEN ln(ormaHM Center- AnlcJes vau may
BJ Mainfom>.psf 11/13/2016 a !!.!.."" mlsst~
liappv ~taflaween from WIEN
Cii'J 1est.p<I ii
SAPIEN Sctlpt Pat:kattr u?sf.ates and rrew
p
iJ Mainf9nn.p~I U/2/2016
features.
En'erir lll:)t :0 ~Oldt
' E1J /ol>out TOfllC$ . /ill Malnl'ontt,psf
BJ Mainl'otm.psf
o/12/2016 ii Art you SAPIEN MVP materlf? Apply henil
v HIM:

e
,A
eot"t Oldct$
r. HodtJres I BJ Fjld~ In f!m!!Rlf ......
U/13/2016 Ar@ you headed rq Micro<olt Ignite 2016? "" \'dt' ~fb
Fk F~it: !C:\S.l:OtN'Pcoc91e1St
fiAl>'l'x
Bi Qgmo-fold!rTuVl~l!M!~f ...... Mv SAPIEN License I exolrlna. No, It's nGt!
t~ S:.n,ci.ro
r; !liUlransfl!:r
' r; Cir6det:s
r. OJ~teotr.:i..
SJ Malnform.psf ...". ii
New Keybo.ird Shortcuts In PoYA?IShefl Studio
2016 Re~et~N#ft

Enable WMI E!Plorer Remote ConneCllD!J


(;Otitt.n Permissions
. r. OnsOeni. Semttnber OnUne Savings
(; !VC11iTr~l
'r;;~adon

- - 1- 1-
-
r. In.ttrnellOnd
...-~
I l4YOU~

AsJtolayGUl
Vle.w all artJcles related U? thls oroduct

>. READ 0!.oR CAP NUM I

Figure 36 - SAPIEN PowerShell Studio Product Manual

1. From Po\verShell St11dio, navigate to the Help tab on the top ribbon bar.
2. On the far left under the Product Support category, click Product Manual.
3. This will open the SAPIEN Docrunent Explorer.
The SAPIEN Document E~rploter is packed with a plethora of information including PowerShell c1ndlet definitions,
Modules PowerShell Studio manuals and guides, Training Videos, Links to online communities and other
resoltrces, and tbe latest articles.
One of the features of the Docunient Explorer that you 111ill find very useful is the ability to add your 0111n notes
directly within the Document Explorer.
56 I PowerShell Studio - A Comprehensive Guide

There are also hundreds of script samples for Po\verShell, VB Script, Po\verShell Studio GUis and more. This is a
great \vay to get your feet \.Vet in understanding ho\v PowerShell Sh1dio functions.

SAPIEN Documtnl Exptortr 2.()16 . Chapter 2-Gttting Starttd Cl x


Homt Stylt 8
.... ,l'.n {) ~ <1 II ~ Edn n Pr malS<npt ~ PowerShell help lilts... 0 Conttnt 0 Starch results L'rSJ
llllliJ l!li'J Copy IJtiG ~ S [iil, find !!'J Edi! n PoworSht Stucuo (J About Flits... 0 ~mptes Ea Notes C'.!:i
Pastt Sack fo nd ~ Status Bar Wfndows
fr-o\r t Rrplac~
Clipboard Conttnl Edit Tools Import Window fi

;11j Chapt<r 2-Gtt1ong Storttd x


e Othervttbs ...
I W e
q:rii Providers
All verbs
Getting Started
iii i i Modules
'Ii
~ l/8Script
EBooks

f Ii
Manuals
S ~ PowerShell Studio 2016
Installation

1
.~ Introduction All SAPIEN TectmoJogies software prooucts are do1m1oadable only. Once a customer
I ~ Getting Started registers or updates a product on my.sapien.com, the download screen appears. Tne
1i'J
Basic Orientation Installer sonware is saved as SPS155etup_xxx.exe to your default download folder. Upon
-s1
The Script Ed~or

f-1i'J
~ Running and Otbu99in9 Scripts

1 .
The GUI Oesigntt
$j Pow01Shll Studio Panes
execution. tne Installation wiZarel first cnecl<S several items sucn as avaJlable CllSK space anel
existence of previous builds. If tile environment Is adequate. tl'le installer will display the legal
aoreement wl'licl'l vou must acceot In order to orocee<l. At anv ooint In tl'le orocess. vou mav
v

1
~ Projocts
Advanced Features and Curtomization
Sourct Control lntogration
1i'J
Packa.ging Scripts
~1i'J Comparing and Muging Files with ScriptMorg
t ~ Th SAPIEN Document Exploror
1i'J
Th Romote Script Exe<ution Engine
~ The Snippet Editor
:ij SAPIEN Update Tool

~
1i'J
Keyboard Shortcuts
. (C) Quick Guides
@Shortcuts
~ 111! Videos
Iii Articles ...
~

$>conttnt ~S.mptes Brows IEJ s..rch Rtsutts II tlots


Rtady .~' NUM , " .,!

figure 37 - SAPIEN Document Explorer

Ho'v much space does the Document Explorer consume? Not as much as you nti.ght think. The software installer
contains about 99 files and consumes about 7.82 lvIB , we ll worth the small amount of space it consumes.
What if I want to remove the Document Explorer?
You can uninstall SAPIEN Document Explorer fro1n your con1puter by using the Add/Re1nove Prograin feature in
the Windo"v's Control Panel.

1. On the Start menu (for Windo\vs 8, right-click the screen's botto1n-left comer), click Control Panel, and
then, under Prograins, do one of the following:
o Windows Vista/7/8: Click Uninstall a Program.
o Windows XP: Click Add or Re1nove Prognuns.
2. When you find t11e prograin SAPIEN Document Explorer, click it, ru1d then do one of the following:
o Windows Vista/7/8: Click U niI1stall.
o Windo\vs XP: Click tl1e Remove or Change/Remove tab (to the right of the. progra1n).
3. Follo"v the prompts. A progress bar shows you how long it will take to remove SAPIEN Docu1nent
Explorer.
PowerShell Studio - Basic Orientation I 57
x
m
Settings 0

People 112 KB
Home Microsoft Corporation 11/4/2016

I Find a setting pl a Photos 97.6MB

m
Microsoft Corporation 11/23/2016

System 112 MB
Power2Go
Cyberlink Corp. 12/15/2011
0

-
Display
B PowerlSO
Power Software Ltd
8.07 MB
9/22/2016
- Apps & features

-
::::. Default apps
Iii SAPIEN Document Explorer 2016 7.B2 MB

m
SAPIEN Technolog1es, Inc. 11/3/2016

[J Notifications & actions SAPIEN PowerShell Help 9.84 MB

m
SAPIEN Technologies, Inc. 11/3/2016
(') Power & sleep
SAPIEN PowerShell Studio 2016 74.7 MB
SAPIEN Technologies, Inc. 11/20/2016
= Storage
D SAPIEN ScriptMerge 2016
SAPIEN Technologies. Inc.
7.BO MB
11/3/2016
m.? Offiine maps

Q3
B SAPIEN Updates 484 KB

m
Tablet mode SAPIEN Technologies, Inc. 11/3/2016

![JI Multitasking SAPIEN VersionRecall 2016 11.1 MB


SAPIEN Technologies, Inc. 11/25/2016

2.2 RIBBON BAR AND TABS

The Ribbon Bar is located at the top and spans the entire width of PowerShell Studio, you will find seven tabs
located along the ribbon bar which \Ve will discuss in greater detail here.

2.2.1 Home Tab


ClldGi O..., ~

c--
llll
- ...,_,,. OdOW DtdoY Toc;t SMeeeont'd riiilb 'flit'lt
a 'l.:i"9 ..... - . ......._ ~ -.. 1:i ll CJw . ...-~. .. - r:t .. li'f'tWM :.. .., QI- ~ ......

- -
~ I U fS nat ... V1\11'1 ..l> @t1m .,...._..
lt#l'IOOI ,..., II "-~ ~- .. a - ~ Wllllt " t~t~

....,.-'4
""" _ Ir
.. ~ .,,. ~ c.- . o-.
QlloCQP <J!O ll ~- ..._.
...I ., t ' ...
Contains the functions used 1nost often while scripting, it is the default tab in PowerShell Studio.

i~.. . ......................................................................................................................................................... .................................................................................. ...... .................... ................................. ............................. .................................................................................................. ..................................................................t:

Paste: used for pasting code into the editor from Windows clipboard.
[~ Copy
L~ Copy HTML Copy: copies selected code to the Windo,vs clipboard.
Paste
~Cut
Copy HTML: copies selected code and fonnats it within HTML code. If you blog,
C pboard
this will quickly become your most used tool, it provides pe1fectly fonnatted HTML
including color coding and formatting.

Cut: copies the selected code to tl1e Windows clipboard and removes tl1e selected code from the editor.
58 I PowerShell Studio - A Comprehensive G uide

i
,., -
......... .................................................................,...._ ,,,,................................................................................ .. ................................,_ ,,,.................................................................................................,_,,,.................................................................,_ ,,................... ...............................................................,_,_ ,,,, ...............i
~.-- ~

Version and Platform : Po\verShell is available in both 32-bit and 64-bit platforms, you. can choose \vhich
Po,verShell versio11 is reqt1ired for your script ai1d platfonn require111ent. In tl1e exainple on the left PowerShell
version 5 ai1d 32-bit platfonn are selected.

Depending on the version of PowerSbell that you have itlStalled on your system that you are running PowerShell
Studio on are the versions that will show as choices. If you are miming Windows 10 you will likely notice that you
sl1ow VS (32 and 64) available, why not V3 or V4? That is because \vhen the PowerShell version is upgraded the
previous versions are uninstalled and i10 longer available.

Elevation (shield): Po,verShell Studio runs your scripts with the


rLocal Machne privileges of the current user. It is considered a security best practice to
g vs - 32 Bit
avoid logging on as an administrator level account whenever possible.
- Son1etimes yotu scripts \ill need to do things that require greater
0 >=< ~ ~+~ ft privileges ~ Po\verShell Studio facilitates this by allowing you to i1m scripts

~ Platform
in elevated mode. The Platform 1nenu provides elevated, and non-elevated,
n1odes for script execution.

STA: Single Threaded Apartn1ent inode. STA (Single Threaded


Local Madlllle
Apartinent) and MTA (Multi-Threaded Apart1nent) detennine ho\v a
g VS - 32Bit \I process manages legacy COM objects and their cofilln1mication \itb
- - inultiple threads. I will not go into the detail, but you need not conce1n
0 )0{ ~ ~+:J f1 yo1uself witl1 tl1e im1er workings of COM objects, otl1er than to reme1nber
~ Platform that ST.A is required for so1n.e of the GUI controls to function correctly.
Section 2. 2. 3 f or 111ore

rLocal f\1achine
Local Cache: refreshes the local cache of PowerShell cn1dlets and
nlodules. If you edit any 1nodules that yot1 have already loaded, like
ra vs - 32Bit \I rena1ning a function or editing the contents within a module, you should
refresh yotu local cache or the changes made to the module \ill not be
0 >=< available for use because once the mod1tle is loaded the locally cached copy
is used.

Local Machine IvI Edit Cache: add/remove 1nodules that are included it1 the cache proftle.
Once clicked a nevv \Vindo\i\1 will open showing all the current modules,
g vs - 32 Btt \I and \Vhetl1er they are part of the current cache profile. 1f you \Vant to add
a module to the current cache profile, check the box neA.1 to the desired
0 ~ n i +d f8 11! module, 1mcheck to remove from the current cache profile.
Ptatform
PowerShell Studio - Basic Orientation I 59
f.Y Powe.Shell Cache Editor x
~ter: local MclcHne v
---'
Cliche: Power5hel64VS v
I ~

~
MoQJe Version Oesa1>bon "
0 Ac:tiveOl'ecmry 1.0.0.0
E2l AwBad<9'0l.ndraslc 1.0.0.0
O~ocker 2.0.0.0
E2J Appx 2.0.0.0
0 AssignedAccess 1.0.0.0
0 AIVSPowerShel 3.1.qLO
0 AZ\xeRM.proNe o.o
0 BestPractices 1.0
0 &lgWafpaper 1.1.2
E2l Bitl.ocker 1.0.0.0
0 ElitsTransfer 1.0.0.0
E2J ElctsTransfer 2.0.0.0
Oar~ i.o.o.o
0 CinCtrdets 1.0.0.0
0 Olrix.common.Comm<lnds 1.3.0.0
0 Otrix.Common.GtoupPolicy l.S.O.O
0 Olrix.XenApp.Cornm<inds 6.5.0.0
0 Defender 1.0
E2J DrectAccessOentCo111p01 ients 1.0.0.0
0 Dism 2.0
0 Dism 3.0
0 DnsOent 1.0.0.0
0EventTr~t 1.0.0.0
n fU'ICtioosModUe 2 1.0.0.0 v
< >
-

Figure 38 - Cache Editor

Local Machine Iv I Import Remote Cache: Imports an Installed Module Set (IMS) exported
on another computer. One of the challenges you face while developing any
g vs - 32 Bit II
\I PowerShell script is that 1nodules that reside on your target platfonn are
not available on your local computer. See References section for details on
0 >e< G ~ ~:J Fe II exporting and importing reniote cache.
Platform ~

Local Mactune E dit Remote Connection : edit the remote cacihe 's connection settings.
These settings define the type of re1note co1mection you want to use, either
lg VS - 32 Bit \I Windows PowerShell Ren1oting or RSEE Remoting. Windows
PowerShell Re1noting 1nay require usenlalne/password credentials, RSEE
0 >e< G ~ +~
does not require credentials but the RSEE service must be rumling on the
Platform remote target syste1n. See the R eferences section for niore information.

Local Madtne Remote Console: this will open a re1note console to the selected
n1achine (requires Windows Remoting). This f eature will not work ifyou
Ef VS - 32 B1t \I
are using RSEE as a reniote connection type.
0 < G ~ +~ E6
Platform
rt
60 I PowerShell Studio - A Comprehensive Guide

; .-
~ ............................................................................................................................................................................................................................................................,........... ,........................................................................................,...................................................................................................,...............................................................t

~Debug .. ~ Step Into . Run (Ctrl+F5): Executes the current docu1nent or project and
I> ---t>
Run
Remote ... C=- Step Over
displays the results in the Output pane. Run creates a ne'v session
that never includes local artifacts, like your Windows PowerShell
Stop t StepOut profile, or session-specific items, like variables, and then runs the
script in the clean-slate session.
I> Run Ctrl+FS
Run in Console (Ctrl+Shift+F5): Executes the script or project in a
J
mt Run in Console Ctrl+F8
console session and displays the results in the Console pane. The Run
9...
.
-i Run Selection Shift+F8 in Console feature doesn't just run a script in the Console pane - it
~~ : Run Selection in Console F8
dot-sources it. Dot-sourcing adds the items in the script scope,
.J
including function, script-scoped variables, classes, and workflo,vs,
to the console, so they 're available even after the script completes.

Run Selection (Ctrl+F8)


Executes the highlighted text or the line that it is on and displays the results in the Output pane.

Run Selection in Console (Ctrl+Shift+F8)


Executes the highlighted text in a console session and displays the results in the Console pane.

Previe"' (Shift+F4)
Allows you to see how a form \Vill appear on the screen without the need to run any code.

DEBUGGING
Debug (FS): Debugs the current script or project.

I> ... ~Debug


Fl ~ Step Into + Run To Cursor Results will be displayed in the Output pane and
Debug pane.
Debug FS
Rui
~ Debug with Multiple Files
... Ctrl+M Debug lvith Multiple Files (Ctrl+M): Debugs
Run the current script or project plus additional files
and their breakpoints.

~ Debug I:=. Step :nto ~un To Cursor Run Remotely (Ctrl+R): Uses PowerShell Remoting to
execute your script or project on another machine. Results
Run -~
I> Remote
Run Remo e1y
G- Step Over 11 Break
F6
will be displayed in the Output pane.

l:>: Run Remotely RSEE Shift+F6 Run Remotely RSEE (C.t rl+Shift+R): Uses the SAPIEN
__ Debug Remotely Ctrl+ F6 Remote Script Execution Engine to execute your file on
another inachine. See References section for more.

~-
GUI scripts cannot be run re1notely.

Debug Remotely (Ctrl+B): Debugs the current script or project on a re1note system. Results \Vill be displayed in
tl1e Output pane and Debug pane.
PowerShell Studio - Basic Orientation I 61

PowerShell Studio also offers the ability to debug a script in elevated mode by setting the appropriate platform
setting as described above. The script will run nom1ally with output, captured to the Output tab, until a breakpoint
is reached. A yellow arrow in the margin of the code \vindo\v indicates the next line of code that "vill be executed.

~ Step Into + Run To Cursor Step Into: executes the next statement and then stops.

c=- Step Over 11 Break


Step Over: executes the next statement, but skipsfunctions and invocations.
C2_ StepOut The skipped state1nents are executed, but not stepped through.

Ste1> Out: Steps out of the current function; up one level if nested. If in the n1ain body, it continues to the end or
the next breakpoint. The skipped statements are executed, but not stepped through.

Run to Cursor: runs the script to the line containing the cursor.

Break: breaks the debugger.

BREAKPOINTS
Toggle Breakpoint F9 Breakpoints instruct the debugger to stop on a specified line
Enao1e I Disable Breakpoint Shift+ F9 of code. This allo"vs you time to revie"v \vhat the script is
doiI1g at that point. To set a breakpoint, place your cursor on
ft Delete All Breakpoints Ctrl + Shift+ F9 the desired line and either press F9 or choose the Toggle
0 Disable All Breakpoints Breakpoint button from the Break Points menu in the Debug
section of the Ho1ne ribbon tab.
Set Variable Breakpoint .. .
Active breakpoints are displayed as solid red circles in the
G Set Function Breakpoint .. . margin of the code editor \vindow . Disabled breakpoints are
I r:; Edit Breakpoints... displayed as red rings.

231901 I $ping = Ne\~ - Object System.Net.Networkinformation . Ping


23191 jt- }
23192 l~ Process
23193 1- {
0 23194! $richtextbox51 .AppendText( "Scanning IP Range 'n" )
23195 l $richtextbox51 .Refresh()
!

Once a breakpoint is set, you can disable or delete it by using the Breakpoints menu or pressing F9 to toggle through
the options. You can also right click on the code editor to access the Breakpoints menu.

TRACEPOINTS

llJ Toggle Tracepoint Ctrl + F9 A Tracepoint causes PowerShell Studio to \Vrite a 1nessage to
the debug windovv when a specific line of code is executed.
C Delete All Tracepoints Ctrl + Alt + F9
Tracepoints appear as solid blue circles in the code editor
margin:
62 I PowerShell Studio - A Comprehensive Guide

23188 1I Begin
23189 1~ {
231901 $ping = New-Object System. Net . Networkinforrriation.Pi ng
23191 1 }
23192 ~ Process
23193 1- {

:
.......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................!~
~

alJ Find /Replace t:I Edit Parameters Find/Replace: as the name indicates this tools \Vill find and/or replace
text within the editor.
~ Format Script iJl1 Assemb es
O Functions -- ":=. '9:
Format Script used to beautify your script by fonnatting it to standard ~
script fonnatting. This will not expand aliases, if you \-Vant to expai1d all
Edit
aliases within your script; press [Ctrl + Shift+ A]. This will help you
elit11inate errors by good fonnatting, and makes your scripts more professional.

Functions: There are three different tools here:

a. Insert New Function


b. Edit Function and
c. Import Functions.

Edit Parameters: better known as the Parameter Builder, used to insert a ne\v para1neter block or edit existing
script paran1eters.

Those familiar with the Function Builder will recognize the sinlilarities between the two tools, except for the Name
portion of the builder. Othenvise the Parameter Builder ai1d the Function Builder share the same functionality .
PowerShell Studio - Basic Orientation I 63
Parameter Builder x
Hame: ? Parameter Sets: ?
'

OutputTviie
SynopslS: ? I
~arameter Edtor Test _]
Descnptlon: ?
Default Parameter Set: ?

L
Cmdlet Binding: ? Parameters: ?
!l.:J I
Parameter Set Filter: (Show All) I
Cnn '"'!>&"
Name Tviie Pos M
~
Posi~
S<.wort!Pagirig
' Name
Coop.ster
stnno
stmg
0 i'!'.i
'I'
0 j,.i
)(
)(
S<.wortsShoiJcl>rocess 0
Confrnnlmpact
Oetena ies whether p~ au:oma~v P<Ol11Dts u:;ers fur conmnabcn
befure nrnng the nsxbOl'I bv ~ the SConl'mPrefere>n shell
-.able lJr..e " " - the flTICton has a pe1'l\Clllel't ~ suet- a!: deleting
rl L

Output Type: ?

figure 39 - Parameter Builder

After entering your parameter information, click " OK", the resulting code will be inserted into the editor for you,
see below.

2 - <#
3 .SYNOPSIS
4 Parameter Editor Test
5
6 .DESCRIPTION
7 Used for deat0nstarting t he use of the Parameter Editor
8
9 . PARAMETER t~ame
10 A description of the Name parameter.
11
12 PARAMETER Cornputer
13 A description of the Computer parameter.
14
15 .EXAMPLE
16 PS C:\> -tlame 'Valuel' -Computer 'Value2'
17
18 . NOTES
19 Additional information about t he file.
20 #>
21 para11
22 (
23 [Para~eter(~landatory Strue)]
24 (str ing)$Name,
25 ( Parameter(Mandatory $true) ]
26 (str ing)SComputer
27 )

Para1neter options can be set by clicking on the options button for each parameter:
64 I PowerShell Studio - A Comprehensive Guide

Paramtttr Build~ x
fQme: ? Parameter Sets: ?

Synopsis:
------~
? t:
Oescnptlon: ?

Cmdlet 8111d1ng:
J ?
Default Parameter Set

Paran1eters:
?

?
I
--
~ Parameter Set filter. (Show All) I
onfi ~
Type Po< M

~ $lmg ' I'


IE21 i":"i )(
Post>or.olll di '9
1 )(
~:>l'aQIOll C...,.,l>!r s.tmg 1E21 j,j
s...>i:>or~ocess JP.
Conf1m1Jmpact I
Det"""""' v.iletn<r "'
~ auttxnabtolv prMC:>....,.. ~ Cllnf=a-
',''
befor~ 'U"IW>g ft fittl>on by~ "le SCotc!nnPT~fermct stiel
~ use whet'~ v.cton -as a pOl"r.ancnt"'*t. a.:!'.,. dclctno
'"
Output Type: ?
Parameter Options '

Figure 40 - Parameter Options

Parameter x
Parameter flame: ? Ahas: ?

J
Description: ? Default Value: ?

fy~ ? Validation: ?
Switch Parameter [ Add_ _

Parameter Set: ?
I Remove

[Settings:
[ Add

Rcr

?
...

v Misc
~
Mandatory True
Poslbon
Vallefr~
Vakiefr~yPropei
VaiJefromRemanngArQIJT

HelpMessage
A short descnpbon of the parameter

Figure 41 - Parameter
PowerShell Studio - Basic Orientation I 65

Comments and Regions: These tools are used to cormnent or unco1rnnent selected line of code, or perfonn region
functions as discussed below:

,' ~
I \

,'
I
I

. ' '
I
I
I
\
\
\
Comment L nes
Block Comment ' ''\ I
Uncomment L nea Region Functions

...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................,
;.-

I NAVIGATION l
!t.......................... .. . ........ ..... .............. ......... ... ....... .. . ........ ..... ... ................ ....... ...... . .. . .. . ............ . ............ ........... ....... .. .. .... ........ .................. ........ . ...... .. . .. . ......................... ........... ...... . .. . ..... ... ..... .......................... . ......... .. . ....................... ..... ..... ... ...... . ........ ... . .... ............. ................... . ........ ................... ......... ... ...... .. .......... ............ ..,!

Previous Last Edit Previous Change: navigates to your previous change within the active
document.
@Next - ' Bookmark
1+ ~1 Go To Line
+-* 4 Previous Function : navigates to the previous function from the current
location in the active document.
NaVigabon

Previous Occurrence: navigates to the first previous occurrence matching the selected text in the active
documented.

Next Change: navigates to your next change from the current location within the active document.

Next Function: navigates to the next function declaration from the current location in the active docu1nent.

Next Occurrence: navigates to the next occurrence 1natching the selected text in the active docu1nent.

Go To Line: ju1nps to any specific line you enter within the current active document.

Last Edit: Goes to the position of the last edit that was 1nade to the current active docmnent.

Toggle Bookmarl{: sets a book at the current selected line.

Clear all Bookmarks: exactly as it says, it will clear all book1narks within the current active document.

Previous/Next Bookmark: jump backward and forward to the next book1nark in the active docu1nent.
66 I PowerShell Studio - A Comprehensive Guide

i
...................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................;
~ ~

-1 Package L:!J Bud all This section contains conunonly used deployment tools from building
packages, i.e .. EXE files, to creating installer files i.e .. MSI files, to deploy1nent
ifb Installer Glj CdnceJ b d methods such as CD/DVD or Email.
llY
::=;t
Deploy ...

Deploy

Build: this will create an executable (EXE) from the active document.

Build and Run : this does the same as Build and will rm1 the executable.

Run: this will nm the executable for the current active document.
Run

Settings Settings: this is pai1 of the Script Packager settings which are discussed in
greater detail in a later chapter.

U1 Package L:!J Buld aD Build: this will create an installer file (MSI) from the active doctunent.

ifb insta er ~ Cancel bl&!


-
..lriJ Build Shift+F7
Install: installs the MSI for the active document.

Uninstall: uninstalls the application for the active document if installed and
Install
versions 1natch.

Settings: this is part of the MSI settings which are discussed in greater detail
~ Settings in a later chapter.

DeJlloy: deploys the files for tl1e active doct1ment and executes the associated
iP Package L!:J Buld a! co1nmands.
i~ Insta er ~ cancet ouild
,, Send To: sends a compressed archive of the deployment files for the active
CY Deploy ...
document to ai1 email recipient.
@. Deploy Ctrl+ Shift+ F7
H~l Send to ... Copy to CD/DVD: bums the deploy1nent files for the active document to a
CD/DVD.
(j Copy to CD/ DVD

ay Settings Setting: this is part of the Deployment Settings which are discussed in greater
detail in a later chapter.
PowerShell Studio - Basic Orientation I 67

iiJ Package tt:J Bud a!l Build all: builds the packager, MSI installer and runs the deploy
co1mnands.
~-
If;;, Insta er f;=j cancel b d
CY Deploy
Cancel build: cancels a running build co1nmand.

Deploy
68 I PowerShell Studio - A Comprehensive Guide

i
.........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................;
~ ~

:) Start Page
Start Page: opens the SAPIEN Po\verShell Studio start page.
f~T Opbons
ITJ Panels O)ltions: opens the Po,verShell Studio options page.

I':. Call Stack Panels: There are 16 different panels to select from that will be used during fonn
II Console designer, scriptiJ1g, and debugging.

lllJlti-- Debug Panels that are highlighted in blue are currently being displayed already. Simply
click to display a pai1el, and click again to hide the pai1el.
[i] Debug Console
IA Find Results Keep in miJ.1d that it is best to only open the panels that you need at the tiine for
what you are working on, this will minimize clutter and 1nini.J.nize the ainoru1t of
I0 I Function Explorer men1oiy that is beiI1g used for each open pa11el.

~Help *The performance panel is available with version 5.3. 130 at1d later.
~ Object Browser
[] Output
I~ Performance
IBID Project
[Il Property
I~ Snippets
lt;'; JToolbox
ii Variables
60 Watch

2.2.2 Designer Tab

-
!fli I) . g . ""' 0 "' ni

.. -
R
~ ~ ''
Pastie

Ooboo<d
l:Q"""
""C>""'

~
r:::;i
Pt~

-
GUI
-
gg 561 ..
)( Ocl<tt
&it
Todo

il -- . . . . . .
ScuttC>""'
s- -""' m
-':I _...,,,. .;. -
..... Y-

C,...,..,.
m"'""""'"
:O s.nToC>Od-
JI 5'n: To eon -
S:o
... .."""""""~
T~vr!'tal~e
lJ C.OIC< "'"""'""" ... ""'1 To "'""
lJ Ccnlc1 """""' 'la SmHo Bod<
[!]
>Dfly
PY'apefty Set
~ 0 .... -.nvs.1
fj; o ..,.eon... s.t
6] Cteott Form Tendb-tc
,........
~
"'...
At.ftrenct.
t<elp

The designer tab contains functions related to forms 1nat1ipulation and creation.
PowerShell Studio - Basic Orientation I 69

j i
!.................................................................................................................................................................................. ...................................................................................................................................................................................................................... ~...................................................................................................................!

Paste: this "vill past object(s) iI1 the Windows clipboard to the current form with the form
[~Copy
designer.
~ ~Cut
Paste
Copy: used to copy a selected object(s) within the form designer to the Windows clipboard.

C pboard
Cut: used to cut a selected object(s) from the current fonn "vithin tbe fonn designer to the
Windows clipboard.

: !
f..............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................!

Preview GUI: allows you to preview the design of the GUI \Vithout runnit1g any scripts within the
GUI.
Preview
GUI
Preview

1.........."......"........"''.....................................................,.._..................................................-................................................................................................... t

It...............................
EDIT ...............................................................................................................................................................................................................................................................,_,,........................................................................................................................................................................................................!I

gg Select AD Select All: selects all controls on the active fonn.

)( Deete Delete: deletes all selected controls on the active form. *Be careful with this one, luckily there
is an UNDO button!

Ecit

,.i ......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................,i

IE- Align Lefts i"f Align Tops These tools are used for aligning two or inore controls on a fonn.

I J. Align Bottoms -ti - Abgn MiddJes


.::1 Ahgn Rights . ; Align Centers

Alignment
70 I PowerShell Studio - A Comprehensive Guide

i
...................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................;
~ ~

r, These tools are stated to be used for resizing a control to its content. However, I've
r..J Size to Control
also noticed that it can be used to make one of inore controls all the sa1ne size. This
~ Size To Control \'Vidth depends on the order of the controls that you select.
20 Size To Control Height
Size

In this exa1nple, "ve select the smaller buttonl first, then the second button2.
Notice the first control selected is st1rrounded by a wbite box, and every
subsequent co11trol selected after it is surrounded by a black box.
0 0- -O
O btilonl 6
d= = o = o


btilon2
-,.'
~ --- ==

o9 Form ~I I~ Click "Size to Control" ai1d notice that button2 becomes the same size as
- buttonl .

0 0 .. 0
O btilonl o
0 QC 0

---
btilon2
-=

aO Form ~I ~ I~ In this exa1nple, you will notice that buttonl is larger in height than button2.
Here \Ve have selected button2 first and button I secondly.

- =.,
! -

bt.ttonl
By doing this "ve are saying basically that "ve want button I to be like button2.
We could do the reverse by selecting the controls in the reverse order.
= == l
PowerShell Studio - Basic Orientation I 71

aC Form ~I 9 I~ If we then click on " Size to control height", notice that buttonl is now the
------== same height as button2. We can do this san1e type ofma1lipulation with "Size
to control width" .

o- o- o
o btiton2 o
o o= o

L........................................................................................................................................................................................................................................................................~........................................................................................................................~...............................................................................................................J

I I Equalize Horizontal Space


These tools are used to equalize the spacing, either horizontally or vertically,
between two or more form controls.
-
~ Equalize Vertical Space

11U Form

.._, Before ~ Form

""'"'
I

- -

Ji
i
r............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................

B Center Honzontafty u Bnng To Front These tools are used for marupulating one or more controls on the
active form.
E8 Center VerticaDy Send To Back
-,}
_.l Tab Order

Position
72 I PowerShell Studio - A Comprehensive Guide

Center Horizontally

- - - - ~00~
aO Form aO Form
-
btitonl r btitonl

Center Vertically
aO Form aO Form
----~-
r:EJOO~
btitonl

... btitonl

Bring to Front/Bring to Back: used to bring controls in front of or behind other controls.

Tab Order: Tab Order works to help you set tl1e order in which you cru.1 tab through the form elements. This means
tl1at when you are in the form and you hit the Tab key, each ele1nent will be highlighted in a certain order.

The Tab Order button is a toggle. That nleans that one click turns it on and another tunlS it off. To display the tab
order of the form ite1ns, si.J.nply click the Tab Order button and each element on tl1e for1n will show its tab order on
the left.
- 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 O O O O H O O O O O O O O O O O O O 0 0 0 0 0 0 0 0 0 0 0 0 0 . . . . 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 O o o o O O O O 0 0 0 0 0 0 0 0 0 0 0 0 0 0 O O H 0 0 0 0 0 0 0 0 0 0 0 0 0 OOOOO O O O O 0 0 0 0 0 0 O O O O O 0 0 0 0 0 0 0 0

al Fo m

llbutton2 ]
button1 ]

Notice the tab order itself is a zero-based array. Zero is the first tab, one is the second tab, and so on and so fortl1.
To change the tab order simply click on one of the ele1nents until the nmnber you want appears. You don't have to
click on the tab order nu1nber itself, just clicking anywhere on the ele1nent will suffice. Clicking on the ele111ent
PowerShell Studio - Basic Orientation I 73

siinply cycles through the available tab orders. As you click on the ele1nent, the number \vill increase. And once
you reach the end of the available tab orders it will start back at zero.

Tab order can also be set in the control properties for each control; however, tab order is much easier
set using the Tab Order control tool.

1..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................)

Property sets are applied by selecting one or inore controls on a form,


f!] Create Property Set
[!] ., ..
CJ: Create Control Set
pressing the Apply Property Set button on the Designer ribbon, pressing
Ctrl+L , or by right-clicking on the control and choosing Apply Property
Apply Set fro1n the 111enu.
Property Set IE] Create Form Template
Templates
A property set is a collection of property settings that can be applied
together to one or 1nore controls. Property Sets allow you to create a consistent look and feel for your GUis; they
are like the web concept of CSS files. A property set can be generic or specific to a type of control.

Apply Prope11y Set: this will show a predetermined preset list of styles that can be applied to the control selected.
The list "vill change depending on the control selected. As seen in the exa1nples on the next page; there different
property sets for buttons a11d text boxes.

Select Property Set x


Select Property Sets:
p
L
00 Anchor Bottom left
Anchors the control to the Bottom Left

00 Anchor Bottom Right


Anchors the control to the Bottom Right.

00 Apply Console Font


Set the font of selected controls to a console fnencly font: COlllef New

Cancel Butto n
11] Converts the button to a Cancel button with OialogReslit.

OK Button
[i]_Converts the button to a OK Button with OialogResUt.
L Show p.-operty sets for same type only I Select J Cancel I

Figure 42 - Button Property Set


74 I PowerShell Studio - A Comprehensive Guide

x
Select Property Sets:
p
Andtor All Sides
00 And'lors the control on al Sides.

00 Anchor Bottom left


And'lors the control to the Bottom Left

00 Anchor Bottom Right


And'lors the control to the Bottom Right.

00 Apply Console Font


Set the font of~~ controls to a console ~Y font: COU'lt!f New

lL Show property sets for same type only c


cancel ]

figure 43 - Text Box Property Set

Ifyou modify a property set after you have applied it to controls, you must reapply it to those controls.
Your changes will not be autoniatically applied.
Create Pro1>erty Set: You can create your own property sets that encapsulate local branding requirements
or other useful settings. To do this, first set all the control properties that you want to caph1re. Then select a control
and press the Create Property Set button on the Designer ribbon or press Ctrl+Shift+L.
Create Property Set x
Ten1plate Source: Select Properties:
Sbuttonl: System. Windows.Forms.Button [E 1.1:1 .~11.1. t ~ u

Limit to: AccessbleDesa1>tion


Matdwlg Type
I AccessibleName
blttonl 0 Accessib!eRole
I A1ow0rop
D Anchor
Creator Han1e: l AutoElpsss
Jeff l Auto51ze
D AutoSizeMode
Company: D Bad<Cotor
[ D Badcgrot.nd!mage

. Description:
0 Backgroundlmagelayout
[1 CausesVaidation
of the property set. 0 ContextMenuStrip
D arsor
v

Create I[ Cancel J
figure 44 - Create Property Set

When the " Create Property Set Ten1plate" dialog appears, select the properties that should be captured by tl1e
property set. Use the Limit to: selector to specify whether yo1rr new property set can be used vvith any control, or
only controls that are the sa1ne type as the source control. You nlust also add a description before you can save the
PowerShell Studio - Basic Orientation I 75

new property set. The next time you apply a property set, your new property set "vill appear in the list of possible
choices.

There is currently no way to alter a property set. They must be re-created and re-applied to the control.
Maybe this is a feature that will be included in a future version release.

Control Sets: In the saine way that property sets allow you to group together property settings for reuse, control
sets allow you to combine 1nultiple controls and script code into new custom controls that can be added to forms
just like standard controls.

Creating your own control sets is another great way to build reusable components for your scripting tasks.

Start by adding controls to a fonn, configuring their properties, and writing all the code required to inake your new
control set function correctly. Once done, select all the controls that are to be included in the control set and press
Ctrl+T or right click on the code editor pane ai1d choose Create Control Set.

Create Control Set x


General L Fu1ctions

Control Set Infonnation:


Control Icon: lili Chart v

Creator Name: ~
Company: [AAMs, Inc.
Control Set Description:
' lnsert a Chart that displays rurnng processes when a button is pressed.

Control Insertion:
Control Action

cancel _J Next

Figure 45 - Create Control Set

The Create Control Set dialog allows you to set the properties of your new custom control. On the General tab:

Control Icon
Choose the icon you would like to associate "vith you control when it is displayed in the toolbox.
Creator Name
Enter your name; tl1e default value for this field is taken from your SAPIEN license.
76 I PowerShell Studio - A Comprehensive Guide

Company
Enter your company name; the default value for this field is taken fro1n your SAPIEN license.
Control Set Description
Provide a description of your control set.
Control Insertion
If you have included any non-visual controls you can use the Control Insertion section to define what
happens whe11 your custon1 control is added to a fonn. You have three choices as described below.
a. Always add the non-visual control
If you add your ne\.v custom control to a fonn that already has a control called timerl on it
PowerShell studio will renrune the new timer and modify the code in your custom control to use
the ne"v naine.
b. Use existing type
If the destination form already has a control of the same type (Timer in the exa1nple) then
PowerShell Studio \.Vill not add a ne\.v control but rather 1nodify the code to refer to the existing
control.
c. Use existing type (match name)
If the destination fonn already has a control of the same type (Ti1ner in the exa1nple) and the
name 1natches tl1e nrune in your custo1n control PowerShell studio will behave as in b - i.e. use
the existing control. If the names do not match, then PowerShell Studio will add everything in
your custom control to the fonn i.e. it \.Vill behave as in a.

Wl1en you press Next you will be taken to tl1e Functions tab \here you can choose to include ru1y functions from
your code in the template.
-.,,,-,. -
,,.,,,.-,,,.. - -- - - - - - - - -- - - - - - - x
-~

General """""""
s.Ject ~ to !nci.de (Ml1cllons ~ n ......,ts wl be """"""bC211Y nck.dtd):
Functions:

' . til """""""


r .J G refresh
-' 0 Load.a.art
]0 O.ar-o..rt

PowerShell Studio will automatically include functions that are bound to events in the control. Click on Finish
ru1d give your Control Set a na1ne. It \ill now be added to the Toolbox.

If you include an entire form in a control set, PowerShell Studio will add an extra tab to the Create Control Set
dialog.
PowerShell Studio - Basic Orientation I 77

General Container Ftxlctions


Create Control Set

The selection induded the form control. Please select the properties and events to apply:
Select Form Properties: Select Form Events:

0
Accessibility
Accessibl eDescription
" 0Behavior
Load
0 AccessibleName
0 Accessibl eRole

Appearance
0 BackColor
0 Backgroundlrnage
0 Backgroundlrnagelayoul:
0 Cursor
0 Font
0 ForeColor
0 FormBord erStyle
0 RightToleft
0 RightToleftLayoul: ...,
-< > < >

Previous l

Figure 46 - Container Tab

The container tab helps you to specify which form property values and event handlers should be included in the
control set. The next time you need to use your nevv control set, simply drag it fro111 the toolbox onto a fonn.

Create Form Template: PowerShell Studio co1nes with several pre-defined templates as shown below, hovvever if
none suit your needs, you can create your ovvn.

CC' r m T.,..,plt x
Preview: Templates:

[Er x - P]
fmptyform
@J Oceatos aner.>ty Fenn

Dialog Style Tomplate


@J Creates fixe<I bordor form thath6s no~ or _ , . , butlllnS
Explo"" Style Template
@J O'eatos an E>llber style layout ..tn Tree and List Control

fuD Grid Search Template


@ Creates a form ,.th search capallibos and a gnd that Ills !he wndow
!!=========!! ~ cb>lo_y thcr~ts. v

LS0oct~ I c-e J

Figure 47 - Form Templates

To create a ne'v fonn template, click on the " Create Form Template ' in the Te1nplates section of the ribbon bar.
Neh't you will be presented with the Create Fom1 Ten1plate dialog:
78 I PowerShell Studio - A Comprehensive Guide

Create Form Template X

Preview: Template Infom1ation:


Name: Test Template

Type: Form Template


3
~

,p C> El ~
Creator: !Jeff
Company:

Oesaiption:

r
b<.Clonl

ti..c!an3

Figure 48 - Create Form Template

Novv fill in the form properties:

Name
Give your template a naine.
Type
PowerShell Studio supports two types of te1nplate:
o Forni teniplates
o Grid templates
If your fonn does not include a D ataGridVievv control this option will not be available
Creator
Your name. This value is taken from the U senlafile set in the General tab of the Options dialog.
Company
Your company details. This value is taken fro1n the Organization set in the General tab of the Options
dialog.
Description
A description of the purpose of the template.
Target grid
This option only appears if you are creating a grid template. In cases where a form has more than one
grid, it allo,vs you to specify which grid auto generated code will use.

Fill in tl1e form and press Save. Your ne\\1 template will novv be sho,vn whenever you create a new form, just like
the standard templates.
PowerShell Studio - Basic Orientation I 79

j i
!.................................................................................................................................................................................. ...................................................................................................................................................................................................................... ~...................................................................................................................!

~
This is a great resource for finding all the properties associated with each control in PowerShell
Studio. When you install PowerShell Studio a PDF is saved at
Control
"C:\ProgramData\SAPIEN\Docu1nent EArplorer\Content\Quick Guides\WinFonns Control
Reference Reference for PowerShell.pdf', you click on the Control Reference button or you can access the
file directly.
Help

There are several docunients located in "C:\ProgramData\SAPIEN\Docunient Explorer\Content\Quick


Gu.ides " that are great to look at, including some Getting Started rnanuals, and a Script Signing Made
Simple guide.

2.2.3 DEPLOY TAB

D
~ ""'
,. 0 6(') na ....

Home Designer Deploy Toos Source Contro Help View

... .., &.ad -- ~-Deploy


~
r~~

Export Exportto
=-+ Settings
~1 Btrnd &Run
Settings
'"'' Buid
Ccl insta ~
Settings

H~J Send to .. .
to Frie C pboard Run Q Urunsta (j Copy to CO/DVD
Export Padcager Insta er Deployment

The deploy tab contains tools to create packaged executables, MSI installers and deployment procedures.

: . :
i ................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................J

Export to File: eArports tlle currently active script to a .psl file.


~~
Ex1>ort to Cli1>board: exports the Clrrrently active script to the Windows clipboard.
Export Export to
to File C pboard
Export
80 I PowerShell Studio - A Comprehensive Guide

i
...................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................;
~ ~

.. , ~d
PowerShell Studio makes it easy to customize the executable files that you create. If
you have never used the Script Packager in PowerShell Studio, when you click
i11 Build &Run Package, PowerShell Studio opens the Packager Settings window.
Settings
Run
Packager The Script Packager contains
? !f t pd

(f SO'IK~ l#Qtf: Mcl'elO't.,,,...,...,61


everything you need to create your CJOl.itM: Stt!llV SO'OI ~ -
______: w~~VlHOr.t~~
package. 0tqom,Rft111cw. I WllN~VZ.Hoct~
SA?rel~V2Holt~,...,

--~' SM'lef~V3Host(CCllMlll'(llne)
(0 ~~':Ion Wl!NPawerShel Vl~ (WlidDws.Pcns)
SAPl!N~V)Hos.t~
~---! Wlef~\IStUt(CO'!'fl'lll"d...,
: MC10Door"a WIEHF'OMrShdVS'10K~,.,....,
S'l'ffH~\tSH!nl~)

~Ol"iv~ror ........... fo'llW''*"'w..NotM.i~~


MlOl"aMCI. N.~11111t.r:OOn~''.rwi. ~.

SCRIPT ENGINE SETTINGS


Script Packager - ttst.psf x
[ i) So1lt Engne Targ<!t: 'M eiosoft Wiidows 32 and 6'1 Bit
. ' ' '
- --- ----- - - - - - -- --..::J
So1lt Engnes:
Cl OulPUt Settings
>--------< SAPIENPowe'Shel V2 lio$t (Commandn)
SAPJSll Powe'Shd V2 lio$t (Wlndows Foons)
SAPJSll PowerShel V2 lio$t (Wnclows)
t------"""" SAPIEN Powe<Shel V3 Host (Ccmnand n)
CO
Versoon Infurmabon SAPIEN Powe-Shel V3 lio$t (Wndows Fonns)
> - - - - - - - - < SAPIEN Powe<Shel V3 HcY.;t (Wlndows)
SAPIEN Powl-erShel VS lio$t (Ccmnand n)
SAPIEN PowetShel VS Host (Windows Foons)
-
SAPIEN Pc>werShel VS Host (Windows)

Windows Foons Engine


Powe-shel only "'911" for Wndows Forms appic;abOnS. Normal Pov.~ output is
SIJl)llr6Sed. Al l.l5er 11ieractlon nw.ist ocax Wll!W'l a form.
-::;;;:;::::... Operatn,j systen: Mcrosoft Wndows 32 and 64 Bit
-==- So1!t execullOn: In rnemocy
- r:;:::
Powe-Shel Version: s.o I 5.1
--
OK cance J

Figure 49 - Script Engine Settings

You will see a list of available script engines that you can choose fro1n, first follo\v by the Po\verShell version you
\VaJlt to require, then followed by the Fonns Engine; Conm1and Line, Windows Fonns, Windows.

Command Line: executes your script in a console windovv, output can be redirected.
PowerShell Studio - Basic Orientation I 81

Windolvs Form : PowerShell only engine for Windows Forms applications. Nonnal PowerShell output is
suppressed. All user interaction must occur within the foIID. *This is tl1e type that you 'ill most likely use the most.

Windows: Yotrr script is exectrted as a Windows application ' ithout a console. h1put and output is presented as
dialogs and message boxes and cannot be redirected.

Microsoft Wtndows 32 Bit


Microsoft \tV111dows 64 Bit
Microsoft WindoNs 32 and 64 Bit
Microsoft Vifindo1#\'S Native

1. Microsoft Windows 32 bit, which \Vill generate a 32-bit executable.


2. Microsoft Windows 64 bit, which will generate a 64-bit executable.
3. Microsoft Windo\vs 32 and 64 bit, which will generate a 32-bit and a 64-bit executable.
4. Microsoft Windo"vs Native, which does t11e san1e as above (with different nanling) but also creates a
statter executable, which \Vill launch the correct version for you.

Native Windovvs Platform, \Ve will go into more details on that target selection because it can be confusing.
(SAPIEN Teclu1ologies Inc., 2016) Choosing tllis build target will put all the files in a folder called bin\Jlny
platjornt. You will get a MyApp.exe, My Appx86.exe and My Appx64.exe. Additionally, .config files are generated
for each of the1n if you checked that option. The MyAppx86 and MyAppx64 files are your actual packaged script.
The My App.exe file is a starter applicatio11 that "vill execute the right package for the current platfo1m. For your
application to work, you must install or deploy all three files together. The starter application receives the same
icon, digital signature and manifest as the packaged files, so a shortcut to that file will create the same experience.

STA Mode - Single-threaded apaitment. The default is multi-tlrreaded aparttnent.

STA (Single Threaded Apa11111ent) and MTA (Multi-Threaded Apartinent) dete1mi11e ho\v a process 1nanages legacy
COM objects and their co1nn1unication \Vith inultiple threads. I \ Vill not go into the detail, but you need not concern
yourself witb the innervvorkings of COM objects, other than to remember that STA is required for some of the GUI
controls to ft1nction correctly.

The following controls require STA 111ode. Otherwise, they do not appear.

Folderl3rowserDialog
SaveFileDialog
OpenFileDialog

Tl1e following control features require STA mode.

TextBox \vith AutoCon1pleteSomce


ComboBox \vith AutoCompleteSource
DataGridView with Ctrl + C to copy text in cells.
Form \.Vith TopMost property set to True.

STA mode is 11ot somet11ing you nonually have to consider when vvriting scripts, but it is something that you sl1ould
be a\.vare of if you are creating GUis tools. Most GUis will run fine in MTA mode, but as a rule, you should always
run yom GUI scripts in STA
82 I PowerShell Studio - A Comprehensive Guide

You can make sure that your Windows Po\verShell scripts require STA when running. If you add the
following comment to your script, PowerShell Studio and PrimalScript run the script in STA mode: #
%ForceSTA% = True

OUTPUT SETTINGS
Script Packager - test.psf x
,----
'" SO'ipt Engne
~
Engne Settings
Output file: ltest .exe
D output Sett.lg$ Output fulder:

IconF4e:
0 Exea.ibo!l Restnctions
~ Generate .config fie :J Resolve and include external saipts
re Version Information
Manfest Qeabon

= &.lld Options
[En-bed a defaUt manfest
Custom Manifest: _______________, I,.
...___ ~J

Alternate Credentials
Usemame: Password:

Rl.r1 Mode: [CUrrent user

Sigt'wlQ
Cerbficate:
~---------~ [Q]~
PassWOl'd:

_ .dl_ _ _ _ _ _ _ _ _~
Tmestamp URL: [ht:t;>:/{bmestamp.globalsql.com/sajpts/bmStamp

OK I[ Caned

Figure 50 - Output Settings


Out1>ut File: Filenaine of the executable.
Output Path : Path to the executable. Since the packager can now generate multiple targets with the sa1ne name, it
can no longer place these files side-by-side \Vith your script. Instead, the executable files are generated in a platform
specific folder under a con1illon folder. The co1nmon folder can be specified in the packager options and defaults to
"bin" .
Icon File: You can specify a custom icon (.ico) for the executable .

Generate .config file:

Resolve and include external scripts: A great many users indicated that they dot source files \Vith coilllnon
functions. Since these are external to a packaged script, they needed to be deployed with the executable. That created
the need to create an installer for an otherwise simple application, required a review or change of script execution
policies and, finally, opened the application up for user intervention by editing the external script files.

So SAPIEN added an option to resolve dot sourced files \vhile packaging. If the option is enaJbled, the code of the
external scripts gets injected into the packaged script when building the executable.
PowerShell Studio - Basic Orientation I 83

Files specified '\-Vith or without single and double quotes are supported. Files that do not exist will issue a
warning. If you have a dot source staten1ent inside a co1n1nent block, the file will be inserted into the
com111ent block.
Using a line comment will prevent a file fro1n being resolved.
If you need to resolve only some but not all exten1al files, you can use a different case for the file
extension.
. ./include/lib.psl \Vill be resolved by the packager,
. ./include/lib.PSI will not be resolved.

Manifest Creation: Options for the 1nanifest file, including a custo1n 1nanifest.
(This is an executable manifest, not a Windows PowerShell 1nodule manifest.)
Alternate Credentials: Uses the credentials of the specified user to run the scripts in the executable file .
Signing: For script signing I recommend that you read "Script Signing Made Simple" by Jeffery Hicks. You will
find a link to it in your "Docmnent Explorer'' under Quick Guides.

#Who forgot to comment this code?


84 I PowerShell Studio - A Comprehensive Guide

EXECUTION RESTRICTIONS

Script Packager - test.psf x


(J ~t Etlglle
I -
Operallig Systems:
....... Wndows 10 I \Vndows Server 2016 (VerSIOO: 10.0)
"
-
D 0u1put settngs 0
I Wndows 8. 1 / Wndows Server 2012 R2 (VerSIOl'I: 6. 3)
[, ~Vndows 8 /Wndoy,,'S Server 2012 (VerSIOl'I: 6.2)

0 Exea.ibon Restncbons 0 \Vndows 7 /Wndoy,,'S Server 2008 R2 (Version: 6.1)


C Wndows Vis121 /Wndows Server 2008 (Version: 6.0)
- C Wndows XP 6~t Edbon /\Vndows Server 2003 /Wnclows Server 2003R2 (Version: 5.2)
-
ra VerSIOO Infonnabon 0 Wndows XP (Version: 5.1)
v
0 w~ Oter<ll'.lft c; QL_

I::: Bu1d Options


Usemame: I
MAC adess: I

I
MadWle~: I
Oomarl: I

r Alow only~ ins~

-
I OK I Cancel ]

Figure 51 - Execution Restrictions

The execution restrictions allow you to li1nit the environment in "vhich the package runs including; operating
systems, specific username, MAC address, Machine na1ne or do1nain.
Each field accepts se1ni-colon separation so you can restrict to 1nore than one. For exa1nple; usema1nes
"John;Bill;Ton1" would require that the logged in user be one of those listed or the user would not be able to execute
tl1e package.
The sa1ne goes for MAC address, Machine name, and
Do1nain.

You need that script in an hour ... ??


PowerShell Studio - Basic Orientation I 85

VERSION INFORMATION

Script Packager - test pd x


Fie VerSIOO: 2.2.1.0 Product Version: ~- 2. 1.0

D 0u1put Settings Product Name: My Application

0 Exeo..ition Restndlons Desa-.>tion:


'
Ths application is used for restrig ptXJX>SeS.

ra VetSIOO Information
Company: ARMS, Inc.

=
I,_
Buid Options
Copyright:

Internal Name:
.---
I
Copyright (c} 2016 Al r9Jts reserved

Ongnal Rename: test

Comnent:

L OK JI cancel

figure 52 - Version Information

Most of these fields will not be a surprise if you have ever worked with any applications. The file version requires
a for1nat of x.x.x.x, this inean you must supply a four-digit version nu1nber such as; 2.2. 1.0
If you are familiar with Visual Basic, " Auto-incren1ent file version" vvill not be new to you. If you enable this
feature each ti1ne that you build your package it '1vill auto-increment the package version.


~

~
.,.
'W

Scripter on vacation!
86 I PowerShell Studio - A Comprehensive Guide

BUILD OPTIONS
Script Packager test.psf x
!Pre-build commands

I
Cl Output Settngs
0 ExeaJtion Restricbons
' ra v~ "'"""boo j
= &jc!Opbofls

-
Post-build commands
I

Figure 53 - Build Options

3
If you need a pre-processor for your script or you want to do son1ething to the final executable, add your co1nmands
here. They will be executed in the sequence defined and one after another rather than in parallel.
Build: 'Build' applies all your settings and creates the actual executable file. 'Run' executes that file. If you picked
.. ~ ~d a comn1and line engine, then the package is executed in a shell \vindow. Depending
.. on the file packaged, this is eitl1er a PowerShell console or a regular cn1d \Vindow. If
~1 &nd &Run you picked a for1n or Windovvs engine, the file is executed directly.
Settings
Run Build & Run : build and run the package.
Packager Run : this will run the current package.

. ............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................,,

-
..lrtl Bukl MSI Settings: provides settings 11eeded to create Windows Installer files (MSI) for
your scripts, inodules or packaged executables.
C'rj Ins tan
Settings The SAPIEN MSI Wizard uses parts of the Wi.X Toolkit to create Windows Installers.
Q Unrtstal The complete WiX Toolkit can be found here http://,viJ\.1oolset.org/
Insta er

3
https://www.sapien.com/blog/2014/03/25/fro1n-script-to-server-deploying-solutions-with-primalscript-2014-part-l/
PowerShell Studio - Basic Orientation I 87

PRODUCT SETTINGS

MSI Settings - test.psf x


Prod.let Det:ais
.
Prod.let Name: test I
I Fies I Folder Product Version: 1.0.0.1
JL
Enter a version runber (e.g. 1.2.3.S) or a path to an existi'lg executables file. If a file is
speofied, the ProductVerSIOll stmg from tis rescxxces wil be used.
COl11>MY Name: I
Prod.let Type: ~ws Appkabon v

Prod.let Icon: l c:'y>rogram Fies (x86}\SAPIB"Technologies, lnc'fowerShel Stucio 2016~c l l:'S


MSI Opbons
64 bt 11Sta!er
~ fnstal fur al users

>./ Requi-e Aclml'lislTator

Mnm.m PowerShel Version required: lPowerShel VerSIOf'I 3

.
OK Cancel

Figure 54 - Product Settings

Product Name: this is the name that \vill be displayed in "Progra1ns and Feattrres" after installation.
Product Version : The version nmnber. You should incre1nent that number "v henever you create a new build of your
product. The installer will use that nmnber to detenni11e if the specific product version is already installed. If it is, it
will not install. If you created an MSI with a higher nu1nber, it "vill uninstall the old version and then install the
newer one. *Notice there is no auto-incrernent file version when creating a11 MSI, as there was with creating ai1
EXE.
Company Name: tllis is the name that will be displayed in "Prograins and Featt1res" after installation.
Product Type: Yotrr selection here, together with tl1e "64 Bit installer" and "Install for all users" options detemline
\V here your files are installed.

The following table sho\vs the locations for 64-bit OS with "Install for all users" selected
-----------------------------------------
PRODUCT TYPE 32 BIT 64 BIT
Windovvs Application C:\Program Files (x86)\Product C:\Progra1n Files\Program Name
Name
Script Application C:\Program Files (x86)\Product C:\Program Files\Product Na1ne
Na1ne
PowerShell Module %Windir%\SysWOW64\ %Windir%\Syste1n32\
WindowsPowerShell\vl .O\Modules\P WindowsPowerShell\v1.O\Modules\Product
roduct Naine Name
I
88 I PowerShell Studio - A Comprehensive G uide

The folloiving table shows the locations for a 64-bit OS w ith a current user only selected

PRODUCT TYPE
- -
I 32 BIT - -
64 BIT
Windows Application C:\Program Files (x86)\f>roduct C:\Program Files\Program Name
Name
Script Application o/oHomePatho/o\Script %I-IomePath%\Sc;ript Applications\Product
Apphcations\Product Name Na1ne

PowerShell Module %HomePatho/o\WindovvsPowerS %Ho1nePatho/o\WindowsPowerS11ell


hell \Modules\Product Name
\Modules\Product Name

Product Icon : This icon file w ill be embedded in the MSI file and shown in "Programs and Features" with your
product.

64-Bit installer: Checking this option prevents installation on 32-bit OS. It also registers COM components as 64
bit co1nponents and changes some folder na1nes as indicated earlier.

Install for all users: This \Vill install the application and its shortcuts for all users on a system . In most cases this
option \:vill require administrative privileges. It also affects the install folder location for some product types.

Require Administrator: Checking this option will cause Windows Installer to prompt for elevation on Windo,vs
Vista or higher. The type of prompt depends on your local UAC (User Access Control) settings and the currently
logged on user.

Minimum PowerShell Version required: select the 1ninimum PowerShell version that your application requires
to run, any version less than that is detected a prompt to install the 1nini1nt1111 version will be displayed and the
installation aborted.

If you use an installer prograin such as InstallShield, you can include the files for the 1ninilnu1n PowerShell version
as a prerequisite. I have also used this to install required PowerShell Modules for applications.

4
Another rather interesting method is to create an Elevated manifest.exe which copies the modules to the correct
folder. In yourpri1nary exe or application (at the very first part of your code) make an " if (!(test-path $module_path)
{start elevated.exe }" . This \.viii prompt the user \.Vith an elevated message if they \Vant to install the 1nodule. Once
it's installed once, it will bypass the elevated install next time the app is ru11 because the test-path is true.

Scripters definition of a Zero- Day

4
https://www.sapien.com/forums/viewtopic.php?t=7894
PowerShell Studio - Basic Orientation I 89

FILES AND FOLDERS


MSI Settings - test. psf x

r;-oduct Detais ] Files (drag and drop files here)


~ /Folder S- ~P C: Tn'

Create Shortait to: [(SO\Kce Script) "l


MSI Name: test .ll'ISI

Output Folder: Ire I


1~sers\leff'l>ocunents\SAP!EN'fowerShel Studlo'files I

StaoiigFokler: r..________________,11 r:o I

Figure 55 - MSI Settings (Files/ Folders)

Files: These are the files that you installed. Arrange and name them exactly as you ' vai1t tl1em installed on the target
machine. Please make sure that you don' t have any stray temporary files in this folder, because anything here will
be included in the MSI file. If you have COM object DLLs, just place tl1em here as well. They will be recognized
as such and registration information will be extracted at build ti1ne.

Create Shortcut to : Select the file you want to create a shortcut to in the Windows Start 1nenu. Currently, you can
only select one file. Typically, this is your main executable or sc1ipt file. For PowerShell modules, you can link to
the help file for example.

MSI Name: The filename for your MSI. This only affects tl1e actual MSI file and not any of the internal names.

Out 1l ut Folder: This specifies the location where you want the MSI file to be created. Do not use the staging folder
for your software for this or your previous M SI file vvill be included in the next re-build. If you have not loaded a
wizard settings file fro1n someplace else, a .1nzw file with the same base na1ne as the MSI name you specified will
be created, tl1at file contains all the setting you entered into the wizard' s dialog.

Staging Folder: This is the location of all the files that you want installed.
90 I PowerShell Studio - A Comprehensive Guide

SIGNING

MSI Settings - test.psf x


Product Detais Certificate: I l [i] ~
I
Fies /Folder
Password: I
Time:starrc URL: [http://trnestamp.globalsql.com/~tsjlmstamp.dl I
~ 0 Use the SlgrW1g Vfizard to Sl9'l the MSI fie.

I OK I[ Cancel ]

Figure 56 - MSI Settings (Signing)

Certificate: A certificate is either code signing certificate installed in your local store or a PFX file you specify in
this fields. You can browse for a PFX file using the file browse button or using the certificate button.

Pass,vord: If you specified a PFX file for code signing it may require the use of a password. If so, please enter it
here.

Timestam1> URL: This URL is used to create a time stamp for the signature used to sign the file. Logging the time
of signing allows you MSI file's signature to re111ain valid even after the certificate expired.

Use the Signing Wizard to sign the MSI file: If your certificate does not fit the above criteria or if you need to
sign \vith a different signature each time you are building an MSI, you can use the Microsoft Signing Wizard. Any
settings entered above will be ignored and the wizard \Viii guide you through the signing process.

Build : creates the MSI installer package based on the settings you configured.

Install: this will install the current MSI build.


Settings

U ninstall: this will uninstall the current package installed (if it inatches the same
Insta er
version).
PowerShell Studio - Basic Orientation I 91

j i
!.................................................................................................................................................................................. .................................................................................................. .................................................................................................................... ~......................................................................................... ..........................!

Deploy: creates the deployment based on the settings that you configured.
~.Deploy

lldl Send to ... Send To : sends a compressed archive of the deployment files for the active
Settings
(j Copy to CD/DVD
docrunent to an email recipient.

Deployment
Copy to CD/DVD : bun1s the deployment files for the active docu1nent to a
CD/DVD.

Deploy Settings - test.psf x


Mall fie to deploy: I....(Scu
_ ce _ t) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _I"
_ 5CJl> [ OK J
!Additional Files (drag rs::~ Sal>t)
' (Packaged ExeaJtable)
(lnstaler Fie)

Deploy Res to: I

Additional Deployment Commands

Figure 57 - Deploy Files

Main tile to deploy: There n1ust be at least one file to deploy, fro1n the dropdown box you \.viii notice in the example
there are four selections:

None: this is the default and you cannot deploy using this selection of course.
Source Scri1Jt: this is will use your existing script file to create the deploy1nent.
Packaged Executable: this \Vill only be listed in the dropdown if you have first used the Packager to build
an executable .EXE.
Installer File: this will only be listed in the dropdown if you have first used the Installer to build a Windows
h1staller file .MSI.

Additional Files: need to add files to your deploy1nent, drag and drop them into here.

De1>loy files to: this is the location that you want your deployment saved to.
92 I PowerShell Studio - A Comprehensive Guide

Additional Deployment Commands: For the additional deployment com1nands, you can add any co.rnmand line
tools you like or need. If, for example you need to also ftp your MSI file so1ne,vhere, this would be the place to
specify that command. These commands are executed in sequence, one at a time, so make sure you have no blocking
tools in there which 'vill potentially sit all night with a dialog up, waiting for your response.

2.2.4 Tools Tab

rm [j ~ . fii 0 an nl ;

-;J Home

iji Fm il Faes.. .
~]! Compare Fies
Des9'ler Deploy

!]) Ched< Syntax


)'$ Verify Scrl>t
Tools SOIXce Control
~ PmlalSaipt
~ PrmalSQL
~

~ PowerShel ~Wnter
~ VerSIOO Recal
View
EiJ PowerRe<)Ex
ti Profile Ecilxlf
a PowetSJiel Console
a PowerShel ISE
Sign Script
. ~ Custom Tool ~ Analyze Scnpt E:3 PnmalXr-t. m WMl Explorer g/ Update-Help
Fie Analys!S SAPIEN Powe:rShel

The tools tab contains functions pertaining to files, script analysis, and links to external programs.
-...........................................................................-............................................-..................................................-............................................-....................................................................................................................................................................._............................................................................-.............,
'
FILE I
........................................................................................................................................................................................... ...............................................................................................................................................................................................................................................................................................................!
~

- llti F11d in Aes... Sign Scri1>t: This will sign the active docu1nent~ however, you first need to have
configured signing in the "Packager" settings or "Installer" settings. See page 79
~ Compare Fies ai1d 87. The dropdo\vn menu also give you the option to re1nove a sig11ature.
Slgn Soipt
... ~ Custom Tool ...
Find in Files: Ho'v 1nany ti1nes have you been \vorking on something and think
File
to yourself "I know I've \Vritten something like this before but can' t reme1nber
which file it is in. This tool provides the ability to search for a string within either the current document, all open
documents, the current directory, or any directory of your choice and its sub-directories if you opt to.

Find In Files x
Find what: [i#;iii,i!it,l!i!,ij:tiJ~%i!i;:,i,!,fj------------ijr.:v:ll
fr. [2J [ Find in Res j
[ Match case [ Mab:h whole word [ CanceJ _J
Find in: [ CUrrent Document
---------~"- ...1
C Search in subfolders
File types: -*.psf, *.pss, "'.psl, "'.psdl, *.psml, *.pff, *.pfs, *.p...
~

L Use IReguSar expreSSK>ns I I

Match Case - this is used if you \Vant to 1natch the upper/lower case in your search

Match \vhole word - by default if you do not select this option tban eacl1 word in your search string \vill return
results. In the example above the 'vords "Find",, "this", and "string" \vould each return results. If you only want to
find the whole search string "Find this striJ1g", then check this box.
PowerShell Studio - Ba sic Orientation I 93

Find in - here you can select current document, all open documents, the curre11t directory, or any directory you
choose.

Search in subfolder - this does exactly as it says and will search all subfolders beneath the 1nain p ath.

File types-this will be enabled if you selected a specific folder in the 'Find in" option. It will search.all *.psf, *.pss.
*.psl , *.psdl, *.ps1nl, *.pff, *.pfs, *.pfproj, or any files.

Use - you can use either regular expressio1is or vvildcards in you search.

Com11are Files: This uses ScriptMerge to find the differences bet1;veen the active docu1nent and whatever file you
choose. W11en you click on 'Co1npare Files" yo11 \.vill be presented with a browse file window, select the file that
you want to compare \.Vit11 yotrr current active docu1nent in PowerShell Studio. Once you select the file ScriptMerge
will open and compare the two files, highlighti11g any difference, as see in the exa1uple belo\v.

1!1 <P:o~::;-y nU'e-"'li.&l:lll>~<;t.e>n.J</ho-pe_z~v> ...... <PrOP"rt-Y a:e..naaa>tn.lttonJ</hcpc:ny> "'


~!5
J.16
$1-
l.ll
JS:t I
<P-::ope:rt.y nU"'S:.:e.>fi7 . 26</P:opcnv>
<Pt:cpcr:y n~-"'l'btndc.11 >0</Prcpcrt.>?
<P%'CSM:Z<;Y n-.="1cxt>bc;&tt.cc.S</PToP9:Cv>
<Prci>ert.V JU1:11;11-u.eV.i.na..15t.ylchcld:.olo::>trot<fPropcrt\?
.....,
lU < F:ci:-r~v r.eae5~zc>fi,
<Propc:ey
<Ptoi>-:ty
<Pf'Ope-ri.~
16</P:cpertv>
n~Tabladex>C</Prop.e:t)">
naacrcxt >butt.cn-l~/Propc:ty>
n...,... ust'l1ua.1Styl c:8a.c~olo.r>T~o</h'~y>

.......,,
v-.nr; ~*Cl.lc~'">bur;c~_cu~.t :c/ tvt=t> _ __
St </Objtcu - <JOb;icC"'..>
i: t-~ <Ob]Kt typee'"Syoeco.w1noov . !'ont11.eu~t.c.t1, SY>t.cis... w...1.noowa. rouu. \ 'ua1ot11 . O.o <'0.b)Kt cw--..sy~t.a.. ll:ta.c>owa. rorsq.lu:c.on. Syt.,.:.w.1: J)OO'V1t. ronu, '.'e&11an.., .{).O
s' ; <Prope.r:.y e&:c.e:toee:1.0n>14S. i2</Propcrtv> <h'OP-t"t.\ c.e.me-1.oc..r;ic:n >li S. i2</ P:os:-ut:v>
lt:t <Pi:Cpctt:.v na111c-..~:ama >euUon.?</PrQJH:tty> <Property nurion-..~o" >but:.e.e,</~roperi.y>
SCi
S4i
tl4
tr
14
<P:opc:r:.y nemtW5Jzc>70. 1~F=O.Pe~ty>
<P::oP'U'tY utlletblr:a.tu>!</Ptci>c::.y>
<~r~y ~e rt'JCt. >bU::"t.0Da</PrC;>11nv>

'fP~.cy :ia:t.O..-.V:.aU&ll'tyl~clttolorJi >tlili


<tv-e:st J:LU1e-"'Cl.ic1t )batto=a_Q.J.c)t</Eviu;.,..
""lili
/ilil
Prilii
Cl>tn:
iiliil'>
iillll--
..."'
1<S

~''
<Propc::t.y a~5iz c >1 0, 25</P:oprtY,
<Frcpe:rt.y n-...:TobtcdeJC>1</,rope:-t.v>
<Prope:~y n.aeToxc >~t.c.on2</Propercy>
<Pro~t.Y aucUii~:a.u.t.1S;y1cli&ckeolo:>Tru~/Er~rtv>

Sf t </ Ob)c> u <lcrblcct.>


S70 <.Ob3..c-:: :.v;ir Sv c.c=.Wi.naowa. fo_ra, .9ci;.t;cn, Sy:. Wstf4ova. ro:u, V11rr a1cn. o , o <Ob)cct t~ .. Syace11..1~-Fo~.s~::-on, SY'ift.ft:ll4N:r.do"Ws .Fot2Qlf V~scni .O.O
$~.. <P':~te-y o..me Loet1on>12 .$1!</Ptopertp '"
! 69 <~t""Y nuc00 tocitc1 o.o >l 2. $!</ P:-opt rt'i>
t7: <~:op~ a.&a;e-r.--=~>bQ:.tooi</Propcrtov>
,,
~70 <Property o&:&Jt~aat'. " )b\itt.cnl</Prcpe%'ty>
1i3
st
111
<Prop.trcy nlll!le ,1te >TO, 20</Prc~r~Y>
<P:cpe.::.y rl4lll1t..-T.ttl:I0..:>2</P~pe.zty>
<Pi:op ~:.y ruuce 1ax r >tN:.toll1</Prcpt:~Y'> ...
'1Z
<Property
<Pro::.:~y
nea.e 5t~~ >10, 10</P:~t:.i?
aa:sa*T&biadcXw>2<1Prop.e:t.v>
<Prcper:.y caa.Tcxt.w>bu~:cnl</ P rop.r~y>
l"t
5 .. "'
<P"tcpu~y
</Obltte"t>
n uotr.ae.'lla'IMltStvlca&olrtolcr" >true-<JFtcpt tty>
.....,.'
1 <Fro~ r .r. V nai:te-Us&Vl :a 1-5 ~ ;1 e.S.c.i:Co lo!'. ,. true</ FrO"S:tcz e;y>
</~ Ct>
!'71
s I
0
f t J.
(f
</CbJcCC)
<C::Jdo><' l~4f

. SY?llOP'SD
....
f'
.. </ Ob)c o;;>
<C<idc>< I fa>AfJI.[

. SYltCi'S!S

se . o.i.sca1-n10H u
Sii Ut'd t o?" dtmon:.nuo t.hc use or the P.-.taaete.r !dtt.or u
> < >

Figure 58 - File Compare

The file on the left is the cu1Tent active docu1ne11t and the file on the right is the selected file to compare it against.

Ho\.v would yol1 like to 1nerge changes from one file to a11other file? Ho"v about line by line or all difference? This
is a hidden. gem in ScriptMerge that will save you countless hours trying to compare files and copy fu1es back and
fo1th between files.

Simply select tl1e liJ1e that you \.Vant to 01erge, th.en click either
the "Right" or "Left'" button to copy the line over to the other
file, or if you want to copy all the differences folrnd just click
either the "All Right" or "All Left" bt1tto1is. It could not be any
siiupler!

If you frequently compare the same two files, you can save yo1uself a lot of ti1ue by setting up a Scripftvierge Group.
94 I PowerShell Studio - A Comprehensive Guide

1. Create a text file .


2. List your file pairs line by line ~ FilelJFile2 (separated by pipe syn1bol). Exa1nple~
C:\Users\You\SAPIEN\Scripts\Filel.pslJC:\ C:\Users\You\SAPIEN\Scripts\File2.psl
3. Save the file with extension .smgrp (ex. Myfiles.smgrp)
4. Whenever you double-click on the .s1ngrp file, ScriptMerge will open it and compare the two
files.

If you click on the File tab in the upper left, you will see a inenu vvith some other
cool features that allow you to also co1npare folders and compare groups.

Figure 59 - Compare Tool Color Options

You can also edit the color options for the compare tool by using the "Settings"
option at the botto1n of the "File" tab.

Custom Tool: this is another hidden gem that I think is frequently overlooked. There is a tre1nendous ntunber of
tools available in PowerShell Studio, but we all tend to \.Vant inore don't we. SAPIEN had the forethought to add a
great little feature to allow you to build your O\.vn custo1n tools, no\.Visn't that great!

Which commands can I use in a custom tool?

You can run al1nost any conunand, including c1nd.exe co1nmands, Windo\.vs Po,:verShell coffilnands and scripts,
and coffilnands to executable files, like robocopy .exe, netstat.exe, and git.exe.

Cmd.exe: To n1n a cominand that's internal to cmd.exe, precede the command vvith ' c1nd' or 'c1nd.exe'.
Executables : To run a com1nand in an executable file, such as robocopy .exe, git.exe, or ipconfig.exe just
type the conunand \.Vith any valid switches.
PowerShell: To rm1 Po\.verShell cmdlets, functions, or scripts, precede the coffilnand with 'po,vershell'
or 'powershell .exe'. When ruru1ing scripts, be sure to include the full path to the script file. Also, verify
that your local execution policy permits you to n1n scripts.
PowerShell Studio - Basic Orientation I 95

In the co1n1nands, in addition to using valid paraineters, arguments, and switches, you can include variables for
values that PowerShell Studio resolves before it sends the conunand to the editor.

$Pro.i ectFolder$ Path to the current project directory. Valid only when a project is open.
$PowerShell$ PowerShell version number selected on the ribbon.
$Platform$ Current platfonn (x86 or x64).
$WinDir$ Path to the Windows directory (e.g. C:\Wi_ndows).
$WinSystem$ Path to the Windo,vs syste1n directory (e.g. C:\Windo,vs\Syste1n32).
$Sele.ction$ Currently selected content, if any. Might contain carriage return/ linefeed characters.
$File$ Full path to the current file, if any.
$FileName$ Name of the current file (no path).
$FileDir$ Path to the directory of the current file (no file na1ne).
$Dir$ Full path to PowerSI1ell Studio installation directory.
$Line$ Current line number in tl1e active file.
$Col$ Current column in the active file.

You can also prompt for one parameter value ai1d create a custo1n inenu specific to a directory. I'll sho\v you how
below, but keep these features in 1nind as you dreain up your custo1n tools.

How to Create a Custom Tool

To create a custom tool, start with a text file named Custo1nMenu.inf. Place the file in the PrograinData directory
for PowerShell Studio or PrimalScript.

For exa1nple:

..\ProgratnData\SAPIEN\Po,verShell Studio 2016


..\ProgratnData\SAPIEN\PrimalScript 2016

The syntax of the file content is:

[Menu]
l =Command Name l ;command line 1
2=Command Name 2;command line 2
[Application]
1=Comtnand Name 1;command line 1
2=Command Name 2;conunand line 2

You can add additional numbered command lines. The nu1nbers indicate a command line. They do not determine
the order of commands in the file. If the file contains multiple command lines with the same nu1nber, only the first
one witl1 each number is effective.
96 I PowerShell Studio - A Comprehensive Guide

Examples:

5
For each conunand, enter the conunand name, a semi-colon (;), and the conunand.

For exainple, this line creates a 'Run Get-Acl' co1nmand that runs the Get-Acl cmdlet on the current file ($File$),
then formats all properties of the output in a list.

1=Run Get-Acl;powershell Get-Acl -Path $File$ I Format-List -Property *

Sections in a CustomMenu.inf file

There are two sections: [Menu] and [Application]

-
A Find n Ft;es ..
In the [Menu] section, add conllllands that n1n and exit, like
a PowerShell cmdlet. The custom menu waits for the conunand
~ Compare Fies to co1nplete.
Sign Script In the [AJ>plication] section, add co1nrnands that don' t exit,
Custom Tool
like a conunand that displays a file or UI that you 1night vvant to
Run Get-Acl keep open. The custo1n 1nenu runs these co1nn1a11ds and exits
without waiting for them to complete.
Open CustomMenu.inf There is a [Commandline] section that you might hear about,
however it is the saine as using [Menu] .

For example, here a co1n1nand in the [Ap1>lication] section opens the current Custo1nMenu.inffile in Notepad,
and the Run Get-ACL conunand in the [Menu] section. As you can see from the screenshot of the menu
on the previous page, the [Menu] section and (Application] section are auton1atically separated by a
line .

[n1enu]
1=Run Get-Acl;povvershell Get-Acl -Path $File$ I Format-List -Property *
[Application]
l=Open CustomMenu.inf;Notepad 'C:\Progranillata\SAPIEN\PowerShell Studio 2016\CustoinMenu.inf'

5 https://www.sapien.com/blog/2016/05/23/add-custom-tools-to-the-menu/
PowerShell Studio - Basic Orientation I 97

To add a separator line wherever you want, to better organize your menu, enter a line
between two items and use a dash "-" character. Example;

[menu]
1=Run Get-Acl;powershell Get-Acl -Path $File$ I Format-List -Property *
2=Get User;powershell [Environment]::UserName
3=-
4=Get IPConfig;powershell Get-NetlPConfiguration

- A Find in Fies .. .

~~ Compare Fi!es
Sign Script
Custom Too! ...

Run Get-Acl
Get u~er

Get IPConfig

Open CustomMenu.inf

Folder-S11ecific Custom Tools

To create custo1n tools that appear only when the current file is stored in a specific directory, place a
CustornMenu.inf file in the specified directory.

L.....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................l

Cbecl< Syntax: this nifty tool will run through your script a11d identify any syntax errors that
l]l Check Syntax
-
, ~ Venfy Scrrpt
it finds. I reco1m11end doing this after any inajor changes to a script.

, ~ Analyze Script Verify Script: instead of checking syntax this tool will check that 11ave all the required parts
to your script, i.e. if you have Import-1nodule state1nents it vvill verify that you have those
Analysis inodules available.

Analyze Script: this is a co1runu1Iity driven module called 6''PSScriptAnalyzer" . PSScriptAnalyzer provides script
analysis and checks for potential code defects in the scripts by applying a group of built-in or customized rules on
the scripts being analyzed. One of the things that you will notice that it does not like are Aliases, now I know this
will frustrate inany Po,verShell scripters because the 1nain consensus is to make your com1nand lines as short and
as efficient as possible. The upside is, to the beginner it inakes reading your code inuch easier if you use e:x.1Janded
cormnands.

6 https://www.powershellgallery.com/packages/PSScriptAnalyzer/l .8. l
98 I PowerShell Studio - A Comprehensive Guide
,. ..........................................................................................,,.,,.,, ..........................................................................................,,.,,.,, ......................................................................................., ., ., ........., _ ...............................................................................................................................................................................,,.,,.,,1

I,.,...........................................
;
SAPIEN..................................................................-................................................................................................ .. , _,,, ~,
i
..................................................................................................................,_ ............................................................................. ..._,.......................................................................................;
~

~ PMnalScnpt ~ PowerShel Help\'Inter BJ Po'lterRegEx These are weblinks to various SAPIEN products to
enl1ance your PovverSl1ell scripting.
~ Pr.malSQL ~ Version Reca~ fa Profi1e Editor
t:i PrimalXML ~ \A/MI Explorer
SAPIEN

7PrimaJScript: Pri1nalScript 20 16 is the next generation of our industry-leading Universal Sc1ipt Enviro1unent
(USE). As a syste1n, database or network achni11istrator, web developer or e11d-user developer, you need to vvork
with 1nultiple technologies, lai1guages a11d file formats at the sa1ne time.

8Prima1SQL: usiJ1g Pri1nalSQL you cai1 connect to any database: fro1n Microsoft SQL Server to Oracle to Microsoft
Access or even Microsoft Excel. PrimalSQL can be used to build rich and complex queries. Fro1n within the
application yo11 can test ai1d retine queries, export results or generate code snippets in a vaiiety of languages. Its
modern, strea1nlined interface makes PrilnalSQL easy to 1mderstand and use.

9PrimaJXML: a tool tl1at is specifically designed to edit, manipulate, and create XML files.

10
Po'\verShell HelpWriter: PowerShell Help Writer 20 16 is the pre1nier editor for Windovvs PowerShell XML help
files for all command types, including c1ndlets, functions, workflows and CIM collllnands.

11
VersionRecall: VersionRecall 2016 auto1nates the n1ost widely used manual process of creating backups and
1naintaining inultiple versions of your files.

12
WMI Ex1Jlorer: tl1e next generation tool for e>..]Jlo1ing the vast universe of the Windows Manage1nent
Instiun1entation database. The WMI database represents a huge repository of infonnation about yolu servers and
client 1nacl1ines \hich as a syste1n or nehvork administrator you need to utilize every day.

13
PowerRegEx: Po\;verRegEx is the tool that makes regular expression creation and discoverability easier, by
grouping regular expression constn1cts by category, providing construct descriptions a11d exan1ples.

Profile Editor: Po\.verShell's profiles inake setting up your \VOrk environment a bit easier, allowing you to pre-load
your 1nost co1nmon snap-ins or 1nodules, defil1e fimctions, set variables and whatever else you need on startup.

7https://www.sapien.com/software/primalscript
8 https://www.sapien.com/software/primalsq l
9
https://www.sapien.com/software/primalxml
10 https://www.sapien.com/software/powershell_helpwriter

11 https://www.sapien.com/software/versionrecall
12 https://www.sapien.com/software/wmiexplorer
13 https://www.sapien.com/software/prod uctivity_pack
PowerShell Studio - Basic Orientation I 99

j i
!.................................................................................................................................................................................. ...................................................................................................................................................................................................................... ~...................................................................................................................!

PowerShell Console: opens a PowerShell console "vindo\.v.


~ PowerSheD Console
~ PowerSheD ISE PowerSbell ISE: opens the Windo"vs PowerShell (x86) ISE console.
DI Update+ielp
U1Jdate-Help: this will update your help files to the latest available version.
Power Shel

Q Updating Help for module Microsoft.PowerShell.Operation.Validation x

.. . . . . .

0%

Installing Help content ..

figure 60 - Installing Help


If you receive this not so user friendly error message during Update-help it means that the help file isn 't
available yet for download from Microsoft. Not the most intuitive error niessage I agree, but it's generated
from Microsoft, not SAPIEN.

Ex.
'https://technet.microsoft.co1n/en-us/library/jj657534.aspx' does not resolve to a container.

2.2.5 Source Control Tab

r.m DBlr O.nn.


- Home Desig11er Deploy Tools Source Control ~ View

c
Create
G Restore
Cl Delete ~
VersiOORecal
[1- Submt Fie
CJ, Restore Fie ~
Lat..neh
, AddTo
~ Chedcin
~ Undo Chedc Out ~ Properbes
~Get latest ~Compare
~ Rewind Explorer (l0 Get Latest ~ ChedcOut ~ View 1-tistory Refresh

Restofe Points VersionRecal Source Control

These controls are all based around providing a syste1n to restore your script back to a previous ti1ne, and providing
source control for yotrr scripts, especially when \.Vorking "vith other teain me1nbers on the same script.
100 I PowerShell Studio-A Comprehensive Guide

;
,.,.........,,,_,,,............................................................ ,_,,,.......................................................................................................................................................................................................................................................................................................................................,_,,,....................................................................................;
~

G Restore This reminds n1e of Microsoft Windows restore points. and it does si1nilar behavior but
0
Create
1 Delete
instead operates at a script level. This \vill help you recover fro1n shooting yourself in the
foot if you iajected mistakes or erroneous code into your scripts.
..._ Rev-.'ind
Create: before any
scripts updates I highly recotnmend that you get into the habit m~jor
Restore Points of creating a restore point, one day you will be tliaukful that yo11 did. Currently there
doesn't seem to be an indication that a restore poi.lit has been created. which can mislead you into thinking that
nothing happened. I would prefer some type of message or stah1s indicator that the restore point created successfully.
It will however if it is the first restore point you've created, enable the "Restore'' and "Delete" b1Itto11 which is at
least so1ne indicatiou, but after that it is hard to knovv subsequent restore points created successfully. Only the last
created restore point 111ill be kept, there is currently no restore point history.

Do you wish to restore this file? Restore: this will restore your script to the last restore point that you created.
You \Vill get a popup confirmation message before restoring.
test.psf
Delete: this will delete your last restore point.

14
Re,vind: this is used to restore your script back to the beginning of the
current session. Careful using th.is if you have been working on your script for quite a vvhile as it \Vill erase ALL
changes since the beg.inning of the current session.

Restore Points
V Create a restore po111t as soon as a file 1s modified.

P' Remove restore points when the application doses.


Restore Point options are available in the "Backup" tab within PovverShell Studio Options.
... . . .-.. . . ... . .. . .-.. . ..... . .. . . . .. ... . . . . . . . . ... .. . . . . . . . . . ... . . . ... . .. . . . . .. . . . . . . . ... . .. . . . . . . . . . . . ... . . . . .--.... . . . . . . .. . . ... . . ... . . . . .. .... . .. . . . . . ....... . ... ... . . . . . . . . . . . . . . . . . . . .. . . . . ... . . . . .. . . . . ..... . . . . .. . . . ...... ... .. ... . . . ... .. . ... . . . . . . . . . . . . . . . . ... . . . .1
rI VERSIONRECALL I
...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................i

15The simple and quick setup lets you select a folder that VersionRecall vvill 1nanage as well as a "backup location"
where your previous versions 'vill be stored (usually on an exten1al drive or network drive.) Fron1 that point on~
\vork as you usually do, saving the file locally, and wl1e11 you are ready, sin1ply subnlit the file using Version.Recall
E:x.rplorer or our Windovvs Explorer integration. Or, set VersionRecall up for autonlatic submission at a
predeternli.ned ti1ne.

You must have SAPIEN's Version.Recall installed on your system otherwise the controls in PowerShell Studio vvill
be disabled.

Unlike many other versio11 recall systems, SAPIEN's Version.Recall 11ever changes a file or its extension., so
restoring is very simple and as easy as opening an older version of the file, there is no cryptic fonnat. There are also
no locking 1nechanisn1S. so no check-in or check-out, which is good for a one or two-person tea1n.

14 https://www.youtube.com/watch?v=DsNCIEXSY6A
15 https://www.sapien .com/software/versionrecall
PowerShell Studio - Basic Orientatio n I 101

Version.Recall is in a11d of itself a full featured product separate from Po\;verShell Studio so we won't go into in-
depth detail here. If you 'vould like to k.no\ more abol1t Version.Recall visit
https ://w\.vw .sapien.com/software/versionrecall

VersionRecall Ex(llorer: this will launch the Version.Recall E>..1Jlorer with the
~ s bmJt
associated repository that corresponds to the active document.
Q, Restore F "'
VersronRec
Explorer ~ Get latest Submit File: submits the active file to the corresponding Version.Recall
repository.
VerS10nRecal
Restore File: ove1vvrites the active file with the latest with the latest version submitted to the correspo11ding
Version.Recall repository.

Get Latest: overwrites the active file with a newer version from the corresponding Version.Recall repository.

l .....................................................................................................-.................................................................._..,.................................................................................................._.............................................................................................................................~...................................................................................................................J

16
~Add To ... Version.Recall is a Source Control Provider. ~ Undo Check Out [B Properties
However, SAPIEN did not want it to intentionally
~ Check In ~ Get latest ~ Compare use any API especially not tl1e Microsoft SouTce
Launch
.., Checkout ~ ew History Refresh Control interface for several reasons. The specs for
the Microsoft Co11trol interface API can be changed
Source Control without notice and it is a very dated API which
causes excessive work on the part of the develop1nent team to confonn to its requirements.

To enable the Source Control tools, you must first have setup a source control provider, and enabled source control
in the PowerShell options u11der "Source Control" tab.

Settings
~ Enable source control ../ Prompt for check in

Automatic check in: Disable Automatic Check In

Check out on edit: Automaticaly Check out

Direct info output: suppress info messages

Launch : launches the source control soft\vare.


Alld To: adds the cturent document to a source control database.
Check In: checks in the changes to the current docume11t into the source control database.
Check Out: checks out tl1e current docttn1ent for editing fron1 tl1e source control database.
Undo Check Out: restores the file to the last checked in version.
Get Latest: get tl1e latest version of tl1e document fron1 the source control database.
Vielv History: view tl1e past versions of tl1e current docu1nent.
Properties: vie"v tl1e source control properties for tl1e current document.
Com11are: compares the active doctunent to a previous version.
Refresh : refresh the source control status.

16 https:// www.sapien.com/b log/20 14/04/23/versionrecall-integra tion-with-primalscript/


102 I PowerShell Studio -A Comprehensive Guide

i
................................................................................................................................................................................................................................................................................................................................................................................................................................... ..................................................................................................i
~ ~ ~

17
GIT is a free open source distributed version control system designed to handle everything fro1n s1nall to very
large projects, ai1d is probably one of the 1nost \.Videly used version control systems \Vorldwide.

Currently the only support for GIT integration \ith PowerShell Studio is via the custom menu. Unfortunately, GIT
does not have an API. To use a source control solution with SAPIEN products it must have a MSSCCI provider,
there are a few MSSCAPI providers out there for GIT.

If you're using projects, you cru1 run a git add -u with the custom menu and it'll add just the modified files in your
repository to be co1nmitted.

CUSTOM GIT MENU


[Menu]
l=GIT - Add To Staging;"C:\Program Files\Git\bin\Git.exe" add "$file$"
2=GIT - Commit To Local Repo;"C:\Program Files\Git\bin\Git.exe" commit $fileName$ -m
''{PromptlEnter commentlCommit from PowerShell Studio $Date$ $Time$}''
3=GIT - Commit All To Local Repo;"C:\Program Files\Git\bin\Git.exe" commit -a -m
"{PromptlEnter commentlCommit from PowerShell Studio $Date$ $Time$}"
4=-
S=GIT - Status;"C : \Program Files\Git\bin\Git.exe" status
6=-
7=GIT - Push Files To Remote Repo;''C:\Program Files\Git\bin\Git.exe'' push Remote
8=GIT - Fetch From Remote Repo;"C:\Program Files\Git\bin\Git.exe" fetch Remote
9=GIT - Pull From Remote Repo;''C:\Program Files\Git\bin\Git . exe'' pull Remote master
[Application]
l =GIT - GUI;"C:\Program Files\Git\cmd\git-gui.exe"

GIT SOURCE CONTROL ARTICLES

How GIT branches affect files on disl<


https://www.sapien.con1/blog/2016/05/25/how-git-branches-affect-files-on-disk/
How to update your forl<
https://www.sapien.co1n/blog/2016/05/16/github-how-to-update-your-fork/
Tell GIT to ignore files
https://w\vw.sapien.co1n/blog/2016/05/18/github-tell-git-to-ignore-files/

11 https://git-scm.com/
PowerShell Studio - Basic Orientation I 103

2.2.6 Help Tab

Home Desig"let Deploy Tools Source Control Help View

rs Oledc For Updates



Ask the Experts SAPIEN Bloa
Ii
Product
Keyboard Shortcuts

~ Control Reference \A/eeJdy v GUI Related Artides SAPIENH~


Context
Manual ~Samples SJ Update~eii MvSAPlEM Account Supoort Forums Heil
Product Support Updates On&ne Help

The help tab contains links to check for updates, product inanual and references, samples, and external links to
support areas.
l".......................... .. . .......................................... ...... . .. . .. . ....... . ..... ..................... .............. ................................. ........... ......... . .. . ..... . .......... ................................ .... .................. .............. .............. ...... .. . .................................... ......... .... ................... .......... .............. .... .... .. . ..... ...... . ..................................... ................................................. .. . ..... .............. ....... ,
I ;

!t..........................
PRODUCT SUPPORT l
....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................;

Product Manual: We introduced the Product Mant1al back in the beginning


Keyboard Shortruts chapter on "Guide to Orientation", along with the Document Explorer. Anyone
~ Control Reference that is nevv to PovverShell Studio should read over the Product Manual as it is
Product packed with very useful infonnation.
Manual ~ Samp'es
Product Support
Keyboard Shortcuts: this \ill open the Keyboard Shortcuts PDF file located
at "C:\Progra1n Files (x86)\SAPIEN Technologies, Inc\PowerShell Studio 2016" which contains a list of all
available keyboard shortcuts for PovverShell Studio 2016. These are also listed in the back for this book in our
reference section.

Control Reference: this open the WinForms Control Reference docu1nent, which contains all the controls in
PowerShell Studio along with their property functions. Very helpful guide that you \Vill reference frequently as you
learn PowerShell Studio. These are also listed in the back for this book in our reference section.

Samples: this opens Document Explorer to a list of all available sample scripts and forms. SAPIEN did an aweso1ne
job here providing users vvith a solid base of exai11ples to quickly learn from.

Exa1nples available in the topics of:

Batch Files
DOTNET
HTAs
PowerShell
Po,verShell Studio
Windovvs Script Host
104 I PowerShell Studio - A Comprehensive Guide

; :
!................................................................................................................................................................................................................................................................... .........................................................................................................................................................................................................................................................\

rs Check For Updates


Check for U1>dates : checks online for SAPIEN product updates.

\AJeekly ~ Update Frequency: select 11ow often you ' vould like Po\verShell Studio to
ElJ Update+felp automatically check online for available updates.
Updates
Update-Hel1> : this checks online with Microsoft for updates to Windo,vs
PowerShell help content.
.............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................r
ONLINE i
........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................:;

Contains links to online SAPIEN resources for support, latest


Ask the Experts SAPIEN Blog
information, articles, forums. Very useful when you are trying to solve an
GUI Related Artides SAPIEl'J Home issue or get advice on the best methods to use for your scripts or forms.
MvSAPIEN Account Supoort Forums

Online

L......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................J

This can be confusing for many and I have seen co1nplaints that it doesn't do anything, the issue is
usually that it is not being used correctly. The context help triggers on the caret position and not
actually the selection, so place your cursor at the beginni11g of the c1ndlet then click the Context Help
Context button. If help is available for the c1ndlet then it \viii either be displayed at the bottom of the screen in
Hefp the window belo"v your script, or if it is an online help resource your default browser \Vill open to
Help display the help page.

In the next screenshot, you can see the cursor at the beginning of the attribute "Para1neter" on line 23 . After clicking
the Context Help button the help information appeared in the \.Vindo\v belo"v.

2.2.7 View Tab


te<t.pof SAPIEN P"""'5l>el S1lJc>o 20!6 (x86)

Tools Soosce CoolrOI tielo Vle\v


.,.., lhJ OUIp.It IJti And R.,..;1> ,.,..J 0 "'""1io'1 El<Plo<er Y Property L...., rm Co<Y..ole .
DJ Verbeal Tab Gr~
8 Spot .,_
t~t Op.,.,. ...... o.t.Jg
....] f) H$
~
.... ~ P..-farmanc ::2' (i!l Snio!>o:s
I"'
r:.t = Tool>ox
~
o.bug
Comolo 0
J ':, c.IStaci<
[J Vat>llble:
6c) Wotch
r,
Iv"! ~
Ob)ttt 8r&.\~
(;;: 5:1 ?l'Qjec!
[i] Layouts
..,, Au!Dt.ayout

vmdow o.bug Oll>er Lavout

The view tab contains several options for panel vie,ving \.Vith different areas of PowerShell Studio including; Output,
Editor, Designer, Debugging, Layouts, and others. It also includes buttons to display the Start page and Po\:verShell
Studio Options.

There are various layout templates that you select, such as; Defaltlt, Co11sole, Debug, Designer, Editor, and Editor
Only.
PowerShell Studio - Basic Orientation 105

-
fl ..l
.._
El

-w...
Gi O ot>'"
~ ..... b..t

...-e. ..... - .. , ... . . .


"
" 0
x

- ..
E "" _.,., l '"-' ~ ;;i ' ";;] t:. t.Jw ID..-
~ ...... cn..o tt~
-.. ..- "~o.ra.._ ~ ".uo.-.c.
:::
- .....
.... -.
.:......
-
S'l'"-
......
'~
': .Gr'J( lllll ...
------------- ----
ii
..
11

1,
WY'!! ,.,. .,_._,,....,,..,._, ,.,. ..,._, ftf 1to. -

. ~llilti"""!
\'""' rf!HIW'

...U!
:: /II ....sc..-tao\ I~

""11111t'rt~t-
.-f ,.,._ r~ ~-.:..,. .

,.lh
.
"'wd.rtlr.., ,.._. ~- ...,._, .....

u. ~t
tt: ">Ct\ ....,. ''It\~' o(fl'Oilt ' v.l""-l'

...::'" ...
),.):
""D
it~ l ~tl~ t >owt t!lie hie

21 ~......
,,;
,.. (
!ttt<~ {l".-14.1 '0l'J
,.....: ,.....,

..; Jtrl, , '""""'


't'*'""'-'"(l"MQtOt')' l tr-AJ .
' nr1.'lf..SC~.tt'

'"
..;

,,,

Figure 61 - Console Layout

.. -.. - -....... A

.,.
,,.. JN'a~ ..,

= .-..~ re,.._. ~o.o.. " Mr...,._,s ., ,..,~~ ..,. . . tlt ':".t~ ._.
iI)_ ........ c.... ..
.t
. ., .. - .. J c.""'- C" ......... .... 611 .... 7"
; y ""--"'
.... "" '-... "'~ a.,., .._
v O ..
.... ...... =-- "~""'"
-~ - - .,~~

,....,_
~1 rr-c
;

~
!

...."
1) ..........

'" \
HI flO'l ff
It UrillL~l '"''~l#o ~ 1H t lt.f,

lt' ,...,.. .
1:: (
>, d,,.. ("'-lr..., l ttw),
.. tu-,"f_Jvs-.,
~ (1Jr-~ (...,_,.tooy l tn.it)j

..'1.- ,,... (lt;'"' '~t.,.

i_.U (

...,
.. 9'f000l ~tll.Uc ,...,.. Wtl"OU l!ICt'C

"
" '.
,....... _...... _________________ ~'
- ,~---

I ....... ...... ........ > I .O.t ,... .,... ' ,. .. 1

Figure 62 - Debug Layout


106 PowerShell Studio - A Comprehensive Guide

-- --
Cl f)t.i O ..,n.
.....,.... ,..._ ..., '- .. r_.,,
r..._ ., r a... ., "' ..... ~
- ~
... .. ~

, __ .
............... :m ... (....
"
If x
0

-
., y
;:::; .... ....._:...~
=....,.... .,. .".... .,
\lw
!, .......... ..,, ... ~ "' ...... ~
111..-1,
= ,...,_ Ii: ~.;;..I Q..~ ... . c-L
., ": ,........,.._ ..
- -
v il --.r- .;
~
... o . "'" i.~~
,,..
-.."'"''"" .--

J ..J ~
-
v- =
i...
..:..I'


l
.
1
'
' .ot'I(

...
~-
11'1J{W
....... f.....- . . _-....... ~ ,,,.. -

& ~J-C1"-S.:.t:1crl cf t-'lt J!llC


,.f , ....

praNttf',
1 1. ,_ ,_ tlt-- - c
-

11
1: ,__,.If. 1"""'1-
,, .. G.ut-if>l'- f ,..., C...,...t ..r- ,...,._, ..,


'"' ~'

~lt~ ~r~t.L"
,.
1

JI
"'
;! t "
..a...t. t.h# JI.kl,

"
:..i
J
d - .. (............,.. ,,,_,J
(1 'f!fJf;"'"'" '
.........
\ ,,. ...,.. lt.... )
(~to!')'

"'
A
..'.
.;'", " itrl1'<J j(e"""~e...
'ft:'#i ....
''--~(

-
ti
M a'TOOO t.,.it.U U.U ..... C...t,..1' kf"'C

" ,,..
,~.. .., . ....
,,. l

"
L
<I
.l

..
"'
-
. -
.
......
.,,_
"'
,,
.>:I ...
= ...J

Figure 63 - Designer Layout

.._
C Clrl O ..,no
~ ~ t~

,, ..,,....
- ......... W.F trfr:)f "'1:
E ~',.... .n1""~'-. ..; :E ~ ., ai ..... ~ :J t-.....
~
'.:. G.-1 )(.....;
~~...,o..,., !r~ W ...
v o .....
)ct..c ~ .~
......
,....,. v ~OoJt.t"- ..; ....u.,.,.

....."'"-
, .., 61~
- ......
e


' ,\,,(llP) I~
".,..-t...,. r.itt,,.,. , ,...,,
'
.,.t.UIUTt, Kac
,. I. 4tter1-~ ot tlloO ~ 0..1'. .Uf'

"
i: """"""Cl ~~,

l.
&l
I

,,
Sf
4 fttoCrt1Kt0"1 fl( t."

'AN'M t
II-.. c \>
C~tr

..,._ v.1-i
N'Vtr

.,~,. 'ti11_.1

,. ..
)1

",.
1VUI

\ J1'....,!'"~Q"l'l('J!tot)' Stn.t-))
" ..
,. tt-"1-"tl Pl..u.
r. .....,......<~to-~ ~n- . )l
a ..,,,.i""Cl~t-
P'
..
.,,.._
~ . . . . . . . . . ,. ._ fO
:ti . , ....... _, ....... ,

n-
O c.ttwA.Ji-O ,. TC001 fIU.111,-. ""- t41'1t,._h, -.....

o tcv..n.A..-; IL
ft ra'I~
O c.n-
;._...
E:l>lt!M
"
.--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~....,

>

Cl
~ -
; r.....wkl.
; .......... Cl
;~
.
; ..__
L2

,_
_; ,......,,.,
>~.MO"

,_
;....
,,_ ~
,..,
V ,,.-...-.ca ... ~ .... 0io..q " '"""._... 0 ~ r.i 'C\.A;l..t f"'-llnW\:lr
I U.... ltJD ..1,.,.: >. NUW IJ'T4 lN lJ C. l ;"">) )

Figure 64 - Editor Layout

If none of the predefined layouts work for you, then you can also create and save your own custo1n layout that fits
your own needs.
PowerShell Studio - Basic Orientation I 107

2.3 PANES

There are 16 different panes available inPowerShell Studio 2016.

-- Call Stack 2.3.1 Call Stack Pane


~ Console
The Call Stack pane sho\.vs you the execution path through your script to the current
~ Debug breakpoint when debugging. Each line, except the first, represents a point where
your script called a fi1nction. The first line is the location of tl1e current breakpoint.
[iJ Debug Console
Double clicking on a line in this windo"v will take you to that distinct line in the
1"11Find Results code editor.

~ Function Explorer
2.3.2 Console Pane
fQ Help

~ Object Browser The console pane is an instance of Po,verShell hosted in the PowerShell Studio IDE.
There is a platfonn selector at the top which allows you to switch between 32-bit
[] Output
and 64-bit PowerShell instances. One tiring to keep in inind is that you do not type
~ Performance conunands on the coffilnand line as you inight be accusto1ned, you type the1n in the
Input Box and press enter, this sends the co1ruru1nd to the shell. If you like you can
~ Project also disable the input box in the Console Tab of the Po\.verShell Studio Options.
[I! Property
Right clicking i.J.1 the
~l
11coosoi. c "
Snippets Console window will !,,,....--,:~~------------------.

~ Toolbox display a context inenu


containing the

&) Watch
Variables following options:

Copy
Copy highlighted text to the clipboard.
Paste
Copy the contents of the clipboard into the
console.
Restart Shell
Restart the shell. This will erase all work done in
tl1e current shell.

Figure 65 - Console
2.3.3 Debug Pane

The Debug output pane shows you messages written to the debug strea1n - by Write-Debug, for exan1ple. It also
records messages created by tracepoints in your code.
108 I PowerShell St udio -A Comprehensive Guide

fill Output o x
>>Debugging (MainForm.psf) Script ...
>> Platform: VS 32Bit (STA) (Forced)
ERROR: Exception calling "Save" \'iith "l" argument(s): "Access to the path 'C: \ path.xml' is denied."
Mainform.psf (1173, 4): ERROR: At line: 1173 char: 4
ERROR: + $PathFile .Save($Path)

ERROR: + Categoryinfo NotSpecified: (:) [], MethodinvocationException


ERROR: + FullyQualifiedErrorid : DotNet/'\ethodException
ERROR:
ERROR: Get-Content : Cannot find path 'F: \ SAPIEN\ PowerShell Studio 2014\Projects \ 452CS Status Display\
Mainform.psf (1188, 22): ERROR: At Line: 1188 char: 22
ERROR: + $ConfigFile = [xml)(Get-Content $CnfgFile)
ERROR: +
ERROR: + Categoryinfo ObjectNotFound: (F:\SAPIEN\Power ... us Display\ none:String) [Get-C
ERROR: + FullyQualifiedErrorid PathNotFound,Microsoft.PowerShell.Con:mands.GetContentCommand
ERROR:
ERROR: Exception setting "Interval": "Value '0' is not a valid value for Interval. Interval must be gr
ERROR: Parameter name: Interval"
Mainform.psf (1191, 2): ERROR: At Line : 1191 char: 2
ERROR: + $timerl.Interval = $ConfigFile.Settings.Display.timer
<
LII Console lllJll- Debug Mi Fnd Rest.Ats G Help [;] Output ~ Performance

Right clicking in the Debug Output windo"v will display a context


lr"~ Copy Ctrl + C
nlenu containing the following options:
Copy HTML Ctrl + Shift + C

Find ... Ctrl + F Copy (Ctrl+C): Copy highlighted teA1 to the clipboard

Select All Ctrl +A Find (Ctrl+F): Search the text in the debug output windo\v
Clear Ctrl + E Select All (Ctrl+A): Select all the text in the debug output windo\v
Clear (Ctrl+E): Clear the debug output window

2.3.4 Debug Console Pane

With the Debug Console, you ca11 interact with the RunSpace while at a breakpoint. Tl1e console allo,vs y ou to fllll
co111lllands, like call function, or cllallge variables to make debugging scripts easier. You can also simply
experiment with what-if scenarios.
PowerShell Studio - Basic Orientation I 109

261 $sOS = Get -lW!liObject -class Win32_0peratingSystem

27
28!
\~rite -Output

[lJ Debug Console


$sOS

CJ x
.

>> $sOS

SystemDirectory C: \Wil~DOHS \sy stem32


Organization Hewlett-Packard Company
BuildNumber 14393
RegisteredUser
SerialNumber 1

Version 10.0.14393

-
~ ~~ I
Ii] Debug Console ":!. Stack ~ \~atdi ii Variables

Figure 66 - Debug Console

In the example, you can see that we set a breakpoint at line 27, we can then query the contents of the variable $sOS
within the debug console to ensure that the contents are as expected. This is a great tool for debugging your script
commands and functions.

Debugging
110 I PowerShell Studio - A Comprehensive Guide

2.3.5 Find Results Pane

When you do a search within Po,;verShell Stl1dio, whether it be a "find in files" or a " find all references", the results
will be displayed in the Find Results Pane.

Mi Rnd Results CJ x

C: \ Users\ Jeff\ Documents\ SAPIEN\ PO\ierShell Studio\ Files\ test.psf (22, 2) : $forml_Load={
Total References: 1

II Console ..... Debug IJli Find Results G Help [g Output ~ Performance

Figure 67 - Find Results

This is an example of a "Find All References" search for the tenn $fornzl _load- { within a test script, as you can
see there is only one results, if there were more tha n one $fonn_load statements then we would have a proble1n.

Mi Find Results CJ x

C: \ Users\ Jeff\ Documents\ SAPIEN\ PO\ier Shell Studio\ Files\ test . psf (22, 2): $forml_Load={
Total References: 1
I I!~ Copy Ctrl + C
Copy HTML Ctrl + Shift+ C

IJli Find ... Ctrl + F

Select All Ctrl +A


llJ Console ..... Debug IJli And Resul
Clear Ctrl + E

Marie as Visited

Cancel Find m Files

Right-click within the Find Results pane to display the sub1nenu; Copy, Copy HTML, Find (finds with the find
results ... nifty huh!), Select All, Clear, and Mark as Visited.
PowerShell Studio - Basic Orientation I 111

2.3.6 Function Explorer Pane

The function eArplorer "vill display will display all functions and events within the current script. This a very useful
tool for fiI1diI1g a specific function within particularly large scripts. If you work with scripts in the thousands of lines
of code, this can save you countless hours.

G FunctJons 0 x A function is a list of Windows


Po,verShell statements that has a
nan1e that you assign. When you run a
p
function, you type the function na1ne.
G Update~og
G Update-t.og ex. Get-Status
G Update-t.og
G Update-t.og
G Upda~og The right-click menu contains tl1e
G Update-t.og follo"v features:
G Update-t.og
G Update-t.og
G Update-t.og Go to Declaration: this will take you
G Update-t.og to the location of the declared function
G Update-t.og Go to Declarat ion
within your script.
G Update-t.og Find All Ref e.rences
G Update-t.og
G Update-t.og Insert
Find All References: tlus will list
G Update-t.og Gene.rate Comment Based Help
G Update-t.og-Mearee every line in your script where the
Edit
G Update-t.og-<ert ft1nction is called, results are shown in
G Update-scCMEtrortog Ii'[~ Copy
the "Find Results" pane.
G UpdateSCCMSuccessl.og V Rename
G Update.soft-t.og
G UpdateSoft-t.og Insert: this will insert a fimction call
G UpdateSuccessCool)lyt.og for the selected function at your
G Update SuccessRepartog
G Update-SuccessWSUS current location witlun your script.
G Update-Taslcfrrorlog
G UpdateTaskSuccesslog
G User Generate Comment Based Help :
G WSUSUpdate tlus does exactly as it says and inserts
.. ii Events Co1nment Based Help at the
, Adobe_Custom_Computers_Enter
, Adobe_Custom_Computets_Leave beginning of the selected function
, Adobe_Custom_Computers_Textehaoged withln your script.
, Adobe_Reports_Cldc
, Advanced_Audit_Button_Cldc
, Audit_Comnands_TextOlanged
, Audit_Custom_Computers_Enter
--~'"--'-'Audit Custom Computers Leave
G Functlons ~ Snippets

Figure 68 - Functions
112 I PowerShell Studio -A Comprehensive Guide
18869 <# Edit: opens the Function Builder for the
18870 .SYNOPSIS
18871 A brief description of t he Updat e-Log function. selected function.
18872
18873 .DESCRIPTION
18874
1887S
A detailed description of t he Update-Log f unction . Copy: copies the function definition to the
18876 .PARAMETER logstring clipboard
18877 A description of the l ogstri ng para.m eter.
18878
18879 .EXAMPLE
18880 PS C:\> Update -Log -logstring 'Valuel'
Rename: renames the selected function and
18881 updates the references in the script or project to
18882 . NOTES
18883 Addit ional inf ormation about the f unction.
reflect the change.
18884 #>
1888S Function Update- Log
18886 - {
188871 Param ([st r ing]$1ogstring)
18888 $currentdir "c:\Program Files\ARMS\sccm"
18889 $logstring "$(Get -Date -Forra~ 'yyyy-11'1-dd HH:an:ss' ) : $logstring'n"
18890 $sccm_status .AppendText($logstring) $logstring
18891 Add -content Sl ogFile a.ue $logstring
188921 $sccm_status .Refresh()
18893 $progressbar_sccmhealth. ReFresh()
18894 [System.Windows . Forms.Application] : :DoEvents()
1889S }

Figure 69 - Ex. Generated Comment Based Help

2.3.7 Help Pane


This pane displays context sensitive Windo,vs PowerShell help about the last cmdlet, alias, or WMI object that was
typed in the code editor window.

0 x

Ne me
WNte-Outpul

Synopsis
Sends the specified objecls to the next command in the popehne II the command 1s lhe last command in the pipeline. the
ob1ects are displayed in the console

Syntax
Write-Output (lnputObJect) <PSObJ"CtU> [NoEnumerate) [<CommonParame1ers>]

Detailed Description
The Wme-Oulput crndlel sends the specified ob1ect down the popel1ne to the next command ~the command 1s the last
command in lhe ppeline, lhe object is displayed on the console

Wnte-OUlput sends objecls down lhe primary popehne. also known as the output stream or the "success pipehne To send
error objects down the em>r pipeline, use Write-Error

This cmdlel Is typocally used in scripts to display strings and other ObJ8CtS on the console Howeo.-er. because the default
beha'llor 1s to d1Splay the objects at the end of a pipehne. it is generally not necessary to use the cmdlel For example. get
ptocess I wnte.output" 1s equMllent to "getptocess.

Parameters

4nput0bject <PSObjecl[)>

Specifies lhe obiects to send down the ptpelme. Enter a variable that contains the objects. or
type a command or exptessoon lhat gets lhe objects

Required true
Posilion: 1
0eraul1 value:
Accept pipeline input true (6yValue)
~cept wildcard characters false

If PowerShell Studio is configured to use external help, the help will be displayed m the SAPIEN Docu1nent
Explorer.
PowerShell Studio - Basic Orientation I 113

To ensure that help items will show up in the Help Pane, you must configure two options as follo"vs:

1. Options c=> Editor > Sho\v cmdlet help while typing


Ecitor Settings
~ Enable autcmabc syntax dle<b'l9

~ Enable CUTent line hoghl9ltng

Console l Use whtespaces mtead of tabs v Show line runbers

v Show crndet ~ whk typing n Show whte spaces


~Enable br~t ~ting 7 Colapse regions on load

Colrm: n snow co1um guide


Tab Size:
--- --.-..,
"I
AsseniJlies
A Font and Color... _j
Fonnatbng
Auto-Insert
PmlalSense [vJ Auto10Sett closino parentheses I ] Auto..-.sert rnport commands fur used mcxiJes

Panels 0 Auto..nsert closino ~ br~ts

v Auto.flsert closino a.rly braces


Pow~Shel
[..-] Auto11lSeft dosno stmg quotes

Source Control
Analysis
v Aulllln!lbcaly analyze sa~ts on~

Figure 70 - Cmdlet Help

2. Options >PowerShell c=> Shovv help in Document Explorer

General Po~Shel Setbngs

I----_, \?IE~.n~t~~11 v Update OOie on mocUe export

q Enable exeo.ition policy wal'Mg

Change Execubon ~

Certificate In local sblfe: [


(leave empty IX> S9l wilh the tirst avaiable code signing
c~bficate)

Ecitor
PFX C~bficate: []
Password: ~==================~
http://llf'OeStamp.olobalsqi.eotn/saf)tsfr:ms~.cl

ExterNI SiQnno Tool:


(IJsng an external tool Ml ovemde al other settings.
Speofy %Fie% fur the S0'1>t to sign.)
Panels
J 0 Automaticaly 59'1 .ps 1 saots when saVf'9
PowerShel

l Source Con1rol

Figure 71 - Document Explorer Help


114 I PowerShell Studio - A Comprehensive Guide

2.3.8 Object Browser Pane

The object browser contains all the follo"ving panes:


tJi1 Object Browser o x

---~ [ Ci1 lia-___..._ii___.____ I


PowerShell Bro,vser - for exploring Po,;verShell objects including
c1ndlets, aliases, 1nodules, functions and help files.
I E""'te" t--n ro S'":c ,.., P
._ SJ About ToPJCS " iJll .NET Object Bro,vser - displays the .Net assemblies available on
.., C!J Core Cmdlets your co1nputer. Each asse1nbly can be opened to reveal the
e Ofo na1nespaces and types contained within. Individual types can be opened to
L!]? reveal their contents - properties, methods etc.
Bae
C!J Add-Computer [lQl WMI Browser - displays namespaces and objects from the WMI
C!J Add-Content database on your computer. As you click on nodes in this panel,
C!J Add+listory PowerShell Studio will display information and code examples about the node
C!J Add-Member in the Help pane.
C!J Add~SSnapin
C!J Add-Type ii Database Bro,vser - allows you to explore databases and generate
B asnp code to read and display data. Before you can use the Database
e cat Browser you need to create a database connection. Po"verShell Studio supports
the follovving connections; Access, SQL Server, MySQL, ODBC, OLEDB,
0cd
Oracle, Oracle Native, PostgreSQL, and Sybase.
SCFS
B chdir
e Ched<point-Computer
Click on the "Create new database connection" icon. Once you have
configured your co1mection, pressing Save will add a new node to the
l!Jdc database browser. Clicking on the node will enumerate the contents of the
l.!Jdear
database and allow you to tunnel into the tables, views, stored procedures, etc.
e dear-Content
S dear-Eventlog
Each pane also includes a custo1n right-click menu to help you integrate the
S Clear-History objects into your code. It might insert a snippet of code directly or could point
B dear+iost you to PowerShell help or MSDN help.
S dear-Item
S Clear-ItemProperty You can also drag/drop objects fro1n the object bro,vsers into the Script Editor
S dear-RecydeBin to insert into your code.
C!J dear-Variable
L!]dhy
So
l.!Jdp
0ds
Sdv
Bcnsn
B compare
C!J Compare-ObJect
S Complete-Transaction v
PowerShell Studio - Basic Orientation I 115

Right clicking on a database object provides


*ti Ob}ect BrO\'JSer c x these options:
()
Insert: Generates a PowerShell function that
uses ADO.Net to retrieve all records fro1n the
database and output the records to the
PowerShell pipeline.

Copy: Copies the name of the database object


onto the clipboard.
Insert
Generate Query Form: Creates a
Refresh PowerShell fonn based on available
Copy templates, and ADO.Net code, to retrieve
database records into a .Net DataSet object
Query v. th \~1sual Quef) B~lder
and display the results in a grid.
Query u~1n9 SQL TColt Only
(J r 'IW>
Gener4tc Query Form.
Generate Query PowerShell Scri11t: Creates
Gtnerate QuC'f)' P~-ttSn S<np a PowerShell script that uses ADO.Net to
retrieve all records from the database ai1d
output the records to the PowerShell pipeline.

The code generators provide a default connection string that you \.Vill need to edit to reflect your environment.

2.3. 9 Output Pane

Tb.is pane displays normal script output. One of the things I like best is that if an error is output from your script
you can doubl e-click on the message and be taken directly to the appropriate file in the code editor.

[]output Cl x
>> Running (test.psf ) Script ...
>> Building ( test . psf) ...
>> Platform: VS 32Bit (STA) ( Forced)

>> Execution ti.Ire : 00 : 00 : 05 ["~ Copy Ctrl + C


>> Script Ended
Copy HTML Ctrl + Shift + C

Mi Find ... Ctrl + F

Select All Ctrl +A


Clear Ctrl + E

II Console ..... Debug MJ Find Results @ Help []Output ~Performance

Figure 72 - Output Pane


116 I PowerShell St udio -A Comprehensive Guide

Right-Click Menu consists of:

Copy (Ctrl+C)
Copy highlighted text to the clipboard.
Copy HTML (Ctrl+Shift+C)
Copied highlight code, including color coding and formatting.
Find (Ctrl+F)
Search the text in the output vvindow.
Select All (Ctr l+A)
Select all the text in the output \vindow.
Clear (Ctrl+E) A. B
Clear the output vvindow. ~~=+-

2.3.10 Performance Pane

~ Performance CJ x
1 1

0.9 0.9

0.8 0.8

0.7 0.7
Q)
Ol 3:
jg 0.6 0.6 <D
cQ) 3
0
u
L.
Q)
o.s '
0.5 -< -
,.... CPU 1
0....
:J 0.4
0....
u
~ r 0.4
::J
3:
OJ
~Memory

0.3 0.3

0.2 0.2

0.1 i 0.1

0 0
0 0.2 0.4 0.6 0.8 1

Time
fl) Console ~ Debug MJ Fm Re5Uts @Help D output I~ Performance

Figure 73 - Performance Pane

As of version 5.3. 130 there is now the capability to track in real-time the CPU and Memory utilization of your
scripts.
PowerShell Studio - Basic Orientation I 117

2.3. 11 Project Pane

The project folders reflect the folder structure of the project files. Therefore, if you previously organized your project
files in folders witb.i11 the project's directory, those folders will auto1natically be displayed in the Project Pane once
the project is loaded.

-
53 Project CJ x
The four icons at the top are as follows fro1n left to right:
~r. l lirii
Enter tevt tn -=-,.~ch ... p
A ra ARMS
~ Ne'v File: this opens the ne\v file dialog \vhere you can choose the
type of file (.psf or .ps l ) to add.
~ Globals.psl
Add New File x
rlijj Malnform.psf
File Types
rlijj Processes.psf
rm startup.pss tpi j
Form
Creates a new GUJ based ~t (.psf)

fJ J PowcrSheO Script
Creates a new PowerShell Scnpt (.ps 1)

r Add Existing File: this \Vill open a Windows Explorer so you can select a file(s) to add to the current project.
You can add the follovving files types:

Form Files r .psf)


Package Script Files (*.pss)
PowerShell Files (*.ps1)
PowerShell Data Files (*.psd1)
Script Module Files r.psm1)
File Group Files r .filegroup)
Previous Form Files r .pff)
Previous Package Script Files (*.pfs)
Previous Files r.pfproJ)
All Files r.*)
118 I PowerShell Studio -A Comprehensive Guide

You can also drag\drop from any Windows Explorer window directly to the Project Pane to add file(s). You will
get a confirmation screen whether y ou want to copy the file to the project directory. If you choose " No" then tl1e
file w ill still be added to the project but the file will not be copied to the project folder.

By default, I like to copy any file(s) or folder(s) tl1at I include in a project to the project folder also.

Copy to Project Directory? x


Do you wish to copy ti-is file to the project <irec:tory?

@Project 0 x

t'J r. .. rii
E"' 'P XI~ rch... P
.. l]j ARMS
bJ G1obals.ps I
Cl ~\'board Sho<tcuts.pdf
B} Man'orm.psf
mu Processes.psf
rllJ Startup.pss

"

r;- Open You can also select any file(s) or folder(s) directly w ithin the Project Pane and
tV Rename re1nove or delete tl1em. When you right-click on a file or folder in the Project Pane
you \Vill see a 1nenu with several selections, the two we address here are;
~ Debug Script File
t> Run Script File
n Run Script in Console Remove: this will ren1ove the selected file(s) or folder(s) fro1n the current project,
~ Preview Form ho\vever it w ill leave the physical file(s) or folder(s) intact on disk .
Remove
x Delete Delete: tltis \vill re1nove the selected file(s) or folder(s) fro1n tl1e current project,
AND will MOVE tlle file(s) or folder(s) to Recycle Bin.

New Folder: this will create a new folder that you na1ne \-vitltin yotrr current project folder.

Open Project Folder: tltis will launch a Windows Explorer windo\v displaying your current project folder.
PowerShell Studio - Basic Orientation I 119

2.3.12 Property Pane

This pane displays all tl1e properties available to the currently selected control, object, or fom1 in the form editor or
project panel.

ly Properties JJ ~ Form Properties: the screenshot to the left is an exa1nple of the properties pane
~ sforml: System.~Tindows.Forms.~
for a form object. Form properties contain the follovving sections:

ij ~ i (E!I, Accessibility - used to provide information for accessibility clients.


v Accessibility
AccessibleDesc
Atlpearance - this control the overall general appearance of the form such as;
AccessibleNam
AccessbleRole Oefat.At
background color or image, font and color, border style, etc.
v Appearance
BackColor [:J Contr~ Behavior - this controls how the fonn acts, such as; enabled or disabled,
Backgroundl.mc [:J (none)
context menu strip (right-click 1nenu), validation, and more.
Badcgroundlmc Tie
Cursor Def&At
> Font Microsoft Sans Senf, Data - allo,vs data binding to the form.
ForeColor ControfText
FormBorderSty Sizable
RightToleft No
Design - tllis is where you name the object as well as lock or unlock sizing of
RightToleftl..a~ False the for1n object.
Text Form
Use\~/aitaxsor False
Focus - configure whether the co1nponent raises validation events.
v Behavior
AlowDrop False
AutoVaSdate EnablePreventForusC Layout - detennines scaling, maxiinu1n and mimmu1n fonn size, location,
ContextMeruS (none) padding and WindowState.
OoubleBuffere< False
Enabled True
ImeMode NoControl Misc- configures trigger for accept and cancel buttons.
v Data
> (DataBindiigs)
Windo"' Size - various options that control how tl1e form appears, including
Tag
v Design opacity, 1nenu strip, icon, and more.
(Name) forml
locked False Property panes can vary depending on the control or object selected, some may
v Focus
have less properties than others. In our chapter on Controls we discuss in depth
CausesValidati< True
v Layout
each of the properties for every control object.
AutoScaleModE Font
AutoScrol False The properties of objects can also be ma1upulated fro1n within your script,
> AutoScro!lMarg O, O
which allo\VS you to provide interactions witllin your GUI when executing, i.e.
AutoScrollMinSi 0, 0
AutoSize False
tunling on/off controls, changing text, 1nanipulating displayed data, and much
AutoSizel''lode GrowOnly more.
> location O, O

Text You can right-click on any property to getMSDN online help about that option,
The text associated with the control. or you can press F 1 after selecting the property .
120 I PowerShell St udio -A Comprehensive Guide

You can also switch between


Y Properties J1. x YProperties q. x
controls on the form using the object
I:g sforml: Systern.\~fndows.For... ...,, !labI Sbutton 1: System. \'Vl'ldows.Forms.B.. . v, picker dropdown located at the top
of the properties pane, or by
(ab) ~ttonl: System.\Vl'ldows.Forms.Button
~~ l J:jl ~ ~ lJ sforml: System.~ftndows.Forms.Form selecting the controls in the forms
v Accessibitity
---- designer.
Flatstyle Standard
AccessibleDe
> Font ~osoft Sans Senf, 8
AccessbleNa
ForeColor Controrrext
AccessibleRo Defalit
v Appearance
Image D <none>
ImageASgn MddleCenter
Bad<Color D Control
Badcgroundli D (none)
BadcgrOtlldll Tile
Cursor Default
Font Mcrosoft Sans Seri' So1ne controls support all alternative way to 1nodify control properties called
ForeColor Controrrext smart tags. These appear as a s1nall icon, on the
FormBorderS Sizable top right of a control, when it is selected in the
0
RightToleft No fonns designer.
RightToleftl False
Text Form
Use~/aitaxs False
v Behavior
Clicking on the s1nart tag will
0 MSDN HeJp display options specific to the ~ ComboBox Tasks ~
0
C Reset control, and it vvill present all 0 Use Data Bound Items
alternative task oriented ' vay
Unbound Mod~
Enabled True of modifying control
-,... .. ...s.-
ImeMode NoControl properties. ~

The left two buttons allow you to switch behveen viewing properties grouped into functional groups or simply listed
alphabetically.

The right hvo buttons This pair of buttons allows you to switch between looking at the properties an object supports
or the events it can trigger.
PowerShell Studio - Basic Orientation I 121

2.3.13 Snippets Pane

~ Snippets 0 x If you are not fainiliar with snippets, these are small pieces of reusable
code that can be easily inserted into scripts, snippets can be full
functions or simple one line staten1ents. The snippets pane contains
~ rii ~ various snippets that can be used within your scripts to complete many
Enter te>t to search... P comn1on tasks. The default snippets are contained in the
~~~~~~~~--~

- User I\ %ProgranlData% \SAPIEMP0111erShell Studio 2016\Snippets\ folder.


You can also add an extra folder of your own to the snippet browser by
.4 - Preset
specifying the folder path on the Panels tab of the Options dialog. This
- ADS! folder is always called 'custo1n' in the snippet browser.
- dasses
-

.4 -
- Database
Escapes
Fies
k"

"""
Tlus will re-scan the snippet folder and refresh the s11ippet pane.

Opens the currently selected snippet folder in Windo\vs


~ Readlilesfromfife Explorer.
~ ReadNamesfromfile
.4 - Form Functions ~ Launches the snippet editor to allow creating your O\ivn s11ippet.
~ OnApphcationExit It is also possible to edit or delete an existing snippet using the
right-click menu.
~ OnAppbcabonload
- Packager Funcbons
-

.4 -
- Parameter Vahdabon
Pester
Utihties
~ Logfile
~ TestPing
~ Trace\Aflfldow
- Va dabon
- VBScript to PowerShel

lf <OO>HOO" o0o0oOOHOoooo<00>0.. .... ................................. ... .... ,,,,,.. ...... ........................ .......... ........ .... ................ ........... ............,,,,,,,. ,... ... ..... .................... ..................... ...... ............. ............ ........... ........... .... ... ... ............ ..
0000>ooo 00000~000 000 00o o < oo ooooooooo ~

!,............................................................................................................................................................................................................................................................................................................................................................................................
:
SNIPPET EDITOR
.............................................................................................................
~
i ~
:

The Snippet Editor will launch \vhen you edit an existing snippet or create a new snippet i11 PowerShell Studio. It is
a self-contained progra1n, and it supports multiple progra1nming languages. Snippets are reusable blocks of code
that you can add to your PovverShell scripts, thus saving you time and reducing errors . S11ippets can include
placeholders, and PowerShell Studio will pro1npt you to supply values for these when the snippet is used.

When you first click to create a new snippet, you will get a popup windows asking you to name the snippet file, by
default the snippet will be saved at~ %ProgranzData%\SAPIEN\Po111erShell Studio 2016\Snippets\
122 I PowerShell Studio -A Comprehensive Guide
ng S PIEN\Use Sn1pptts J>owuShel ut sn pp et Snippet Editor x
;:; Flit Edit Vltw He,lp
::

.j:[. D ~ Iii ll llli' 8 Ci t .


~-------------------
\larlablu ::<-:::::-:-::::::-:::::: ..,. q. x
TI~: test
Variables
Shortwt:

[)esa\:>tion:
:==============================~
Author: ~ff

~U:U.:

Language: Power
_ Shel
.__I _ _ ___,v I Type:

References :-::-:-:-:-;:-:-:-:-:-:-:-::::{-:::::::::::::::1.::::::::::::::::::::::::::-:-:-:-:-c:-:-:-::::-:-:-:-:-:-:-:-:-:-:-:-:-:-::::::::::-:-:-:-:-:-:-::: .... q. x

+ -
~ URL

Rdertnces Output Variable Details Imports


Rtady tlUM . ,;

Figure 74 - Snippet Editor


Title: the name of your snippet.
Shortcut: the text that when typed in the code editor will invoke the snippet.
Description: a short description of "vhat the snippet does.
Author: your details.
Help URL: If you have help infonnation available for the snippet provide the link here.
Language: this must be set to "PowerShell" if you want to use the snippet in PowerShell Studio.
Type: this defines the intended use of the snippet, as \.Vell as \vhere PowerShell Studio will display the snippet.

Expansion v There are three tv pes selections:


Expansion - use if your snippet is intended to simply be inserted into code.
SUrrounds With Surrounds With - use if your snippet is intended to surround existing code.
Both
Both - use if your snippet can be used for either Expansion or Surround.

If you choose Surrounds with or Both, you must include the placeholder $selected$
so1newhere in your snippet code body, othervvise you may ovenvrite user code vvhen your
snippet is used .
PowerShell Studio - Basic Orientation I 123
mg\SAPIEN\User Snippets Po erShel test sn ppet - Sn ppet Editor - ::J x
m File Edit View Help

1;1 D ~Ill Jb ~ I! el T .
..
Variables ... q. x
.-----------------------------
Title: Dowhlle
Variables
Shortcut: DoWhile

Descrt>tion: Create a Do ~ loop

lwthor: YOIX Name

~LRL:

language: I.....Po_v._erShel
_ _ _ _ I ___.v Type: Both

ldo {
2 SselededS
3I
4 Sends
5 ) w!'llle (Scoodi>onS)

Ret ere n ces ::-::-:-:::::::::::::::::::=::::::::::::::::::-:::-:::::::::::::::::::::::::-:::::::::::::::::::::::::-::::::-::::::::::::::::::-: .... q. x

+-
Assembly URL

References Output variable Details Imports

Figure 75 - Example of Type (Both)

References: This section helps Po\verShell Studio to understa11d any dependencies that your snippet has. The
assemblies you list here will be loaded into PowerShell Studio when you use the snippet.

Imports: This section is not used for Po\verShell snippets.

Variable Details: This section is used to configure placeholder variables used in a snippet. Placeholder variables
are added to a snippet when you-right click on the snippet code editor and choose Add Variable.

Once you have given the variable naine it will appear in the snippet as $<variable 113Jne>$ (e.g.
$co1nputerName$) and you can configure the variable properties.

ID
The variable's na1ne.
Default
A default value if required.
Function
Not used in PowerShell snippets.
124 I PowerShell Studio -A Comprehensive Guide

Tytle
Not used in PowerShell snippets.
Kind
Not used in PowerShell snippets.
Editable
Not used in PowerShell snippets.
ToolTip
Provides some text eA.'Plaining the purpose of the variable. This helps the snippet user understand
how to complete the snippet. PowerShell Sh1dio will display these tooltips as the user navigates
bet,veen the placeholders in the PowerShell Studio code editor.

Two built in variables are provided:

$selected$
Allo\.vs you to 1nerge code from the code editor into your snippet when it is used.

$end$
Specifies where the cursor should be placed when a snippet is inserted into the code editor.

--
PowerShell Studio - Basic Orientation 125

2.3.14 Toolbox Pane

r CCToolbox The toolbox pane is one of the most used panes when using the form designer, this is
-
' x
.- c : where all the control objects are located that you will use to create functioning GUI
p forms .
~ <Pointer>
@Sutton
The toolbox pane consists of three tabs:
IiiChart
0 Oled<Sox
[f~ Ched<ed.istSox
Controls:
ti1I ColotOialog
~ ComboBox T11ese are all the GUI controls that you can add to your form.
~ ContextMeruS!rl>
6J DataGnd
{iJ OataGnc!View Control Sets:
ifl DateT11ieP.dcer These are custo1n controls that you can drag and drop fro1n the Toolbox Panel into the
OolMri.JpOown
designer like a11y other ordinary fonn co11trol. They are 111ade up of either single or
9 EtrO!Provide.r
~ FieSystemWatdler multiple controls with predefined property values, event handlers, and functions.
iFj Ro~ayoutPanel
taJ FolderBrowserO!alog
.al FolderSrowserModemOlalog Select:
J3 FontDlalog Tl1is is a list of every control in your fonnat for easy selection.
LI G<oupSox
HetiProV!der
< ~ HSaolJBar We will briefly discuss each control here and its basic function, in later chapters \Ve
r;J !magel.Ast provide much more in-depth functionality and examples of each control.
A Label
A Lnl<1.abel
a. lrstSox
H! lrstvlew
SAPIE1V has created excellent Spotlights on nzany of the controls, where available we
H
[!;) MaskedTextSox will provide the reference.
~~ MenuS!rl>
~ MonthCalenclar
3 Nobfyicon
D Nl.mencUpOown
1ll OpenFikOialog .............................................................................................................................................................................................................................................................................................................................................................................................,
D Panel
Plc:tl..reBox
CONTROL OBJECTS - BASIC OVERVIEW
.........................................................................................................................................................................................., ..........................................................................................................................,..,. ........................................................,
I
@D ProgressBar
@D ProgressBOveriay
~ Prope<tyGnd
)Button
0 Radoeutton 18
BUTTON - Creates a clickable button. Used to initiate or end an action.
A RJdlTextaox
.fl SaveReOialog
rn ~tcontaM"
..,. ~tter
Chart
19
L Statusaar CHART - Creates a chart with several different chart types available.
b StatusS!rl>
LI TabControl ~ CheckBox
f;1 Tablelayootpanel
2
@; Textf!ox CHECKBOX - Creates a windows checkbox control \vhich represents a true/false
@rmer condition
[[!! Too16ar
[[!! ToolS!rl> g: ChedcedlistBox
l.i,. ToorTip
0-- Tr ackaar
-!.:-_ CHECKLISTBOX - Creates a multiple item list check box. allows you to list a
TreeView
VS<ro!IBar
~ Web&owser

18 https://www.sapien.com/blog/20 l l /06/07 /primalforms-20 l l -spotlight-on-the-button-control/


19 http://info.sapien.com/index.php/guis/gui-controls/designing -charts-for-powershell

20 http://info.sapien.com/index.php/guis/gui-controls/spotlight-on-the-checkbox-control
126 I PowerShell Studio-A Comprehensive Guide
collection of items, each ,;yith its own checkbox.

; ColorDialog
COLORDIALOG - Creates a color picker vvhich allows the form user to select a choice of colors for the form.

~: ComboBox
11
COMBOBOX - Creates a dropdo,vn sty le box for multiple items. The item list can be either static or
dynamically built.
- ContextMenuS tnp
11
CONTEXTMENUSTRIP - Creates a men11 of com1nands in a right-click conte>..'t menlt. For your convenience,
when you drop a Contex~enuStrip in the designer, PowerShell Studio will autornatically assign the
ContextMenuStrip to any control you drop it on. To 1nanually assign a ContextMenuSuip to a control you need to
set the control's ContextlvlenuStrip property to the desired Contex.1MenuStrip control.

DataGnd
DATAGRID - Creates a nice grid style table for displaying data, like ho,;v excel spreadsheet style looks.
:nDataGrid is outdated and it is recommended that you use DataGridView instead because of its enhanced
features. DataGrid is retained for back\.vards compatibility.

DataGridView
DATAGRIDVIEW - DataGridVie';v is the ne'1vest grid style data table.
DateTrne?icker
DATETIMEPICKER - Creates a visual cale11dar date picker. You can select long or short dates, time, or create
your own custom for1nat.
~
.., DomainUpDO'A'n
DOMAINUPDOWN - This control at first seems misleading because it makes you think it only have something
to do vvith network domains, but that is not the case. This will create a list type control 'iV ith up/down controls.
In1agine a dropdo'1vn box ,;vhere instead you click and up or do'\ivn selector. This is used on a fonn where you need
to present 1nultiple items but you have liinited area on the form.

ErrorProVtder
14
ERRORPROVIDER - Use the ErrorProvider if you want to notify tJ1e user that there is an input error by
flasl1ing an icon next to the input control. You can use a single ErrorProvider for multiple controls. In the case
where you '1Vish to display different icons or styles, you will need to use multiple ErrorProvider controls.

6fJ FileSystem~Jatcher

FILESYSTEMW ATCHER - This is used to watch a specific directory or file; any changes will raise an event.
This is not a visible control that is added to the fo1ID, you can think of it as an Event Control.

21 http://info.sapien.com/index.php/guis/gui-controls/spotlight-on-the-combobox-contro l
22 http://info.sapien.com/index.php/guis/gui-contro ls/spotlight-on-the-contextmenustrip-contro l
23 https://msdn.m icrosoft.com/en-us/library/msl 71628(v=vs.11 O) .aspx
24 http://info.sapien .com/index.php/guis/gui-controls/spotlight-on-the-errorprovider-control
PowerShell Studio - Basic Orientation I 127

S:ZO: Flol/\'layoutpanel

FLOWLAYOUTPANEL - This is used to create an area on the form tl1at you want to automatically control tl1e
aligrunent and flow of controls. The options for flow direction are "Left to Right", "Right to Left", "Top Do"vn",
and "Bottom Up"

- FolderBrowse.rDtalog
FOLDERBROWSERDIALOG - This is used to pron1pt the user to select a folder.

- FolderBrowserMode.mDlalog
25
FOLDERBROWSERMODERNDIALOG- This uses the 1nodem version of the folder browser dialog that is
available in the later versions of Wit1dows.

= Fontoialog
26
FONTDIALOG - This control prompts the user to choose a font fro1n ainong tl1ose installed on the local
computer.

rxv
L- GroupBox
GROUPBOX - This creates an area on the fonn to allow you to group different controls together for better
design flow "vithitl your form.

~ HelpProv1der
27
HELPPROVIDER - allows you to setup a popup or online help for a control on a form.

~. > HScroDBar
28
HSCROLLBAR- this control represents a standard Windo"vs horizontal scroll bar which can be used to raises
events that 1nanipulate other controls.

~ lmagel.Jst
29
IMAGELIST - Use tl1e I1nageList to store a group of i1nages tl1at can be accessed by other controls, such as the
ListView, TreeView, TabControl, or Toolbar.

25 http://info.sapien.com/index.php/guis/gui-controls/the-folderbrowsermoderndialog-control
26 https://msdn.microsoft.com/en-us/libra ry/System.Windows.Forms.FontDialog.aspx
27 https://msdn.microsoft.com/en-us/libra ry/System.Windows.Forms.HelpProvider.aspx
28 https://msdn.microsoft.com/en-us/library/System.Windows.Forms.HScrollBar.aspx
29 http://info.sapien.com/index.php/guis/gui-controls/spotlight-on-the-imagelist-control
128 I PowerShell Studio -A Comprehensive Guide

A Label
30
LABEL - Creates a clickable text box. Use a label to display text strings. Allows only one line of text, no wrap,
and no multiple lines.

A Linld..abel
LINKLABEL - same as a LABEL control except the tex.1 is a clickable hyperlink.

=: ListBox
LISTBOX - creates a box for displaying a list of selectable items. This can be manually populated or dyruunically
populated .

t ~-
.) .ii "
Listview
31
LISTVIEW - The ListView is a hybrid display. It is tnore co1nplex than a ListBox, but also can display data like
a grid. A ListView control allows you to display a list of ite1ns with item text and, optionally, an icon to identify
the type of item. For example, you could use the ListView to display icons in a similar fashion to the Window' s
File Explorer.

....
1-1 MaskedTextBox
32
MASKEDTEXTBOX - Use the MaskedTextBox to distinguish between proper and i1nproper user input. By
using a mask, you can specify the fonnat of the input without custom validation.

[:- MenuStrip
MENUSTRIP - used to create a clickable, expanding inenu bar within your GUI for1n. You are probably most
fa1niliar with seeing tlris displayed at the top of applications.

a
...;...
MonthCalendar
MONTHCALENDAR - used to create a calendar style selectable date control, this is nonnally used for actions
tl1at can be triggered by a specific selected date.

:!!!I Notifylcon
33
NOTIFYICON - Use the NotifyIcon control, to alert users of special events, such as when a task is co1npleted.

30 http://info.sapien.com/index.php/guis/gui-controls/spotlight-on-the-label-control
31 http://info.sapien.com/index.php/guis/gui-controls/spotlight-on-the-listview-control
32 http://info.sapien.com/index.php/guis/gui-controls/spotlight-on-the-maskedtextbox-control
33 http://info.sapien.com/index.php/guis/gui-controls/spotlight-on-the-notifyicon-control
PowerShell Studio - Basic Orientation I 129

: NumeridJpDO!/\'n
NUMERICUPDOWN - this control is very si1nilar in appearance to the DOMAIN UPDOWN control we
discussed earlier but supports customizable numerical lists.

~ OpenFiJeDtalog
OPENFILEDIALOG - Displays a standard dialog box that pro1npts the user to open a file .

0 Panel

PANEL - creates a panel that you can customize by color, border, and background. Typically used to group
specific controls within a form for designability .

0
PKtureBox
PICTUREBOX - used to insert your own graphic in your fonn. Accepts follo\ving file ty pes; .bmp, .gif, .jpg,
.jpeg, .png, .ico, .emf, and .\vmf

ITID ProgressBar
34
PROGRESSBAR - Use a ProgressBar when you need to show the user that progress is being made in some
operation, sucl1 as copying files.

ITID ProgressBarOverlay
PROGRESSBAROVERLAY - This progress control functions exactly like the typical progress bar, with the
added ability of displaying a text percentage over the progress bar.

~ PropertyGrid
PROPERTY GRID - Provides a user interface for browsing the properties of an object.

@ Rad10Button
35
RADIOBUTTON - Use a radio button when you want to present users \Vith 1nultiple cl1oices, but only allow
thetn to select one option. Radio buttons behave like a CheckBox Control, except tl1at they work in cottjunction
with other radio buttons.

34 http://info.sapien.com/index.php/guis/gui-controls/spotlight-on-the-progressbar- control
35 http://info.sapien.com/index.php/guis/gui-controls/spotlight-on-the-radiobutton-control
130 I PowerShell Studio -A Comprehensive Guide

~A RKhTextBox
RICHTEXTBOX - creates a Windows rich text box which supports multiple lines, and font customization.

= SaveFdeOialog

SAVEFILEDIALOG - Pro1npts the user to select a location for saving a file.

[I) SpbtContainer

SPLITCONTAINER - creates a design area that is divided in two by a sizable bar, either horizontal or vertical.

+I+ SpUtter
SPLITTER - Represents a splitter control that enables the user to resize docked controls. This is superseded by
SPLITCONTAINER and is available only for back"vard compatibility reasons.

b:_ StatusBar
36
STATUSBAR - Use the StatusBar control, to display status information to the user. The StalusBar can also be
used for user interaction but typically plays an infonnative roll.

L StatusStnp
37
STATUSSTRIP - Use the StatusStrip control, to display status infon1-iation to the user. The StatusStrip serves as
a replace1nent to the StatusBa.r and offers inore support for user interaction than the StatusBar by allowing you to
add buttons, progress bars, and other controls.

LI TabControf
38
TABCONTROL - Use the TabControl when you \vi.sh to present a series of related controls that a.re separated
into individual pages which can be selected by a tab.

fo Tablelayoutpanel
TABLELAYOUTP ANEL - Represents a panel that dynainically lays out its contents in a grid co1nposed of ro\vs
and colu1nns.

36 http://into.sapien.com/index.php/guis/gui-controls/spotlight-on-the-statusbar-control
37 http://into.sapien.com/index.php/guis/gui-controls/spotlight-on-the-statusstrip-control
38 http://into.sapien.com/index.php/guis/gui-controls/spotlight-on-the-tabcontrol
PowerShell Studio - Basic Orientation I 131

1sbi1 TextBox
39
TEXTBOX - Creates a teA't box for displaying text and collecting user input in teA't format.

G rimer
40
TIMER - Creates a timer that raises an event at intervals that you specify. Use the Timer event when you need
to run code repeatedly at a specified interval. For exa1nple, you can use a Timer control to check the status of a
process once every second.

~ TootBar

TOOLBAR - Represents a Windows toolbar. Replaced by TOOLBARSTRIP, and is retained for backward
compatibility.

~ ToolStnp
TOOLS TRIP - Provides a container for Windows toolbar objects.

~ Toofrip
41
TOOLTIP - Represents a small rectangular pop-up vvindow that typically displays help for the feature. The
tooltip appears when the mouse hovers over the control.

Q- TrackBar

TRACKBAR - creates a standard Windo"vs track bar.

., _

42
-
! ::- TreeView

TREEVIEW - Displays a hierarchical collection of labeled ite1ns, each of which is represented by a TreeNode.

~ VScrol!Bar
VSCROLLBAR- creates a standard Windows vertical scroll bar.

39 http://info.sapien .com/index.php/guis/gui-controls/spotlight-on-the-textbox-control
40 http://info.sapien.com/index.php/guis/gui-controls/spotlight-on-the-timer-control
41 http://info.sapien.com/index.php/guis/gui-controls/spotlight-on-the-tooltip-control
42 http://info.sapien.com/index.php/guis/gui-controls/spotlight-on-controls-the-treeview-control
132 I PowerShell Studio -A Comprehensive Guide

WEBBROWSER - Enables tl1e user to navigate Web pages inside your fonn.

-
,,..................................................................................................................................................................................................................................._,,................................................................................. ........................................................................................................................................................................................................................................ ..

!:............CONTROL SETS - BAS IC OVERVIEW !


...............................................................................................................................................................................................................................................................................................................................-............................................................................................. ...................................................................................................
~
~

@ BUTTON-MENU BUTTON
Inserts a button that displays an ite111 configurable expandable menu.

@ BUTTON - RUN PROCESS


Inserts a button that starts a process using the Process Tracker and displays a busy iinage until the process is
co1nplete. Uses the "Fonn - Process Tracker" control set.

@ BUTTON - SINGLE CLICK


Inserts a button that prevents inultiple clicks.

@ BUTTON - START JOB


Inserts a button that starts a Job using the Job Tracker and displays a busy image until the Job is complete. Uses
the "Form - Job Tracker" control set.

CHART - DISK SPACE


Inserts a chart that displays local disk space for all drives, can also be used for re1note disk space display.

CHART - MEMORY USAGE


Inserts a chart that displays the top processes for both physical and virt11al me1nory, can also be used for re1note
me1nory usage display.

CHART - TOP PROCESSES


Inserts a chart th.at displays the top processes with the largest working set, can also be used for remote top process
display.

:.-: COMBOBOX AUTOCOMPLETE


Inserts and auto-completing combo box. Auto-completes based on the items listed in the combo box collection.

~ COMBOBOX - COUNTRIES
Inserts a combo box containing all world countries.

=--" COMBOBOX - US STATES - Inserts a co1nbo box containing all US States.

r;.; ELEMENT HOST - WPF CONTROL HOST


Creates an Ele1nentHost control which allows you to host WPF controls inside WinFonns.

FORM- FADE IN EFFECT


Applies the fonn fade in effect when the form first appears.
PowerShell Studio - Basic Orientation I 133

-a:
FORM - JOB TRACKER
Adds the framework to 1nanage jobs in a GUI, \<vhich are used to create responsive forms.

FORM - PROCESS TRACKER


Adds the fra1ne,vork to 1nanage processes in a GUI, which are used to create responsive fonns .
..... LISTVIEW - APPLICATIONS LIST
;~ -
Inserts a ListVie\ that displays a list of installed statuses for a specific application.
.a .,, ..
!~ -LISTVIEW - SORTING COLUMNS
Inserts a ListView that sorts the items when a column is clicked.

@D PROGRESSBAR - RESPONSIVE LOOP


Inserts a ProgressBar that runs a responsive loop with Start and Cancel buttons.

till TEXTBOX - BROWSE FOR FILE


Inserts a textbox with a browse button to enable file selection.

abl TEXTBOX - BROWSE FOR FOLDER


Inserts a textbox with a browse button to enable folder selection.

lablTEXTBOX - GET PROCESS


Inserts a textbox that displays the Get-Process results \<vhen a button is clicked.

r.=JTEXTBOX-VALIDATEBIRIBDAY
Inserts a 1nasked textbox that validates birthdate entry.

- TEXTBOX - VALIDA TE EMAIL


I11serts a 1nasked textbox that validates email address entry.

~ TEXTBOX - VALIDATE IP
Inserts a 1nasked textbox that validates IP address entry.

r;_ TEXTBOX-VALIDATEPHONE
Inserts a 1nasked textbox that validates US telephone number entry. Mask is (999) 000-0000.

~I TEXTBOX - WATERMARK - Inserts a text box with a light gray "vatermark when the textbox is not
currently selected and the user has not typed any input.
134 I PowerShell Studio -A Comprehensive Guide

Office Life

-

-
Chapter 3

Form

"Life is really simple, but we insist on making it complicated."


- Confucius
x

f.t -Tooll ReShn Tools .. Sitt... ~ ':> llltllmotll ~ ~ Delete &t..-ee.tlcaeo


~ SCCMOetc Toda ,6 WSUS l\>dlle f.t Mv"""'1/J Prog li.!l OS " - ' "\. fOc th:tod I>-. j, Java Tooll l'J MoboTooll Q. A.odll>g Tooll ')t - Tooll M Hot>Oool< Tooll ~ V... Tooll 0 McNee

I SCCM Gert -Oiock I oz I Rerww SCCM c..i I or. Ent4r COllllJIUt.er n.... l >
Complete SCCM 01en1 He ant! Check BenewSCCM Ce!l!fica!e ,..
111oo1,....,.awnel"''"'e-d>Od< onlhe SCCMO... Tho !ool ,........,., an frwllldceolic:Memlhe _ _.,_a,_
1 0 - . .. r<q..nd Ml'lllCel ... n.mrig """'1cMebe muodbylhe Sile S..-. In ""'*lc:ert6c:i<elsonedlhe.,..
2.0-. -dV/Mlw1-1 r d - - - l h l l . . . t ..... an SCCMd<ttiobowme-
3 0 - . DCOM Id lo ONlllod
4 0-.lhlll!Md<l<--15'%
5 0 - . SCCM CMllateolat.......,, ....s.- .,.::hiig [~SCCMO... l oz
I
k
Sl!e Seiver Sile Code
, .. a- Ta.I< 5-enot Oll
Unjn313Mnsta8 SCCM Clienl ' - - - - -...- ......
Clean SCCM Task Sequences Thishn:uon ... _ . . , _ l h e SCCJI den RICHTEXT
- - - Han!lr'llSCCMTaolc~can-llC>oeo*".a-110""'ll-SCCMl.ll>dltea0tWSUS eatofal 1 AeancoPodloallylOlhe_e_llion.
This1ool ... doar"'f laoi< _,.,,.,..lhll moyhoYelaledlatone,_ at onolhet. ~- SCCM _,., US a 2.0e.irw..,lludc~onlhe- BOX
cllance IO.....,. l>U!l"'!I \Jl>dales 3 ~lhean'O!t SCCMd<rt.lhonlM>!Ulslhelllest SCCMdenlOll-nro
4 The repootayla..tlul .-.d VII!! ~lapedooned

I~ SCCMO..~ I 01';.
1 """'''--.; ~.. I or.
SCCM Cfien1 Beoair M1SSJOQ UQdajes
Tholool"'1-lhe SCCM0...10 pofomi . _ n- aa 7......,.........., onlhe "'1'W1
a.t..-..Y"'ll>e--.lhl ISIO-lhe tali<fnwwniumgll>e ,_,,_.,..., ThisMclion...tdoc>laylllhe-\Jl>daleaon -..

St.aw. Yu~ ec-p1t.d Job Stat-va [~ ~I.op. l


Lc-.c.. 9llul o.te
PowerShell Studio - Form Design and Projects I 137

FORM DESIGN AND PROJECTS


Over the years, I have created 1nany GUI applications using Po,verShell Studio, and from time to time \Vithin this
book I "vill reference so1ne of that work, such as Automated Remediation Manage1nent Console (ARMS), purely to
demonstrate GUI design and coding examples.

..
l'Jt-Toolo iii fftShnTodo !I-~ !i) U.VU.....aSollwn ~ """-~
ll SCCMa...Toolt .!!. wsus....... "'....,.....,..,. ii;l)os- .... ... ~.. P "'-Todo 1!11 _T.... -...,r.... ~ ""'T""' 9 """""T"" .a \Joe(T.... o-..
wsus~

~!rid lnsclll()ptlons

0 l<c<fyb<t... - ...........

@ lu.odo1rioact1Ncd'rd~
o ,.,,,....,,..,_....,_
VSUS
& .. -....
S.t"V'9.1" fl'_...
J
Por~

._@
s30_ __,
t
:s- "' :l t""' r.., :
0 1o1.o~...........,
,

hlt-.IMt.x~~?
- ""''*"'On U-l
~t~ . . . . .. ~-----~

............
Q i*'ltUMl'IOdtao.~toM;Q't
y., . Sidt 0 ........ 111... - ..
NoclyustrkCOft:Sl'.att.._ 15~
Lon,d>d,.... w--.. u ..- , _,.. How <I?., lo c:hocik (or"~ l.Odll:?
Oofo.A 6mn oa - - @E...,.22""' 0C....,.Holn
~. """" :, 1Solocr ""' :

Vtmon 2:.2.1

figure 76 - Automated Remediation Management Console (ARMS)

Every GUI application shottld start with a good foundation and \Ve11 planned design layout; this will save you
countless hours of re-work later. You should al"vays consider "vho will be using the form, what are their needs,
and \Vhat are their skill levels. Will your fonn be fixed or "vill it be sizable? Is there a maxi1num resolution
constraint that you need to adhere to? Do your research no\v and save a lot of headaches down the road after
you've deployed your forms.

3.1 INTRODUCTION TO FORMS

If a floor is the foundation to a home, then tl1e fonn is the foundation for all applications. Before you start building
your nlasterpiece it is important that you understand what exactly a fonn is and \<V hat are tl1e different fonn templates,
and when to use which each one depending on the tasks that you want to accomplish \Vith your ne'v form.

This 1nay sound daunting, but SAPIEN has pre-built many cominon form templates already for you! And \<Ve will
get into that in just a moment.
138 I PowerShell Studio - A Comprehensive Guide

New PowerShell Script Ne'v PowerShell Scri1>t - tlris is used if you \.Vant to create a simple
Creates a new PowerShel Scnpt (.ps 1). PowerShell script without a GUI. You will notice with this type there is
no "Designer" tab and all controls in the toolbox are greyed out.
New Form
Creates a new GUI based scnpt (.psf).
New Form - this will launch a dialog ':vindow to select the specific form
te1nplate that you want to use. There are 11 different fon11 templates, and
New Project
Pro,JeCts are used to work VYlth nUl:iple one empty form to choose from.
files.
New Form Project We'll be discussing Projects ai1d Modules in the next section, for now
Creates a new GUI based project. we will focus on the form because this is the foundation of al1nost
eve:rytlring that you ':vill do in Po,verShell Studio. We also ':vill provide
New Module Project several tips when it comes to dealing with 1nodules, and ' vhen they
Creates a new PowerShd ~t modlJe
project. should be used and 'vhen you are better off living without them.
New Module From Functions
Creates a script mocUe by selecting
fmcbons from eX1sting ~ts.
New Module From Help File 3.1.1 Blocked Forms
Creates a script modU.e by denvrig
functions from a Pov.erShel help file.
If you have ever gotten a form from a friend, co-\vorker or downloaded
011e fro1n the Internet you have probably been frustrated 'vith the form
being blocked. This is a prevent an unknown file that did not originate
from your co111puter from being
executed ':vithout your kno,:vledge. ! Unblock file
You probably also noticed a yellow triangle next to the open fonn name on the
file tab. If you know for certain that the file is safe, silnply right-click on tl1e file na1ne on the tab, and select Unblock
File. Iffor some reason after doing that it doesn't seem to unblock the file, you nzay need to right-click a second
time and select "Reload Document".

3.2 FORM TEMPLATES

Willie it is i111possible to create, predefined te1nplates packaged with PowerShell St11dio that can fit every scenario
or every user need, SAPIEN has done a great job putting together some co1nmon starting point te111plates.

There are 11 different form templates available for you to choose from, 12 if you include the Empty Form template.
Form te1nplates give you a quick starting point \.vhen creating a new fonn or project.

Thankfully SAPIEN had the forethought to provide the ability, if the predefined templates do not meet your needs,
to create and save your own templates.
PowerShell Studio - Form Design and Projects I 139

3.2.1 Form Border Styles

You can also choose from 7 different border styles for your form to give it that unique look and feel.

None

Yes, you are not seeing things, literally! There is no way to close
the fonn \Vithout killing the running process. Useful if you are
building an application that users should not be able to exit out
of, like a Kiosk.

t1J Form 0 x
Fixed Single

This border style provides a nice clean crisp style, with Title Bar,
Icon, and Control Box.

This is probably one of tl1e most used Border Styles.

rf1 Form o x Fixed 3D

Depending on the operating syste1n so1ne styles may look the


same, as in this case ona Windows 10 syste1n it appears the same
as a Fixed Single style.

Form 0 x
Fixed Dialog
Can you spot the difference? There is no icon, other than that it
is basically the sa1ne as the Fixed Single and Fixed 3D styles.
140 I PowerShell St udio -A Comprehensive Guide

Pi Form D X Sizable
This sty le adds the size control in the lower right corner of the
fonn, allo"ving users to resize your form. This is tricky unless
you've designed your form correctly this can thrO\ all your
form controls out of alig1unent, and your design \ill look very
.... unappealing .
...........

...........
........

...

Form Fixed Tool Windolv


This style re1noves the icon, and both 1niniinize and maxi1nize
buttons. The close butt o11 is also a slightly different design.

Form

Sizable Tool Windolv


This sty le has the same characteristics of the Fixed Tool
Window sty le, however instead of fixed it has a size control in
the lower right, allowing users to resize the windo"v.
PowerShell Stu dio - Form Design a nd Projec ts I 141

Empty form
$ti j Creates an Empty Form

3.2.2 Empty Form

Generates a basic 300x300 pixel bla1lk form. Once you have become proficient at creating GUI forms this will most
likely be the default type that you will choose.

1';0000000 0000 . . . . 0 0 0 0 0 0 0 0 0 0 0 0 U 0 0 0 0 0 0 0 o 0 o 0 0 0 0 00 . . . . . . . . . . U o 0 0 0 0 0 o 0 OOH000000 0 0 o 0 0 0 0 0 n o O o O o o o 0 0 0 0 0 0 o o ooOoOo000000o00 00oo 000000 00000 0 0 0 0 .... 0 0 0 0 0 0 0 0 0 0 0 o 0 Uo 00000o0000000000000 ... 0000000000o00o0000H0000000oOoo0.000000000000000000000000o00000o0o00000 0000

Figure 77 - Empty Form

While it might seem like the least interesting template you would use, it will become the 1nost used starting point
for your GUI forms that you build in the future. As you advance in your knowledge of Po"verShell Studio it is likely
that you will create your own te1nplates, a11d we cover that in this chapter as "vell.

All fonns contain the basic Windows Fon11 design area with Title Bar, Icon, and Control Box (Minimize, Maximize,
Close). You can remove the Control Box completely, or you can remove only the Minilnize or Maxi1nize buttons,
or both.
142 I PowerShell St udio -A Comprehensive Guide

Dialog Style Template


Creates a fixed border form that has no minmlze or maxmize buttons

3.2.3 Dialog Style Form

Generates a 290 x 291-pixel fixed form, with no minimize or maxi1nize buttons. A basic button, labeled "OK" is
also created.

Notice the "O" in "OK" is underlined. This is acco1nplished by enabling the !Text &OKJ
"U seMnemonic" button property and assigning "&OK" as tl1e button text. This is TextA5gn tliddleeenter
TextlmageRela Overlay
probably more familiar described as a Hotkey. In this example, you could click the
( UseMnemonc True J
"OK" button with your mouse or press ALT+O on the keyboard. UseVISUalSty!eE True
UseWaitaxsor False

Form ~

I QK

Figure 78 - Dialog Style Form

There is no code generated with this template except for the standard fonn_load event.
PowerShell Studio - Form Design and Projects I 143

Explorer Style Template


Creates an Explorer style layout with a Tree and List Control

3.2.4 Explorer Style Form

Generates an Explorer style layout \ith 43TreeVie\ and 44ListVie"v controls. This can be used to create your own
custom tree in the TreeVie\ on the left, with nodes and subnodes. Each node or sub nodes can be configured to
display a collection of items in the ListView on the right.

aC Form

Figure 79 - Explorer Style Form

This ten1plate generates the default event code for the TreeView control (AfterSelect). W11en a node is selected in
the TreeView, the code you place in the AfterSelect event will be executed.

43 http://info.sapien.com/index.php/guis/gui-controls/spotlight-on-controls-the-treeview-control
44 info.sapien.com/index.php/guis/gui-controls/spotlight-on-the-listview-control
144 I PowerShell St udio -A Comprehensive Guide

Full Grid Search Template


Creates a form Nith search capab bes and a grid that fills the 'A'indow
to dsplay the reruts.

3.2.5 Full Grid Search Template

Generates a form that can be useful for many different search and results projects including installed software
searches. The template uses the following form controls: Textbox, Button, and DataGridVievv.

Qu~ry
;:::::-::::==-~-===---=:::::==-=-=--==-~--=-=-=:--=-==-=--==-::::=-=-===-==-==-=-==-=-==-=~.-
~~~
............
:! !:

Search i
........ .

--------- ..
I
---------------------~-----------._ _________________ __________________......._____
'"' ~,..---------
- I
..--
I
: I
! I
i !
I I
: ;
l t
: I
I t

i ;
. : t
I

i

r I

i I
..
I
l

I'

't

.i:, t
I'
:t
.:
:
i
'
: t
i: t
t
; f
: I

i !
l !
ll Ii
.
t___ ........................._.,,,_...______________........,__________-..-________. -------- ---------------------.. - ......---.. . . . . . . -- ___________ ;
'

Figure 80 - Full Grid Search Form

This template generates several code functions:

Update-DataGridVie\v - This fin1ction loads the data into the DataGridVie\v.


ConvertTo-DataTable - Converts objects into a DataTable, vvhich are used for DataBinding
SearchGridO - This function searches the DataGridVievv for the specified search string.
ColumnHeaderMouseClick Event - this allovvs sorting of the colu1nn in DataGridView.
KeyUp Event - this search the DataGridView after each key value entered in the teA1:box.
PowerShell Studio - Form Design and Projects I 145

Grid Job Template


Creates a form l/\,th search capabilities and a gnd to display the
re5Uts. The re5Uts are loaded usrng a Job.

3.2.6 Grid Job Template


Generates a fonn that is comparable to the Full Grid Search te1nplate, however in this te1nplate the data is loaded
into the DataGridView using Jobs.

I
'~""'
"
""""'""'
"""""'
""'
-=.-...,""'"-"'-""'
'""'
--""'
-"""
-=-.,,..
.-=.=""'
,...,,__.,...
__..,...
-= - """'
= -"""-.,...
-"- .,..,..,.,.,,."--~
"'""' "' - --=-,......,.,
-=-=""'
--"""""'""'
-==-"""
--""'
-"""-"""
-..=.=-==
-="""
==
---""'-,....,-.,.,....,,.
--=""'
""'
--""'
-'""'
~
figure 81 - Grid Job Template

This is an easy te1nplate to start out "vith when leanling how to i1nple1nentjobs into your forms. Once the form is
created simply switch to the code editor and go to the $buttonStartJob_Click event and enter the code that you
'v ish to nm.
146 I PowerShell St udio -A Comprehensive Guide

Grid Search Template


Creates a form with search capababes and a gnd.

3.2.7 Grid Search Template


Generates a form t11at is basically t11e sa1ne as the "Grid Job" te1nplate, with the exception it does not use jobs
during data collection.

au Grid Search

------------------- [ ~arch

Figure 82 - Grid Search Template

This will "vork fine witl1 data collection that is not time consmning or syste1ns that have a fast response tune, however
if the query takes more than a fe,v seconds the GUI "vill freeze and display a (not responding) message in the title
bar. This can confuse users into thinking that the application has hung. You should use Jobs if you have issues with
this happening.
PowerShell Studio - Form Design a nd Projec ts I 147

Grid Template
Creates a form with a grid.

3.2.8 Grid Template

Generates a fonn that consists of a basic form with a Data ViewGrid control and two button controls (Load and
Exit). U nlike the Grid Search and Full Grid Search templates, it does not provide search capability within the
DataVie\vGrid, but it is a basic starting point.

oO Grid
("

. . - J

Figure 83 - Grid Template

Beginners of PowerShell Studio will fiI1d this is a great example for learning the basics of working vvith a
D ataGridVievv. For an in-depth look at DataGridView controls, read the Deep Dive chapter on controls.
148 I PowerShell Studio -A Comprehensive Guide

r-tenu Template
Creates a layout with a Menu

3.2.9 Menu Template


Generates a form t11at will give you a starting point for a fonn that requires an eA'])andable me11u.

agJ Form
File Edit Help

I
j

!
-~
-----
----
--.- ---_.----...- -- ---
....... ... ....... . .. ...... ............. -
----
-----
-
-----
-----
- --
-
. --------~------------ -- - - - - --
.................. ...-. _______________.... ... .. ---
----
-------
----
-
----
--
~
---
Figure 84 - Menu Template

File Edit Help T. ...


' J
I Copy Ctrl+C I 11 I I T~ee Here I
Paste Ctrl+ V I T~ee Here I
I ~~e nere I

Each 1nenu ite1n is customizable and can consist of several sub-ite1ns. You can configure Hotkeys and Icons for
each menu ite1n .
PowerShell Stu dio - Form Design a nd Projec ts I 149

Tab Control Template


Creates a form with a Tab Control and navigabon buttons.

3.2.10 Tab Control Template

Generates a form "vith Tab Controls and Navigation Buttons, like the one shown belo"v.
...--. -- -....... - ------. --. - ............... --. ---..-.- ---- ---------. - ....-..............- ---. -. ..............-- ----..--- -............ - --- ..-. - ......... ..... --...........
.-- .._

oSJ Form

tabpage 1 tabpage2

Figure 85 - Tab Control Template

Tabs are easiest to understand when we think of the1n in the context being like the tabs 'vithin your Internet Bro"vser.
They allo\v you separate controls into separate pages within the same for1n, this not only allows us to organize
different fonn functions but also to add 1nuch more controls to a single form tl1an otherwise would not be possible.

The navigation buttons in this example is used to move back and forth benveen the tab pages, rather than clicking
the tabs tl1emselves.
150 I PowerShell Studio -A Comprehensive Guide

Text Box Template


Creates a form with a read only text box.

3.2.10 Text Box Template

Generates a fonn with a read only text box.


........... ---- ...... ..... - - -- ...... --- - . - --------- ------- ...........
l
aO Text ~I 8 I~

.I I
I
!

!
i

I
I
I
I

1.
!

11

Ii

1I
I
[ 1.oad ] [ ~ J [ ~ J
!.....................................--
Figure 86 - Text Box Template

In tllis example, several events and a function named "load-text" are created. The load-text function is executed
'vhen you click the Load button. The example command within the load-te:x.1 function is "$richtextboxl.Text = Get-
Process I Out-String" \vllich will quecy the local syste1n for all nmning process a11d output the list to the text box.

The Copy button silnply uses a click event and executes a series of co1nmands:
$richtextbox 1. SelectAll() #Selects all the text
$richtextboxl .Copy() #Copies selected text to clipboard
$richtextboxl.Select(O,O)~ #Unselects all the text
PowerShell Stu dio - Form Design a nd Projec ts I 151

Text Box with Search Template


Creates a form V\'l th a read only text box that has search capab bes.

3.2.11 Text Box with Search Template

Generates a fonn essentially the same as the previous Text Box te111plate ho\vever it also includes search capabilities
within the results.

aEJ Text ~~~


.......___ _ _ ______. IAnd I

[ load J [ Copy J
Figure 87 - Text Box with Search Template

The only difference in this te1nplate versus the standard Text Box form is the addition of the "FindTe:x.1" function
which is used to search the text box that was popttlated by the Load-Text function. This is a good example of how
to implement search capabilities into your forms .
152 I PowerShell St udio -A Comprehensive Guide

Wizard Template
Creates a wizard styfe form Nith navigation buttons.

3.2.12 Wizard Template


Generates a wizard sty le form with navigation buttons.

Wizard
--
Step 1 Step 2 Step 3
-----------------------------------------------------------------------------------------------------------------------------
Enter Name:
I

I
I

L < ~ack ] [ !:iext ) J[ ~ J -'_flni_.sh_) I


I

figure 88 - Wizard Template

Essentially this fonn works by not allowing you to proceed to the next tab (step) until the requirement in the current
tab (step) is fulfilled. Once you proceed to the next step it will however let you go back to the previous completed
step . This is a prime example of utilizing validation.
PowerShell Studio - Form Design and Projects I 153

3.3 FORM PROPERTIES

The great thing about \vorking in an IDE is the flexibility that is available 1vhen designing forms, and PowerShell
Studio excels when it co1nes to fonn design. So, before you create your form let's go over all the prope1ties that are
available for you to custo1nize your fonns.

You've undoubtedly hear the word "forn1" and "control'>used separately a lot, however keep il1 ntind that
"for1ns" are a type of control too (form control).

We will break the properties up into inanageable po1tions for explanation purposes.

3.3.1 Accessibility

v Accessibility AccessibleDescription - description reported to accessibility


AccessibleOesaiption clients.
AccessibleName
AccessibleRole Default
v Appearance
AccessibleName - na1ne that is reported to accessibility clients.
BackColor D Control
> Background!mage System.Drawing.Bitmap AccessibileRole - reports the object type to accessibility clients.
Backgroundlmagelayout Tile
Ctxsor Default
> Font Microsoft Sans Senf, 8. 2Spt
ForeColor Cootrorrext
3.3.2 Appearance
FormBorderStyle FixedSingle
RightToleft No
RlghtToleftlayout False BackColor - choose from either syste111, \Veb or custo1n colors for
Text My form
Use\~/aitCl.rsor False
form background.
v Behavior
AllowDrop False Backgroundlmage - choose an linage that "vill be used as the for1n
AutoValidate EnablePreventForusChange background. This uses the Systetn.Dra"ving.Bitmap class, which
ContextMenuStnp (none)
False
should not be confused with System.Drawing.linage.
Ooub!eBuffered
Enabled True System.Drawing.linage is the base class for
ImeMode NoControl System.Drawing.Bitrnap.
v Data
> (DataBlndings)
BackgroundlmageLavout - there are five choices to select fro1n
Tag
depending on how you 'vant the image to be displayed on the
background, (none, tile, center, stretch, zoom).

Cursor - there are ma11y selections to choose fro1n which 'vill determine the display type of the cursor as it moves
witltin the form boundaries during execution. Below is a small sample of the cursors that are available.

El Arrow II I Cross ~ !Beam ~ No [QJ WaitCursor ~ Help ~ SizeAll


Font - many options are available for defining the default font that you want to use for the form includi11g; font
name, size, unit, font characteristics such as bold, italic, underline or strikeout.

NOTE: Keep in mind when choosing fonts, if you use fonts not installed on all other syste1ns that 1night use your
form and a inissing font is encountered then the font will change to the default font Windows chooses, this could
154 I PowerShell Studio - A Comprehensive Guide

drastically change the intended look of your fonn. I recommend that you al\vays use standard fonts, or at least the
fonts that you k11ovv are installed on all the systenlS that inight use your fonns.

ForeColor - determines the default text color for the fo11n, you can choose from system, web, or custom colors.
Colors, it's a personal thing!

FonnBorderStyle - changes the form appearance and behavior of the border and title bar. There are seven style to
choose from; None, FixedSingle, Fixed3D, FixedDialog, Sizable, FixedToolWindow, and SizabledToolWindo\v.

Styles inay react differently also depending on the flavor of Microsoft Windo\vs that the form is executing
on, for example the same style may look differently on a Windo,vs 7 computer than a Windovvs 10
coinputer.

RightToLeft - indicates should the component draw from right-to-left for RTL languages. There are three choices;
No, Yes and Inherit. 45The most widespread RTL languages are Persian, Arabic and Hebrew.

RightToLeftLayout - [True/False] indicates \vhether the control layout is right-to-left when the "RightToLeft"
property is set to YES.

Text - the text shown on the form title bar. Doesn' t appear to be a character limit so it will run off the title bar if
you enter too many.

UseWaitCursor - [True/False] deternlines the cursor property of the form and its cllild controls. If set to True, tl1e
Wait Cursor will be displayed, and the fonn vvill be unusable until the WaitCursor is set to False.

This is typically alvvays set at "False" in the properties and changed within the script code using
"$FormName.UseWaitCursor = $true" to turn on the Wait Cursor if there is a process executing that you \Vant the
user to \vait on before continuing to use the form, then issue a "$FormName. Use Ttf!aitCursor = $false" to tum off
the Wait Cursor.

~ My form - [J x

Figure 89 - Wait Cursor (Windo'''s 10)

45 https://en.wikipedia.org/wiki/Right-to-left
PowerShell Studio - Form Design and Projects I 155

3.3.3 Behavior

AllowDro1> - [Tn1e/False] determines whether data that the user drags and drops onto it \ill be accepted. Keep in
inind that AllowDrop requires STA (Single Threaded Apartment) n1ode to ftmction properly, we discussed STA
mode in the Script Engine Settings options.

Auto Validate - this will determine whether controls on the fom1 \.ill automatically be validated, if the control
supports validation, when focus changes. There are four options; Inherit, Disable, EnablePreventFocusChange, and
EnableAllo\vFocusChange.

ContextMenuStrip - this will display the selected shortcut 1nenu when the
user right-clicks the fonn. You inust first add a ContextMenuStrip control, (none)
from the Toolbox Pane, to the form before this can be used. If you have inore contextmenustrip 1
than one ContextMenuStrip control with your fonn, the dropdown selector -,00 -te_xtm_en_us_tr-ip-2----'-----~
will allow you to select \.vhich ContextMenuSt:Iip to use.

DoubleBuffered - [True/False] indicates \Vbeth.e r tl1e controls that support it on the form \Vill be double buffered.
This is often used to prevent flickering lvhen scrolling through large amounts o_f data in a DataGridT'ieH1 or other
controls. Double buffering uses a memory buffer to address the flicker problems associated with inultiple paint
operations. Whe11 double buffering is enabled, all paint operations are first rendered to a memory buffer instead of
the dra\.vit1g surface on the screen.

Enabled - [True/False] this detemrine if the fo1m is enabled for use or not. If you set this to False for a form, the
fo1m will not run and \Vill error out \Vith ERROR: Exception calling "Shoi11Dialog" lrVith "O" argurnent(s) : ''Forms
that are not enabled cannot be displa_yed as a nzodal dialog box. S'et the jorn1's enabled property to true before
calling sho111D;a/og."

lmeMode - "6deternlines the Input Metl1od Editor for the fo1111 \vhen selected. An IME is a progra111 that enables
users to enter co1nplex characters and symbols, such as Japanese Kanji characters, using a sta11dard keyboard.

3.3.4 Data

DataBindings - DataBinding ca11 be ve1y con1plex under tJ1e hood, but ttltimately it 1nakes tllings easier for the
sc1ipter/developer by preventing 1nanual ma1lipulation of controls. Tllis is normally used iii conjunction with
forms and specific controls that accept databinding, such as Te>..1box or DataViewGrid. It can be used to bind to an
external source such as a SQL database table.

Data Binding and Windows Forms - https://rnsdn.microsoft.com/en-us/librarv/c8aebb9k(v=ys. l 10).aspx

Data Sources Supported by Windows Forms - hUps://msdn.1nicrosoft.com/en-


us/librarv/f3v6cbOc(\'=vs. l lO).aspx

46 https://msdn .microsoft.com/en-us/library/system.windows.forms.control.imemode(v=vs. l l O) .aspx


156 I PowerShell Studio- A Comprehensive Guide

3.3.5 Design

v Design (Name) - this is the name used in the script code to identify the object, in
{Name) formMy'form
locked False
this case the form. If you change the object ruune PowerShell Studio will
v Focus automatically update the name throughout all the sc1ipt code for you.
CausesVafidabon True
v Layout
Loc.k ed - [True/False] locks the object fron1 being n1oved or resized. This
AutoScaleMode Font
AutoScrol False has no locking effecting on a fonn itself.
> AutoScrolMargil 0, 0
> AutoScrollMinSlze 0,0
AutoSlze
AutoSizeMode
False
GrowOnly
3.3.6 Focus
> Locabon 0, 0
) Maxm.imSize 0, 0
CausesValidation - [Tn1e/False] determines if the component raises
> MinimumSize 0,0
validation events.
) Paddrlg 0, 0, 0, 0
) Size 555, 454
Star!Posrtion \~rndowsOefaultl.oca tion A validatio11 event is so1netbing that typically is niggered to execute Ji
WndowState Normal
v M""tsc
certain event occurs. For insta11ce, you nlight have a piece of code that you
AcceptSutton (none) \Vant to run if a form " closing" event happens, or you might want to trigger
CancelButton (none) a validation event if a specific control has focus or loses focus (meaning
KeyPreview False
v
the mouse moves onto (focus) or away fro1n (lose focus) the specific
Window Style
ControlBox True control.
Helpautton False
) Icon ~ (Icon) There are also two events associated with validation, validating and
lsMdiCon~ False
ManMenuSbip (none)
validated, which is covered in a later chapter.
MaxirnreBox True
MinimlzeBox True
Opaoty 100/o 3.3. 7 Layout
ShowIcon True
ShowlnTaskbar True
SizeQipStyle Auto
AutoScaleMode - deternlines how the fonn or con.trol will scale when
TopMost False
TransparencyKey D either screen resolution or fonts change. T11ere are four options; None,
Font, Dpi, Inherit.

Option Namc Dcscri)ltion


None Automatic scaling is disabled
Font ntrols scale relative to the dlln.ensio11s of the font the classes are usi11g, usually the syste1n
t.
------
Dpi Controls scale relative to the display resolution. Common resolutio11s are 96 and 120 DPI.
Inherit Controls scale per the classes' parent's scaling m.ode. If there is no parent, auto1natic scaling
[ is disabled.
~--------

Most business applications should use the Font automatic scaling mode. The Dpi scaling 1node is useful for graphics-
based applications and is co1npatible \-Vith the default scaling used by the .NET Compact Frainework. This is
typically because Auto Scaling by Font is used when you have a user that inight have bad eyesight ai1d that user
11eeds to increase font sized, you wouldl1' t want to manually control resizing of every child co11trol. Ho\vever, Auto
Scaling affects ALL controls, even controls that do not display fonts sucl1 as picture box controls.
PowerShell Studio - Form Design and Projects I 157

47
Scaling by Font is useful if you \Vant to have a control or form stretch or shrink per the size of the fonts in the
operating system, and should be used when the absolute size of the control or fonn does not n1atter. Scaling by Dpi
is useful when you want to size a control or form relative to the screen. For exan1ple, you inay want to use dots per
inch (DPI) sca1ing on a control displaying a chart or otl1er graphic so that it always occupies a certain percentage of
the screen.

AutoScroU - [Tn1e/False] determines if scroll bars 09 MyForm

automatically appear when the control elements are larger than "
the visible area.

In the example on the right, the fonn was resized by dragging


the lo\ver right comer, as the form size was decreased and the
control "button!" touched the lower part of the for1n, the scroll
bars auton1atically appeared on the right of the form.

[ rlj 1viy Form o x I In the example on the left,


the fo1m was resized until
the control "button I "
touched the right side of
the fonn, notice the scroll L buitonl
bars auto1natically
appeared at the bottom of the fonn.
buttonl

L In both examples when the control "butto11l " touches the right or botto1n of the
>
form and you continue to shrink the form, the button will not go off the forn1,
but rather will begin to 1nove with the fo11n, staying against the side or bottom until resized to normal size.

AutoScroUMargin - [Width/Height] determines the 1nargin around a control during auto scroll. This is set in pixels.

AutoScroUMinSize - [Width/Height] detennines the Ininim1un logical size for the auto scroll region. Tllis is set in
pixels.

AutoSize - [True/False] determines if a control will automatically size itself to fit its contents.

For example, using a button control, in tllis case "buttonl" and tl1e button text is changed "vitlrin the script code
results would be as f ollo\vs:
$buttonl .Text = 'The button will auto size to fit '
115' My Form 0 x fl9 MyForm 0 x

I The button v.ill auto size to fit I I The button l

AutoSize is True AutoSize is False

AutoSizemocle - [GrowOnly/Grow And Shrink] deten1lines is a control can only grow to fit its contents or if it can
also shrink to fit its contents. AutoSize nzust be set to "True "

47 https://msdn.m icrosoft .com/ en-us/library/system .windows.forms.conta inercontrol.autoscalemode (v=vs. 110) .aspx


158 I PowerShell Studio - A Comprehensive Guide

In this example, \!Ve have a button control, buttonl, \!Vith default text of "My First Button", within the script code we
change the button text to "Button".

4i I $buttonftyFirstButton . Text = 'Button'

You can see that with GrowOnly the button stays relatively the sa1ne size when we reduce the size of its contents,
ho"vever, with GrowAndShrink the button size \vill also shrink when the contents are reduced.

'QIJ lv1y Form 0 x

I Button I
GrowOnly

'00 My Form 0 x

I Button I

GrowAnd Sh rink

Location - [X,Y] this is the X,Y coordinates of the control relative to the upper-left of the container. (X) is the
distance fro1n the left border of the display area and second nu1nber (Y) is the distance from the upper border of the
display area. For this property to have any effect on a form, you must also set the "StartPosition" property of the
form to Manual.
MaximumSize - [Width/Height] determines the maxiinu1n size the form can be resized to. You 1nust be using a
FonnBorderStyle that allows resizing, such as "Sizable" and "SizableToolWindow", or this will have no effect on
the form.
MinimumSize - [Width/Height] determines the minimum that a form can be resized to. The same requirements for
FonnBorderStyle that applied to MaximumSize also apply to this property.
Padding - detennines the INTERIOR spacing within a control; ~ My Form 0 x
left, right, top, bottom. If all sides will be the same, then you
only need to specify the padding value in the "ALL" property .
Do not confuse this \Vith space around outside of the control. In
the example on the right, the dark gray area is a large button,
the padding is for the interior text nanie of the button, not My First Button

exterior of the button.


Size - [Width/Height] determines the size of the control in
pixels. You could also use a script command to automatically
PowerShell Studio - Form Design and Projects I 159
inake the control the saine size as a background image with the followiI1g: Fonn.Size =
Fonn.Backgroundlmage. Size;

StartPosition - detemlines the starting position of the fonn when it first appears after execution~ there are five
positions ~ Manual, CenterScreen, WindowsDefaultLocation, WindowsDefaultBounds, and CenterParent

CenterParent The form is centered \vithin the bounds of its parent form.

CenterScreen The form is centered on the current display, and 11as the dimensions
specified in the form's size.
Manual The position of the form is determined by the Location property.

Win clo,vsDefaultBounds The fom1 is positioned at the Windo\VS default location and has the
bounds detennined by Windo,vs default.
Winclo,vsDefaultLocation The form is positioned at the Windows default location and has the
dimensions specified in the fonn's size.

Winclo,vState - [Normal/Minimized/Maximized] determines the initial visual state of the fonn upon execution.

3.3.8 Misc

AcceotButton - by selecting a button control on your form, if a user hits tl1e enter" key on the board it will react
as if the selected button \as "clicked".
CancelButton - by selecting a button control on your form, if a user hits the "esc" key 011 the board it \Vill react as
if the selected button was "clicked''.
48
KeyPreview - [Tn1e/False] detennines \Vhether keyboard events for controls on the fonn are registered vvith the
form. This property was inherited from back in the Visual Basic 6 days \Vhen you needed Key Preview to implement
short-but keys, however th.is isn't needed anymore in Windows Fonns. The whole point of Key Preview is to allo\.v
tl1e UI to respond to a sho1tcut keystroke. Normally keyboard messages are sent to the control that has focus. Setting
tltis to True doesn't cause any proble1ns, if the fonn's Key Down event will n1n, however it doesn't have any affect
if tl1ere is no code associated \Vith it.

3.3. 9 Window Style

ControlBox - [Tn1e/False] deter1nines if the form has a Control/system inenu box, this consists of the Minimize,
maxi1nize, and Close buttons, as well as the fonn icon.

48 https://msdn.microsoft.com/en-us/library/system.windows.forms.form.keypreview{v=vs. l l 0) .aspx
160 I PowerShell Studio - A Comprehensive Guide

HelnButton - [True/False] detennines \Vhether the form has a Help button on the caption bar. Both MaxilnizeBox
and MinimizeBox properties inust both be set to "FALSE" for this to work properly . This \Vilt display a s1nall (?)
mark button to the left of the (X) close button in the caption bar.

9 - $forrrif-tyform_He lpReque s ted= [System. t-JindO\'IS . Forms . He lpEventHand le r] {


10 #Event Argument: $_ = [System. Windows. Forms. HelpEventArgs]
11 #TOOO: Place custom script here
12
13 }

You can use a HelpRequested event handler like the one above to executes specific code if the (?) Help button is
clicked.

YProperties JJ x To easily add the HelpRequested event code to your for1n follo'v these
steps.
w sformMyForm: System.Windows.F. ~
I~ '.El ( J 1. With the Form selected in the Desigi1er Pane, click on tl1e
~ ""'------ l'I

Mou~apnre<
"Lightiring Bolt" in the Fonn Properties Pane, tl1is \Vill switch to the
MouseCkk available events view for tl1e fonn.
MouseDoubleO
Resize8eg11
2. Double-Click on the HelpRequested event, this \vill auto1natically add
ResizeEnd the event code \Vithin the script editor.
Scrol
v Appe.a rance 3. To switch back to the Form Properties, si1nply click the u:1 Properties
Pant
v Behavior Icon to the left of the Lightning Bolt (events).
OlangeUICue.s
ControlAdded Icon - detennines the Icon (.iso) ilnage that is displayed at the far-left
Contr~emove
FormOosed
con1er of the caption bar of the form.
FormOosing
HelpButtonCkl<
HelpRequested formMyform_Hel1
~
lnputlanguage
lnputlanguage
load formMyform_loa>
?
x
QueryAcces:sib

IsMidContainer - [True/False] determines if the fonn is a MDI container. A multiple document interface (MDI)
is a GUI in which multiple \Vindows reside under a single parent \Vindow. This allo,vs you to create an application
that maintains n1ultiple fonns \Vitlrin a single container form. Some exa1nples of MDI are Microsoft Excel and
Microsoft Word.
In the example belo\v I have created a si1nple form (Test_MDIFom1.psf) \Vith an object name of (fonnl).
IsMidContainer is set to True, and a MenuStrip (1nenustripl) has been added, \:vith a menu ite1n of (Forms) and a
child item of (Child Form).

11...J Form Event code ($childToolStripMenuiten1) was generated for the child menu item (Child
Fonn) by double-clicking on the menu ite1n within the desig11er.
Forms
Child Form
PowerShell Stu dio - Form Design a nd Projec ts I 161

71? $childToolStripMenuitem_Click={
8~ $child = NeH-Object System. Hindows.Forms.Form
9~ $child .MOIPar ent = $forml
10; $child . Text='Child Form'
11 ~ $child . Show()
12 ~ }

As you can see I have added in four different lines of code:


../ Line 1 - generates a new windows fom1 .
../ Line 2 - designates t11e parent of the child fonn .
../ Line 3 - gives the form a name .
../ Line 4 - shows the fonn.

The results are shovvn below, a child fonn is novv sho\.vn within a parent form:
09 Form 0 x
Forms

-- - --
aSJ Child Form
---- 300~

!
I

I
I

In this example, there are two child forms, one is open and the other is 1ninimized within the parent fonn.

a9 Form 0 x
Forms

rl: Child Form


162 I PowerShell Studio - A Comprehensive Guide

Even though several years ago, MDI was all the rage and every developer vvas using it, Tabs are the preferred
inethod today. There are still some specific uses for MDI so it has been included here to demoinstrate that you can
build the1n with Po,verShell Studio.

SAPIEN Lead Developer - David Corrales

PowerShell Studio doesn't support MDI because it doesn't work well in PowerShell
due to the nature of the code. This doesn't mean it can't be done, but it will require
manual coding.

You can use another psf to design the chi ld form, but you must modify the exported
code because it generates a function that returns the form's DialogResult, which will
not work for MDI. Therefore, you would have to modify the code by:

1. Making sure the form variables do not go out of scope. Use script scope and
make sure you don't use the same names across forms.
2. Change the Form's ShowDialog() method call to Show()
3. Pass the MDI parent to script so you can assign it to the form.

Interesting enough, you can also use this method to display multiple forms at the
same time (non-modally).

The obvious downside is that after making changes to the GUI in the designer, you
must repeat the steps above. The manual manipulate is the reason we don't
encourage people to go this route.

MainMenuStrip - if you have added a 1nenustrip control to your fonn it will be selectable. This specifies which
menustrip will be the primary for the form. This used for keyboard activation and automatic 1nerging in MDI.
MaximizeBox - [True/False] determines if a Maximize control is presented on the form caption bar.
MinimizeBox - [True/False] determines if a Mini1nize control is presented on the form caption bar.
Opacitv - [Oo/o-100%] determine the transparency (opacity) of the fonn.
Sho'v Icon - determines if an icon is displayed in the far-left of the title bar.
ShowlnTaskbar - [True/False] detennines if the form "\vhen executing will appear in the Windo,vs Taskbar.
SizeGripStyle - [Auto/Sho,v/Hide] determines if the sizing grip will show on the form.
TopMost - [True/False] if set to True the form will always be displayed above other windows that do not have
this property set. Normally this is set to False to avoid user frustration.
PowerShell Studio - Form Design a nd Projec ts I 163

TransnarencyKev- sets the color that will appear as transparent when painted onto the fonn. Default is white.

3.4 CREATING A NEW EMPTY FORM

In this section, we will walk through the process of creating your first fonn, configuring fonn properties, adding
controls, events and script code to 1nake a functional fonn. Jfyou have already installed PowerShell Studio you can
perform these steps as we go.

First create a new empty fonn.

D
,. Nl'W

Open
~

~
@j
New PowerShell Script
Creares a new PO\\erShel Scr1lt (.psl).

New Form

-b3
Cr~tes a new GUJ based SCJ'1)t (.psf).
Open Project

Save ra New Project


Pro)!S ate~ to "'Orie v"tn rrlibilie
!>es.

~. Save As
ra New Form ProJect
Creares a new GUI based pro)t.

Ed Save All
ra New Module Project
Creates a new PowerShel saipt mocUe
pro)Kt.
Create Template...

ra New Module From Functions


Creates a SO'lPI mocUe by seleell>O
g Create File Group.. fi..ncbons from e>OS!JlQ SCJ'1)ts.

@
-.:-
Print ~ ra New Module From Help File
Cr~tes a S0'1Pt mocUe by denvng
fi..ncbons from a Powe-Shel help fie.

Oose

Close Pr0Ject

OpllOnS x Eiat
Figure 90 - New Form
After selecting "New Form" you will be presented with the fo r1n selection dialog

Select a Form Template x


Preview: Templates:
rt"'" \.- )( :0 (I

Empty form
~ Creates an Errc>ty Fonn

ifo 1
Dialog Style Template
Creates a fixed border f'orm that has no minmze 0< maxm.ze buttons

Explorer Style Template


Creates an Explorer style layout with a Tree and List Control

Full Grid Search Template


ifo J to
I~
Creates a form with search capabities and a gnd that fils the wndow
<isplay the resUts.

============::!J l.__c.rid loh.r~t~-----------"


l Select J l
Cancel

Figure 91 - Em11ty Form Template


164 I PowerShell St udio - A Comprehensive Guide

Choose "E1npt:y Fonn" fro1n the form template dialog box.


The new form will be generated and your screen should look like below:

-.-
.....
~~
.., 1::
Soll~Ccrwof

- - .= m..... ""'
~ ....,,-
m., .... c.-< lf~H(lrllQl'lt.ll~

f...-...-i-.
@c.....-
11 .. !!J ~1 ::::.':.7'
-
A 'i"' 6
0

Ii~
x

- -
ill ""T Slit 0 c.cnim
=.i ...
... ("""' t) s...o...._.._ _,.,, 51 Tab Order-
iJy
A'Ol)ertyStl Uitre.afonnT~
Con11al
Re!tf~

t: fji ~
----------------------------.., :lJv Properties

~t: s~.Wrrdows.Fotta.F... v
x

.,;J fOfm -c--~11.e


_ _ _ l.. ;liQil
1 ~, ->
12 @art!Dft
~l ~
.., A<ussibilitv
Acu , c.w
.,.. et ' Id<
'8 ICI.,_,._
'''
e i-
.., Appcantne!C
:;;:J~ ..-.... O eona1
j;l-. > -.....-o v-1
t' CGn~~lrlP Sedcg'our'id:lfta Tk
,Po.- Onor \VIOnor
,,_J O.lOG<..... Foont ~s..Sietlt.
i;:"Oe:T- - ConalTm
(}~~ '91 &deSt'jil So:fMI
o,,,_.- I
fbd'lfTCUft No
oq,.T... 11!..oy. .

~--
~ ............""'111
---- - -
Tt form
:3J rcidufllo;c$1U().!oo
ill 'ofdw'&o '10dtiO.-OO
...........
UWW!Onor Fehie

."9owOtCC>

-
f'altc
id3 FOtlOaloo '1t.110Vlicltll: ~roa..c
1" - Coo<ax"""'51~
-..... ~f&fecF-tibe:

.J-
t.> HScto&tr

A .-
a-
,.,..

[~IA-

- - - - ---- -
- - 1- t - - - 1 L)ycut; Aull! Li.raut >. I - 'v NUM I W I \Jlie: 6 Col: I Ow: I 11

Figu re 92 - Gener ated Empty Form

To change the default text "Fonn" at the top of your new fonn, in the properties panel under " Appearance" change
the property "Text" to whatever you vvish. In Fig. 4 the nanze was changed to "My F orm ".

- 0 x
q 0
rl C<n _....,
A

1:- 1ff 111,,


.. Alon_ ~ [;3 Size b Ccl'\:rol ... ~~~~.!aSpac:r [!] fi] er.... -iys.i l~}J

El
l'
c:no00ox
fdol

x
ill Aq\8ollomc
~ """'
~
!'! c.n...
= ~To~Ntd:tl

QI ""

--------------------------~ y ~ope~
5':e
- ~----
Sooo-'OQ
11 Cont<' vnatv
Poollion

E::f TobOrdor
......
fj~ o-..to ConvolS.t
Pl'-iys.1 lf;l ereatefarmT..O.te
T..0.:.S
Conol
Refmnc<
Hol:>

x I
i m c:iii.. 1 ~ ..) $lolnftyf'ouu: Svs:ttm.Wlndows.F. v

.... ' - .P .li ~! 1 1 1 fiiiJ


~ ~ ....,.,..,,
.... ' - - - - - - - - ' - l A I

"
If
@~-
.. Owt
l
IS
v Accessibility
A--.0

i El
D~
Cheddlox
v
., l':Mv
-DcfaUt
Appear.&~

~ Cdoto.aloo D eono1
BilclcCo1o<
~ c.mbc8ox llad<v....-0 o->
! Contex""""5lre> ~Tl<
/;:lOotoGrd ea- DcfaUt
.,J OotoGn!Mew > ftont Mlaosoft ~Senf.
OoteT- for.colo! Convo!T<XI
o
o~
- f"""8an:lorSt~ St:able
RJ\tltToleft Ho
z;l 1'4eSys...,Watr:het Rlcihllal.tuy , ....
,,. fbwlll'f'Ol,ltP~ Tat Hyfonn

o
__
Ust\Vaitanor Fake
;.I) Fdde8tGSEiC
'ill - .........
;.i3 Fcnll>olog
-""""" AJo.<l<op , ....

--
AutoV*bbe ENblt?reventfoaJst
w \,rOlllllox
ConW<tMenUSt 0-) ,.,,.
.J-
~--
A Lob.i
a.-
NiCled

"""'"'loo-
TM

~ ldlllo

- - 1- + - ....,..,..
----
"""' ,.,.... >. I '. ' ,, NUM I UlNI 1....: 6 Cd: I Ow: I

Figure 93 - Changing Name of Form

The form background color, background image, default font settings ai1d form border st:y le can. all be set within the
fonn properties. You can also resize the fonn by using your mouse to hold down and drag eitl1er the right iniddle,
PowerShell Studio - Form Design and Projects I 165
lower right comer, or bottom of the form. In Fig. 7 you can see we have changed the background image and we
have enlarged the size ofthe form.

;n test.psf x
~~~~~~~~~~~~~~~~~~~~~~~~
Y Properties q. x

[%! $formMyForm: System.Wndows.F... v


o!l" My Form

v Accessibility
~
AccessOleNam<
Ac=sb!eRole Oefadt
v Appearance
Bod<Color D Conlrcl
> Backgo'CUldlma Sy stem.Draw
~Tile
Orsor OefaUt
v Font l>'ocroo>oft sans Serif,
Name l!fil Maosoft Sans
Sue 8.25

Bold FoiSe:
GciOlal'~I 1
GGVerbcall False
Italic Faioc
S!nkl!OUt F~
~False
For~ Conlrorrext
Forrri!orderStyl Sizable
Rlghtroleft
- '- . ""
Bad<9roundlma.g e
No
-. v

Tu! badqoi.nd lmaoe ~ fur the


conlTOI.

Figure 94 - Background Image and Resized

3.5 FORM PROJECTS

What are fonn projects? Si1nple question, with a relatively 1nore complex ans\ver! At the ground level, we can say
that form projects are a collection of 1nultiple forms into a single GUI application vvith more than one windovv.
Not to be confused with an MDI fortn which can contain several child for1ns within the parent fonn. In a fonn
project, we call this 1nodal windows, where one form can open another form, and that form can open another form,
and so on. Each new fon11 opened by a previous form is called a "child" and if that "child" form opens another fonn
then it becorn.e s a " parent" fonn as well as a "child" of its parent. Confused yet?

( PARENT
] CHILD/PARENT CHILD

In a 1nodal window structure when a clrild form is opened the parent form beco1nes disabled until the child form is
closed, this is a means of passing control fro1n the parent to the child, then back to the parent when the child closes.
The 1nethod (ShowDialog) is used \.vhen opening a child form, and when the child form closes it returns the
(DialogResult) back to the pare11t, the Dialog Result tells which button on the child form \vas used to close the form.
166 I PowerShell Studio - A Comprehensive Guide

3.5.1 Multi-Form Projects

Fie
-- - - -~
To create a nevv Form Project, click on File > New > Ne'v Form Project
0 N""'
-- ~
N....., Pe>wr$hell 5<ript

--
Creates new Powe<Shd Scre>t (.psi}.

Open N ~ro; d

~
New Form
~iesanewGU!b3<edr0t (.psf).
Proiect Types:
Opn Projt Since vve are creating a forn1
project that will consist of ra FormProj~

c....... """" r..m project. Used to er"'. scrc>t oOllkabon.


~ Sav

R~ SavAs
~ New Form Project
Lfi'a
Cr"'oanr>" GU!ba<edpr~
multiple forms, select the ra Multi-Form Proj ect
CreateslXO)ert "'' "'"Opie - lJsod to a ...... oal>tappjcabon.

~ SaveAll ~ N- Module Proim


"Multi-Form Project",
Llij
Crea~ new PowerS!lef sae>t modAe
give your project a name and
L
projKt.
n~1 Crute Template ..
~ N.w Module From Functions

kl) Ll&j Creare. <enpt modl.ie by sele<1r19 click "Create".


Credtt fde Group f..ncw>s from X>SlnQ ~ts-
~ Now Module From Hdp File Project"-: Ky Form Pro,ect
@I Print L!lJ Creates a <mpt ll10CUe by derMn<;i
fvncQOn$ from PowerShol heb file, Lo<at!Or>: C:..,..,s~ts\SAP~S"""'i'<OJ a;_ J

-..!:- Close
Another 'vay is to click on

-..!:- Close P101ct


File > New > Ne'v Project

x
Proiect Types:
Select "Multi-Form Project", give your project a na1ne and click
"Create". Lm Empty Project
Creros"" enoty project. used to a .... ~ opp1c:a.,....

Lm Crtcs. ~ Fonn Project


(Q<,. P'JeCt. Used ., er"' ..,.,Iapobt>oo.
I
Lra CfteS. Module Project
-Slid scnp mo<Ut.

Lm MultlForm Project
Crtco prO)<ct ,.;in ""Opie IO<ms. u-..ed to="'. ''"t IQPlfcalfon.

0 New
' ~
New PowerShell Script
Crea~~ a new PowerShd Saipt (.psl).
Pfoiect-: My Proiect

J
- loal1101>: C:'j.Jsers\le~1$\SAl'lfN~ Sludoo'l'ro)Oc Sn>wse
Open
~
New Form fV,Create Pro)OCI Folder
Creates a new GUI based ~t (.psf).

Ii Open Project
NewProj~

~ Save Ci PrOJCCts are l.l!iecl to lk With mulbl)le


l;les.

~. ~veAs
Ci
New Form Project
Creates a oew GUI based pro)ect.
No\v, Po\verShell Studio, will create four files and open thetn in
the editor:
~ SaveAJI
era New Module Project
Creates a new Powe-Shel SCll)t module
project.
~ Create Template... MainFor1n.psf
5J Create File Group...
era Nw Module From Functions
Creates a SQ1>1 modtk by selecting
~ns from elCistwlQ saipts. ChildForm.psf
@I Print era New Module From Help File
Creates a SCl1)t module by detl\/11g Globals.psl
fu:ictions from a Powe<Shel ~ ffe.
Startup.pss

~
Close

Close Project
When you run, debug or Name

Options x ExitJ
package the project into an l!J ChildForm.psf
executable (.exe) or h) Globals.ps1
Microsoft installer file (.msl), all four files and any other (.psf) files that you ffl MainForm.psf
1night have added to the project are all combined into one single (.psl) file! [i My Form Project.psproj
Including all the code that you \Vrite into your forms and code thatPowerShell 0 My Form Project.psprojs
Studio generates to make the GUI application work. By doing this PowerShell
ID] Startup.pss
Studio makes it easy to share variables among forms.
PowerShell Studio - Form Design and Projects I 167

If you would like to see all the code generated and added to the single .psi file you can go to the Deploy Tab, ai1d
click "Export to File", this will export your entire project into one single .psi file which you can open with any
editor to view the contents.
There are several different regions that are created within the script file \Vhen it is generated. If you haven't looked
I suggest that you do it when you get a chance, there is so1ne great infonnation to gain as to how your application
is being generated by Po\verShell Studio.
Assemblies - these co1nmands load the asse1nblies that you used in the Syste1n.Windo'1vs.Fonns

l #---------------------------------
2 #region Import the Assemblies
3 #-----------------------
4 [void ] [reflection.assembly]::Load ('System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c56 l 934e089')
5 [void] [reflection.assembly]::Load ('System.Data, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c56 l 934e089')
6 [void] [reflection.assembly]::Load ('System.Drawing, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f 7fl l d50a3a')
7 [void] [reflection.assembly]::Load ('System.Design, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7fl l d50a3a')
8 #endregion Import Assemblies

Form Objects - these co1nmands create all the objects you used in your forms.

l #-----------------------------------------
2 #region Generated Form Objects
3 #-------------------------------- ------------
4 [System.Windows.Forms.Application] ::EnableVisualStyles()
5 $MainForm = New-Object 'Sys tem.Windows.Forms.Form'
6 $1abe1Domain = New-Object 'System.Windows.Forms. Label'
7 $Domain = New-Object 'System. Windows.Forms.T extBox'
8 $statusstrip l = New-Object 'System.Windows.Forms.StatusStrip'

Recovery Data - this is used to recover .psffiles if they are deleted or lost, inake sure yo1L don't make any
changes here!

l #region File Recovery Data (DO NOT MODIFY)


2 <# RecoveryData:
3 JXcdAB+LCAAAAAAABADsXWlv6tqS/Y7Ef7h6X/3UGz84klpblhAgjE4gTN+YnEDAgAED/vVdq7ZNyE
wSzvT 6nCt Fl wzGLteuvWpa9d83o8HcG7n7bG/d+4f+ZzWe0//zr8R/xf /l v9HIP //8d80d342d3jQ3no6
qvdnofyu9sZObu7P /Wqzs/xYv3pZf
168 I PowerShell Studio - A Comprehensive Guide

User Generated Script- this is your code that you vvrote into the fonns.

1 #----------------------
2 # User Generated Script
3 #----------------------
4 $ErrorActionPreference ='Stop'
5 $0nLoadFormEvent = {
6 Check to ensure application is run as administrator, if not shut it down.#>
7 If (-NOT
([Security.Princ ipal. Windows Prin c ipal] [Security.Principal. Windowsldentity] ::GetCurrent()) .lslnRole ([
Security.Principal.WindowsBuiltlnRole] "Administrator"))

Control Properties - these are settings that are taken fron1 the properties of the controls on your fonns.

1 #
2 # richtextbox73
3 #
4 $richtextbox73.BackColor = 'WhiteSmoke'
5 $richtextbox73.BorderStyle ='None'
1 $richtextbox73.Font = 'Mic rosoft Sans Serif, 8.25pt'
2 $richtextbox73.Location = '539, 495'
3 $richtextbox73.Name = 'richtextbox73'
4 $richtextbox73.Read0nly =$True
5 $richtextbox73.Size = '297, 92'
6 $richtextbox73.Tablndex = 89
7 $richtextbox73.TabStop =$False

PolverShell Studio Management Files


There are a couple of other files that are created that PowerShell Studio needs to manage yotrr project including;
(.psproj, and .psprojs) files, each contain the project naine you used.
The (.psprojs) file is a way for PowerShell Studio to keep track of the files that are part of your project, as you add
fonns they will be docu1nented in tltis file, for exainple, at default the file contains:
1 <ProjectState>
2 <Version> 1.0</Version>
3 <FilelD>d4947ad8-d846-445a-8168-273a2a772acf</File lD>
4 <OpenFiles>
5 <File>Startup.pss</File>
6 <File>Globals.ps 1</File>
7 <File>Mainform.psf</File>
8 <File>ChildForm.psf</File>
9 </Open Files>
10 </ProjectState>
PowerShell Stu dio - Form Design and Projects I 169

The (.psproj) file contains a list of all the reference functions, which are used vvhen calling a form. The default file
contains:
l <Projec t>
2 <Version>2.0</ Version>
3 <File lD>d4947ad8-d846-445a-8 l 68-273a2a772acf</File lD>
4 <Files>
5 <File Build="O">Sta rtup .pss</File>
6 <File ReferenceFunction="Show -Main Form_p sf" Build="O">M ainForm .psf</File>
7 <File Refe re nce f unc tio n="lnvoke-G lo bal_psl" Build="O"
Shared="Tru e">Globals.p sl </File>
8 <File Reference Fun ctio n="Sh ow-C hild Form_psf" Bu ild="O">C h ild Fo rm. psf </ File>
9 </Files>
l 0 </Project>

Globals.psl - th.is contains global variables, functions, and other values that are shared among the mttltiple fonns
in your project.

Nfake sure under the p roperties for Globals.psi, in the Misc. section, set Build to "Include", and Command Ext to
"True", or it i11ill not i11ork properly and the functions i11ill not be accessible.

Let's look at an example of a functio11 in the Globals.psi accessible from other forms in the project. By default,
' vhen you created a ne'v fonn project the Globals.psl file vvas generated auto1natically and SAPIEN populated it
with a couple of examples for you. The function "Get-ScriptDirectory" is defined in the Globals. psl file. If you are
in a11otl1er form and you start typing "Get-ScriptDirectory" you will notice a pop-out tl1at \ivill give you infonnation
on the function, including its location in the GJobals.psl file.

l
2iG $MainForm_ Load={
3 j #TOOO : Initial ize Form Cont rol s her e
41 get-scriptdirectoryj
5
6
n
function get-scriptdirectory
Get-ScriptDirectory returns the proper location of the script.
7 jD Output Type: System.String
8
~I
I
1 Source File:~ Globals.ps1

Startu p.oss - this is where you can pass paraineters to the application ''before" it loads. Adding a Parani block
to the Startup.pss file allows y ot1 to provide startup parameters to yot1r proj ect vvhen it iuns. The runtime
behavior depends on 11ow t11e project is started. If you start youT project from the console, tbe11 you provide
parameter values on the co1nmand line, separated by spaces. If you are starting a Forms project, then
PowerShell Studio will pro1npt you for the paran1eter values. If you package a project into an EXE file,
the11 you mt1st always provide startup paraineters on the command line. You can also add Param blocks
to fonns and scripts i11 your project, as long as their Co1nmand Extension property is not set to true.
Si1nply add a Param block to the beginning of the file and provide parameter values \iVhen you invoke
the file .
170 I PowerShell Studio - A Comprehensive Guide

3.5.2 Scope Variables

Lefs e>.'J)lore the different types of scopes as related to PovverShell and how scopes are used to isolate a script's
modifications. When we are talkil1g about Po,verShell, a ''scope" refers to the current environment in which a script
or command shell is n1nning. Scopes can be used to protect certain objects from being unintentionally modified by
scripts or other functions, unless explicitly told to do so.

The follo\ving are protected frorn modification by cornmands run from another scope:
Variables
Aliases
Functions
PSDrives

Ne\v scopes are created \vben a script is executed or ' :vhen a ne\.v sessio11 or instance of PovverShell is created. There
are some scopes that have a special meaning:
Global Scope - is the scope created when PowerShell starts, and includes variables, aliases, functions, and
PSDrives that are built into PowerShell as \Veil as ones made by your PowerSbell profile.
Local Scope - refers to whatever the current scope is. When PowerShell is started, it refers to the Global
scope, when you execute a script it refers to the Script Scope internal to the nUUling script.
ScriJlt ScOJle - created \vhen a script runs. Tl1e only conuna11ds that operate \Vithin this scope are those
conunands within the script.
Private Scopes - can be defined within the current scope to prevent con1111ands in other scopes from being
able to read or modify items you do not want thern to have access to.

As vve mentioned, co111lllai1ds executed within one scope does not affect items in a11other scope unless we
specifically tell them to do so. As an example, if \e create a variable named $ThisVar in the Global Scope and a
script executes which nms a co1nmand to change the value of $ThisVar. A copy of $ThisVar ' vill be created in the
Script Scope and the value altered. If I checked the value of $ThisVar fron1 within the script, it vvould appear that
the value had been changed, hovvever once the script bas ended and you check the value in $This Var you \Vill notice
tbat the value is the same.

Why is that? Because remember within a script you are using the Script Scope, and a Global Scope variable \.Vill not
be affected frorn a script corrnnand UNLESS you explicitly request it. To cha11ge a Global Scope variable fro111
witllin the .Local Scope (remember ,;vhen a sc1ipt is executing the Local Scope refers to the Script Scope), you only
need to add the scope name at the start of the variable name, and put a colon betvveen the scope and variable na1ne.

$global:ThisVar
$script:Th is Var
$1ocal:ThisVar

This comruand within a script would change the Global Scope variable $ThisVarvalue:

l $global:ThisVar ='Changed the global scope variable value'


PowerShell Stu dio - Form Design a nd Projec ts I 171

It is very colTilnon for a parent form to collect data fro1n a child form, and PowerShell Studio handles this remarkably
well.

For exa1nple, a main fonn opens a child fonn where a user inputs data into a text box and clicks OK on the child
form, which closes the clrild fonn and control is returned to the parent fonn. But you need the data that the user
entered (text property value) of the Text Box.
When you add the reference function for the child form (Call-ChildForm_psf) to the MainForm.psf script,
PowerShell Studio will automatically 1nake the values of the control properties of the child form available to the
inainfonn.

You can create a script-scoped variable in a child fonn, for exainple to create a script-scoped variable for the text in
a Textbox, you can use something like: $script:ChildForm_Text = $textbox.text.trimO

49
June Blender of SAPIEN has written an excellent article on Multi-Form Projects which
includes a great explanation ofScript-Scopes and Return Variables.

3.5.3 Collection Project

Collection Projects were introduced with Po,verShell Studio 2014, and allowed you to create a new project to keep
track of groups of files, including psl script files.

x
Project Types:
Collection Project
lrr I Creates a project that alows you to group files.

Empty Project
j !liJ Creates an empty project. Used to create a script appkabon.

I 1 Form Project
I Vi~ Creates a Sl'lgle form pro,Ject. Used to create a 501>t appkabon.

I I Module Project
I rd Creates a PowerShel 501>t modUe.

Project Name: My Colecbon

Locabon:

~Create Project Folder


I Create ICcanceJ ]
Figure 95 - Collection Projects

49 http:/ /info .sapien .com/index.php? option=com_c ontent & view=article &id=246 :how-do-multi-form-projects-
work&c atid=27 &ltemid=2656
172 I PowerShell Studio - A Comprehensive Guide

There is no Startup.pss file generated with a Collection Project because each file is considered individual content
and therefore tl1ere is no need for an entry point. Each file can be nm individually using the "Run" co1n1nand on
the Ribbon Bar.

New options were added to the Collecbon Project in oi-der to accommodate yotrr deployment needs by controlling
the behavior of the Packager, MSI, and Deploy1nent as a whole or as individual files .

Two new project properties were added:

~~epcrtcl
De1Jlov As:
:O cro...-o off fl
This determines tl1e deploy1ne11t behavioi- of the Project as a \hole. There are two
C]l l g) .
"De~
Deploy As options to choose fro111:
~--
Pr-yHc
,.
Scrjpt ~l
~ Hbc (File) - Tells the project to handle each file individually when it comes to
~hr.le Groepof f!An
.. OJC"'l ..... ~:: deploy1nent. Each project file will maintain its O\Vll independent settings.

When to use: Use this setting when you are using the Collection Project to group
individual files that don't i1ecessary interact with each other. Witl1 this setting you
OejloyAt
Ol:lb u
to-dul\s,_-,t b- 6 lfe Ni dtd WI can package and deploy (pubbsh) eacl1 script independently.
d'>t ~

(Project) - Tells the project to handle the deployment of all the files. You inust
define a primary file for the purposes of the Packager and MSI builder.

When to use: Use this setting when you have a group of files that interact and have a start I entry point
script. For exan1ple, if you have a priinary script that dot sources various secondary scripts. In this case,
tJ1e pri1uary script \Viii get converted into an executable and you can create an installer that includes the
primary packaged script and all the supporting files I scripts. The project files are also deployed (published)
as a whole.

Primarv File:
This property tells the project, wllich file is tl1e pri1nary file \vhen Deploy As is set to Project. The pri1nary file
will be the file that is packaged into an executable. All other files will be considered external " Content".

Previously the deployn1ent options were unavailable in the Collection Project t1nless you opened tl1e files
independent of the project. These nevv deploy.ment settings no\v allow the Collection Project to fit your
deployment needs.

3.5.4 Module Projects

A script module is a file (.psn1l) that contains any valid Windows PowerShell code. Script developers and
ad111inistrators can use this type of module to create 111odules whose members i11clude fm1ctions, va1iables, and more.
At heart, a script 1nod11le is simply a Windows PowerShell script vvith a different eA.1ension, which allovvs
administrators to use i1upo1t, export, and 1nanage1nent fm1ctions on it.
PowerShell Studio - Form Design and Projec ts I 173

In PovverShell Studio you can also add a form (.psf) in the 1nodule vvhich is vvhy the final script has to be generated
before it is included in the module' s script.

A PovverShell Module consists offot1r components:

..;' Code File (.psml) - either a script or 1nanaged cmdlet assembly .


..;' Support Files - additional files that the Code File might need like assemblies, help files, or scripts .
..;' Manifest (.psdl) - vvhich describes the Code File and Support Files, as well as store metadata such as
author and version. Manifests are not required for a 1nodule. Modules can reference script files (.psl ), sc1ipt
module files (.psml), inanifest files (.psdl ), formatting and type files (.pslxnll), cmdlet and provider
assemblies (.dll), resource files, Help files, localization files~ or any other type of file or resource that is
bundled as part of the inodule. For an internationalized script, the module folder also contains a set of
message catalog files. If you add a 1nanifest file to the module folder, you can reference tl1e mt1hiple files
as a single unit by referencing the manifest.
..;' Directory - a location that contains all the above files in a location that Po\verS.hell can reasonably find.

None of t11ese co1nponents, by the1nselves, are actually necessary. For example, a module can teclmically be only a
script stored in a .ps1nl ftle. You can also have a module that is nothing but a manifest ftle, vvhich is used mainly
for organizational ptu-poses. You can also w1ite a script tba t dyna1nically creates a n1odule, and as such doesn' t
actually need a directory to store anything in.

50
Jv!icrosoft offers a great article on flow to 1vrite a Pov11erShell Script Module. You create a script module by saving
1

a valid Po"verSbell script to a .ps1nl file, and then saving that file in a directory located \Vihere Po,verShell can find
it. In that folder you can also place any resources you need to run your script, as \ell as a n1anifest file that describes
to PowerShell ho\:v youJ n1odule works.

It can be confusing when using "Build Module" because all the .psl files within the Project will be merged into one
script and inserted into the Module .psn1l file. Again, tllis is because of the ability to add a .psf fonn file, wllich
needs to be generated by Po\verShell Studio to create all the code needed to Sl1ppo11 the form.

'I' Properties c " x If for some reason, you do not want files to be 1nerged, you can set the file' s Build
_ _..'--'
" Property to Content instead of Include. Do this by selecting the file in Project pa11el
ff;J~ I M and the11 use the Property panel to change the file's settings. Settit1g the file to Content
v Mls<:
Buld ensures the file will be included when exporting the 1nodule.
Niltne
Content
'
5"t R~lstryValud"orAllUS>
~ .
ef~fnc I~ ~

Shao-ed Fal$e Setting the file to Exclude "'ill ensuTe that the file is NOT included when exporting
the n1odule.

Setting the file to Include vvill ensure that it IS merged when building t11e module.

Build
HDw the fit relates to the buld and deployment
proce=.

50 https://msdn.microsoft.com /en-us/library/ dd878340 (v=vs.85).aspx


174 I PowerShell Studio - A Comprehensive Guide

; ;
toooOOOOOOOO+o- ooo. .o . .o o .. .o.oo. .oo. .o ooo. .o . .o . .o . .o . . oooo+oooooo . .ooMOM OOOOO O O OOO OO. .O . .O . .O OOOOOOOO H O- - OOOO. .O . .O O.OOOOOOOOOO. .O . .O M O M O . .O . .O . . OOOO' OO >. .O OOOOO OM OOOOOOO OOO OO"O"O" 'O OOOOOOOOOOO- OOOO. .O . .O . .O O.OOOOO<O. .O"O'"OM O M O . .O . . O. . . . .. . .. .. . . . . . . .. .. . . . . .. . .. . .. . .. , , , ,, , , . , ,, ,, , ,, . ., _ ,, , ,. ., . .. , , . , , , ,. . . . . . . . .. .. . .. . . . . . . . .. . .. . .. . .. . . . . .. .. . _ , ,, , ,, , ,, . ., . , , ,, . ., . . ., , H 0000~
OO " - '' ' ' ' "" '' ' " ' ' ' '' ' ' '. .O . .O M O M 0 . .0 . .0 . . 0000 ' 000. .0 . .0 0 00. .0 -00 0 0 000 00. .0 000. .

, ~ N""' PowtlSh.11 Sc:np1


There are many times where \!Ve find that as sc1ipters we are constantly
~
1(""" Open
- Create:,,..,. p.,.e<51ie1 Saw>! (.C>S I).
reusing functions that we have written from previous projects. Normally
we copy/paste the function code from one script to another, but there is a
~ Open Project
better way . You can create a ne"v inodule based on those functions so that
ld Swt all yo1rr scripts can siinply reference the inodttle in a centralized location.
c-~ s.v.As
Id Sm: .All This allo'1vs you to Ccnll'ert Functions ,nfo Module x
~ Cr ..te Templ41<- import functions from
rn f1odulc:

@I
~

CJ..10 Fflt Group-

Pnnt

Oou
various psl sc1ipts a11d
merge them il1to a
single script 111odule .
Source JU~~ runctlOns
1v "Q - 1
-
~ .,, n 9""' -Mew ....ee 16,.ps!

lii:tt"'crad....._
v- e ~~Jll&f

'--~~~~~~~~~~~~--'
When you select this "...,,. 1x e.i "'n c.._..._
.., (: Cict~v

.,;~ --....._,.,
option, you \~ill be
first asked to select a file (if one is not already open), the11 you
will be presented witl1 a dialog to select \IV hich functions to
include in your new 1nodule, as "veil as t11e ability to naine your
1uodule.

Module Name - This is where you give your module a name to use. It is not reco1mnended to use 1nod1tle .names
that contain spaces.
Location - You can specify where you would like the modttle saved, by default it \ Vill be saved in the Po'1verSbell
Sh1dio project directory.
Create Module Folder - tllis option 'vill create a ne\iv folder using the module's name and places aJI the relevant
files for the module within that directory.
Sou rce Files - the list of all files that you have added that will be used to i1nport functions tl1at you select.
Add File - use the Add File button to add n1ultiple files to the Source Files list.
Remove File - used to remove selected file(s) fTorn t11e Source Files list.
Functions - presented as a node list, this list is compiled fro1n the files in the Source Files list. You can check the
functions that you \Vant to import and llllcheck functions you do not wish to import. Any check ftmction that includes
referenced ftmctions \IV.ill also be imported.

If any duplicate identical functions are found, the function \vill only be i111ported once. If a11y functions are fotmd
that have t11e saine name but the code in the functions are different, all '1Vill be imported however, PowerShell Studio
\ill renan1e all duplicates a11d an error will be shown in the Output Pane.

Once you click on "Create Module" Po'1verShell Studio \Vill generate three files:
.psd 1 - this contains the modules manifest.
.J>Sm 1 - contains all the iinported functions and the Export-Moduleme1nber c111dlet state1nent listing all t11e
imported functions.
.help.xml - contains the PowerShell XML help file for the inodule, which is generated from the imported
.fimctions.
PowerShell Studio - Form Design and Projects I 175

There are times when we do not want to share specific functions, aliases, variables or cmdlets \.Vith users. Export-
ModuleMember can enable you to tell what functions are visible to a user.

For exa1nple, let's say there are two functions in a module; Get-Userlnfo and Get-Processes. If we want only the
Get-Processes function to be visible to users, we would use the follo\.ving code in the module co11taini11g the
functions:

Export-ModuleMember Get-Processes

If we wanted both to be visible we ,;vould use:

Export-ModuleMember Get-Processes, Get-Userlnfo

L...................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................j

Provides the ability to generate a PowerShell


New Module x
Module from an iinported .XML help file. Three
Module:
files are generated; .psdl , .psml, and a Test-
Module Name: 1CmdletSarnples
Module.psl. Wltile it doesn 't quite generate a
locabon: l c:~\leff'Poa.ments\SAPIEN'fowerShel Studio'frojects """'] [ Browse J fully functio1ting nlodule it can save some ti1ne
and give you a starting point for your 1nodule.
Create MocUe IL cancel =i...
176 I PowerShell Studio - A Comprehensive Guide
Chapter 4

FOR
PowerShell Studio - Form Controls I 179

FORM CONTROLS

It isn' t about the singular use of a control, designing a form is about having numerous controls work in unison witl1
each other! Controls are at the heart of any GUI fonn, fro1n the fonn itself to the controls the form houses such as
buttons, listviews, datagrids, etc.

A common mistake is the improper use o.f ( ) and (-eq) so let 's clear it up before moving on:
If ($box.checked = $true) f- This assigns a value of $true to $box.checked.
If ($box.checked -eq $true) f- This is evaluating the current value of $box.checked.

4.1 BUTTON CONTROL

0-.. 51 Thebutton is one of the most used controls, it provides interactivity between the user and the fonn,
usually to start or stop a specific process flow.

~ Form 0 x There are many combinations of properties that you can use to
customize buttons to fit almost any design that you are looking for.
button1 Flat Style Back Color
Whether it is changing the button style, font style, font colors,
background colors, background i1nage, or adding an icon to the
~on2 I Popup Style button2 - Background lrlllllje
button, you will find almost with practice you can create some very
eye appealing buttons for your fonns.
r ... ~_.,
'""""'"' Standard Style MT0'6J Fonts
When you first create a button, it uses a default na1ning convention
of $button!, the I being the next nu1nber available for the button
bU!on4 J System Style Image
control. What happens if you copy/paste a button? For exa1nple, if
.._____ _ _ _ _ _ _ _ _ _ _ _ _ _-=--.: the button is named "buttonl", when copied it will be automatically
named "buttonButtonl ".

You can, and should always change the name of your button controls to reflect a na1ne easy to identify in script code
\.Vhat it does. For exainple, instead of "buttonl'', it might be called "Query_Running_Processes". To reference t11e
button control in script code we would of course add a $ to the beginning of t11e name; $butto11l or
$Query_Running_Processes.

51 https://www.sapien.com/blog/20 l l /06/07 /primalforms-20 l l -spotlight-on-the-button-control/


180 I PowerShell Studio- A Comprehensive Guide

4.1.1 Button Events


:.c1d Events (Sbutton 1) The figure 011 the left shows tl1e 58 events that ca11 be associated with a button
' .. p control.
Aut<>SizeChanged
[1 ~
r Bad<gOU>dlmageChanged
An event is basically a change that has occurred to the contro4 such as the
D Bad<9r0Uldlmagel.ayoo!Chanoed control "vas "clicked" or the mouse nioved over the control.
[1 BlndlngCon~xtO'langed
L causesv~~
[J Ci;entsizeehanged
c Con~><lMe!>uS~ To add ai1 eve11t, right-click on the button control and select "Add Events"
l Curso.-Changed
r

,
O<XkChaoged
[_ ~
[1 Fontdianged
Ql Edit Default Event (Click) The Default Event for the button control is
[_ ForeColotehanged Add Events... Ctrl E "Click'', or select the b11tton and press "Ctrl-
[ Loca~
[_ Marljin(honged
Go to Event E" .
[ ReQOOChanged if/ Rename
[. Ri<jltToteftehanged
l Slz~
[, Tablnde~
0 Help
-
PowerShell Sn1dio handles most of the
l TabStopOlanged 00 Apply Property Set.. Ctrl + l background details of event inanage111ent for
[1 Tex!ChanQed
~d
I!! Create Property Set... Ctrl + Shift + l
- you.
c dick fil Create Control Set... Ctrl + T
[_ ControlAdded -
C ControRemoved
[J Dra'11)rop
Insert Recent Control An event is a me1nber of a class, just like a
[1 DragEnter
c 0.-agOV'er
rlil Copy Ctrl + C property or a inethod. Wbe11 you use the
[ DraQleave ~ Paste Ctrl + V
Get-Member cmdlet by default, it renrrns
l GIW'~ )( Delete Del
r events, along with the other 1ne1nber types.
U P~
r
r
HelpRequested

Pa.nt ,.
DD
DD Select All

Bring to Front
Ctrl +A

Ctrl + B

>
~yCon~ag
[ QueryAcassiblhtyHelp Send to Back Ctrl + Shift + B For exa1nple, a close button ($b11tto11Close)
c fnter is an instance of the button class,
L KeyOown Properties
r J(e~es
00 View Code Svstem.Windows.Forms.Button. You can
[_ J(e~
[ ' Layoot Document Outline create a button and add it to a fom1 "vitl1 the
lJ leave
t'1ouseClick
co1nmands:
D MQuseQipueChanged
l MouseDown
[. Mousefnter
L Mousel.eave
1 #Create a close button
[
l
MouW!over
M~ve
2 =
$buttonClose New-Objec t 'System.Windows.Forms.Button '
D MousellP 3 #Add if to the form.
[_ Move
[ Prev~wl<eyOown 4 $form l .Controls.Add ($buttonsClose}
c Resltt
[ Cl>angeUICoes
[' s~
[ SystrmColoisChanoed Like all buttons, i11 fact like all controls, $ButtonClose has a Click event.
l Va'damg
[. Vaada~ When the Click event happens ("is raised"). tlle system calls the event handler
C Parentehanged for the Click event.

An event handler is code or script that is designed to respond to an event.

Typically, you ~vrite the event handler com1nands in a script block a11d save them in a variable that is natned for tl1e
event. In this example, we "vrite an event handler for the Click event of $buttonClose. We write a co1n1na11d that
calls the Close() inethod of the fonn, enclose it in a script block, and assign it to a variable conveniently named
$buttonClose_ Click. Despite its usefulness, tl1e variable naine is just a name and it has no effect on tJ1e outcome.

l #Create an event handler


2 $buttonClose_Click = { $forml .Close(}}
PowerShell Studio - Form Controls I 181

The next step is to "register" the event handler script. Registering associates the Click event \:Vith the
$buttonClose_Click event handler: When the event handler is registered, the system n1ns the co1ninands in the event
handler whenever the Click event happens on the $buttonClose button.

To register ai1 event handler in PovverShell Studio, in the Properties box, click the Event icon (thunderbolt). In the
ro'\tv for the event, such as Click, type the name of the event handler variable without the dollar sign ($).

For the default event of each type, like the Click event of a button, PowerShell Studio does it for you.

But, in the background, Po\verShell St11dio writes a co1nmand to register the event handler.

Here's the syntax of an event registration cotrunand .

.add_($eventHandler)

For example:
1 #Register an event handler for the Click event
2 $buttonClose.add_C lick($buttonClose_Click)

In this case, $buttonClose is the object, $buttonClose_Click is the event ha11dler.

But what is add_Clicl{O? Or, inore generally what are those inethods na1ned add_<EventName>? If you search
MSDN in the Button class (System. Windows.Forms.Button), or the class of any other control, or even their parent
classes, you won't find any nlethods na1ned add_ClickO or add_<AnyEventNa1ne>.

Example:
You have created a ne\v form with one button na1ned "buttonl", ai1d added two events: Click and TextChanged. If
you Export to File fro1n the deploy tab, and examined the produced .psl file, you will notice that Po,verShell Studio
has done a lot of the work in the background for you, as seen belo,v:

1 #Create button 1
2 $button 1 =New-Object 'System.Windows.Forms.Button'
3 #Add button 1 to the form
4 $form l .Controls.Add ($button l)

#Button 1 properties
$button l .FlatStyle = 'Flat'
$button 1.Location = '27, 43'
$button l .Name= 'button l '
$button l .Size= '75, 23'
$button l .Tab Index = 0
$button l .Text= 'button 1'
$button l .UseVisualStyleBackColor =$True
182 I PowerShell St udio -A Comprehensive Guide

l #Register event handlers for the Click and TextChanged events


2 $butto n l .add_TextChanged ($button l _TextC hanged)
3 $butto n l .ad d_Clic k($bu tton l _C lic k)

And you will see the following script code added for you:

1 $butto n l _Click={
2 #TODO: Place custom script here
3 }
4
5 $butto nl _TextChanged={
6 #TODO: Place c ustom script here
7 }

Why use an IDE like PolverShell Studio if you can hand-code the script?
Sure, you could hand-code everything to create your own script file without using an IDE, and no\v that we have
pulled back the curtain, and exposed the magic behind the scenes, you can see that even using an IDE the script
n1ust still confonn to PowerShell scripting standards. An IDE allows you to acco1nplish what used to take hours in
only minutes ! With PowerShell Studio, you need only drag/drop a control onto your fonn, position it where you
like, set the control's properties, add events that you need, and insert the specific code that you would like executed
when a specific event is raised. It's really that si1nple! The majority of the coding is done by Po\verShell Studio for
you. Yes, I fully expect this to make hardcore PowerShell scripters heads e>..'Plode, but then again, the C# guys felt
the saine \vay until they e1nbraced Microsoft's Visual Studio!

4.1.2 Button Manipulation

> ................................
$buttonl .
f
~
A~~~~i.t;fiit:yoi;j~ct...................................................................

................ .. ................................. ................................


._ ._ _. ._._
"
r AccessibleDefaultActionDescription
> AccessibleDescription
> AccessibleName
--- > AccessibleRole
G add_AutoSizeChanged
G add_BackColorChanged
G add_BackgroundlmageChanged
G add_Backgroundlmagelayout(hanged
:G add_BindingContextChanged v
PowerShell Studio - Form Controls I 183

In the Script Editor, as you start to type the control ruune ending with a period (.), a dropdo"vn will open showing
you all the methods and properties that you can apply to the control.

Control manipulation cormnands 1nust be


executed either directly or indirectly by a
raised event to work . The example on the left
demonstrates 11ow t11e $button! .Text
#TODO: Initialize Form Controls here
$buttonl.Text = 'Does ~.Ork' co1nmand will work \vhen the Load Fonn
} event (direct) is raised or "vitllin the Function
6
' $buttonl . Text = 'Does Not ~lork'
when it is called by the buttonl_click event
8 raised (indirect), but will not be executed if
9 function Change-Button no raised event has acted upon it, as in the
- {$buttonl.Text = 'Does ~rk' }
middle example.

- $buttonl_Click={Change-Button}
14

When you type the control na1ne within the editor and
enter a period at the end (.) you will see a pop out menu
$button.'ly8utton.
> fA~~-~~ibiiitYQb}~ct .....,_,_,........_..._,_,..._._..._,_,,............_,,] I\
to sho"v you all the available properties and inethods
> A~~~~it;i~o~i~~liActi~~o~~~i.P'ti~~.........................

> AccessibleDescription
available for t11at control.
> AccessibleName
> AccessibleRole
0 add_AutoSizeChanged
0 add_BackColorChanged
0 add_Backgroundlm ageChanged
tj add_BackgroundlmagelayoutChanged
0 add_BindingContextChanged "

$buttonMyButton .text After typing the property or


>Size
method, there will be another pop
} " Suspendlayout
> Tablndex out tl1at provides you n1ore
> TabStop
infonnation about tl1e selected
>Tag
JI ~ JI property Text property or inethod "vit11 links to
JI TextAlign class System.String vanous resources.
JI Text.lmageRelation [iilvie. n Browse [iilv'"-'' Type 0 MSON Hep
JI Top
> Topleve!Control v
184 I PowerShell St udio -A Comprehensive Guide

Change Button Text I Your Button


I $buttonMyButton.Text ="Your Button"

Change Button Text Color I My Button


I $buttonMyButton.ForeColor = 'DarkRed'

Enable or Disable Button t1o $buttonMyButton.Enabled = $false

$buttonMyButton.Visible = $true
Button Visible or Hidden ~ ~
Of course, it would be hard to shovv' you if the button were
My Button
- - invisible, however the comma11d would be:
$buttonMyButton.Visible = $false

Change Button Text Color I My Button


I $buttonMyButton.BackColor = 'White'

<;,.... ..... . ....... .......... ... ............. ... ....... ....................... ... ... ... . ... ..... ... . .... ..... ..... ... .......... ... ...... . ... ... . . . ....... ....... ... ............. ... . . . ....... ..... . ... . ... ... . . . .... .......... ... .......... ... ..... .... . ........ .. ... ............. ... ....... ... ..... .... . ... .... . . .... .......... ... ... .......... ...... .... ... .......... ........... .. .......... ... ..... . .... ..... . ....... .......... ... .......... ... ... ... ....... .................... ... ...... . ... ..... ... .. .

I Co mmo n Butto n Manipulatio n


i,,,,,,,,.,,,,,,.,,,,,,, ., ......, ., .,,.,.,,.,., , .,, , ....., , ,,, , , .,,.,.,,, , , ,,.,_., .,,, , ,.,, , .,,.,.,,.,,, , ,,., .,.,,, , ,,, ,,.,,.,,.,,.,,.., .,,,,.., ., ., ,,,.,., ,,.,,.,.,,, ,..,,,.,, .,,.,,..,,.,, .,,.,,.,,.,,.,,.., .,.,_ .,,., ,..,., ..,..,,.,,.,.,.,,., .,, .,,..,.,.,., .,, ., ,..,,., ,.,.,, ,.., .w, -m.,.,.,.,""' ""'"'""'" '''' ,..,...,,.,..,,.,,J
!

Adding an im age to a button: I. My Button I


1.Select the Button Control in the designer.
2. In the Properties panel on the right, the two properties that you will use are the "linage"
and "I1nageAlign" properties.
3. Click on the browse button within the "linage" property and select the image file you
wish to use. Re1ne1nber, image size matters, the hnage should not be larger than the size
of your button control.
4. Select the image alignment \ithin the Button control by using the "ImageAlign"
property.

I My &itton I TextBeforelmage

I My Button I lmageBeforeTe}..1:
You can also use the "TextlmageRelation" property to display the

l___ y Butt_on_....
M_ I ImageAboveText
image before, after, above, or below the text.

My Button
I TextAbovel1nage
PowerShell Studio - Form Controls I 185

4.2 CHART CONTROL

Charts can be very useful especially ,;vhen comparing data, and are easily added to any form, but can be very
confusing when it comes to populating with data.

.a Form
When you first insert a chart into your fonn (drag/drop). It will appear
like the chart of the left. There is initially one series of data created in
100
a column type chart.
- Series1

80
... There are two helper functions that are generated by PowerShell
. Studio; Update-Chart a11d Clear-Chart .
60 1:
-
40
- Update-Chart plots the points that you supp[y onto the chart.

20 ,, - - Clear-Chart helps to clear all points fro1n tl1e chart.

0 There are many chart properties that can be set either as default in the
0 2 4 6 8
properties pane for the chart control fro1n the designer, or on tl1e fly
within the script code. It all depends on how flexible you want the chart
to be, there 1nay be instances ,;vhere you want to give users a choice to
select the chart type that they prefer, this can easily be done with a dropdown choice.

4.2. 1 Chart Example

First, add the Chart Control to an empty form, then edit a few of the chart properties:

- c x
- Desogncr A ... 0
Q -fill Copy ~
=
f.3Staso~ 1 lJ Centct ltonronlllr
: l!l ~
r-..
ll;1 ~ an !:!Di )( lltlo" ili Af<>11!1ottor.s .. ~ - Sitt Q CO"lttd Yid:!'! : 11 centct v..DQilr
~s.. m
~
PMtt
~ Atc-l P e:
.
1': (;I c... >It>

.
QJI t Cct12n I Heb
~ Su
CIC>boord - Ed!
""""" . vPropertJes
~ r t:IToot>ox )( )(

t cm c=i:-r-:----.. ~ . . -11: S.,.Stem.Vlndow$J'orms.... I"


p ii o0 "'" c..,1101 Giifl e ~
~J ~
~ ~ ""'*'<>
' @a.-
..El "''
o~!Sox
:Sc~
Chedc8ox
A

~
~ 100

80
-Series!
0

-
TllbS""'

.., Chart
Amo .."""
Owweas
Legends
lruo
Truo

(Collection)
(Cane ctton)
(Co8eclllon)
'ij~x Senes (Coll<etlon)
!IU eonit.-...s.., 60 >- >-- >- -
IP o...and , ""'

I
.o-JOatar-""Mow 0 0
) Olo~)
Oa!e- ... .__ - Oi1llSOU!Ct (none)
D- l119

Oer--
lfJ fi<S.....,Wallh 20 >- -
v Ocolgn
~)
lodoed
chrU
F.is.
,... flcml.a.,.,.,ll'>nol
v focus
r;zi-~
0 C:......V.adotic Truo
':JI -
'Cw fcnt!loalog
r,l'Qldox
......-nlllalog
0
1 2 3 5 6 7 8
o- 0
.., tmaoe

Text
An!!A..,,,._.,, .. "
~ Thi! lb<t ...-...S <!h lht control.
OHSa-
~..im.w~~~~..:Jlv ._,_~~~~~~~~~~~~~~~

. -- . --~ . -- - -

- - f- + - + 1Ayou1s Autolbrout AulDw..~bt9;taPM >. I ~ .- ,1 NUM I UlF-8 (LR-: 232 Col:: l 0-W: 1 '
186 I PowerShell Studio -A Comprehensive Guide

Title Collection Editor ? x 1. Click "Add" to create a new Title me1nber,


you can leave the name "Titlel" .
Tile 1 properties:
2. Edit the "text" property, enter "Top 5
~= 11 I Processes", this is what will be displayed at the
v
Top 5 Proccesses top of the chart. Chart Title.
(\Mi>le) True
BackCo1or D 3. Click " Ok".
I
8aCkRatdiS&e
LB
Bac:lruraderi5* None
None
Backmage D
Badtmage~ Topleft
BadthlageTl'af'I! D
BadtmageWrap Tie

(Text)
Tile text.
Add Remove

OK Cancel

1. Select the Chart Control. ~y Tools -Conal Heb V.... ,.. . ...,6
2. Open the "ChartAreas" gg S.Ct Al ~ 5 S'tt
[j] ~!
fif ti) CO"llr"d I 4 () Cd'W Hclnzontlliy
x llci<>< Ill ....,.,a...... t1t "'0'1.,_.. ~ s.... Comil Y*lii. IE ecn"' .,...,, :

-
:::
collection property. ~ ~ )(r!Cc<:m ~Jl "C o ~t S! ~s.t Iii Heb
Cloboard Edi AIQrrncnt s.. """""" Ter.dotcs
\j'] Cihoot>ox x y PropenleS "
J> ~..__---------------. 1
i til: l fi1] ~ I 1t
&
gi
g Li _..,,
p
!fi.l ~ l TWl 1
"

--1
TebStoc> TM
! @ .,non l 0
VdiClc Ttuc
11'
.. '" ~ v Chort
i ' 0 ,,,._ ""''""' (Col<ctlon)

-
u~ISox ... Co
iii~ l~
: ~ Con1boeox 80
~I Con>ox1Mm.6"1l l\t!es
0.6ta
"'""""" 60 v
.,Jo.-..

I
0 0
O.b<T..-.,
c:i-.-. 40
0 &T"""1>wlor v OH:ion
j;} FkSysttmW- (t<Mnt) chrll
20
; ~ -.Oyoull'd lodc<d Pih<
v focus
~~
C.-Vlldollc TN<
I i:zJ Fcldet&cucseo-.1 Celog 2 3 s 6 7 &
id3 Fonl!)o;aloo y

:n-..- 0 0 0

-OYldc<
OHScoll!or

- - 1- - 1 - + l.4youe AutoLavcut 1Wtosaed~t9:33Pf.t >. I NU.Jrd I l11'f.s j line-:232 Cd: t Char: 1 .i:

x 7 x 3. Open the "Axes Collection

l
0........1 .........
: _~l I ~~~.,.._----'I Editor" .
:'. E-~
I Y(Value) 0 1

"'

:_) t
'> POSltlCln 2 Sooondoty X
-..ccio.
Juo
128.0.0.0
"'
3 -..,.Y(V>luo) ox;s 4. Select the " X axis" .
v~-
s..~

yc..-
v T41e
r""""..,..,... 5. Under the Title property enter
> a.norx It!
Q.norY
Pmcesa.
"Process".

-
-Tl!eforl Ct"
Moaooc11 s..... s..t. t

Tl!e- -
v lobe

- '"".......' y
6. Click "OK" to close the Axis

-- .......
Tiiie
O..t~.- .
Collection Editor.
J
OK 7. Click "OK" to close the
ChartArea Collection Editor.
PowerShell Studio - Form Controls I 187

1. Select the Chart control.


aa
a a Select Al 1:~
lli ...., Bottoms . . ...., _
=
83 ~ID CCN"ol
- I lJ Con:.< Hon:an"'v
fI Cen1Ve<oc.lv
. [!]
A lil O
l'il
fi~...,,.
2. Open the " Series
"
)( Odel>: Sae To Coi:rof Width ~

.'.;! ...., - ~ "1 - 5:1 "'


"'-IYStl m Collection Editor" .
CJi>board fdt ......... \lg! '"''""

""- . r...,..,..
EJ ::IToolbox x y Properti?s x
~
! ~ ~
p ii
~ '"'"b,-_-
,.,.,----'-1~ rR-. 0 --0
TabStoc> Trve
" @ Button !> VISi1tt
""'
i 0~
!l' ..
100
Too SProeces.ses

- S.1esl
v Chart
......... ...,.
Ttut

(Colcction)
t;J~ OwtArus (Collect""1)
'.il C<b"'4ioo 80 legends (Collection)
He-. c

0.-
!j! C.01>:-..S"'P _,_ Tltlos (Colloctloo)
iP O.taGnd 60 - v Data

-...
~~)

I
{;JO.taCMW 0 )

11i:10...- . . - Tag
->
c:i-
0 &oal'lu.- 20 -
v D<slgn
~) d1art1
~R<Sys"'"'W-
Luclzd Fw
~-""'"'""'
:ill~ 0 v Focus
I 2 3 4 5 6 1 8
Jj Fold&& "'""-..c..ioo
d3 Foot!)alog v
0 0
."l Gr-
-
~--
.... ~ ..,
ISConoule ... Dc!>uo ,t,fft!R..Ut> f)Hcl> [l~!Z>Ut ie""fi>r'""""'
--
- -1-1- + m lAYout5. Au'lol11vout AIJto:..l\'cdat9'46PM >. I N UM I VTF-S I tnc:232 Col: l Ow: I .1

Series Collection Editor 7 x


1. Change the series naine to "Process WS" Meni>ers: Process ws properties:

~ J
Process \IS
:: 1
YAxis Type PMlaiy
...,. Olalt
OiartArea
OiartType
v Data
lsXVM!elndexed False

Poirts (Collection)
XVM!eType f'Uo
YVakiesPerP<*i 1
l--...Mf-J..,.,..;T..~~_.....__--=====--=:::::::

[ Add Remove r-- OK


l
Cancel

I <eioe< r ol ect1on Editor ? x


Members: f'lllcess WS properties: 1. Under Custom Properties, change the Drawing Style
~= ~ 1 ~ to " Cylinder'' .
0
!Ilse ,..
"v Customl'loperties DrawingStyl 2. Click OK to close the Series Collection Editor.
f)iiwingStyte C)Wlder
f)iiwSide~Side /'Uo
!:nWPonVakJe Average
LabelSlyte lv.o
MaxP!KelPonWdh 0
Mnf>IKelPonWdh 0
P!KelPonWdh 0
PonWdh 0.8 v

lnwingStyle
Gets or sets the cevmg st)4e ol ba.- or c:oUm
elms.
[ Remove

OK
188 I PowerShell Studio -A Comprehensive Guide
- 0 x 1. Now add a ComboBox
nome 0."910' Deploy Tods

1: -
Source ConD'cl i'tolp View
.., A -;ai o
control to the form by
Pa~te
_
:,
b[il) COl>Y
~ OJI
~
~
PreWM
GUI
ggSelect Al
)( Delete

.:9 ~
L

ili ~ llottomo
d-:...
ffl
* AiQ'i -
'-.entm
=
t.;j Sze to eon=-ot
Sze To Cetltror Wd1tl
~I :.ze To 104 ..,,g,1
dragging and dropping it
c:lol>oo<d Preview Edt Size T""1iates fro1n the toolbox to the fonn
~ ii:Toollox ~~~--'-~~~~~~~~~~~~~----. ~opertleS 'x area.
i
4'

QI
= Ci!
frlU :C>: to ICcl'
... 1
'P
l10
~ sccmbobox!: Systrtn.Wfldows~

';:J1 I !wI _J
2. Select the Co1nb0Box in
f., Lt <1'oonter> Maxl<nQ lh D
the designer, tl1en in the

....
@auttan Sorted Fa15"
~ . . O>art
! 0 Chodcllox
~ Chedo:d.ls1!3ox
Tcp 5 Proccesses
Toblndox
TobSll>O
1
True properties open the "Items
100 Truo
Collection".
'.iJ CobOlaloQ
.,, "' - Process \'IS
v Dobl
~ Comboeox (Dotollo11d191)
Ii Contex-~
80 O.:aSource (!>one)
iP o..da)'Mefrb (!>one)

v-
O.taGnd
i,Jo.taGndV!ew 60 .... ~- ~- l_, (Collection)
"" 0.leT""'9idce< Tog
D~ 40 ~ ~- - v Design
o~
if) Fil<Sys..,.Wo..,,.,.
~ Flcw.U)'MPon<I
20 .... - ~)
lodced
comboboxl
False
v Focus
'ill Fcldetllrawse<o..log 0 .... C......V-bc T"'
i;z) F--Modemt>olog 1 3 s 7
v Layout
t;i3 Fontlloaiog 2 6 8
Process
Ant'hnr' Tnn. I "'ft
I r"J Gr-6<> Items
Hdlf>rovlclor The otens on .,. combo box.
1._.-

- -
- --

I- + - - -
---"'---------
+ layouts
- - - --
'"'"' Lyout '"'"' ""'<d 10:-0PM
-~

>- I c. .. . ' NUM j u1H1 I Uno: 78 Cd: 1 aw:i , 1

String Collection Editor ? x


1. Enter the naines of different cha1t types, in this
exainples we use: StackedBar, StackedArea, and Pie. Stlld<ed Ba.-
Stlld<edhea
P'iel
2. Click OK to save the items.

OK

The form should now look like the following:


otil!? You can resize tl1e form and chart by dragging tl1e
comers.

We' re still not done yet, \Ve now n.eed to add in script
code to make the chart function.

In the editor, you will notice that the functions (Update-


Chart and Clear-Chart) have been generated for you by
20+---f Po\verShell Studio. This \Vas done auto1natically when
o+-_..__, you added the chart control to tl1e form.
1 2 3 s 6 7 8

We \vill add a fm1ction to check that Microsoft Chart Controls exist on the machine miming the fonn because Chart
Controls are required for the form to function properly, and 1nust be installed beforehand.
PowerShell Stu dio - Form Controls I 189

Function to chec]{ that Microsoft Chart Control exists on the local machine
1 function O nApplicationLoad {
2 #Note: This function is not called in Projects
3 #Note: This function runs before the form is created
4 #Note: To get the script directory in the Packager use: Split-Path
$hostinvocation.MyCommand .p a th
5 #Note: To get the console output in the Packager (Windows Mode) use:
$Console0utput (Type: System.Collections.Arraylist)
6 #Important: Form controls cannot be accessed in this function
7 #TODO: Add snapins and custom code to validate the application load
8 if([Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms.DataVisualization"
) -eq $null)
9 {
10 #Microsoft Chart Controls are not installed
11 [void] [reflection.assembly]::Load ("System.Windows.Forms, Version=2.0.0.0,'
12 Culture=neutral, PublicKeyToken=b77a5c56 l 934e089")
13 [void] [System .Windows.Forms.MessageBox] ::Show("Microsoft Chart Contro ls for
Microsoft .NET 3.5 Framework is required"'
14 ,"Microsoft Chart Controls Required")
15 #Open the URL
16 [System.Diagnostics.Process]::Start("http://www.microsoft.com/downloads/en/'
17 details.aspx?familyid= 130F7986-BF49-4FE5-9CA8-
91OA E6EA442C&displaylang=en");
18 return $false
19 }
20
21 re turn $true # return true for success or false for fa ilure
22 }

Function to load the chart with our data 1>oints


1 function Update-ProcessChart
2 {
3 if (! ($combobox 1.Text -eq ""))
4 { $charttype = $combobox 1.Text }
5 else
6 { $charttype = "StackedBar"}
7 $Processes= Get-Process I Sort-Object -Property WS I Select-Object Name ,WS,ID -Las t 5
8 $ProcNames = @(foreach($Proc in $Processes){$Proc.Name +" (" + $Proc.ID + ")"})
9 $WS = @(foreach($Ptoc in $Processes){$Proc.WS/1MB})
1O Update-Chart $chartl -XPoints $ProcNames -YPoints $WS -charttype $chcrttype
11 }

We then add the event " SelectedlndexChanged" for the ComboBox, so that we can detect when an item has been
selected from the Co1nb0Box. In the designer, right-click on the Co1nb0Box control and select "Edit Default Event",
then in the editor add the code belo'v in the event block.
190 I PowerShell Studio - A Comprehensive Guide

1 $comboboxl _SelectedlndexChanged={
2 Update-ProcessChart
3
4 }

Each time the SelectedindexChanged event is raised the Update-ProcessChart function will execute. Now when you
Run the fonn, and select Stackedbar from the Co1nb0Box, your form should look like the one below.
Congratulations! You have created your first Chart!

DS' Chart Control D x

Top 5 Proccessoes

- Process VIS

WINWORD (7048)

SnagitEditor (4356)

firefox (9020)

PowerShell Studio (12620)

Microsoft.Photos (8532)

0 200 400 600 800


PowerShell Studio - Form Controls I 191

4.3 CHECKBOX CONTROL

0-.. 52The checkbox control is very useful vvhen you want to provide inultiple selections or to enable/disable
other controls.

0 Oiecked There two possible states, checked or unchecked. The default is m1checked unless set
checked either by code or in CheckBox properties.
D Unchecked

$checkbox.checked =$true (checked)


$checkbox.checked =$false (unchecked)

The default location of the checkbox within the control is Middle Left, you can use tl1e CheckAlign property if you
need to change the position.

nO O Q O ttr
O;,Q,O
:
~ checkbox 1
0
9
: 6 checkbox:1 6 6checkbox1 b
OOO
6. . ... . . . . . . . 06 6. . . . . . . . . . . .
06

Top Center Top Left Top Right

OO O OO O: O..O O
:

o checkb~
:

9
:

cEl checkbox1 0 checkbox:1 d


OOC C}OC 6.... . ........ . .0 6
Middle Center Middle Left Middle Right

OO O OO
. O. OO
. O
.
6checkbox1 6 6HFl checkbox:1 6 6checkbox:1 b
rg :
6~ ......................~ ......................6 iT~OC
l ~ Fl
0 O 7::::-:b

Bottom Center Bottom Left Botto1n Right

The TextAlign property can be used to determine where tl1e text in tl1e CheckBox control aligns, the sa1ne values as
CheckAlign are available.

52 https://www.sapien.com/blog/20 l l /06/29 /primalforms-20 l l -spotlight-on-the-checkbox-control/


192 I PowerShell Studio - A Comprehensive Guide

4.3.1 CheckBox Example


The default event is CheckChanged, and is used to respond to a user either checking or unchecking a CheckBox.

You can see below the different controls that were used for this example.

CheckBox Control - D x

0 Use Admin Credentials

Admin Credentials
UserName: USet"i a e

Passv;ord:

-
L_ oK ]

In this exrunple, we use a Checkbox to control the enable/disable of the Userruune and Password text boxes.
We add the default CheckChanged event to 1nonitor if the user checks or unchecks the CheckBox "Use Ad1nin
Credentials"

The Script Code is:


1 $CheckBox_Ad min_Creds_Chec kedChanged={
2 #Enable or Disable the TextBox controls
3 $UserName.Enabled = $CheckBox_Admin_Creds.Checked
4 $Password.Enabled= $CheckBox_A dmin_Creds.Checked
5
6 }

rl:J ChtckBox Control D X

When the CheckBox is checked both the U semame and Password boxes are
enabled: E2J UseAdmi.n Croedenlials

UserName; I ~
:::::======::::::
Passvt0r~ !

OK I
Basically, all this is saying are that the controls $UserName and $Password,
shottld be enabled when $CheckBox- Achnin- Creds. Checked is true.
PowerShell Studio - Form Controls I 193

In more complex fonns the CheckBox can be used to enable/disable controls, as well as determine the values of
specific variables, such as ii1 ARMS we have used this to allo'v a selection for using Microsoft Update Server,
supplying a Windows Registry key value, and disabling the custo1n WSUS server configuration boxes.

wsus~

I+ FO!Ce WSUS Updates



I -
'
"
0 Use Microsoft Update Seiver
Select tBs option to use the
'.liaosofl Wndows Update
,,~" Server !or rece1v1ig l.4)dates.
,,~
,,~ Download and hstal Options

Enable 0 Disable ,,t


," 0 Notfy before download and mtal

"
I
' /!Uo download/Notiy of nstalabon
WSUS Server Comgu-ation

WSUS Serve r Name


., './.

Port I
I 0 /!Uo dov.Tiload/~ i'lstalatlon

15e1ect Day :
__
l~Comg..re ri_Setmgs
_ _ _~I 18530
0 /!Uo Updates/User corligucible
Who can approve/asapprove ~es?
Al Users 0 Mnnstrators
Restart v.ih logged On Users?
lnstal Minor Updates Potomatlcaly?
0 Ntow user to decide v.t1en to restart
@ Yes Siertly 0 No !teat like al ~es
Nolly user a.to-restart in 15 minl.tes

Lenl of Tme Watring Before Reboot If Req\ftd? How often to c:hec:k for new updates?
Defaul 5 "*1. 0 Custom f..'lr"des Eveiy 22 hous 0 Custom Hotn
Select i'b.n
jSelect Mrdes :

We do this using the saine CheckChanged event:

1 $checkboxUseMicrosoftUpdateSe_CheckedChanged = {
2 If ($checkboxUseMicrosoftUpdateSe.Checked -ne $true)
3 {
4 $WSUS_Server.Enabled =$tru e
5 $port.Enabled =$true
6 $usewsusserver = "2"
7 }
8 else
9 {
10 $WSUS_Server.Enabled =$false
11 $port.Enabled =$false
12 $usewsusserver = "1"
13 }
14 }

When "Use Microsoft Update Server" is checked, it vvill disable the WSUS Server Naine and Port# text boxes, and
supply the value needed for the Windows Registry Key:
HKLM\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows\ Windo,vsU pdate\AU
194 I PowerShell Studio - A Comprehensive Guide

As you become more experienced with PowerShell and PowerShell Studio, you \vill leam many ways to incorporate
the CheckBox to provide a much more interactive application for your users.

R ememeber to use the ( ) and (-eq) appropriately, this is the type o.fmistake that will leave you scratching
your head trying to determine what is going wrong!
If ($box.checked = $true) ~ This is assigned a value of $true to $box.checked
If ($box.checked -eq $tn1e) ~This is evaluating the value of $box.checked

4.4 CHECKEDLISTBOX CONTROL


The CheckedListBox is typically used when you "vant to present several ite1ns that can be selected independently.
The list of items can either be pre-populated within the control properties, or dynamically via code.

4.4.1 CheckedlistBox Example


~ Orm 0 x Let's take for exa1nple this simple form usiI1g
1N'hafs Checked \'Jhat's NOT Checked
a CheckedListBox that presents four different
applications that a user can select to install.
0 Oracle Java
0 Adobe Acrobat
0 Microsoft SOL Here I've also created nvo Textbox to
0 Avamar Backup
demonstrate ho\v you can use PowerShell
code to determine what items are checked and
AM~e I
- - - - - - - - - - - - - - - - - - = which are not.
CheckedListBox = $sofnvare ite1ns
What's Checked box= $checked box
What's NOT Checked box= $unchecked box
Analyze Button = $buttonAnalyze

o'fi Form 0 x
\\/hat's Checked Mlat's NOT Cheoked
Software lnstalation Oracle Java Microsoft SOL
Adobe Acrobat Avamar Backup
0 Oracle Java
0 Adobe Acrobat
D Microsoft SQL
D Avamar Backup

Analyze

....
111 this case the user selected t\vo items and "vhen "Analyze" is clicked the results are displayed in the two text boxes
to the rigl1t. We could use that sa1ne information instead of displaying in the text boxes to kick off soft"vare
installations for the ite1ns selected, and we could create a log containing what sofnvare \Vas installed and what was
not installed.
PowerShell Studio - Form Controls I 195

Here is tl1e code that n1akes it happen:

1 $buttonAnalyze_Click={
2 # Determine what items are checked and send to "What's Checked" box
3 foreach ($item in $software_items.Checked ltems)
4 {
5 $ch ec ked_box .A pp en dText("$ item 'n")
6 }
7 # Determine what is NOT checked and send to "What's NOT Checked" box
8 $unchecked= $software_items.ltems I ?{
9 $software_items.Checkedltems -notcontains $_
10 }
11 foreach ($item in $unchecked)
12 {
13 $unchecked_box.AppendText("$item ' n")
14 }}

NOTE: I have used a CheckedListBox "vhen dynainicaJly listing installed software on a syste1n, giving
the user ai1 option to select each item in the CheckedListBox and clicki.J1g a button to ren1ove the selected
software. Although I prefer to use a DataGridView in this case, like below, simply because it looks better,
and cai1 provide 1nore structured information:

~ SCC>IO..T.. 6 WSUSll>dd 'llt ....,.,..,_..,. lk] OS- ' F\o_P.... ;j, JovoT"' !!! .....o..i<T"' ~I.WT"' 0 -..
I\, ...._ T"' A.9-T"' 9 S,C"""""""'- p""'.-~ ..

-- - _,...- __ -
lott.w.,.. t.l-tioo

802.1 ln Wrolon l..AH C#'d l!ll2.0l0


ldobo,_,,,.OC 15 (!21).20042
..
lntr C...,O"t>er "._
llol!i-o

I ... ""ohd Softwn


It.at.a ... aoe

... -

--- ..
ldoboNR
~~S..5M .. '
2.G0.19120
50
-.s.a-...

'
WnE080-1974"'58F9l ,
CF8802804<:03A-'38Ml.

---
---10"1 10 1 52.14 CIE9EF98E-259E" 1604l
ldobl FIWt Pfaoret' 1 l Id 110l152 -.s,.-- ""
u -s.o-'-"-
'"

ChctXfor~Codit s.02.2904 fCod x86


1
Dxu!lin&;ilotw201& lt.19.0 SAPtEHTh I ;:l!I h:. .x86 (OC7J01FlC27f....9E7-A._

~~e~ 1 1~.59._
I ----+-
D--'- "" _ _ __.,ID9!21~...
----=--1-96
S.W.edhl* 4.S.0.0 GarminUdoru~ x96 (E4'12f14-208D-4A.1A4L.
---->-- Re-moie SoflwBre Un!nstJllaPon
Eoeon&erw:~ 2.40.(l(l)l SED'DEPSONCORPOR... x86 (0388M.32.f2r..CIJ8.68_ rw.1oot.t eean N ~-)OJ ettndW.a.n a tl 'tl'N14'd tel!~. ihctl)Q.Jean .-C. and ~al.
Fo-FAX....... 1 10.00 SEJIQ'.)EPSONOORl'OIL. >96 IOCllflC9l<:B~L
1 Emta~Mmen:ldck "lA ~ Sottwn"
"'-"*'co u2.ro SEJl<OEPSONCORPOR... ' "
--- (1)16A31~96&A.. 2. FIOftlh W gil:flCr.lled scloci eod'I~ )'Ot.I ..... to~ f)dOckto . - . ~ ocipliecitionl)
3. Ode "l.hwal Selected Sdtwe..
&son~Prrf: L~ SEllCO:PSONCORf'Orfl.. x86 (3E31V.Xl).27lE"'46'7-51 ..,

VttMonl.2.1

In this example, we will create a form that will list all installed soft\vare on tl1e local or a re1note computer,
utilizing the CheckedListbox.
196 I PowerShell Studio - A Comprehensive Guide

OSI Chart Control o x 1. First, add a CheckedListBox control to an


e1npty form.
2. Add a button that will be llsed to start the
I.. ust Installed Som.are process of gathering installed software. In
this case the button. text has been changed to
"List Installed Software", and we have
added an arrow i1nage to the button.
3. Add a text box that \Vill be used for the
user to enter the computer naine.
4. Double-Click on the "List Installed
Software" button to create a ne\v "Click"
event.

In this example the controls are named as follows:


CheckedListbox - checkedlistboxl
Textbox - soft_computers
Button - buttonsoftlist

Since the Control Helper Function (Update-ListBox) is created automatically for you \Vhen you added the
CheckedListBox control to your fom1. The only thing you need to do is add some code to your Button control
"Click eve11t":

First, you need to grab the computer naine that was entered into the TextBox, but you need to make sure that if the
user accidently entered a space at the end of the nrune that you trim that off:

1 $soft_computers.Text = $soft_computers.Text -replace "","" -replace '(?s) (\n){2,}', "'n" -replace


,\n$', ..
2 $Computer= $soft_computers.Text.Split("'n") I 3 {
3 $_.trim()
4 }

Next, we need to evaluate that the co1nputer is actually online. There are some scripters that don't do tlus, they
siinply use a Try/Catch when it co1nes to determining if a system is online and catch the error if it is not
responding. It can save a couple seconds that \Vay, ho\:vever I personally do not like doing that, instead I do a test-
connection:

1 if (test-Connection -ComputerName $computer -Count 1 -Quiet)

Next, we \Vill use the Uninstall keys witlun the Windows Registry to detennine the installed sofhvare on a syste1n,
I do not reco1nmend ever using WMI as everyone knows that will cause every piece of installed software to do a
repair, and can cause many issues.
PowerShell Studio - Form Controls I 197

1 $array = @()
2 #Define the variable to hold the location of Currently Installed Programs
3 $UninstallRegKeys =@("SOFTWARE\ \Microsoft\ \Windows\ \CurrentVersion\ \Uninstall",
4 "SOFTWARE\ \Wow6432Node\ \Microsoft\ \Windows\ \CurrentVersion\ \Uninstall")
5
6 # Notice we use the Uninstall Key registry location instead of WMI
7 foreach ($UninstallRegKey in $UninstallRegKeys)
8 {$Hive= [Microsoft.Win32.RegistryHive]"LocalMachine"; $regKey =
[Microsoft.Win32.RegistryKey] ::OpenRemoteBaseKey($ Hive, $computer); $ref=
$regKey.OpenSubKey($UninstallRegKey);
9 lf ($ref)
10 {
11 #Create an instance of the Registry Object and open the HKLM base key
12 $reg= [microsoft.win32.registrykey]::OpenRemoteBaseKey('LocalMachine', $computer)
13
14 #Drill down into the Uninstall key using the OpenSubKey Method
15 $regkey = $reg.OpenSubKey($UninstallRegKey)
16
17 #Retrieve an array of string that contain all the subkey names
18 $subkeys = $regkey.GetSubKeyNames()
19
20 #Open each Subkey and use the GetValue Method to return the string value
21 foreach ($key in $subkeys)
22 {$64check =
"SOFTWARE\\Wow6432Node\ \Microsoft\ \Windows\ \CurrentVersion\ \Uninstall"
23 $Hive= [Microsoft.Win32.RegistryHive]"LocalMachine";
24 $reg Key= [Microsoft.Win32. RegistryKey] ::OpenRemoteBaseKey($ Hive, $computer);
25 $ref= $regKey.OpenSubKey($64check);
26 If ($ref)
27 {
28 if ($UninstallRegKey -match "Wow6432Node")
29 {$Softwarearchitecture = "x86"}
30 else
31 {$Softwarearchitecture = "x64"}
32 }
33 else
34 {$Softwarearchitecture = "x86"}
35
36 $thisKey = $UninstallRegKey + "\\"+$key
37 $AppGUID = $key
38 $thisSubKey = $reg.OpenSubKey($thisKey)
39 $app = $thisSubKey.GetValue("DisplayName")
198 I PowerShell Studio - A Comprehensive Guide

No\, let's put it all together:


1 $buttonsoftlist_Click={
1111 1 1
2 $soft_computers.Text= $soft_computers.T ext -replace"", -replace (? s) (\n){2,} , "' n" -replace
'\n$1 II
I

3 $Computer= $soft_computers.Text.Split("'n") I % {$_.trim()}


4 if (test-Connection -ComputerName $computer -Count 1 -Quiet)
5 {$array= @()
6 #Define the variable to hold the location of Currently Installed Programs
7 $UninstallRegKeys =("SOFTWARE\ \Microsoft\ \Windows\ \CurrentVersion\ \Uninstall",
8 "SOFTWARE\ \Wow6432Node\ \Microsoft\ \Windows\ \CurrentVersion\ \Uninstall")
9 # Notice we use the Uninstall Key registry location instead of WM foreach
($UninstallRegKey in $UninstallRegKeys)
10 {$Hive= [Microsoft.Win32.RegistryHive]"LocalMachine"; $reg Key=
[Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey($ Hive, $computer); $ref =
$regKey.OpenSubKey($UninstallRegKey);
11 If ($ref)
12 {
13 #Create an instance of the Registry Object and open the HKLM base key
1
14 $reg= [microsoft.win32.registrykey] ::OpenRemoteBaseKey('LocalMachine $computer) ,

15 #Drill down into the Uninstall key using the OpenSubKey Method
16 $regkey = $reg.OpenSubKey($UninstallRegKey)
17 #Retrieve an array of string that contain all the subkey names
18 $subkeys = $regkey.GetSubKeyNames()
19 #Open each Subkey and use the GetValue Method to return the string value
20 foreach ($key in $subkeys)
21 {$64check =
"SOFTWARE\ \Wow6432Node\\Microsoft\ \Windows\ \CurrentVersion\ \Uninstall"
22 $Hive= [Microsoft.Win32.RegistryHive]"LocalMachine";
23 $reg Key= [Microsoft.Win32.Re.gistryKey] ::OpenRemoteBaseKey($Hive, $computer);
24 $ref= $regKey.OpenSubKey($64check);
25 If ($ref)
26 {if ($UninstallRegKey -match "Wow6432Node")
27 {$Softwarearchitecture = "x86"}
28 else
29 {$Softwarearchitecture = "x64"}
30 }
31 else
32 {$Softwarearchitecture = "x86"}
33 $thisKey = $UninstallRegKey + "\\"+$key
34 $AppGUID =$key
35 $thisSubKey = $reg.OpenSubKey($thisKey)
36 $opp= $thisSubKey.GetValue("DisplayName")
37 If ($opp -ne $null)
38 {Update-ListBox $checkedlistbox 1 $opp -Append}
39 }} Else {# Computer is offline ->this could optionally be output to a log file}}}}
PowerShell Studio - Form Controls I 199

a"FJ CheckedlistBox Control 0 x

0AdobeAIR
l2J Adobe Flash Player 24 NPAPI
0 AutoRun Pro En rpr e ersion 5.0.0.89
0 Adobe Media Player I+ List Installed Software
0 SAPIEN Document Explorer 2016
0 Dropbox
0 Email Grabber 2
0 Epson PC-FAX Driver
0 EPSON Scan
0 FileZilla Client 3.23.0.2
0 lnstallAware XS
0 Power2Go
0 LabetPrint
0 Magic ISO Maker v5.5 (build 0281)
0 Mozilla Firefox 50.1.0 (x86 en-US)
0 Mozilla Maintenance Service
0 NVIDIA Stereoscopic 3D Driver
0 Microsoft Office Professional Plus 2010
D O'MlCloud
0 PDF Complete Special Edition

.....
This is what the form should now look like when it is run. You can see that \Ve we.re able to gather a list of all
installed software fro1n the co1nputer that was specified, and each sofuvare application listed can be
checked/unchecked. This could be further adapted to add an Un.install button, and so1ne more code to allow
uninstalling of all applications checked. We can easily do th.is by using tl1e GUID of the application, and if you
noticed we already have that stored in the $key variable.

Sitnilar to the below:

l $checkedlistboxl .Checkedltems I
2 ForEach-Object{
3 $soft_computers.Text= $soft_computers.Text -replace "", '"' -replace '(?s) {\n){2,}',
"' n" -replace '\n$', "
4 $Computer= $soft_computers.Text.Split("'n") I 3 {$_.trim(}}
5 $uninstall = $key
6 $softname = L
7 $returnval =
([WMICLASS]"\\$computer\ROOT\CIMV2:win32_process").Create("msiexe,c ' /x$uninstall
'/norestart '/qn")

* this is only an example, you would need to first capture the $key variable for each application.
200 I PowerShell Studio - A Comprehensive Guide

4.5 COLORDIALOG CONTROL

The ColorDialog Control is an easy way to give users the ability to change the colors of for1ns, controls or fonts.
Each color can be represented in Hexadecimal digits, since RED, GREEN, and BLUE each can have values from 0
to 255 (256 possible values), there are 16,777,216 colors available for choosing!

There are a few properties that you can define that will control how the ColorDialog box is displayed, and whether
only basic colors will be selectable or all colors vvill be available.

FullOpen: determines if the custo1n color section will be initially opened.


AllowFullOpen: determines if the user can open the custom color section.
AnyColor: indicates whether the dialog box displays all available colors in the set of basic colors.
SoliclColorOnly: indicates vvhether the dialog box will restrict users to only selecting solid colors.

r~...:
crr o wo
x
rrr oo
&.ecalots:
x


G

D



lll or l!ll o r
CustOIOcdcn:
l ~'"~ rrrrr rrrrrrr r tt.e: :! Li~
rrr rr rrr rrrrrrrr Red:
s..:Li G:ei:LI
CoicliSclld 1..t.m:EJ lb:E)
OK Concel OK Cancel Add to Or.otom Colors

Full Open (False) Full Open (True)

4.5.1 ColorDialog Example

iiSJ Form D X In this exa1nple I have created a simple fon11 with one button that
allovvs the user to change the fonn background color. The same
I Change ColOf I concept can be used to change other control colors or font colors .

.
l $buttonChangeColor_Click ={
2 # Open the ColorDialog Box
3 $color Dialog l .ShowDialog {)
4 # Grab the color that the user selects
5 $BackColor = $colordialogl .Color.Name
6 #Translate the HEX# to a System Drawing Color for the Form Background
7 $BackColor = [System.Drawing.ColorTranslator]::FromHtml('#' + $BackColor)
PowerShell Studio - Form Controls I 201

8 # Apply the color to the form


9 $form l .Bac kColor = $Bac kColor
10
11 }

If only basic colors are chosen then the translation from HEX# is not needed, however since you cannot determine
iv hichcolor will be chosen, I recommend always using the translation or you will receive errors and the color picker
will not function correctly.

4.6 COMBOBOX CONTROL

53
ComboBox and Do1nainUpDown Controls are basically the same with the exception that the Co1nb0Box
0-... is more of a drop down style, while the DomainUpDown is more of a rotational selector.

There are three different drop do,vn sty les to choose from:

DS' Form 0 x ill Form 0 x ofj Form 0 x

lem4 tern 4 v

lem l Item l
kem2 Item 2
Item 3 Item 3
C'll' t

Sin1ple DropDown DropDown List

NOIB: Both Si1nple and DropDown allow the user to inanually type in a value, if you only want the user
to select fro1n the list provide then you should use DropDown List.

4.6.1 ComboBox Example


a x
ii! ' This is a basic example of ho\v a ComboBox \Vorks. We have one Co1nb0Box on the left,
and one text box on the right. When an item from the ComboBox is selected, the results
will be shown in the text box.

First you need to create the default event "SelectedlndexChanged" for the Co1nb0Box.
1 $comboboxl _ Selected.IndexChanged= {
2 $textbox l.Text = $comboboxl.Selectedltem }

53 https://www.sapie n.com/blog/20 11 /06/21/primalforms-2011 -spotlight-on-the-combobox-control/


202 I PowerShell Studio - A Comprehensive Guide

The preceding code demonstrates ho\v we get the selected item from the ComboBox by exaffilillng
$co1nboboxl .selecteditem which \Ve then use to change the text in $textboxl. You could also use the results of the
ComboBox selectio11 in nu1nerous \vays to manipulate other controls or data.

If the co1nbo box's Dro1>DO"\vnStyle is not DropDownList and you are going to accept new values, it is
recommended to use the text property instead of selecteditem.

For exa1nple, \Ve have a ComboBox, with a DropDownStyle set to "DropDown" or " Simple" . We have
three ite1ns in the collection, Apples, Oranges, and Peaches. However, both of these Combobox styles also
allo\v the user to type in their own value. So, let's say they choose to type in "Pears"

If we executed the follo,ving:


$co1nboboxl .Selectedltem
It \Vould con1e back as NULL, vvhich \vould be correct because nothing was selected from the list.

However, if \Ve executed the following instead:


$comboboxl .Text
It would have the value of "Pears"

The following helper function is generated when you add a Co1nb0Box to a fonn, and allows you to dynainically
load ite1ns for the ComboBox:

1 function Update-ComboBox
2 {
3 <#
4 .SYNOPSIS
5 This functions helps you load items into a ComboBox.
6
7 .DESCRIPTION
8 Use this function to dynamically load items into the ComboBox control.
9
10 .PARAMETER ComboBox
11 The ComboBox control you want to add items to.
12
13 .PARAMETER Items
14 Th e object or objects you wish to load into the ComboBox's Items collection.
15
16 .PARAMETER DisplayMember
17 Indicates the property to display for the items in this contro l.
18
19 .PARAMETER Append
20 Adds th e item(s) to the ComboBox without c learing the Items collection.
21 #>
22 Param (
23 [Parameter(Mandatory=$true)]
24 (System.Windows.Forms.ComboBox]$ComboBox,
25 [Parameter(Mandatory=$tru e)]
26 $Items,
PowerShell Studio - Form Controls I 203

27 [Parameter(Mandatory=$false)]
28 [string]$DisplayMember,
29 [switch]$Append
30 )
31
32 ~(-not$Append)
33 {
34 $comboBox.ltems.Clear()
35 }
36
37 if ($Items -is [Array])
38 {
39 $comboBox.ltems.AddRange($1tems)
40 }
41 e lse
42 {
43 $comboBox.ltems.Add ($Items)
44 }
45
46 $comboBox.DisplayMember = $DisplayMember
47 }

Example of loadiI1g a ComboBox 1nanually with multiple ite1ns:

Update-ComboBox $comboboxl "iteml ", " item2", " item3"

To add additional ite1ns to ai1 existing ComboBox list use the append parameter:

Update-ComboBox $comboboxl " item4" -Append

Loading a Co1nb0Box programically with script:

Update-ComboBox $comboboxl (Get-Process) "ProcessName"

4.7 CONTEXTMENUSTRIP CONTROL


54
The ContextMenuStrip is used to create a right-click menu for a control that you choose. For
0- convenience, 'vhen you drop a ContextMenuStrip on top of any control in the Designer it vvill be
- automatically assigned to that control. v Behavior
ABov..Orop False
AutoEl!rpsis False
To manually assign a ContextMenuStrip to a control, you need to set the control 's > ContextMenuSf extmenustriptG)
ContextMenuStrip property to the desired ContextMenuStrip control..
3::~.,,, I
54 https://www.sapien.com/blog/2011/l2/l 6/primalforms-2011 -spotlight-on-the-contextmenustrip-control/
204 I PowerShell Studio - A Comprehensive Guide

You can also assign the ContextMenuStrip to a control within the script editor, for example:
$button l .ContextMenuStrip = $contextmenustrip l

4.7.1 ShowCheckMargin and ShowlmageMargin


The ShowCheckMargin property determines whether a space for a check mark is shown on the left edge of tl1e
ToolS tripMenultem.

The ShowImageMargiI1 property detennines whether space for an i1nage for each menu item is displayed.

-----------
0 ShowCheckMargin -----------

! Edit items...

If you enable the Sho\vCheckMarginyou also need to set the property for each rnenu item' s Behavior/CheckOnClick
to "True" or the check inark will not display for the selected menu item. This is typically used when creating an
option that remains enabled for a user until deselected. If you are sin1ply creating a right click menu item that
executes once each time selected, then you \.Vill not have a need for using the check inark.
PowerShell Studio - Form Controls 205

4.7.2 ContextMenuStrip Example


In this example, we \ill add a single Button
Control, then add a ContextMenuStrip Control,
I< _,..,>
I@ !t.ltton add three inenu items, and assign it to the
.. ""' button.
~ Chtd;Bol(
~-..
~~
....
ilt~ic
00 Contex~Slr(I
I~ 0.taGod 1. Add the Button control to your empty
1ri:io.-..
lilt .....-
[!- form.
10 - -
z;l Flt>Sy~6tdler
~ Ao<M.a~id 2. Drag/Drop the ContextMenuStrip control
~~
IJl ,,_.....,,_, C>afo9
cc Yon::i..log directly on top of the Button control, this will
LJ Gro.4*x
-..idot
I~~
automatically associate the menu with the
1.U-
A Ube! button control. NOTE: the contextmenustrip
8-
~u.-
I I will appear in the pane beneath the form, it will
~!' Utt'l!Of
r- ~txlSox
~;ii-...... I not appear directly on the form.
rt:ii-~
:;;;1 ...,,.,,_ I

la,...,.,_
\fl - ,. Moo
O""'
'~"""""""
GD IJroO't:~:::e.
f.iil~r~y
'!! .......~
I
e-
. " A.lc:hTtXl8oX
li .!ll-
(Il $p1~

Click on the s1nall triangle in the upper right corner of the ? .. .. .. . ContextMe.nuStrip T~
contextmeoustrip1
Context1nenuStrip, check both the " ShowimageMargin" and .... 1 RenderMode: [ImnagerRenderMode
.
" ShowCheckMargin" . _____...,. E2J ShowlmageMargin
E2J ShowCheckMargin
Then click on "Edit Items". Ed'rt Items ...

Items Collection Editor ? x 1. Leave tl1e ite1n type set


to Menuite1n, then click the
Select item and add to ist bek-" ToolStripMeoobem t~em1 Add button to add three 11e\;v
~

I~~ Merultem ' [ Md J ct:: ~ J I _J toolstripmenu items.


Members: Right ToleftAIAoMirrorln False
conteidmenu~ 1
ShortcutKeyOisplayStrir
'
Teld Disable ClalQeS 2. You should now see a
~ to~enuitem
Teld~ MiddleCeder parent contextmenustrip ite1n
~ toolstripmenUtem2
TeldOtrection Horizontal
~ toolst~erutem3 TeldfmageRelation ImageBefore Teld
and three child 1nenu items.
v Behavior
PUo~ze True 3. For each toolstipmenu
AIAoToolTip False
True bd item click on the Text property
OoubleOckEnabled False and cl1ange the name. Th.is \ill
Enabled True
ToolTipTeld
be the text that is displayed for
~sble True the menu item. In this
v Daa exa1nple, we used "Disable
Drop Down Q-lone}
Changes", " Stop" and
OK "Ti1ner".
206 I PowerShell Studio - A Comprehensive Guide

4. If you "vant a check mark to appear or disappear each time the menu item is clicked, then you can set the
ClieckO nClick oroperty to 1RUE.

~- Disable Changes When you are finished your right-click meny should look like the
example on the left.
[ Stop
I
Timer

All three menu items can have an image assigned to the1n using the Items Collection Editor (see bel0Vi1). The
"Disable Changes" menu item Behavior/CheckOnClick is set to True so that when the user selected this menu ite1n
it will remain checked until the user re-selects the menu ite1n to uncheck it. Both the "Stop" and "Tuner" menu
ite1ns Behavior/CheckOnClick property is set to False because these are to execute only once per user click.

4.7.3 Important Events

Item Clicked
This event occurs when a 1nenu iten1 is clicked. Use this event as a general catch all event fo r the 1nenu items. It
allo,vs you to react to the menu ite1n clicks without having to set each individual menu ite1n' s click event.

You can access the clicked iten1 by accessing the event's argument Clickite1n property:

$ .Clickedltem

The follo"ving is an exa1nple of how to respond to the ItemClicked event

1 $contextmenustripService_ltemClicked=[System.Windows.Forms.ToolStripltemClickedEventHandl
er]{
2 #Event Argument:$_ = [System.Windows.Forms.ToolStripltemClickedEventArgs]
3
4 if($_.Clickedltem -eq $startToolStripMenultem)
5 {
6 Write-Host 'Start'
7 }
8 e lseif ($_.Clickedltem.Text -eq 'Stop')
9 {
10 Write -Host 'Stop'
11 }
12 }

Opening
This event occurs when the ContextMenuStrip is opening. Use this eve11t as a trigger to initialize the inenu ite1ns
such as enabling I disabling or ltiding menu items.

You can prevent the ContextMenuStrip from opening by cancelling the event:

$_.Cancel = $true
PowerShell Studio - Form Controls I 207

The follo"ving is an exainple demonstrating the use of the Opening event to initialize the menu ite1ns:

l $contextmenustripService_Opening=[System.ComponentModel.CancelEventHandler]{
2 #Event Argument: $_ = [System.ComponentModel.CancelEventArgs]
3
4 $pauseToolStripMenultem.Enabled =$fa lse
5 $startToolStripMenultem.Enabled =$false
6 $stopToolStripMenultem.Enabled =$false
7
8 if($treeviewServices.SelectedNode -ne $null)
9 {
l0 $service= $treeviewServices.SelectedNode.Tag
ll
12 if($service -ne $null)#ls there is a service object?
13 {
14 $pauseToolStripMenultem.Enabled =$false
15 $startToolStripMenultem.Enabled =$false
16 $stopToolStripMenultem.Enabled =$false
17
18 $service.Refresh() #Update the status
19
20 if($service.Status -eq 'Running')
21 {
22 $stopToolStripMenultem.Enabled =$true
23 $pauseToolStripMenultem.Enabled = $service.CanPauseAndCon tinue
24 }
25 e lseif($service.Status -eq 'Paused')
26 {
27 $startToolStripMenultem.Enabled =$true
28 $stopToolStripMenultem.Enabled =$true
29 }
30 e lse
31 {
32 $startToolStripMenultem.Enabled =$true
33 }
34 }
35 }
36 e lse
37 {
38 $_. Cancel= $true #Don't show th e context menu
39 }
40 }
208 I PowerShell Studio - A Comprehensive Guide

Closed
This event occurs \vhen the ContextMenuStrip has closed. You can use this event to handle state cl1anges or
selection changes in a combo box 1nenu ite1n if you do not handle their state changes as they occur.

To detennine why the ContextMenuStrip closed, you can access the event's argmnent CloseReason property :

$_.CloseReason

Values:

AppFocusChange
Specifies that the ContextMenuStrip control was closed because ai1other application has received the
focus.
App Clicked
Specifies that the ContextMenuStrip control \Vas closed because an application was launched.
Item Clicked
Specifies that the ContextMenuStrip control was closed because one of its items \vas clicked.
Keyboard
Specifies that the ContextMenuStrip control was closed because of keyboard activity , such as the ESC
key being pressed.
CloseCalled
Specifies that the ContextMenuStrip control \Vas closed because the Close method was called.

Example of the Closed Event:

1 $contextmenustripService_Closed=[System.Windows.Forms.ToolStripDropDownClosedEventHandl
er]{
2 #Event Argument:$_ = [System.Windows.Forms.ToolStripDropDownClosedEventArgs]
3 Write-Host "Close Reason: $($_.CloseReason)"
4
5 if ($_.C loseReason -eq 'ltemClicked')
6 {
7 Write-Host 'ComboBox Value:' $comboBoxMenultem.SelectedText
8 Write-Host 'TextBox Value:' $textBoxMenultem.Text
9 }
10 }

4.7.4 Important Methods

Close
This 1nethod closes the ContextMenuStrip control.

$contextmenustripService.Close()
PowerShell Studio - Form Controls I 209

Show
This method displays the context menu. Use this method when you wish to 111anually trigger the context 1nenu.

Example use of the Sho\v inethod:

l $treeviewServices_NodeMouseClick=[System.Windows.Forms.TreeNodeMouseClickEventHandler]
{
2 #Event Argument:$_= [System.Windows.Forms.TreeNodeMouseClickEventArgs]
3 if($_.Button -eq 'Right')
4 {
5 $treeviewServices.SelectedNode =$_.Node
6
7 #Display a context menu for any node without setting
8 #each individual contextmenustrip property
9
1O #Show the context menu relative to a control
11 $contextmenustripService.Show($treeviewServices, $_.Location)
12
13 #Alternative: Show context menu using a screen location
14 #$truePoint = $treeviewServices.PointToScreen ($_.Location)
15 #$contextmenustripService.Show($truePoint)
16 }
17 }

4.8 DATAGRID AND DATAGRIDVIEW CONTROLS


Data Grid is the predecessor to DataGridView, in tllis section we \.vill be discussing the Data Grid View however there
are 111any similarities between the both. Below are the major differences:

DataGuid~iCll Control
fcah1res
Multiple column types The DataGridView control provides 1nore built-in column types than the
DataGrid control. These. column types 1neet the needs of most conunon
scenarios, but are also easier to exte11d or replace than the column types in
the DataGtid control.
Multiple ways to clis1>lay data The DataGrid control is limited to displaying data from an external data
source. The DataGridView control, however, can display m1bound data
stored in the control, data fro1n a bound data source, or bound and unbound
data together. You can also imple1nent virtual mode in the DataGridVie\v
control to provide custom data n1anage1nent.
Multi1>le ways to customize the The DataGridView control provides inany properties and events that
display of data enable you to specify ho\v data is formatted and displayed. For example,
you can change the appearance of cells, rows, and colu1mis depending on
the data they contain, or you can replace data of one data type with
equivalent data of another type.
210 I PowerShell Studio - A Comprehensive Guide

Multi11Ie options for changing The DataGridView control enables you to 'vork with individual grid
cell, row, column, and header components in nu1nerous ways. For example, you can freeze rows and
appearance and behavior colmnns to prevent the1n from scrolliI1g; hide ro,vs, colUIIll1s, and headers;
change the way row colu1nn, and header sizes are adjusted; change the
way users make selections; and provide ToolTips and sho1tcut rnenus for
individual cells, rows, and colunms.

The DataGrid coutrol is retained for back\vard compatibility and for special needs. For nearly all purposes, you
sl1ould use the DataGridVie"v control. The only feature that is available in the Data Grid control that is not available
il1 the DataGridView control is the hierarchical display of information from t\VO related tables in a single control.
You 1nust use two DataGridVie\v controls to display iJlfonnation from hvo tables that are in a tnaster/detail
relationship.

4.8.1 Dynamic Populated Example


<
I'm going to use an exa1nple fro1n the ARMS
application that I designed a couple years ago,
--
' i.t..,.. ..t .... ,.... a .. ,..
-.,, ~"'--
- -- -- --
"\.-...~ JNt 1A Wll ) Mt-
() t,M"\,llWl4,W-.

1
because it den1onstrates dynamically loading
your DataGridVie"v, building columns on the
fly , as well as selectable iten1s in the
DataGridVie\v reslilts.

In the example above the DataGridView is on


Y'n' "'tr= tr:ottm
....,._,,.. W'..,_""......,,,..,.,._..,,..,.,.,.,1. """"*c .. the left, and a RichTextBox used to display
"'""""""~- -.o: "~
t_._,__ .......,.,..,....... ..,...~
'-'-"'- ~-A-~P."l'ttt,,__ &11~11 ~~...,...
1r...- .. ,,.~w-
system messages is on the right. The TextBox
in the middle is for the user to enter a
computer name since this works not only locally but for re1note syste1ns as vvell.

DataGridVielv datagridview_soft'1vare
TextBox soft_co1nputers
Button buttonsoftlist
Button buttonDeleteSelectedSofu:va
RichTextBox richtext softbox

This is done in hvo parts, first we use tl1e code belovv to scan the system for all installed sofuvare creating an array
that vve can use to populate our DataViewGrid.

l $array = @()
2 #Define the variable to hold the location of Currently Installed Programs
3 $UninstallRegKeys =
@("SOFTWARE\ \Microsoft\ \Windows\ \CurrentVersion\ \Uninstall",
4
"SOFTWARE\\ Wow6432Node\\Microsoft\\ Windows\ \CurrentVersion\ \Uninstall")
PowerShell Studio - Form Controls I 211
5 # Notice we search the Uninstall Key registry location, we do not use WMI as this causes known
issues
6 foreach ($UninstallRegKey in $Uninsta11RegKeys)
7 {
8 $Hive = [Microsoft.Win32.RegistryHive]"LocalMachine";
9 $regKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey($Hive,
$computer);
10 $ref= $regKey.OpenSubKey($UninstallR egKey);
ll If ($ref)
12 {
13 #Create an instance of the Registry Object and open the HKLM base key
14 $reg=
[microsoft.win32.registrykey]::OpenRemoteBaseKey('LocalMachine', $computer)
15 #Drill down into the Un install key using the OpenSubKey Method
16 $regkey = $reg.OpenSubKey($UninstallRegKey)
17 #Retrieve an array of string that contain all the subkey names
18 $subkeys = $regkey.GetSubKeyNames()
19 #Open each Subkey and use the GetValue Method to return the string vaJue for DisplayName
for each
20 foreach ($key in $subkeys)
21 {
22 $64check =
"SOFTWARE\\Wow6432Node\ \Microsoft\ \Windows\ \CurrentVersion\ \Uninstall"
23 $Hive= [Microsoft.Win32.RegistryHive]"LocalMachine";
24 $regKey =
[Microsoft. Win32. RegistryKey]: :Open RemoteBaseKey($ Hive, $computer);
25 $ref= $regKey.OpenSubKey($64check);
26 If ($ref)
27 {
28
29 if ($UninstallRegKey -match "Wow6432Node")
30 { $Softwarearchitecture = "x86"}
31 e lse
32 =
{ $Softwarearchitecture "x64"}
33 } else
34 { $Softwarearchitecture = "x86"}
35 $thisKey = $UninstallRegKey + "\\"+$key
36 $AppGUID =$key
37 $thisSubKey = $reg.OpenSubKey($thisKey)
38 $obj= New-Object PSObject
39 $obj I Add-Member -MemberType NoteProperty -
Name "ComputerName" -Value $computername
40 $obj I Add-Member -MemberType NoteProperty -
Nome "Application" -Value $($thisSubKey.GetValue("DisplayName"))
41 $obj I Add-Member -MemberType NoteProperty-
Name "Version" -Value $($thisSubKey.GetValue("OisplayVersion"))
212 I PowerShell Studio -A Comprehensive Guide

42 $obj I Add-Member -MemberType No te Property -


Name "Vendor" -Value $($thisSubKey.GetValu e("P ublisher"))
43 $obj I Add-Member -MemberType Note Property-
Name "GUID" -Value $AppGUID
44 $obj I Add-Member -MemberType NoteProperty -
Name "Architecture" -Value $Softwarearchitecture
45 $array += $obj
46
47 }
48
49 }
50 else
51 {}
52 }
53 $apps =$array I Where-Object { $_.GUID -like"{*"} I Where-Object {
$_.Application } I select Application, Version, Vendor, Architecture, GUID I So1rt-Object
Application

In the second step, we take the data that \!Ve just gathered and call the Update-DataGridView_Software function.
54 Update-datagridview_software - DataGridView $datagridview_software -Item $apps
55 Function to Update DataGridView
56 function Update-datagridview_software
57 { Param (
58 [ValidateNotNull()]
59 [Parameter(Mandatory =$true)]
60 [System.Windovvs.Forms.DataGridView]$DataGridView,
61 [ValidateNotNu ll()]
62 [Param eter(Mandatory =$true)]
63 $Item,
64 [Parame ter(Mandato ry =$false)]
65 [strin g]$DataMember
66 )
67 $DataGridView.Suspend Layout()
68 $DataGridView.DataMember = $DataMember
69 if ($Item -is [System.ComponentModel. IListSource] '
70 -or $Item -is [System.ComponentModel.IBindinglist] -or $Item -is
[System.ComponentModel.IBindinglistView])
71 { $DataGridView.DataSource =$Item}
72 else
73 {$array= New-Object System.Collections.Arraylist
74 if ($Item -is [System.Collections.llist])
75 { $array.AddRange($1tem) }
76 Else {$array.Add ($Item) }
77 $DataGridView.DataSource =$array}
78 $DataGridView.Resumelayout() }
PowerShell Studio - Form Controls I 213

The results are a nicely fonnatted DataGridVie\;v with five columns, sorted by Application Name.

~ Vnon Vendor Att:hlecture GUlO


802.1 ln Wirelesa LAN C.W 3.02.0lO Rai-.k x86 {Sfe4F100-f7FC>-4766-8..
Adobe~DC 15.020.20042
- -
Adobe s~ 1r1corpoqt x86
-
{AC76BAS& l033-fFFF77...

Adobe AIR
--
Adobe /!crdJll. Reader DC 15.020.20042
2.6.0.19120
Adobe ~ems ~icorporat x86
~-

Adobe ~ems lnc;oiporat x86


{/>C76BASG-7A07-1033-7._
WF7E080-1974-458F-93 ...
Adobe Ctellliw !ae 5 M... ' 5.0 Adobe Systems lnc;oiporat x86 {FBS028Q4.C034..4382-A3...
Pdobe Fl&sh Player 10 I'd ... 10J.52.14 Adobe Systems, nc. x86 {6E9EF98E-259E4160-8..
Adobe flash Player 11 /'d. ... 11.0.1.1.52 Adobe S)'$tems lnc;oiporat ... x64 {A10EE468Qfs.4FAS-.A....
M:>be Me-ill l'llryer 18 i'dobe Sytt...,. inc<>mMll . x86 {OE3A9DC5-9A50-64SS.9 ..
Adobe PhottWiop CS6 13.0 Adobe Sy.terns lnc;oipcait ... x86 {74E83499-889S485C96...
Adobe PhottWiop ~--- 3.4.2 Adobe x64 {8BBA6F77-4/l,79-4E90-B...
Adobe Piltt!I BendOt Toold ... 2.0 Adobe Sys!MIS lr1corpoqt ... x86 {OSCC778E-ec58-424&&...
Adobe Refresh MMager 1.8.0 Adobe Sy.terns lnc;oiporat ... x86 (fC76BA86.-0804.1033-19...
.Advertising Certer 0,0.0.1 Nero/lG x86 tl2ee4338b545-4aoo.82. ..
ANT Drivers IM1ilerx64 2.3.4 Gl!mln Ud crls Slbsidades x64 {11F6087F-2114-458S.9E....
ARMS 2.2.1 ARMS x64 {8014249F3f-OS.4480.99...
030X10 15.42368.0902 Miaosoft x86 (E()9C4DB7-630C-4f-06.A. ..
~ Tex!Message 9,5.0 ~Melia x86 {C4B176C2-0C81-40F7-8...
llWedX for Managed Code ... 9.022904 Miaosoft x86 (E9E34215-82EF-4909-BE ...
Doconett &Dlcter2016 SAPiEN Tec:Mologjes. nc. x86
i-- - - - - -3.1.79.0 ~ --
{OC7.l01F1.C27F-49E7A.-
--
Oropbox~e~
I-
Bevated mtl!ler
1 3.59.1
4.5.0.0
Dropbox. Irie.
__
..,,_, Ud er b usidiiries
x86
... x86
. -
{09921SAS-A723-430C-8._
{E4612F14208C>-4A lML
-
~-
- - - ~

-- --- - -
t-
Cpse>n Evett Manager 2.40.1)001 SEIKO EPSON CORPOR... x86 {0388AA32.f2X:-4178-BlL
I-
Cpse>n FAX lUly 110.00
-
SEIKO EPSON CORPOR... x86 OC8E&:93-C82E-4378-9._
C?son Pm CD
- 2.42.00 SEIKO EPSON CORPOR... x86
>--
61\31 F~27S0-4968-A._

- Pin
-Cpse>nNet 2.! SEIKO EPSON CORPOR.._ x86
- -~
I {3E314000-274E-4S4791 _,
- -- v

In a DataGridView tl1e first cell of each row starts at zero (0) and continues, in the example above the cells would
be 0-4.

In tl1e previous exarnple if we look at the row that is currently selected, Adobe Media Player:
$datagridview.SelectedCells[O].Value = Adobe Media Player
$datagridview.SelectedCells[l].Value = 1.8
$datagridview.SelectedCells[2].Value = Adobe Systems Incorporated
$datagridview.SelectedCells(3].Value = x86
$datagridview.SelectedCells[4].Value = {DE3A9DC5-9A5D-6485-9662-347162C7E4CA}

Or if your selectionmode is set to FullRowSelect you can use:


$datagridview.Selected.Ro,;vs I$_Cells[O].Value

.-
F_
u11_RowSe
__ _ _ _ _ _ __,.lv~
1ect Depending on the setting of SelectionMode in the
CelSelect
Ful!RowSelect Data GridView properties it \ Vill determine ,;vhat tl1e user can
~ select in the DataGridView.
Rowtteadetselect
Cok.mnHeadetSe!ect

In tbe example above \.Vhere we allow the user to select inultiple rows then uninstall the selected software \.Ve use
the following code:

1 $d atagridview_software .Selected Rows


2 ForEach-Object{
3 $soft_computers.Text = $soft_computers.Text -replace" ",'"' -replace '(?s){\n){2,}',
"' n" -replace '\n$', "
4 $Computer= $soft_compu ters.Text .Split("'n") I % {$_.trim()}
5 $uninstall = $_.Cells[4] .Value
214 I PowerShell Studio - A Comprehensive Guide

6 $softname $_.Cells[O].Value =
7 $returnval =
([WMICLASS]"\\$computer\ROOT\CIMV2:win32_process").Create("msiexec '/x$uhinstall
'/norestart '/qn")
8 }
*This should be wrapped in an event, such as an Uninstall Button tvith a click event. $buttonl_Click={}

4.8.2 Manually Populated Example


There are many times that you will want to inanually define the colu1nns in a DataGridView, this is easily done by
clicking on the s1nall triangle in the upper right con1er of the DataGridView, then selecting Edit Colmnns.

i~Name " ---~....._~00~--'0


~if-~--=--'"'-
---- IP Ad<:ress
0-=
===::::i!=::=::z:~====~;
Opeiatir.,, System
Dab<iridV-Taslcs

Choose Data Source: [


Edit Column~
Add Column...
0 Enable Adding
0 Enable Editing
0 Enable Deleting
0 Enable Column Reordering
Dode in Parent Container

This opens the Edit Coltlllll1S \.Vindow.

E~t C lurnn x Header Text - this is the visible na111e of the column.

Contex.tMenuStrip - used to enable a right-click menu for the


column, this has many possible uses.
Visible True
.., llehavior
Cont..iMonuStnp tlcne)
MaxlnputLength - lintits the a1nount of characters that can be
Mex~l..etlgth 32767
inserted into the colmnn cell.
. __-1
RoadOnly True
v

~ ~-:..._ ReadOnly - [True/False] set as tn1e if you do not want the data in
l ML Jl Remove
aGrid\lew eonttol horizoritaly.

I OK I Cancel the column to be editable.

Resizable - [True/False] allo\.vs the column to be resized by the user.

SortMode - allows auto, programmatic, or no sorting capabilities for the column.


Column Ty1>es:

Column T e Descri tion


-----...~--........~~~~~~~-
DataGri clView TextBox Column Used with text-based values. Generated automatically when binding to
numbers and strings.
DataGridVielvCheckBoxColumn Used with Boolean and CheckState values. Generated auto1natically when
binding to values of these types.
DataGridViewlmageColumn Used to display ilnages. Generated automatically when binding to byte
arrays, Image o~jects? or Icon objects.
DataGridViewButtonColumn Used to display buttons in cells. Not automatically generated when
binding. Typically used as unbound columns.
PowerShell Studio - Form Controls I 215

Column Type Description


DataGridViewComboBoxColumn Used to display drop-down lists in cells. Not automatically generated
\V hen binding. Typically, data-bound mai1ually.
DataGridVie\VLinkColu mn Used to display drop-do,vn lists in cells. Not automatically generated
when binding. Typically, data-bound manually.

To add a row of data to a DataGridViel.v; your na1nes and variables will of course be different from exan1ples.

$datagridview.Rows.Add("$computer', "$1ps", '1$0Sversion")


* Three column DataGridView

$datagridview.Rows.Add( 11 $computer", 11 $1ps", 11 $0Sversion", 1111


)

*Four columnDataG1idView \Vith last column empty

4.8.3 Important Methods


These are a few of the connnands that you will use 111ost often \vith DataGridVie"vs:

$datagridview.rows.add- used to add a ro\v of data to an existing DataGridVie\v.


$datagridvie\v.refresh() - used to refresh the DataGridVie'v data displayed on the screen, typically this is
the preferred corrunand to use because it calls the Invalidate for the control and then calls the Update to
force paint the control so that the invalidation is synchronous.
$datagridview.update() - basically tl1e same as refresh command, however this could be slower as it is
queued until the next WM_PAINT message is received.
$datagridview.rows.clearO - clears all data fro1n the specified DataGridVie\v.
$datagridvie\v.SuspendLayout() - used to temporarily suspend tnultiple layout events while adjust tnultiple
attributes.
$datagridview.Resu1neLayout() - used in conjunction with the previous suspend conlilland to resu1ne and
enable changes to take effect.
$datagridview.DataSource = $~'{,XX - the object that contains data for the DataGridView to display.

4.9 DATETIMEPICKER CONTROL


The DateTimePicker Control is used to allo"v a user to select a specific date \Vithin the GUI fonn.

1JT) MyForm x
Monday . December 26. 2016 0 ...
Date\Ti December 2016
Sun Mon Tue Wed Thu Fri Sat
27 28 29 30 1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
Dayof 18 19 20 21 22 23 24
25 00 27 28 29 30 31
1 2 3 4 5 6 7
DayofY. [ I Today: 12/26/ 2016
216 I PowerShell Studio - A Comprehensive Guide

The control displays a calendar style form so the user can select a specific date, the default date/tin1e is always the
current date/time.

4.9.1 DateTimePicker Example


In this exa1nple, \Ve have added a DateTi1nePicker to an empty form, and several text boxes to de1nonstrate ho\v to
obtain different values from the selected date/time.

I Monday December 26. 2016 o. . I


Date\Time Mouth
12 _______.
12126/2016 20:54:14
---------.
.....__
Day Year
120 1-
?o-16 _ _ __
Day of Week Hour
Monday
Day of Year
20 ____
---------.
.....__
Minute
___.

~1
--------.
54

Date\Time $datetimepickerl .value


Date $datetimepickerl.value.date (displays as I2/26/20I6 00:00:00)
notice time is all zeros.
Day $datetirnepicker I .value.Day
TimeOIDay $datetimepicker I .value. TimeOfDay
Day of Week $datetimepickerI.value.Day0fWeek
Day of Year $datetimepicker I .value.DayOfYear
Month $datetimepicker I .value.Month
Year $datetimepicker I .value.Year
Hour $datetimepickerl .value.Hour
Minute $datetimepicker I .value .Minute
Seconds $datetimepicker1.Value. Second
Milliseconds $datetimepicker1.Value .Millisecond
Ticks $datetimepickerl.value.ticks (The value of this property represents
the nu1nber of 100-nanosecond intervals that have elapsed since
12:00:00 midnight, January 1, 0001 (0:00:00 UTC on January 1,
0001, in the Gregorian calendar)
If you need to add a day, month, year, hour, ininute, second or n1ore to a selected date, you can use the following
exan1ples:

lAdd Day(s)
==================
I
$datetime ickerl.value.AddDays(xx)
Add Hour(s} $datetimepicker 1. value.AddHours(xx)
Add Minute(~l _ _ _ _ _ _ _ _ f$dateti1nepickerl.value.AddMinutes(xx)
Add Month(s)
,___ _ _ _ _ _ _ _ _ _ _ _ _ _ _ $datetimepickerl.value.AddM~nths(xx)
PowerShell Studio - Form Controls I 217

Add Second(s) $datetimepickerl.value.AddSeconds(xx)


Add Year(s) - - - - - - - - - + _$_datetimepickerl .value.AddYears(xx)
Add Millisecond(.~
s)_ $datetimepickerl.value.AddMilliseconds(xx)
Add Tick~) $datetime_pick~r I. value .AddTicks(Int64 value)

4.9.2 Add DateTimePicker to DataGridView


55 Have you ever wanted to add a Date/rime Picker to a DataGridVie\iv column? ,Below is the Microsoft
recommended way of adding that. In this example, they are using column index 2, along 'vith the MouseDown event
to detect clicking in the column cell.

l $datagridviewl_CellMouseDown=[System.Windows.Forms.DataGridViewCellMouseEventHandler
]{
2 #Event Argument:$_ = [System.Windows.Forms.DataGridViewCellMouseEventArgs]
3 if($_.Columnlndex -eq 2){
4 $dtp =New-Object System.Windows.Forms.DateTimePicker
5 $datagridviewl .Controls.Add ($dtp)
6 $dtp.Format ='Short'
7 $Rectangle= $datagridviewl .GetCellDisplayRectangle($_.Columnlndex, $_.Rowlndex, $true)
8 $dtp.Size =New-Object System.Drawing.Size($Rectangle.Wid-th, $Rectangle.Height)
9 $dtp.Location =New-Object System.Drawing.Point($Rectangle.X, $Rectangle.Y);
l0 $dtp. BringTofront()
ll $dtp.add_ ValueChanged({
12 $datagridviewl .CurrentCell.Value =$this.Value
13 $this.Visible = $false
14 }) $dtp.add_LostFocus({ $this.Visible= $false }) } }

5.0 DOMAINUPDOWN CONTROL


The Do1nainUpDown Control essentially provides a rotaional selector for ite1ns.

o9 Fornl D x Useful when you half limited space on your fonn but need to present many
ite1ns for selection by the user.
(Select The DomainUpDown Control can be populated either ina.nually using the
collection properties of the control \Vithin the PowerShell Studio designer?
or programinatically through code.

The 1nost typical method is to use a "TextChanged'' event to perform so1ne


type of operation on the selected value.

55 https://www.sapien.com/forums/viewtopic.php?t=l 0544
218 I PowerShell Studio - A Comprehensive Guide

To add an item to the Don1ainUpDown Control via code use:


$domainupdown l .items.add(" item4")

To remove an ite1n previously added use :


$domainupdown l .items.remove("item4")

To clear all ite1ns in the list use:


$domainupdown l .items.clear()

NOTE: All iten1s that are added via the iten1s property of the control, will return once the form is closed and
reopened, even if remove or clear is used.

To sort ite1ns in the collection use:


$domainupdown 1.sorted = $true

To add an item fro1n a teA.1box control use:


$domainupdown l .items.add($textboxl .text.trim())
NOTE: in this example, 111e trini offany extra spaces

5.1 ERRORPROVIDER CONTROL


56Provides a user interface for indicating that a control on a form has an error associated \Vith it. Use the
0-_ ErrorProvider if you \.vant to notify tl1e user that there is an input error by flashing an icon next to the input
... control. You can use a single ErrorProvider for 111ultiple controls. In the case "vhere you wish to display
different icons or styles. you \;vill need to use 1nultiple ErrorProvider controls.

5.1.1 ErrorProvider Properties

BlinkRate Gets or sets the rate at which the error icon flashes.
BlinkStyle Gets or sets a value indicating when the error icon flashes.
CanRaiseEven Gets a value indicating whether the component can raise an event.
ts
Container Gets the !Container that contains the Component.
ContainerCon Gets or sets a value indicating the parent control for this ErrorProvider.
trol
DataMember Gets or sets the list within a data source to monitor.
DataSource Gets or sets the data source that the ErrorProvider monitors.
DesignMode Gets a value that indicates whether the Component is currently in design mode.
Events Gets the list of event handlers that are attached to this Component.
Icon Gets or sets the Icon that is displayed next to a control when an error description string has
been set for the control.

56 https://www.sapien.com/blog/2011/08/l8/primalforms-2011-spotlight-on-the-errorprovider-control/
PowerShell Studio - Form Controls I 219

RightToLeft Gets or sets a value that indicates whether the component is used in a locale that supports
right-to-left fonts.
Site Gets or sets the !Site of the Component.
Tag Gets or sets an object that contains data about the component.

Icon
Use this property to change the icon used to indicate an error.
Default Icon:

BlinkRate
This property controls the rate in nlilliseconds at which the error icon blinks. Use this property to il1crease or
decrease the blink rate of the icon. Note: 1000 ntilliseconds = 1 sec.
Default Value: 250

Blink Style
Tllis property controls whether the error icon blinks when an error is set.

Values: (Default is BlinklfDifferentError)


BlinkljDi.fferentError
Blinks when the icon is already displayed and a new enor string is set for the control.

AbtVaysBli nk:
Always blinks ~vhen the error icon is first displayed, or when an error description string is set for the control and the
error icon is already displayed.

NeverBlink
Never blinks the error icon.

5.1.2 Important Methods

SetError
This method sets the error description string for the specified control.

Use the SetError 1nethod to display the error icon next to the target control and display a specified error 1nessage
when the user hovers the inouse over the error icon. To clear a11error1nessage, pass an e1npty string to the method,
using the sa1ne control as a parameter.

SetError method when validating a TextBox:

l $textboxName_Validating=[System.ComponentModel.CancelEventHandler]{
2 #Event Argument:$_ = [System.ComponentModel.CancelEventArgs]
3 #Check if the Name field is empty
4 if($textboxName.Text.Trim() -eq "")
5 {
6 #Display an error message
7 $errorproviderl .SetError($textboxName, "Please enter your name.");
220 I PowerShell Studio - A Comprehensive Guide

8 } else {#Clear the error


9 $errorproviderl .SetError($textboxName, "");
10 }}
The ErrorProvider displayed iI1 the form:

o':J Enter your Name ~=:::!.J~l2l


::!...J!~~

Name:

SetlconAlignment

This 1nethod sets the location where the error icon should be placed in relation to the control. Default Alignment:
MiddleRight

Note: You must set the aligrunent for each individual control.

Note: You can set also set the Icon Alignment in the designer by settiI1g the target control's
"IconAlignment on errorproviderl" property.

An example use of the SetlconAlignment method \here tl1e error Icon is set on the left side of the TextBox
control:
$errorproviderl .SetlconAlignment($textboxName,
[System.Windows.Forms.ErrorlconAlignment]::Middleleft)

The resultiI1g fonn:

Dl Enter your Name

Name:

( OK )

TopLeft
The icon appears aligned with the top of tl1e control and to the left of the control.

TopRight
The icon appears aligned with the top of the control and to tl1e right of the control.
PowerShell Studio - Form Controls I 221

MiddleLeft
The icon appears aligned witl1 tl1e middle of the control and the left of the control.

MiddleRight
The icon appears aligned \.Vi th the middle of the control and the right of the control.

BottomLeft
The icon appears aligned with the bottom of the control and the left of the control.

BottomRight
The icon appears aligned witl1 the bottom of the control and the right of the control.

SetlconPadding
Sets the amount of extra space left bet\.veen the specified control and the error icon.

B.
.. Note: You 1nust set the padding for each individual control.

ErrorProv ider with padding set to 1:

ErrorProvider witl1 padding set to 10:

$errorproviderl . SeticonPadding($textboxName, 1)
222 I PowerShell Studio - A Comprehensive Guide

5.1.3 Example Use


57
SAPIEN provides an ErrorProvider exainple that does a great job at demonstrating the use of the ErrorProvider
control. In this example, we \vill go through creating a fonn that demonstrates the use of the SetlconAlignment and
the SetlconPadding.
Add the following controls to ai1 einpty form:
Er "der Samplt 1. Label
2. Co1nbobox (cotnboboxl)
PJignment: v Padding: 1 3. Label
4. Nu1nericUpdo\-vn (nlltnericupdownl)
0 .. ....... ... .......,
5. Label
: Enter Name: 6. TextBox (textboxName)
: .....- .....................,
7. Button (buttonOK)

The label control na1nes are not important in


this examples and can be anything you like.
OK ] Ho\vever, the other controls we have
provided the control name to n1atch the script
code.

In the For1nEvent_Load section add the following lines of code to look like belo\v:

1 $FormEvent_Load={
2 #TODO: Initialize Form Con trols here
3 $errorproviderl .SetlconAlignment($textboxName,
[System.Windows.Forms.ErrorlconAlignment]::Middleleft)
4 $errorproviderl .SetlconPadding($textboxName, 1)
5
6 Update-ComboBox $comboboxl
([System.Enum]::GetNames([System.Windows.Forms. ErrorlconAlignment]))
7 $comboboxl .Selectedltem = "MiddleRight"
8 $errorproviderl .SetError($textboxName, "Please enter your name.");
9 }

Create an textboxNaine "validating" event (right-click on the textboxNa1ne control and select "validating"). Within
the textboxNaine_Validating section add the follo\ving lines of code to look like below:

10 $textboxName_Validating=[System.ComponentModel.CancelEventHandler]{
11 #Event Argument:$_ = [System.ComponentModel.CancelEventArgs]
12 #Check if th e Name field is empty
13 if($textboxName.Text.Trim() -eq "")
14 {#Display an error message
15 $errorproviderl .SetError($textboxName, "Please enter your name.");}
16 else

57 https://www.sapien .com/blog/2011/08/l8/primalforms-20 l l -spotlight-on-the-errorprovider-control/


PowerShell Studio - Form Controls I 223
17 {#Clear the error
18 $errorproviderl .SetError($textboxName, "");}}

Create a comboboxl "selectedindexchanged'' event (right-click on the combobox control ai1d select
"selectedindexchanged"). Within the comboboxl _selectedindexchanged section add the f 0110,ving lines of code to
look like below :

19 $comboboxl _SelectedlndexChanged={
20 #TODO: Place custom script here
21 $errorproviderl .SetlconAlignment($textboxName,
[System.Windows.Forms.ErrorlconAlignment]$comboboxl .Selectedltem)
22 }

Create a nm11ericupdownl "valuechanged" event (right-click on the nu1nericupdown control and select
"valuechai1ged"). WithiI1 the nu1nericl_valuechanged section add the following lines of code to look like below:

23 $numericupdown 1_ ValueChanged={
24 #TODO: Place custom script here
25 $errorproviderl .SetlconPadding($textboxName, $numericupdown l .Value)
26 }

Now 'vhen you run the form it should appears like the example below :

Try changing the alignment and padding to see the


ErrorProvider Sample x changes to the ErrorProvider icon. The icon will
re1nain visible until you ei1ter so1nething in the text
Alignment: MiddleRight v Padding: , ~I box.

Enter Name:
11

[ OK ]
224 I PowerShell Studio - A Comprehensive Guide

5.2 FILESYSTEMWATCHER CONTROL


58
The FileSyste1nWatcher is a very powerful co1nponent, which allows us to connect to the directories a11d \Vatch
for specific changes within them, such as creation of new files, addition of subdirectories and renaming of files or
subdirectories. This makes it possible to easily detect when certain files or directories are created, modified or
deleted. It is one of the members of System.IO namespace.

59Wlrile researching this topic, I came across a great article by John Simmons about the FileSystemWatcher, it is
written for C# however it is still a great article discussing the advai1tages and limitations of this control.

The FileSystemWatcher component is designed to watch for changes within the directory, not to changes to the
directory's attributes themselves. For exa1nple, if you are watclring a directory called c:\Mydir, the co1nponent will
monitor changes within the directory but not changes to the directory itself.

There are several properties you set for your FileSystemWatcher co1nponent instai1ces to determine ho\v they
behave. These properties determine what directories and subdirectories the co1nponent instance will monitor and
the exact occurrences \.vithin those directories that \Vill raise events.

Path - Sets or Gets the Path of the directory to watch.


EnableRaisingEvents - Enable or disable the component.
Filter - Gets or sets the filter string, used to determine \.vhat files are monitored in a directory. Default
value is (*. *)
IncludeSubdirectories - Enables or disables including subdirectories to be watched.
InternalBufferSize - Gets or sets the size of intenial buffer. Default is 8K.
NotifyFilter - Gets or sets the type of changes to \Vatch for.

FileSystemWatcher can notify for the follovving types of changes:


FileName
DirectoryName
Attributes
Size
LastWrite
LastAccess
Creatio11Ti1ne
Security

The Path property indicates the fully qualified path of the root directory you want to watch. This can be in standard
directory notation(c:\directory) or in UNC fonnat (\\server\directory).

58 http://www.c-sharpcorner.com/article/monitoring-file-system-using-filesystemwatcher-class-partl I
5 9 https://www.codeproject.com/ artic les/587 40/filesystemwatcher-pure-chaos-part-of
PowerShell Studio - Form Controls I 225
The IncludeSubdirectories property indicates \.Vhether subdirectories within the root directory should be
monitored. If the property is set to true, the component watches for the same changes in tl1e subdirectories as it does
in the main directory the component is watclling.

Set Filter property to an empty string("") to watch for changes in all files. To watch a specific file, set the Filter
prope1ty to the file name say "samp.t:A1" . You can also ' vatch for changes in a certain type of file. For example, to
watch for changes in document files, set the Filter property to "*.doc".

FileSystemWatcher class does not ignore lridde11 files. Setting the Filter does not decrease "vl1at goes into the buffer.

By settingNotifyFilter property to one of the NotifyFilters values, you can track several types of changes such as
changes in Attributes, the LastWrite date and time, or the Size of files or directories or when sec1trity access to a
file or directory tights changes. These values are all part of the NotifyFilters enumeration. You can set mtlltiple
changes to \Vatch for by using "I" operator.

Your FileSyste111Watcher con1ponent has the potential to receive an enormous ntunber of events, particularly if you
have set it to \.Vatch a very high-traffic directory. Tl1is can cause problems, as the FileSyste1nWatcher co1nponent
can only receive event notifications at a manageable rate. The system notifies the co1nponent of ftle changes, it
stores those changes in a buffer the co1nponent creates and passes to the Win32 Application Prograinming Interfaces
(APis). If there are many changes in a short tiine, the buffer can overflo\v. This causes the co1nponent to lose track
of cha11ges in the di.rectory, and it ' vill only provide "blanket" notification a11d the con1pone11t \.Vill raise an exception.
Default size is 4KB, you cai1 i11crease the buffer size using Inten1a1BufferSize, but increasing the size of the buffer
is expensive, as it comes from non-paged inen1ory that caiu1ot be swapped out to disk, so keep the buffer as srnall
as possible. A 4 KB buffer can track changes on approxiniately 80 files in a directory. Each event takes up 16 bytes
in the buffer, plus enougl1 bytes to store the na111e of the file, in Unicode (2 bytes per character), tl1at tl1e event
occurred on. You can use this info11nation to approximate the buffer size you will need.

To avoid a buffer overflow, use the NotifyFilter and Include Subdirectories properties so you can filter out unwru1ted
change notifications.

In addi.tio11 to using the FileSyste1nWatcher co111ponent to innnediately 11101ritor a specific directory. you can use the
WaitForChai1ged method to wait until a specific event occurs ai1d then contiI1ue with execution of tl1e thread. For
exa1nple, if you are working with a Web-based nevvs applicatio~ you inight create an adn1in portion of the site
\Vhere users upload tl1eir ne\.vs stories. You cottld use the WaitForChai1ged method to \.Vatch tl1at directory until the
last access date c.hanges, and tl1en begin processing tl1e ne\.vs directory for new articles.

You specify U1e type of change to watch for by setting tl1e value of a WatcherChangeType e11umeration. The possible
values are as follows:
226 I PowerShell St udio - A Comprehensive Guide

Member Name Description


All The creation, deletion, change, or renaming of a file or folder.
Changed The change of a file or folder. The types of changes include: changes to size, attributes,
security settings, last write, and last access time.
Created The creation of a file or folder.
Deleted The deletion of a file or folder.
Renamed The renaining of a file or folder.

WaitForChanged is a synchronous 1nethod that retun1s an object of type WaitForChangedResult. This class contain
specific infom1ation on the type of change that occurred in the directory. You can access information such as Name,
OldName, and TiinedOut on this object to find out 1nore about the change. TimeOut is the time (in 1nilliseconds) to
wait before timiI1g out.

If you use it in a Windov.is Form application, the application \Vould stop responding if the inethod was used on the
UI thread instead of the \Vorker thread.

Although some co1nmo11 occurrences, such as copying or moving a file, do not correspond directly to ai1 event, these
occurrences do cause events to be raised. When you copy a file, the syste1n raises a Created event in the directory
to \;vhich tl1e file was copied but does not raise ai1y events in the original directory . When you move a file, the server
raises two events: a Deleted event in tl1e source directory, followed by a Created event in the target directory.

FileSyste1nWatcher has fotu different events that can be added and configured, you can access these events by right-
clicking on the FileSystemWatcher control in tl1e Designer.

Add hents (Sfrlesystemwatcherl)

Olanged
0 Created
0 Deleted
l Renamed

j
Create r _J
cancel
PowerShell Studio - Form Controls I 227

5.3 FLOWLA YOUTPANEL CONTROL


The FlowLayoutPanel is a great way to organize several controls in an orderly fashion with easy. Simply drag/drop
the FlowLayoutPanel to your form then resize the control as needed. As you drag/drop other controls onto the top
of the FlowLayoutPanel it will auto1natically align your controls per the FlowDirection that you choose in the
FlowlayoutPanel properties.

There are four different flow directions: LeftToRight, TopDown, RightToLeft, Botton1Up.

oO Form o!? Form


fo ~;~-----------~-----------1

I I
jOradiob.Aton2 lj

I
!O ra<iob4 .ionJ :
IjO radiob.Aton4 I!
I I
. I
! I
I. .I
I !
I
!
I

I"'------------------------------"'i
Left to Right Top Down

og Fo m oSI rm
-------------------------. r---------------------------------------------------------------------.....
...
--~ ---------- ---------~-~-- -----~------
!0 raciotx.ttonJ 0 raciotx.tton2 0 raciotx.tton1 '
:'
I ..' I
'

I 0 raciotx.tton4 .'
:
,
:
.
I
I
I
::
.'
I

I.. ''

: iiO raciobutton4 II
...I
I
I .'
'

Ii I
:O
.:'
raciotx.ttonJ
.
'

I 1..0
:
raciobutton2
..i
I
:

.i: !O !
."'----------------------------- '
---- ----------------------------------------J -----raciobutton
--......... 1
...... _...............____,
-----------~-..._...............................................

Right to Left Bottom Up

Be aware that when using the FlowLayoutPanel that it will ignore all docking an anchoring of any controls that are
placed within it, if not it would defeat the purpose of the Flo"vLayoutPanel having the ability to align controls.
228 I PowerShell Studio - A Comprehensive Guide

5.4 FOLDERBROWSERMODERNDIALOG
Q 60

-... The FolderBro,;yserDialog is the predecessor to the latest FolderBrowserModernDialog control.

If you are running Windows 7 or later it '1Vill display the moden1 version of the FolderBro,;yserDialog:

v Ltbfnt> ~ SAPel P"'~rShd!Scudoo201S

Org.ono:t """"(oldtf

0."moclo! <Cl T7~

1211 '2010:)2 PM F lcld<r


Dowr'c .OS

Ooo rte Mfi (2)

Oocumcnb

If you are running on a legacy OS, less than Windows 7, it will display the original FolderBrowserDialog:
_,__
I

.......
,o...;,.-..-.~

......
Ntlilo ...
~ ......,....~
~ .... au

.---
~--1:111
ii '-SMl~W
31 ...
......._.,

--
-
....
--
.............
/J-.....ilrrilM. .
. . ,...... . . . . .1
Ila r ....s;.,.

Here is an exa1nple of how to display the FolderBrowserModernDialog using its Show Dialog method:

1 $folderbrowsermoderndialogl .SelectedPath = $textboxPath.Text


2 if ($folderbrowsermoderndialogl .ShowDialog() -eq 'OK')
3 {
4 $textboxPath.Text = $folderbrowsermoderndialogl .SelectedPath
5 }

Keep in niind that the (TextBox - Browse for Folder) in the Controls Sets panel still uses the legacy style
FolderBro111serDialog. I'll show you a little later ho111 you can create your own Modern Browser Control
set, iffact you can easily create many control sets for comb;nations ofcontrols that you regularly use.

60https://www.sapien.com/blog/2015/05/0l/powershell-studio-2015-new-folderbrowsermoderndialog-
control/
PowerShell Studio - Form Controls I 229

5.5 FONTDIALOG CONTROL


The FontDialog is used to allow a user to change the font, style, color, effects and size for any specific control(s) or
text that you choose.

5.5.1 FontDialog Example


In this example I have added the FontDialog Control, two buttons and a richtextbox.

or;} Form 0 x By clicking the "Change Font" button, a popup Font


Dialog window \vill appear to allow you to custo1nize the
Change Me
font.

The font vvill then be applied to both the text in the


I Change Font I teA1box and the text for the "Change Me" button. This
de1nonstrates how you can use the FontDialog to change
User can change the fori of ttls message!
different controls, even at the sa1ne time .

....:

With this control, there is no code that is automatically generated in the editor, however there is so1ne you will need
to add yourself. In this exainple I used a click event for the "Change Font" button:

1 $buttonChangeFont_Click={
2 $fontdialogl .ShowDialog()
3 $font= $fontdialog l .Font
4 $richtextbox 1.Font= $font
5 $buttonChangeMe.Font =$font
6 }
230 I PowerShell Studio - A Comprehensive Guide

5.6 GROUPBOX CONTROL

The GroupBox is used for design purposes to organize and layout the functionality of your fonn so that it is easier
for the user to follow.

~JV..J
For example, as you can see in the figure on the
I* Force wsus Updates
0 Use Mia'osoft Update SeNer
SeJect ths op:oo to use the
left, multiple group boxes have been used within
Microsoft Wnd<ms Update
SeNer for recevng updates. a large group box to organize the different
I
settings. This inakes it inuch easier for the user
to follow the organization of the different
0 Notiy before download and instal
@ Enable 0 Disable options that are available.
@ /Uo download/Nolly of flStalation

0 /Uo download/schedUe rntalation


WSUS Server Name Port I
!Select Day : ~ Tme :_J
18530
0 /Uo Updates/User corfiouable

@ ~Users 0 Aduilisbators
'""
0 Pl.ow user lo deode ~tien to Fe$lart
@ Yes - Siertly 0 No -treat like al updates
@ Notiy user alio-feStart In 15 miUes
I t ..li:A

@ DefaUI - 5 min. 0 Custom MIUes @ Every 22 hous 0 Custom Hous


'Select Mnutes : lseiect Holn :
l~~~~~=---c~~ ltl1~~~~~~'

wsus Com!ation
0
You can see the final outcome in the figure to the I Foroe WSUS Updates
Use Microsoft Update SeNer
Select this opt.on o use the
right. This is a much better approach to form Mcrosof: Wndows Update
SeNer fot receM'l9 updates
design.
Download and lnstal Options

0 Nolly befcxe download and mtal


@Enable 0 CXsable
@ IU.o download/Notiy of instalatlon
WSUS SeNerCom!atlon
0 /Uo download/schedUe instalation
WSUS Server Name Port I
~Day : Select Tme :
ls530
0 A.to Updates/User corfiguable
Who can approve/<isapprove ~es'>

Restart wih Logged On Users?


lnstal Mmr Updates A.tomaticaly?
0 Pl.ow user lo decide when to restart
@ Yes - Silerily 0 No -treat like al updates
@ Notiy user alio~slart in 15 mi'Ues

l.eni of Tme Warring Before Reboot If Recped'> How often to check f0< new ~es1
@ Defaul - 5 min. 0 Custom Mirues @ Every 22 hous 0 Custom Hous
1
Select Hotn :
'Select Mrues : I
PowerShell Studio - Form Controls I 231

5.7 HELPPROVIDER CONTROL


The HelpProvider Control is a unique tool that allow you to provide popup help for any control.

o_. Form 0 x First, Drag/Drop the HelpProvider Control to your form, you will
notice that it has very little properties associated with it, and there is no
code generated in the editor. However, it is very simple to getting
button1 runrung.

In this exainple, I have created a si1nple fonn with one button ai1d one
combobox to demonstrate how to setup the HelpProvider, this will
work the same for any control.

First you need to tell the form which control you are initiating the HelpProvider for:
l $helpproviderl .SetShowHelp($button l)

Second, you need to set the string that you \Vant to display when the user clicks on the control and presses Fl :
l $helpproviderl .SetHelpString($button l, "Help for button l ")

In this example I used four lines:


l $helpproviderl .SetShowHelp($button l)
2 $helpproviderl .SetHelpString($button l, "Help for button l ")
3 $helpproviderl .SetShowHelp($comboboxl)
4 $helpproviderl .SetHelpString ($combo box l, "Help for combobox")

110 Form 0 x ~9 Form 0 x


~Help for Wton 1
&11 I
I buttonl

:: ...
232 I PowerShell Studio - A Comprehensive Guide

5.8 IMAGELIST CONTROL

0-.. 61
The hnageList Control is used to store a group of in1ages that can be accessed by other controls. linages
that are included in the I1nageList are stored as bina.J.}1 data 'vithin the form. Example below:

l # imagelistl
2 $Formatter_binaryFomatter = New-Object
System. Runtime .Serialization.Formatters. Binary. BinaryFormatter
3 #region Binary Data
4 $System_IO_MemoryStream = New-Object System.10.MemoryStream
(, [byte[]] [System.Convert] ::FromBase64String ('
5 AAEAAAD///// AQAAAAAAAAAMAgAAAFdTeXNOZWOuV21uZG93cy5Gb3JtcywgVmVyc21vbjOOLjA
u
6 MC4wLCBDdWxOdXJIPW51dXRyYWwslFB l YmxpYOtleVRva2VuPWl3N2El YzU2MTkzNGUwODkFAQA
A
7 ACZTeXNOZWOuV21uZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJIYW l lcgEAAAAERGFOYQcCAgAAAAk
D
8 AAAADwMAAAAaCAAAAklTRnQBSQFMAwEBAAEIAQABCAEAARABAAEQAQAE/wEJAQAl/wFC
AUOBNgEE
9 BgABNgEEAgABKAMAA UADAAEQAwABAQEAAQgGAAEEGAABgAIAA YADAAKAAQABgAMAA YA
BAAGAAQAC
10 gAIAA8ABAAHAAdwBwAEAAfABygGmAQABMwUAATMBAAEzA.Q ABMwEAAjMCAAMWAQADHA
EAAylBAAMp
11 AQADVQEAAOOBAANCAQADOQEAAYABfAH/AQACUAH/AQABkwEAAdYBAAH/AewBzAEAAcYB
lgHvAQAB
12 l glnAQABkAGpAaOCAAH/ATMDAAFmAwABmQMAAcwCAAEzAwACMwlAATMBZglAATMBmQIA
ATMBzAIA
13 ATMB/wlAA WYDAAFmATMCAAJmAgABZgGZAgABZgHMAgABZgH/AgABmQMAAZkBMwlAAZkBZg
IAApkC
14 AwcAAQMHAAEBBwABAQcAAQEnAAEHBwABBwcAAQcHAAH/BgAL'))
15 $imagelistl .lmageStream =
$Formatter_binaryFomatter.Deserialize($System_IO_MemoryStream)
16 $Formatter_binaryFomatter =$null
17 $System_IO_MemoryStream =$null
18 $imagelistl .TransparentColor = 'Transparent'
19 #endregion Generated Form Code

There are five different bit depths to choose fro1n for the images in the hnageList; 4Bit, 8Bit, 16Bit. 24Bit, and
32Bit.

61 https://www.sapien.com/blog/2011/10/19 /primalforms-2011 -spotlight-on-the-imagelist-co.ntrol/


PowerShell Studio - Form Contro ls I 233

5.8.1 Comparing Image Bit-Depth

Bit depth refers to the color infonnation stored in an itnage. The higher the bit depth of an image, the more colors it
can store. Tl1e si1nplest i1n age, a 1 bit i1nage, can only shovv two colors, black and \Vhite. That is because the 1 bit
can 01tly store one of tw o values, 0 (white) and 1 (black). An 8 bit image can store 256 possible colors, vvhile a 24
bit i1nage can display about 16 million colors. Keep in mind that the larger the bit-depth and size of yo1rr images,
the larger tl1e finished .psf or .ps l file will be, I recoilllnend using the s1nallest bit-depth that you can get away with.

Bits per Pixel Number of available colors


4 16
8 256
16 65,536
24 16,777,216
32 16,777,216 +Transparency

The human eye can only discern about 10 nzillion different colors, so saving an inzage higher than 24-bit
is excessive ifthe only intended purpose is for vie1'11ing, unless you need transparency. Also, standard JPEG
and 1'/FF.files can only use 8-bit and 16-bit, respectively.

a .. ffii lmagelist Tasks To add ilnages sitnply click on the triangle in the upper
j ~ unagelistl
... .. ; Image Size ~t:Wt3 right con1er of the I1nageList control, then select the
iinage size, bit-depth, and click the " Choose Images" .
Image Bit Depth IDepth8Bit v
1
J Choose mages

In tl1e image on the right you can see how an i1nage with a
lower bit-depth will have a relatively graiitier look to it
than an image w ith a higher bit-depth. Typically for
1nonitor viewing 8-bit provides a liappy medium between
size savings and great looking hnages.

When ii1creasi11g i1nage bit-depth you also exponentially


increase the size of the ilnage file, in the case of 8-bit to
24-bit, it increases from 420k to 12MB.

24-BIT COLOR 8-en COLOR 8-en e/w I-en B/w


16MILLIONCOLORS 256 COLORS 256 GRAYS 2COLORS
1.2 MB 420 K 320 K 42 K
234 I PowerShell Studio - A Comprehensive Guide

5. 9 LABEL CONTROL

Q 62
The Label Control is a clickable text string display. Typically used to provide labeliI1g for other controls.
-

Analysis Meter -- --- Here we use a Label Control (Analysis Meter) to indicate what the
ProgressBar is used for.
0%

Ttflhenyou change the text in a label PowerShell Studio will change the nan1e of the variable of the Label
Control. For instance, ifyou change the name ofthe Label Control to "Exit ,, then PowerShell Studio will
change all references in the script code to $LabelExit.

TIP: To direct Windows PowerShell to evaluate an expression before inserting the result in a string, use a
sube:Kpression. The syntax is$( <e:x.'})ression ).

Without subexpression:

1 $Labe1Main.Text ="Building automation on (Get-Process 'PowerShell


Studio').MainWindowTitle"

Form x
Building automa~ on (Get-Process PO'lt-wShe!I S.'udio1 Main\'Jinda11Title

With subexpression:

1 $Labe1Main.Text ="Building automation on $((Get-Process 'PowerShell


Studio').MainWindowTitle)''

Form x
&nkJ.ng 3u:oma:.on on SAP1EN POY.tfShell S:udio 20 5

To disable or enable the clickable feature of the label use the Enabled property. Enabled = $false 111ill
disable the clickable feature.

62 https://www.sapien.com/blog/2015/12/ 16/spotlight-on-the-label-control/
PowerShell Studio - Form Controls I 235

6.0 LINKLABEL CONTROL

The LinkLabel Control is much like the Label Control that vve just discussed, with the exception that this provides
for a linkable text.

oSJ Form 0 x The LinkLabel Control has inany possibilities, including:

Open a v.'ebsite ~ Opening a Webpage


Automated Remediation V.Jebsite
--- -- ~
~
Opening a folder, local or remote
Starting up an application
Open a folder ~ Start/End a process
C: Drive - ---- ~ Opening a document
~ Sending an e1nail
Start an application

PovrerShell (Administrator)
- This is only a fevv of the many possibilities that can be ilnagined
for use.

In the example on the left \Ve have three different LinkLabels


:.
that perfonn different tasks. The code used for each of the
Link:Clicked Events is shown below:

Open Webpage
l $1inklabelAutomatedRemediation_LinkClicked=[System.Windows.Forms.LinklabellinkClickedEven
tHandler]{Start("http://www.automatedremediation.com")}

Open local folder


1 $1inklabelCDrive_LinkClicked=[System.Windows.Forms.LinklabellinkClicked EventHandler]{ii c:\}

Start PowerSbell as Ad1ninistrator


1 $1inklabelPowerShellAdministra_LinkClicked=[System.Windows.Forms.LinkLabellinkClickedEventHa
ndler]{Start-Process -FilePath "powershell" -Verb runAs}
236 PowerShell Studio - A Comprehensive Guide

6.1 LISTBOX CONTROL

The ListBox Control is used to display multiple items which can be populated either manually in the control
properties or program1natically \:vithin the script code. The ListBox also provides the MultiColu1nn property to
enable the display of items in colmnns instead of a straight vertical list of items. With this, the control can display
more visible ite1ns a11d the user no longer needs to scroll to an item.

The selection 1node property allows you to define if the items in the ListBox are single-select, multiple-select, or
not selectable at all.


None No items are selectable
One Only one ite1n at a ti1ne is selectable
MultiSimple A inouse click or pressing the SPACEBAR selects or deselects an item in the list.
MultiExtended Pressing SHIFT and clicking the 1nouse or pressing SHIFT and one of the arrow keys (UP
ARROW, DOWN ARROW, LEFT ARROW, and RIGHT ARROW) extends the selection
from tl1e previously selected item to the current item. Pressing CTRL and clicking the inouse
selects or deselects an item in the list.

The selection mode can also be set within script code using:
$listboxl.selectionMode = "MultiExtended"

To allow users to select 1nultiple items then perfor1n an action on each item selected, you can si1nply do tl1e
follo\ving:
./ Set the selection inode for the ListBox control to either "Multiextended" or "Multi Simple" .
./ Perform the desired actions on each selection with: $Listboxl.selecteditems I o/o {$_ "Enter your actions"}
The $listbox.selecteditems refers to all selected ite111s i11 the ListBox. The % after the pipe is a symbol for
FORBACH and the $_ refers to tl1e current object. You could even call functions or scripts blocks.
PowerShell Studio - Form Controls I 237

6.1.2 ListBox Control Example

aSJ Form D x In this example, we have a ListBox control at the top, which we
have populated with ite1ns in the collection within the control's
property window.
computerl
er2 There is one button in the center that will be used to perfonn an
action on each selected ite1n in the ListBox.

The final control is a RichTextBox at the bottom which is used to


provide visual confirmation that the actions were performed.
( Process Selected Computers J
* I have included five fake computer naines, and the last being 1ny
real test machine name, to demonstrate tl1at the actions are being
performed.
comptier1 IS offline
computer2 is offline
computer4 is offline
jeff-hp is Online

....:

The code that I used in this example is listed below :

l function checkonline
2 {
3 # Check if computer is online
4 if (test-Connection -ComputerName $_-Count l -Quiet)
11 11
5 {$richtextboxl .AppendText( $_ is online 'n )}

6 else
11 11
7 {$richtextboxl .AppendText( $_ is offline 'n )}

8 }
9
l 0 $buttonProcessSelectedCompu_Click = {
ll # Clear the textbox
1111
12 $richtextboxl .Text=
13 # Call the CheckOnline function for each selected item
14 $Listboxl .Selectedltems I 3 {
15 checkonline $_}
16 }
238 I PowerShell Studio - A Comprehensive Guide

6.2 LISTVIEW CONTROL


63The
ListView is a hybrid display. It is more co1nplex than a ListBox, but also can display data like a grid.
_0- A ListView control allovvs you to display a list of items with item text and, optionally, a11 icon to identify
the type of ite1n. For exa1nple, you could use the ListView to display icons in a silnilar fashion to the
Windo'v' s File Explorer.

This information comes from David Corrales at SAPIEN who created a very nice three-part series of Spotlights on
the ListVievv Control.

6.2.1 Important Properties

Vielv
This property indicates how items are displayed in the control. Use this property to set the style or vievv of the
ListView control.

Select from the follo,ving views:

Largelcon
Each item appears as a full-sized icon with a label below it.

~
PrimalScript PrimalForms OtangeVue

PrimalSQL
~
PrimalXML

Details
Each ite1n appears on a separate line \Vith further information about each item arranged in columns. The left-most
colmnn contains a small icon and label, and subsequent colmnns contain sub items as specified by the application.
A column displays a header which can display a caption for the co1Ullll1. The user can resize each column at run
ti1ne.

Product Status
, ............ ........................,...................................................................................
._

!OtangeVue lnsta ed
~;lP~~F;:;OOoooououoooooouomuuuuuo~~~"";f """""""""""""""""""""

@) PrimalSaipt lnstaDed
PrimalSQL lnstaDed
lnstaDed

63 https://www.sapien.com/blog/2012/04/04/spotlight-on-the-listview-control-part- l J
PowerShell Studio - Form Controls I 239

Smallfcon
Each ite1n appears as a s1nall icon with a label to its right.
~ f(h~~~V~~! !Si Primal Forms
~-p~~&riPt.. - PrimalSQL
I PrimalXML

List
Each ite1n appears as a s1nall icon with a label to its right. Items are arranged in columns with no column headers.
1~o;~~~1
- , ..............................
!:i:l Primal Forms
~ PrimalSctipt
Primal SOL
,...., PrimalXML

Tile
Each item appears as a full-sized icon with the ite111 label and subitem infonnation to the right of it. The subite1n
information that appears is specified by the application. This vie,;v is available only on Windows XP and the
Windows Server 2003 fa1nily. On earlier operating systems, this value is ignored and the ListVie\v control displays
in the Largelcon view.

,.................................1
piangeVue 1
l n~a ted
....................................................................................
,l

"1
tiilflfl
- - nsta .ed
Prima!Forms

~ PrimalScript
~ f'sta.ed
(~;) PrimalSQL
~) 4'\staed
fI Prima!XML
~ Jistaied
240 I PowerShell St udio - A Comprehensive Guide

Sonie properties only pertain to particular views. The compatible viei11s will be listed in each property 's
description .

Alignment
This property indicates hovv items are aligned within the ListView .

Compatible Views: Smalll con, Largel con


Default Value: Top

Default
When the user moves ru1 ite1n, it re1nains \vhere it is dropped.
Top
Ite1ns are aligned to tl1e top of the ListVie'v control.
Left
Ite1ns are aligned to the left of the ListView control.
SnapToGrid
Ite1ns are aligned to an invisible grid in the control. When the user moves an ite1n, it moves to the closest
juncture in the grid.

AllowColumnReorder
This property indicates whether the user can reorder colunm headers in the Details view. Set this property to True,
the users the order of the column header, by dragging the header to the desired location.

Co1npatible Views: Details


Default Value: False

ChecldJoxes
This property indicates \.Vhether a check box appears next to each item in the control.

Co1npatible Views: All except Tile


Default Value: False

When CheckBoxes is set to True, use the ItemChecked event to respond to an item's checked state changes.

Product Status
[t] MEh~~9~v~~~~;i
CJ !s fF>;;~i"F~~.......................~~~. . . ..
El ~ PrimalScript lnsta ed
EJ ~ PrimaJSQL lnstaDed
EJ I.- PrimaJXML lnsta!led

Columns
This property contains a collection of colu1nn headers that are displayed in the Details view.
PowerShell Studio - Form Controls I 241

Compatible Views: Details


You can access the Colunuilieader Collection Editor via the designer:

c:> r: ~

lktYltwTMb
tcBltt~

(cfjC~~
((fi Gr~ _ _t_
()pcm h t_C_
olumns
_ _c_oC_
fl:_
tlOn
_ ~
- ,

V'icw:

Ood: 11'1 Parcn= Ccnwn<f

===o )

Or you can access the ColumnHeader Collection Editor via the Property Pane:

AnowColumnR False
Autokange False
(Colledioni Q
ContextMenu~ (none) ~
Enabled True
Groups (Collection)

The ColmnnHeader Collection Editor allows you to add I remove Colmnn as well as modify their properties:

( st ... _ Cdloc+_C...

Olltcfe. .l ; C l

td! I &i .
: l

. l6oc - ' 3
...,,_ o -
.....,.~ t:::l -
T ~
f~ "
!Al

The Columns collection is made up of the following object

ColumnBeader [System.Windows.Forms.ColtunnHeader]

t
DisplayIndex This property indicates the display order of the column relative to the currently displayed
columns
242 I PowerShell Studio - A Comprehensive Guide

Imagelndex This property indicates the index of the image displayed in the ColumnHeader.
Text This property contains the text displayed in the column header.
TextAlign This property determines the horizontal aligrunent of the text displayed in tl1e CohunnHeader.
Values (Default: Left):
Left
The object or text is aligned on the left of the control element.

Right
The object or text is aligned on the right of the control ele1nent.

Center
The object or text is aligned in the center of the control ele1nent.

Width This property detennines the width of tl1e column.

Set Width = -1, to adjust the width of the longest ite111 in the column.
Set Width = -2, to auto size to the width of the colUllll1 heading.
Note : When setting these special values, the control will automatically replace the Width with the calculated
value.

FullRowSelect
This property indicates "vhether all sub items are highlighted along with the item when selected.

Co111patible Views: Details


Default Value: False

Selection without FullRowSelect:


Product Status
~ Installed
:it PrimalForms lnstaBed
~Primal Script Installed
bd Primal SOL Installed
PrimalXML lnstaDed

Selection "vith FullRowSelect:


Product Status
~
"--'=--=--~--=:........:=-~~~~~

lm1 Primal Fonns


Installed
~ PrunalScript Installed
bd PrimalSQL lnstaDed
I.- PrimalXML Installed
PowerShell Studio - Form Controls I 243

GridLines
This property indicates whether grid lines appear bet\veen the ro,vs and columns containing the items ai1d sub ite1ns
in the control. The grid lines are only shown when in Details view.

Compatible Views: Details

Product Status
~a:;;;g~v~~~~~f ...................................--
tst PrimalFormslnstaDed
~ PrimaJScript lnstaBed
bCl PrimaJSQL lnstaDed
I;- PrimaJXM L lnstaDed

Grou1>s
This property contai11s a collection of ListViewGroup objects that are used by the control. Groups are very useful
to display ite1ns in categories withil.1 the ListView.

B.
If there are groups defined and a item has no group set; it will go into the "Default " group.

Compatible Views: All except tl1e L ist

You can access the Group Collection Editor via the Designer:

61C~.a
( Groupi ~--tM-(-ciurnM--c-oll-t':-1.-
~ _.
'":l-tO--.t




c~

---ol
HeaderStvle
This property indicated the style of the colu1nn headers in the Details vievv. Use this property when you wai1t to
prevent the users from having the option to click on the headers. Typically, you would want to sort the itetns when
a user clicks on the header. You can respond to a header click by using the ListView 's Colu1nnClick event.

Compatible Views: Details

Values (Default: Clickable):

None
The colu1nn header is not displayed in report view.
244 I PowerShell St udio - A Comprehensive Guide

Nonclickable
The colunm headers do not respond to the click of a mouse.
Clickable
The column headers function like buttons and can cany out an action, such as sorting, when clicked.

HidcSelcction
This property indicates whether the selected item in the control remains highlighted \vhen the control loses focus.

Co1npatible Views: All

HotTracking
This property indicates whether the text of an ite1n or subite1n has the appearance of a hyperlink \vhen the inouse
pointer passes over it.

Enabling hot tracking will cause the Activation property to be set to OneClick and the HoverSelection property to
be set to true. In addition, run-time label editing is not allo\ved \vhen hot tracking is enabled.

Con1patible Views: All

Default Value: False

LabclEdit
This property indicates whether the user can edit the labels of ite1ns in the control. Use the BeforeEditLabel and
AfterEditLabel events in order react to when a user changes a label.

Compatible Views: All

Default Value: False

Largelm ageList
This property contains the I1nageList control used by the ListView for i1nages in Large Icon view. See the Spotlight
on tl1e ImageList Control blog article for n1ore infon11ation on tl1e ImageList.

" The index of the corresponding SmalllmageList should be the same as the LargelmageList.

Co1npatible Vie,vs: Large/con

SmalllmageList
This property contains the ImageList control used by the ListView for images in all views except for the Large
Icon view.

Co1npatible Views: Snialll con, Detail, List, Tile

StatelmageList
This property contains the ImageList control used by the ListView for custom states.
PowerShell Studio - Form Controls I 245

Q_ If an IniageList is specified in the StatelmageList property and the CheckBoxes property is set to true, the
in1ages at index positions 0 and 1 in the JnzageList are displayed instead of the check box. The image at
index position 0 is displayed instead of the unchecked check box, and the image at index position 1 is
displayed instead of the checked check box.

Compatible Views: All

MultiSelect
This property indicating "vhether 1ntlltiple ite1ns can be selected. If this property is set to tn1e, use the Selectedlte1ns
property to determine "vhich items are selected.

Compatible Views: All


Default Value: True

ShowItem Tool Tips


This property indicates \Vhether ToolTips are shown for the ListViewItem objects contained in the ListView.

Compatible Views: All


Default Value: False

Sorting
This property indicates the way ite1ns are to be sorted.

Default Value: None

None
The ite1ns are not sorted.
Ascending
The ite1ns are sorted in ascending order.
Descending
The ite1ns are sorted in descending order.

Compatible Vie\vs: All

Selecteclltems
This property contains all the ite1ns that are selected in the ListView.

ft..
Each itenz is a ListViewltem object; so you must use the Text property to display the nanie.

1 #Display Selected Items


2 foreach ($itemin$1istviewl .Selected Items)
3 { Write-Host $item.Text}

Items
This property contains a collection of all the items in the ListView. All items in a ListView are represented by a
ListViewlte1n object:

ListViewltem [System.Windows.Fonns.ListViewlte1n]
246 I PowerShell Studio - A Comprehensive Guide

t
Checked This property indicates \Vhether the item is checked.
Text Th.is property contains the displayed teA1 of the item.
ToolTipText Th.is property contains the text shown when the 1nouse pointer rests on the ListViewltem.
GroUfl This property points to the group to \Vhich the ite1n is assigned.
Set this property to any existing Group. All items \Vith an unsigned Group will be shovv in
the ''Default" Group.
lmagelndex This property indicates the index of the i1nage that is displayed for the iten1.
Statelmagelndex Tlus property indicates the index of the state image (an image such as a selected or cleared
check box that indicates the state of the ite1n) that is displayed for the ite1n.
SubItems Tlus property is a collection conta.imng all subitems of the ite1n.
Compatible Views: Details, Tile

Adding.Items to the ListView:

You can access the Ite1ns Collection Editor via the Designer:

Ed
Opens the Items collection td1tot
Ed Gr
Otta1ls

Doc , "'"'"" conta:ner

Or via the Property Pane: HideSelection True


Hol Tradciig False
HoverSeleclion False
lmeMode NoCortrol

LabelEdil
labe!Wrap
(Collection)
False
True
ca
The ListVie\vlte1n Collection Editor allows you to add I remove Item as well set their properties:
PowerShell Studio - Form Controls I 247

- .......... .,..... ...... !

2:
$ II

- ..
,_
..... __
--
i.r... ...,.. '
o -
* a

~
,_
~t-if

=
~,.... ~

a w
c....

... .. ...
-~

~
z -
......

.
1
,_
.
I

Via the Script Editor:

[ListViewltem] Add ([ListVielvltem] value)


Adds an existing ListViewitem to the collection.

Public Method
[ListVie,vltem] Add ([String] text)
Creates an ite1n with the specified text and adds it to the collection.

[ListVie\vltem] Add ([String] text, [Int] imagelndex)


Creates an ite1n with the specified text and image and adds it to the collection.

[ListViewltem] Add ([String] text, [String] imageKey)


Creates an ite1n with the specified text and image and adds it to the collection.

[ListVie,vltem] Add ([String] key, [String] text, [Int] imagelndex)


Creates an ite1n with the specified key, teA1, and image and adds an item to the collection.

[ListViewltem] Add ([String] key, [String] text, [String] imageKey)


Creates an ite1n \Vith the specified key, text, and image and adds an item to the collection.

Example Use:

1 $1istitem =$1istviewl .Items.Add( ' Primal Forms' , 2)


Adding Subltems:

In the cases where you \vish to add Sublte1ns to the ListVie"v you can add them using:

Via the ListView Ite1n Collection Editor:


248 I PowerShell Studio - A Comprehensive Guide

lmagelndex ~ 2
By clicking on tl1e Sublte1ns property in the
ListViewlte111 Collection Editor, you will be
lmageKey D (none)
StatelrnagelndexD 0 -- presented with a ListViewSubitem Collection Editor.
B Data
(Co ec:tion) The only important property you need to set for a
Tag
ListViewSubltemis the Text property.
B Display
L lndentCount _ 0 Via the Script Editor:

The Sublte1ns property has the following tnethods to


add ListViewSubltems:

[ListViewSublte1n] Add ([ListVievvSubltem] item)


Adds an existing ListViewltem.ListViewSubltem to the ......
-
collection.
CI "' ._
. '

[ListViewSublte1n] Add ([String] text) ,.., /:!J ...


Mtc $oor'9 s.f
l't
w. ,.,
Adds a subite1n to tl1e collection with specified text.
.
Fa
~
C

[ListVie,:vSublte1n] Add ([String] text, [Color] foreColor, [Color]


backColor, [Font] font)
Adds a subite1n to the collection vvith specified teA1, foreground
color, background color, and font settings.

Example Use:

1 $subltem =$1istitem.Subltems.Add('lnstalled')

6.2.2 Important Methods

Clear
This method removes all items and columns from the ListView.

1 $1istviewl .Clear()

Begin U1>date
This 1nethod prevents the control from drawing until the EndUpdate 1nethod is called. Use this 1nethod vvhen you
are updating or adding a large number of ite111s.

1 $1istviewl .Begin Update()

EndUpdate
This method resumes drawing of the list view control after drawing is suspended by the BeginUpdate method.

1 $1istviewl .EndUpdate()
PowerShell Studio - Form Controls I 249

Exa1nple use of the BeginUpdate and EndUpdate:

l $1istviewl .BeginUpdate()
2 $1istviewl .Items.Clear();
3 foreach ($itemin$array)
4 {
5 [void]$1istviewl .Items.Add ($item.Text)
6 }
7 $1istviewl .EndUpdate();

6.2.3 Important Events

AfterLabelEdit
This event occurs when the label for an ite1n has been edited by the user. Label editing must be enabled for this
event to be called (See L abelEdit property).

AfterLabelEdit event uses the following argument, which is accessible via the $_ variable:

(System.Windows.Forms.LabelEditEventHandler]

t
CancelEdit Gets or sets a value indicating whether the edit has been canceled.
Label Gets the ne\v text assigned to the label of the ListViewlte1n.
Item Gets the zero-based index of the ListVievvItem containing the label to edit.

Use this event to react to name changes. For example, if the represents a file, you can use this event as a trigger fo r
renaming the file. You should also perform any validation and reject the na1ne change if there is a failure.

l $1istviewl _AfterlabelEdit=[System.Windows.Forms.LabelEditEventHandler]{
2 #Event Argument:$_ = [System.Windows.Forms.LabelEditEventArgs]
3 if(-not (Validate-File Name$_.Label))
4 {
5 $_.CancelEdit =$true
6 }
7 e lse
8 {
9 #Rename the file
l0 }
ll }

BeforeLabelEdit
This event occurs vvhen the user starts editing the label of an ite1n.

This event uses the [System.Windovvs.Forms.LabelEditEventHandler] argument. See AfterLabelEdit for more
information about this argument.
250 I PowerShell Studio - A Comprehensive Guide

Use this event to prevent users fro1n rerunning specific ite1ns.

1 $1istviewl _BeforelabelEdit=[System.Windows.Forms.LabelEditEventHandler]{
2 #Event Argument: $_ = [System.Windows.Forms.LabelEditEventArgs]
3 if (-not$1istviewl .ltems[$_.ltem].Checked)
4 {
5 $_.CancelEdit =$true
6 }
7 }

ColumnClicli
This event occurs when the user clicks a colmnn header within the list view control. Typically you \Vill use this
event to sort the list by the selected colm1m.

ColmnnClick event uses the follo,ving argu1nent, which is accessible via the $_ variable:

[System.Windows.Forms.ColumnClickEventArgs]

1 $1istviewl _ColumnClick=[System.Windows.Forms.ColumnClickEventHandler] {
2 #Event Argument:$_= (System.Windows.Forms.ColumnClickEventArgs]
3 Write-Host ("Column '{O}' was c lic ked" -f $this.Columns[$_.Column].Text)
4 }

Item Activate

This event occurs when an item is activated. One or more ite1ns can be activated by the user, depending on the
Activate property.

Activating an item is not the same as selecting an item. For exaniple, you may want to display a webpage
when the user activates an item in the ListView. Use the Selectedltenis or Selectedlndices property to
referenced the activated iteni.

1 $1istviewl _ltemA ctivate={


2 Write-Host "Activate Item" $1istviewl .Selectedltems[O].Text
3 }

Item Checked
This event occurs when the checked property of a ListVievv ite1n changes.

ltemChecked event uses the followil1g argument, winch is accessible via the $_ variable :

[System.Windows.Forms.Item ChecliedEventArgs]

1 $1istviewl _ltemChecked=[System.Windows.Forms.ltemCheckedEventHandler]{
2 #Event Argument:$_= (System.Windows.Forms.ltemCheckedEventArgs]
3 if ($_.Item.Checked)
4 {
PowerShell Studio - Form Controls I 251
5 Write-Host "Checked Item: $($_.Item.Text)"
6 }
7 e lse
8 {
9 Write-Host"Unchecked Item: $($_.Item.Text)"
10 }}

SelectedlndexChan ged

This event occurs when the Selectedlndex collection changes. Use the event when you \ant to react to a change in
the selection.

1 $1istviewl_SelectedlndexChanged={
2 Write-Host "Selection Changed"
3 }

ltemSelectionChanged
This event occurs when the selection state of an item changes. Use this event instead of the SelectedlndexChanged
when you want to kno,;y the which item was selected or unselected.

ItemSelectionChanged event uses the follo,ving argument, "vhich is accessible via the $_ variable:

[System.Windows.Forms.ListViewltemSelectionChangedEventArgs]

1 $1istview l _ltemSelectionCh an ged =[System.Windows. Forms.ListViewltemSelec tio nC hanged EventH


andler]{
2 #Event Argument:$_ = [System.Windows.Forms.ListViewltemSelectionChangedEventArgs]
3 if ($_.lsSelected)
4 {
5 Write-Host"Selected: $ ($_.ltem.T ext)"
6 }
7 e lse
8 {
9 Write-Host"UnSelected: $ ($_. ltem.Text)"
l0 }
11 }
252 I PowerShell Studio - A Comprehensive Guide

6.3 MASKEDTEXTBOX CONTROL


64
The MaskedTextbox is an enhanced text box control that supports a declarative syntax for accepting or
0-... rejecting user input. Use the MaskedTextBox to distinguish between proper and improper user input. By
using a mask, you can specify the fonnat of the input without custom validation.

6.3.1 Important Properties

Mask
This property sets the string governing the input for this control.

Why use the Mask property?


Use the Mask property to limit the textbox' s input to a specific format. You can define your O\Vn custo1n 1nask or
preferably select from a predefined set using the desig11er. The designer has a useful set of predefined masks such
as date time formats, phone numbers, and zip codes.

Input Mask ? X]
Select a predef1ned mask description from the list below or select Custom to define a custom mask. You can access the predesigned masks either via the
Mask DeSCliption Data Format Validating Type Property pane, or by clicking the sn1all triangle in the
Numeric (5-digi!s) 12345 lnl32 upper right comer of the MaskedTextBox control.
Phone number (574} SSS-0123 6ione)
Phone number no area code SSS-0123 6ione)
Short date 12111/2003 OateTme
Short date and~ (US) 12/11/2003 11:20 DateTime
Social secuity nunber 000-00-1234 6ione)
Time (fu'opean/Military) 23:20 OateTme
Tune (US) 11:20 DateTime
Ql)Code 98052..()399 6ione)
<Custom> 6ione>
Mask: 0 Use ValidatingType

Preview:

If you need to create your O\Vn format, please refer to the follo\.ving table:

0 Digit, required. This element will accept any single digit between 0 and 9.
9 Digit or space, optional.
# Digit or space, optional. If this position is blank in the mask, it will be rendered as a space in
the Text property. Plus (+) and minus (-)signs are allowed.
L Letter, required. Restricts input to the ASCII letters a-z and A-Z. This mask element is
equivalent to [a-zA-Z] in regular expressions.
? Letter, optional. Restricts input to the ASCII letters a-z and A-Z. This mask element is
equivalent to [a-zA-Z]? in regular expressions.
& Character, required. If the AsciiOnly property is set to true, this element behaves like the "L"
element.

64 https://www.sapien .com/blog/2011 /09 /27/primalforms-201 1-spotlight-on-the-maskedtextbox-control/


PowerShell Studio - Form Controls I 253

c Character, optional. Any non-control character. If the AsciiOnly property is set to true, this
element behaves like the"?" element.
A Alphanumeric, required. If the AsciiOnly property is set to true, the only characters it will
accept are the ASCII letters a-z and A-Z. This mask element behaves like the "a" element.
a Alphanumeric, optional. If the AsciiOnly property is set to true, the only characters it will
accept are the ASCII letters a-z and A-Z. This mask element behaves like the "A" element.
Decimal placeh~older. Th e actual display character used will be the decimal symbol
appropriate to the culture.
) Thousands placeholder. The actual display character used will be the thousands placeholder
appropriate to the culture.
Time separator. The actual display character used will be the time symbol appropriate to the
culture.
I Date separator. The actual display character used will be the date symbol appropriate to
culture.
$ Currency symbol. The actual character displayed will be th e currency symbol appropriate to
the culture.
< Shift down. Converts all char acters that follow to lowercase.
> Shift up. Converts all characters that follow to uppercase.
Disable a previous shift up or shift down.
\ Escape. Escapes a mask character , turning it into a literal. "\\" is the escape sequence for a
backslash.
All other Literals. All non-mask elements will appear as themselves within MaskedTextBox. Literals
characters always occupy a static position in the mask at run time, and cannot be moved or deleted by
the user.

An example mask for a US phone nu1nber is as follows:

(999) 000-0000

In this inask the first three digits are optional and the last seven are required. The parentheses are considered
Literals, which means the user ca1mot altered the1n.

BeeDOnError
This property indicates ' vhether the iuasked text box control raises the syste1n beep for each user key stroke that it
rejects. Values (Default: $False)

Culture
Tllis property sets the culll1re infom1ation associated with tl1e 1nasked text box.

Set this property if you are specifically targeting a culture that is not the current default (English (United States)
for US 1nachines). This effects the fonnat of the date tin1e entries and these changed will be reflected when
selecting predefined 111asks as n1entioned above.
254 I PowerShell St udio - A Comprehensive Guide

MaskComuleted
This property indicates whether all required inputs have been entered into the input mask.

The MaskC01npleted property can be useful \hen it comes to validating the data. See the MaskFull property for
an example.

MaskFull
This property indicates \.vhether all required and optional inputs have been entered into the input 1nask.

This property is si1nilar to MaskC01npleted property \.Vith the exception that it also enco1npasses optional inputs
specified in the Mask property. To compare these properties and to de1nonstrate their usefulness when it co1nes to
validating, \Ve \ill look at validating a phone number. The predefined Mask for a US phone nmnber specifies that
the area code (first three digits) is optional and the re1naining seven digits are 111andatory .

The following examples will help de1nonstrate the difference between the two properties:

Partially co1npleted phone nu1nber:

Phone: (555)555-_
I
MaskCompleted False
MaskFull False

Phone Number without an area code:

Phone: ( ) 555-5555
I
MaskCompleted True
MaskFu II False

Co1npleted Phone Number:

Phone: (555) 555-5555


I
MaskCompleted True
Masl{Full True

Text
The prope1ty gets or sets the text as it is currently displayed to the user.
PowerShell Studio - Form Controls I 255

The value rett1n1ed may include formatting characters specified in the Mask property. See the TextMaskFormat
property for more infon11ation.

TextMaskFormat
Tllis property detenrunes whether the string returned by the Text property includes literals and/or prornpt
characters.

Use the TextMaskFonnat if you need to 1nodify the fonnat of the string that is returned by the Text property of the
MaskedTextBox control.

Values (Default: IncludeLiterals):

The example values displayed are based on he following MaskTe>..1Box:

Pho:ne: ( ) 555-5555
I
JncludePrompt
Return text input by the user as well as any instances of the pro1npt character.
Text: " 5555555"
lncludeLiterals
Return text input by the user as well as any literal characters defined in the rnask.
Text: "( ) 555-5555"
lncludeProniptAndLiterals
Return text input by the user as well as a11y literal characters defined in the mask and any instances of the
pro1npt character.
Text: "(_) 555-5555"
1:!,xcludePromptAndLiterals
Return only text input by the user.
Text: " 5555555"

ValidatingType
Thls property contains the data type used to verify the data input by the user.

You need not set tllis property nonnally, since the preset Masks already set this property appropriately . Tllis ensures
data types are \Vithin the correct range. For example, "77/77/7777" is a valid format for a date, but the value is not.

You must set the ValidatingType property to a type, wllich in PowerShell is defined by the full class name
surrounded by brackets. For exan1ple, to set the ValidatingType to a DateTitne you will need to do tl1e following:

l $maskedtextboxBirthDate.ValidatingType =[System .DateTime]

6.3.3 Important Methods


ValidateText
Tllis method converts the user input string to an instance of the validating type.
256 I PowerShell Studio - A Comprehensive Guide

Use this method to determine if the content of the MaskTextBox is valid. This 1nethod requires that a co1npatible
type be set in the ValdiatingType property. If the ValidateText fails it "vill return a $null value otherwise it will
ren1n1 an object of the corresponding type.

Example:

1 if($maskedtextboxBirth Date.ValidatingType -ne $null)


2 {
3 if($maskedtextboxBirthDate.ValidateText() -eq $null)
4 {
5 #Validation Failed
6 }
7 else
8 {
9 #Validation Successful } }

A
The A1askTextBox will automatically validate the text 1~1hen it loses focus.

6.3.3 Important Events

MasklnputRejected
This event occurs when the user's input or assigned character does not match the corresponding fonnat element of
the input mask.

Use this event when you want to react to invalid input:

1 $maskedtextboxPhone_MasklnputRejected=[System.Windows.Forms.MasklnputRejectedEventHa
ndler]{
2 #Event Argument:$_ = (System.Windows.Forms.MasklnputRejectedEventArgs]
3 $1abe1Error.Text ="Failed input -Postion ({O}): {l }" -f $_.Position, $_.RejectionHint.ToString()
4 }

The event passes a para1neter variable $_ . Use this variable to access the follo"ving properties:

$ .Position
Returns the position in the 1nask corresponding to the invalid input character.
$_.RejectionHint
Returns an enumerated value [Systein. ComponentModel.MaskedTextResultHint] that describes "vhy the
input character "vas rejected. Please see the MSDN MaskTextResultHist Help page for 1nore infonnation.

TypeValidationCompleted
This event occurs when MaskedTextBox has finished parsit1g the current value using the Validatit1gType property .

Use this event to react to \Vhen a type validation fails or succeeds. This event is also fired \Vhen the ValdiateText
method is called.
PowerShell Studio - Form Controls I 257
1 $maskedtextboxBirthDate_TypeValidationCompleted=[System.Windows.Forms.TypeValidationEv
entHandler]{
2 #Event Argument:$_= [System.Windows.Forms.TypeValidationEventArgs]
3 if($_.lsValidlnput -eq $false)
4 {
5 $_.Cancel= $true# Keep the focus on the control
6 $errorproviderl .SetError($maskedtextboxBirthDate, "Invalid Date Format");
7 }
8 e lse
9 {
1O $errorprovider 1.SetError ($maskedtextboxBirth Date, "");
11 }
12 }

The TypeValdiationCompleted passes a parainetervariable $_.The following are important properties you can
access with this variable:

$ .Cancel
This property indicates whether the event should be canceled. Set it to $true to retain the focus on the
MaskTextBox.
$_.Is Validlnput
This property indicates whether the fonnatted input string was successfully converted to the validating
type.
$ .Retun1Value
This property returns the object that results fro1n tl1e conversion of the fonnatted input string.

6.4 MENUSTRIP CONTROL


The MenuStrip control allo\S you to place a drop-do\.vn style menu on tl1e form, with custom parent a11d child
menu items.

oSJ f-orm The default docking position is at the top as in the


I
D

Type Here example on the left.


258 I PowerShell Studio - A Comprehensive Guide

09 Form ~ El . El_
o ---~--------- L-ffi MenuStrip Tasks
T peHere J
' - - - - - - - - - - - - - - - - - - - - - - - - - - - - Embed in ToolStnpConta1ner
Insert Standard Items

Re.nderMode: ManagerRenderMode v l
Dode [TOP v 1
GripStyle: [ Hidden ~
Edit terns .

There are two options for entering 1nenu items, you ca11 type directly into the text boxes in the control, or you can
click on tl1e small triangle in the upper right con1er of the MenuStrip control to access the MenuStrip Tasks, then
click "Edit Items".

Once you enter menu items as parent ite1ns and


child ite1ns it 'vill look like the exainple on the
..
aO

File I Here I
right.
I Print I Printer
Save PDF
The default event for each 1nenu ite1ns is a Click Exit I _Here I
' '
Event. To add the Click Event si1nply double- I " Here I
click on the appropriate menu item.

For example, if we double-click on the Printer


1nenu item, PowerShell Studio will create a
Click Event for the menu iten1 and add the
following code in the editor:

1 $printerToolStripMen u Item_Click={
2 #TODO: Place custom script here
3 }
PowerShell Studio - Form Controls I 259

6.4.1 Add Icon to Menu Item


rJ] Form - 0 x Many tiines, you might need to add images to your menu ite1ns
Fil~ I for a 1nore professional looking menu. This cai1 be easily
Print accomplished by doing the following:
Sav~

0 Exit

In this example, we have added a red exclan1ation image to


the Exit menu ite1n.

( :Ji[:ic:>;--Gl~~ M
. . .St1nriplosb

- . EmHd ToolStnpCon1t1ner
In.kit Stlfdltd ltitm5
RitndttModr:: ,~
M.-
.,-
gtr-
Rtn-
dm.t
-o-d-. v

l>o<le Top - iv

Follow the steps to open the Items Collection Editor. l


. . '
'
Selod .... ..cl ~ .... _ . IootS<n- !loTod!l>'oMenuhm
Ir:, ,_,1.., - v I .Add : !l!IJ

--
McniM<1; r.,.OnaJon ......,....,
T...lnago- lnago8"o<oTeoG

Sl:e Tiue
1w.. odTo F,.
r..,.
FllM

r...

v Oat
!ll.90own l>ono)
!ll.9Downl- (Colodlon)

liloTootSlnpMor-.a~
T09
v DniW>
a-i-1

I OK I Clncol

Then in the left pane, select the menu ite1n that you want to add the i1nage to. In the right pane select the image
property and click the browser button to select the inlage that you want assigned. You can also edit the ilnage
aligmnent, scaling, and transparency.

Items Collection Edrtor fileToolStnpMenultem.DropDownltems) ? x


Select lem and add to ist below: ToolStripMenuftem exilToolStripMenulem
I~ Menulem vi Add 1 ~- A I
- Li
I -
Backgouidmage D~> "'
~ ToolStripDropDownMenu Backgouidmagel..ayot Tie
::. prirt Tool StripMenu lem
Olecked False
Check Slate Uichecked
f:- saveToolStripMenulem ()splay~ lm~Text
B-,
t--~ x > N:ri Segoe UI. ~
ForeColor CorirolText
> Image l!i2J System.Drawing.Bit
lmageMgn MiddeCenter
, ,I! lmageSca&ng
ImageTransparertColor
Siz.eToR
D
~Tol.eft No
~ Tol.eftAioMirorln False
Shocto.AKeyf)splaySllT
Text Em
TextA&gn MiddeCenter vj
OK I L
Cancel
.1:
260 I PowerShell Studio - A Comprehensive Guide

6.4.2 Adding Standard Menu Items

MenuStrip Tasks If you \Vould like to quickly add many of the standard application
1nenu ite1ns quickly, you can do that by clicking on the "Insert
Embed 1n Too Str:pContainer
Standard Items" link within the MenuStrip Tasks window.
Insert Standard Items -
RenderMode: ManagerRenderMode v I File Edit Tools Help

Dacie: Top v I
lJ New Ctrl+ N
- Open Ctrl+O
GripStyle: Hidden v j
Edit Items... Save Ctrl+S
Save As

This will populate the MenuStrip with standard menu items along with 1nany Print Ctrl+ P
associated standard 1nenu icons. Print Preview

This will not generate any of the necessary code in the editor that is Exit
needed to make the menu itenis functional, you will need to insert the
code yourself

6.5 MONTHCALENDAR CONTROL


The MonthCalendar control is used to provide a user the ability to select a date. The resulting selected date can be
used in many different scenarios to fit fonn processes.

El JI ~ -~ To obtain the user selected date use:


a9 orm =
$1nonthcalendar1.SelectionStart
December 2016 To obtain the ending selected date use:
Sun Mon Tue Wed Thu Fri Sat
27 28 29 30 1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
$monthcalendar1. SelectionEnd
18 19 20 21 22 23 24
25 26 21 28 29 I 30 I 31
1 2 3 4 5 6 7 To obtain the date range selected use:
I Today: 12/30/2016

$monthcalendar l. SelectionRange

There are several coilllnon co1mnands such as the ones above that are handy to know, so we will go over a few of
those here:
PowerShell Studio - Form Contro ls I 261

Circle today 's day on calendar:


$monthcalendar 1.ShowTodayCircle =$true

Li1nit the amount of days that can be selected in a date range (ex. 20 days):
$n1onthcalendarl .MaxSelectionCotmt = 20

For flexibility, the only limits on date display and ret1rrn for your calendar are the ones the Cale11dar control itself
has. This ineans you can select as large a ra11ge of dates as the Calendar control is willing to let you choose (10
years' worth) over any date range between January I, 1752 ai1d Dece1nber 31, 9998.

There has been some confusion over the differences ii1MaxSelectionCou11ta11d SelectionCount. The main difference
is the SelectionC01mt limits the nu1nber of days ill the retlrrned date rai1ge beginning \Vith the first date selected,
however the user vvill still be able to select a larger rru1ge on the calendar in the fonn.

MaxSelectionCount limits the size of the date range selectable on tl1e calendar by the user. This vvould be the
reco1mnended n1ethod when you are restricting date range sizes because it doesn't make sense to restrict the size of
a date range if the user is unaware a restriction is imposed.

Remove the today banner:


$monthcalendarl .Sho,Today = $false

Set day of vveek to begin calendar on (ex. Monday):


$monthcalendar l .FirstDayOfWeek = Sy stem.windows.Fornis.Day .Monday

If you vvant to obtainjust the Month, Day or Year of the selected start date use:

$monthcalendarl . selectionstart.day
$monthcalendarl . sel ect i onstart. month
$monthcalendarl. sel ectionstart.year

When you are getting the start, end or ra11ge of dates, it a11toniatically includes the tune, and since your user
doesn't have the ability to set ti1ne from the calendar control, time will always show a start tin1e of 00:00:00
(12:00:00AM).

Luckily, the Mo nthCalendar control bas a ToString so tl1at we cai1 fonnat the date:
$monthcalendarl . Select i onSt art . ToString( 'MM/ dd/ yyyy') \Vill return a date formatted for example
12/30/2016.

Notice that the Month Jv!M is capitalized, nzm is for niinute, so care_fui with your capitalization here! 65A
coniplete list ofCusto1n Date and Time Forn-zat Strings are available on MS'DN 66For niore resources on
the 1\1!onthCalendar Class, Jv!SD1V is an excellent resource that lists every constru.ctor, niethod, and
event.

65 http s://msdn.microsoft.com/en-us/libra ry/8kb3ddd4.as px


66 https://msdn. microsoft.com/en-us/lib rary/ system.windows.forms.monthcale nd a r.aspx
262 I PowerShell Studio - A Comprehensive Guide

6.6 NOTIFYICON CONTROL

0-... 67
Use the NotifyIcon control, to alert users of special events, such as when a task is co1npleted. Typically,
this control is used for infonnational purposes, but it cai1 also be used as a source for user ii1teraction.

6.6.1 Important Properties

BalloonTi11Text
This property sets the text associated with the balloon ToolTip. Use this property to
This is the balloon text. display a 1nessage in the Balloon Tooltip.

Setting the BalloonTipText in the script editor:

1 $Notifylcon.BalloonTipText = 'This is th e balloon text"

BalloonTipTitle
This property sets the title of the balloon ToolTip.
Balloon Title ~ x The title text is displayed above tl1e balloon text.
This is the balloon text.

BalloonTiplcon
This property sets the icon to associate witl1 the balloon Tooltip. In other words, the icon displayed inside the
tooltip itself.
Note: The BalloonTip Title property must be set in order to view the balloon icon.

Icon: None "\ x Icon: Info "\ x Icon: Error "\ x Icon: Warning "\ x
Balloon Icon Balloon Icon Balloon Icon Balloon Icon

:::/) ~ t;J 4) 2:04 :::/) ~ t) 4> 2:04 Pl

None - No Icon Info Icon Error Icon Warning Icon

Icon
This property sets the icon to display in the syste1n tray.

Importai1t: This property niust be set; otherwise the tool tip balloon will not sho\;v !

The designer vvill allow you to bro,;vse and select an icon to display \hen the tooltip is shown.

67 https://www.sapien .com/blog/20 12/05/08/spotlight-on-the-notifyicon-control/


PowerShell Studio - Form Controls I 263

Click on the bro\vse button in the Property Panel:


.
" Window 5',to
CoierolBox True
Het>&.con
- -13
fel:e
(bin)
. - . .. . .. ~ ...... ...
~
'ldCortoncr f~
I:
Man~Strc> t'ione)
-
-...........
..."-
Or use the inenu in the designer: -
..
.._
;sq

o ..... .... ID Notifylcon Tasks ... , ' ..


~ notifyicon 1 ----1

~ I Choose icon~

Note: If a "phantom" icon re1nains in the system tray after closing the form, then it is recoilllnended set the Visible
property to False in order to clear the icon before closing form.

L Exit

ContextMenuStrip

This property sets the shortcut inenu to show when the user right-clicks the icon.
Set this property to an existing ContextMenuStrip to assign a menu to the syste1n tray icon.

Visible

This property indicates ,;vhether the icon is visible in the notification area of the taskbar.

Values (Default: True): True I False

6.6.2 Important Events

BalloonTipClicked

This event occurs when the balloon tip is clicked. Use this event to react to user clicks in the ToolTip balloon.

1 $notifyicon 1_BalloonTipClicked={
2 Write-Host 'The Balloon Tip was Clicked'}
264 I PowerShell Studio - A Comprehensive Guide

Click Me ~ x
Please click on this balloon!

Clicked & DoubleClicked

These events occur "vhen the syste1n tray icon is clicked. If you need more infor1nation such as "vhich inouse
button was used, then it is reconunended to use the MouseClick events (See belo"v).

MouseClick
This event occurs when a user clicks on the system tray icon.

[System.Windows.Forms.LabelEditEventBandler]

Button Gets \Vhich inouse button was pressed.


Clicks Gets the nu1nber of times the inouse button was pressed and released.
Delta (Not applicable)
Location Gets the location of the mouse during the generating inouse event.
x Gets the x-coordinate of the mouse during the generating 1nouse event.
y Gets the y-coordinate of the mouse during the generating inouse event.

l $notifyicon l_MouseClick=[System.Windows.Forms.MouseEventHandler]{
2 #Event Argument: $_ = [System.Windows.Forms.MouseEventArgs]
3 Write-Host "System Tray Icon Mouse Click: $($_.Button) Clicks: $($_.Clicks)"
4 }

MouseDoubleClick
These events occur when a user double clicks on a system tray icon. This event has the same arguments as the
MouseClick event.

l $notifyicon l_MouseDoubleClick=[System.Windows.Forms.MouseEventHandler]{
2 #Event Argument: $_ = [System.Windows.Forms.MouseEventArgs]
3 Write-Host "System Tray Icon Mouse Double Click: $($_.Button) Clicks: $($_.Clicks)"
4 }

6.6.3 Important Methods

ShowBalloonTip

This 1nethod displays a balloon tip in the taskbar for the specified ti111e period.
PowerShell Studio - Form Controls I 265
The method uses the properties of the Notifylcon to display the balloon tip. Therefore, they must be set
before calling this method.

l $Notifylcon.ShowBalloonTip(O)

This variation, displays a balloon tip with the specified title, text, and icon in the taskbar for the
specified time period. You need not set the Notifylcon 's properties ifyou use this method variation.

l $N otifylcon.ShowBalloonTip($Timeout, $BalloonTipTitle, $BalloonTipText $BalloonTiplcon)

Helper Function:

The following is a helper function that allows you to display the Notify Icon. The help function also assigns the
calling executable ' s icon) if the Notify Icon's Icon property hasn' t been assigned.

l function Show-Notifylcon
2 {
3 <#
4 .SYNOPSIS
5 Displays a Notifylcon's balloon tip message in the taskbar's notification area.
6
7 .DESCRIPTION
8 Displays a Notifylcon's a balloon tip message in the taskbar's notification area.
9
10 .PARAMETER Notifylcon
11 The Notifylcon control that will be displayed.
12
13 .PARAMETER BalloonTipText
14 Sets the text to display in the balloon tip.
15
16 .PARAMETER BalloonTipTitle
17 Sets the Title to display in the balloon tip.

1 .PARAMETER BalloonTiplcon
2 The icon to display in the ballon tip.
3
4 .PARAMETER Timeout
5 The time the ToolTip Balloon will remain visible in milliseconds.
6 Default: 0 - Uses windows default.
7 #>
8 param(
9 [Parameter(Mandatory =$true, Position = 0))
1O [ValidateNotNull()]
11 [System .Windows.Forms.Notifylcon]$Notifylcon,
12 [Parameter (Mandato ry =$true, Position= l )]
13 [ValidateNotNullOrEmpty()]
266 I PowerShell Studio - A Comprehensive Guide

14 [String]$BalloonTipText,
15 [Parameter(Position = 2)]
16 [String]$BalloonTipTitle = ",
17 [Parameter(Position = 3)]
18 [System.Windows.Forms.ToolTiplcon]$BalloonTiplcon ='None',
19 [Parameter(Position = 4)]
20 [int]$Timeout = O
21 )
22
23 if ($Notifylcon.lcon -eq $null)
24 {
25 #Set a Default Icon otherwise the balloon will not show
26 $Notifylcon .lcon =
[System. Drawing. Icon]:: ExtractAssociated Icon ([System. Windows. Forms.Application] :: ExecutableP
ath)
27 }
28
29 $Notifylcon.ShowBalloonTip($Timeout, $BalloonTipTitle, $BalloonTipText, $BalloonTiplcon)
30 }

Exainple Use:

l Show-Notifylcon -Notifylcon $notifyicon l -BalloonTipText $textboxText.Text'


2 -BalloonTipTitle $textboxTitle.Text - BalloonTiplcon $comboboxl .Selectedltem

There is a sa1nple form de1nonstrating the Notify Icon available in SAPIEN's Download section at

(https://\V\V\v.sapien.com/downloads#Sample%20Scripts/Prilna1Fonns%2020 l l/NotifylconSan1ple.zip)

6.7 NUMERICUPDOWN CONTROL


The NumericUpDown control is like the DomainUpDown control, except in this case we are only \vorking with
nu1nerical nu1nbers.

6.7.1 Important Properties v Data


(Da1ta8indings)
DecimalPlaces O
Decimal Places: Increment 1
Maximum 100
[P.00 :l (2) Deci1nal Places Minimum O
Tag

[f IJ (0) Decilnal Places lhousandsSeparator False


PowerShell Studio - Form Controls I 267

Increment:
This detennines the amount to increment or decre1nent on each button click. I.E. if tl1e increment is set to (5) tl1en
each button click \ivould increase by 5, 10, 15, 20, 25, and so on.

Maximum:
This liinits the 1naxiJ.num value that the control can be increased.

Minimum:
This li1nits the 1nini1num value that the control can be decreased.

Thousands Separator:
If set to Tn1e, this \ivill auto1natically insert a "," separator for numerical values over 999. For example, 1000
would read 1,000.

To get the current selected value fro1n the Nu1nericUpDown control use:
$numericupdownl.value

6.7.2 Important Event

.ValueCbanged
For the ValueChanged event to occur, the Value property can be changed in code, by clicking the up or do\ivn button,
or by the user entering a new value that is read by the control. The new value is read when the user hits the ENTER
key or navigates away fro1n the control. If tl1e user enters a new value and then clicks the up or down button, the
ValueChanged event will occur twice.

6.8 OPENFILEDIALOG CONTROL

The OpenFileDialog control operates with the saine principles as the FolderBrowserDialog, except instead of select
a folder location it is used to select a specific file(s). If enabled, the OpenFileDialog can allow multiple files to be
selected.

6.8.1 OpenfileDialog Example

aO Form In tllis exainple, we created a ne\v form with a textbox and a button,
looks fa1niliar doesn't it. We then added tl1e OpenFileDialog control
to the form by drag/drop tl1e control from the toolbox on top of the
fonn.

Silnple enough rigl1t!


268 I PowerShell Studio - A Comprehensive Guide

Now right-click on the button and add the " Click" event. This generate the event and a fevv lines of code:

1 $button l _Click={ }

But that does nothing on its own~ we need to insert so1ne code to inake everything work togetl1er:

1 $button 1_Click={
2 #This is looking for the OpenFileDialog window to close successfully, meaning a valid file was
selected and OPEN was clicked.
3 if ($openfiledialogl .ShowDialog() -eq 'OK')
4 {
5 #this populates th e text box with the selec ted file.
6 $textboxl .Text= $openfiledialogl .FileName
7 }
8 }

If you want the user to be able to select inultiple files:

2) Set the MultiSelect property for the OpenFileDialog control to TRUE.


3) Instead of a TextBox, I suggest using a RichTe:x.1Box.
4) Add a button and create a CLICK event for the button
5) Insert code similar to the exa1nple belovv into the CLICK event. This ti1ne instead of using
$open:filedialog.FileNa1ne you will use $OpenFileDialog.FileNa1nes ( ~notice the son the end).

1 $button 1_Click={
2 if ($openfiledialog 1.ShowDialog() -eq 'OK')
3 {
4 $filenames= $openfiledialog 1.filenames
5 foreach ($file in $filenames) {
6 $textbox 1.AppendText("$file 'n")
7 }}}

The ForEach loop is used to collect each file name that ' vas selected, then each is appended to the RichTextBox,
use a ' n to insert a line retum

a'9 Form 0 x
C:\Users\Jeff\Docunerts\eel-box.pg
C:\Users\Jefl\Docunerts\Oieckist .pd
C:\Useis\Jeff\Docuneris\dc~.pcf
[]

.:i

It should look so1nething like the example above when you are done!
PowerShell Studio - Form Controls I 269

6.9 PANEL CONTROL

The Panel control is like the GroupBox control, in that it is used to provide grouping for other controls. The
difference being that a Panel control can have scroll bars, and GroupBox has a caption at the top. When you move
a Panel control around on a fo11n, all control within the Panel control vvill 1nove \ith it.

In this exa1nple, you can see the Panel Control (dark grey box), \ith three different controls contained within it. If
you don't need the caption at the top, as in a GroupBox, then the Panel is usually the best choice especially when
adding color to the panel.

ag F m However, if the GroupBox background will be the same as the for1n


background, it can be a great way to organize controls and offers a caption
ability.

Notice in the form in the next page, showing before and after BackColor,
the color on a GroupBox tends to bleed over the top of the GroupBox
which doesn' t inake a very professional looking design.

09 Form

My Tile

--- -- - - -- - ---- -- -- - -- -
.

Keep in mind that with the Panel Control or the GroupBox Control, if you disable the control by setting .enable =
$false, then all controls within the Panel or GroupBox will also be disabled. You can use this to yotrr advantage by
disabling or enabling an entire group of controls vvith one com1nand.
270 I PowerShe ll St udio - A Comprehe nsive Guide

7.0 PICTUREBOX CONTROL


6
0-.. 8Represents a Windo,vs picture box control for displaying an i1nage. Use a PictureBox when you need to
- display an image either located on a disk or the internet. Sin1ilar to other controls, you can also imbed an
i1nage in your form \vith the PictureBox.

Image and hnageLocation properties. the difference betvveen tJ1ese two properties determines how you p'lan to load
the in1age.

Image property i1nbeds the ilnage in the form so that it is self-reliant \hen displaying an image, no internet or file
share connection required. The image is converted to a Base64String \Vhich is then imbedded into the form. Which
looks sinlilar to the code belo,v:

l $pictureboxl .Image = [System.Convert] ::FromBase64String('


/9j/4AAQSkZJRgABAQEASABIAAD/7gAOQWRvYm UAZAAAAAAB/+ ESnEV4aWYAAE l NACoAAAAI
AAcBEgADAAAAAQABAAABGgAFAAAAAQAAAGIBGwAFAAAAAQAAAGoBKAADAAAAAQACA
AABMQACAAAA HAAAAH IBM gAAAAAAEAAEFkb2JllFBob3Rvc2hv c CBDUzUgV21uZG93cwAyMDE 1
OjAzOjlylDEzOjM 1OjAwAAACoAIABAAAAAEAAAM goAM ABAAAAAEAAALOAAAAAAAAAAYBAw
ADAAAAAQAGAAABGgAFAAAAAQAAARABGwCAgAEAAAAAQAAEXMAAAAAAAAASAAAAAE
AAABIAAAAAf/Y / +OADEFkb2J IXONNAAH/7gAOQWRvYmUAZIAAAAAB/9sAhAAM CAglCQgM CQk
M EQsKCxEVDwwM DxUYExM VExM YEQwM DAwM DBEM DAwM DAwM DAwMDAwM DAwMDAwM DA
w MDAwM DAwM AQOLCVv()ODRAODhAUDg40FBQODg40FBEM DAwM DBERDAwM DAwM EQwM D
AwMDAwM DAwM DAwMDAwMDAwM DAwMDAwM DAz/wAA RCACXA KA DAS IA==')

lmagelocation property is used to load an image asynchronously from eiU1er a \Vebsite or disk location. I.his is used
mainly to either decrease the overall file size of the fonn or if you \vant the ability to edit an image at a later tilne
that w ill display next time the fom1 is Joaded.

lnitiallmage. tllis refers to the image that you \Vant to display \Vhile the main image is loading, used if you
are using lmageLocation and it might take a fe,v seconds for the main iJnage to do\vnload.

Errorlmage. is the image that you 'vant to display if an error occurs during the image-loading process, or if
tl1e i1nage load is cancelled. Works 'vith In1ageLocation property.

SizeModc, this propert)1 controls how the PictureBox \Vill handle the image placeme11t and sizing. Tl1ere are five
different settings.

1. Normal! The image is placed in the upper-left comer of the PictureBox. The image is clipped if it is larger
than the PictureBox it is contained in.
2. Stretchlmage: The image \Vithin the PictureBox is stretched or shn1nk to fit the size of the PictureBox.
3. AutoSize: The PiclmeBox is sized equal to Ule size of the linage that il contains.
~. Centerlmage: The image is displayed in the center if the PictureBox is larger than the i1nage. If the image
is larger than the PictureBox, U1e picture is placed in the center of the PictureBox and lhe outside edges are
clipped.

68 http s://www.sapien.c om/blog/20 1l /08/05/primalforms-201 1-spotlight-on-the-picturebox-control/


PowerShell Studio - Form Controls I 271

5. Zoom: The size of the image is increased or decreased maintaining the size ratio .

The PictureBox support file types *.gif, *.jpg, *.jpeg, *.bmp, *.w1nf, *.png, tl1ere is a .NE'T source available to
allo"v mai1y other file types, it is called 69DevIL.

70
High0nCoding has an excellent article on using this type of i1nage inse1tion from a database. The article
demonstrates how to fetch data from tl1e database using PowerShell, and how to display ilnages in the windows
form using data from the database.

7.1 PROGRESSBAR AND PROGRESSBAROVERLA Y


71
The ProgressBar represents a Windows progress bar, ProgressBarOverlay also has tl1e added ability to
0-.. display percentage co1npleted or ai1y specified text within tl1e ProgressBarOverlay. Use a ProgressBar
- when you need to show the user that progress is being made in so1ne operation, such as copying files.

ProgressBar

ProgressBarOverlay (o/o)

Directories ... ProgressBarOverlay (text)

7.1.1 Important Properties

Maximum: The Maximu111 is the upper bound of the ra.nge this ProgressBar is working with.

Why use the Maxinium property?


Use the Maxi1num property when you have a known limit for your ProgressBar. When the Value property is equal
to tl1e value of the Maxiinu1n property, the progress bar is co1npletely filled.

Exa1nple of setting the Maximum property in the Script Editor:


$progressbarl .Maximum= $files.Count

Values (Default: I 00):

69 http://openil.sourceforge.net/
70 http://highoncoding.com/ Articles/235_Accessing_Database_And_Displaying_lmages_Using_Windows_P

owerShell.aspx
71 https://www.sapien.com/blog/20 l l /07 /l 4/primalforms-20 l l -spotlight-on-the-progressbar-control/
272 I PowerShell St udio - A Comprehensive Guide

Minimum: The Minimu1n is the lower bound of the range this ProgressBar is working \Vith. When the Value
property is equal to the value of the Minimum property , the ProgressBar will be empty .

Values (Default 0)

Step : The Step is the ainount to increment the current value of the ProgressBar by when the PerfonnStepQ method
is called.

Why use the Step property?


Use the Step property to specify the amount that each co1npleted task in an operation changes the value of the
progress bar. The Step property default value is 10, so you inay want to set the step to 1 'vhen necessary.

Values (Default: 10)

Value: The current value of the ProgressBar, in the range specified by the Minimu1n and Maximrun properties.

Why use the Value property?


Use the Value property if you \Vant to set the progress at a specific point or to obtain the current position of the
ProgressBar .

Values (Default: 0)

7.1.2 Important Methods

Increment: This inethod advances the current position of the ProgressBar by the specified a1nount.

Why use the Increment method?


Use the Incre1nent method \Vhen you need to increment the value of the ProgressBar by varying a1nounts. This
method of incrementing the ProgressBar is silnilar to using the Step property with the PerformStep method.
Setting the Step property is not necessary \Vhen using the Increment method.

Exa1nple of using Incre1nent 1nethod in the script editor:

1 $p rogressbarl .lncrement(l)

PerformStep: This 1nethod advances the current value of the ProgressBar by the amount of the Step property .

Why use the PerforniStep method?


Use the PerformStep inethod when repeatedly incrementing the ProgressBar by the same amount (i.e., the value
set in the Step property).

Here is a sample script block triggered by a button, that displays its progress as it creates a backup of all t11e text
files located in a folder specified by the user:

1 $b uttonBa c kup f iles_C lic k={


2 #Back up Text files from a selected directory
PowerShell Studio - Form Controls I 273
3 if($fo lderbrowserdialogl .ShowDialog() -eq 'OK')
4 {
5 $selectedPath = $folderbrowserdialogl .Selected Path
6
7 #Get all the text files in the folder
8 $files= Get-Childltem $selectedPath -Filter *.txt
9
10 if ($files -eq $null -or $files.Count -eq 0)
11 { #No files to backup
12 return
13 }
14 #Initialize the Progress Bar
15 $progressbarl .Maximum= $files.Count
16 $progressbarl .Step= 1
17 $progressbarl .Value= 0
18
19 #Create the Backup Folder
20 $destination = ('{O}\ \Backup' -f $selectedPath)
21 [System.IO.Directory]::CreateDirectory($destination)
22
23 #Copy the files and update the progress bar
24 foreach ($file in $files){
25 Copy-Item ('{0}\\{l }' -f $selected Path, $file) -Destination $destination
26 $progressbarl .PerformStep()
27 } }}

7.2 PROPERTYGRID CONTROL


~ Form o x The PropertyGrid control \as designed to edit the
properties collection of another control.
:: ~ ! I.J
> Fla!Appearance
FlatStyle Standard
button1 J In the form on the right, we have a PropertyGrid
> Font Microsoft Sans Seri. 8.25pt -
ForeColor CortrolTexl
control with the " SelectedObject" set to our button
Image
lmageA!ign
D ~>
r.NdcleCerter
- "Buttonl" . This provides tl1e ability to edit Buttonl
Image Index D ~> witltin the form itself.
lmageKey D ~>
lmagelist tione>
Righ!Toleft No
Text bulton1
This is a great way to add customization capability to
- . --
any fonn without having to rebuild the fonn offline

l
and reload the form. Now, tl1at said tllis beco1nes
some\.vhat unfeasible if you are trying to change many
different controls because you \.Vould need a
' - - - - - - - - - - - - - - - - - - - - - - = " Property Grid for each control you \.Vanted to edit.

You can use the ReadOnly attribute to keep specific control properties fron1 being editable. The Browseable attribute
detennines whether a control's property is show n in the grid or hidden.
274 I PowerShell Studio - A Comprehensive Guide

DescriptionAttribute. Sets the text for the property that is displayed in the description help pane belo\v
the properties. This is a useful "vay to provide help text for the active property (the property that l1as focus).
Apply this attribute to the MaxRepeatRate property.

CategoryAttribute. Sets the category that the property is u11der in the grid. Tltis is useful when you want
a property grouped by a category naine. If a property does 11ot have a category specified, then it will be
assigned to the Misc category. Apply this attribute to all properties.

BrowsableAttribute - Indicates whether the property is sho\vn in the grid. This is useful \>vhen you \Vant
to hide a property from the grid. By default, a public property is always shown in the grid. Apply this
attribute to the SettingsChanged property.

ReadOnlyAttribute - Indicates \hether the property is read-only. This is useful vvl1en you wai1t to keep
a property from being editable in the grid. By default, a public property vvith get and set accessor functions
is editable in the grid. Apply tltis attiibute to the App Version property.

DefaultValueAttribute - Identifies the property's default value. This is useful when you want to provide
a default value for a property and later detennine if the property's value is different than the default. Apply
this attribute to all properties.

DefaultPropertyAttribute - Identifies the default property for tl1e class. The default property for a class
gets the focus first "vhen the class is selected in the grid. Apply this att1ibute to the AppSettings class.

No':v I know \>vhat you are thinking, why not just add a second Property Grid(2) control with its " SelectionObject"
set to the first PropertyGrid(l) control so that you could change the "Selection.Obj ect" of the PropertyGrid(l) tl1en
you could easily switch to other controls? Wouldn't that be nice! Unfo1tunately, it doesn' t work that \!Vay , in fact
you can control every other property except the "SelectionObject" property. As you can see i11 the exa1nple belo,v,
the only selection available in the " SelectionObject" is (none).

ii9 Form 0 x
PropertyGrid(l) PropertyGrid(2)

~=; ~ l I_j bultonl J ~1 :~ 1l I..:J


.--~-------------.
> Font 1"crosoft Sans Senf. 8.~ "' Con!extMenuS!rip tionel
FOl'eColor CortrclTell! Enabled True
Image D ~) lmeMode NoCorirol
lmage.AJign Mddeeerter Se!ected0b1ect
tmagetndex. D Vionel Tablndex. !tione> j
tmageKev D t>onel TabStop ...,,nrm:ue,-------~

lmagelsst ~) UseCompatibleTextRendeon True


RightToleft No Visible True
Tex:t bt.Cton1 v Data
~ec__ - "
..--
l:l!JAfjan_ Oa.ta6iDdinsl.s L

J
"

1~---0-~
Selec~
Sets the currently selected object that the grid v.i ll brO'...'Se.
PowerShell Studio - Form Controls I 275

7.3 RADIOBUTTON CONTROL


72
The RadioButton control is used when you want to present multiple choices to a user but only allow one
0- selection. RadioButtons work in co1tjunction \Vith other RadioButtons located within the same container,
- that can be a form, a groupbox or a pai1el.

o'} RadioButton 0 x Example #1

In this exainple, there are t\vo groupbox's \Vith three


groupboxl groupbox2 radiobutton's in each groupbox. The radiobuttons in eacl1
@Option A Q OptionA
groupbox are independent of each other. The user can only
choose either Option A, B, or C in each groupbox.
Q Option B @Option B

Q OptionC Q OptionC

.::

Example #2 ? Rad108utton 0 x

There is one Panel control on the left with three radiobuttons, one
GroupBox control on the right with three radiobuttons, and three
@OptimA Q OptionA
additional radiobuttons on the fon11 itself.
Q OptionB @OptionB

The radiobuttons in the Panel control, in the GroupBox control, and Q OptionC Q OptionC

on the Form, all work independently of each other. This allows you
to group RadioButtons together in three different ways. Q OptionA

Q OplionB
In this scenario, the user can make one selection from three different @OplionC

areas, for a total of three selections.

7.3.1 Important Properties

Checl{ed: This indicates whether the RadioButton is checked or not. Use the Checked property to determine the
state of a specific radio button or -vvhen you want to check or uncheck a radio button. When you set this property to
True, the previously checked radio button in the group \Vill be unchecked.

$radiobuttonl.checked =$true

7.3.2 Important Events

CheckChanged: Occurs whenever the Checked property changes value. Use the CheckChanged property \iv hen you
wish to respond to the user checking a radio button. Tllis event also fires when the previously checked radio button
is unchecked due to the user checking a different radio button.

72
https://www.sapien.com/blog/20 l l /07 /08/primalforms-20 l l -spotlight-on-the-radiobutton-control/
276 I PowerShell Studio - A Comprehensive Guide

'J Rad10Button 0 x 111 this exainple, we demonstrate how to use the checked property of a
RadioButton by checking the state of each RadioButton when the mouse moves
over the Panel control, if option Panel A, B, or C is selected \e set the text for
the Label control below.

0 Panel A
l $panell _MouseMove=[System.Windows.Forms.MouseEventHandler]{
0 Panel B 2 If ($radiobuttonPanelA.Checked -eq $true)
3 { $1abell .Text= "Panel A is selected"}
@PaneJC 4 elseif ($radiobuttonPanelB.Checked -eq $true)
5 { $1abell .Text= "Panel Bis selected"}
6 elseif ($radiobuttonPanelC.Checked -eq $true)
Panel C is selected 7 {$label l .Text = "Panel C is selected"}
8}

7.4 RICHTEXTBOX CONTROL


The Ricl1TextBox provides a multi-line text display, which allows you to format different pa11s of text differently,
and include itnages, tables, or other rich content. Unlike the standard Textbox "vhich only allo\ one font, forecolor
at1d fonnatting for all text. The equivilant co1nparison would be between Notepad (TextBox) and Wordpad
(RichTextBox). Another point to re1nember is that R.ichTextBox does not support DataBinding, however the
standard Textbox does.

Ahnost everyone will tell you that formatting for RichTex.1box is at best very drrficult, \vhich is why most of the
industry tends to output to either Out-GridView or if more flexibility is needed then html reports are usually used
instead. There is a Web Vie"v control, however unfortunately it is one of the fe"v controls that are not offered in the
default toolbox.

The nicest thing about a RichTextbox is that a nicely fonnatted RTF docun1ent can be loaded into the RichTex.1Box
\lvitl1ol1t losing any of the formatting.

l $richtextbox l .LoadFile('c:\Users\Jeff\Desktop\ARMS\EULA.rtf')

19 MyFc>1m X

This is an exa1nple of a .RTF file loaded into a RichTex.1Box.


IMPORTANT: Please read the terms and conditions of product application set "
out below carefully prior to download, Installation, copy or use. THROUGH
DOWNLOADING, INSTAWNG, COPYING OR USING lliE SOFTWARE YOU ARE
EXPRESSING YOUR CONSENT TO THESE TERM SANO CONOm ONS.

oftware End-User License Agreement.

Under the terms e>f this Software End User License Agreement (lierelnafter
referred t<> as "the Agreement") executed by and between Jeffery Holder
(hereinafter referred to as '"Jeffery Holder" or "the Pre>vlder") and you, a
physical perron or legal entity (hereinafter referred t<> as "You" or "the End
User"), You are entitled to use the Software defined In Artlcle 1 of this
Agreement. The S<>ftware defined in Artlde 1 of this Agreement can be stored
on a data carrier, sent via electronic mail, downle>aded from the Internet.
downloaded from the Provider's servers or obtained from o ther sources,
subj ect to the terms and conditions specified below.

THIS IS AN AGREEMENT ON ENO.USER RIGHTS ANO NOT AN AGREEMENT FOR


SAlE. The Provider continues to own the COPV of the software and the Phvsical "
PowerShell Studio - Form Controls I 277

Auto Scrolling
If you have a RichTextBox and you ,;vould like for it to auto1natically scroll to the last entry as text is displayed, this
example will do it for you:

1 $richtextbox 1_T extChanged={


$richtextboxl .SelectionStart = $richtextboxl .Textlength;
$richtextbox 1.ScrolIT oCaret()
$richtextboxl .Focus()
}

Start a ne''' line


If you \.Vould like to start a ne"v line when sending text to a RichTextBox use the backtick n (' n)
1 $richtextboxl .text= "Start a new line after this text' n"

Send RichTextBox contents to Wordpad


1 $filename= [System.10.Path]::GetTempFileName()
2 $richtextbox30.SaveFile ($filename}
3 Start-Process wordpad $filename -ErrorAction 'Stop'

Co)}y RichTextBox contents to Windows Cli)}board


1 function Add-ClipBoard ($text}
2 {
3 Add-Type -AssemblyName System.Windows.Forms
4 $tb =New-Object System.Windows.Forms.TextBox
5 $tb.Multiline = $true
6 $tb.Text =$text
7 $tb.SelectAll()
8 $tb.Copy()
9 }
10 Call the function with
11 $text= $richtextbox 1.text
12 Add-Clipboard -text $text

7.5 SAVEFILEDIALOG CONTROL

Many times, the SaveFileDialog control is misunderstood, it only saves a file, it does not create the file to be saved.
You must first output the file to be saved.

For example, let's say you have a report contained in the variable $report and you want to save that to a file, you
\.Vould use the SaveFileDialog FileOK event:

1 $savefiledialog 1_FileOk= [System.ComponentModel.CancelEventHandler]{


2 $report I Out-file $savefiledialog l .FileName}
278 I PowerShell Studio - A Comprehensive Guide

To show the dialog box so that the user can select the directory and filename of the file to be saved you would use:

1 $savefiledialog 1.ShowDialog ()

a MyForm
.,___~~~~~~~~~~~~~~~~~~ !
x In this basic example, we added a TeA1box, a Button, and
the SaveFileDialog control to an empty form. Our goal is
In this bask: example we have a text box where a report is displayed. and a
Save ~on located below that will open the SaveAle dialog so the user can
we vvant to be able to save the teA1 that is displayed in the
selec:t the location and name ol the file to be saved I box to a file .

This is sunpliest method and works in most all instances.


Save

1 $buttonSave_C lick={
2 $report= $textboxl .Text# Put the text into a variable, but we could just use the
$textboxl .text and no variable in this case.
3 $savefiledialog 1.ShowDialog () # Open the Dialog Box
4 }
5
6 $savefiledialog 1_F ileOk=[System.ComponentModel.CancelEventHandler]{
7 $report I Out-File $savefiledialog l .FileName
8 }

7.6 SPLITCONTAINER CONTROL

The SplitContainer creates two pai1els on a fonn which cai1 be presented as either horizontal or vertical. I've seen
in many discussions that the SplitContainer only supports two panels, however you can add more two panels by
sin1ply dragging more SplitContai11er controls to the fonn.

In the example to the left we have added the


-------------------------------------"~'
a;J yForm
-- ---------------...;'':-- -
~
SplitContainer control to an e1npty for1n, you can
I i! ! see it create two panels ~ Panell ai1d Panel2. You
;H
l I.i can easily adjust the Panel percentages by
;.I;:' : placing your inouse pointer on the dividing line
I :
I:
'
!I between the two panels and dragging to resize.
I; Panel1
I:
i: Panerz i
; I'
1
I
,
I.:
'
;:
.:'
!
I: :
I ;':'
i:
.i
i

!I I: i
JL_______________ l
PowerShell Studio - Form Controls I 279

You can also switch between


!~~-------~~-
-~------. - - - --------------------- -
- ----- --
- -- - --- -------- -- ----- -----
- - -----~I SpfrtContainer Tasks horizontal and vertical orientation
Vertical Splitter Orientation
by clicking on the s1nall arrow in
Undock in Parent Container
I the upper right of the control.
II Panel1
'
I
Il________________________________________________________________________________________________________ j!
r------------------------------------------------------------------------------------------1
L- ------ ~-- ----- I

This is an example of dragging


;---------------------------------! r-----------. . . . . . .___. . _. . . . . . . . .-.. . --.. . . . . . . . . _. .___ . ._. .... . .------1 TWO SplitContainer controls to an
i 11 I
; i I I' e1npty form, resulting in three
!' Panel1
'
I !
'
:
o
- - I.:
'1
:

.................................. ~......................... ....................... ..................................................


t :
I

I
i
f
f
;
panels.
:-------------------------------------------1 ii !
'
:'
:
:' I
:
!
t
:
:
: I'
I
i
t
I It f

i !l j
'' 'I
I
;
t I i
t

!' :' !' '


I
: 'I
I ' 'f I 'J
' 1'' '
i
;

,'' "
I

,,
" pane12
'1

i
!i
I 1 I

: t

!
:
Panel2 H
: I !j
'
:
'1
: ;
J
: I t
' ,
I

I
"
I

:
I

'
I
f

!
:
~i
: 1'
!
If
:
:

:I
I

I
:
: I
~J I i
f

:, ;'I: j
': II J I
' I I
i
I

:
I

:I , I I

---------------------------..---- .._----------------- --------------------------..-----


: : J

LJ!.
r-------------------1 ,-----------------------------1
Form

.---------
______r----------
-:_ _~-~I;,l II
1! 11 I
!I I I
I ! l i
' ii I
Pllnet1
!11 Panell
II
1
- II
Il
1 Ii
i
II
1 I :
i I
J
1 1 1

l____J[_________ll_____ _______________
Example A ExampleB
280 I PowerShell Studio - A Comprehensive Guide

In example A, we drag a new SplitContainer onto Panel2 on the left, this results iI1 Panel2 being split into two
panels, exainple B .

- -
.....

7.7 SPLITTER CONTROL

Windows For1ns Splitter controls are used to resize docked controls at nm ti1ne. The St>litter control is often used
on fonns vvith controls that have varying lengths of data to present, like Windows Explorer, whose data panes
contain information of varying widths at different ti1nes.

When the user points the mouse pointer at the m1docked edge of a control that can be resized by a splitter control,
the pointer changes its appearance to indicate that the control can be resized. The splitter control allows the user to
resize the docked control that is i1nmediately before it. Therefore, to enable the user to resize a docked control at
run ti1ne, dock the control to be resized to an edge of a contaiI1er, and then dock a splitter control to the sa1ne side
of that container.

rlJ ~t F 1m

In the example on the left \.Ve have created a text box


(white area) and docked it to the left. The rest of the fonn
is empty (grey area).

We drag and drop the Splitter control onto the TextBox


and inake sure it is docked to the left as \.veil.
PowerShell Studio - Form Controls 281

Now vvhen we run the fonn you vvill notice that if you 1nove your x

1nouse over the splitter bar, you can hold and drag to resize the
TeA1.Box.

This will 'ork vvith any control that you want to give users the
ability to resize the undocked side of a control.

To ensure that the Splitter control does not resize controls docked
to a size that is too small to be useful to the user, you use the
MinEA1ra and MinSize properties. The MinExtra and MinS.ize
properties determine the minimum size that controls docked to
the left ru1d rigl1t (or top and botto111 if a horizo11tal SJJlitter
control) can be sized to. If the otl1er controls on yotrr fonn tl1at the
Splitter control is docked to display a specific style of border, you can use the BorderStyle property to n1atch the
border sty le of the controls that are docked to it.

You inight find it desirable to set a max:immn size limit on controls that the S1>1itter control is docked to. The
SplitterMoved and SplitterM.oving events enable you to detennine vvhen the user is resizing a docked control. You
can use the SplitPosition property in an event handler for the S11litterMoved or S11litterMovin.g events to detennine
the size of the control that the Splitter control is docked to and set the SplitPosition property to a different value to
linrit the docked control's vvidtb to a specified maximum vvidtl1 (or height if a horizontally aligned Splitter control).

7.8 STATUSBAR CONTROL

0- 73
Use the StatusBar control, to display status iufonnation to the user. The StatusBar can also be used for
- user interaction but typically plays an inforn1at:ive roll.

There are two options when using the Statusbar, you can ejtJ1er sho'v only the StatusBar text or you coo show
StatusBar panels tl1at you have added. This is controlled by the "ShowPanels" property.

ShowPanels set to True - displays the panels that you have set.
ShowPanels set to False - displays only the StatusBar teA1.

o;} My Form x The exainple on the left has "ShowPanels" set to


false, \V hich displays only the text property of the
StatusBar control. This is useful if you only need to
display one line of infonnation at a time.

-
This is the Statusbar Text ertered into the text property .::

73 https://www.sapien .com/blog/20 12/07 /05/spotlight-on-the-statusbar-control/


282 I PowerShell Studio - A Comprehensive Guide

if) MyForm x In this exainple, "ShovvPanels" is set to True, and


- - - - - - - - - - - - - - - - - - - - - -, vve have added three panels.

Panels (Collection)

The text of each panel can be controlled by:


$statusbarpanell.Text - "Version
2.2.1"
$statusbarpanel2.Text - "Author: Your
Name"
~~~~~~~~~1 $status barpanel3.Text - "Processing
Version 2.2.1 Pdhor: Your Name Processing tasks... _________.-. . . Tasks ... "

7.9 STATUSSTRIP CONTROL

74
Use the Stat11sStrip control, to display status infonnation to the user. The StatusStrip serves as a
0-... replace1nent to the StatusBar and offers more support for user interaction than tl1e StatusBar by allowing
you to add buttons, progress bars, and other controls. It's like StatusBar on Steriods!

aSJ I Form El NOTE: The progressbar in a


statusstrip does not contain a
refresh prop erty. StatusStrip
also does not support the newer
ProgressBarOver lay.

j I ......
A Statuslabel
(ffiJ ProgressBar
~
- OropOownButton
03 Split Button

74 https://www.sapien .com/blog/20 12/09 /12/spotlight-on-the-statusstrip-control/


PowerShell Studio - Form Controls I 283

7. 9.1 Important Properties

AllowltemReorder -This property allows the items in the StatusStrip to be reordered when the ALT key is
pressed.

SizingGrip - This property indicates whether a sizing handle (grip) is displayed in the lower-right corner of the
control. This property is mainly cos1netic and should be set to False \<vl1en using fixed sized forms, such as \vhen
the fonn's FonnBorderStyle property is set to FixedDialog.

Sho,vltemToolTips -This property indicates whether ToolTips are shown for the StatusStrip. Set this property to
True \<vhen you want to provide help information for items in the StatusStrip.

Layout Style - Tllis property indicates hovv the StatusStrip lays out the items collection.

Values (Default: Table):

StackWithOverflow
Specifies that items are laid out automatically.
H orizontalStackWithOverflow
Specifies that items are laid out horizontally and overflow as necessary.
VerticalStackrVithOverflow
Specifies that items are laid out vertically, are centered within the control, and overflo\v as necessary.
rtOl1l
Specifies that items flo"v horizontally or vertically as necessary.
Table
Specifies that items are laid out flush left.

Ijyou want to ensure all the items on the status bar are visible even when the form is resized then you
can use the Flow layout style.

Docl< - This property indicates \vhich StatusStrip borders are docked to its parent control and detennines ho"v a
StatusStrip is resized vvith its parent.

Values (Default: Bottom):

None
The control is not docked. The StatusStrip becomes a free floating control that cannot be moved by the
user.
Top
The control's top edge is docked to the top of its contailling control.
Bottom
The control's bottom edge is docked to the bottom of its containmg control.
Left
The control's left edge is docked to the left edge of its containing control.
Right
The control's right edge is docked to the right edge of its containing control.
Fill
All the control's edges are docked to the all edges of its containing control and sized appropriately.
284 I PowerShell Studio - A Comprehensive Guide

7.9.2 Important Events

Item Clicked

This event occurs when a ToolStripitem is clicked. This event allows you to handle all the click events in one
location, but it is not recormnend using this event if you are have DropDownButtons or SplitButtons. Instead you
should use each ToolStripltem's individual event handlers.

l $statusstrip l _l temClicked= [System.Windows.Forms.T oolStripltemClickedEventHandler] {


2 #Event Argument:$_ = [System.Windows.Forms.ToolStripltemClickedEventArgs]
3
4 Write-Host $_.Clickedltem.Text
5 if ($_.Clicked Item -eq $toolstripstatuslabel l)
6 {
7 Write-Host "You c licked the label" } }

8.0 TABCONTROL CONTROL

0-... 75
Use the TabControl \.vhen you wish to present a series of related controls that are separated into
- individual pages which can be selected by a tab.
Tit Netwock Tools. ~ Syst.., ~once ~ u.t/\khlol Softwore ~ Oelde &!IOl!ll1se Cdlcol..
SCCM Cierl Tools .c', WSUS ~
ReS!we Tools
'f&< Advanced l'w'9 [i;i) OS Re;ioll \. I lk>quoted Paths ii Java Tools g Pdobo Tools .Audm9 Toob "*Moe Tools (!J ~Desk Tooh !
F'4e5hote Poo/yz0<
Use< Tools 0 McNee

TabControl \.Vith 18 tab pages

? x Open the TabPages properties of the TabControl to add new tab


Membo: t~3p<ope<ties: pages. Each tab page is customizable, and you can also add an icon
0 .. *
(~=- ~ 11...J_----~ to each TabPage item.
1 tabpagel
2 tobpage;I
3 tobpage5
v Accessibility
AccessbleDescr
" I
4 tabpage6 AccessbleName
5 tabpage7
6 tabpageS
~Role Defaolt I. Add a11 I1nageList control to your fonn, then populate the
v ~
7 tabpageS
8 tabpage10
8acl<Color D While i1nagelist \Vith the icons you will be using. (See ImageList 5.8)
Bac1<g<ound1m~ D t>onel
9 tabpagell
10 111bpage12
Bacl<g<oundlm~ Tte 2. In the "ImageList" property of th.e TabControl select the
Bonle<Sl}ie None
11 tabpage13
12 tabpage15
eur- Defaul in1agelist you want to use.
> f<ri Mcrosoft Sans s.d. I
13 tobpage16
14 tobpage17 feColor Comdleod 3. In each TabPage "In1ageindex" property select the image that
~Tol.e!t No
15 tobpage18
16 111bpoge19 T..i SCCM Cllenl Tool: you want to appear to the left of the tab page title.
17 tabpage20 UseVisua!Sl}ie81 Fw
UseWlli!Cursor Fabe
v Behavior
[ >'*1 Remove
How~- Falee

OK Caned

75 https://www.sapien.com/blog/20 1l/ l0/28/primalforms-201 l -spo tlight-on-the-tabcontrol/


PowerShell Studio - Form Controls I 285
- 0 x

IUdb-g TOCilt ~ Mic looll ~ ~ lodl


~ D*&I...... ~

Each TabControl Item wlll have an


I
associated Tab Page. This allows you to
bulld multlple pages within the same
form. Tab Page

Bemplf Sptqrt Yl"C)5t.a!lpbon


h llOOI.,. tw! h COlfO.ter JO.I erclll'td nl I.er#! 1111 d ti....,... #1.wn. "'1d'I .,cu een Md .-od ll'l'llCll
1 ~'911PJ~~ ~$oft....,.~ ....
1F'l!OlflNN~edMlld.Md'i~~Q'tlO~~- . . . --~
J.Gdt ~u-.....t ~!o't,....

""""u'

8.0.1 Important Events

SelectedlndexChanged
This event occurs when tl1e value of the Selectedlndex property changes.

Use this event if you wish to respond when the current tab is changed. For exa1nple, you could use this event to
trigger data validation or enable or disable certain controls that depend upon the current tab.

@- Pressing Ctr/ + Tab will select the next TabPage in the TabControl.

l $tabcontroll _Se lec tedlndexChanged={


2
3 if($tabcontroll .SelectedTab -eq $tabpageProcess)
4 {
5 #We are on the process tab
6 }
7 e lse
8 {
9 #We are on another tab
l0 }
ll
12 }
286 PowerShell Studio - A Comprehensive Guide

8.1 TABLELAYOUTPANEL CONTROL

The TableLayoutPanel is like other tables that you have used, it is basically just a table "vith colmnns and rows.
Once you practice using the TableLayoutPanel you can use it to quickly create dialog forms that are easily
resizable.

I a!:J M Form ~ This is an exa1nple of a form wit11 the


i TableLayoutPanel. Two labels, two TextBoxes,
I ,~~~-------------~----------~--------------~-------------------------------------~-~
i
and two buttons have been added.

I ;~----~----------~-------------~-------------------------~-------------------~
!

I
I
I. .
:
:
:
r----------~J . . . . . . . . . . . . . . . . . . . . . ,
.:
i
.:
:

I :I OK Cancel I t

I.I
--------------------------------------------------------------

a9 c: rm Notice whe.n "ve resize the form


Name: the layout remains the saine.
r----------------------------~-------------------~-,.------1

~ . .
.~-~;----------------------------------------------------------~-------

.~---------------..--- . -----------..-------..-------------------------------l..----.--------l
i...............-------....------.........................................................................-----........--.... ........_ ----..................--.................-......................................
_,, ........
OK
'
.,.i ............................
Cancel !
..

76
To re-create this example, perfor1n the following steps:

1. Create a new e1npty fonn.

2. Set the padding on the fonn to 12,12,12,12. You may "vant to change the ainount later, but use tllis for
now.

3. Add a TableLayoutPanel to the fonn. Set Dock to Fill. It starts with two columns and two ro\vs. No\.v,
it's decision tin1e. Shottld the labels be on the left or on tl1e top (assuming the language is English)?

76 https://blogs. msdn .microsoft.com/jpricket /2006 /04/05 /win forms-a utolayout-basics-ta blelayoutpanel/


PowerShell Studio - Form Controls I 287

Should the buttons be at the bottom or on the right? For no\.V, I wa11t the labels above the controls and the
buttons on the bottotn.

4. Keep the coln1nns at two and add 4 more rows. How should you add ro\.vs? In the Designer, there are
two main \.Vays: Add Row 1nenu item or the Edit Columns ai1d Rows 111enu iten1 on the Tasks menu of the
TLP. For now, simply select the Add Ro"v inenu four times. Four rows are added to the TLP with
Absolute RowStyles (\.ve will fix this later, making any of the ro,vs autosize with nothing in them will
cause them to disappear from the designer).

5. In ro, 0, column 0 put a label. Set the teA1: to "Naine :". Set t11e Anchor to Left and Right. Set the
Margin to 0,0,0,0.

6. In ro, 1, colrunn 0 put a TextBox. Set the name to "tbNaine". Set the Anchor to Left ai1d Right. Set the
Margit1 to 0,5,0,0.

7. In row 2, column 0 put a label. Set the teA1 to 'Description:". Set t11e Anchor to Left ai1d Right. Set the
Margin to 0 6,0,0.

8. In ro\.v 3, colu1nn 0 put a TextBox. Set the name to "tbDescription '. Set the Anchor to Left, Top, Right
and Botto1n. Set the Margin to 0,5,0,0. Set MultiLine to Tn1e.

9. In row 4, leave it empty.

10. In rovv 5, column 0 put a button. Set the text to "OK". Set t11e name to "buttonOK". Set the Anchor to
Bottom ai1d Right. Set the Margin to 0,0,0.0. Set the DialogResult to OK.

11. In row 5, colunm 1 put a button. Set the text to :'Cancel". Set the name to "buttonCancel". Set t11e Anchor
to Botto1n ai1d Right. Set the Margin to 6,0,0,0. Set tl1e DialogResult to Cancel.

12. No'v that we have our controls in place, we can set the correct RowStyles ai1d ColumnStyles. Select tlle
TLP a11d choose Edit Colunms and Rovvs fro1n t11e Tasks menu.

13. It shows the columns by default. The second colt1nm is just there for t11e Cancel button. We need to make
it as s1nall as possible and chai1ge the other controls to span across it. Set tl1e style for the second column
to Auto Size. This \Vill cause the column to shrink to tJ1e width of the Ca11cel button (the only control in
that col1unn). Leave column one alone.

14. In the drop down, select Ro,;vs. We want t11e ro'v that contains the .Description text box to eA'})and witi1
the dialog. Set the style for the forth ro\v (row 3 me11tioned above) to Percent. We want the rO\.V that is
empty to be exactly 10 pixels tall. Set t11e fift11 row to Absolute (it should already be that), and set the
amout to 10. All other rows should autosize to their contents. Set the frrst, second, tllird and sixth ro,vs to
Auto Size.

15. Once you click OK, your form should be close to what you want.
288 I PowerShell Studio - A Comprehensive Guide

16. For the labels and textboxes, set the Colu1nnSpru1 to 2. This will cause the1n to stretch the entire width of
the TLP.

17. Finally, let' s finish off the look of the form. Select the form. Set Text to "Edit Item". Set AcceptButton to
buttonOK. Set CancelButton to buttonCancel. Set Showlcon to false. Set MinimizeBox to false. Set
Maxi1nizeBox to false.

8.2 TEXTBOX CONTROL


77
Creates a text box for displaying text alld collecting user input in text fonnat. The difference in a TeA.1Box
0-.. and RichTextBox is that a TextBox only allows one font, one color and one fom1atting style for all text
within the box .

11 ,.;.;rll;...."'."f""
;....- " - - - - - - - - -13- If you need a simple text box without a lot of fonnatting needed, then the
I TextBox is the best fit. Ho\ivever, I generally use a RichTextbox \ith all my
applications in case later I decide to add in any additional formatting I don't
need to change controls. I see no benefit using a Textbox when you can use a
RichTextbox instead.
~ r ...eo. &, sett"9 tho r...eo._ "11U1Lne" to
TM. Ille T""'Scot wl alow more tho<> one lne """"tho box.
By setting the TextBox property "MultiLine" to TRUE, the text box will support
more than one line.

Clear Text Box - to clear tl1e contents of a teA.1box use:


11
1 $textbox l .text= "

Copy to Clipboard - To copy the contents of a textbox to the Windows Clipboard use:

2 function Add-ClipBoard ($text)


3 {
4 Add-Type -AssemblyName System.Windows.Forms
5 $tb =New-Object System.Windows.Forms.TextBox
6 $tb.Multiline =$true
7 $tb.Text = $text
8 $tb.SelectAll()
9 $tb.Copy()
l0 }
ll $text = $textbox l. text
12 Add-ClipBoard -text $text

77 https://www.sapien.com/blog/201l/06/l3/primalforms-20 l l -spotlight-on-the-textbox-control/
PowerShell Studio - Form Controls I 289

Copy to WordPad-to copy the contents of a teA1box to WordPad use:

l $filename= [System.10.Path]::GetTempFileName()
2 $textboxl .SaveFile($filename)
3 Start-Process wordpad $filename -ErrorAction 'Stop'

NOTE: You could change to Start-Process winword $filename -ErrorAction 'Stop' to open in Microsoft Word.

8.3 TIMER CONTROL


78
Creates a timer that raises a11 event at intervals that you specify. Use the Ti1ner event when you need to
0- iun code repeatedly at a specified interval. For example, you cai1 use a Tuner control to cl1eck the status
- of a process once every second.
79
Application fade-in effect

8.3.1 Important Events

Ticl<
This event occurs when the specified tinier interval .has elapsed ai1d the ti1ner is enabled.

Ifanother event such as a button click is processing a slo111 script, the Tinier 's Tick event vvill not fire until
after that event has completed processing.

Wanting: If the a1nount of tune to process a Tick event takes longer then the Interval tiine, it can lead to an overlap
issue. Please be sure to leave an adequate ainount of time for each Tick event to process. An alternate solution to
this potential issue is to stop the ti1ner "v hile processing the Tick Event:

l $timerl_Tick={
2 #Temporarily stop the timer
3 $timerl .Stop()
4
5 #Process the Tick Event Here ...
6
7 #Resume the timer
8 $timerl .Start()
9 }

78 https://www.sapien.com/blog/20 l l /08/09 /primalforms-20 l l -spotlight-on-the-timer-control/


79 https://www.sapien.com/blog/20 l l /08/l l /primalforms-20 l l -create-an-awesome-fade-in-form/
290 I PowerShell Studio - A Comprehensive Guide

Warning: Ti1ners can cause out of me1nory errors in long running scripts. Using the timer' s StOfl method can help
free allocated me1nory and thus prevent memory errors.

In the following exa1nple, vve create a 60 second count down ti1ner that utilizes the timer 's Tick event to update the
display (label) with the re1naining time.

1 $Tota1Time = 60 #in seconds


2
3 $buttonStart_Click={
4 $buttonStart.Enabled =$false
5 #Add TotalTime to current time
6 $script:StartTime = (Get-Date).AddSeconds($Totarrime)
7 #Start the timer
8 $timerUpdate.Start()
9 }
10
11 $timerUpda te_Tick={
12 #Use Get-Date for Time Accuracy
13 [TimeSpan]$span = $script:StartTime - (Get-Date)
14
15 #Update the display
16 $formSampleTimer.Text = $1abe1Time.Text = "{O:NO}" -f $span.Tota1Seconds
17
18 if($span.Tota1Seconds -le 0)
19 {
20 $timerUpdate.Stop()}}
PowerShell Studio - Form Controls I 291

8.3.2 Timer Example 1


In this example, we are going to create a button that displays the current ti1ne updated every second, we are using a
button control but you could easily use a textbox, label, or many other controls to accomplish the same tiring.

The screen on the left shows tl1e Button control


a My Form x displaying the current date/time, this is updated
with the timer control. We have set t11e timer
control interval to 1000 (1nillseconds or 1
second).

Button= $button!
01/10/201716:24:09 Timer = $timer I

We also added the Timer tick event to the editor


by right clicking on the timer control and
selecting "Edit default event (Tick)".

1 $formMyForm_Load={
2
3 $button l .Text= [DateTime]::Now
4 $timer.Start()
5 }
6 $timerl_Tick={
7 $button l .Text= [DateTime]::Now
8 }

8.3.3 Timer Example 2


'l My Form x In this exainple, \Ve have created a ti1ner based on current date/time with
start/stop buttons.

Label = $labell
Start Button = $buttonSTART
Stop Button = $buttonSTOP
START STOP

Click the " Start" and " Stop" buttons to start and stop the ti1ner.

1 $fo rmMyForm_Load={
2
3 $1abell .Text= [DateTime]::N ow
4 $timerl .Start()
292 I PowerShell Studio - A Comprehensive Guide

5 $run = 1
6
7 }
8 $timerl _Tick = { $1abell .Text= [DateTime]::Now}
9 $buttonStart_Click={ $timerl .Start() }
10 $buttonSTOP_Click={ $timerl .Stop()}

8.4 TOOLBAR CONTROL


The ToolBar control allows you to add a simple easy access toolbar style menu to your fonn. T11ere are three choices
of toolbar items; Pushbutton, Togglebutton, and DropDo\vn.

,/J MyForm x There three different display option for each toolbar menu
item:

1. Text only
2. Text and linage
3. Image only

Each display option is de1nonstrated in the exa1nple to the left.

To add the images, you will first need to add an I1nageList


control and populate with iinages. See section 5.8 for details.
Then in the ToolBar property "lmageList" select the imagelist
control that you added.

To enable different action depending on the button that the


user selects, use the ToolBar default event (Button_ Click).

Example script code for Button Click Event

1 $toolbar 1_ButtonClick=[System. Windows.Forms.Tool BarButtonClickEventH andler]{


2
3 If ($toolbarbutton l .Pushed= $true)
4 {#insert code to execute}
5 If ($toolbarbutton2.Pushed =$true)
6 {#insert code to execute}
7 if ($toolbarbutton4.Pushed =$true)
8 {#insert code to execute}
9 if ($toolbarbutton5.Pushed =$true)
1O {#insert code to execute}
11 }
PowerShell Studio - Form Controls I 293

8.5 TOOLSTRIP CONTROL


The ToolStrip control is like the StatusStrip control, except that the ToolStrip has more menu item ty pes that can be
added, such as; Button, Label, SplitButton, DropDo,;vnButton, Separator, ComboBox, Tex1Box, and ProgressBar
(ty pically found on StatusStrip rather than the ToolStrip).

Button, SplitButton and DropDownButton can be displayed in varying \ays as either text only, image and text, or
image only.

Items Collection Editor ? x


Select item and add to list below: Tool StripQOJn toolstripWton 1
10 ProgressBar v I Add J ~~ ~ i
r-- - -
I
Members: v Appearance
i :l W toolstrip 1 + BackColor D WhiteSmoke
Backgroundlrnage D {none)
J ~~~~~~~~~~~--Jlr+l Background lrnagelayot lie
A toolstriplabel 1
ca toolstripsplitbuttonl x Olecked
OleckState
False
Unchecked
&'==. toolstripdropdov.-nbutton 1 lrnageAndText
="' toolstripcombobox 1 Font None
fill toolstriptexlbox 1 ForeColor Text
ClID toolstripprogressbarl ) Image Image
Image~ r:-;;;-::--:'ii~----i

lmageScaling ze o
ImageTransparentColor Mags Ila
RghtToleft No
Right TolefthltoMim>rln False
Text Bdton

[ OK ] [ Cancel ]

-Pf! My Form x
0
Button label 0
SplitButton 0
DropOown ComboBox Text Box
294 I PowerShell St udio - A Comprehensive Guide

NOTE: There is a known bug \vith ToolStrip in Windows Forms. The issue is that when using the renderer,
you will see a "vhite border around the ToolStrip. Microsoft has stated that it will not be fixing this bug.

of] My Form x
File View Tools Help

l I~ Q

You are probably 1nost used to seeing the ToolStrip control used like the example above in most applications.

8.6 TOOLTIP CONTROL

0-.. 8
Represents a s111all rectangular pop-up window that typically displays help for the feature. The tooltip
appears when the mouse hovers over the control.

~
-
How to Create a ToolTip for a control: a!? MyForm ~r

~
a.
1. Add your control that you want to add a ~
~on
ToolTip for, in this exainple we picked a
silnple Button control.
2. Drag/Drop the Tooltip control onto the form,
the Tooltip control \Vill not appear on the form,
it will appear at the botto1n of the Designer
Panel.
3. After you add the ToolTip control to a form it
will add a new dynanlic property to all other
controls on the forn1 as "vell as future controls l
'i. 1oo1bp1 -
that you 111ay add.
4. Select the control to add a Tooltip to, go to the property "ToolTip" for the control, in our
example the property for the button control.

80 https://www.sa pien.com/blo g /20 14/0 l /30/ sp otlight-on-the-tooltip-control/


PowerShell Studio - Form Controls I 295

5. Enter the infonnation you want displayed in the Tooltip when the user hovers the mouse over
the control. It is best to keep the text as short as possible, if you need to enter 1nultiple lines use
the ' n to start a new line.
6. Select the ToolTip control and make sure that the "Active" property is set to TRUE.
7. That' s all there is to it!

The tooltip will look like the exa1nple


D9 MyForm x on the left when the user hovers the
1nouse over the control.

Click this button to start the process ,

8.7 TRACKBAR CONTROL


This is used to represent a standard Windo\vs Trackbar, so1ne use the na1ne Slider. The TrackBar provides a
control with a range that you specify and step frequency . Although limited in uses that you 1night find on forms, it
is a very cool control.

ofj "'Y Form The exa1nple on the left represents a


standard Track.Bar control.

' A great exa1nple of the use of the


TrackBar is demonstrated at
81
Ad1ninsCache. This uses the
TrackBar for frequency generation
and duration.
This one 1night drive your coworkers
------------ over the edge!
The code used to create the
Frequency/Duration TrackBar is belo,v:

81 https://adminscache.wordpress.com/2013/05/0 l /winforms-trackbar-gui-using-console-beep/
296 I PowerShell Studio - A Comprehensive Guide

1 #--
2 #region Application Functions
3 #----------------------
4
5 #endregion Application Functions
6
7 #--
8 # Generated Form Function
9 #--
10 function Show-test_psf {
11
12 #---------------------------
13 #region Import the Assemblies
14 #--
15 [void] [reflection.assembly]::Load ('System.Windows.Forms, Version=2.0.0.0,
Culture=neutra l, PublicKeyToken=b77a5c561934e089')
16 [void] [reflection.assembly]::Load('System.Data, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c56 l 934e089')
17 [void] [reflection.assembly]::Load ('System.Drawing, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7fl 1d50a3a')
18 [void] [reflection.assembly]::Load ('System.Design, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f l l d50a3a')
19 #endregion Import Assemblies
20
21 #------------------
22 #region Generated Form Objects
23 #--
24 [System.Windows.Forms.Application] ::EnableVisualStyles()
25 $formMyForm = New-Object 'System.Windows.Forms.Form'
26 $DurationLabel = New-Object 'Sys tem.Windows.Forms.Label'
27 $FrequencyLabel = New-Object 'System.Windows.Forms.Label'
28 $ExitButton = New-Object 'System.Windows.Forms.Button'
29 $PlayButton = New-Object 'System.Windows.Forms.Button'
30 $DurationTrackBar =N ew-Object 'System.Windows.Forms.TrackBar'
31 $FrequencyTrackBar = New-Object 'System.Windows.Forms.TrackBar'
32 $1nitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
33 #endregion Generated Form Objects
34
35 #--------------------
36 # User Generated Script
37 #--
38
39 $formMyForm_Load = {
40 # Frequency TrackBar
41 $FrequencyTrackBar.Location = " 70,20"
PowerShell Studio - Form Controls I 297

42 $FrequencyTrackBar.Orientation = "Horizontal"
43 $FrequencyTrackBar.Width = 350
44 $FrequencyTrackBar.Height = 40
45 $FrequencyTrackBar.TickFrequency = 1000
46 $FrequencyTrackBar.TickStyle = "Top Left"
47 $FrequencyTrackBar.SetRange (37, 327 67)
48 $FreqTrackBarValue = 2000
49 $FrequencyTrackBar.Value = 2000
50 $Frequencylabel.Location = "200,75"
51 $Frequencylabel.Size = "120,30"
52 $Frequencylabel.Text = " Frequency ($FreqTrackBarValue) "
53 # Play Button
54 $PlayButton.Location = "120,220"
55 $PlayButton.Size = "75,23"
56 $PlayButton.Text= "Play"
57
58 $global:DurationValue = 300
59 $global:FrequencyValue = 2000
60
61 $DurationTrackBar.Location = "70, 150"
62 $FrequencyTrackBar.Orientation = "Horizontal"
63 $DurationTrackBar.Width = 350
64 $DurationTrackBar.Height = 40
65 $DurationTrackBar.TickFrequency = 200
66 $DurationTrackBar.TickStyle = "BottomRight"
67 $DurationTrackBar.SetRange(l, 2000)
68 $DurationTrackBarValue = 300
69 $DurationTrackBar.Value = 300
70
71
72
73 }
74 #Play the Tone
75 Function Playlt
76 {
77 [System.Console]::Beep($global:FrequencyValue, $global:DurationValue)
78 }
79
80 $FrequencyTrackBar_ValueChanged={
81 $FreqTrackBarValue = $FrequencyTrackBar.Value
82 $Frequencylabel.Text = "Frequency ($FreqTrackBarValue) "
83 $global:FrequencyValue = $FreqTrackBarValue
84
85 }
86
87 $PlayButton_Click={
298 I PowerShell Studio - A Comprehensive Guide

88 Playlt
89
90 }
91
92 $DurationTrackBar_ValueChanged={
93 $DurationTrackBarValue = $DurationTrackBar.Value
94 $Durationlabel.Text ="Duration ($DurationTrackBarValue)"
95 $global:DurationValue = $DurationTrackBarValue
96
97 }
98
99 $ExitButton_Click={
l 00 $formMyForm.Close()
l0 l
102 }
103
l 04 # -End User Generated Script--
105 #---------------------------
106 #region Generated Events
107 #---
108
l 09 $Form_StateCorrection_Load=
l l0 {
lll #Correct the initial state of the form to prevent the .Net maximized form issue
112 $formMyForm.WindowState = $1nitialFormWindowState
113 }
114
115 $Form_Cleanup_FormClosed=
116 {
117 #Remove all event handlers from the controls
118 try
11 9 {
120 $ExitButton.remove_Click($ExitButton_Click)
12 l $PlayButton .remove_Click($ PlayButton_Click)
122
$DurationTrackBar.remove_ValueChanged($DurationTrackBar_ ValueChanged)
123
$FrequencyTrackBar.remove_ValueChanged($FrequencyTrackBar_ValueChanged)
124 $formMyForm.remove_Load($formMyForm_Load)
125 $formMyForm.remove_Load ($Form_StateCorrection_Load)
126 $formMyForm.remove_FormClosed ($Form_C leanup_FormClosed)
127 }
128 catch {Out-Null<# Prevent PSScriptAnalyzer warning #>}
129 }
130 #endregion Generated Events
13 l
PowerShell Studio - Form Controls I 299
132 #----------------------
133 #region Generated Form Code
134 #---------------------------
135 $formMyForm.SuspendLayout()
136 $FrequencyTrackBar.Beginlnit()
137 $DurationTrackBar.Begin lnit()
138 #
139 # formMyForm
140 #
141 $formMyForm.Controls.Add ($Duration Label)
142 $formMyForm.Controls.Add($FrequencyLabel)
143 $formMyForm.Controls.Add($ExitButton)
144 $formMyForm.Controls.Add($PlayButton)
145 $formMyForm.Controls.Add($DurationTrackBar)
146 $formMyForm.Controls.Add($FrequencyTrackBar)
147 $formMyForm.AutoScaleDimensions = '6, 13'
148 $formMyForm.AutoScaleMode ='Font'
149 $formMyForm.AutoValidate = 'EnablePreventFocusChange'
150 $formMyForm.BackColor = 'WhiteSmoke'
151 $formMyForm.Backgroundlmagelayout ='None'
152 $formMyForm.ClientSize = '490, 267'
153 $formMyForm.FormBorderStyle = 'Fixed3D'
154 $formMyForm.lsMdiContainer =$True
155 $formMyForm.Location = '200, 200'
156 $System_Windows_Forms_MenuStrip_ 1 = New-Object 'System.Windows.Forms.MenuStrip'
157 $System_Windows_Forms_MenuStrip_ l .Location= 'O, O'
158 $System_ Windows_Forms_MenuStrip_ 1. Name = "
159 $System_Windows_Forms_MenuStrip_ 1.Size = '672, 24'
160 $System_Windows_Forms_MenuStrip_ 1.Tablndex = 2
161 $System_Windows_Forms_MenuStrip_l .Visible= $False
162 $formMyForm.MainMenuStrip = $System_Windows_Forms_MenuStrip_l
163 $formMyForm.MaximizeBox = $False
164 $formMyForm.MaximumSize = '3100, 5000'
165 $formMyForm.MinimizeBox =$False
166 $formMyForm.Name = 'formMyForm'
167 $formMyForm.SizeGripStyle = 'Show'
168 $formMyForm.StartPosition = 'CenterScreen'
169 $formMyForm.Text ='My Form'
170 $formMyForm.add_Load ($formMyForm_Load)
171 #
172 # Durationlabel
173 #
174 $Durationlabel.AutoSize =$True
175 $Durationlabel.Location = '293, 113'
17 6 $Duration Label.Name=' Duration Label'
177 $Durationlabel.Size = '35, 13'
300 I PowerShell Studio - A Comprehensive Guide

178 $Durationlabel.Tablndex = 6
179 $Durationlabel.Text = 'labell'
180 #
181 # Frequencylabel
182 #
183 $Frequencylabel.AutoSize =$True
184 $Frequencylabel.Location = '62, 11 3'
185 $Frequencylabel.Name = 'Frequencylabel'
186 $Frequencylabel.Size = '35, 13'
187 $Frequencylabel.Tablndex = 5
188 $Frequencylabel.Text = 'labell'
189 #
190 # ExitButton
191 #
192 $ExitButton.Location = '293, 220'
193 $ExitButton.Name = 'ExitButton'
194 $ExitButton.Size = '75, 23'
195 $ExitButton.Tablndex = 4
196 $ExitButton.Text = 'Exit'
197 $ExitButton .UseVisualStyleBackColor =$True
198 $ExitButton.add_Click($ExitButton_Clic k)
199 #
200 # PlayButton
201 #
202 $PlayButton.Location = '95, 220'
203 $PlayButton.Name = 'PlayButton'
204 $PlayButton.Size = '75, 23'
205 $PlayButton.Tablndex = 3
206 $PlayButton.Text ='Play'
207 $PlayButton.UseVisualStyleBackColor =$True
208 $PlayButton.add_Click($PlayButton_Click)
209 #
210 # DurationTrackBar
211 #
212 $DurationTrackBar.LargeChange = 20
213 $DurationTrackBar.Location = '62, 148'
214 $DurationTrackBar.Maximum = 100
215 $DurationTrackBar.Name = 'DurationTra ckBar'
216 $DurationTrackBar.Size = '350, 45'
217 $DurationTrackBar.SmallChange = 5
218 $DurationTrackBar.Tablndex = 2
219 $DurationTrackBar.TickFrequency = 5
220 $DurationTrackBar.add_ValueChanged ($DurationTrackBar_ ValueChanged)
221 #
222 # FrequencyTrackBar
223 #
PowerShell Studio - Form Controls I 301

224 $FrequencyTrackBar.LargeChange = 20
225 $FrequencyTrackBar.Location = '62, 28'
226 $FrequencyTrackBar.Maximum 100 =
227 =
$FrequencyTrackBar.Name 'FrequencyTrackBar'
228 =
$FrequencyTrackBar.Size '350, 45'
229 $FrequencyTrackBar.SmallChange = 5
230 $FrequencyTrackBar.Tablndex 1 =
231 $FrequencyTrackBar.TickFrequency = 5
232 $FrequencyTrackBar.add_ValueChanged ($FrequencyTrackBar_ValueChanged)
233 $DurationTrackBar.Endlnit()
234 $FrequencyTrackBar.Endlnit()
235 $formMyForm.Resumelayout()
236 #endregion Generated Form Code
237
238 #-------
239
240 #Save the initial state of the form
241 $1nitialFormWindowState = $formMyForm.WindowState
242 # lnit the On Load event to correct the initial state of the form
243 $formMyForm.add_Load ($ Form_StateCorrection_Load)
244 #Clean up the control events
245 $formM yForm.add_FormClosed ($Form_Clean up_FormClosed)
246 #Show the Form
247 return $formMyForm.ShowDialog()
248
249 } #End Function
250
251 #Call the form
252 Show-test_psf I Out-Null

8.8 TREEVIEW CONTROL

Q 82
Displays a hierarchical collection of labeled ite1ns, each of \.Vhich is represented by a TreeNode. When
-- it co1nes to displaying hierarchical information such as a folder stn1cture, the Tree View control is a perfect
choice. 111 addition, the Tree View allows users to rename tree nodes which can be useful in many instances.
The TreeView also seives as a good navigation tool.

82 https://www.sapien.com/blog/20 11 /11/l4/primalforms-2011 -spotlight-on-the-treeview-control-part-1/


302 I PowerShell Studio - A Comprehensive Guide

r1:J MyForm x CheckBoxes property - setting this to True will disply


- - - - - - - - - - - - - - - - - - -
1
check boxes next to the tree nodes.

HideSelection property - this detennines if the selected


tree node will remain highlighted even if focus is lost,
such as \:V hen another control is selected.

t;JDRoot eORoot
j ~- 0Node1 l 1 0Node1
j 'DNode 2
BDRoot 2 -----
.....
El0 Root 2
~..0Node4 ; .. 0Node4
LO Node 4 ;. DNode 4
TRUE FALSE

8
:
Root
-""'!"
ImageList property - this ssets the ImageList objects that are used by the tree nodes. You will
l ~.... Node1 also need to add the I1nageList control to your fonn, and populate \vith the image you \:Vould like
' ' Node2
~.. ~ Root 2 for the nodes to use.
1.... Node4
LabelEdit property - this determi11es if a user wilJ be allowed to rename a tree node, if you are
i.... Node 4
using this as a file treeview you could use this to allo\v users to rena1ne a file.

8 Root Sho\vLines property - by setting this to FALSE there will be no lines displayed between tree
Node1 nodes.
Node2
8
- Root 2
Node4
ShowPlusMinus property - this indicates whether the plus-sign (+) and
- Root
Node4
minus-sign (-) \Vill be displayed next to the tree nodes. Nodel
Node 2
Root 2
Node4
Node4

8.9 VSCROLLBAR CONTROL


Windows Fonns scroll bar controls are used to provide easy navigation through a long list of ite1ns or a large
amount of infonnation by scrolling vertically within a control. The VScrollBar control allo,vs you to add
scrolling capabilities to co1nponents that do not support scrolling by default.

1. Minimum - The value of the control when the scroll thu1nb is at the left end of the HScrollBar or top of
the VScrollBar.
2. Maximum - This is the largest possible value of the scroll bar. Note that the Value property of the scroll
bar when the thumb is pulled all tl1e way to the right for the HScrollBar or the bottom of the VScrollBar
is not equal to the Maximum property. The Value property \vill be equal to this fonnula: Maximum -
LargeChange + 1.
3. Small Change - Here's the increment value used when the user clicks one of the arro"v buttons.
PowerShell Studio - Form Controls I 303

4. LargeChange - This is the incre1nent value used when the user clicks the scroll bar control on either
side of the scroll tl1umb.
5. Value - The current value of the scroll bar. This value represents the position of the top of the
HScrollBar's scroll thu1nb and the left side of the VScrollBar's scroll thumb.

9.0 WEBBROWSER CONTROL


r J(J My Form x The WebBrowser control allow you to define an
p '20 area on a form to display an Intranet or Internet
U Microsoft Sign in "

blmonl
Web Page.
.. . ,..,.. . - -- . '
L

The URL you 'vant to display is defined in the


"URL" property of the WebBrowser control.

The URL can also be defined in the script code:

$webbrowserl .Url = "http://w,V\v.google.com"

9.0. 1 Example
NOTE: when you first add the WebBrowser control to your fon11, the default property for "Dock" is FILL. This
will fill the entire form with the WebBrowser control. To resize t11e control, change the "Dock" property to NONE.

..
-
In this exa1nple, we have added the WebBrowser control \Vhich is
on the right, and three button 011 the left which \Ve are going to use

-
to display different webpages in the WebBrowser control.

We labeled each button \vith the cooresponding website; Google,


WebBrowser Reddit, and Linkedln.

1 $buttonGoogle_Click={

2 $webbrowserl .Uri= "http://www.google.com"}

3 $buttonReddit_C lick={
4 $webbrowserl .Uri= "http://www.reddit.com"}
5 $buttonlinkedln_Click={
6 $webbrowserl .Uri= http://www.linkedin.com}

That's all there is to it!


304 I PowerShell Studio - A Comprehensive Guide
Chapter 5
PowerShell Studio - Example Projects I 307

EXAMPLE PROJECTS
In this section, we will \Valk you through several working examples of projects created using Powershell Studio.
This will help to reinforce what you have already lean1ed in previous chapters and 11ow to apply that to working
forms.

IP RANGE SCANNER

Tllis tool \vill scan a user defi11ed range of IP Addresses to identify active/non-active IPs, as well as attempt to
provide device information and open ports. This is a great tool for keeping an eye on "vhat is on your nehvork.

First, we create an einpty form, and give it a na1ne of IP Sca1mer, then a size of 1349 vvidth and 750 height. I also
typically set the form backcolor to "white" also.

Pont ""''ft. Ser10 Senf,


l'o<.calor
_ _.,. S<ubl< c..,,.,,.... I\

R>;h<Tol<~ No
T<UIU lht

.., Behavior
~Qp ll*aisc
AutoVakie~ !Nbic9reW!'I~
,,,,,.,-.,s, ~)

Ooublc9.Jffwec
Enolled
"*
True
lrM:Modt NoConlToi
v .,....

.., Dt:tJgn
~ formrPScanner
lodC! .....

v -
~V.W.ocTrue
v Uyout
liutoSc ; '1odc Foni
Aucosaol Fike
>

>
)
...,_
Au~o.o
Ai.itOSc~ O, 0
Au..S:.

Loa:iort
Ma~l't
...........,
.....

O, 0
0,0
) ~ o.o
> Plddn; 0, O, 0, 0
S:t 1349, 750
Stlr1Po9bon \~ tt.oc.a
\~tlte f'b'tnd
v Hise
-~)
c-.artton ~)
. -
Siz

Now we are going to add some of the controls that we will need for tl1e fonn:
(1) GroupBox - groupboxl
(3) TextBox- textboxl, begin_IP, end_IP
(3) Label - labell, label2, label3
(1) PictureBox - pictureboxl
( 1) Button - buttonScanIPRange
308 I PowerShell Studio - A Comprehensive Guide

uC IP Scanner @~~
-------------------------------~

Tus tool wl scan al IP~ wilw> the,_ speciried to idaly .. textbox1


adlvelnonlive IPs <rod olt0f11ll lo provide device/system Womlal>or>.

'f
Sl"'111g IP >ddr= Ending IP >ddr=
PictureBox1
I u.e 1tie(192.168.1
~IPRqe
1orma1:
I UJtJt .1)
A

\ I I

'
I I I
Label2
GroupBox1

Label1 Label3

I
ButtonScanlPRange

TextBoxl Properties: TextBox2 Properties: TextBox3 Pro1>erties:


MultiLine - 1RUE MultiLine - FALSE MultiLine - FALSE
ReadOnly - TRUE ReadOnly - FALSE ReadOnly - FALSE
Tab Stop - FALSE TabStop - TRUE TabStop - 1RUE
Enabled - TRUE Enabled - TRUE Enabled - TRUE
WordWrap - 1RUE WordWrap - FALSE WordWrap - FALSE

Labell Properties: Label2 Pro11erties: Label3 Properties:


MultiLine - FALSE MultiLine - FALSE MultiLine - FALSE
ReadOnly - FALSE ReadOnly-FALSE ReadOnly - FALSE
TabStop - FALSE Tab Stop - FALSE Tab Stop - FALSE
Enabled - TRUE Enabled - 1RUE Enabled - TRUE
WordWrap - FALSE WordWrap - FALSE WordWrap - FALSE
Text - Starting IP Address Text - Ending IP Address Text- Use the format: x.x.x.x

GroupBoxl Properties: PictureBoxl 11roperties: ButtonScanIPRange Properties:


Text - IP Range Scanner Choose a picture you want TeA1 - &Scan IP Range
Enabled - TRUE UseMne1nonic -1RUE
Enabled - FALSE
TabStop - 1RUE
PowerShell Studio - Example Projects I 309

Next, \Ve will add a DataGridView that will be used to display our results. I also added an additional image on the
left just for design purposes but it isn't necessary.

~IP Scanner ~ e :~
--------------------------~

IP Range Sc..mer

Tho tool wl scan al IP addi moo wilwl the fiW190 spedied to ldertfy
activemonilCIJVe IPs and lll!en.,i 1<> pmvlde device/system rlonnmon

.____~ . I.____~ r---1


EndroglP- I
l
I !
:
I :icon IP Range I
Use the'""""''
'-- - - = - - - - - " - - - - - ' u.xx (192.168.1.1)
L----.i

DA TAGRIDVIEW

Now, we want to add three columns to our DataGridView; IP Address, Name, Open Ports.

IP~-

h1col A te1t1 al IP adchtaes wd*11he 1WJ08 fP8a6ed io ~


~e IPtlf'ICI a!tn'JC)IU>Ol'O'ride ~I'll~

c= -----i . c -----i r-- 1


-
c+--------------<>------------.,,.,......~ o...c;ridVl<wT-

- .....
p
C~Ott:1Source

Edit Col1.1,,,nJ.
AddC~
(f'IOl'l t J

l ' i -
~ IP - ...... IP - D E... :.<A: 9
D Enbl< Edrong
I~ s_c., IP Rongo
. -~--~
I UM"'-
-..x.xx (192.1681.l) _i --J D Enoble Dtleting
[:a Enblie Column Reotdttlng

Step 1. Click on the s1nall triangle in the upper right of the DataGridView.
310 I PowerShell Studio - A Comprehensive Guide

Step 2. Select "Add Columns"

Add Column ? x For each column, the two properties that "ve are concen1ed with
are the Header Text, which is the displayed colmnn nrune, and
the Read-Only box should be checked.
Add all tluee colunu1s, then click Cancel to close.

@ lhbolnd cok.ml
Name: ~,
CoUnn
--1---------------.

Type: DataGndViewTexiBoxCobm v

llP_Pddress
Headert.exl: ...... _____________.
12] V~ Read 0rVy 0 Frozen

L Add J Cancel

Colmn width can be adjusted if you like by editing the Edit Columns ? x
colmnns, and changing the FillWeight property. Selected Coli.mm:
~llilf.fi!if1
Click on small triangle in upper right of !!fill Name rv Design
DataGridVie' v control, select "Edit Colums". ~ Open Ports
CoUmType DataGOOViewText BoxColu .... I
v ~
PUoSizeMode NolSet
OMderWidlh 0
- 100
Frozen False
Mnimu:nWidlh 5
Width 287

Wei~ I
wet<j'I. that is used when sung ths cobm in the I
auo size mode.
Md ... Remove
J

OK Cancel

The DataGridView header should now look like the example below:

, ,p hktess Name Open Ports


PowerShell Studio - Example Projects I 311

Now, let's look at the code needed to pull everything together and inake it a functioning fon11.
You'll notice that PowerShell Studio has already added the Helper Function when we added the DataGridView
control to the form. #region Control Helper Functions

.. Scan lP Right-Click on the "Scan IP Range' button and select


-
,
roo Edit Default Event (Click)

Add Events...
Go to Event
~

Ctrl + E
____,

~
the "Edit D efault Event".

iV Rename Now, go to the editor tab. We' re not going to go in-


depth on how the PowerShell co1nmands work or why
0 Help ~

\Ve use the1n, because there are many excellent books


00 Apply Property Set. .. Ctrl + l
available to teach ho"v to use PowerShell, and this book
f!) Create Property Set. .. Ctrl + Shift + l
is about how to intergrate that into a GUI fonn.
~f Create Control Set... Ctrl + T

Insert Recent Control ~

r~ Copy Ctrl + C
f{9 Paste Ctrl + V
)( Delete Del
DD Select All Ctrl +A
DD

Bring to Front Ctrl + B


Send to Bade Ctrl + Shift + B

~ Properties
~ View Code
Document Outline

First, we \vill enter the code within the $buttonScanIPRange_Click event


1 $buttonScan lPRange_Click={
2 function lnvoke-TSPingSweep
3 {
4 Param (
5 [parameter(Mandatory =$true,
6 Position= O)]
7 [ValidatePattern ("\b\d{l ,3}\.\d{l ,3}\.\d{l ,3}\.\ d {l ,3}\b")]
8 [string]$StartAddress,
9 [parameter(Mandatory =$true,
10 Position = 1)]
11 [ValidatePattern ("\b\d{l ,3}\.\d{l ,3}\.\d{l ,3}\.\d{l ,3}\b")]
12 [strin g]$EndAddress,
13 [switch ]$ResolveHost,
14 [switch ]$ScanPort,
15 [int[]]$Ports = @(21, 22, 23, 53, 69, 71 , 80, 98, 110, 139, 111, 389, 443, 445, 1080, 1433, 2001, 2049,
3001,3 128, 5222,6667,6868, 7777, 7878,8080, 1521, 3306, 3389,5801,5900, 5555,5901),
312 I PowerShell Studio - A Comprehensive Guide

16 [int]$Time0ut = 100
17 )
18 Begin
19 {$ping = New-Object System.Net.Networkinformation.Ping}
20 Process
21 {
22 [System. Windows. Forms.Application]:: Do Events()
23 foreach ($a in ($StartAddress.Split(".") [O) .. $EndAddress.Split(".") [O)))
24 { foreach ($bin ($StartAddress.Split(".") [l] .. $EndAddress.Split(".") [l]))
25 {foreach ($c in ($StartAddress.Split(".") [2] .. $EndAddress.Split(".") [2]))
26 {foreach ($d in ($StartAddress.Split(".") [3] .. $EndAddress.Split(".") [3]))
27 { $pingStatus =$ping.Send ("$a.$b.$c.$d", $Timeout)
28 $IP_No_P ing = "$a.$b.$c.$d"
29 if ($pingStatus.Status -eq "Success")
30 {Try
31 {[System. Windows. Forms.Application]:: Do Events()
32 if ($ResolveHost)
33 {[System.Windows.Forms.Application]::DoEvents()
34 $getHostEntry = [Net.DNS]::BeginGetHostEntry($pingStatus.Address, $null, $null)
35 }
36 if ($ScanPort)
37 {[System.Windows.Forms.Application]::DoEvents()
38 $open Ports = @()
39 for ($i = l; $i -le $ports.Count: $i++)
40 {$port= $Ports[($i - l)]
41 $client= New-Object System.Net.Sockets.T cpClient
42 $beginConnect = $client.BeginConnect($pingStatus.Address, $port, $null, $null)
43 if ($client.Connected)
44 {$openPorts +=$port}
45 else
46 {#Wait
47 Start-Sleep -Milli $Timeout
48 if ($client.Connected)
49 {$openPorts +=$port}
50 }
51 $client.Close()
52 }}
53 if ($ResolveHost)
54 {$hostName = ([Net.DNS]::EndGetHostEntry([IAsyncResult]$getHostEntry)).HostName
55 }
56 # Return Object
57 $scanresult = New-Object PSObject-Property @{ IPAddress = "$a.$b.$c.$d";
58 HostName = $hostName;
59 Ports= $openPorts} I Select-Object IPAddress, HostName, Ports
60 [System.Windows.Forms.Applica.tion]: :DoEvents()
61 $host_data = $scanresult.HostName
PowerShell Studio - Example Projects I 313

62 $IP_data= $scanresult.IPAddress
63 $ports_data = $scanresult.Ports
64 $datagridviewl .Rows.Add("$1P_ddta ", "$host_data", "$ports_da ta")
65 [System.Windows.Forms.Application]::DoEvents()
66 }
67 catc h
68 {
69 $datagridviewl .Rows.Add ("$a.$b.$c.$d", "Unknown Device", "NIA")
70 [System.Windows.Forms.Application] ::DoEvents()
71 }}
72 else
73 {
74 [System .Windows.Forms.Application] ::DoEvents()
75 $datagridviewl .Rows.Add("$1P_No_Ping", "No Response", "N/ A")
76 }}}}}
77 }
78 End
79 {}
80 }
81 $datagridviewl .Width = 623
82 # Disable the button until finished processing
83 $buttonScanlPRange.Enabled =$false
84 # Change the button text so the user knows it is running
85 $buttonScanlPRange.Text =" .. Scanning"
86 #Clear the DataGridView in case there is any previous scan showing
87 $datagridviewl .Rows.Clear()
88 $datagridviewl .Refresh()
89 $StartScan IP = $begin_IP .Text
90 $EndScan IP = $End_IP .Text
91 lnvoke-TSPingSweep -StartAddress $StartScanlP -EndAddress $EndScanlP -ResolveHost -ScanPort
92 $buttonScanlPRange.Enabled =$true
93 $buttonScanlPRange.Text ="Scan IP Range"
94 }

[System. Windows.Forms.Application]: :DoEvents()


When you n1n a Windovvs Fonn, it creates the new form, \Vhich then \Vaits for events to handle. Each time the
form handles an event, it processes all the code associated with that event. All other events wait in the queue.
While your code handles the event, your application does not respond. For example, the windo\v does not repaint
if another \vindow is dragged on top.

If you.call DoEvents in your code, your application can handle the other events. For example, if you have a fonn
that adds data to a ListBox and add DoEvents to your code, your fonn repaints \vhen anotl1er wil1dov1 is dragged
over it. If you remove DoEvents from your code, your fonn will not repaint until the click event handler of the
button is finished executing. This coilllnand can be used to help eleviate the issue \Vitl1 a fonn displaying "Not
Responding".
314 I PowerShell Studio - A Comprehensive Guide

Add Events (SEnd_IP) a


NeA1, we are going to add a "TeA1Changed" event to each textbox2 and 'C' t..._ te' 0
--- .P l

!J R~
textbox3, this "vill be used to only enable our "Scan IP Range' button when RightTol.ftO>anood
.:=; Si2e0langed
tl1ey are not e1npt)'. [__, Tab!ndex<hanged
TabStop(j)angod
12i Tex!Chlnged
I v~
_J Contr~
I ControlRemoved
0.-ag[)rop
_, 0.-aQEnter
[__, " aqOver
0.-agleavo
~ Glv~
_J ~equested
~ QueryContrueOrag
QueryAce6Sb6~ v

In the editor, enter tl1e follo"ving code for the two "textchanged" events that you just created.

95 $begin_IP_TextChanged={
96 $buttonScanlPRange.Enabled = (($begin_IP.Text-ne "")-and ($End_IP.Text-ne ""))
97 }
98
99 $End_IP_TextChanged={
100 $buttonScanlPRange.Enabled = (($begin_IP .Text -ne "") -and ($End_IP .Text -ne ""))
101 }

-NoNo--
- 0 x

--
tt. ,_. . ..:"" 11 lP tcichJMt wcm.,. t*"9t ~ ' '"">'
d"lt/ro-i*l'O""'"...,,. ~ Dl!Vdc ~- ~
- w,....._~-~h:ll'!lt
Ooen Port
2llO.UltDIO

--
1'2.168.12 NIA

!tt1 "' "'

~-
' @ Gt I ll l 1'2.168 ll
192168 14
No-
...No -
WA
WA

- - - ' - ---'I ~"''"""


,'--'..- - --- U.l (1!11$111)
ltl.168 1,
192.1'8.I'
1!2.161.17 ,.,_
--
,.,_ 3
,.._
-
"-A
HIA

1'2.16811
1'2.168 1'
1'2.161' 10
t!l.1'8.111
No-
M W-
HIA
WA
WA
ao 1"6

Finished! You now have a working IP Scanner! Try it out!


PowerShell Studio - Example Projects I 315

DISPLAY AND KILL RUNNING PROCESSES REMOTELY

This form will allow you to display all running processes on a re1note computer and kill any process.

aO Running Processes ~[]~ First, you n.eed to add the


--------------- follo,ving controls to the form:
Get Processes [ Refresh J
(3) TextBoxes
Button (3) Buttons

Button TextBox For the "Kill Process" button and


its associated text box to the right,
set the property "Enabled" to
FALSE. We do tlus because we
don' t want a user to be able to use
those controls until we have first
l'EXTBOX gotten a list of all the running
processes.

Next, we create a click event for each button, "Get Processes'', "Kill Process" and "Refresh". PowerShell Studio
will insert the event wrapper in the code editor for you.

Below is the code for each button tl1at you will need to enter:

Get P rocess button:


1 $buttonGetProcesses_Click = {
2 $computer= $computer.Text
3 # Get running processes from computer and display in TextBox.
4 $Processes= Get-Process -ComputerName $computer I Out-String
5 $process_text.Text =$Processes
6 # Enable "Kill Process" button and associated textbox.
7 $buttonKillProcess.Enabled = $true
8 $killbox.Enabled =$true
9 }
316 I PowerShell Studio -A Comprehensive Guide

Kill Process button:

10 $buttonKillProcess_Click = {
11 $computer= $computer.Text
12 $kill box = $killbox.Text
13 $kill_process = gwmi -comp $computer win32_process I ? name -like *$killbox.exe
14 [void] $kill_process. terminate()
15 $process_text.T ext= "''
16 $Processes= Get-Process -ComputerName $compu ter I Out-String
17 $process_text.Text =$Processes
18 }

Refresh button:

19 $buttonRefresh_C lick = {
20 $computer= $computer.Text
21 $Processes= Get-Process -ComputerName $computer I Out-String
22 $process_text.Text =$Processes
23
24 }

rlfJ Running Processes 0 x


Get Pr<>Ce$$es 1 1~-hp Refresh
Ente< CQml'Uter name

Kill Proces$ J Enter Process Name i.e. NotePad

Ra.ndles NPM CK> PM (K) WS CKl CPU ( s ) Id SI P:ocNa:


------
- ----23
37S 7S44 1140
------
21.28 16148
-- ------------
1 AAM U~e Noeifier
137 11 1840 1960 o.os 8044 1 ac.roc:z:y
48 4 S96 760 0.00 3020 0 AESTSr64
232 13 3908 6896 S.77 2164 0 AGSSrvic:
SS7 29 17100 23192 2.36 8132 l Applic:oeion?ram&l!ose
137 8 1792 1928 0 . 02 16048 l AppVShNoei!y
121 8 1280 1820 o.os 2152 0 8 -rm9VC:
213 14 8772 11072 2.38 lU64 O audiod9
107 10 1672 19S6 4.84 4636 l Bea-c64
561 16 1840 2148 10.86 S76 0 c:sr
588 23 2492 11592 96.53 676 1 c1r
363 19 S320 S932 0.2S 2036 O dasHose
122 10 2380 1896 0.00 1680 O ObxSvc:
173 9 2712 S940 0.34 11412 1 dl.lhon
2832 129 151768 116476 411 . 73 7360 1 Oropbox
185 13 2044 3508 0.78 3844 O DropboxUpdaee
778 S4 86316 82624 s. 871. 28 960 ldwi
244 18 3008 3496 0.28 6684 l E::=vent.M&naqer
2448 364 243428 206980 429.92 2796 l .xplorr
780 SS 21500 3UOO 26.33 6580 1 explorer
1848 213 790736 742008 3# 022. 48 9020 1 fix.fox
37 s 760 804 0.02 11988 l tcnt.d.--vh.osc
195 27 asn 8264 0.33 6368 1 ron.xSTM
129 11 2772 2476 0.05 2080 O HPClie.n~Srvic
200 14 2444 2700 0.09 21S6 l hpi.naclld2
0 0 0 4 0 0 Idl.e
118 a 1128 1504 0.00 2108 O jhi_rvice
308 15 2580 3068 0.23 9188 1 juchec:lt
328 16 3016 3048 0.16 6660 l JUJc:hed

That's it, run the fonn, enter a computer name and click "Get Processes" . I added a couple of labels for the text
boxes to give users more clarification. This doesn' t include error trapping tl1at should be included in every script.
PowerShell Studio - Example Projects I 317

FILESHARE ANALYZER

In this example, we will create a form that recursively analyzes the parent folder that you specify and all child
folders to obtain the total nmnber of files in each directory, total size of each folder, last accessed, attributes and
the specified folder owner if exists.

oD Fil.share Analyze<

Label TextBox
EUeShare AnaNzer textbox
Reo.nively onolyzes the poront folder tn.t l'O'J specfy s1d al Cf1id foldets lo obtan lhe total IU1'i>er cl fies In eoch dinoctOI)',
I lntlyz rtesi-s I total size"' eoch folder. m tne spedoecl folder ovmer I -

TextBox
'
Button
PictureBox
I
I .
!........................................!

Label

DataGridView TextBox

In this example, vve are going to be using several different controls, as you can see from the image above.
1. Drag/Drop each control onto a new empty form, you can use the layout above or create your own layout.
2. Let's start with the TextBox (textbox50) located in the upper left comer of the form, this vvill be vvhere
the user will enter the file path they want to analyze.
a. Set BackColor property to "MintCream"
b . Set MultiLine property to FALSE
c. Leave the text property blank.
d. Create three different events (right-click on textbox and choose Add Events, fron1 the selection
box check "TextChanged", "Enter" and "Leave", then click Create.
e. In tl1e editor for the TextChru.lged event insert the follo,ving code:
l $textbox50_TextChanged={
2 If ($textbox50.Text-ne "")
3 {
4 $buttonAnalyzeFileShares.Enabled =$true
5 }
6 }
318 I PowerShell Studio - A Comprehensive Guide

f. In the editor for the Enter event insert the following code:
7 $textbox50_Enter={
8 $WatermarkText_dir ='Enter Path (example\\server\myfiles or v:\myfiles)'
'9 if ($textbox50.Text -eq $WatermarkText_dir)
10 {
11 #Clear the text
12 $textbox50.Text = ""
13 $textbox50.ForeColor = 'WindowText'
14 }
15
16 }

g. In the editor for the Leave event insert the following code:
17 $textbox50_Leave={
18 $WatermarkText_dir ='Enter Path (example\ \server\myfiles or v:\myfiles)'
19 if ($textbox50.Text -eq "")
20 {
21 #Display the watermark
22 $textbox50.Text = $WatermarkText_dir
23 $textbox50.ForeColor = 'DarkGray'
24 $buttonAnalyzeFileShares.Enabled =$false
25 }
26
27 }

The Enter and Leave events are designed to display the WaterMark "Enter Path (exa1nple \\server\1nyfiles or
v :\nl)'files)" when the textbox is e1npty, and also to disable the "Analyze FileShares" button if empty.
3. Next let's work on the "Analyze FileShares" button (buttonAnalyzeFileShares). In this example, I 've
added an arrow iinage to the button but it isn't necessary, you ca11 add do this using the "linage" property
of the button, and adjusting the "IinageAlign" property.
a. Create a Click event for the button (right-click and choose Edit Default Event). Then go to the
editor and use the follo\viI1g code \Vithin the $buttonAnalyzeFileShares_ Click Event.
28 $buttonAnalyzeFileShares_Click = {
29 # First we clear the contents of the DataGridView
30 $datagridview22.Rows.Clear()
31 # Disable and change the text of the "Analyze Fileshares" button
32 $buttonAnalyzefileShares.Enabled =$false
33 $buttonAnalyzeFileShares.Text = " ... Processing"
34 $ErrorActionPreference = 'SilentlyContinue'
35 # Set the ProgressBarOverlay step and set value to O
36 $progressbaroverlayl .Step= l
37 $progressbaroverlayl .Value= 0
38 # Clear the Status Messages box
PowerShell Studio - Example Projects I 319

39
1111
40 $rich textbox81 .Text =
41 $richtextbox81.AppendText("Analyzing Directories .... Please Wait ' n")
42 [System.Windows.Forms.Application]::DoEvents()
43 # Grab the parent folder file path from the text box
44 $item = $textbox50.Text
45 $every= "-Every"
46 $FormatNumbers = "-Forma tNumbers"
47 # Script-level variables used with -Total.
48 [Ulnt64]$script:totalcount = 0
49 [Ulnt64]$script:totalbytes = O
50 #region Get Directory
51 function Get-Directory
52 {
53 param ($item)
54
55 if (Test-Path -Path $item -PathType Container)
56 {
57 $item = Get-Item -Path $item -Force
58 }
59
60 if ($item -and ($item -is [System.10.Directorylnfo]))
61 {
62 return $item
63 }
64
65 }
66 #endregion
67 #region Format-Output
68 # Filter that outputs the custom object with formatted numbers.
69 function Format-Output
70 {
71 process
72 {
73 $_ I Select-Object Path,
74 @{
75 Name ="Files"; Expression = {
76 "{O:NO}" -f $_.Files
77 }
78 },
79 @{
80 Name = "Size"; Expression = {
81 "{O:NO}" -f $_.Size
82 }
83 }
84 }
320 I PowerShell Studio - A Comprehensive Guide

85 }
86 #endregion
87 #region Get Stats
88 # Outputs directory statistics for the specified directory. With -recurse,
89 # the function includes files in all subdirectories of the specified
90 # directory. With -format, numbers in the output objects are formatted with
91 # the Format-Output filter.
92 function Get-DirectoryStats
93 {
94
95 param ($directory,
96 $recurse,
97 $format)
98 $1astaccess = $directory.LastAccessTime
99 $attrib = $directory.attributes
100 $directoryname = $direc tory.Fu11Name I Out-String
l0 l $files= $directory I Get-Childltem -Force -Recurse:$recurse I Where-
Object {
102 -not $_.PSlsContainer
103 }
104 [System.Windows.Forms.Application]::DoEvents()
105
106 if ($files)
107 {
108 $richtextbox8 l .A ppendText("Calculating $directoryname")
109 [System. Windows.Forms.Application] ::DoEven ts()
110 $output= $files I Measure-Object -Sum -Property Length I
Select-Object '
lll
@{
112 Name ="Path"; Expression = {
113 $directory.Fu11Name
114 }
115 },
116
@{
117 Name ="Files"; Expression = {
118 $_.Count; $script:totalcount +=$_.Count
119 }
120 },
121
@{
122 Name = "Size"; Expression = {
123 $_.S um; $script:totalbytes += $_.S um
124 }
125 }
PowerShe ll Studio - Example Projects I 321

126 }
127 else
128 {
129 $output="" I Select-Object '
130 @{
131 Name ="Path"; Expression = {
132 $directory. FullName
133 }
134 },
135 @{
136 Name = "Files"; Expression = {
137 0
138 }
139 },
140 @{
141 Name ="Size"; Expression = {
142 0
143 }
144 }
145 }
146
147 if (-not $format)
148 {
149 $dir =$output.Path
150 $File_count =$output.Files
151 $Dir_size = ([System.Math]::Round($output.size /1 MB, 4))
152 $owner= Get-Acl $dir I select -expand Owner
153 If ($File_count -eq "O" -and $Dir_size -e q "O")
154 {
155 $datagridview22.Rows.Add("$dir", "Access Denied or Empty
Fo Id er,
" '"', "'I)
156 }
157 else
158 {
159 $datagridview22.Rows.add ("$dir", "$File_counf', "$Dir_size MB",
"$1astaccess", "$attrib", "$owner")
160 }
161 [System.Windows.Forms.Application]::DoEvents()
162 }
163 else
164 {
165 $dir =$output.Path
166 $File_count= $output.Files
167 $Dir_size = ([System.Math]::Round($output.size /1 MB, 4))
168 $owner= Get-Acl $dir I select -expand Owner
169 If ($File_count -eq "O" -and $Dir_size -eq "O")
322 I PowerShell Studio - A Comprehensive Guide

170 {
171 $datagridview22.Rows .Add ("$dir", "Access Denied or Empty
Folder", "", '"')
172 }
173 else
174 {
175 $datagridview22.Rows.Add ("$dir", "$File_counf', "$Dir_size MB",
"$1astaccess", "$attrib", "$owner")
176 }
177 [System.Windows.Forms.Application] ::DoEvents()
178 }
179
180 }
181 #endregion
182 # Write an error if the item is not a directory in the file system.
183 $directory= Get-Directory -item $item
184 if (-not $directory)
185 {
186 $itempath = $item I Out-String
187 $richtextbox81 .AppendText("$itempath is not a directory in th e file system.")
188 $buttonAnalyzeFileShares.T ext= "Analyze FileShares"
189 $buttonAnalyzeFileShares.Enabled =$true
190 $textbox51 .Text = "Finished"
191 return
192 }
193
194 # Get the statistics for the first-level directory.
195 Get- DirectoryStats -directory $directory -recurse:$true -format:$true
196
197 # Get the subdirectories of the first-level directory and get the statistics
198 # for each of them.
199 $Targets= ($directory I Get-Childltem -Recurse -Directory I Measure-Object I %{
200 $_.Count
201 })
202 $progressbaroverlayl .Maximum= $Targets
203 $textbox5 l .Text= $targets
204 $directory I Get-Childltem -Force -Recurse I
205 Where-Object {
206 $_.PSlsContainer
207 } I ForEach-Object {
208 Get- DirectoryStats -directory$_ -recurse:$true -format:$true
209 $progressbaroverlayl .PerformStep()
21O $Targets= ($Targets - l)
211 $textbox51.Text =$targets
212
213 }
PowerShe ll Studio - Example Projects I 323

214 $progressbaroverlayl .Value= $targets


215 $bvttonAnalyzefileShares.Text ="Analyze FileShares"
216 $buttonAnalyzeFileShares.Enabled = $true
217 $textbox51.Text ="Finished"
218 }

4. Click on the small triangle in the upper right comer of the DataGridView, select Add Column. Add the
following columns; FileShare Path, Total Files~ Total Size, Last Accessed, Attributes and Owner. For
each colum11 check both the Visible and Read Only check boxes.
~ -~
~ - Sliare
-P_alh
_ __.==~--
Tclal
-Res--==~-Tdal
-S -z-o--==~-lasl
~Q~ ----====---i'tttb.t
--M---======---
OWnor
---===~-~jl' ~rldV'iewTllSks
Choose Data Source: f{nOn'el ,,.;ijl
~-----==:___===,
-'dd Column 7 x Edll! Columns...

Oat~~

~nlhePa~ ' tf'dd Co!um_n_


0
0
... _
Enable Adding
Enable Editing
t 0 Enable Deleting
0 Enable Column Reordering
OocJc an Parent Container
@~colrM

6 Name: leoum1 I 0
Type: IDetaG!<MewTedBoxColl.rrro "J
I
Header text; ~S!)aie Pmh I
0 Vioibie D Reac!Only D Frozen

Md l Leancd_ j
--

No\V. you cru1 nu1 the form, by going to the HOrvIB tab in the ribbon bar, and clicking on RUN. The fom1 should
be silnilar to the exainple belo\v

FaleShare Analyze
~ lWWllytos lt>e""""" loldew tNi )'OU seJy ond .. cl1lcl ,_to oblllln !he 1otll IUllb d ffos ii actl ~O<)I.

-..
~1 lotol sltoof each folder. and !ho oped:-ed loide<ownerf - ..

Tote! Sloil LostAcc:osaod Owner

F\pogomt\0012-0lf....&.Ator.s 16 4.4-0S2MS O<l/12/2016 02.50:12 Chotory JEFFHP\Jolf


f;~\1231-.i

F:'otognons\2.4
4543
450
133.1083 MS
-
2.6C66MS
O<l/ 12/2016 02:50:12
-
O<l/ 12/2016 02'50;52
Cho!Ol)I
l:QctOl)I
-
JEfF.HP\Jdf
JEfF.HP\Jdf
Statua Mev
F:~\tO_GK_Gomebo... S 6).7795MB
- - -
O<l/12/2016 02:50:55 Chdory JEFFHP\Jdf
~ F:~Dll'"''8\>8411J\100v~,,,..,.... S!)1<!s Pack 201tl\5v8uletln
4 ~ """" Sl<iia.. ~~'<mageo'll!!'ve\iopd~
A

1H11l9MB
- -- -
O<l/12/2016 02;50:56 JEfF.HP\Jdf
- ~ f;~\va:l10\100v~""'""" ~Pool< 2010\Sv~
-- ChdQrf 4~ m.n =~~~ve\ollltU>loon
~F: ~\841ft- 100vll<Uln l'>riJm St)!Hl'lld< 2010\5v~
874 4546 MB O<l/12/2016 02;51:02 acectory JEFf.HP\Jdf
~ol)otes fiom Sktneq,rl\l!roW~eS_-~
F'otognons\Adive@Fle Re. 4 9m1MB O<l/12/2016 02l51;03 CirettOl)I JEFF-HP\Jdf Colc::dimg f,..__\v84lj)\1oov&.-.<1'reri.1!1 &vies Pool< 2010\5v~n
- --
JEFf.HP\Jo!f
4~ F1oi!rSlci->Box !\hvllm*t"""~\a<lt!lloc010t
F:~\Adobo 4 207.8692 MB 04/12/2016 02:51:0S thQoty ~ F;'f><ooi1,.\v8410\100"~ ~AA> Pock 2010\5vMom
Directay 4 Sly!e$ f1'oo! ~S... l\llrovo~IOOivele.-.~ ..
F:'\pn>gllmsVdobe O.aove - 1755 36i1l5.691 MB O<l/12/2016 02.51.17 JEffHP\.ltll ~ F:....O!l'OlilS\w8410\100v&.lot;i ..._.., ~ ~:201tl\5v8tllelio
F:\pcoglonsVdobe.C"lllivate.... 3 248.3463M8 O<l/12/2016 02~:4() Dnlclory JEff.HP\lolf 4 ~fiiiin SktnBoxi!'8me~i.liriive"'1se\blo9 .
---- Re~. lhaO<)I
~ F:~\v 84f(J\ 100vrulem ~ Sfy!os Peck .21110\5 ,.~.,
16915.8248 MS 04/12/2016 03.00:44 JEff.HP\.ltll 4~ -~Nnve~~Wsolttees
~ f> \!184\0\10011~ P,..,..,, ~ l'aci< 2010\5 vllo.IJoCii
203.0334 MS O<l/12/2016 03:03:01 ihc:tOl)I JEFFHP\Jel! 4~ '1Qm Sl(t,eo;. !lhv<o~~~'l>odc~
~-
Fc~\AdobeCam<raRa_ 29 73.3881 MB O<l/12/2016 03.03:04 Dm:IOl)I JEFf.HPIJ<lf ~;'<>o>gt.,1;s\v8"410\10llv~ P""*"" 9yleo PllCk 201q1Sv&Aelin
4~ Sklr!lloX~~'i:wo~~voru
f ' c<og!msVdobelJ!ttn>cm. 900 71 .~ 1 6MS 04/12/2016 03-03:06 Dttd0ty JEFfHP\Jdf ~ F;~\v84l0\100 v!Metin " ' - sty\e's Poi:l<.20'10\5 vOOl!em
F:~~S_o!U! rn1 65.5613 MB 04/ 12/2016 03-03:15 ~ooy JEff.HP\Jdf
4 ~ FiomSl<ilS... f\!eio~ '
~1':~\V~11]).100v~ ...,,..,,~Paei<201~v~
F:~~ , Co<J>o., 124 1.7MB OC/12/2016 03<C411 Di'ectO<)I JEFFHP\Jdf 4 ill)'lo. Hon> SIMBox l\OelOXPSOs
--- ~ F~(l).100v~ _.., ~ Plick 201o\5ve.Jii!in
F~_Poaor_ 10 4153428 MS O<l/12/2016 030412 DlectQrf JEfF.HP\Jdf StylOs l'1o!i! ~!lox \,.Got~
~:~\vlJ410\100v~ ~ Sl)JF~OISv!WetTn
F:~ 2923 22.5094 M.8 04/12/2016 03:<1418 ChdO<)I JEfF-HP\Jdf ~ Ski>b r:aolo~'ld.io
-- --- ~~\v'8410\100~~ ~Slyl.. f>'ICkj2010\5v~
22.0<l45 MB 04/12/2(l16 0304:38 CirettQrf JEfF.HP\Je!f
l.iyle's - Sktnllo!< ~=~
~F:~~l 100v~l'remlilm$tylM~2010\5~in
F"""l'l!!l)S~-'"""""" 6 6.59.lSMS O<l/12/2016 03:*.33 Drec:!Ol)I JEFFHP\Jelf
F;~
--- ----
317 74974 MB
- -
04/12/2016 ()3:()<14() D'rec!O<)I
j ol)le$ A'om SldnScx ~l.ciilo~oc:h
- JEffHP\Jelf ... ...
324 I PowerShell Studio - A Comprehensive Guide
Chapter 6
\ I
PowerShell Studio - Reference Guide I 327

REFERENCE GUIDE
The reference guide contains important information pertaining to not only Po,verShell Studio but also Windo,vs
Po,verShell. You will also find all the pertainient control properties for each control listed. in an easy to read table
fonnat.

EXPORTING CACHE FROM REMOTE MACHINE

One of the challenges faced \.vhen developing any Po,verShell script is that modules that reside on your local
development computer may or may not be available on the target computer that you user \.Vill be n1nning your script
from.
As a first step, you need to get the PowerShell cache information that PowerShell Stuido uses fro1n your target
1nachine. To inake this as si1nple as possible, SAPIEN has packed all the files required into a zip file. It's called
CacheExport.zip and you can find that in the PowerShell Studio product installation folder m1der "Redistributables".
Take CacheExportxxxx.zip file, copy it to a flash drive, a nehvork share or wherever you need it to be so you can
access it from the target machine. It is recommended that you unzip the file after you have copied it to the target
machine to avoid a few extra dialog boxes that would occur.
Start the CacheExport utility (CacheEA'J)Ort.exe). This process \Vas designed to be installation free, so anything that
needs to happen \.vill be done by the utility . Unless you have anything else SAPIEN already installed on that
machine, CacheExport will launch RegisterControls.exe. As this requires elevation you inay get a few corresponding
pro1npts. Please make sure to allo"v it to run, othenvise the utility \von't work.

Cad1e Export x
Export c:ache files to: J C:\Users\Jeff\pesktop\JEFF-HP.CacheExport
ID
Local Cache Stall.JS

PowerShell '112 32 Bit ===Cache files found ===


PowerShetl V2 64Bit: ===Cache files found===
PowerS.hell 113 32 Bit: ***Cache files not present ***
Pov,1erShell V3 64 Sit:
PowerShell V'I 32 Bit: -*
*** Cache tiles not present ***
Cac:he files not present ~
PowerShell V4 64 Bit: *** Cache file-s not present ***
PowerShell VS 32 Bit:
PowerShell VS 64 Bit: == =Cache files found ===
I Rebu'~d All Cache Files J

Save I L Close ]
328 I PowerShell Studio - A Comprehensive Guide

Most likely you see a status as shown above. Click on "Rebuild all cache files" if anything is not present. If you
leave the CacheExport tool on your remote inachine, you can later on do this as needed if you install new versions
of any module(s) or additional n1odules or products on that system.

Once you do that the status changes to show this:

tlii4 Cache Export x


Export cadie files to: J C: \Users \Jeff>esktop\JEFF+IP. CadieExport
ID
Local Cache Status

PowerSheD V2 32 B.it: - Building . -


PowerSheU V2 64 Bit: -Building , -
PowerShell V3 32 Bit: - Building . -
PowerSheU V3 64 Bit: - Building . -
PowerSheU V4 32 Bit: - Building .. -
PowerShell V4 64 Bit: -Bu~ding .. -
PowerShell VS 32 Bit: - Building .. -
PowerSheU VS 64 Bit: - Building . -

Save Close

Depending on platform and PowerShell versions installed this process takes a fe,v minutes to co1nplete. Once
finished, you should see so1nething like this:
PowerShell Studio - Reference Guide I 329

Click on the "Save" button to save the newly built cache files to an export file. The default
location for this is your desktop. The file is na1ned with your computers name and a .CacheExport
extension. Please do not modify the name of the file, because this naine is \V hat PowerShell
Studio will use to fi11d that remote 1nachine on a network. The CacheE>q)ort utility \Vill
automatically close after you click "Save".

Take that file a11d copy it back to your flash drive, network share or whatever location you can access fro1n your
develop1nent macltine.

IMPORTING REMOTE CACHE FILE

After you have exported the remote cache from your target remote system, the next step is to i1nport the remote
cache file into PowerShell Studio located on your development syste1n.

Click on the "Import Remote Cache" button located in the Platfonn


LocalMadme
section of the Ribbon Bar.
~vs - 32Bit
0 >e'\ ~ P +~ re II A dialog window will open, select the previously exported cache file for
the remote system.
Platform '

x
> This PC > Desktop > v Cl Search Desktop p

Organize New folder

OneDrive

c:3 This PC
Desktop istatus I-Status Graphics Jeff JeffHolder Cloud knowledgebase2 Mastering New folder
23 PowerShell
~ Documents
..J. Downloads
Ji Music
'- I Pictures
Videos New Graphics ReelSchematic ReelSchernaticl Source status display SURVIVEOUTDO SurviveOutdoor
:;_ OS (C:) OR Backup

- HP_RECOVERY (
_ Secondary (F:)
f
fj CD Drive (G:)
_ Data locker (H:)
SurviveOutdoor SurviveOutdoor Tungstenlube tungstenlube.co Work JEFF-HP.CacheEx
_ Datalocker (H:) o.; Book Product Labels m port

File name: IJEFF-HP.CacheExport v I Cache Export Files (".CacheExpc v

Open 11 Cancel
330 I PowerShell Studio - A Comprehensive Guide

lrnport Rernote Cache

Remote Machine: JEFF-HP OK

Remote Connection Cancel


D Using VVindo'l\s Pol/\ erShell Remoting
1

D Using RSEE Remoting

Credentials

Username:

No"v, you have hvo options for connection to the re1note system, either Windows PowerShell remoting or RSEE
Remoting. Depending on your selection so1ne of the following options may not be available to you. If you plan on
using Windows Remoting to run scripts on this machine you may have to provide a valid user id and pass\vord for
that computer.

If you are using RSEE (Re1note Script Execution Engine) to connect to the remote inachine no credentials are
necessary. If you plan on just running or testing script on that remote machine and you already have Windo\VS
Remoting \ivorking, there is no need to install RSEE there. If on the other hand, Windows Re1noting is not an
option or you need to debug on that remote computer, installing the RSEE service on the target 1nachine is
reco1nmended.

Once you have the cache infor1nation imported you can select the machine
Local Madine
from the platform combo box:
Local Machine
JEFf +iP ~~----_,,,,___
Once you have selected this other machine as your target enviromnent you
..___.
""' Platform will see c1ndlets colored according to \Vhat exists on this machine but not
your local co1nputer.

If you selected Windows Remoting as the remote connection to this other


1nachine you can use the Re1note Console button to open a console to the
JEFF-HP , ..., I
re1note machine. This console can co1ne in hand to verify that scripts you a vs - 32 Bit ] ..., I
ran did the right thing and conditions are what you e>..'J)ect them to be. 0 < ~ 11 +~ Fe II
~ Platform /
The first time you click on the Remote Console button a new console will
be added to your list of embedded consoles. You can al\vays use this button to bring up the corresponding console
for your target machine. Additionally, you can also select the remote console fto1n the list even if you are using your
local machine or some other computer as target.
PowerShell Studio - Reference Guide I 331
Both Windovvs Re1noting ai1d RSEE use the highest available endpoint when nmning a script remotely. That 1neaI1S
that even if you don't have PowerShell V3 installed locally, it ':vill run in V3 on the remote machine.
Likewise, if you have a 32-bit inachine and the remote machine is 64-bit yot1r script will execute in a 64-bit
Po\verShell instance . (RSEE depends on whether you installed the 32-bit or 64-bit version of the service.) No':v you
can edit and 11111 sc1ipts against re1note systems fro1n the comfort of yotir ovvn development computer.

REMOTE SCRIPT EXECUTION ENGINE (RSEE)


The Remote Sc1ipt Execution Engine (RSEE) is an enterprise-level remote script e-xecution e11viro1u11e11t. It
consists of two components: The client, ':vllich is built into PowerShell Studio, and a re1note service that must be
deployed to each con1puter \vbere you \ill remotely run scripts. RSEE is capable of deploying a sc.ript fro1n \vitllin
Po\:verShell Studio out to reinote co1nputers where the script is executed, and bringing the scripts' output and results
back to PowerShell Studio for yotu review.

RSEE is a complex tool a11d it interacts closely with Windows' security subsystems. RSEE is recornme11ded for use
only by experienced Windows adn1iitistrators wl10 f1tlly understand service deploy1nent and inanagement, cross-
co1nputer secmity and authenti.cation and, in the case of don1ain environn1ents, Group Policy objects and Active
Directory ad1ninistration. Apart fro1n tl1e guidelines in tllis nianual, SAPIEN Teclu1ologies caiu1ot assist you with
security issues caused by improper configuration nor can \Ve assist \Vith Active Directory, Group Policy, or local
computer configuration tasks.

RSEE is designed only for Windo,;vs Script Host (WSH) scripts in VBS (VBScript) or JS (JSc1ipt) files. It is not
designed for otl1er WSH scripts (including WSFs) nor is it designed for scripts \.Vritten in other languages (such as
batch KiXtart, and so forth).
7

RSEE DeJlloyment

RSEE's service component is packaged in a Microsoft Windows Installer (MSI) file and is sttitable for deployn1ent
via Group Policy. You can also 111anually install it on individual machlnes. Keep in 1nind t11at, once installed, the
se1v ice needs to be started in order to be useful. Tllis will occur auto1natically after restartiJ1g the computer on wltich
the service is installed (the service is set to strut auton1atically by default).

After deploying the service, there are a ntunber of configuration steps that you must take in order to properly
configure RSEE in your environment.

Identity

RSEE installs, by default, to log in u11der the privileged Loca.lSystem accou11t. This may be s11fficient for your
purposes. However when deployi11g scripts in PowerShell Studio, be sure not to specify any credentials in the
Launch dialog box. Also, be advised that the LocalSyste1n account may not be able to execute son1e scripts,
depending on their security require1nents.
332 I PowerShell Studio - A Comprehensive Guide

We recommend that you co1tligure the RSEE service to nm under a l1ser account tliat has adntinistrative privileges
on the local co1nputer. In a workgroup ei1vironment, this would be a local acco1mt, and we reconunend creating tlle
same local accom1t (with tlle same pass,vord) on all of your co1nputers, for consistency. In a don1ain enviro11filent,
'1Ve reconm1end creating a single domain. account '1Vhich has local adnunistrative rights on all co1nputers in the
do1nain, and using this accolmt to nm t11e RSEE se1v ice. Whenever the RSEE service is nllllling under a user
account, you must specify that account (and its pasS\:vord) when deploying scripts in PrirnalScript.

When using RSEE, you have the option to specify the credentials 11uder vvhicl1 tlle script should execute. Generally
speaking, you need to provide the sa111e credentials that the RSEE service is using to log on.

TCP Port

The RSEE se1v ice defaults to using TCP port 9987 for incon1ing com1ections, and TCP port 9988 for outgoing
connections. It is your responsibility to ensure that any local firewalls \:vill permit inco1ning traffic on tllis port. Keep
in n1ind that the Windoivs Fire\.vall (Windo,:vs XP SP 2 and later. and Windows Seiver 2003 SP 1 and later) can be
centrally configlrred via a do1naiI1 Group Policy object.

You can specify a different port:

Via the Registry - The key is HKEY_LOCAL_MACHINE\Soft\vare\Policies\Sapien . The Value nan1e


is InPort (for the inco1ning port) and OutPort (for the outgoing po1t). Note that these values are n1ost easily
configured by 111eans of a Group Policy object (GPO), and we provide a ten1plate (ADM file) tl1at can be
i111ported into a GPO to co1Ifi gure RSEE.

Both Po"VverShe11 Studio (as the RSEE client) and the RSEE service utilize InP01t ai1d OutPort. The service listens
to InPort for iI1conling connections and uses OutPort to send script output back to the client. The client reverses this:
scripts are sent via InPort ai1d results are received on OutP01t. The registry key above con.figures tl1ese ports for
both clients and the service.

Domain Tips

While manually configuring a few co1nputers in a workgroup is not a hardship, mai1ually corrfig1rri11g ai1 entire
don1ai.n of computers can be burde11So1ne. Al1 Active Directory do1nain environment provides a nu111ber of
capabilities for centraliziI1g and auto1nating this configuration, ho'1vever. While this section is not iI1tended as a
comprehensive t11torial in Active Directory (we recornmend tllat you consult an e~'Perienced Active Directory
ad1ni1tistrator or the appropriate docun1entatio11 if you need inore assistance), the following tips should help you
configure RSEE more easily:

Create a don1ain accou11t. Name this account son1ething like "RSEEUser" ai1d provide it with a strong
password per yo1rr organization's password policies.
Deploy the RSEE service. This cai1 be done by meai1s of a Group Policy object (GPO) linked to the
appropriate levels in the domain. The RSEE se1v ice defaults to running under the LocalSystem account
and it defaults to port 9987. The service's MSI is in tlle RSEE folder under your PrimalScript Enterprise
installation folder.
PowerShell Studio - Reference Guide I 333

Make the RSEE service account a local Ad1ninistrator. You can do tllis in a Group Policy object (GPO).
Bro"vse to Computer Configuration > Security Settings > Restricted Groups. Add a group
("Administrators") ru1d U1en add your RSEE domain account (a11d any other appropriate accounts) to the
group.
Configure the RSEE service. You need to configure the RSEE service to log 011 ' viU1 tl1e user account (ru1d
pass\vord) you created. This can either be done 1nanually or using a script. The book 1if;indoH'S
Adn1inistrator's A11ton1ation 1'oo/kit, for example, contains a script that can set the logon account and
pass,vord used by services nnming on multiple computers. Utilities like Senice Explorer
(W\V\V.scriptlogic.co1n) can perfonn the sa1ne task.
Select the TCP port. We provide a Group Policy object (GPO) administrative template (ADM file) that
you can import into a GPO a11d use to centrally configure the TCP port used by the RSEE service. Tllis
ADM file is located in the RSEE folder under your PrimalScript Enterprise installation folder.

UsingRSEE

RSEE no' v supports Po,versbell. To deploy the current script (only VBS and JS files are currently supported) to one
or more ren1ote co1nputers that have the RSEE service installed, click the RSEE button on the Seri.pt toolba.r. or
select Run Script on Re1note Co inputer from the Script menu.

RSEE perfom1s a quick scan of your script to look for con111umds tliat nrighl create a graplrical user element such
as U1e VB Script MsgBox() function. If it finds any of these functions, it displays a wanti11g message. Keep in 1ni nd
that scripts \Vill not nonnally be able to interact \riU1 the desktop en ironment on remote computers, n1eaning there
':vould be no \Vay for someone to respond to graphical elements such as MsgBox() or InputBoxO. Thus. these
ele1uents can cause the script to "hang" and stop respo11ding. RSEE does not perfom1 an exhaustive check for
graphical ele1nents: it is your responsibility lo ensure they're not used in your scripts. RSEE ' vill allow you lo
continue \Vitb graphical elements because you may have configured lhe RSEE service to interact \Vith the desktop
of U1e ren1ote computer. It's your decision.

Next is the RSEE Lat1nch dialog. The Launch dialog lists the computers \\here your script \Vill be deployed. Note
that tl1e Launch dialog a.l'vays preloads a default list of co1nputer11an1es at startup. Here's '\'hat you can do:

Click Launch lo run the sc1ipt on the computers "''hicb have a checklnark next to their na1ne.
Set or clear the cJ1eckbox next to one or inore computer na1nes. You can .leave nan1es in the list but clearing
their checkbox 'rill prevent RSEE f ro1n at1en1pting to run the script on them.
Click Close to close the Launc.11 dialog. Ifyou've changed the list of computer nan1es. yo111ll be prompted
to save your changes.
Use Load List and Save List to load an alternate list of computer names (from a text file) or saYe the current
list to a te:\.1 file. By default, Prima.lScript vvill look for a te}.1 file called Default.clt in the \SAPlEN\RSEE
Lists folder under your Documents folder. You \ Vill need to create the file youiself if you want a pre-loaded
list 'vhen you launchRSEE.
Use Select All and Unselect All to set or clear the checkbox next to all computer ruunes currently in the
list.
334 I PowerShell Studio - A Comprehensive Guide

Select a computer name and click Remove to remove it from the list.
Type a computer i1ame (1nust be resolvable to an IP address by your computer) or IP address and click +
to add that computer to the list
Specify a usernatne (user ID) and password. These will be used to run the script on tihe ren1ote con1puter,
and should generally 1natch the usen1a1ne that tl1e ren1ote RSEE senrice is usiJ1g to log in. Note: if the
usen1ame you specify is a local account on the remote computer(s). then just type tl1e use1name. If the
usen1rune is a do1nain account, specify the name in the fonnat user@domai11 The older domain\user format
is not supported.

When you click Launch, RSEE will execute the script on the ren1ote computer(s) . .Any output produced by the script
\vill be displayed in the Output tab vvithin the Po,.verSl1ell Stl1dio vvindovv. Note that the message "Socket connection
failed" i11dicates that RSEE was unable to connect to the RSEE service on a specified con1puter (eitl1erbecause the
co1nputer is not connected to the netvvork, bas a firewall blocking the RSEE service po1ts, or the RSEE seivice is
not installed).

RSEE deploys scripts asynchronously. That is, RSEE sends the sc1ipts out to th.e remote con1puters you've selected
and then displays \Vhatever results co1ne back. If your scripts produce no output, then you won't see any results in
PovverShell Studio.

It's possible for the RSEE seivice on a remote co111puter to n1n into a problem (particularly secu1ity-related ones)
that it can't report back: in these insta11ces, it vvill see1n to you (looking at PovverSbell Studio) as if nothing has
happened. Whenever possible, your sc1ipts should incorporate error-checking and -trappil1g: and should produce
appropriate output so that you get so1ne res1ilts back if the script executes conectly.

RSEE cannot be used to deploy a script for later execution. If you need to schedtile a script to execute on a remote
computer at a particular tin1e, use Windows' built-in Task Scheduler instead of RSEE. You can even write a script
utilizing the SCHTASKS.EXE comnw1d line tool tliat creates re1note scheduled tasks on multiple co1nputers.

Also. if an Output tab is already open in Po\verShell Studio, RSEE will utilize it rather tlian creating a nevv one.
You \!Vill need to 111anually select the tab to vie'v any RSEE results or error 1nessages.

RSEE Restrictions

In order to bring the output of re1note scripts back to your coinputer. U1e ren1ote RSEE senrice captl1res tl1e standard
conlffiand-line output of your scripts. That n1eans any sc1ipt output 1nust be created using the WScript.Echo 1nethod.
Do not use graphical user interface functions sucl1 as MsgBox() or InputBoxO. Because the RSEE se1vice doesn't
interact vvith the desktop, nobody will ever see these functio1is' dialog boxes and tl1e script vvill hang.

It is possible, if the RSEE service is .n1nning under the LocalSystem account, to configiue Wil1dows to allow the
service to interact with the desktop. You may vvish to e>..rperiment witl1 this configuration, but it is not a recom1nended
configuration because of the usual security restrictions on the LocalSystem account.

Also, avoid any object inethods-such as WScript.Popup-that create graphical elements.


PowerShell Studio - Reference Guide I 335

Any objects referer1ced by a script must be installed, registered, arid available on the rernote inachil1e where RSEE
executes tl1e script.

At tltis time, RSEE can only be used to execute Windo,vs Script Host scripts. RSEE explicitly launches scripts tmder
CScript.exe \Vhich must be available on the re1note computers.

Most otl1er restrictions in RSEE are actually Windows sectlrity restrictions. When the RSEE service launches, it
does so using the credentials you configure in Windo\.vs' service 111anager. When the RSEE service receives a script,
it creates a brar1d-ne\.v process usi11g whatever credentials you enter into tl1e RSEE Launch dialog. The following
figure illustrates this process a11d tl1e tlrree sets of credentials involved:

RSEE LAUNCH DIALOG SCRIPT


CREDENTIAL #2

SCRIPT
CREDENTIAL #2 USED

RSEE SERVICE
CREDENTIAL #3

Always bear in mind that your scripts execute under the sectlrit)' credentials you provide (Credentials #2 il1 the
diagra1n). Tltis process does require your attention, as several things can go \.Vrong if you're not careful:

If, in the Lau11ch dialog, you specify credentials (#2 il1 the diagrai11) that the RSEE se1v ice account (#3 in
the diagrain) doesn't have perntission to use in a ne'v process launch, then script execution will fail.

Practically speaki11g, the credentials you provide in the Lam1ch dialog (#2 in the diagram) need to be the same as
the credentials the RSEE service uses to log in (#3 in the diagTam).

If the RSEE service accotmt (#3 in the diagra1n) doesn't have appropriate rights (including "Log on as a
service"), tl1en the RSEE service will not be able to start.
If your script tries to do so1nething that the Launch credentials (#2 il1 the diagrain) don't have permission
to do-such as log into a database or access a file share-then you'll receive an error. Depending on the
exact situation, this may or may not be co1mnunicated back to you in PowerShell Studio.
If your script tries to pe1fonn an illegal operation-such as specifying alternate credentials in a WMI
connectio11 (which is illegal because the script is executing locally on the re1note macltine, ai1d local
connections to WMI aren't allowed to use alternate credentials)-you'll receive ai1 error. Again, depending
on the exact circumstances, this error inay or n1ay not be fed back to you in Po\verShell Studio.
336 I PowerShell Studio - A Comprehensive Guide

These and other similar situations are not problems 'vith RSEE; they are inherent conditions of the Windows
operating system ru1d its security subsyste1ns. Whenever you encounter an error with RSEE, bear these conditions
in inind and think about the possible security ramifications of what your script is trying to do.

RSEE encrypts scripts during trans1nission to help keep the1n secure. RSEE does not implement ru1y sort of IP
filtering capability ('vhich might, for exa1nple, allow you to ensure that only your co1nputer can utilize RSEE on
re1note servers). Instead~ \Ve reco1n111end using Windo\vs' o'vn built-in IP filtering (available as part of Windo,vs'
IPSec features) . Using this filtering,.you can ensure that only specified IP addresses are allo\ved to collllnunicate on
the TCP ports used by the RSEE service, thus restricting who can contact that service and utilize RSEE.

SINGLE THREADED APARTMENT (STA)

STA Mode - Single-threaded apartment. The default is multi-threaded apartment.

STA (Single Threaded Apartment) and MTA (Multi-Threaded Apartment) detennine how a process manages legacy
COM objects and tl1eir collllnunication with inultiple threads. I \Vill not go into the detail, but you need not concern
yourself 'vith the inner workings of COM objects, other than to reme1nber that STA is required for some of the GUI
controls to function correctly.

The follo"ving controls require STA mode. Othenvise, they do not appear.

FolderBrowserDialog
SaveFileDialog
OpenFileDialog

The follo\ving control features require STA mode.

TextBox with AutoC01npleteSource


Co1nb0Box with AutoC01npleteSource
DataGridView 'vith Ctrl + C to copy text in cells.
Form with TopJ\!fost property set to True.

STA mode is not so1nething you normally have to consider when writing scripts, but it is something that you should
be a'vare of if you are creating GUis tools. Most GUis will n111 fine in MTA mode, but as a rule, you should always
n1n your GUI scripts in STA

You can make sure that your Windows PowerShell scripts require STA vvhen running. If you add the
following comn?.ent to your script, PowerShell Studio and Prima/Script run the script in STA mode: #
o/oForceSTAo/o = True
PowerShell Studio - Reference Guide I 337

PSSCRIPTANAL YZER

~ Check Syntax PSSc1iptAnalyzer is a PowerShell 1nodule developed by the PowerSl1ell Tean1 at Microsoft
and checks the quality of Windo,vs PowerSl1ell code by n1nning against a set of rules. The
' ~ Venfy Salpt
ntles are based on PowerShell best practices which have been identified by the PowerShell
,, ~ Analyze Saipt team and PowerShell Co1n1nunity.
Analyszs
PSScriptAnalyzer is built into Po'\>verShell Studio for convenience of use, located lmder the
"Tools" tab, in the Analysis section, and na1ned "Analyze Script".

We you click on "Analyze Script", PSScriptAnalyzer will scan your Po"verShell code, and return a report of any
findings similar to the report below:

>> A!lalyzing Script (test.psf)


PSScriptAnalyzer 1.8.1
test.psf (233, 10): Warning: Function 'Update-OataGridView' has verb that could change system state. Therefore, the function has to support 'ShouldProcess'.
test.psf (70, 12): Warning: The C111dlet 'Get-OirectoryStats' uses a plural noun. A singular noun should be used instead.
test.psf (130, 29): Warning: 'select" is an alias of 'Select-Object'. Alias can introduce possible problems and make scripts hard to ~aintain. Please conside
test.psf (146, 29): warning: 'select is an alias of 'Select-Object. Alias can introduce possible problems and make scripts hard to maintain. Please conside
test.psf (177, 81): Warning: 'X' is an alias of "forEach-Object'. Alias can introduce possible problems and make scripts hard to maintain. Please consider ch
test.psf (300, 10): Warning: The cmdlet "load-OataGridView' uses an unapproved verb.
test.psf (446, 7): Warning: Empty catch block is used. Please use Write-Error or throw statements in catch blocks.
test.psf (6, 1}: Warning: The variable 'richtextbox8l_TextChanged" is assigned but never used.
test.psf (201, 1): warning: The variable 'textbox56_TextC~anged' is assigned but never used.
test.psf (209, 1): Warning: The variable 'textbox50_Enter' is assigned but never used.
test.psf (220, 1): warning: The variable 'textbox50_Leave' is assigned but never used.
test .psf (12, 2}: Warning: The variable 'buttonAnalyzefileShares_Click' is assigned but never used.
test.psf (23, 3): warning: The variable 'every' is assigned but never used.
test.psf (24, 3}: warning: The variable 'Fon11at"umbers' is assigned but never used .
>> Analyzing Script Cotr.pleted (14 items: 0 Errors, 14 Warnings, 0 Information)

SCRIPTPATH IN HOST

Many PowerShell users utilize code as shown belo"v to determine \.Vhere the running script resides:

219 function get-scriptdirectory{


220 $invocatioh=(get-variable Mylnvocation -Scope 1).Value
22 1 Split-Path $invocation.myinvocation.path
222}

Unfortunately, if the script nms inside a custon1 host, such as PowerShell Studio 's intenlal host, for a good
number of debuggers and the SAPIEN PowerShell host from the PowerShell Studio packager, the MyInvocation
variable contains an empt)r path member.

There is no docu1nented way to set My Invocation fro1n a custom host and any atten1pts contacting Microsoft iI1
this matter only resulted in confinnation that any atte1npt to do so would be ove1writte11 anyway. It see1ns
unreasonable to eA--pect the Po,verShell tea1n to change the API anytime soon. And even then, changing the current
behavior nlight prove m1desirable since it could potentially break existing scripts.

That of coluse leaves everyone implementing a custom host with a dile1nma. The SAPIEN Po"verSl1ell hosts no"v
all contain a variable called $Hostlnvocation \Vhich has the same interface as My Invocation and provides the
desired infoanation.
338 I PowerShell Studio - A Comprehensive Guide

So, if you are running your script inside any SAPIEN PowerShell host you can use code like tbis to determine
where your script is:

223 function get-scriptdire c tory{


224 if ($hostinvocation -ne null) {
225 Split-Path $hostinvocation .MyCommand.path
226}
227 else {
228 $invocation=(get-variable Mylnvocation -Scope 1).Value
229 Split-Path $invocation .myinvocation.path
230 }}

CONVERTING HEX# COLOR NUMBERS

There are ti1nes, especially when using the ColorDialog control and you need to translate the HEX# color i1m11ber
to a usable format for controls and fonns. If only basic colors are used, then the translation fro1n HEX# is not needed.
To translate the color picked from the ColorDialog control use the following example:

1 $buttonChangeColor_Click = {
2 # Open the ColorDialog Box
3 $colorDialogl .ShowDialog()
4 # Grab the color that the user selects
5 $BackColor = $colordialog l .Color.Name
6 #Translate the HEX# to a System Drawing Color for the Form Background
7 $BackColor = [System.Drawing.ColorTranslator]::FromHtml('#' + $BackColor)
8 # Apply the color to the form
9 $form l .BackColor = $BackColor }

REQUIRE ADMINISTRATOR

There are many times that you need your form to run with elevated privileges. The standard "vay has always been
to place the follo\iving code either at the start of your script, or at the start of the Fonn_Load event.
1 If (-NOT
([Security. Principa l. Windows Principal] [Security. Principal. Windowsldentity] ::G etCurren t() ) .lsln Role ( [
Security.Prin cipal. WindowsBuiltlnRole] "Administrator"))
2 {[void] [System.Windows.Forms.MessageBox]::Show('This form must be Run As Administrator!",
"Error Message")
3 $FORM l .close()
4 }
PowerShell Studio - Reference Guide I 339

NOTE: this is one of those rare occasions when code does not require that it be started by an event eitl1er directly
or indirectly.
If the user is not n1nning tl1e form as ad1ninistrator they will receive an error inessage popup, and the form will
close. Tbis inethod works "vith all PowerShell versions and provides you a ineans to display a custon1error111essage.
Beginning with PowerSbell 4.0 you cottld also use:
1 #requires -runasadministrator

NOTE: Keep in mind this will reqttire that all users that run your form '\ivill need to have at least PowerShell
version 4 installed.

CONTROL PROPERTIES

BUTTON

AccessibilityObject
Gets the AccessibleObject assigned to the control.
AccessibleDefaultActionDescription Gets or sets the default action description of the co11trol for use by
accessibility client applications.
AccessibleDescription Gets or sets tl1e description of the control used by accessibility client
applications.
AccessibleName Gets or sets the name of the control used by accessibility client
applications.
Accessible~ole Gets or sets the accessible role of the control
AllowDrop Gets or sets a value indicating \.vhetl1er the control can accept data that
the user drags onto it.
Anchor Gets or sets tl1e edges of the container to \Vhicl1 a control is bound and
determines how a control is resized with its parent.
AutoEUipsis Gets or sets a value indicating vt'hether the ellipsis character (... ) appears
at tl1e iight edge of tl1e control, denoting that the control text eA1:ends
beyond the specified length of the control.
AutoScrollOffset Gets or sets where tlus control is scrolled to in ScrollControllnto Vie\.v.
AutoSize Gets or sets a value that indicates whether the control resizes based on
its contents.
AutoSizeMode Gets or sets the mode by which the Button automatically resizes itself.
BackColor Gets or sets the background color of the control.
Backgroundlmage Gets or sets tl1e backgrotu1d image displayed in the control.
Background Im ageLayou t Gets or sets the background image layout as defined in the lmageLayout
ent101eration.
BindingContext Gets or sets the BindingContext for the control.
Bottom Gets the distance, in pi\:els, benveen the bottom edge of the control and
the top edge of its contai11er's client area.
Bounds Gets or sets tl1e size and location of the control il1cluding its nonclient
elements, in pixels, relative to the parent control.
340 I PowerShell Studio - A Comprehensive Guide

CanEuablelme Gets a value incticating whether the lmeMode property can be set to an
active value. to enable IME support.
CanFocus Gets a value indicating '~hetl1er U1e control can receive focus.
CanRaiseEvents Detennines if events can be raised on the control.
CanSelect Gets a value indicating \ V hetl1er the control can be selected.
Catlture Gets or sets a vaJue indicating \'V heU1er the control has captltred the
mouse.
CausesValidation Gets or sets a value indicating 'vhether the control causes validation to
be performed on any controls that require validation \vhen it receives
focus.
ClientRectan gle Gets the rectangle that represents the cliet1t area of the control.
ClientSize Gets or sets the 11eight and width of the client area of tl1e control.
Com1anyName Gets the ruun.e of the co1npru1y or creator of the application containing
the control.
Container Gets the IContainer that contains the Component.
ContainsFocus Gets a value indicating \vhether the co11trol, or one of its child controls.
currently has the input focus.
ContextMenu Gets or sets the shortcut men11 associated with the control.
ContextMenuStrip Gets or sets the ContextMenuStrip associated "'-itb thls control.
Controls Gets the collection of controls contained \\1ithin the control.
Created Gets a , ralue indicating whether the control bas been created.
CreateParams Gets a CreateParams on U1e base class 'vhen creating a 'vindo,v.
Cursor Gets or sets U1e cursor U1at is displayed \hen the mouse pointer is over
the control.
DataBindings Gets the data bit1dings for the control.
DefaultCursor Gets or sets the default cursor for the control.
Defau ltlmeMode Gets the default Input Method Editor (IME) mode supported by this
control.
DefaultMargin Gets the space. in pixels. that is specified by default bet,yeen controls.
DefaultMaximumSize Gets the length ruid heigl1t in pixels. tliat is specified as U1e default
maximun1 size of a control.
Defau ltMinimu mSize Gets the length and height in pixels. tliat is specified as the defa1tlt
111inin111m size of a control.
DefaultPadding Gets U1e internal spacing, in pixels, of tl1e contents of a control.
DefaultSize Gets the default size of the control.
DesignMode Gets a value that indicates ivl1ether the Co1nponent is currently in design
n1ode.
DialogResult Gets or sets a vaJue that is rettuned to the parent forn1 when the button
is clicked.
DisplayRectangle Gets the rectangle that represents the display area of the control.
Disposing Gets a value indicating \:vbether the base Control class is in tl1e process
of disposing.
Dock Gets or sets which control borders are docked to its parent co11trol and
determines ho':v a control is resized ':vith its parent.
Dou bleBuffered Gets or sets a value indicating \vhether this control should redravv its
surface using a secondary buffer to reduce or prevent flicker.
Enabled Gets or sets a value indicating \Vhether the control c ai1 respond to user
interaction.
PowerShell Studio - Reference Guide. I 341
[

Events Gets the list of event handlers tl1at are attached to this Component.
FlatAppearance Gets the appearance of the border and the colors used to indicate check
state and 1nouse state.
FlatStylc Gets or sets the flat style appearance of the button control.
Focused Gets a valu.e indicating whether the control l1as inpt1t focus.
Font Gets or sets the font of the text displayed by the control.
FontHeight Gets or sets the height of the font of the control.
ForeColor Gets or sets the foreground color of the control.
Handle Gets the window handle that the control is bound to.
Has Children Gets a value indicating whether the control contains one or more child
controls.
Height Gets or sets the heigl1t of the control.
Image Gets or sets the image that is displayed on a button control.
ImageAlign Gets or sets the alig1nnent of the ilnage on the button control.
lmagelndex Gets or sets the image list index value of the image displayed on the
button control.
lmageKey Gets or sets the key accessor for the i n1age in the ImageList.
lmageList Gets or sets the ImageList that contains the Image displayed on a button
control.
lmeMode This API supports the product infrastructure and is not intended to be
used directly from your code. Gets or sets the Input Method Editor
(IME) 1node supported by this control. This property is not relevant for
this class.
ImeModeBase Gets or sets the IME 1node of a control.
InvokeRequired Gets a value indicating \.Vhether tl1e caller must call an invoke 1nethod
\;vhen making method calls to the control because the caller is on a
different thread tllaD the one the control was created on.
lsAccessible Gets or sets a value il1dicating whether the control is visible to
accessibility applications.
lsDefault Gets or sets a value indicating wbetl1er tl1e button control is tl1e default
b11tton.
IsDisposed Gets a value indicating ':vhether the control bas been disposed of.
IsHandleC reated Gets a value indicating whether tl1e control has a 11andle associated v1ith
it.
lsMirrored Gets a value indicating whether the control is mirrored.
LayoutEngine Gets a cached instance of the control's layout engine.
Left Gets or sets the dista11ce, in pixels, between tl1e left edge of the control
and the left edge of its container's che11t area.
Location Gets or sets tl1e coordilla.tes of the upper-left corner of the control
relative to the upper-left corner of its container.
Margin Gets or sets the space benveen controls.
Ma.~imumSize Gets or sets the size that is the upper lin1it that GetPreferredSize can
specify.
MioimumSize Gets or sets the size that is tl1e lower Jimit that GetPreferredSize can
specify.
Name Gets or sets the name of the control.
Padding Gets or sets padding within the control.
Parent Gets or sets the parent container of the control.
342 I PowerShell Studio - A Comprehensive Guide

PreferredSize Gets the size of a rectangular area into 'vhicb the control can fit.
P roductName Gets the product nan1e of the assembly contai ning the control.
ProductVersion Gets the ~version of the assembly containing the control.
Recreatin gHandle Gets a value indicati11g whether the control is currently re-creating its
handle.
Region Gets or sets the \Vi11do'v region associated \Vith the control.
RenderRightToLcft Obsolete.This property is now obsolete.
ResizeRedra\v Gets or sets a value i.ndicating \Vhether the control redra,vs itseJf ivhen
resized.
Right Gets the distance, in pi.xels bet,veeu the right edge of the control and
the left edge of its container's clier1t area.
RigbtToLeft Gets or sets a value indicating whether control's elements are aligned to
support locales using right-to-left fonts.
ScaleCbildren Gets a value that determines the scaling of child co11trols.
SholvFocusCues Gets a value indicating whether the control should display focus
rectangles.
Sbo\\1Keyboard

Cues Gets a value indicating ~v.hether the user interface is in the appropriate
state to show or hide keyboard accelerators.
Site Gets or sets the site of tl1e control.
Size Gets or sets the height and \tVidth of the control.
TabIndex Gets or sets tl1e tab order of the control within its container.
TabStop Gels or sets a value indicating wl1ether U1e user can give the focus to
this control using the TAB key.
Tag Gets or sets the object that contaiI1s data about the control.
Te.~t Gets or sets the text associated \Vith this control
TextAJign Gets or sets the alignment of the text on the button control.
TextlmageRclation Gets or sets the position of text and image relative to each other.
Top Gets or sets the distance. in pixels, benveen the top edge of the control
and the top edge of its container's client area.
TopLevelControl Gets the parent control that is not parented by another Windows Fonns
control. Typically, this is the outermost Form that the control is
contained in.
U seComp atibleTextRendering Gets or sets a value that detennines 'vhelher to use U1e Graphics class
(GDI+) or the TextRenderer class (GDI) to render te~1.
UseMne.m onic Gets or sets a value indicating whether t11e first character that is
preceded by an ampersand (&) is used as the mnemonic key of the
control.
UseVisu alS tyleBackColo r Gets or sets a value that detennines if the backgrot1nd is dra,;vn using
visual styles. if supported.
U scW aitCursor Gets or sets a value indicating \vhether to use the 'vail cursor for the
current control and all child controls.
Visible Gets or sets a value indicating 'vhether t11e control and all its child
controls are displayed.
Width Gets or sets tl1e "vidlh of the control.
WindowTarget T.his API supports tl1e product infrastn1cture and is not intended to be
used directly from your code. This property is not releYanl for this class.
PowerShell St udio - Reference Guide I 343

CHART


Accessibil~rO bject Gets the AccessibleObject assigned to the control.
AccessibleDefaultActiooDescri1ltioo Gets or sets U1e defaull action description of the control for use by
accessibility client applications.
AcccssibleDescription Gets or sets the description of tl1e control used by accessibility client
applications.
AccessibleN ame Gets or sets the name of the control used by accessibility clienl
applications.
AccessibleRole Gets or sets the accessible role of the control
Allo"Dro1> Gets or sets a value indicating \vhetller the control can accept data that
the user drags onto it.
Anchor Gets or sets the edges of the container to \Vhich a control is bound and
dete.nnines h O\.Y a control is resized '''ith its parent.
Annotations Gets or sets the name of the control used by accessibility client
applications
Anti Aliasing Gets or sets a value that detennines \hether anti-aliasing is used \\ihen
tex.'t and graphlcs are drawn.
AutoScrollOffset Gets or sets ' vhere this control is scrolled to in ScrollControlintoVie,v.
AutoSize Gets or sets a alue that i11dicates \Vhether the control resizes based on
its contents.
BackColor Gets or sets the backgrotmd color of the control
BackGrad ientS tyle Gets or sets the orientation for the background gradient of a Chart
control. Also. determines \Vhether a gradient is used.
Backgroundlmage Gets or sets the backgrotmd image displayed in the control.
Backgrou ndlmageLayout Gets or sets the background image layout as defined it1 the ImageLayout
enumeration.
BackBatchStvle

Gets or sets the hatching sty le of the Chart control.
Backlmage Gets or sets the background ilnage of the Chart control.
BacklmageAlignment Gets or sets the background image alignment used for the Unscaled
dra,ving tnode.
BacklmageTranspareotColor Gets or sets the color of the Chart control that will be displayed as
transparent.
BacklmageW ra1>Mode Gets or sets the dra\ving rnode for the background image of the Chart
control.
BackSecondarvColor

Gets or sets the secondary color of the chart backgrolUld.
BindingContext Gets or sets tl1e BindingContext for the control.
BorderColor This API supports the product infrastructure and is not intended lo be
used directly from your code. Gets or sets the color of the chart border.
BorderDashStyle

Gets or sets the style of U1e border.
Bo rderLineColor Gets or sets the color of the border line.
BorderLineDashStyle Gets or sets the style of the border line.
BorderLineWidth Gets or sets the \Vidtl1 of the border fu1e.
BorderSkin Gets or sets a BorderSkin object. which provides border skin
functionality for the Chart control.
BorderWidth This API supports tl1e product infrastructure and is not intended to be
ltsed directly from your code. Gets or set s the "'tidth of the chart border.
344 I PowerShell Studio - A Comprehensive Guide

Bottom Gets the distance, iu pixels, benveen the botton1 edge of the control and
the top edge of its co11tainer's client area.
Bounds Gets or sets the size and Location of the control including its nonclient
elements, in pixels, relative to the parent control.
BuildNumber Tllis API supports the product i1lfrastn1cture and is not intended to be
used direcUy from your code. Gets U1e build number of U1e Cliart
control.
CanEoablelme Gets a value indicating \Vhether the ImeMode property can be set to an
active value, to enable 1ME support.
Can Focus Gets a value indicating \Vhetber the control can receive focus.
CanRaiseEveots Detennines if events can be raised on t11e control.
Can Select Gets a value indicating whether the control can be selected.
Capture Gets or sets a value indicating \Vbether tbe control has captured the
111ouse.
Cau sesValidation Gets or sets a value indicating whether the control causes validation to
be performed on any controls that require validation \Vhen it receives
focus.
ChartAreas Gets a read-only ChartAreaCollection object that is used to store
CbartArca objects.
ClientRectaogle Gets the rectangle that represents the client area of the control.
ClientSize Gets or sets the height and width of the client area of the control.
CompanyName Gets the name of the company or creator of the application containing
the control.
Container Gets the IContainer that contains the Component.
ContainsFocus Gets a value indicating ' vhether the control, or one of its cllild controls,
currently has the iJ1put focus.
ContextMenu Gets or sets the shortcut menu associated \.Vilh the control.
ContextMenuStrip Gets or sets the ContextMenuStrip associated \vitl1 tllis control.
Controls Gets the collection of controls contained ,;vithin the control.
1

Created Gets a value indicating whether tl1e control has been created.
CreateParams Gets a CreateParan1s on the base class \Vhen creating a \Vindo,v.
Cursor Gets or sets the cuJsor lhat is displayed \Vhe11 the n1ouse pointer is over
the control.
DataBindings Gets the data bindings for the control.
DefaultCursor Gets or sets the default ctrrsor for tl1e control.
DataManipulator Gets a DataManipulator object that provides methods and properties
that handle data.
DataSource Gets or sets the data source for the Chart object.
DefaultimeMode Gets t11e default Input Method Editor (IME) mode supported by this
control.
DcfaultMargin Gets the space. in pixels, that is specified by default benveen co11trols.
DefaultMa1imumSize Gets the length and height, in pL'{els. that is specified as U1e default
maximUln size of a co11trol.
DefaultMioimu mSize Gets the length and height in pLxels. that is specified as the default
1ni nin11rm size of a control.
DefaultPadding Gets the internal spacing, in pixels, of the contents of a control.
DefaultSize Gets the default size of the control.
PowerShell Studio - Reference Guide I 345

DesignMode Gets a value that indicates whether the Component is currently in design
n1ode.
DialogResult Gets or sets a val.ue that is returned to the pare11t fonn 'vhen the button
is clicked.
DisplayRectangle Gets the rectangle that represents the display area of the control.
Disposing Gets a value indicating ivhether the base Control class is in the process
of disposing.
Dock Gets or sets 'vhich control boiders are docked to its parent control and
detenniJ1es ho'v a control is resized 'vitl1 its parent.
DoubleBuffercd Gets or sets a value indicating "vl1ether this control should redra,;v its
surface using a secondary buffer to reduce or prevent flicker.
Enabled Gets or sets a value indicating 'vhether the control can respond to user
interaction.
Events Gets the list of event hru1dlers that are attached to Ulis Component.
Focused Gets a value indicating " hether the control has input focus.
Font Gets or sets the font of the text displayed by ll1e control.
FontHeight Gets or sets the height of the font of the control.
ForeColor Gets or sets the foreground color of the control.
Handle Gets the ivindo"' handle U1at the control is bound to.
HasChildren Gets a value indicating 'vhether the control contains one or n1ore child
controls.
Height Gets or sets the height of the control.
Images Gets or sets fue image that is displayed on a button control.
lmeMode This API supports the product infrast1ucture and is not intended to be
used directly from yom code. Gets or sets the Input Method Editor
(IME) 1node supported by this control. This property is not relevant for
this class.
ImeModeBase Gets or sets the IME mode of a control.
InvokeRequiretl Gets a value indicating 'vhellier the caller n1ust call an invoke method
when making method calls to the control because the caller is on a
different thread than the one the control 'vas created on.
IsAccessible Gets or sets a value indicating 'vhether the control is visible to
accessibility applications.
IsDisposed Gets a value indicating ':vhelher the control has been disposed of.
IsHandleCreated Gets a value indicating whether the control has a handle associated \ViU1
it.
IsMirrored Gets a value indicating whether the control is n'rirrored.
IsSoftSbadOlVS Gets or sets a flag that detennines if a smootll gradient is applied when
shado,vs are dra,v11
LayoutEngine Gets a cached insta11ce of the control's layout engine.
Left Gets or sets the distance, ill pi~els between the left edge of the control
and the left edge of its container's client area.
Legends Gets or sets a LegendCollectior1 tliat stores all Legend objects 11Sed by
the Chart control
Location Gets or sets the coordinates of the upper-left comer of the control
relative to the upper-left comer of its container.
Margin Gets or sets the space beh~1 een co11trols.
MaximumSize Gets or sets the size that is the upper linlit that GetPreferredSize can
specify.
346 I PowerShell Studio - A Comprehensive Guide

MinimumSize Gets or sets the size that is the lower limit that GetPreferredSize can
specify .
Name Gets or sets the nan1e of the control.
Padding Gets or sets padding "vithin the control.
Palette Gets or sets the palette for the Chart control.
PaletteCustomColors Gets or sets an array of custom palette colors.
Parent Gets or sets the parent container of the control.
PreferredSize Gets the size of a rectangular area into "vhich the co11trol can fit.
Printing Gels a read-only PrintingMru1ager object used for printing a chart.
ProductName Gets U1e product name of the assembly containing the control.
ProductVersion Gets the version of the asse111bly containing the control.
RecreatingHandle Gets a value indicating \Vhelher the control is currently re-creating its
hru1dle.
Region Gets or sets the \Vindo\v region associated with t11e contTol.
RenderingD1>iX This API supports the product infrastn1cture and is not intended to be
used directly from your code. Gets or sets the 11orizontal resolution of
the Chart renderer.
Renderin gDpiY Gets or sets the vertical resolution of the Chart renderer.
RenderRightToLeft Obsolete.This property is now obsolete.
ResizeRedraw Gets or sets a value indicating whether the control redra,vs itself when
resized.
Right Gets the distance, in pi.'<els, benveen the right edge of the control and
the left edge of its container's client area.
RightToLeft Gets or sets a value indicating whether control's elements are aligned to
support locales using right-to-left fonts.
ScaleChild ren Gels a value that determines the scaling of child controls.
Scrializer Gets a ChartSerializer object Uiat is used for chart serialization.
Series Gets a SeriesCollection objecL which contains Series objects.
Sho"'FocusCues Gets a value indicating "vhether the control should display focus
rectangles.
ShowKeyboardCues Gets a value indicating v.rhether the user interface is in the appropriate
state to sho\v or hide keyboard accelerators.
Site Gets or sets the site of the co11trol.
Size Gets or sets the height aJld width of the control.
SuppressExceptions Gets or sets a flag that detennines \vhether non-critical exceptions
should be suppressed.
TabIndex Gets or sets the tab order of the control ,,,;thin its container.
TabStop Gets or sets a value indicating whether the user ca11 give the focus to
this control using the TAB key .
Tag Gets or sets the object that contains data about the control.
Text Gets or sets the text associated \Vith this control.
TextAntiAIiasingQu ality Gets or sets the TextA.11tiAliasingQuality type to use 'vhen applying
anti-aliasing to text.
Titles Gets or sets a TiUeCollection object that is used to store all Title objects
used by tl1e Chart control.
Top Gets or sets the distance in pixels. between the top edge of the control
ru1d the top edge of its container's client area.
PowerShell Studio - Reference Guide I 347

To1>LevelControl Gets the parent control that is not parented by another Windo\vs Fom1s
control. Typically, this is the outermost Form that the control is
contained in.
UseWaitCursor Gets or sets a value it1dicating \hether to use the vvait cursor for the
curre11t control and all child controls.
Visible Gets or sets a value indicating \Vhether the control and all its child
controls are displayed.
Width Gets or sets the width of the control.
WindowTarget This API supports the product infrastructure and is not intended to be
used directly from your code. This property is not relevant for this class.

CHECKBOX

PROPERTY DESCRIPTION
ActualHeight Gets the rendered height of this ele1nent.
ActualWidth Gets the rendered widtl1 of this element.
AJlowDrop Gets or sets a value iJ1dicating vvhether tlris element can be used as the
target of a drag-and-drop operation. This is a dependency property.
ArcAnyTouchcsC a1l tu red Gets a value that indicates 'vhether at least one touch is captured lo this
element.
AreAnyTouchesCapturedWithin Gets a value that indicates whether at least one touch is captured to this
ele1nent or to a11y child ele1nents in its visual tree.
ArcAnyTouchesDirectlyOver Gets a value that indicates 'vhether at least one tot1ch is pressed over this
element.
AreAnyToucbesOver Gets a value that indicates \Vhetber at least one toucl1 is pressed over tlris
element or any clrild elements in its visual tree.
Background Gets or sets a b1ush that describes tbe background of a control.
BindingGrou1l Gets or sets the BindingGroup that is 11sed for the element.
Bitm apEffect Obsolete.Gets or sets a bitinap effect U1at applies directly lo the rendered
content for this element. This is a dependency property.
Binn apEffectlnpu t Obsolete. Gets or sets an input source for the bitmap effect tl13t applies
directly to the rendered content for this element. Tlris is a dependency
property.
Bo1-clerBrush Gets or sets a brush that describes the border backgrotu1d of a co11trol.
Bo rderTh ickness Gets or sets the border tllickness of a control.
CacheModc Gets or sets a cached representation of the UIEle111ent.
ClickMode Gets or sets "hen the Click event occurs.
Clip Gets or sets U1e geotnetry used lo define the outline of the contents of an
ele1nent. This is a dependency prope1ty.
ClitlToBounds Gets or sets a value indicating whether to clip the content of this element
(or content coining from the child elements of this eleme11t) to fit into the
size of ll1e containing element. This is a dependency pl2P_erty.
Command Gets or sets the con1mand to invoke \Vl1en this button is pressed.
CommandBindings Gets a collection of ConunandBinding objects associated with this
element. A Com1nandBinding enables command handlingfor this
348 I PowerShell Studio - A Comprehensive Guide

PROPERTY DESCRIPTION
element, and declares ilie linkage between a command~ its events, and the
handlers attached by this element.
CommandParamcter Gets or sets the parameter to pass to the Conunand property.
Command Target Gets or sets the element on which to raise the specified corn1nand.
Content Gets or sets the conlent of a ContentContTol.
ContentStringFormat Gets or sets a composite string that specifies 11ow to fom1at U1e Content
property if it is displayed as a string.
ContentTemplate Gets or sets the data template used to display the content of U1e
ContentControl.
ContentTemp lateSelector Gets or sets a ten1plate selector that enables all application 'vriter to
provide custom template-selection logic.
Co ntextMenu Gets or sets the context n1enu element tliat should appear ,~henever the
context n1enu is requested through user interface (U1) from within tlris
ele1nent.
Cursor Gets or sets the cursor that displays "1hen the mouse pointer is over this
element.
Data Context Gets or sets the data conte:\.1 for an element " 1l1en it participates in data
binding.
Defau JtStyleKev

Gets or sets the key to use to reference the style for this control. 'vhe11
then1e styles are used or defined.
DepcndencyObjectTyJlC Gets the DependencyObjectType that \vraps the CLR type of this
instance.
DesiredSize Gets the size that this element computed during the measure pass of the
layout process.
Disflatchcr Gets the Dispatcher tlris DispatcherObject is associated \Vith.
Effect Gets or sets the bitniap effect to apply to U1e UIElement. This is a
dependency property.
Flo,, Direction Gets or sets the direction that text ru1d other user interface (UI) ele111ents
flo'v '~iU'lin any parent ele1nent t11at controls tl1eir .layout.
Focusable Gets or sets a value U1at indicates whether the element can receive focus.
This is a dependency property.
FocusVisuals tyle Gets or sets a property that enables customization of appearance, effects,
or other style characteristics that will apply to Uris elen1ent \vhen it
capttrres keyboard focus.
FontFamily Gets or sets the font faurily of the control.
FontSize Gets or sets the font size.
Fonts tretcb Gets or sets the degree to whicl1 a fo11t is condensed or e:x.'J)anded on the
screen.
FontStyle Gets or sets the font style.
FontWeight Gets or sets U1c 'veight or thickness of the specified font.
ForceCursor Gets or sets a value U1at indicates whether this Frame\vorkElement
should force the user interface (UI) to render the cuJsor as declared by U1e
Cursor property.
Foregrottod Gets or sets a brush tl1at descnbes the foregrotLnd color.
HandlesScrolling Gets a value that indicates 'vhether a control supports scrolling.
HasAnimatedPrope11ies Gets a value indicating \Vhether this element has any a11in1ated properties.
Has Content Gets a value that indicates \vheil1er the ContentConuol contains content.
HasEffectiveKe~boardFocus Gets a value that indicates ,;vhether the UIElement has focus.
Height Gets or sets tl1e suggested 11eigl1t of the element.
PowerShell Studio - Reference Guide I 349

PROPERTY DESCRIPTION
HorizontalAlignment Gets 01 sets the horizontal alignment characteristics applied to this
element when it is composed within a parent element. such as a panel or
items control.
HorizontaJContentAlignment Gets or sets the ho1izontal alignme11t of the conhol's conte11t.
InheritanceBehavior Gets or sets lhe scope limits for property value inheritance, resource key
loo.k11p. and RelativeSource FindAncestor lookup.
InputBindings Gels Lhe collection of input bindings associated \Vi.th t11is cle1nent.
In1>utScope Gets or sets the contex.1 for input used by this FrameworkElement.
IsArrangeVaJid Gets a value indicating whether the co1nputed size and position of child
elements in this element's layout are valid.
IsChecked Gets or sets \Vltelber the ToggleButton is checked.
IsEnabled Gets or sets a value indicating vvheU1er tllis elerne11t is enabled in the user
interface (Ul). Tllis is a dependency property.
lsEnabledCore Gets the value of the IsEnabled property.
IsFocused Gets a value that detennines \lvhether this element has logical focus. This
is a dependency property.
lsHitTestVisible Gets or sets a value that declares \Vhether this element can possibly be
retun1ed as a hit test result fron1 so1ne portion of its rendered content.
This is a dependency property.
IsInitialized Gets a value U1at indicates vvbether Lhis e.le1nent has been initialized.
either dl1ring processing by a XAML processor. or by e:\.rplicitly having
its Endlnit n1ethod called.
lslnputMethodEnabled Gets a value indicating \vhether an input method system. such as an Input
Metl1od Editor (Il\1E), is enabled for processing U1e input to this element.
IsKeyboardFocused Gets a value indicating \Vhether tllis ele1nent has keyboard focus. Tllis is
a dependency property.
IsKe, 1boardFocu sWithin Gets a value indicating \vl1ether keyboard focus is anyvvhere \\rithin the
element or its visual tree child elements. This is a dependency property .
IsLoaded Gets a value that indicates vvhether this e.le1nent has been loaded for
presentation.
IsManipulationEnabled Gets or sets a value that indicates whether manipulation eve11ts are
enabled on this UIElen1ent.
lsMeasu reValid Gets a value indicati11g whether the cu1Tent size returned by layout
measlrre is valid.
lsMouseCapmred Gets a value indicatil1g \Vhether the mouse is captured to tlris elen1ent.
This is a dependency property.
lsMouseCaptu reWithin Gets a value lJ1at detennines whether inouse capture is held by this
element or by child elements in its visual tree. Tllis is a dependency
property.
IsMouscDirectlyOver

Gets a value that indicates whether tl1e position of the mouse pointer
corresponds to hit test results. which take element compositing into
account. This is a dependency property.
lsMotiseOver Gets a value indicating whether the mouse pointer is located over tlris
element (including child elements in the visual tree). This is a
dependency property.
lsPressed Gets a value that indicates whether a ButtonBase is c1trrently activated.
lsSealed Gets a value that indicates \;vbether this instance is c1uTently sealed (read-
only).
350 I PowerShell Studio - A Comprehensive Guide

PROPERTY DESCRIPTION
IsS tylusC aptured Gets a value indicating "vhether the stylus is captured by this element.
This is a dependency property.
IsStyJusCaptu_reWithin Gets a value that detem1ines whether stylus capttrre is held by this
e1e111ent, or an element \vithiJ.1 the ele1ne11t bounds and its visual tree. This
is a dependency property.
lsStvlu

sDi rectlyOver

Gets a value that indicates \vhether the stylus position co1Tesponds to hit
test resltlts. \vhich take element compositing into accoWlt. This is a
dependency property.
lsStylusOvcr

Gets a value indicating whether the stylus cursor is located over this
elen1ent (including visual child ele1nenls). This is a dependency property.
IsTabSto1> Gets or sets a value that indicates whether a control is included in tab
navigation.
IsTllreeState Dete1nrines \hether the control suppo1ts two or three states.
IsVisible Gets a value indicating whether this element is visible it1 the user
interface (Ul). This is a dependency property.
Language Gets or sets localization/globalization language illfo11natio11 that applies
to an ele1nent.
LayoutTransform Gets or sets a graphics transformation that should apply to this element
when layout is performed.
Logical Child rcn Gets an entunerator to the content control's logical child elements.
Margin Gets or sets the outer inargin of an element.
MaxHeight Gets or sets the ina~1num height constraint of the element.
MaxWidth Gets or sets the maximum '""idtb constraint of the element.
MinHeigbt Gets or sets t11e mini1nm11 height constraint of the elen1ent.
MinWidth Gets or sets the m.i:nilnmn width constraint of the element.
Name Gets or sets the identifying name of the element. The naine provides a
reference so that code-behind, such as event handler code. can refer to a
inark-up element after it is consti11cted duiit1g processing by a XAM1.,
processor.
Opacity Gets or sets the opacity factor applied to the entire UIEle1nent when it is
rendered in tl1e user interface (Ul). This is a dependency property.
OpacityMasi{ Gets or sets an opacity mask, as a Bn1sl1 implementation that is applied to
any aJpha-cliannel 1nasking for the rendered content of tltis ele1nent. This
is a dependency property.
OveITidesDefauJtStyle Gets or sets a value that indicates whether tltis ele1nent incorporates sty le
properties from theme styles.
Padding Gets or sets t11e padding inside a control.
Parent Gets the logical pare11t element of this element.
Persistld Obsolete.Gets a value that uniquely identifies this element.
RenderSize Gets (or sets, but see Remarks) the final render size of tltis element.
RenderTransform Gets or sets transform information that affects the rendering position of
this elen1e11t. This is a dependency property.
RenderTransform Origin Gets or sets the center point of any possible render transfonn declared by
RenderTransfonn. relative to U1e bounds of the elen1en.t. This is a
dependency property.
Resources Gets or sets the locally-defined resource dictionary .
Sna1>sT0DevicePixels Gets or sets a value that detem1ines \Vhether rendering for this ele1nent
should use device-specific pixel settings during re11dering. This is a
dependency property.
PowerShell Studio - Reference Guide I 351

PROPERTY DESCRIPTION
Style

Gets or sets the style used by this element '''hen it is rendered.
StJlu sPluglns Gets a collection of all stylus plug-in (custon1ization) objects associated
\vith this ele111ent.
Tab Index Gets or sets a value that determines the order in which elements receive
focus when tl1c user navigates Ulfough controls by using the TAB key.
Tag Gets or sets an arbitrary object value that can be used to store custom
infonnation about this ele1nent.
Template Gets or sets a control template.
TemplatedParent Gets a reference to the template parent of this element. This property is
not relevant if the ele1nent was not created through a template.
ToolTip Gets or sets the tool-tip object that is displayed for this element in the
user interface (UT).
TouchesCaptured Gets all toucl1 devices tlIBt are captured to this element.
TouchesCaptu redWithin Gets all touch devices that are capluTed to this element or any child
elements in its visual tree.
TouchesDirectlyOver Gets all touch devices that are over this element.
TouchesOvcr Gets all touch devices that are over this eleinent or auy child ele1nents in
its visual tree.
T rj ggers Gets the collection of triggers established directly on this eleme11t or in
child ele1nents.
Uid Gets or sets tl1e turique identifier (for localization) for Uris element. This
is a dependency prope1ty.
UseLayoutRounding Gets or sets a value that indicates whether layout rounding should be
applied to this element's size and position during layout.
VerticaJAJignmeut Gets or sets the ve1tical alig111nent characteristics applied to tllis ele1nent
\Vben it is coniposed \Vithin a parent elen1ent such as a panel or ite111s
control.
VerticalContentAlignment Gets or sets U1e vertical alignment of the control's content.
Visibility Gets or sets the user i11terface (UT) visibility of this elen1enl. This is a
dependency property.
VisuaIBitmapEffect Obsolete. Gets or sets the BitmapEffect value for the Visual.
VisualBitmapEffectlnput Obsolete. Gets or sets the Bit:JnapEffectlnput value for the Visual.

VisualBitmapScatingMode Gets or sets the BitmapScalingMode for lhe Visual.


VisualCacbeMode Gets or sets a cached representation of tl1e Visual.
VisualChildrenCount Gets the number of viSl1al child elements \vitllin this element.
Visu alClearTypeHint Gets or sets the ClearTypeHint that deten1rines ho, ClearType is
rendered in the Visual
VisualCli1l Gets or sets the clip regio11 of the Visual as a Geo111etly value.
VisualEdgeMode Gets or sets the edge n1ode of the Visual as an EdgeMode value.
V.i suaJEffect Gets or sets the bitmap effect to apply to the Visual.
Visual Offset Gets or sets the offset value of lhe visual object.
Visual Opacity Gets or sets the opacity of the Visual.
VisuaIOpacityMask Gets or sets the Bn1sh value that represents the opacity mask of the
Visual.
VisualParent Gets U1e visual tree parent of the visual object.
VisuaJScrollableAreaClip Gets or sets a clipped scrollable area for tl1e Visual.
VisuaITextHintingMode Gets or sets the TextHintingMode of the Visual.
352 I PowerShell Studio - A Comprehensive Guide

PROPERTY DESCRIPTION
-------
VisuaJTextRenderingMode Gets or sets the TeA-1RenderingMode of the Visual.
Visual Transform Gets or sets the Transform value fo r the Visual.
VisualXSnappingGuidelines Gets or sets the x-coordinate (vertical) guideline collectio11.
VisualYSnap11ingGuidelines Gets or sets the y-coordb.1ate (horizontal) guideline collection. ------<
Width Gets or sets tl1e width of the element.

CHECKEDLISTBOX

AccessibilityObject
. - .
Gets the AccessibleObject assigned to the control.
AccessibleDefaultActionDescription Gets or sets the default actio11 desc1iption of the control for use by
accessibility client applications.
AccessibleDescription Gets or sets the descriptio11 of the control used by accessibility clie11t
applications.
AccessibleName Gets or sets the nan1e of the control used by accessibility client
applications.
AccessibleRole Gets or sets the accessible role of the control
Allo,vDrop Gets or sets a value indicating whetl1er the control can accept data that
tl1e user drags onto it.
Allo,vSelection Gets a value indicating \Vhether the ListBox currently enables
selection of list iten1s.
Anchor Gets or sets the edges of the container to which a control is bound and
detemlines how a control is resized \ith its parent.
AutoScrollOffset Gets or sets where this control is scrolled to in ScrollControllnto Vie\.v.
Auto Size This API suppo11s the product infrastructure and is i1ot intended to be
used directly fro111 your code. This prope11y is not releva11t for this
class.
BackColo.r Gets or sets the backgTound color for the control.
Bacl<groundlmage This API supports the product infrastructlrre and is 11ot intended to be
used directly from your code. This property is not relevru1t to this
class.
BackgroundlmageLayout This API supports the product infrastructure and is i1ot intended to be
used directly from your code. Gets or sets the background image
layout for a ListBox as defined in the ImageLayout en1uneration.
BindingContext Gets or sets the BindingContext for the control.
BorderStyle

Gets or sets the type of border that is drawn around tl1e ListBox.
Bottom Gets the distance, in pixels, between tJ1e botto1n edge of the control
and the top edge of its container's client area.
Bounds Gets or sets the size and location of the control including its nonclient
elements, in pixels, relative to the parent control.
CanEnablelme Gets a value indicating \V hether the lmeMode property can be set to an
active value, to enable IlvlE support.
CanFocus Gets a value indicating whether the control cai1 receive focus.
CanRaiseEvents Determines if events can be raised on the control
Can Select Gets a value indicating "vhether the control can be selected.
PowerShell Studio - Reference Guide I 353

Capture Gets or sets a value indicating \Vhether the control has captured the
1nouse.
CausesValidation Gets or sets a value indicating \Vhetber the control causes validation to
be performed on any controls that require validation \vben it receives
focus.
Checkedlndices Collection of checked indexes in tllis CheckedListBox.
Checkeditems Collection of checked items in this CJ1eckedListBox.
CbcckOoCHck Gets or sets a value indicating \Vhether the check box should be
toggled \hen an ite111 is selected.
ClieotRectan gle Gets the Iectangle that represents the client area of the control.
C lieotSize Gets or sets the height and \Vidth of the client area of the control.
ColumnWidth Gets or sets the \Vidth of colmnns in a multicoJwnn ListBox.
Com 1>an~rN ame Gets the 1ian1e of the company or creator of the application containing
the control.
Container Gets the !Container that contains the Component.
Contain,SFocus Gets a value indicating \vhether the controL or one of its child
controls. currently has tl1e input focus.
CootextMenu Gets or sets the shortcut menu associated with the control.
ContextMenuStrip Gets or sets t11e ContextMenuStrip associated \Vith Olis control.
Controls Gets the collection of co11trols contained 'vithin the co11trol.
Created Gets a value indicating \vhetber the control has been created.
CreateParams Gets the required creation parameters \Vhen the control handle is
createcl
Cursor Gets or sets tJ1e cursor that is displayed when the mouse pointer is
over the control.
Custom Tab Offsets Gets the \Vidth of the tabs bet,veen the items in the ListBox.
DataBindings Gets the data bindings foI the control.
DataManager Gets the CurrencyManager associated with this control.
DataSourcc Gets or sets the data soruce for the control.
Defau ltCu r so r Gets or sets the default cursor for the control.
DefaultlmeMode Gets the default I11put Method Editor (IME) mode supported by the
control
DefaultMargin Gets the space. in pixels. that is specified by default between controls.
DefaultMaximumSize Gets U1e lengU1 and height in pixels, that is specified as tJ1e default
niaxitnun1 size of a control.
DefaultMinimumSize Gets the lengtl1 and heighL in pixels, that is specified as the default
rninimum size of a control.
DefaultPadding Gets the internal spacing. in pL'{els. of the contents of a control.
DefaultSize Gets the default size of the control.
DesignMode Gets a value tl1at indicates \.Ybether the Co1nponent is currently in
design mode.
DisplayMember Gets or sets a string that specifies a property of the objects contained
in tl1e list box ~r bose conte11ts you \Vant to display.
DisplayRectangle Gets the rectangle that represents tl1e display area of the control.
Disposing Gets a value indicating \Vhether the base Control class is in tl1e process
of disposing.
Dock Gets or sets which control borders are docked to its parent control and
deten1rines how a control is resized ~itl1 its parent.
354 I PowerShell Studio - A Compre he nsive Guide

DoubleButfered Gets or sets a value indicating whether th.is control should redra\v its
surface using a secondary buffer to reduce or prevent flicker.
DralvMode This API supports the product infrastn1cture and is not intended to be
used directly from your code. Gets a value indicating the mode for
drawing elements of the Cl1eckedListBox. This property is not
relevant to tllis class.
Enabled Gets or sets a vaJue indicating Vi'hether tl1e control can respond to user
interaction.
Events Gets the list of event handlers that are attached to this Co1nponent.
Focused Gets a value indicating \hether the co11trol has input focus.
Font Gels or sets the font of the text displayed by the control.
FontHeight Gets or sets the height of the font of the control.
ForeColor Gets or sets the foreground color of the control.
Format.Info Gets or sets the IFormatProvider tl1at provides custom formatting
behavior.
ForrnatString Gets or sets the fom1at-specifier c11aracters that indicate ho' v a value is
to be displayed.
FormattingEnabled Gets or sets a value indicating '1Yhether fonnatting is applied to the
DisplayMen1ber property of tl1e ListControl.
Handle Gels the window handle t11at the control is bound to.
Has Children Gets a value indicating \Vhether the control contains one or more child
controls.
Height Gets or sets the height of tl1e control.
HorizontaJExtcnt Gets or sets the \vidth by 'vhich the horizontal scroll bar of a ListBox
can scro.ll.
HorizontalScrollbar Gets or sets a value indicating "\\'hether a horizontal scroll bar is
displayed in tl1e control.
ImeMode Gets or sets the Input Method Editor (IME) mode of the control.
ImeModcBase Gets or sets the IME mode of a control
IntegralHeigbt Gets or sets a value indicating \hether the control should resize to
avoid showing partial items.
InvokeRequired Gets a value indicatingwhetl1er the caller must call an invoke met11od
when making method calls to the control because t11e caller is on a
different Urread lhan the one the control \Vas created on.
IsAccessible Gets or sets a value indicating \\'heU1er the control is visible to
accessibility applications.
lsDisposed Gets a value indicating \Vhether the control has been disposed of.
lsHandleCreated Gets a value indicating \vhether the control bas a handle associated
witl1 it.
lsMirrored Gets a value indicating whether tl1e control is mirrored.
ltemHeight Gets the height of the item area.
Items Gets the collection of ite1ns in this CheckedListBox.
LayoutEngine Gets a cached instance of the control's layout engine.
Left Gets or sets the dista11ce. in pixels. bet'1veen the left edge of the control
and the left edge of its container's client area.
Location Gets or sets the coordinates of the upper-left corner of the control
relative to the upper-left comer of its container.
Margin Gets or sets U1e space bet1veen controls.
PowerShell Studio - Reference Guide. I 355

MaximumSize Gets or sets the size that is the upper lirnit that GetPieferredSize can
specify.
MinimumSize Gets or sets the size that is tl1e lo,ver limit that GetPreferredSize can
specify.
MultiColu mo Gets or sets a value indicating whether the ListBox supports multiple
coln1nns.
Name Gets or sets the name of the control.
Padding Gets or sets padding within the CheckedListBox. This property is not
relevant to this class.
Parent Gets or sets the pare11t container of the control.
Pret'erredHeight Gets the combined heigl1t of all items in the ListBox.
PreferredSize Gets the size of a rectangular area into 'tV.hich the control ca11 fit.
ProductName Gets the product naine of the assembly contailting the control.
ProductVersion Gets the version of the assembly containing the control.
Recreatin gHancUe Gets a value indicating \hether the contTol is currently re-creating its
handle.
Region Gets or sets the \Vil1dovv region associated with the control.
RenderRightToLeft Obsolete.This property is no'v obsolete.
ResizeRedraw Gets or sets a value indicating wl1ether the control redraws itself when
resized.
Right Gets the distance, in pixels, between the right edge of the control and
the left edge of its container's client area.
RightToLeft Gets or sets a value indicating whether text displayed by the control is
displayed from right to left.
ScaleChildren Gets a value that detennines the scaling of child controls.
ScrollAl,vaysVisible Gets or sets a value indicating whether the ve1tical scroll bar is sho,;vn
at all times.
Selectedlndex Gets or sets the zero-based index of the currently selected iten1 in a
ListBox.
Selectedlnclices Gets a collection that contains the zero-based indexes of all cu1Tently
selected items in the ListBox.
Selectedltem Gets or sets the currently selected ite1n in the ListBox.
Selected Items Gets a collection containing the currently selected ite1ns in the
ListBox.
SelectedValue Gets or sets tl1e value of the me111ber property specified by tl1e
V alueMember property.
Selection Mode Gets or sets a value specifying tl1e selection mode.
Sho'vFocusCues Gets a value indicating \.Vl1ether the control shottld display focus
rectangles.
ShowKeyboard Cues Gets a value indicating whether the user interface is in the approp1iate
state to sho,;v or hide keyboard accelerators.
Site Gets or sets the site of the control.
Size Gets or sets the he~ght and width of the control.
Sorted Gets or sets a value indicating whether the items in the ListBox are
sorted alphabetically.
Tab Index Gets or sets the tab order of tl1e control within its container.
TabStop Gets or sets a value indicating whether the user can give the focus to
this control using the TAB key.
356 I PowerShell Studio - A Comprehensive Guide

I
Tag Gets or sets the object that contains data about the control.
Text Gets or searches for the teA1 of the currently selected item i11 the
ListBox.
ThreeDCheckBoxcs Gets or sets a value indicating whether the check boxes have a
Syste1n.Windows.Fonns.ButtonState of Flat or Normal.
Top Gets or sets the distance. in pixels, between the top edge of tl1e control
and tl1e top edge of its container's client area.
Toplndex Gets or sets the index of the first visible item in the ListBox.
TopLeveJControl Gets the parent control that is not parented by another Windo,vs
Forms control. Typically, this is the outermost Form that the control is
contained in.
UseCompatibleTextRendering Gets or sets a value that determines whether to use the Graphics class
(GDI+) or the TextRenderer class (GDI) to render text.
UseCustomTab Offsets Gets or sets a value indicating whether the ListBox recognizes and
eJ\'J)ands tab characters when it dra\vs its strings by using tl1e
CustomTabOffsets integer array.
UseTabStops Gets or sets a value indicating whether the ListBox can recognize and
eA'}Jand tab characters \vhen drawing its strings.
UseW aitCursor Gets or sets a value indicating whether to ttse t11e \.Vait cursor for the
current control and all child controls.
ValucMember Gets or sets a string that specifies the property of the data sou1ce fron1
which to draw the value.
Visible Gets or sets a value indicating 'vhetber the control and all its clllid
controls are displayed.
Width Gets or sets the vvidth of the control.
Window Target This API supports tl1e product infrastruct11re and is not intended to be
used directly from your code. This property is not relevant for this
class.

COLORDIALOG

AIJowFullOpen
Gets or sets a value indicating whether tl1e user can use the dialog box to define custom
colors.
AnyColor Gets or sets a value iI1dicating vvhether the dialog box displays all available colors in the set
of basic colors.
CanRaiseEvents Gets a value indicating whether the component can raise an event.
Color Gets or sets the color selected by the user.
Container Gets the !Container that contains the Component.
Custom Colors Gets 01 sets the set of custom colors shown in the dialog box.
DesignMode Gets a value that indicates whetl1er the Component is cu1Te11tly in design inode.
Events Gets the list of event ha11dlers that are attached to this Co111ponent.
Full Open Gets or sets a value indicating whether tl1e controls used to create custo1n colors are visible
when tlle dialog box is opened
Instance This API supports the product infrastructure and is not intended to be used diJectly fro1n
your code. Gets the m1derlying window instance handle (HINSTANCE)
PowerShell Studio - Reference Guide I 357

r
Options This API s11pports the product infrastmchue and is not intended to be used directly from
your code. Gets values to initialize the ColorDialog.
SholvHel1> Gets or sets a value indicating \Vhetl1er a Help button appears in the color dialog box.
Site Gets or sets the ISite of tl1e Component.
SolidColorOnly Gets or sets a value indicating whether the dialog box will restrict users to selecting solid
colors only.
Tag Gets or sets an object tl1at contains data abot1t the control.

COMBO BOX

Actu alHeight Gets the rendered height of this element.


ActualWidth Gets the rendered \idtl1 of this element.
AllowDrop Gets or sets a value indicating whet11er this eleme11t can be used as the
target of a drag-and-drop operation, Th.is is a dependency property
Alternation Count Gets or sets the number of alternating item containers in the ItemsControl,
vvhich enables alten1ating containers to have a tulique appearance.
AreAnyToucbesCa[Jtured Gets a value that indicates whetl1er at least one touch is capttued to this
element.
AreAnyTouchesCa1>turedWithi Gets a value that indicates whetl1er at least one touch is captuJed to this
D element or to any child elements in its visual tree.
AreAnyTouchesDirectlyOver Gets a value that indicates whether at least one touch is pressed over tllis
element
AreAnyToucbesOver Gets a value that indicates whether at least one touch is pressed over tllis
element or any child ele1nents in its visual tree.
Background Gets or sets a brush that describes the background of a control.
BindingGrouJJ Gets or sets tl1e BindingGroup tl1at is used for lhe elen1ent.
BitmapEffect Obsolete. Gets or sets a bitmap effect that applies dixectly to the rendered
content for this element. This is a dependency property
BitmapEffectln put Obsolete. Gets or sets an inp11t source for the bitmap effect that applies
directly to the rendered content for this element. This is a dependency
property
BorderBrusb Gets or sets a brush that describes the border background of a control.
BorderThiclmess Gets or sets the border thickness of a control.
CacheMode Gets or sets a cached representation of the UIElen1ent.
Clip Gets or sets the geo111et:ry used to define the outline of the contents of an
element. This is a dependency property
Clip To Bounds Gets or sets a value indicating whetl1er to clip the content of this element
(or content co1ning fro1n the child elements of this element) to fit into the
size of the containing element. This is a dependency property
CommandBindings Gets a collection of Com1nandBinding objects associated with this
ele1nent. A CornmandBinding enables corninand handling for this
element, and declares the Jinkage between a com1nand, its events, and the
handlers attached by tll.is elen1ent
358 I PowerShell Studio - A Comprehensive Guide

ContcxtMenu Gets or sets the context n1enu element that sl1ould appear whenever the
context men11 is req11ested through user interface (UI) fro1n within this
element.
Cursor Gets or sets the cursor that displays when the 1nouse pointer is over this
element.
Data Context Gets or sets the data context for an eleme11t when it paiticipates in data
binding.
DefaultStyleKey

Gets or sets the key to use to reference the style for this control, when
theme styles are used or defined.
DependencyObjectType Gets the DependencyObjectType that wraps the CLR type of this instance.
DesiredSize Gets the size that this eleme11t co1nputed duriI1g the measure pass of the
layout process.
Dis1Jatcher Gets the Dispatcher this Dispatcl1erObject is associated \vith.
DisplayMcm herPath Gets or sets a path to a value on the source object to serve as the visual
representation of the object.
Effect Gets or sets the bitmap effect to apply to the UIElen1ent. This is a
dependency property
FlowDirection Gets or sets the direction that tex1 and other user interface (UI) elements
flow \.Vithin any parent elen1ent tl1at controls their layout.
Focusable Gets or sets a value that indicates whether the element can receive focus.
This is a dependency property
FocusVisualStyle Gets or sets a property that enables customization of appearance, effects,
or other style characte1istics tl1at will apply to this ele1nent when it
captures keyboard focus.
FontFamily Gets or sets the font fanlily of the control.
FontSize Gets or sets the font size.
FontStretc.h Gets or sets the degree to which a font is condensed or expanded on the
screen.
FontStyle Gets or sets the font sty le.
FontWeight Gets or sets the weight or thickness of the specified font.
ForceCursor Gets or sets a value that indicates whether this Fra1nework.Ele1nent should
force the user interface (U1) to render the cursor as declared by the Cursor
property.
Foreground Gets or sets a bn1sh that describes the foreground color.
GroupStyle Gets a collection of GroupStyle objects that define the appearance of each
level of groups.
Gron pStyleSelector Gets or sets a nlethod that enables you to provide custo1TI selectio11 logic
for a GroupStyle to aQply to each group in a collection.
HandlesScrolling Gets a value that indicates 'vl1ether a combo box supports scrolling.
(Overrides Control.HandlesScrolling.)
HasAnim ateclP roperties Gets a value indicating whetl1er this element has any anin1ated properties.
HasEffecti.veKeyboardF ocu s Gets a value that indicates wl1ether the ComboBox bas focus. (Ovenides
UIElement.HasEffectiveKeyboardFocus.)
Hasltems Gets a value tl1at indicates wl1ether the Items Control contains items.
Height Gets or sets the suggested heigl1t of the element.
PowerShe ll Studio - Refere nce G uid e I 359

HorizontalAlignment Gets or sets U1e horizontal aligiunent characteristics applied to Utis


ele1nent ' vhe11 it is con1posed \Vitltin a parent ele111ent. Sltch as a panel or
ite1ns control.
HorizontalContentAlignmeut Gets or sets the horizontal alignment of the control's content.
InberitaoceBeh avior Gets or sets the scope limits for property value inJ1eritance. resource key
lookup, and RelativeSource FindAncestor lookup.
lnputBindings Gets the collection of input bindings associated \vith this element.
lntJutScope Gets or sets the conteA1 for input used by tltis Frame'"'orkEle1nent.
IsArrangeValid Gets a value indicating "vbether U1e co1nputed size and position of child
elements in this elen1ent's layout are valid.
IsDropDo,vnOpen Gets or sets a value that indicates \Vhether the drop--0.0\, U for a combo box
7

is currently open.
IsEditable Gets or sets a value that enables or disables editing of the te~1 in text box
of the ComboBox.
ls Enabled Gets or sets a value indicating \Vhether this element is enabled in the user
interface (UI). This is a dependency property
IsEnabledCore Gets a value that becon1es U1e return value of IsEnabled in derived classes.
IsFocused Gets a value tl1at determines whether tllis ele1nent has logical focus. Tltls
is a dependency propercy
IsGrouping Gets a value that indicates \Vhether U1e co11trol is using grouping.
IsIDtTestVisible Gets or sets a value that declares \Vbether this ele1ne11t can possibly oe
ret11med as a hit test result fro111 son1e portion of its rendered co11tent. This
is a dependency property
Islnitialized Gets a value that indicates \Vhether this elen1ent has been initialized, either
during processing by a XAML processor. or by e:'\.'J)licitly having its
Endlnit method called.
Isln1)utMethodEnabled Gets a valu.e indicating 'vhelher an input metl1od syste~ such as an Input
Method Editor (IME) is enabled for processing the input to this element.
lsKcyboardFocu scd Gets a alue indicating whetl1er this element bas keyboard focus. This is a
dependency property
lsKeyboardFocusWithin Gets a value indicating whether keyboard focus is an)"vhere ''rithin the
element or its visual tree clrild ele1nents. This is a dependency property
lsLoaded Gets a value that indicates 'vhetl1er tltis ele1nent has been loaded fo r
presentatioJL
IsManipulationEoab led Gets or sets a value tl1at indicates ' vbetl1er 1nanipulation events are
enabled on this UIElement
lsMeasu reValid Gets a value indicating \\hether the current size returned by layout
n1easure is valid.
lsMouseCaptured Gets a value indicating whether the mouse is captured to this element.
This is a dependency property
IsMouseCaptu reWithin
IsMouseDirectlyOver

Gets a value tl1at indicates whether the position of the mouse pointer
corresponds to hit test results. which take element compositing into
account. This is a dependency property
Gets a value indicating whetl1er the rnouse pointer is located over this
eletnent (including cltild elen1ents in the visual tree). This is a dependency
property
360 I PowerShell Studio - A Comprehensive Guide

lsReadOnJy Gets or sets a value tl1at enables selection-only n1ode. in \Vhich tl1e
contents of the co1nbo box are selectable but not editable.
IsSealed Gets a value that indicates \Vhether this instance is currently sealed (read-
only).
lsSelectionBoxHighlighted Gets \Vbether the SelectionBoxltem is higltligbted.
IsS tylusCaptured Gets a value indicating \Vhether the stylus is captured by this element.
This is a depende11cy property
IsStylusCa1>tureWithin Gets a value Uiat detennines \vbether stylus capture is held by this
element. or an element within the elen1ent bounds and its visual tree. This
is a dependency property
lsStylusDirectlvOver

Gets a value that indicates \Nhether the stylus position corresponds to hit
test results. which take elen1ent compositing into account. This is a
dependency property
lsStylusOver

Gets a value indicati11g \vhether the stylus cursor is located over this
elen1ent (including visual child elements). This is a dependency property
IsSyochrooizedWithCurrentlte Gets or sets a value U1at in.dicates \V11eU1er a Selector should keep the
m Selectedlte1n synchronized \Vitb the current item in U1e Items property .
ls Tab Stop Gets or sets a value that indicates \vhether a control is included in tab
navigation.
IsTcxtSearchC aseSensitive Gets or sets a value that indicates whether case is a condition \Vhen
searchmg for items.
IsTeA-tSearchEnabled Gets or sets a value that indicates 'vhether Te~1Search is enabled on the
ItemsControl instance.
lsVisible Gets a value indicating vvhetber this element is visible in the user interface
(UI). Tllis is a dependency property
ItemBin din gGrou p Gets or sets the BindingGroup tl1at is copied to each ite1n in the
ItemsControl.
ltemContainer<rtnerator Gets tl1e ItemContainerGenerator tl1at is associated \' ith the control.
1

ltemCootainerStyle Gets or sets the Style that is applied to the container element generated for
each item.
ItemContainerSt)1leSelector Gets or sets custo1n sty le-selection logic for a style U1at cru1 be applied to
each generated container element.
Items Gets the collection used to generate the content of the ItemsControl.
ItemsPanel Gets or sets the template that defines the panel that controls the layout of
items.
ItemsSource Gets or sets a collection used to generate the content of the ItemsControl.
ltemStriogFormat Gets or sets a con1posite string U1at specifies ho\v to fom1at the itenlS in
the Iten1sControl if they are displayed as slril1gs.
Item Template Gets or sets the DataTemplate used to display each iten1.
Item Tern t>lateSelecto r Gets or sets the custom logic for choosing a te1nplate used to display each
item
Language Gets or sets localization/globalization language infonnation that applies to
an ele1nenl.
LayoutTransform Gets or sets a graphics transfon11ation t11at sho1tld apply to this element
\Vhen layout is performed.
LogicaJCbildren Gets an enumerator for tJ1e logical child objects of the ItemsControl
object.
PowerShell Studio - Reference Guide. I 361

Margin Gets or sets the outer n1argin of an element.


MaxDro11DownHeight Gets or sets the maximum height for a co1nbo box drop-dow11.
MaxHeight Gets or sets the maximum height constraint of tl1e element
MaxWidth Gets or sets the maxim1un width constraint of the element.
MinHeigbt Gets or sets the minin1um height constrai.J.1t of tl1e element.
MinWidth Gets or sets the minin1um width constrai.J.1t of the element.
Name Gets or sets tl1e identifying na1ne of the element. The name provides a
reference so that code-behi11d, sucl1 as event handler code, can refer to a
markup ele1nent after it is constructed during process.iJ1g by a XA11L
processor.
Opacity
OpacityMasi< Gets or sets an opacity inask, as a Bn1sh i1nplementation that is applied to
any alpha-channel rnasking for the rendered co11tent of this element. This
is a dependency property
OverridesDefaultStyle Gets or sets a value that indicates ,;vhether this element incorporates style
properties from theme styles.
Padding Gets or sets the padding inside a control.
Parent Gets the logical parent eleme11t of this element.
Persistld Obsolete.Gets a value that uniquely identifies this element.
RenderSize Gets (or sets, but see Remarks) the final render size of this element.
RenderTransform Gets or sets transform information that affects the reudering position of
this element. This is a dependeucy property
RenderTransformOrigin Gets or sets the center point of ru1y possible render transform declared by
RenderTransfonn, relative to the bounds of tbe element. This is a
dependency propert}1
Resources Gets or sets the locally-defined resource dictionazy.
Selectedlndex Gets or sets the index of the first item in the current selection or returns
negative one (-1) if the selection is empty.
Selectedltem Gets or sets tl1e first iten1 in the cu1rent selection or rehrms null if the
selection is empty
SelectedValue Gets or sets tl1e value of the Selectedltem, obtained by using
SelectedValuePatl1.
SelectedValuePath Gets or sets the path that is used to get the SelectedValue fron1 the
Selectedltem.
SelectionBoxltem Gets the item that is displayed in the selection box.
SelectionBoxltemStringFormat Gets a composite string that specifies bow to format tl1e selected item in
the selection box if it is displayed as a string.
SelectionBoxltemTemplate Gets the item template of the selection box content.
ShouldPreserveUserEnteredPre Gets or sets a value that indicates vvhether the ComboBox keeps the user's
fix input or replaces tl1e input with a .matching ite1n.
SnapsToDevicePixels Gets or sets a value that detennines whether rendering for this element
should use device-specific pixel settings during rendering. Tllis is a
depe11dency property
362 I PowerShell Studio - A Comprehensive Guide

StaysOpenOnEdit Gets or sets whether a ComboBox tl1at is open and displays a drop-down
contTol will re1nain open vvhen a user clicks the Te~1Box.
Style Gets or sets the style used by this element when it is rendered.
StylusPluglns Gets a collection of all stylus plug-i11 (customization) o~jects associated
'vith this elen1ent.
Tablndex Gets or sets a value that detennines the order in \hi.ch elements receive
focus when the user navigates through controls by using the TAB key.
Tag Gets or sets an arbitrary object value that can be used to store custom
information about this elen1ent.
Template Gets or sets a control ten1plate.
Tem11latedParent Gets a reference to the template parent of this element. This property is
not relevant if the element was not created through a template.
Text Gets or sets the text of the currently selected ite1n.
ToolTi11
TouchesCaptured Gets all touch devices that are captured to this element
TouchesCapturedWithin Gets all touch devices that are captured to this element or any cllild
elements i11 its visual tree.
ToucbesDirectlyOver Gets all touch devices that are over tlris element
TouchesOver Gets all touch devices that are over tlris ele1nent or any child ele1nents in
its visl1al tree
Gets the collection of triggers established directly on tills element, or in
child elements.
Uid Gets or sets the tmique identifier (for localization) for tlris ele1nent. Tlris is
a dependency property.
U seLayoutRounding Gets or sets a value that indicates wl1ether layout rounding should be
applied to tlris ele1nent's size a11d position during layout.
VerticalAJign ment Gets or sets t11e vertical alig1unent characteristics applied to this element
when it is composed within a parent ele1nent sucl1 as a panel or items
control.
VerticalContentAlignment Gets or sets tl1e vertical alig1unent of the conttol's content.
Visibility Gets or sets the user interface (UI) visibility of this element. Tlris is a
dependency p..!Q,Perty
VisuaJBitmapEffect Obsolete.Gets or sets the BitmapE:ffect value for the Visual.
VisuaJBitmapEffectlnput Obsolete. Gets or sets the Bit11iapEffecth1put value for the Visual.
Visu aJBitmapScalin gMode Gets or sets the BitniapScalingMode for the Visual.
VisualCacheMode Gets or sets a cached representation of the Visual.
VisuaJChildrenCount Gets tl1e number of visual clrild ele111ents within tlris elen1ent.
Visu alClearTypeHint Gets or sets tl1e ClearTypeHiut that determines bow ClearType is rendered
in the Visual.
VisualCli11 Gets or sets tl1e clip region of the Visual as a Geometty value.
VisualEdgeMode Gets or sets the edge mode of the Visual as an EdgeMode value.
VisualEffect Gets or sets t11e bitinap effect to apply to the Visual.
Visual Offset Gets or sets tl1e offset value of the visual object
PowerShell Studio - Reference Guide I 363

VisnalOpacity Gets or sets the opacity of t:he Visual.


VisualOpacityMasi{ Gets or sets the Brush value that represents the opacity inask of the
Visual.
VisuaJP arent Gets the visual tree parent of the visual object.
VisualScrollableAreaClip Gets or sets a clipped scrollable area for the Visual.
VisualTextBintingMode Gets or sets the TextHintingMode of the Visual.
VisualTextRenderingMode Gets or sets the TextRenderingMode of tl.1e Visual
VisuaJTransform Gets or sets the Transform value for the Visual.
VisualXSnapJ>ingGuidelines Gets or sets the x-coordinate (vertical) guideline collection.
VisualYSnap1>ingGuidelines Gets or sets the y-coordinate (horizontal) guideline collection.
Width Gets or sets the \Vidth of the element.

CONTEXTMENUSTRIP

AccessibilityO bject Gets the AccessibleObject assigned to the control.


Accessi b l.eDefau ltA.ctio nDescripti Gets or sets the default action description of the control for use by
on accessibility client applications.
AccessibleDescription Gets or sets the description of the control used by accessibility client
applications.
AccessibleName Gets or sets the nan1e of the co11trol used by accessibility client
applications.
AccessibleRole Gets or sets the accessible role of the control
AllowDro1l Gets or sets a value indicating \.vhether drag-and-drop and iten1
reordering are handJed through events that you i111ple1uent.
AllowItemReorder This API supports the product infrastructure and is not intended to be
used directly fron1 your code. This property is not relevant to this class.
AllowMerge Gets or sets a value indicating \Vhether multiple MenuStrip,
ToolStripDropDownMenu, ToolStripMenuitem, ai1d other types can be
combined.
AllowTransparency Gets or sets a value indicating "vhether the Opacit)' of the form can be
adjusted.
Anchor This API supports the product infrastrucnue and is not intended to be
used directly fro1n your code. This property is not relevant to this class.
An to Close Gets or sets a value indicating whetl1er the ToolStripDropDown control
should automatically close when it has lost activation.
AutoScroll This API Sllpports the product infrastructure and is not intended to be
used directly fro1n your code. This property is not relevant for tltls class.
AntoScrollMargin This API Sllpports the product infrastructLue and is not intended to be
used directly fro1n your code. This property is not relevant for this class.
AntoScrolIMinSize This API Sllpports the product infrastructtue and is not intended to be
used directly fro1n your code. This property is not relevant for tllis class.
AutoScroUOffset Gets or sets where this control is scrolled to in ScrollControllntoView.
364 I PowerShell Studio - A Comprehensive Guide

AutoScrollPosition This API supports the product infrastructure and is not intended to be
used directly from your code. This property is not relevant for this class.
AutoSize Gets or sets a value indicatil1g whether the ToolStripDropDown
autornatically adjusts its size \Vhen the form is resized.
BackColor This API supports the product infrastn1cture and is not intended to be
used directly frorn your code. Gets or sets U1e backgrow1d color for tl1e
ToolStrip.
Baclwoundlmage Gets or sets the background image displayed in the control.
BackgroundlmageLayou t Gets or sets the background image layoltt as defined irn. the lmageLayout
enumeration.
BindingContext Gets or sets the binding contex1 for the ToolStrip.
Bottom Gets the distance, in pi'{els: between the bottom edge of the control and
the top edge of its container s client area.
Bounds Gets or sets the size and location of the control including its nonclient
elements, in pL"els, relative to the parent control.
CanEnablelme Gets a value indicating whether the ImeMode property can be set to an
active value, to enable IME support.
CanFocus Gets a value i11dicating whether the control can receive focus.
Can Overflow This API supports the product infrastructure and is not intended to be
used directly from yotrr code. Gets or sets a value indicating 'vhether the
items in a ToolStripDropDo\vn can be sent to an overflo'\v menu.
CanRaiseEvents Determ.ines if events can be raised on the control.
CanSelect Gets a value indicating whether tl1e control can be selected.
Ca)lture Gets or sets a value indicating \.Vhether tl1e control has capt1rred the
mouse.
CausesValidation Gets or sets a value indicating \.vhether the ToolStrip causes validation to
be performed on any controls that require validation \.Vhen it receives
focus.
ClicntRectangle Gets the rectangle that represents the client area of the control.
ClientSize Gets or sets the height and width of the client area of the control
CompanyName Gets the name of the company or creator of the application containing
the control.
Container Gets the IContainer that contains the Con1ponenl.
ContainsFocus Gets a value indicati11g whether the control. or one of its cJlild controls,
currently has the input focus.
ContextMeou This API supports the product infrastn1.cture and is not intended to be
used direcUy from your code. This property is not relevru1t to this class.
ContextMenuStrip This API supports the product infrastn1cture a11d is not intended to be
used directly from your code. This property is not relevant to this class.
Controls This API supports tl1e product infrastructure and is not intended to be
used directly from your code. This property is not relevant for this class.
Created Gets a value indicating whether the control has been created.
CreateParams Gets paran1eters of a ne\v \Vindow.
Cursor Gets or sets the ctrrsor that is displayed \vhen the mouse pointer is over
the ToolStrip.
DataBindi.ngs Gets the data bindings for the control.
DefaultCu rsor Gets or sets tl1e default cursor for tJ1e control.
DefauJtDock Gets the docking location of the TooIStrip. indicating which borders are
docked to the co11tainer.
PowerShell Studio - Reference Guide I 365

DefaultD.-01>DOl1'nDirection Gets or sets the direction in 'vllich the ToolStripDropDo,vn is displayed


relative to U1e ToolStrip.
DefaultGripMargin Gets the default spacing, in pixels, between the sizing grip and the edges
of U1e TooJStrip.
DefaultlmeMode Gets the default Input Method Editor (IME) mode supported by the
COiltrOl.
DefaultMargin Gets the spacing, in pixels, betvveen the ToolStrip and the
ToolS trip Container.
DefanltMaxi:mumSize Gets U1e length and heigh~ in pixels. tl1at is specified as the default
maxin11llll size of a control.
DefauJtMinimumSize Gets the length and height, in pixels. that is specified as the default
n1inimum size of a control.
DefaultPadding Gets the internal spacing. in pixels. of the control.
Defau ltSholvltemToolTips Gets a value indicating ' vhether ToolTips are sho\vn for the
ToolStripDropDo,vn by default.
Defau It Size Gets the default size of the ToolStrip.
DesigoMode Gets a value U1at indicates ,;v bet.her the Con1ponent is curre11tly in design
n1ode.
Displayedltems Gets the subset of items that are currently displayed on the TooIS trip,
including items that are automatically added into the ToolStrip.
DisplayRectangle Gets the rectangle that represents the display area of the
ToolStripDropDownMenu.
Disposing Gets a value indicating whether the base Control class is in. the process
of disposing.
Dock Tllis AP! suppo11s the product infrastn1cttue and is not intended to be
used directly from your code. This property is not relevant to tlus class.
DockPadding Gets the dock padding settings for all edges of the control.
DoubleBuffered Gets or sets a value indjcating wheU1er this control should redra"v its
surface using a secondary buffer to reduce or prevent nicker.
D ropShadolv Enabled Gets or sets a value indicating "\>vhether a three-dimensional shado""1
effect appears when the ToolStripDropDown is displayed.
Enabled Gets or sets a value indicating whether the control can respond to user
interaction.
Events Gets the list of e,rent handlers that are attached to this Component.
Focused Gets a value indicating whether the control has input focus.
Font Gets or sets the font of the text displayed on tl1e ToolStripDropDo"vn.
FootHeight Gets or sets the height of the :font of the control.
ForeColor Gets or sets the foregrou11d color of the TooIStrip.
GripDisplaySt~1 le This API suppo11s the product infrastruct1rre and is not intended to be
used directly from your code. This property is not relevant to tllis class.
GripMargin This AP! supports tl1e product infrastructtrre and is not intended to be
used directly from your code. This property is not relevant to Ulis class.
GripRectangle Thls API supports tl1e product infrastructure and is not intended to be
used directly from your code. This property is not rele,rantto this class.
GripStyle This API supports the product infrastructtrre and is not intended to be
used directly from your code. This property is not relevant to this class.
Handle Gets the \Vindow handle tl1at the control is bound to.
HasChildren This API supports the product infrastn1cture and is not intended to be
used directly from your code. Tllis property is not relevant for ill.is class.
366 I PowerShell Studio - A Comprehensive Guide

Height Gels or sets ll1e height of t11e control.


HorizontalScroll This API supports the product infrastructure and is not intended to be
used directly fro1n your code. This property is not relevant for trus class.
HScroU Gets or sets a value indicating whether the horizontal scroll bar is visible.
lmageList Gets or sets the iniage list that contains the image displayed on a
Too1Slrip item.
lmageScalingSize Gets or sets the size in pixels, of an image used on a ToolStrip.
ImeMode Gets or sets the Input Method Editor (lME) mode of the control.
lmeModeBase Gets or sets the IME mode of a control.
lnvokeRequired Gets a value i11dicating \hether the caller 1uust call ru1 invoke method
\Vhen making method calls to the control because the caller is on a
different thread than tl1e one tl1e co11trol \Nas created on.
IsAccessible Gets or sets a value indicating \Vhether the control is visible to
accessibility applications.
IsAutoGenerated Gets a value indicating \vhether this ToolStripDropDo,vn \Vas
auton1atically ge11erated.
lsCttrrentlyDragging Gets a value indicating \Vhether the user is currently moving the
TooJStrip from one ToolStripContainer to another.
IsDisposed Gets a value indicating 'vhether the control has been disposed of.
IsDropDo,vn Gets a value indicating \vhether a ToolStrip is a ToolStripDropDo,vn
control.
IsHandleCreated Gets a value indicating \vhether the control has a handle associated \vith
it.
IsMirrored Gets a \ralue indicating \vhether the control is 11lirrored.
Items Gets all tl1e items tl1at belong to a ToolStrip.
La you tEngine Passes a reference to the cached LayoutEngine retl1rned by U1e layout
engine interface.
LayoutSettin gs Gets or sets layout scheme characteristics.
LayoutStyle

Gets or sets a value indicating how the items of ContextMenuStrip are
displayed.
Left Gets or sets the distaJlce in pixels. bet,veen the left edge of the controJ
and the left edge of its containe1Js client area.
Location This API supports the product infrastructure and is not intended to be
used directly from yo11r code. This property is not rele~r,u1t to this class.
Margin Gets or sets the space bet\veen controls.
MaxjmumSize Gets or sets the size that is the upper limit that GetPreferredSize can
specify.
MaxltemSize Gets the maximum height and \Vidth, in pixels. of the ContextMenuStrip.
MinimumSize Gets or sets the size that is the lo\i\1er limit that GetPreferredSize can
specify.
Name Gets or sets the ruune of the controJ .
Opacity Delemlines U1e opacity of U1e fom1.
Orientation Gets the orientation of the ToolStripPanel.
Overflo\\'Button This API supports the product infrastructure and is not intended to be
used directly from your code. Tllis property is not relevant to this class.
0\v nerItem Gets or sets the ToolStripitern that is the owner of this
ToolStripDropDO\VIl.
Padding Gets or sets padding \vilhin the co11trol.
PowerShell Studio - Reference G uide I 367
t

Parent Gets or sets the parent container of the control.


PrcfcrrcdSizc Gets the size of a rectangular area into \vhich the control can iit.
ProductName Gets the product name of the assembly contai ning the control.
ProductVersion Gets U1e version of the asse1nbly containing the control.
Recrcatin gBandle Gets a value indicating \Vhether tl1e conlrol is currently re-creating its
handle.
Region Gets or sets the \vindo'v region associated with the ToolStripDropDo\vn.
Renderer Gets or sets a ToolStripRenderer used to customize the look and feel of a
ToolStrip.
RenderMode Gets or sets a value that indicates which visual styles \Yill be applied to
the ToolStrip.
RenderRightToLeft Obsolete.This property is uo' v obsolete.
ResizeRedraw Gets or sets a value i11dicating whether the control redra\VS itself \vhen
resized.
Right Gets U1e distance, in pixels, bet\veen U1e ri,ght edge of the control and the
left edge of its container's client area.
Ri.ghtToLeft Gets or sets a value indicatiJ1g ':\'hether control's ele1nents are aligned to
support locales using right-to-left fo nts.
ScaleChildren Gets a value that determines the scaling of child controls.
ShowChecliMargin Gets or sets a value indicating \Vhether space for a check n1ark is sho,vn
on the left edge of the ToolSt:IipMe11ulte111.
Sho" FocusCues
1
Gets a value indicating whether the control should display focus
rectangles.
Sho,,ImageMargin Gets or sets a value indicating \<Vhether space for an image is sho\Yn on
tile left edge of the ToolStripMenulte111.
Sho"' Item ToolTi1>s Gets or sets a value indicating \Vhether ToolTips are to be displayed on
ToolStrip itenlS.
Sho"KeyboardCues

Gets a value indicating \Vhether U1e user interface is in the appropriate
state to sho'v or bide keyboard accelerators.
Site Gets or sets tl1e site of the control.
Size Gets or sets the height and \Vidth of tl1e control.
SourceControl Gets U1e last control tJ1at caused this ContextMenuStrip to be displayed.
Stretch This API suppo1ts the product infrastn1cture and is not intended to be
used directly from your code. This property is not relevai1t to this class.
Tablndex Tltis API supports the product infrastructure and is not intended to be
used directly from your code. This property is not relevant to this class.
TabStop Gets or sets a value indicating \vhether the user can give the focus to an
ite1n in the ToolStrip using the TAB key.
Tag Gets or sets the object that contains data about the control.
Text Gets or sets the text associated ivith this control.
TcxtDirection Specifies the direction in whic11 to dra'v the te~1: on the item.
Top Gets or sets the distance. in pixels. benveen the top edge of the control
and tl1e top edge of its container's cllent area.
TopLevel Gets or sets a value indicating \vhether the ToolStripDropDownis a top-
level co11trol.
TopLevelCootrol Gets the parent co11trol that is not parented by another Windo\vs Fonns
co ntrol. Typically. this is the outennost Forn1 that U1e control is
contained in.
368 I PowerShell Studio - A Comprehensive Guide

TopMost Gets or sets a v alue indicating whether the form should be displayed as a
topmost form.
UseW aitCursor Gets or sets a value it1dicating whether to use the vvait cursor for the
current control and all child controls.
VerticalScroll This API supports the product infrastn1cture and is not intended to be
used directly from your code. This property is not relevant for this class.
Visible Gets or sets a value indicati11g \:vhether tl1e ToolStripDropDown is
visible or hidden.
VScroll Gets or sets a value indicating whether the vertical scroll bar is visible.
Width Gets or sets the \:vidth of the control.
Window Target This API supports the product infrastructure and is not intended to be
used directly from your code. This property is not relevant for this class.

DATAGRID AND DATAGRIDVIEW

AccessibilityObject Gets the AccessibleObject assigned to the control.


AccessibleDefaultActionDescri11tion Gets or sets the default action description of tl1e control for use
by accessibility client applications.
Access.i bleDescri ption Gets or sets the description of the control used by accessibility
client applications.
AccessibleName Gets or sets the name of the control used by accessibility client
applications.
Accessible~ole Gets or sets the accessible role of the control
AdjustedTopLeftHeaderBorderStyle Gets the border style for the upper-left cell in the
DataGridVievv.
AdvancedCeUBorderStyle Gets the border style of the cells in the DataGridView.
Advanced ColumnHeadersBorderStyle Gets the border sty le of the column header cells in the
DataGridVievv.
AdvancedRowHeadersBorderStyle Gets tbe border style of the ro\ header cells in the
DataGridView.
AllowDro11 Gets or sets a value i11dicati11g whether tl1e co11trol ca11 accept
data that the user drags onto it.
Allo'vU serToAcldRows Gets or sets a value indicating whether the option to add rows is
displayed to the user.
Allow UserToDeleteRo,vs Gets or sets a value indicating vvhether the user is allo\-ved to
delete rows fro1u tl1e DataGridView.
AllowU serToOrderColumns Gets or sets a value indicating whether manual column
repositioning is enabled.
Allo'vU serToResizeColumns Gets or sets a value indicati11g whether users can resize
coltunns.
AlJo,vUserToResizeRows Gets or sets a value indicating whether users can resize rows.
AlternatingRowsDefaultCellStyle Gets or sets the default cell style applied to odd-numbered rows
of the DataGridView.
Anchor Gets or sets the edges of the container to which a control is
bound and detemlines ho':v a control is resized with its parent.
PowerShell Studio - Reference Guide. I 369

AntoGenerateColnmns Gets or sets a value indicating \>vhether colu1nns are created


automatically when the DataSoruce or DataMemberproperties
are set.
AutoScrollOffset Gets or sets where this control is scrolled to in
ScrollControlintoVie,;v.
AutoSize This API supports the product infrastructure and is not intended
to be used directly from your code. This property is not relevant
for this class.(Ove1rides Control.AutoSize.)
AutoSizeColumnsMode Gets or sets a value indicating how column "vidths are
determined.
AutoSizeRowsMode Gets or sets a value indicating how row heights are determined.
BackColor This API Sl1ppo1ts tl1e product infrastructure and is not intended
to be used directly from yotrr code. Gets or sets the background
color for the control.(Overrides Control.BackColor.)
Background Color Gets or sets the background color of the DataGridVie\>v.
Backgroundlmage Tllis API supports tl1e product infrastructure and is not intended
to be used directly from yoru code. Gets or sets the background
image displayed in the control.(Overrides
Control.Backgroundlmage.)
BackgrouncllmageLayout This API supports tl1e product infrasuucture and is not intended
to be used directly fro1n your code. Gets OI sets the background
image layout as defined in the In1ageLayout entuneration.
(Overrides Coutrol.BackgroundllnageLayout.)
BindingContext Gets or sets the BindingContext for the control.
BorderStylc Gets or sets the border style for the DataGridVie\>v.
Bottom Gets the distance, in pLxels, between tlle bottom edge of the
control and the top edge of its container's client area.
Bounds Gets or sets the size and location of the control including its
nonclient eleme11ts, in pixels, relative to the parent control.
CanEnablelme Gets a value indicating \Vhether the lmeMode property can be
set to an active value, to enable IME support. (Overrides
Control.CanEnablelme.)
CanFoc11s Gets a value indicating \vhether the control can receive focus.
C anRaiseEvents Determit1es if events can be raised on the control.
CanSelect Gets a value indicating ~vhether the control can be selected.
Ca11ture Gets or sets a value indicating whether the control has captured
the mouse.
CausesValidation Gets or sets a value indicati11g whether the control causes
validation to be perfor1ned on any controls that require
validation when it receives focus.
CeUBorderStyle Gets the cell border style for the DataGridView.
ClientRectangle Gets the rectangle tl1at represents tlie client area of the control.
ClientSize Gets or sets tl1e height and width of the client area of the
control.
Cli11boardCopyMocle Gets or sets a value that indicates whether users ca11 copy cell
tex1 values to the Clipboard and whether ro~v and coltllll.11
header tex1 is included.
Column Count Gets or sets the number of coltnnns displayed in tl1e
Data GridView.
370 I PowerShell Studio - A Comprehensive Guide

ColumnHeadersBorderStvle

Gets the border style applied to the colunm headers.
ColumnHeadersDefauJtCeUS tvlc

Gets or sets the default colnn111 header style.
ColumnHeadersHcight Gets or sets the heigh~ in pixels, of the column headers ro\v
ColumnHeadersHeightSizeMode Gets or sets a value indicating \vl1ether tl1e height of the coltum1
headers is adjustable and whether it can be adjusted by the user
or is automatically adjusted to fit the contents of the 11eaders.
ColumoHeadersVisible Gets or sets a value indicating \Nhether tJ1e colu1m1 header TO\V
is displayed.
Columns Gets a collection tliat contains all the columns in the control.
CompanyName Gets the na1ne of tbe co1npany or creator of the application
contai ning the control.
Container Gets U1e !Container that contains tl1e Component. (Inherited
fron1 Co1nponent.)
ContainsFocu s Gets a value indicating v.rhether the control: or one of its child
controls, currently has the input focus.
ContextMenu Gets or sets the shortcut menu associated ' vith the control.
ContextMenuStrip Gets or sets U1e Conte>.1.MenuStrip associated \vith th.is control.
Controls Gets the collection of controls contained within the control.
Created Gets a value indicating \-vhether the control has been created.
CreateParams Gets the required creation parameters \hen the control handle
is created.
CurrentCell Gets or sets the currently active cell.
CurrentCellAdd ress Gets the ro'v and colunm indexes of the currently active cell.
CurrentRo'v Gets the rO\ containing the current cell.
Cursor Gets or sets the c1usor that is displayed \-vhen the mouse pointer
is over the control.
DataBindings Gets 01e data bindings for the control.
DataMember Gets or sets the nan1e of the list or table i11 the data source for
\;vhich the DataGridVievv is displaying data.
DataSource Gets or sets the data source that the DataGridVie\v is displaying
data for.
DefaultCellStyle Gets or sets the default cell style to be applied to the cells in the
DataGridVie\v if no other cell style properties are set.
DefaultCursor Gets or sets the default cursor for the control.
Defau ltlmeMode Gets the default Input Method Editor (IME) mode supported by
the control.
DefaultMargin Gets the space. in pixels~ that is specified by default bet,veen
co11trols.
DefaultMaximumSize Gets the length and height, in pixels, that is specified as the
default 1naximttn1 size of a contro 1.
Defau ltMinimu mSize Gets t11e length and height, iJ1 pixels, that is specified as the
default ininimun1 size of a control.
DefaultPadding Gets the inten1al spacing, in pixels, of the contents of a control.
DefaultSize Gets 01e default initial size of tl1e control. (Overrides
Control.DefaultSize.)
DesignMode Gets a value that indicates \Vl1ether the Component is currently
in design mode.(lnherited from Con1ponent.)
DisplayRectanglc Gets the rectangle that represents the display area of the control.
(Ovenides Co11trol.DisplayRectangle.)
PowerShell Studio - Reference Guide. I 371
[

Disposing
Gets a value indicating whether the base Control class is in the
process of disposing.
Dock Gets or sets which control borders are docked to its parent
control and detennines how a control is resized with its parent.
DoubleBufferecl Gets or sets a value indicating whether this control should
redraw its surface using a secondacy buffer to reduce or prevent
flicker.
EditingControl Gets the control hosted by the current cell, if a cell with an
editing control is in edit inode.
EditingPanel Gets the panel that contains the EditingControl.
EditMode Gets or sets a value indicating ho'\ to begin editing a cell.
Enabled Gets or sets a value indicating whether the control can respond
to user interaction.
EnableHeadersVisu alSty.les Gets or sets a value indicating whether r0\\1 and column headers
use the visuaJ styles of tl1e user's c11rrent then1e if visual styles
are enabled for the application.
Events Gets the list of event handlers that are attached to this
Component. (Inherited from Component.)
FirstDis1>layed Cell Gets or sets the first cell currently displayed in the
DataGridVie,v; typically, this cell is in tl1e upper left con1er.
FirstDi.splayedScrollingColumnHiddenW Gets the vvidth of the portion of the column that is currently
idtb scrolled out of view ..
FirstDis1>layedScrollingColumnlndex Gets or sets the index of the colunm that is the first col1u1m
displayed on the DataGridVievv.
Fi rstDisplayedScrollingRowIndex Gets or sets the index of the row that is the first row displayed
on the DataGridView.
Focused Gets a value indicating vvhether the control has input focus.
Font Gets or sets the font of the te)..1: displayed by the DataGridVievv.
(Overrides Control.Font.)
FontHeight Gets or sets the height of the font of the control.
ForeColor Gets or sets the foreground color of tl1e DataGridView.
(Overrides Control.ForeColor.)
GridColor Gets or sets the color of the grid lines separating tl1e cells of the
DataG1idView.
Handle Gets tl1e window handle tliat the control is bom1d to.
Has Children Gets a value indicating whether tl1e control contains one or
more child controls.
Height Gets or sets tl1e heigl1t of the control.
Ho rizontalScrol lBar Gets the horizontaJ scroll bar of the control
HorizontalScrollingOffset Gets or sets the number of pixels by vvhich the control is
scrolled 11orizontally.
lmeMode Gets or sets the Input Method Editor (IME) lnode of the control.
lmeModeBase Gets or sets the IJ\1E mode of a control.
lnvokeRequired Gets a value il1dicating whether the caller must call an invoke
method whe11 making method calls to the control because the
caller is on a different thread than the one the control vvas
created on.
IsAccessible Gets or sets a vaJue indicating whether the control is visible to
accessibility ap_plications.
372 I PowerShell Studio - A Comprehensive Guide

Is Cu 1TentCellDirty Gets a value indicating whether the current cell has


uncommitted changes.
IsCurrentCeDinEclitMod.e Gets a value indicating whether the currently active cell is being
edited.
IsCurrentRowDirty

Gets a value indicating whether the current row has
11ncoIDinitted changes.
IsDis11osed Gets a value indicating whet11er t11e control l1as been disposed
of.
IsHancUeCreated Gets a value indicating whetl1er the contTol has a handle
associated with it.
IsMirrored Gets a value indicating whether the control is inirrored.
Itcm[Int32, lnt32] Provides ru1 it1dexer to get or set the cell located at the
intersection of tl1e column a11d ro\v \vi th the specified indexes.
Item[String, Int32) Provides an indexer to get or set tl1e cell located at the
intersection of tl1e row with the specified index and t11e column
with the specified name.
LayoutE n gine Gets a cached instance of U1e control's layot1t engine.
Left Gets or sets the distance, in pixels, between the left edge of the
control and the left edge of its co11tai11er's client area.
Location Gets or sets tl1e coordinates of the upper-left comer of the
control relative to tl1e upper-left comer of its container.
Margin Gets or sets the space between controls.
MaximumSize Gets or sets the size tl1at is the upper limit that GetPreferredSize
can specify.
MinimumSize Gets or sets the size that is the lower limit that GetPreferredSize
can specify.
MultiSelect Gets or sets a value indicating wl1ether the user is allowed to
select more than one cell, row, or colunm of the DataGridVievv
at a ti111e.
Name Gets or sets the name of tl1e control.
NewRowIndex Gets tl1e index of the row for new records.
Pad rung This API supports the product infrastructure and is not intended
to be used directly from your code. This property is not relevant
for tllls control.
Parent Gets or sets the parent container of the control.
PreferredSize Gets the size of a rectangular area into which the co11trol can fit.
ProductName Gets the product nan1e of the assembly containing the control.
ProductVersion Gets the version of the assembly containing tl1e control.
Read Only Gets or sets a value indicating \V hether the user can edit the
cells of the DataGridVievv control.
Recreatin gHan.dle Gets a value indicating whether the control is currently re-
creating its handle.
Region Gets or sets the window region associated with t11e control.
RenderRightToLeft Obsolete. This property is now obsolete.
ResizeRecbaw Gets or sets a value indicati.J1g whether tl1e control redraws itself
vvhen resized.
Right Gets the distance, in pixels, betvveen the right edge of the
control and the left edge of its contait1er's client area.
PowerShell Studio - Reference Guide I 373

RightToLeft Gets or sets a value indicating v.1hether control's elements are


alig11ed to support locaJes using right-to-left fonts.
Ro,vCount Gets or sets the nwnber of ro,vs displayed in the DataGridVie,v.
Ro'vHcadersBorderS tylc

Gets or sets the border style of the ro'v header cells.
Ro'''HeadersDefaultCeUStyle

Gets or sets the default style applied to the row header cells .
Ro'v HeadersVisible Gets or sets a value indicating v. hetl1er tl1e colwru1 tl1at contains
1

ro,;v headers is displayed.


Ro,vHeadersWidth Gets or sets the ' vidth. in pi'Cels. of the column that contains the
row headers.
Ro,vHeadersWidthSizeMode Gets or sets a value indicating whether the 'vidtl1 of the ro'v
headers is adjustable and whether it can be adjusted by the user
or is automatically adjusted to fit the contents of the headers.
Gets a collection that contains all the rovvs in the DataGridVie'~
control.
Ro\vsDefau ltC ellStyle Gets or sets the default style applied to the ro'v cells of the
DataGridVieiv.
Gets or sets the ro'v that represents lhe template for all the Iov.s
in the control.
ScaJcChildrcn Gets a value that determines the scaling of child controls.
ScrollBars Gets or sets the type of scroll bars to display for the
DataGridView control.
SclectcdCcUs Gets the collection of cells selected by the user.
Selected Columns Gets the collection of columns selected by the user.
SelectedRoTI S
1
Gets the collection of rows selected by the user.
SelectionMode Gets or sets a value indicating bo'v the cells of the
DataGridVie'v can be selected.
Sbo,vCeUErrors Gets or sets a value i11dicating wheU1er to sho'v cell errors.
SholvCelJToolTips Gets or sets a value indjcating 'vhether or not ToolTips will
sho'v 'vhen the molJSe pointer pauses on a cell.
ShOl\ E ditinglcoo
1
Gets or sets a value indicating whether or not the editing glyph
is visible in the ro'v header of the cell being edited.
SholvFocusCues Gets a value indicating whether the control should display focus
rectangles.
SholvKevboardCues

Gets a value indicating '\>vhether the user interface is in the
appropriate state to shO\V or hide keyboard accelerators.
SholvRolvErrors Gets or sets a value indicating \Yhetl1er row headers "vill display
error glyphs for each row that contains a data entry error.
Site Gets or sets the site of the control.
Size Gets or sets U1e height and widU1 of t11e control.
Sorted Column Gets the colUlnn by \Vhich the DataGridVie'v contents are
currently sorted.
SortOrder Gets a value indicating "''bether tl1e items u1 the DataGridVie'v
control are sorted in ascending or descending order, or are not
sorted.
Standard Tab Gets or sets a value indicating ' vhetl1er the TAB key moves the
focus to the next control in the tab order rafuer than 1noving
focus to the next cell in the control.
TabIndex Gets or.sets the tab order of the control ,vithin its container.
374 I PowerShell Studio - A Comprehensive Guide

TabStop Gets or sets a value indicating \Vhether the user cai1 give the
focus to this control using the TAB key.
Tag Gets or sets the object that contains data abot1t the control.
Text This API supports the product infrastructure and is not inte11ded
to be used directly fron1 yotu code. Gets or sets the text
associated with the control. (Overrides Control.Text.)
Top Gets or sets the distance, in pi.xels, between tl1e top edge of the
control and tl1e top edge of its container's client area.
To1>LeftHeaderCell Gets or sets the header cell located in the upper left corner of
the DataGridView control.
TopLevelControl Gets the parent control that is not parented by another Windo\.VS
Forms control. Typically, this is the outermost Form that the
control is contained in.
UserSetCu rso r Gets the default or user-specified value of the Cursor property.
UseWaitCursor Gets or sets a value indicating whether to use the wait cursor for
the current control and all child controls.
VerticalScrollBar Gets the vertical scroll bar of the control.
VerticalScrollingOffset Gets the nnmber of pLxels by which the control is scrolled
vertically.
VirtualMode Gets or sets a value indicating \.vl1ether you have provided your
O\.VO data-1nanagement operations for tl1e DataG1idView
control.
V.i sible Gets or sets a value indicating whether the control and all its
child controls are displayed.
Width Gets or sets the \.vidth of the co11trol.
Window Target This API supports the product infrastructure and is not intended
to be used directly from your code. This property is not relevant
for this class.

DATETIMEPICKER

PROPERTY DESCRIPTION
AccessibilityObject Gets the AccessibleObject assigned to the control.
Accessi.bleDefaultActionDescripti Gets or sets the default action description of the control for use by
on accessibility client applications.
AccessibleDescri1Jt.ion Gets or sets the description of the control used by accessibility clie11t
applications.
AccessibleN ame Gets or sets the name of the control used by accessibility client
applications.
Accessiblellole Gets or sets the accessible role of the control
Allo,vDro1J Gets or sets a value indicating whether the control can accept data that
the user drags onto it.
Anchor Gets or sets the edges of the container to which a control is bound and
detenni nes ho'\ a control is resized with its parent.
AutoScrollOffset Gets or sets where this control is scrolled to in ScrollControllnto Vie\.
PowerShe ll Studio - Refere nce Guide I 375

PROPERTY DESCRIPTION
Auto Size This API supports U1e product infrastructure and is not intended to be
used directly from your code. This property is not relevant for this class.
BackColor Gets or sets a value indicating the background color of the
DateTimePicker control. (Overrides Control.Back.Color.)
Backgroundlmage This API supports the product in:frastJ.ucture and is not ir1tended to be
used directly from your code. Gets or sets the background image for the
control. (Overrides Control.Backgroundlmage.)
Backgrou ndlmageLayout This API suppo1ts the product infrastructure and is not intended to be
used directly from y oUI code. Gets or sets the layout of the background
image of the DateTimePicker control.(Overrides
Control.Backgro1mdlmageLayout.)
BindingContext Gets or sets the B.indingContext for tl1e control.
Bottom Gets the distance, in pixels. benveen the bottom edge of tbe control and
the top edge of its container's client area.
Bounds Gets or sets the size and location of tl1e co11trol iI1cluding its nonclient
elements, in pixels. relative to the parent control.
CalendarFont Gets or sets the font style applied to the calendar.
CalendarForeColor Gets or sets the foreground color of the calendar.
CalendarMonthBackground Gets or sets the background color of the calendar n1ontb.
C alendarTitleBackColor Gets or sets tbe background color of the calendar title.
CalendarTitleForeColor Gets or sets the foregroru1d color of tbe calendar title.
CalcndarTrailin gForcColor Gets or sets the foreground color of the calendar t railing dates.
CanEnablelme Gets a value indicating whether the lmeMode property can be set to an
active value, to enable lME support.
CanFocus Gets a value indicating \vhether the control can receive focus.
CanRaiseEvents Detennines if e\rents can be raised on tbe control.
Can Select Gets a value indicating \Vhetber tbe control can be selected.
Capture Gets or sets a value indicating '"bether the control bas captured the
1nouse.
CausesValidation Gets or sets a value indicating \Vhether the control causes validation to be
perfom1ed on any controls that require validation \Vhen it receives focus.
Checked Gets or sets a value indicating \Vhether tl1e Value property has been set
\Vith a valid date/tin1e value and the displayed value is able to be
updated.
ClientRectangle Gets the rectangle that represents the client area of tlie control.
ClientSize Gets or sets the height and width of the client area of the control.
ComJJanyName Gets the name of the co1npa11y or creator of llie applicati.011 contairling
the control.
Container Gets the !Container that contains the Compo11ent. (Inherited from
Component.)
ContainsFocus Gets a value indicating 'vl1elher the control, or one of its child controls,
currently has the input focus.
ContextMenu Gets or sets the shortcut 1nenu associated witl1 the control.
ContextMenuStritl Gets or sets tl1e ContextMenuStrip associated 'vitb tllis control.
376 I PowerShell Studio - A Comprehensive Guide

PROPERTY DESCRIPTION
Controls Gets the collection of controls contained \:Vithin the control.
Created Gets a value indicating whether the control has been created.
CreateParams Gets the required creation parameters when the co11trol band.le is
created.(Overrides Control. CreateParams.)
Cmsor Gets or sets the cursor that is displayed when the mouse pointer is over
the co11tro l.
Custom.Format Gets or sets the custom date/time format string.
DataBindings Gets the data bindings for the co11trol.
DefaultCursor Gets or sets the default cursor for the control.
DefaultlmeMode Gets the default Input Method Editor (Thffi) mode supported by the
control.
DefaultMargin Gets the space, in pi,"{els, that is specified by default bet\tveen controls.
DefaultMaximumSize Gets the length and height, in pixels, that is specified as the default
maximum size of a control.
DefaultMinimumSize Gets the lengtl1 ai1d height, in pixels, that is specified as the default
nlinimtlffi size of a control.
DefaultPadding Gets the internal spacing, in pixels, of the contents of a control.
Defau It Size Gets the default size of the control. (Overrides Control.DefaultSize.)
DesignMode Gets a value that indicates whetl1er the Component is currently in design
mode.(lnherited from Component.)
DisplayRectangle Gets the rectangle that represents the display area of the control.
Dis1>osing Gets a value indicating whether the base Control class is in the process of
disposing.
Dock Gets or sets wltich control borders are docked to its parent control and
determines ho"v a control is resized \:Vith its parent.
DoubleBuffered This API supports the product infrastructure and is not intended to be
used directly from your code. Gets or sets a value indicating \:vhether the
control should redra"v its surface using a secondary buffer. Setting this
property has no effect on the DateTimePicker control. (Overrides
Co11trol.DoubleBuffered.)
DropDo,vnAlign Gets or sets the aligm11ent of the drop-down calendar on the
DateTitnePicker control.
Enabled Gets or sets a value indicating wl1ether the control can respond to user
interaction.
Events Gets the list of event handlers that are attached to this
Component. (Inl1e1ited fron1 Component.)
Focused Gets a value indicating whether the control has input focus.
Font Gets or sets the font of the text displayed by the control.
FontHeight Gets or sets the 11eight of the font of the control.
ForeColor This API supports the product infrastructure and is not iI1tended to be
used directly fJon1 yotlf code. Gets or sets the foreground color of the
DateTimePicker control. (Overrides Control.ForeColor.)
Format Gets or sets t11e fonnat of the date and tilne displayed in the control.
Handle Gets the window handle that the control is botmd to.
PowerShell Studio - Reference Guide I 377

PROPERTY DESCRIPTION
Has Children Gets a value indicating whether the control contains one or more child
controls.
Height Gets or sets the height of the control.
lmeMode Gets or sets the h1pt1t Method Editor (IME) mode of the control.
ImeModeBase Gets or sets the IME mode of a control.
Invol\.eRequired Gets a value indicating whether tl1e caller must call an invoke method
when making method calls to the control because the caller is on a
different thread than the one the control was created on.
IsAccessible Gets or sets a value indicating whether the control is visible to
accessibility applications.
IsDisposed Gets a value indicating whether the control has been disposed of.
IsHandleCreated Gets a value indicating whetl1er the co11tro1 has a 11andle associated with
it.
IsMirrored Gets a value indicating whether the control is mirrored.
Layou tEngine Gets a cached instance of the control's layout engine.
Left Gets or sets the distance, in pixels, between the left edge of the control
and the left edge of its container's client area.
Location Gets or sets the coordi1iates of the upper-left con1er of the control relative
to the upper-left corner of its container.
Margin Gets or sets the space between controls.
Ma."\:Date Gets or sets the maximum date and tin1e tl1at can be selected in the
control.
Ma."timumDateTime Gets the maximtu11 date value allovved for the DateTi111ePicker control.
MaximumSize Gets or sets the size that is the upper lin1it that GetPreferredSize can
specify.
MinDate Gets or sets the mi11imu1n date and time that can be selected in the
control.
Minimu mDateTime Gets tl1e 1ni1li111tun date vaJue allo,ved for the DateTimePicker control.
MinimumSize Gets or sets the size that is the lower limit that GetPreferredSize can
specify.
Name Gets or sets the llafile of the control.
Padding This API supports the product infrastructure and is not intended to be
used directly from your code. Gets or sets the spacing between the
contents of the DateTimePicker control and its edges.
Parent Gets or sets the parent co11tainer of the control.
PreferredHeight Gets the preferred height of the DateTimePicker control
PreferredSize Gets tl1e size of a rectru1gular area into which the control can fit.
ProductName Gets the product name of tl1e assembly containing the control.
ProductVersion Gets tl1e version of the assembly co11taining the control.
RecreatingHandle Gets a value iI1dicafu1g whether tl1e control is cturently re-creating its
11anclle.
Region Gets or sets the vvindow region associated ~vith the control.
RenderRightToLeft Obsolete.This property is now obsolete.
378 I PowerShell Studio - A Comprehensive Guide

PROPERTY DESCRIPTION
ResizeRedraw
- - - - - - - -
Gets or sets a
- -
value
- - - -
indicati11g
-\V
- -
hether
-the control redra\.vs itself when
resized.
Right Gets the distance, in pixels, betwee11 the right edg~ of the control and the
left edge of its container's client area.
RightToLef't Gets or sets a value indicating \.vl1etber control's elemen ts are aligned to
support locales using right-to-left fonts.
RightToLeftLayout Gets or sets \.vhether the contents of t11e DateTi1nePicker are laid out
from 1igl1t to left.
ScaleChildren Gets a value that detennines the scaling of child controls.
ShowCheckBox Gets or sets a value indicating wl1etber a check box is displayed to the
left of the selected date.
Show FocusCues Gets a value indicating \vbether the control should display focus
rectangles.
Sho\vKeyboard Cues Gets a value indicating \vhether the user interface is in the appropriate
state to show or hide keyboard accelerators.
Sho\vUpDown Gets or sets a value indicating whether a spin button control (also known
as an up-down control) is used to adjust the date/tilne value.
Site Gets or sets the site of the control.
Size Gets or sets tl1e height and widtl1 of the control.
Tablndex Gets or sets the tab order of the control '1vithin its co11tainer.
TabStop Gets or sets a value indicating \.vhether the user can give the focus to this
control using the TAB key.
Tag Gets or sets the object that contains data about the control
Text Gets or sets the text associated \.vitl1 this control. (Overrides
Control. TeA't.)
Top Gets or sets the distance, in pixels, bet'Ween the top edge of the control
and the top edge of its container's client area.
TopLevelControl Gets the parent control that is not parented by a11other Wi11dows Fon11S
control. Typically, this is the outer1nost Form that tl1e control is
contained in.
UseW aitCursor Gets or sets a value indicating wl1ether to use the wait cursor for the
current control and all child controls.
Value Gets or sets tlle date/tiine value assigned to tl1e control.
Visible Gets or sets a value indicating vvl1ether the control and a.11 its child
controls are displayed.
Width Gets or sets the width of the control.
Winclo,vTarget This API supports the product infrastructure and is not intended to be
used directly from your code. This property is not relevant for this class.
DOMAINUPDOWN

PROPERTY DESCRIPTION
-- ---
AccessibilityObject Gets the AccessibleObject assigned to tl1e control.
Accessi b leDefaultActionDescription Gets or sets the default action description of the control for use by
accessibility client ap_plications.
PowerShell Stu dio - Reference Guide. I 379

PROPERTY DESCRIPTION
AccessibleDesc1iption Gets or sets the description of the control used by accessibility
client applications.
Accessible.N"aine Gets or sets the name of the co11trol used by accessibility client
applications.
AccessiblelloJe Gets or sets the accessible role of the control
ActiveControl Gets or sets the active control on the container control.
AllowDrop Gets or sets a value indicating whether the control cai.1 accept data
that the user drags onto it.
Anchor Gets or sets the edges of the container to ':vhich a control is botu1d
and determines how a control is resized \.vith its parent.
AntoScaleDimensions Gets or sets the dimensions that the control was designed to.
AutoScaleFacto r Gets the scaling factor ben;vee11 tl1e Cll1Te11t and design-time
auto111atic scaling din1ensions.
AutoScaleMode Gets or sets the automatic sca1ing mode of the control.
Auto Scroll This API supports the product infrastructure and is not intended to
be used directly from your code. Gets a value indicating whether
the container will allow the user to scroll to any controls placed
outside of its visible boundaries.
Auto Scro IIMargin This API supports the product infrastructure and is not intended to
be used directly fro111 yol1r code. Gets or sets the size of the auto-
scroll margin.
AutoScrollMinSize This API supports the product infrastn1cture ru1d is not intended to
be used directly fro1n your code. Gets or sets the rnitlimun1 size of
the auto-scroll area.
AntoScrollOffset Gets or sets where tl1is control is scrolled to in
Scroll ControllntoVievv.
AutoScroJIPosition Gets or sets tl1e location of the auto-scroll position.
AutoSize Gets or sets a value indicating whether the control should
automatically resize based on its contents.
Auto Validate Gets or sets a value that indicates whether controls in tllls
contai11er will be automatically ' 'alidated when the focus changes.
BackColor Tills API supports the product infrastn1cture and is not intended to
be used directly from your code. Gets or sets the background color
for tlle teA1 box portion of the spin box (also knovv11 as ru1 up-down
control).
Backgroundlm age Th.is API suppo1ts tlle product infrastn1cture and is not intended to
be used directly from yot1r code. Gets or sets the background
irnage for the UpDownBase.
BackgroundlmageLayou t This API supports the product infrastn1cture and is not intended to
be used directly from your code. Gets or sets the layout of tlle
Backgroundlmage of the UpDo,vnBase.
Bin dingContext Gets or sets the BindingContext for the control.
Borders tyJe Gets or sets the border sty le for the spin box (.also kno\v-n as an up-
down control).
Bottom Gets tl1e distance. in pixels, bet\veen the bott om edge of the
control and the top edge of its container's client aiea.
380 I PowerShell Studio - A Comprehensive Guide

PROPERTY DESCRIPTION
Bounds Gets or sets the size and location of the control including its
nonclient elements, in pi,"'{els, relative to the parent control.
CanEnablelme Gets a value indicating whether the ImeMode pi-operty can be set
to an active value, to enable IME support.
CanFocus Gets a ,ralue indicating whether the control can receive foct1s.
CanRaiseEvents Determines if events can be raised on the control.
CanSelect Gets a value indicating whether the control can be selected.
Capture Gets or sets a value indicati11g whether the control has captured
the n1ouse.
CausesValidation Gets or sets a value indicatil1gwl1ether the control causes
validation to be performed on any controls that require validation
when it receives focus.
ChangingText Gets or sets a value indicating ~vhether tl1e text property is being
changed ii1ten1ally by its parent class.
Clie.ntRectan gle Gets the rectangle that represents the client area of the control.
ClientSize Gets or sets the height and width of the client area of the control.
CompanyName Gets the name of the company or creator of the application
containing the control.
Container Gets the !Container that contaiI1s the Component.
Contai.nsFocus Gets a value indicating whether the control, or one of its child
controls, currently lias the input focus.
ContextMenu This API supports the product infrastn1cture and is not intended to
be used directly fro1nyour code. Gets or sets the shortcut menu
associated with the spin box (also known as an up-dovvn control).
ContextMenuStrip Gets or sets the shortcut menu for the spin box (also k11own as an
up-down control).
Controls Gets the collection of controls contained within the control.
Created Gets a value indicating whether the control lias been created.
CreateParams This API supports the product infrastructure and is not intended to
be used directly fro1n your code. Gets the required creation
paraineters when the control handle is created.
Cu r1entAu toScaleDimensions Gets the current run-tilne dimensions of the screen.
Cursor Gets or sets the cursor that is displayed vvhen the mouse pointer is
over the control.
DataBindings Gets the data bindings for the control.
DefauJtC'ursor Gets or sets the default cursor for tl1e control
DefaultlmeMode Gets the default Input Method Editor (IME) mode supported by
t11e control.
DefaultMargin Gets the space, in pi,"'{els, that is specified by default bet\veen
controls.
DefaultMaximumSize Gets the length and height, in pixels, that is specified as the default
tnaximmn size of a control.
DefaultMi.nimumSize Gets the lengtl1 and height, in pixels that is specified as the default
minimtun size of a control
DefaultPadding Gets the internal spacing, in pixels of the contents of a control.
PowerShell Studio - Reference Guide I 381

PROPERTY DESCRIPTION
DefaultSize Gets the default size of tl1e control.
DesignMode Gets a value that indicates \ivl1ether the Component is c1mently in
design mode.
Dis11layRectangle Gets the rectangle that represents tl1e virtual display area of the
control.
Disposing Gets a value indicating whether the base Control class is in the
process of disposing.
Dock Gets or sets which control borders are docked to its parent control
and deten1lines how a control is resized with its parent.
DockPadding This API supports the product infrastructure and is not intended to
be used directly from yo11r code. Gets the dock padding settings
for all edges of the UpDownBase control.
DoubleBuffered Gets or sets a value indicating \:vhetber this control should redraw
its surface using a secondary buffer to reduce or prevent flicker.
Enabled Gets or sets a value indicating whether the control can respond to
user interaction.
Events Gets tl1e list of event handlers that are attached to this Component.
Focused Gets a value indicating wbetl1er the control has input focus.
Font Gets or sets the font of the teA1 displayed by the control.
FontHeight Gets or sets the height of the font of the control.
ForeColor Gets or sets the foreground color of the spin box (also known as
an up-down control).
Handle Gets t11e vvindo\iv liandle t11at the contro1 is bo1md to.
H.asChildren Gets a value indicati.I1g whetl1er the control contains one or more
child controls.
Height Gets or sets the height of the control.
HorizontaJScroll Gets the characteristics associated \Vitl1 the horizontal scroll bar.
HScroll Gets or sets a value indicating whether the 11orizontal scroll bar is
visible.
ImeMode Gets or sets the Input Method Editor (IME) mode of the contTol.
ImeModeBase Gets or sets t11e IME mode of a control.
lntercepU\rroW'l(eys Gets or sets a value indicating ,;vhetl1er the user can use t11e UP
ARROW and DOWN ARROW keys to select values.
JnvokeRequired Gets a value indicati.11g whetl1er tl1e caller n1ust call an invoke
metl1od when making method calls to the control because the
caller is on a different thread than the one the control was created
on
IsAccessible Gets or sets a value indicating ,;vhether the control is visible to
accessibility applications.
IsDisposed Gets a value indicating whether tl1e control has been disposed of.
IsHandleCreated Gets a value indicating whether tl1e coutrol lias a handle associated
\Vith it.
IsMirrored Gets a value indicating whether tl1e control is mirrored.
Items A collection of objects assigned to tl1e spin box (also known as an
up-do\.vn control).
382 I PowerShell Studio - A Comprehensive Guide

PROPERTY DESCRIPTIC>N
LayoutEngine Gets a cached instance of the control's layout engine.
Left Gets or sets the distance, in pixels, between the left edge of the
control ru1d tJ1e left edge of its container's client area.
Location Gets or sets the coordinates of t11e upper-left comer of the control
relative to the upper-left comer of its container.
Margin Gets or sets the space ben-;veen controls.
MaximumSize Gets or sets the maximum size of the spin box (also kno"vn as an
up-down control).
MinimumSize Gets or sets the rninimum size of the spin box (also know11 as an
up-down control).
Name Gets or sets the name of the control.
Padding This API supports the product infrastn1cture and is not intended to
be used directly fro111 your code. Gets or sets the spacing between
the Domai11UpDown control's co11tents and its edges.
Parent Gets or sets the parent container of the control.
ParentForm Gets the form that the container control is assigned to.
PreferredBeight Gets tl1e heigl1t of the spin box (also known as an up-d.ovvn
control).
PreferredSi1,e Gets the size of a rectangular area into \Vhi.ch the control can fit.
ProductName Gets the product name of the assembly containing the control.
ProductVersion Gets the version of the assembly containing the control.
Read Only Gets or sets a value indicati11g wl1ether the text can be changed by
tl1e use of the up or do,vn buttons only.
RecreatingHandle Gets a value indicating \vhether the control is currently re-creating
its handle.
Region Gets or sets the window region associated ' vith the co11trol.
RenderRightToLeft Obsolete.Tins property is now obsolete.
ResizeRed1aw Gets or sets a value indicating whether the control redraws itself
when resized.
Right Gets the distru1ce, in pixels, behveen the right edge of the control
and the left edge of its container's client area.
RightToLeft Gets or sets a value indicating whether control's elements are
aligned to support locales using right-to-left fo11ts.
ScaleChildren Gets a value that detennines the scaling of child controls.
Selectedlndex Gets or sets the index value of the selected item.
Selectedltem Gets or sets the selected item based on the index value of the
selected item in the collection.
Show Focus Cues Gets a value indicating whether the control should display focus
rectangles.
Show Keyboard Cues Gets a value indicating \V hether the user interface is in the
approp1iate state to sho\<v or hide keyboard accelerators.
Site Gets or sets the site of the control.
Size Gets or sets tl1e height and width of the control .
PowerShell Studio - Reference Guide I 383

PROPERTY DESCRIPnON
Sorted Gets or sets a value indicating whether the jtem collection is
sorted.
Tablndex Gets or sets the tab order of the co11trol \Vithir1 its container.
TabStOJl Gets or sets a value indicating whether the user can give the focus
to this control using the TAB key.
Tag Gets or sets the object that contains data about the control
Text Gets or sets the text displayed in the spin box (also known as an
up-do\>vn control).
TextAlign Gets or sets the aligru:nent of the text in the spin box (also known
as an up-down control).
Top Gets or sets the distance~ in p.Lxels, bet"\veen the top edge of the
control and the top edge of its container's client area.
To1>LeveJControl Gets t11e parent control that is .not parented by another Windo\;vs
Fo1IDS control. Typically this is the outer1nost Form that the
control is contained in.
UpDownAlign Gets or sets the alignment of tl1e up and down buttons on the spin
box (also known as an up-down control).
UserEdit Gets or sets a value indicating \Vhether a value has been entered by
the user.
UseW aitCu rsor Gets or sets a value indicating vvhether to use the wrut cursor for
the current control and all child controls.
VerticalScroll Gets the cliaracteristics associated wit11 the ve1tical scroll bar.
Visible Gets or sets a value indicating whetl1er tl1e control and all its child
controls are displayed.
VScroll Gets or sets a value indicating \Vhetber the vertical scroll bar is
visible.
Width Gets or sets the width of the control.
Window Target This API supports the product infrastructure and is not intended to
be used directly fron1 yo11r code. This property is not relevant for
this class.
Wrap Gets or sets a value indicating wbetlier the collection of items
continues to the first or last item if the user continues past the end
of the list.

ERRORPROVIDER

Blinl<Rate Gets or sets the rate at wllich the error icon flashes.
Blinl<S tyle Gets or sets a value inrucating when tl1e e1ror icon flashes.
CanRaiseEve Gets a value indicating vvhether the component can rruse an event.
nts
Container Gets the I Container tl1at contfilns the Con1ponent.
ContainerCon Gets or sets a value indicating the parent control for this ErroIProvider.
trol
DataMember Gets or sets the list '1vithin a data so1uce to n1onitor.
384 I PowerShell Studio - A Comprehensive Guide

DataSource Gets or sets the data source that the ErrorProvider inonitors.
DesignMode Gets a value that indicates \Vhether the Component is c1rrrently in design inode.
Events Gets the list of event handlers that are attached to this Component.
Icon Gets or sets the Icon tl1at is displayed next to a control when a11 error description string has
been set for the control.
RightToLeft Gets or sets a value that indicates whether the component is used in a locale that supports
right-to-left fonts.
Site Gets or sets the ISite of tl1e Component.
Tag Gets or sets an object that contains data about the component.

FILESYSTEMWATCHER

PROPERTY DESCRIPTION
CanRaiseEvents Gets a value indicating whether the component can raise an event.
Container Gets tl1e IContainer that contains the Compo11ent.
DesignMode Gets a value that indicates whetl1er the Con1ponent is cturently in design mode.
EnableRaisin gEvents Gets or sets a value indicating whether the component is enabled.
Events Gets the list of event handlers that are attached to this Compo11ent.
Filter Gets or sets the filter string used to detenuine what files are n1onitored in a
directory.
IncludeSubdirectories Gets or sets a value indicating whether subdirectories within the specified path
should be monitored.
InternalBufferSize Gets or sets the size (in bytes) of tl1e il1temal buffer.
Notify

Filter Gets or sets tl1e type of changes to watch for.
Path Gets or sets the patl1 of the directory to watch.
Site Gets or sets ai1 ISite for the FileSystemWatcher.
SyuchronizingObject Gets or sets the object used to inarshal tl1e event handler calls issued as a result of
a directory change.

FLOWLAYOUTPANEL

PROPERTY DESCRIPTION
AccessibilityObject Gets the AccessibleObject assigned to the control.
AccessibleDefaultActionDescri11tion Gets or sets tl1e default action description of tl1e
control for use by accessibility client applications.
AccessibleDescri11tion Gets or sets the description of the control used by
accessibility client applications.
AccessibleN rune Gets or sets the na1ne of tl1e control used by
accessibility client applications.
AccessibleRole Gets or sets the accessible role of the control
AllowDro11 Gets or sets a value indicating \hetber the control can
accept data that the user drags onto it.
PowerShell Studio - Reference Guide I 385

Anchor Gets orsets the edges of the container to which a


control is bound and determines how a control is
resized vvith its parent
AutoScroll Gets or sets a value indicating whether the container
enables the user to scroll to any controls placed
outside of its visible botmda1ies.
AutoScrollMargin Gets or sets the size of the auto-scroll margin.
AutoScrollMinSize Gets or sets the minimmn size of the auto-scroll.
AutoScrollOffset Gets or sets where this control is scrolled to in
ScrollControllntoView.
AutoScrollPosition Gets or sets the location of the auto-scroll position.
Auto Size Gets or sets a value that indicates whether the control
resizes based on its contents.(Inl1erited fron1 Panel.)
AutoSizeMode Indicates the automatic sizing behavior of the
control.(lnherited fro1n Pai1el.)
BackColor Gets or sets the background color for the control.
Bacl<grouncllmage Gets or sets the background image displayed in the
control.
BackgroundlmageLayout Gets or sets the background ilnage layout as defined
in the ImageLayout enun1eration.
Bin dingContext Gets or sets tl1e BindingContext for the control.
BorderStyle Indicates the border style for the control.(Inberited
from Pai1el.)
Bottom Gets the distance, in pixels, bet\;veen the botto1n edge
of the control and the top edge of its container's client
area.
Bounds Gets or sets the size and location of the control
including its nonclient elements, in pLxels, relative to
the parent control.
CanEnablelme Gets a value indicating ,;vhether the ImeMode
property can be set to ai1 active value, to enable Th1E
Sllpport.
CanFocus Gets a value indicating whether the control can
receive focus.
CanRaiseEvents Determil1es if events can be raised on the control.
CanSelect Gets a value indicating wl1ether tl1e co11trol can be
selected.
Capture Gets or sets a value indicating whether the control has
captured the mouse.
CausesValidation Gets or sets a value indicating whether the control
causes validation to be perfonned on any controls tliat
require validation when it receives focus.
ClientRectan gle Gets the rectangle that represe11ts the client area of the
control.
ClientSize Gets or sets the height and \Vidth of the client area of
the control.
Com1>anyName Gets the name of tl1e co1npany or creator of tl1e
application containing the control.
386 I PowerShell Studio - A Comprehensive Guide

Container Gets the !Container that contains the Component.


ContainsFocus Gets a value indicating'"hether the control, or one of
its child controls, currently has the ~put focus.
ContextMeuu Gets or sets the shortcut menu associated with the
control.
ContextMenuStri1> Gets or sets the ContextMenuStrip associated with
this control.
Controls Gets the collection of controls contained within the
control.
Created Gets a value indicating vvhetl1er the control has been
created.
C reateP aram s Gets the required creation parameters when the
control l1andle is created.(Inherited from Panel.)
Cursor Gets or sets the cursor that is displayed when the
n1ouse poiirter is over the control.
DataBindings Gets the data bindings for the control.
DefaultCursor Gets or sets the default cwsor for the control.
DefaultlmeMode Gets the default Input Method Editor (IJ\.1E) mode
supported by the control.
Defau ltMargin Gets the space, iI1 pi,'{els, that is specified by default
between controls.
DefaultMaximumSize Gets the length and 11eight. in pixels, that is specified
as the default maximtllll size of a control.
DefaultMinimumSize Gets the length and 11eight, in pi,xels, that is specified
as the default m:i.J1in1wu size of a control.
DefaultPadding Gets the internal spacing, in pixels, of the contents of
a control.
DefaultSize Gets the default size of the control.(Inherited from
Panel.)
DesignMode Gets a value that indicates whetl1er the Component is
currently in design mode.
DisplayRectangle Gets the rectangle that represents t11e virtual display
area of the control.
Disposing Gets a value indicating whether the base Control class
is in the process of disposing.
Dock Gets or sets vvhich control borders are docked to its
parent control and determines how a control is resized
vvith its parent.
DockPadcling Gets the dock padding settings for all edges of the
control.
DoubleBuffered Gets or sets a value indicating whether this control
should redraw its surface using a secondary buffer to
reduce or prevent flicker.
Enabled Gets or sets a value indicating whether the control can
respond to user interaction.
Events Gets the list of event handlers that are attached to this
Component.
Flo\vDirection Gets or sets a value indicating tl1e flow direction of
the FlowLayoutPanel control.
PowerShell Studio - Reference Guide I 387

Focused Gets a v~lue indicating whether tl1e control has input


focus.
Font Gets or sets the font of the tex.1: displayed by tl1e
control.
FontHeight Gets or sets the height of tl1e font of the control.
ForeColor Gets or sets the foreground color of the control.
Handle Gets the \:vindo\ handle that the control is bound to.
HasChildren Gets a value indicating \hether the control contains
one or more child controls.
Height Gets or sets the height of the control.
HorizontalScroll Gets the characteristics associated with the horizontal
scroll bar.
HScrolJ Gets or sets a val.ue indicating whether the horizontal
scroll bar is visible.
ImeMode Gets or sets the Input Method Editor (IME) mode of
the control.
lmeModeBase Gets or sets the IME 1node of a control.
lnvol{eRequired Gets a value indicating whether tl1e caller 1nust call an
invoke nlethod when 1naking 1nethod calls to the
control because th.e caller is on a different thread than
the one the control was created on.
lsAccessible Gets or sets a value indicating whether the control is
visible to accessibility applications.
IsDisposecl Gets a value indicating whether the control has been
disposed of.
lsHandJeC reated Gets a value indicating wl1ether the control has a
handle associated with it.
IsMirrored Gets a value indicating \vhether the control is
mirrored.
LayoutEngine Gets a cached instance of the panel's layout
engine.(Overrides Control.LayoutEngine.)
Left Gets or sets the distance, in pixels between the left
edge of the control ru1d t11e left edge of its container's
client area.
Location Gets or sets the coordiuates of the upper-left corner of
the control relative to the upper-left comer of its
container.
Margin Gets or sets the space between controls.
Maximu mSize Gets or sets the size that is the upper lirnit that
GetPrefelTedSize can specify .
Minimu mSize Gets or sets the size tliat is the lo,ver limit that
GetPreferredSize can specify.
Name Gets or sets the name of tl1e control.
Padding Gets or sets padding within the control.
Parent Gets or sets the parent container of the control.
PrefenedSize Gets the size of a rectangular area into \Vhicl1 the
control can fit.
388 I PowerShell Studio - A Comprehensive Guide

ProductName Gets the product name of the assembly containing the


control.
ProductVersion Gets the version of tl1e assen1bly containing the
control.
RecreatingHanclle Gets a value indicating whetl1er the control is
currently re-creating its handle.
Region Gets or sets the wil1dow region associated with the
control.
Ren derRightToLeft Obsolete.This property is now obsolete.
ResizeRed raw Gets or sets a value indicating 'vhether the co11trol
redraws itself \.v henresized.
Right Gets the distance in pixels. between the right edge of
the control and the left edge of its container's client
area.
RightToLeft Gets or sets a value indicating \Vhether control's
elements are aligned to support locales using rigl1t-to-
left fonts.
ScaleCbildren Gets a value that determines the scaling of child
controls.
Sho\v FocusCues Gets a value indicating whether the control should
display focus rectangles.
SbowKeyboardCues Gets a value indicating whether the user il1terface is in
fue appropriate state to show or hide keyboard
accelerators.
Site Gets or sets the site of tl1e control.
Size Gets or sets the height and 'vidth of the control.
TabIndex Gets or sets the tab order of the control within its
container.
TabStOJl Gets or sets a value indicatil1g whether tl1e user can
give the focus to tllis control using the TAB
key. (Inherited from Panel.)
Tag Gets or sets the object that contains data about the
control.
Text This API supports the product infrastn1cture and is not
intended to be used directly fro1n your code. This
n1ember is not meaningful for tl1is control.(lnherited
from Panel.)
Top Gets or sets the distance, in pixels, behveen the top
edge of the control and the top edge of its container's
client area.
TopLevelCont rol Gets the parent control tliat is not parented by another
Windo\.vs Forms control. Typically, tllis is the
outennost Fonn tllllt the control is contained in.
UseWaitCursor Gets or sets a value indicating whether to use the wait
cursor for the current control and all child controls.
VerticalScroll Gets the characteristics associated V\1ith the vertical
scroll bar.
Visible Gets or sets a value indicati11g wbet11er the control and
all its child controls are displayed.
PowerShell Studio - Reference Guide I 389

VScroll Gets or sets a value indicating whether tl1e vertical


scroll bar is visible.
Width Gets or sets the width of tl1e control.
Windo\vTarget Th.is API st1pports the product infrastructure and is not
intended to be used directly from yotu code. This
property is not relevant for this class.
WrapContents Gets or sets a value indicating w11ether the
Flo\.YLayoutPanel control should wrap its contents or
let tl1e contents be clipped.

FOLDERBROWSERMODERNDIALOG

PROPERTIES DESCRIPTION
Container Gets the I Container t11at contains the Co1nponent.(Inherited fro1n Component.)
Description Gets or sets the descriptive text displayed above tl1e tree view control in the dialog
box.
RootFolder Gets or sets the root folder \.vhere tl1e browsing struts fro1n.
SelectedPatb Gets or sets the path selected by the user.
Sholl1Ne,vFolderButton Gets or sets a value indicating whether the New Folder button appears in the folder
browser dialog box.
Site Gets or sets the ISite of the Co111ponent.
Tag Gets or sets an object that contains data about tl1e control.

FONTDIALOG

Name Description
AllowScriptChange Gets or sets a value indicating \hether the user can change the cliaracter set specified in
the Script combo box to display a character set otl1er than tlle one currently displayed.
Allows imulations Gets or sets a value indicating whether the dialog box allows graphics device inte1face
(GDI) font simulations.
Allo,vVectorFonts Gets or sets a value i11dicating whether the dialog box allo\>vs vector font selections.
Allo,vVe11icalFonts Gets or sets a value indicating \vhether the dialog box displays both vertical and
horizontal fonts or only horizontal fonts.
CanRaiseEvents Gets a value indicating wl1ether tl1e compo11ent can raise an event. (Inherited from
Component.)
Color Gets or sets the selected font color.
Container Gets the !Container that contains tl1e Component. (Inherited from Component.)
DesignMode Gets a value that indicates whether the Component is currently in design inode. (Inherited
fron1 Co1npo11ent.)
390 I PowerShell Studio - A Comprehensive Guide

Name Description
Events Gets tbe list of event handlers that are attached to this Component. (lnl1erited fro1n
Component.)
FixedPitcb 0 nly Gets or sets a value indicating whether the dialog box allo,vs only the selection of fixed-
pitch fonts.
Font Gets or sets the selected font.
FontMustExist Gets or sets a value indicating wl1ether the dialog box specnies an error condition if the
user atten1pts to select a font or style that does not exist.
MaxSiz,,e Gets or sets tl1e maximum point size a user can select.
MinSize Gets or sets tbe 111ini1num point size a user can select.
01>tions This API supports the product infrastructure and is not intended to be used directly from
your code. Gets values to initialize the FontDialog.
Scripts Only Gets or sets a value indicating 'vhether the dialog box allows selection of fonts for all
non-OEM and Symbol character sets. as 'veil as the ANSI character set.
Show Apply Gets or sets a value indicating whether tl1e dialog box contains ai1 Apply butto11.
ShowColor Gets or sets a value indicating whether the dialog box displays the color choice.
Sho,vEffects Gets or sets a value indicating whether the dialog box contains controls that allow the
user to specify strikethrough, tmderline. and text color options.
Sbo,vHelp Gets or sets a value indicating whether the dialog box displays a Help button.
Site Gets or sets the ISite of the Co1nponent. (Inherited fro1n Coniponent.)
Tag Gets or sets an object that contains data about the control. (Inherited from
CommonDialog.)

GROUP BOX

PROPERTY DESCRIPTION
Actu alHeight Gets the rendered hei_ght of this element.
ActualWidtb Gets the rendered \vidth of this element.
Allo,vDrop Gets or sets a value indicating 'vbether this element can be used as the
target of a drag-and-drop operation. This is a dependency property.
AreAnyTouchesCaptu red Gets a value that indicates \Vhether at least one toucl1 is captured to tllis
element.
AreAnyTouchesCapturedWith Gets a value that indicates whether at least one touch is captured to tllis

m element o.r to any child elements inits visual tree .
AreAnyToucbesDirectlyOver Gets a value that indicates whether at least one touch is pressed over this
element.
AreAnyToucbesOver Gets a value that indicates whetl1er at least one touch is pressed over this
element or any child elements in its visual tree.
Bacl<ground Gets or sets a bn1sh that desc1i bes the background of a control.
BindingGroup Gets or sets the BindingGroup that is used for the element.
BitmapEffect Obsolete.Gets or sets a bitmap effect that applies directly to the rendered
content for this element. This is a dependency property.
PowerShell Studio - Reference Guide I 391

PROPERTY DESCRIPTION
BitinapEffectln1Jut Obsolete. Gets or sets an input source for the bitmap effect that applies
directly lo the rendered co11tent for this eleme11t. This is a dependency
property.
BorderBrusb Gets or sets a bntsh t11at describes the border background of a control.
BorderTbickness Gets or sets the border thickness of a control.
CacheMode Gets or sets a cached representation of the UIElen1ent.
Clip Gets or sets the geo1netry used to defme the outline of the contents of an
elen1ent. This is a dependency property .
Cli1JT0Bounds Gets or sets a ' 'alue indicating '"hether to clip the content of this element
(or content co1ning frorn the child elements of U1is ele111ent) to fit into the
size of the containing element. This is a dependency property .
CommandBindings Gets a collection of CommandBinding objects associated \ith this elen1ent.
A Con1I0andBindil1g enables comnlalld ha11dling for this element. a11d
declares the linkage behveen a cornn1and, its events, and the handlers
attached by this element.
Content Gets or sets the content of a ContentC011trol. (Inherited from
ContentControl.)
ContentStringFormat Gets or sets a composite stting thar specifies ho'v to format the Co11tent
property if it is displayed as a string.(lnherited from ContentControl.)
ContentTemplate Gets or sets the data ten1plate used to display the content of the
ContentCo nlTol. (Inherited fro1n ContentControl.)
ContentTemplateSelector Gets or sets a template selector that enables an application \.Yriter to provide
custom te1nplate-selection logic. (Inherited from Conte11tControl. )
ContextMenu Gets or sets the context n1enu elen1ent that should appear \Vhenever the
context tnenu is requested tluough user interface (UI) fro1n \Vithin Utls
element.
Cursor Gets or sets the cwsor that displays 'vhen the mouse pointer is over this
element.
DataContext Gets or sets U1e data context for an e1e1nent when it participates in data
binding.
DefaultStyleKe~1 Gets or sets the key to use to reference the style for this control. \vhen
the1ne styles are used or defined.
De1>en dencyObjectTy1>e Gets the DependencyO~jectType that ' vraps the CLR type of tllis ilistai1ce.
(Inherited from DependencyObject.)
Desired Size Gets the size tl1at tltis element co1nputed during the n1easure pass of the
layout process.
Dispatcher Gets the Dispatcher Ulis DispatcherObject is associated ' vith. (lnl1eriled
from DispatcherObject.)
Effect Gets or sets U1e bitn1ap effect to apply to U1e UIEle1nenl. This is a
dependency propetty.
FlowDirection Gets or sets the direction that text and other user interface (UI) ele1ne11ts
flov. ,,ithin any parent element that controls their layout.
1

Focusable Gets or sets a value that indicates \Yhether the ele1nent can receive focus.
This is a dependency property.
FocusVisualStyle

Gets or sets a property that enables customization of appearance, effects, or
other sty le cl1aracteristics that 'vill apply to this ele1nent "vhen it captures
keyboard focus.
FontFamily

Gets or sets the font fanrily of the co11trol.
FontSizc Gets or sets the font size.
392 I PowerShell Studio - A Comprehensive Guide

PROPERTY DESCRIPTION
FootStretch Gets or sets the degree to which a font is condensed or expanded on the
screen.
FootStvle

Gets or sets the font st)rlc.
FootWcight Gets or sets the \Veight or thickness of the specified font.
ForceCursor Gets or sets a value that indicates \Vhetl1er tllis Fratne,vorkElement should
force the user interface (UI) to render the cursor as declared by the Cursor
property .
Foreground Gets or sets a brush that describes the foreground color.
BandlesScrolling Gets a value that indicates \.Vhether a control supports scrolling.
HasAnimatedPrope11ies Gets a value indicating \Vhether U1is element has any animated properties.
BasContcnt Gets a value that indicates v,; hether the ContentControl contains content.
(Inherited fron1 ContentControl.)
HasEffectiveKc, boarclFocus
1
Gets a value that indicates '"11ether the UIElement has focus.
HasHeader Gets a value that indicates whether the header is null.
Header Gets or sets the data used for tlle header of each control.
HcadcrStiingFormat Gets or sets a composite string that specifies hO\Vlo fomial the Header
propert)' if it is displayed as a string.(In11erited fron1
Headered ContentControl.)
BeaderTempJate Gets or sets the template used to display t11e content of the control's header.
HcaderTcmplateSelcctor Gets or sets a data template selector that provides custon-a logic for
choosing the template used to display the header.
Height Gets or sets the suggested height of tlle ele1nent.
HorizontalAJignment Gets or sets t..he horizontal alignment characteristics applied to Uris eleinent
\Vhen it is con1posed \vitllin a parent element. such as a panel or itenlS
control.
HorizontalContentAlignment Gets or sets the horizontal aligrunent of the control's content.
InheritanceBehavior Gets or sets the scope limits for prope1ty value inheritance, resource key
lookup. and RelativeSource FindAncestor lookup.
lnputBindings Gets the collection of input bindings associated with this element.
lnputScope Gets or sets the context for input used by Uris Frame,vorkElement.
IsArrangeValid Gets a value indicating 'vhether the computed size and position of child
ele1nents in this ele1nent's layout are valid.
lsEnabled Gets or sets a value indicating ,~v hether this element is enabled in the user
interface (UI). This is a dependency property.
lsEnabledCore Gets a val ue that becomes the return value of IsEnabled ]11 derived classes.
lsFocused Gets a value tlial detennines \Vbether this element has logical focus. This is
a dependency property.
IsHitTcstVisible Gets or sets a value that declares ' vhether this ele1nent can possibly be
returned as a bit test result from some portion of its rendered content. Th.is
is a dependency property.
lslnitialized Gets a value that indicates '~1 hether this element bas been initialized, either
during processing by a XAML processor. or by explicitly having its End.I1lit
nlethod caJled.
IslnputMethodEnabled Gets a value indicating whether an input method system, such as an Input
Method Editor {IME), is enabled for processing the input to this element.
IsKeyboardFocused

Gets a value indicating ivhether this element bas keyboard focus . This is a
dependency property .
IsKeyboardFocusWitbin Gets a value indicating 'vJ1ether keyboard focus is anywhere " ;ithin U1e
ele1nent or its vjsual tree child elen1ents. This is a dependency property.
PowerShe ll Studio - Refere nce G uid e I 393

PROPERTY DESCRIPTION
lsLoaded Gets a value that indicates vvhether this element has been loaded for
presentation.
IsManipulationEnabled Gets or sets a value that indicates \Vhether n1anipulation events are enabled
on this UIEle111ent.
lsMeasu reV alid Gets a value indicating \Vhether the current size returned by layoul n1eastue
is valid.
IsMouscCaptured Gets a value indicating \ Vhether the 1nouse is captured to Uris element. This
is a dependency property.
IsMouseC aptu reWithin Gets a value that dete111rines \Vhether 1nouse capture is held by Uris eletnent
or by child elements in its visual tree. This is a dependency property.
IsMouseDirectlvOver

Gels a value that indicates \Yhelher tl1e position of the mouse poi11ter
corresponds to hit test results, \Vhich take element compositing into
account. This is a dependency property.
l sMouseOver Gets a value ii1dicating whether the tnouse pointer is located over this
element (including child elements in the visual tree). This is a dependency
property.
IsSealed Gets a value Ulat indicates \vhether this instance is currently sealed (read-
onJy).(lnJ1erited fro1n DependencyObject.)
IsS tylusC ap tured Gets a value indicating \vhether tl1e stylus is captured by this element. This
is a dependency property .
IsStylusCa1,tureWithin Gets a value that detennines \Vhetl1er stylus capture is held by this ele1nent,
or an element \itirin U1e elen1ent bounds and its visual tree. This is a
dependency property.
IsStylusDirectlyOver Gets a value that indicates whether the Sl)rlus position corresponds to hit
test results. \Vhich take element compositing into account. This is a
dependency property.
IsStytusOver Gets a value indicating \vhether the stylus cursor is located over this
element (including visual child elen1ents). This is a dependency property.
IsTabStop Gets or sets a value that indicates \Vhether a control is included in tab
navigation.
IsVisible Gets a value indicating whether this ele1nent is visible in the user interface
(UI). This is a dependency properly.
Language Gets or sets localization/globalization language information that applies to
an ele1nent.
LayoutTransform

Gets or sets a graphics transformation that should apply to this elen1enl
when layout is performed.
LogicalChildren Gets an enunierator to the logical child elements of the ControlTemplate.
Margin Gets or sets the outer 1nargin of an element.
MaxHeight Gets or sets the inaxin1wn height constraint of the elen1ent.
MaxWidth Gets or sets the nmxin1wn \tYidth constraint of the element.
MinHeight Gets or sets the n1 ini mum height constraint of the element.
MinWidth Gets or sets the minimu1n widtl1constraint of the element.
Name Gets or sets the identifying naine of tbe ele1nent. The name provides a
reference so that code-behind. such as event handler code. can refer to a
n1arkup element after it is constructed during processing by a XAML
processor.
Opacity Gets or sets the opacity factor applied to the entire UIEle1nent lvhen it is
rendered iI1 the user interface (Ul). Tllis is a depe11dency property.
394 I PowerShell Studio - A Comprehensive Guide

PROPERTY DESCRIPTION
OpacityMask Gets or sets an opacity n1ask, as a Bn1sh iJnplen1entation that is applied to
any alpha-channel masking for the rendered content of this element. This is
a dependency property .
OverridesDefau ltStyle

Gets or sets a value that indicates \Vhetl1er tlris element incorporates style
properties from theme styles.
Padding Gets or sets the padding inside a control.
Parent Gets the logical parent ele1nent of this element.
Persistld Obsolete. Gets a value that uniquely identifies this element.
RenderSize Gets (or sets, but see Renwks) U1e final render size of tlllis element.
RenderTransform Gets or sets transform infor1nation that affects the rendering position of this
element This is a dependency property.
RenderTransf o rmOrigi n Gets or sets the center point of any possible render transfonn declared by
RenderTransfonn. relative to the bounds of the element. This is a
depende11cy property.
Resources Gets or sets U1e locally-defmed resource dictionary.
SnapsToDevicePixcls Gets or sets a value that determines "\\ hether rendering for this ele1nent
1

should use device-specific pixel settings during rendering. This is a


dependency property.
Style

Gets or sets the style used by this element \Vhenit is rendered.
StylusPluglns Gets a collection of all stylus plug-in (custonlization) objects associated
with this element.
Tablndex Gets or sets a value that determines the order in which elements receiYe
focus \Vhen tl1e user navigates Utrough controls by using tl1e TAB key.
Tag Gets or sets an arbitrary object value that cru1 be used to store custom
information about this ele1nent.
Template Gets or sets a control template.
TemtJlatcdParent Gets a reference to the template pruent of this element This property is not
relevant if U1e elem.enl \Vas not created lhroug11 a ten1plate.
ToolTip Gets or sets ilie tool-tip object U1at is displayed for this element in tl1e user
interface (UI).
ToucbesCaptu red Gets all touch devices that are captured to this elernent.
TouchcsCaptu redWithin Gets all touch devices that are captured to this ele1nent or any child
elements in its visual tree.
Touches irectlvOver

Gets all touch devices that are over this element.
TouchesOver Gets all touch devices that are over this element or any child elements in its
\risual tree.
Triggers Gets the collection of triggers established directly on this element. or in
cbild ele111ents.
Uid Gets or sets the unique identifier (for localization) for this elen1ent. This is
a dependency property.
UseLayoutRounding Gets or sets a value that indicates whether layout rounding should be
applied to this ele1nent's size a11d position during layo ut.
VerticalAlignment Gets or sets the vertical aligrlIDent chardcteristics applied to this elen1ent
\vhen it is co1nposed ' vitbin a parent elen1ent such as a panel or ilen1s
control.
v e rticalContentAJignment Gets or sets the vertical alignment of the control's content.
Visibilin1~
Gets or sets the user interface (UI) visibility of Olis element. This is a
dependency property.
VisualBitmapEffect Obsolete. Gets or sets the BitmapEffect value for the Visual.
PowerShell Studio - Reference Guide I 395

PROPERTY DESCRIPTION
--
VisualBitmapEffectlnpnt
-- ---
Obsolete.Gets or sets the BitmapEffectlnput value for the Visual.
Visu aJBitmapScalin gMode Gets or sets the BittnapScalingMode for the Visual.
Vi.su aJCacheMode Gets or sets a cached representation of the Visual.
VisuaIChildrenCount Gets the number of visual child ele1nents \Vithin this ele1nent.
VisoalClearTypeBint Gets or sets the ClearTypeHint that detemlines how ClearType is rendered
in the Visual.
Visual Clip Gets or sets the clip region of the Visual as a Geometry value.
VisualEdgeMode Gets or sets the edge mode of the Visual as an EdgeMode value.
VisualEffect Gets or sets the bitmap effect to apply to the Visual.
VisuaIOffset Gets or sets tbe offset value of the visual object.
VisualOpacity Gets or sets the opacity of the Visual.
VisuaIOpacityMasl{ Gets or sets tbe Brush value that represents the opacity inask of the Visual.
VisuaJParent Gets the visual tree parent of the visual object.
VisualScrollableAreaClip Gets or sets a clipped scrollable area for the Visual.
VisualTextHintingMode Gets or sets the TeA1:HintingMode of the Visual.
Visu alTextRende1ingMode Gets or sets tbe TeA1RenderingMode of the Visual.
VisualTransform Gets or sets tbe Transfon11 value for the Visual.
VisualXSnappingGuidelines Gets or sets the x-coordinate (vertical) guideline collection.
VisualYSnap1>ingGuidelines Gets or sets they-coordinate (horizontal) guideline collection.
Width Gets or sets the width of the element.

HELPPROVIDER

PROPERTY DESCRIPTION
C anRaiseEvents Gets a value indicating whether tl1e component can raise an event.
Container Gets the IContai11er that contains the Co1nponent.
Design Mode Gets a value that indicates whether the Component is currently in design mode.
Events Gets the list of event handlers that are attached to this Co1nponent
HelpNamesi>ace Gets or sets a value specifying the name of the Help file associated with this HelpProvider
object.
Site Gets or sets the I Site of the Component
Tag Gets or sets the object that contains supplemental data about the HelpProvider.

IMAGELIST

ColorDepth Gets the color depth of the image list.


Container Gets tl1e !Container that contains tl1e Component.
Handle Gets the hai1dle of the m1age list object.
HandleCreated Gets a value indicating \.Vhether the underlying Win3 2 handle bas been created.
Images Gets the lmageList.ImageCollection for this image list.
ImageSize Gets or sets the size of U1e images in the image list.
396 I PowerShell Studio - A Comprehensive Guide

lmageStream Gets the ImageListStreamer associated \Vith this image list.


Site Gets or sets tl1e ISite of the Co1nponent.
Tag Gets or sets a11 object that contains additional data about the I111ageList
Trans1>arentColor Gets or sets tl1e color to treat as transparent.

LABEL

Actuameight
'
Gets tbe rendered height of this element.
ActuaJWidth Gets the rendered width of tlris ele111ent.
AllowDrop Gets or sets a value indicating \:vhether this element can be used as the
target of a drag-and-drop operation. This is a dependency property.
AreAnyTouchesC a1>tu red Gets a value that indicates -vvhether at least one touch is captured to
this element.
AreAnyTouchesCa1>tu red Within Gets a value that indicates \.Vhether at least one touch is captured to
this element or to any clrild elements in its visual tree.
AreAnyTouchesDirectlyOver Gets a value that indicates whether at least one toucl1 is pressed over
this element.
AreAnyTouchesOver Gets a vallte that indicates whether at least one touch is pressed over
tlris element or any cltlld elements in its visual tree.
Background Gets or sets a bn1sh that describes tl1e background of a control.
BindingGroup Gets or sets the BindingGroup that is used for tl1e element.
Bitm a1>Effect Obsolete.Gets or sets a bittnap effect tl1at applies directly to the
rendered content for this ele.ment. Tltls is a dependency property.
BitmapEffectlnput Obsolete. Gets or sets an input source for the bitmap effect tl1at
applies directly to the rendered content for tlris element. This is a
dependency property.
BorderBrush Gets or sets a bn1sh tl1at describes the border backgrolmd of a control.
Bo rderThiclrness Gets or sets the border thick11ess of a control.
CacheMode Gets or sets a cached representation of the UIBle111ent.
Clip Gets or sets the geometry used to define the outline of the contents of
an elen1ent. This is a dependency property.
Cli1>T0Bounds Gets or sets a value iI1dicating whether to clip tl1e content of tllis
ele1nent (or content coining from the clilld ele1nents of tllis ele1nent)
to fit into tl1e size of the containing ele1nent. This is a dependency
property.
CommandBindings Gets a collection of ConnnandBinding objects associated with this
element. A Co1nmai1dBinding enables command handling for this
ele1nent, and declares tl1e linkage between a co1nmand, its events, and
tl1e handlers attached by tltls element.
Content Gets or sets the content of a Conte11tControl.
ContentStringFormat Gets or sets a composite string that specifies how to format tl1e
Content property if it is displayed as a string.
PowerShell Studio - Reference Guide I 397

ContentTemplate Gets or sets t11e data template used to display the content of the
ContentControl.
ContentTemplateSelector Gets or sets a template selector that enables an application \Vriter to
provide custom template-selection logic.
ContextMenu. Gets or sets the context 1nenu element that should appear whenever
tl1e conteA1: menu is requested through user inte1face (UI) from ';vithin
this element.
Cursor Gets or sets the cursor that displays when tl1e mouse pointer is over
this element.
DataContei'1 Gets or sets the data conteA1: for a11 element when it participates in
data binding.
DefaultStyleKey Gets or sets the key to use to reference the style for this control, when
theme styles are used or defined.
De11en dencyOb jectType Gets the DependencyObjectType that \vraps tl1e CLR type of this
insta11ce.
DesiredSize Gets the size that this element computed during tb.e meas1rre pass of
tl1e layout process.
Dispatcher Gets the Dispatcher this DispatcberObject is associated witl1.
(Inherited from DispatcherObject.)
Effect Gets or sets the bittnap effect to apply to the UIElement. This is a
dependency property.
FlolvDirection Gets or sets the direction tl1at teA1: and other user il1terface (Ul)
elen1ents flo"v witlrin any parent ele1nent that controls tl1eir layout.
Focusable Gets or sets a value that indicates 'vhether the element ca11 receive
focus. Tlris is a dependency property.
FocusVisualStyle Gets or sets a property that enables custo1nization of appearance,
effects, or otl1er sty le characte1istics that \Vill apply to this element
when it captures keyboard focus.
FontFamily Gets or sets the font family of the control.
FontSize Gets or sets the font size.
FontStretch Gets or sets the degree to wlrich a font is condensed or eA'Pailded on
the screen.
FontStyle Gets or sets the font style.
FontWeight Gets or sets the weight or tlrickness of the specified font.
F 01ceCu rso i Gets or sets a value tllat indicates whether this FrameworkEle1nent
should force the user interface (UI) to render tl1e ctrrsor as declared by
tl1e Cursor property.
Foreground Gets or sets a brush that describes the foreground. color.
Han dlesScrolling Gets a value that indicates whether a control supports scrolling.
HasAnimatedP ro11e11ies Gets a value indicating ,;vhether tlris element has any anitnated
pr~perties.
HasContent Gets a value that indicates whether the ContentControl contains
content.
HasEffectiveKeyboardFocus Gets a val11e that indicates whether the UIElement has focus.
Height Gets or sets the suggested height of the element.
398 I PowerShell Studio - A Comprehensive Guide

HorizontalAlignment Gets or sets the .horizontal alignment characteristics applied to this


element when it is composed within a parent element, such as a panel
or items control.
HorizontaJContentAlignment Gets or sets the horizontal alignment of the control's content.
InberitanceBehavior Gets or sets the scope limits for property value inheritance, resource
key lookup, and Relative Source Find.Ancestor lookup.
lnputBindings Gets the collection of input bi.ridings associated "vith this element.
lnflotScope Gets or sets the conte:t\.1 for input used by tltis FramevvorkElement.
lsArrangeValid Gets a value indicating whether the computed size and position of
cltild elements in tltis element's layo11t are valid.
lsEnabled Gets or sets a value indicating whether tltis ele1nent is enabled in the
user interface (U1). This is a dependency property .
lsEnabledCore Gets a value that becomes the return value of IsEnabled in derived
classes.
IsFocusecl Gets a value tliat determines whether this ele1nent has logical focus .
This is a depe11dency property.
lsHitTestVisible Gets or sets a val11e that declares 'vhether this ele1uent can possibly be
returned as a hit test resttlt from some portion of its rendered content.
Tltis is a dependency property.
lsInitialized Gets a value tliat indicates whether this element has been initialized,
either during processing by a XAJv1L processor, or by explicitly
having its Endlnit method called.
lslntJutMethodEnabled Gets a value indicating whether an input 1uetl1od systen1, such as an
Input Method Editor (IME), is enabled for processing the input to this
ele1nent.
lsKeyboardFocu

sed Gets a value indicating whether this element lias keyboard focus. Tltis
is a dependency property.
lsKeyboardFocu sWithin Gets a value indicating whether keyboard focus is anywhere witltin
the ele1nent or its visual tree cltild elements. TJtis is a dependency
property.
lsLoaded Gets a value tliat indicates whether this element has been loaded for
presentation.
lsManipulationEnabled Gets or sets a value tliat indicates whether 1nanipulation events are
enabled on tltis UIElement.
lsMeasu reValid Gets a value indicating whether tl1e current size returned by layout
measure is valid.
lsMouseCaptu red Gets a value indicating whether the inouse is captured to tltis ele1uent.
Tltis is a dependency property.
lsMouseCaptureWithin Gets a value tliat detennines vvl1ether mouse capture is held by this
element or by child elements in its visual tree. This is a dependency
property.
lsMouseDirectlyOver

Gets a value that i.r1dicates \V hether the position of the mouse pointer
corresponds lo ltit test res1tlts, \Vltich take ele1nent compositing into
account. This is a dependency pro2erty.
lsMouseOver Gets a value indicating whether the mouse pointer is located over this
element (including cllild elements in the visual tree). This is a
dependency property.
PowerShell Studio - Reference Guide. I 399

IsSealed Gets a value tl1at indicates whether this instance is ctuTently sealed
(read-only).
IsS tylusC aptured Gets a value indicating whether the stylus is captured by this element.
This is a dependency property.
IsStylusCa1JtureWithin Gets a value that detennit1es whether stylus capture is held by this
element. or an ele1nent within the element bounds ai1d its visual tree.
This is a dependency prope1fy.
IsStylusDiiectlyOver Gets a value that indicates whether the stylus position corresponds to
hit test results whicl1 take element compositing into account. This is a
dependency property.
IsStylusOver Gets a value indicating whether the stylus cursor is located over this
element (including visual child eleme11ts). This is a depende11cy
property.
IsTabStop Gets or sets a value that indicates whether a control is included in tab
navigation.
IsVisible Gets a value indicating \.vhether this element is visible in the user
interface (UI). This is a dependency property.
Language Gets or sets localization/globalization language information that
applies to an element.
LayoutTransform Gets or sets a graphics transformation that should apply to this
ele1nent when layout is perfonned.
LogicalChildren Gets an enumerator to tl1e content control's logical child eleme11ts.
Margin Gets or sets the outer nlargin of an element.
MaxHeight Gets or sets the maximum height constraint of the element.
MaxWjdtb Gets or sets the niaximmn width constraint of the element.
MinHeight Gets or sets the nlini1ntun height constraint of the ele1nent.
MinWidth Gets or sets the minimum "vidth constrai11t of the elen1ent.
Name Gets or sets the ide11tifying nan1e of the element. The naine provides a
reference so that code-behind, such as event handler code, can refer to
a markup element after it is constructed dtrring processing by a
XA11L processor.
Opacity Gets or sets the opacity factor applied to the entire UIEle1nent when it
is rendered in the user interface (UI). This is a dependency property.
OpacityMasi< Gets or sets an opacity mask, as a Bn1sb inlplen1entation that is
applied to ru1y alpha-cbannel maslcing for the re11dered content of this
elen1ent. This is a dependency property.
OverriclesDefaultStyle Gets or sets a value that indicates whether this element incorporates
style properties from theme styles.
Padding Gets or sets the padding inside a control.
Parent Gets the logical parent element of this element.
Persistld Obsolete. Gets a value that uniquely identifies this ele1nent.
RenderSize Gets (or sets, but see Ren1arks) tl1e final render size of this ele1nent.
RenderTransform Gets or sets transform infom1ation that affects the rende1ing position
of this ele1nent. This is a dependency pr~perty.
400 I PowerShell Studio - A Comprehensive Guide

RenderTransformOrigin Gets or sets the center point of any possible render transform declared
by RenderTransfonn, relative to the bounds of the element. This is a
dependency property.
Resources Gets or sets the locally-defined resom:ce dictionary.
Soa1>sT0DevicePixels Gets or sets a value that detennines \Vhether re11deri11g for this
element should use device-specific pi,xel settings during rendering.
Th.is is a dependency property.
Style Gets or sets the style used by this element when it is rendered.
StylusPlu gins Gets a collection of all stylus plug-in (customization) objects
associated \Vith th.is ele1nent.
Tablndex Gets or sets a value tl1at detennines the order in which ele1nents
receive focus \Vl1e11 the user navigates through controls by using the
TAB key.
Tag Gets or sets an arbitTary object value that can be used to store custon1
info1mation about this ele1nent.
Target Gets or sets the element that receives focus when the user presses the
label's access key .
Template Gets or sets a control template.
Tem1>latedParent Gets a reference to the ten1plate parent of this ele1nent. This properly
is not relevant if the element was not created through a template.
ToolTi(l Gets or sets the tool-tip object that is displayed for tlris ele1nent in the
user intetface (UI).
TouchesCaptured Gets all touch devices that are captlired to this elernent.
TouchesCapturedWithin Gets all touch devices that are captured to this ele1nent or any child
elernents in its visual tree.
TouchesDirectlyOver Gets all touch devices tl1at are over this element.
ToucbcsOver Gets all touch devices that are over this elen1ent or a11y child ele1nents
in its visual tree.
Triggers Gets the collection of triggers established directly on this ele1nent, or
in child eleme11ts.
Uid Gets or sets the unique identifier (for localizatio11) for this ele1n.ent.
This is a dependency property .
U seLayoutRounding Gets or sets a value that indicates \vhether layout rounding should be
applied to this element's size and position duril1g layout.
VerticalAJign ment Gets or sets the vertical alignn1ent characteristics applied to tlris
ele1nent when it is co1nposed within a parent element such as a panel
or ite1ns control.
VerticalContentA1ignment Gets or sets tl1e vertical alignment of the control's content.
Visibility Gets or sets the user interface (UI) visibility of this ele1nent. This is a
dependency property .
Visu alBitmapEffect Obsolete.Gets or sets the BitmapEffect value for the Visual.
VisualBitmapEffectln put Obsolete.Gets or sets the BitmapEffectlnput value for the Visual.
VisualBitmapScalingMode Gets or sets the BitmapScalingMode for the Visual.
VisualCacheMode Gets or sets a cached representation of the Visual.
VisualChildrenCount Gets the number of visual child elements vvitbin this element.
PowerShell Studio - Reference Guide I 401

VisualClearTypeHint Gets or sets t11e ClearTypeHint that detenuines ho"v ClearType is


rendered in the Visual.
Visual Clip Gets or sets the clip region of the Visual as a Geometry value.
VisualEdgeMode Gets or sets the edge mode of the Visual as an EdgeMode value.
Visual Effect Gets or sets the bitmap effect to apply to the Visual
Visual Offset Gets or sets the offset valtte of the visual object.
VisualOpacity Gets or sets the opacity of the Visual.
VisualOpacityMask Gets or sets the Brusl1 value that represents the opacity iuask of the
Visual.
VisualParent Gets the visual tree parent of the visual object
VisualScrollableAreaClip Gets or sets a clipped scrollable area for the Vis11al.
Visu alTextHintin gMode Gets or sets the TextHintingMode of the Visual.
VisualTextRende1ingMode Gets or sets the TextRende1ingMode of the Visual.
VisualTransform Gets or sets the Transform value for tl1e Visual.
VisualXSna1JpingGuideli11es Gets or sets the x-coordinate (ve11ical) guideline collection.
VisualYSnappingGuidelines Gets or sets t11e y-coordinate (horizontal) guideline collection.
Width Gets or sets the widt11 of t11e ele1ne.nt.

LINKLABEL

AccessibilityO b ject Gets the AccessibleObject assigned to tl1e control.


AccessibleDefaultActionDescription Gets or sets the default action description of tl1e control for use by
accessibility client applications.
AccessibleDescription Gets or sets the description of tl1e control used by accessibility
client applications.
AccessibleName Gets or sets the name of the control used by accessibility client
applications.
AccessibleRole Gets or sets the accessible role of tl1e control
ActiveLinkColo r Gets or sets the color used to display an active link.
AllowDrop Gets or sets a value indicating whether tl1e control can accept data
that the user drags onto it.
Anchor Gets or sets the edges of the container to 'vhich a control is bo1u1d
and detenni11es how a control is resized "vith its parent.
Au toElliJJSis Gets or sets a value indicating whether the ellipsis character(... )
appears at the right edge of the Label, denoting that the Label text
extends beyond tl1e specified length of the Label.
AutoScrollOffset Gets or sets "vhere tltis control is scrolled to iI1
Scro11ControllntoView.
Auto Size Gets or sets a valt1e indicating whetl1er the control is automatically
resized to display its entire contents.
BackColor Gets or sets the background color for the control
402 I PowerShell Studio - A Comprehensive Guide

Backgroundlm age This API supports the product infrastructure and is not intended to
be used directly from your code. Gets or sets the image rendered
on tlle background of the control.
Backgrou ndlmageLayout This API supports the product infrastn1cttue and is not intended to
be used directly fro1n yoru code. This property is not relevant fo r
this class.
Bin clingContext Gets or sets tl1e BindingConte~'t for the control.
BorderStvle

Gets or sets the border sty le for the control.
Bottom Gets the distance, in pixels, between the botto1n edge of the
control and the top edge of its contail1er's client area.
Bounds Gets or sets the size and location of the control including its
nonclient elements, il1 pi-xels relati,re to the parent co11trol.
CanEnablelme Gets a value indicating ' vhet11er the lmeMode property can be set
to an active value, to enable IME support.
CanFocus Gets a value indicating "'hether the control can receive focus.
CanRaiseEvents Detennines if events can be raised on the control.
CanSelect Gets a value indicatil1g \vbether the control can be selected.
Ca11ture Gels or sets a value indicating \Vhether the control has captured
the mouse.
CausesValidation Gets or sets a value indicating whether the control causes
validation to be performed on any controls that require validation
when it receives focus.
ClientRectangle Gets the rectangle that represents the client area of the control.
ClicntSizc Gets or sets the height and \vidth of the client area of the control.
CompanyName Gets the name of the company or creator of the applicatio11
containing the control.
Container Gets the !Container that contains the Component.
ContainsFocus Gets a value indicating whetl1er the control, or one of its child
controls, currently has the input focus.
ContextMenu Gets or sets the shortcut n1enu associated \Vit11 U1e control.
ContextMenuStrip Gets or sets the ContextMenuStrip associated \vith this control.
Controls Gets the collection of controls contained wiUlin U1e control.
Created Gets a value indicating '\iVhet11er the control has been created.
CreateParams Gets the required creation parruneters "vhen the control handle is
created.
Cursor Gets or sets the cursor that is displayed when the mouse pointer is
over the co ntro I.
DataBindings Gets the data bindmgs for the control.
Defau ltCurso r Gets or sets the default cursor for the control.
DefaultlmeMode Gets the default Input Method Editor (lME) 1node supported by
this control.
Defau ltMargin Gets tl1e space. in pixels. that is specified by default bern1een
controls.
Defau ltMa:\'in:tumSize Gets the lengtl1 and beighL in pixels. that is specified as the default
1naxin1u111 size of a control.
Defau ltMinimumSize Gets the lengtl1 and height, in pixels, that is specified as the default
minimum size of a control.
Defau ltPadding Gets the internal spacing, in pixels, of the contents of a control.
PowerShell Studio - Reference Guide. I 403

DefaultSize Gets the default size of the control.


DesignMode Gets a value that indicates whether the Component is currently in
design mode.
DisabledLinkColor Gets or sets the color used when displaying a disabled link.
DisplayRectangle Gets the rectangle that represents the display area of the control.
Disposing Gets a value indicating whether the base Control class is in tl1e
process of disposing.
Dock Gets or sets \hich control borders are docked to its parent control
and deter1nines 11ow a control is resized with its parent.
DoubleBuffered Gets or sets a value indicating whether this control sl1ould redraw
its surface using a secondary buffer to reduce or prevent flicker.
Enabled Gets or sets a value indicating whether the control ca11 respo11d to
user interaction.
Events Gets tl1e list of event handlers that are attached to this Component.
FlatStyle Tllis API supports the product infrastlucture and is not intended to
be used directly from your code. Gets or sets the flat style
appearance of tlle LinkLabel.
Focused Gets a value indicating '\ivhetller the control has input focus.
Foot Gets or sets the font of the text displayed by tl1e control.
FootHeight Gets or sets the height of the font of the control.
ForeColor Gets or sets the foreground color of the control.
Handle Gets tlle 'indovv handle that the control is bound to.
HasChildreo Gets a value indicating '\ivhether the control contains one or tnore
child controls.
Height Gets or sets the height of the control.
Image Gets or sets the image that is displayed on a Label.
ImageAJigo Gets or sets the aligiunent of an image that is displayed in the
control.
Imagelodex Gets or sets the index value of the image displayed on the Label.
ImageKey Gets or sets the key accessor for the image in tl1e IniageList.
ImageList Gets or sets the ImageList that contains the images to display in
the Label control.
ImeMode This API supports the product infrastructure and is not intended to
be used directly from your code. Gets or sets the hlput Method
Editor (IlvfE) mode supported by this control.
ImeModeBase Gets or sets the Th1E n1ode of a control.
IovokeRequired Gets a value indicating whether tl1e caller must call an invoke
1netl1od when making n1ethod calls to tlle control because the
caller is on a different thread than the one the control vvas created
on.
lsAccessible Gets or sets a value indicating whether the control is visible to
accessibility applications.
IsDisposed Gets a value indicating whetller tl1e control has been disposed of.
IsHandleC reated Gets a value indicating whether the control has a handle associated
with it.
IsMirrored Gets a value indicating whether tl1e control is mirrored.
LayoutEngioe Gets a cached instance of the control's layout engine.
404 I PowerShe ll Stu dio - A Comprehe nsive Guide

Left Gets or sets the distance, in pi'<els, bet\veen the left edge of the
control and the left edge of its container's client area.
LinkArea Gets or sets the range in the te:\.1 to treat as a link.
LinkBebavior Gets or sets a value that represents the behavior of a link.
LinkColor Gets or sets the col or used '~1hen displaying a norm.al link.
Links Gets the collection of links contained \Vithin tl1e Link.Label.
LinkVisited Gets or sets a value it1dicating whether a link should be displayed
as though it ,;\ere visited.
Location Gets or sets the coordinates of the upper-left comer of the control
relative to the upper-left comer of its container.
Margin Gets or sets the space between controls.
Maximu mSize Gets or sets the size that is the upper limil that GetPreferredSize
can specify.
MinimumSize Gets or sets the size that is the lotvver limit that GetPreferredSize
can specify.
Name Gets or sets t11e name of the control.
OverrideCu rsor Gets or sets the mouse pointer to use when the 1no11se pointer is
~ ithin the bounds of the Link.Label.
Padding Gets or sets the interior spacing, in pixels, between the edges of a
LinkI.abeJ and its contents.
Parent Gets or sets the parent container of the control.
P refcrredHeight Gets the preferred height of the control.
PreferredSize Gets tl1e size of a rectangular area into which the control can fit.
Preferred Width Gets the preferred width of the control.
ProductName Gets the product nalne of the assen1bly contai1tlng the control.
ProductVersion Gets tl1e version of tl1e assembly containing the co11trol.
RecreatingHandle Gets a value indicafu1g \)y'hether the control is currently re-creating
its handle.
Region Gets or sets the "vindo,, region associated '~ith the control.
RenderRightToLeft Obsolete.This pToperty is no~ obsolete.
RenderTrans1>arent Obsolete.Indicates whether the container control background is
rendered on tl1e Label.
ResizeRedraw Gets or sets a value indicating 'vhether the control redra,vs itself
" .hen resized.
Right Gets the distance. in pixels, between tl1e right edge of ll1e control
and the left edge of its container's client area.
RightToLcft Gets or sets a value indicating 'vhether control's elements are
aligned to support locales using right-to-left fonts.
Scale Children Gets a value that detennines the scaling of child controls.
ShowFocusCues Gets a value indicating whether the control should display focus
rectangles.
Sho'vKeyboard

Cues Gets a value indicating \>Vhether the user interface is in the
appropriate state to sho"v or hide keyboard accelerators.
Site Gets or sets the site of U1e control.
Size Gets or sets the 11eigl1t and 'vidth of the control.
Tab Index Gets or sets the tab order of the control ,,ithin its container.
TabStOJ> Gets or sets a value that indicates ' vhether the user can tab to the
LinkLabel.
PowerShell Studio - Reference Guide I 405

Tag Gets or sets tbe object tbat contains data about the control.
Text Gets or sets the teA't displayed by the Linkl .abel.(Overrides
Label.Text.)
TextAlign Gets or sets the alignment of text in the label.
To1> Gets or sets the distance, in pixels, bet,;veen the top edge of the
control and the top edge of its container's client area.
TopLevelControJ Gets tl1e parent control that is not parented by another Windows
Fonns control. Typically, this is tbe outennost Form that the
control is contained u1.
UseCom1>atibleTextRendering Gets or sets a value that detennines \Vhether to use the Graphics
class (GDI+) or the TextRenderer class (GDI) to render text.
U seMnemonic Gets or sets a value indicating \Vhether the control interprets an
ampersand character(&) in the control's Text prope1ty to be an
access key prefix character.
UseW aitCu rso r Gets or sets a value indicating whether to use the \.Va.it ctrrsor for
tbe current control and all child controls.
Visible Gets or sets a value indicating ':vhether the control and all its child
controls are displayed.
VisitedLinkColor Gets or sets the color used when displaying a link that that 11as
been previously visited.
Width Gets or sets the width of the control.
Window Target Tins API supports the product infrastructure and is not inte11ded to
be used directly from your code. This property is not relevant for
this class.

LISTBOX

Actuaffieight Gets the rendered height of this element.


ActualWidth Gets tl1e rendered \.Vidth of this ele1nent.
AllowDrop Gets or sets a value indicating whether this element can be used as the
target of a drag-and-drop operation. This is a dependency property.
AlternationCount Gets or sets the ntunber of alternating ite1n containers in the
ItemsControl, which enables alten1ating containers to have a unique
appea1ance.
Anchorltem Gets or sets the item that is initially selected \Vhen SelectionMode is
Extended.
AreAnyTou.cbesCaJltured Gets a value that indicates whether at least 011e touch is captured to this
elen1ent.
AreAnyTouchesCapturedWithin Gets a value that indicates whether at least one touch is captured to this
elen1ent or to any child ele1nents in its visual tree.
AreAnyToucbesDirectlyOver Gets a value that indicates whether at least one touch is pressed over
this el emeut
AreAnyTouchesOver Gets a value that indicates whether at least one touch is pressed over
this element or any child elements in its visual tree.
Bacliground Gets or sets a brush tl1at describes the background of a control.
406 I PowerShe ll Studio - A Compre hensive Guide

Bin dingGrou 1> Gets or sets the BindingGroup U1al is used for U1e element.
Bitm atlEffect Obsolete.Gets or sets a bitnlllp effect that applies directly to the
rendered content for Utls ele1ne11t. Tlris is a dependency property .
BitmapEffcctlnput Obsolete. Gets or sets an input source for the bitmap effect that applies
directly to the rendered content for tlris ele1nent. This is a dependency
property.
BorderBrush Gets or sets a bn1sb that describes tJ1e border background of a control.
Bo rderThickness Gets or sets the border thickness of a control.
CacheMode Gets or sets a cached representation of the UIElement.
Clip Gets or sets the geo1net.ry used to define the outline of the contents of an
element. This is a dependency property.
ClipToBounds Gets or sets a value indicating \hether to clip tl1e content of tllis
element (or content coining from the child elements of this element) to
fit into the size of the containing element. This is a dep endency
property.
Command Bindings Gets a collection of Command.Binding objects associated with this
ele1nent. A Comrnand.Binding enables conunand handling for this
element, and declares the linkage between a command, its events, and
U1e handlers attached by t1Jis element.
CootextMenu Gets or sets the context n1enu elen1ent U1at should appear whenever the
context n1enu is requested Urrough user interface (U I) fron1 \Vithin Ulis
element.
Cursor Gets or sets the cursor that displays when the mouse pointer is over this
element.
Data Context Gets or sets the data context for an element ' vhen it participates in data
binding.
DefaultStyleKey Gets or sets the key to use to reference the style for this control. 'vhen
theme styles are used or defined.
Depen dencyObjcctType Gets the DependencyObjectType that \vraps the CLR type of Utis
instance. (Inherited fromDependencyObject.)
Desired Size Gets tl1e size that this element computed dtuing the measrne pass of the
layout process.
Dispatcher Gets the Dispatcher this DispatcherObject is associated with. (Inherited
fro tn Dispatcl1erObject.)
DisplayMemberPath Gets or sets a path to a valt1e on the source object to serve as the visual
representation of the object.
Effect Gets or sets the bitmap effect to apply to the UIElement. This is a
dependency property.
Flo,vDirectioo Gets or sets the direction that text and other user interface (UI) elements
flow \vithin any parent element that controls their layout
Focusable Gets or sets a value that indicates wbetJ1er the eleinent can receive
focus. This is a depe11dency property.
FocusVisualStvle

Gets or sets a property that enables customization of appearance,
effects. or otl1er sty le characteristics U1at \.Vill apply to this ele1nent when
it captures keyboard focus.
FontFamily Gets or sets U1e font fan1jly of tJ1e control.
FontSize Gets or sets the font size.
FontStretch Gets or sets the degree to \vhicb a font is condensed or expanded on the
screen.
PowerShell Studio - Reference Guide I 407

FontStvle

Gets or sets the font style.
FontWeigbt Gets or sets the weight or thickness of the specified font.
ForceCursor Gets or sets a value that indicates \Vhether this Frame,vork.Element
should force tl1e user interface (UI) to render the cursor as declared by
the Cursor property .
Foreground Gets or sets a bn1sh that describes the foreground color.
Gron pSt~1 le Gets a collection of GroupStyle objects that define the appearance of
each level of groups.
G rou 1>StyleSelector Gets or sets a method that enables you to provide custom selection logic
for a GroupStyle to apply to each group in a collection.
HaocllesScrolling Gets a value that indicates \Yhether the ListBox supports
scrolling.(Ovetrides Contro l.HandlesScrolling.)
HasAoimatedPrope11ies Gets a value indicating \:Vhetber this elernent has any anilnated
properties.
HasEffectiveKeyboardFocus

Gets a value that indicates 'vbether the UIElement ltas focus.
Hasltems Gets a value that indicates \Vhether the Iten1sControl contains iterns.
Height Gets or sets the suggested heig11t of the element.
HorizontaWignmeot Gets or sets the ho1izontal alignment characteristics applied to this
elen1ent when it is composed \vitbin a parent element, such as a panel or
items control.
HorizontaJContentAlignmeot Gets or sets the horizontal alignment of the control's content.
InberitanceBeha,rior Gets or sets the scope limits for property value inheritance. resotuce key
lookup. and ReJativeSource Find.Ancestor lookup.
InputBindin gs Gets the collection of input biJ1clings associated vviith this ele1nent.
InputScope Gets or sets the context for mput used by this Frame\vorkElement.
IsArrangeValid Gets a value indicating \vheU1er the computed size and position of child
elements in this elen1ent's layout are valid.
l sEnabled Gets or sets a value indicating 'vheU1er this elen1e11t is enabJed in the
user interface (UI). This is a dependency property.
IsEnabledCore Gets a value that becornes the return value of IsEnabled il1 derived
classes.
IsFocused Gets a Yalue that determines '""hether this element has logical focus.
This is a dependency property.
IsGrouping Gets a value that indicates whether the control is using grouping.
IsHitTestVisiblc Gets or sets a value th.at declares \VbeU1er this eleme11t can possibly be
rettimed as a hit test result from some portion of its rer1dered content.
This is a dependency property.
Islnitialized Gets a value that indicates \Vhether this element has been ffiitialized,
either durmg processing by a XAML processor. or by explicitly having
its Endlnit meU1od called.
IsinputMetbodEnabled Gets a value indicating \vhether an input n1etbod systern. sucl1 as an
Input Method Editor (IME), is enabled for processing the input to this
element.
IsKe:vboardFocu

sed Gets a value indicating whether this element has keyboard focus. This is
a dependency property.
IsKeyboardFocu sWithin Gets a value indicating \vhether keyboard focus is an)'\vhere witllffi the
elen1ent or its visual tree child ele1nents. Th.is is a dependency property .
IsLoaded Gets a value tl1at indicates \vhetber this ele1nent has been loaded for
presentation.
408 I PowerShell Studio - A Comprehensive Guide

IsMani pu lationEn ab led Gets or sets a value that indicates \Vhether m.anipulation events are
enabled on this U1Ele1nent.
IsMeasureValid Gets a value indicating \VheU1er the current size returned by Layout
measure is valid.
I sMou seCaJltured Gets a value indicating \Vhetber the n1ouse is capt1ued to tllis ele1nent.
This is a dependency property .
lsMouseCa1>tu reWithin Gets a value that deternlines \vhether n1ouse capture is held by this
element or by child elements in its visual tree. This is a dependency
property.
IsMou seDirectlyOver

Gets a value that indicates \vl1ether the position of the mouse pointer
corresponds to hit test results. \\hich take elernent con1positing into
account. This is a dependency property.
lsMouseOVer Gets a value indicating \Vhether the mouse pointer is located over this
element (including child elements in U1e visual tree). Tb.is is a
dependency property.
lsSealed Gets a value that indicates whether this instance is currently sealed
(read-only).(Inherited fro1n DependencyObject.)
lsStylusCaptured Gets a value indicating ,vhether the stylus is captured by this eleme11t.
This is a dependency property.
IsStylusCa1>tureWithin Gets a value that determines whether stylus capture is held by this
elernent. or an element \Vithin the elen1ent bounds and its visual tree.
This is a dependency property.
IsS tylu sDirectlyOver Gets a value that indicates \Vhether the stylus position corresponds to hit
test results, which take element compositing i11to account. This is a
dependency property.
IsStvlusOver

Gets a value indicating whether the stylus cursor is located over this
element (including visual child ele1nents). TJlis is a dependency
property.
IsSynchronizedWithCurren.titem Gets or sets a value that indicates 'vhether a Selector should keep the
Selectedltem synchronized 'vith the current ite111 in the Iten1s property .
(Inherited fro1n Selector.)
IsTabStop Gets or sets a value tbat indicates \Vhether a control is included in tab
navigation.
IsTextSearchCaseSensitive Gets or sets a value that indicates \VhetJ1er case is a condition \Vhen
searclling for items.
IsTextSearcbEnabled Gets or sets a value that indicates ' vhether TextSearch is enabled on tbe
ItemsControl instance.
lsVisible Gets a value indicating \Vhetber this element is visible in the user
interface (UI). This is a dependency property.
ltemBiudingGroup Gets or sets the BindingGroup that is copied to eacl1 item in the
ItemsControl.
ltemContainerGenerator Gets the ItemContainerGenerator that is associated \vith the control.
ItemContaine1S tvle

Gets or sets the Style that is applied to the container eletnenl generated
for each item.
Item ContainerStyleSelector Gels or sets custon1 style-selection logic for a style that can be applied
to each generated container element.
Items Gets the collection used to generate the content of the ItemsControl.
ltcmsPancl Gets or sets the template that defines the panel that controls the layout
of ite1ns.
PowerShell Studio - Reference Guide I 409

ltemsSou rce Gets or sets a collection used to generate the content of the
ltemsControl.
ItemStringFormat Gets or sets a con1posite string tl1at specifies ho\:v lo format the itenis in
the ItemsControl if they are displayed as strings.
Item Template Gets or sets the DataTe1nplate used to display each iten1.
ItemTcmplateSelector Gets or sets the custom logic for choosing a template used to di5play
each item.
Language Gets or sets localization/globalization language information that applies
to an element.
LayoutTransform

Gets or sets a graphics transfomiation that should apply to this elernent
' ' hen layout is performed.
1

LogicaJChild ren Gets an enu111erator for tl1e logical child objects of the ItemsControl
object.
Margin Gets or sets the outer 1nargin of an element.
Max Height Gets or sets the maximum height constraint of the element.
MaxWidth Gets or sets the maximw11 \\1idth constraint of the e len1ent.
MinHeight Gets or sets the rninimun1 height co11Straint of the elernent.
MinWidth Gets or sets the minirnum \Vidth constraint of the element.
Name Gets or sets the identifying naine of the element. The name provides a
reference so that code-behind. such as event handler code. can refer to a
n1arkup ele1nent after it is constructed during processing by a XAML
processor.
01>acity Gets or sets the opacity factor applied to the entire UIEle1nent when it is
rendered in the user interface (Ul). This is a dependency property.
OpacityMas k Gets or sets a11 opacity mask. as a Brush i1nple1nentation that is applied
to any alpha-channel ulllsking for the rendered content of this element.
This is a dependency property.
OverridesDefaultStyle

Gets or sets a value that indicates \vhether this ele1nent incorporates
sty le properties from theme styles.
Padding Gets or sets the padding inside a control.
Parent Gets tl1e logical parent eleme11t of this element.
PersistId Obsolete.Gets a value U1at uniquely identifies Ulis ele1nent.
RcndcrSize Gets (or sets, but see Remarks) the final render size of this element
RenderTransforrn Gets or sets transform infor1nation U1at affects the rendering position of
this element. This is a dependency property.
RenderTransformOrigin Gets or sets tl1e center point of any possible render transfonn declared
by RenderTransfonn, relative to tl1e bounds of tb.e element. This is a
dependency property.
Resources Gets or sets the locally-defined resource dictionary.
Selectedlndex Gets or sets the index of the first item in the current selection or reti1ms
negative one (-1) if the selection is e1npty. (Inherited fron1 Selector.)
Selectedltem Gets or sets tl1e first item in the current selection or reh1ms null if the
selection is en1pty (Inherited from Selector.)
Selectedltems Gets the currently selected items.
SelectedValue Gets or sets the value of the Selectedltem, obtained by using
SelectedValuePath. (Inherited from Selector.)
SelcctedValuePatb Gets or sets the path that is used to get the SelectedValue fro1u the
Selecteditem. (Inherited fro1n Selector.)
410 I PowerShe ll St udio -A Comprehe nsive Guide

SelcctionModc Gets or sets the selection behavior for a ListBox.


Snaps ToDe,ricePixels Gets or sets a value that detem1ines \vhether rendering for this element
should use device-specific pixel settings during rendering. This is a
dependency property.
Style Gets or sets the sty le used by this elen1ent \\ hen it is rendered.
1

StylusPlu gins Gets a collection of all stylus plug-in (custo1nization) objects associated
\ith this ele1nent.
Tablndex Gets or sets a alue that determines the order in which elements recei e
focus \Vhen the user navigates throug11 controls by using the TAB key.
Tag Gets or sets an arbitrary objectvalue that can be used to store custom
infomiation about Ulis element.
Template Gets or sets a control template.
TemplatedParent Gets a reference to the template parent of this element. This property is
not relevant if the element was not created through a template.
ToolTip Gets or sets tbe tool-tip object that is displayed for this elerne11t in the
user interface (Ul).
TouchesCaptwed Gets all touch de,rices that are capttued to this element.
TouchesCaptu redWithin Gets all touch devices that are capt1ued to this elen1ent or any ch.ild
elements in its ,-isual tree.
Tou cbesD irectlyOver Gets all touch devices that are over this element.
ToucbesOver Gets all touch devices that are over this elen1ent or any child elements in
its visual tree.
Triggers Gets the collection of triggers established directly on this element, or in
child elen1ents.
Uid Gets or sets the unique identifier (for localization) for this ele1nent. This
is a dependency property .
UseLayoutRounding Gets or sets a va1ue that indicates ,vJ1ether layout rounding should be
applied to this element's size and position dtuing layout
VerticalAlignment Gets or sets the vertical alignment characteristics applied to this element
\Vhen it is cornposed \\ithin a parent ele1ne11t such as a panel or ite1ns
control.
VerticalContcntAlignment Gets or sets the vertical aligim1ent of the control's content.
Visibilitv Gets or sets the user interface (Ul) visibility of this elen1ent. This is a
dependency property.
VisualBitma11Effcct Obsolete. Gets or sets the BitmapEffect value for the Visual.
VisualBitmapEffectlnput Obsolete.Gets or sets the Biln1apEffectlnput value for the Visual.
VisualBitma_pScalingMode Gets or sets the BitmapScalingMode for U1e Visual.
VisualCacheMode Gets or sets a cached representation of the Visual.
VisuaJCbildrenCount Gets the nun1ber of visual child ele1nents \vi thin tlris ele1ne11t.
VisualClearTy1leHint Gets or sets the CJearTypeHint that deternunes how ClearType is
rendered in U1e Visual.
VisualCli1J Gets or sets tl1e clip region of the Visual as a Geometry value.
VisualEdgeMode Gets or sets the edge tnode of the Visual as an EdgeMode Yalue.
VisualEffect Gets or sets the bitmap effect to apply to tl1e Visual.
VisualOtiset Gets or sets the offset value of the visual object.
Visual Opacity Gets or sets the opacity of the Visual.
VisuaJOpacityMask Gets or sets the Bn1sh value that represents the opacity mask of the
Visual.
PowerShell Studio - Reference Guide I 411

VisnaIParent Gets the visual tree parent of the visual object.


VisnaJScrollableAreaClip Gets or sets a clipped scrollable area for the Visual.
VisuaJTextHi_otingMode Gets or sets the TextHintingMode of the Visual.
VisuaJTextRenderingMode Gets or sets the TextRende1iugMode of the Visual
VisualTransform Gets or sets the Transform value for the Visual.
VisualXSnappiogGuidelines Gets or sets tl1e x-coordinate (vertical) guideline collection.
VisuaJYSnappingGuidelines Gets or sets tl1e y-coordinate (horizontal) guideline collection.
Width Gets or sets the vvidth of the element.

LISTVIEW

Actnaffieight Gets the rendered height of this element.


ActualWidth Gets the rendered vvidth of this ele1nent.
AllowDrop Gets or sets a value indicating whetl1er this element can be used as the
target of a drag-and-drop operation. This is a dependency property.
AlteroationCouot Gets or sets tl1e nu1nber of alternating ite1n containers in the
ItemsControl, '~1 hich enables alternating containers to have a unique
appearance.
Anchorltem Gets or sets the ite1n that is initially selected "vhen SelectionMode is
Extended.
AreAnyTouchesCaptu red Gets a value that indicates whether at least one touch is captured to this
elen1ent.
AreAnyTouchesCapturedWithio Gets a value that indicates whether at least one touch is captured to this
element or to any child elements in its visual tree.
AreAnyTouchesDirectlyOver Gets a value tl1at indicates '1vhetber at least one touch is pressed over
this eleme11t.
AreAnyTouchesOver Gets a value tliat indicates whether at least one touch is pressed over
this eleme11t or any child elements in its visual tree.
Background Gets or sets a bn1sh tl1at describes the background of a control.
BindingGroup Gets or sets the BindingGroup that is used for tl1e elen1ent.
BitmapEffect Obsolete. Gets or sets a bitmap effect that applies directly to the
rendered content for this ele1nent. This is a dependency property.
Bitm apEffectln put Obsolete. Gets or sets an input source for tl1e bitmap effect that applies
directly to the rendered content for this ele1nent. This is a dependency
property.
BorderBrush Gets or sets a brush tl1at describes the border background of a control.
BorderTbickness Gets or sets the border thickness of a control.
CacbeMode Gets or sets a cached representation of the UIElement.
Cli1> Gets or sets the geo1netry used to define the outli11e of the contents of
an ele1nent. This is a dependency property.
ClipToBounds Gets or sets a value indicating whether to clip the content of this
ele1nent (or conte11t coming from the child elen1ents of this element) to
412 I PowerShell Studio - A Comprehensive Guide

fit into the size of the containing element. This is a dependency


property.
CommandBindings Gets a collection of CommandBinding objects associated with this
element. A Co1runandBinding enables command baudling for this
element, and declares the Ji nkage between a command, its events, and
the handlers attached by this element.
ContextMenu Gets or sets the contex.1 menu element that should appear whenever the
context menu is requested through user interface (UI) from within this
ele1nent.
Cursor Gets or sets the cursor that displays "vhen the mouse poi11ter is over
this element.
DataContext Gets or sets the data context for an ele1nent when it paiticipates in data
binding.
Defau ltStyleKey Gets or sets the key to use to reference the style for this co11trol, \vhen
theme styles are used or defined.
DependencyObjectType Gets tl1e DependencyObjectType that \Taps the CLR type of tltis
instance. (Inherited from Depe11dencyObject.)
DesiredSize Gets the size that this ele1nent computed during the measure pass of
the layout process.
Dispatcher Gets tl1e Dispatcher this DispatcherObject is associated with. (Inherited
fro1n DispatcherObject.)
Dis11layMem berPatb Gets or sets a path to a value on the source object to serve as the visual
representation of tl1e object.
Effect Gets or sets the bitmap effect to apply to the UIElement. This is a
dependency property.
Flo'vDirection Gets or sets the direction that tex.1 and other user interface (UI)
elernents flo,;v ,;vitltin any parent element that controls their layout.
Focusable Gets or sets a value tliat indicates whether the ele1nent can receive
focus. This is a dependency property.
FocusVi.sualStyle Gets or sets a property that enables customization of appearance,
effects, or other style characteristics tliat will apply to this element
when it captures keyboard focus.
FontFamily Gets or sets the font family of the control.
FontSize Gets or sets the font size.
FontStretch Gets or sets the degree to which a font is condensed or ex.'Panded on
tl1e screen.
FontStyle Gets or sets the font sty le.
FontWeight Gets or sets the weight or thickness of the specified font.
ForceCurso r Gets or sets a value that indicates vvhether this Fra111e\vorkElement
should force the user interface (UI) to render the cursor as declared by
tl1e Cursor property.
Foreground Gets or sets a b1usb tliat describes the foregrotmd color.
GroupStyJe Gets a collection of GroupStyle objects that define the appearance of
each level of groups.(Inhe1ited from ItemsControl.)
GroupStyleSelector Gets or sets a metl1od tliat enables you to provide custom selection
logic for a GroupStyle to apply to each group in a collection.
Han dlesScrollin g Gets a value that indicates whether the ListBox supports scrolling.
PowerShell Studio - Reference Guide I 413

HasAnim atedProperties Gels a va lue indicating \hether this elen1ent has any ani111ated
properties.
HasEffectiveKeyboardFocus

Gets a value that indicates v.rhether the UIEle1nent has focus.
Hasltems Gets a value U13t inrucates \hether the Iten1sControl contains items.
Height Gets or sets the suggested height of the element.
HorizontalAlignment Gets or sets the horizontal aligrunent characteristics applied to this
element \Vhen it is co1nposed within a parent elen1ent, such as a paneJ
or iten1s control.
HorizontalContentAlignment Gets or sets the ho1izontal alignment of the control's content.
InberitanceBehavior Gets or sets the scope lin1its for property value inheritance. reso1uce
key lookllp, and RelativeS01rrce Find.Ancestor lookup.
InputBindings Gets the collection of input bindings associated \Vitb this element.
InputScope Gets or sets the context for input used by tills Frame\vorkElen1ent.
IsArrangeValid Gets a value indicating 'vhether the computed size and position of
cllild elements in this ele1nenrs layout are valid.
IsEnabled Gets or sets a. value indicating whether this element is enabled in the
user iuterface (UI). This is a dependency property.
lsEnabledCore Gets a valu.e that becomes the return value of IsEnabled in derived
classes.
IsFocused Gets a value that detemlines \Vhether this elen1ent has logical focus.
This is a dependency property.
lsGrou1Jing Gets a value that indicates whether the control is using grouping.
IsHitTestVisible Gets or sets a vaJue that declares \Vhether this elen1ent can possibly be
returned as a hit test result from so rne portion of its rendered content.
This is a dependency property.
Isloitialized Gets a value that indicates \vhether this elen1ent has been initialized,
either during processing by a XAML processor, or by explicitly 113ving
its End.In.it method called.
Isl o pu tMethodEnabled Gets a value indicating whether an input n1ethod syste111, such as an
Input Method Editor (IME), is enabled for processing the input to this
elen1ent.
l sKeyboa rdFocu sed Gets a value indicating \Vhether this elen1ent 113s keyboard focus. This
is a dependency property.
lsKe:yboardFocu

sWithin Gets a value i11dicating whether keyboard focus is auywhere within the
element or its visual tree child elen1ents. This is a depe11dency
property.
I sLoaded Gets a value that indicates whether this element has been loaded for
presentation.
IsManipulationEnabled Gets or sets a value that indicates whether manipulation events are
enabled on this UIElement.
IsMeasureValid Gets a value indicating whether the curre11t size retun1ed by layout
measure is valid.
IsMouscCa11tured Gets a value indicating whether the mouse is capttued to this element.
This is a dependency property.
IsMouseCaptureWithin Gets a value that detennines whetl1er mouse capttue is held by this
element or by child elements in its visual tree. This is a dependency
pioperty.
414 I PowerShell Studio - A Comprehensive Guide

IsMouseDirectlyOver Gets a value that indicates whether the position of the mouse pointer
corresponds to hit test results, whicl1 take element compositing into
account. This i s a dependency property.
IsMouseOver Gets a value indicating whether the mouse poit1ter is located over tllis
element (including child elements in the visual tree). This is a
dependency property.
IsScaled Gets a value that indicates whether this instance is currently sealed
(read-only).(Inherited fron1 DependencyObject.)
IsStylusCaptured Gets a value indicating whether the stylus is cap1:u red by this eleme11t.
This is a dependency property.
IsStyJusCaptureWithin Gets a value that detennines whether stylus capture is held by this
ele1nent, or an element vvithin the element botu1ds and its visual tree.
This is a dependency property.
IsStylusDirectlyOver Gets a value that indicates whether tl1e stylus position corresponds to
llit test results, which take element compositing il1to account. This is a
dependency property.
IsStylusOver Gets a value indicating whether the stylus cursor is located over tllis
ele111ent (including visual child ele1nents). TJlis is a dependency
property.
IsSynchronizedWithCurrentltem Gets or sets a value that indicates whether a Selector should keep tl1e
Selectedltem synchronized with the current item in the Items property.
(Inherited fron1 Selector.)
IsTabStop Gets or sets a value that indicates vvhether a control is included in tab
navigation.
lsTextSearchCaseSensitive Gets or sets a value that indicates vvhether case is a co11dition "\tvben
searclling for items.(Inberited from ItemsControl.)
IsTextSearchEnabled Gets or sets a value that il1dicates vvhether TextSearcl1 is enabled on
the ItemsControl instance.
IsVisible Gets a value indicati11g whether this element is visible in the user
interface (UT). This is a dependency property.
ltemBindingGroup Gets or sets the BindingGroup that is copied to each item in the
ItemsControl. (Inherited from Iten1sControl.)
ItemContainerGenerator Gets the ItemContainerGenerator that is associated with the control.
ItemContainerStyle Gets or sets the Style that is applied to the container element generated
for each ite1n.
ItemContainerStyleSelecto1 Gets or sets ClIStom style-selection logic for a sty le that can be applied
to each generated co11tainer elen1ent.
Items Gets the collection used to generate the content of the
Iten1sControl.(lnherited fro1n Ite1nsControl.)
ItemsPanel Gets or sets the template that defines the panel that controls the layout
of iten1s.
ItemsSource Gets or sets a collection used to generate the content of the
ItemsControl.
ltemStringFonnat Gets or sets a composite string that specifies ho'v to format the items in
the lte1nsControl if they are displayed as stJ.ings.(111.herited from
ItemsControl.)
Item Template Gets or sets the DataTemplate used to display each item .
PowerShell Studio- Reference Guide. I 415

ItemTemplateSelecto r

Gets or sets the custom logic for choosing a template used to display
each item.
Language Gets or sets localization/globalization lai1guage infon11ation that
applies to all eleme11t.
LayoutTransform Gets or sets a graphics trailSfonnation that should apply to this element
when layot1t is performed.
LogicalChildren Gets an enumerator fo r tl1e logical child objects of tJ1e lten1sControl
object.(Inherited fro111 ltemsControl.)
Margin Gets or sets the outer margin of all element.
MaxHeight Gets or sets tl1e maximmn height constraint of the ele1nent.
MaxWidth Gets or sets t11e maximum width constraint of the element.
MinHeight Gets or sets the 111ini1numheight constraint of the ele1nent.
MinWidth Gets or sets the minimiun width constraint of the ele1nent.
Name Gets or sets t11e identifyil1g nan1e of the element. The name provides a
reference so that code-behind, such as event handler code, can refer to
a inarkup element after it is constn1cted during processing by a XAJ\.1L
processor.
Opacity Gets or sets the opacity factor applied to the entire UIElement \Vhen it
is rendered in the user interface (UI). This is a dependency property.
OpacityMasi< Gets or sets an opacity mask. as a Brush iniplen1entation that is applied
to any alpha-cham1el n1asking for the rendered content of this ele1nent.
Tltis is a dependency property.
OverridesDefaultStyle Gets or sets a value that il1dicates whether this element incorporates
style properties fro1n theme sty les.
Padding Gets or sets the padding inside a control.
Parent Gets the logical parent ele1nent of this element.
Persistld Obsolete. Gets a value that uniquely ide11tifies this element.
RenderSize Gets (or sets, but see Re1narks) the final render size of this element.
RenderTransform Gets or sets transform information that affects the rendering position of
this eleme11t. This is a dependency property.
RenderTransformOrigin Gets or sets the center point of any possible render transform declared
by RenderTransfonn, relative to the bounds of the element. This is a
dependency property.
Resources Gets or sets t11e locally-defined resource dictionary.
Selectedlndex Gets or sets the index of the first item in the current selection or returns
negative one (-1) if the selection is empty. (Inherited from Selector.)
Selectedltem Gets or sets the first ite1n in the current selection or returns ntill if the
selection is empty (Inherited from Selector.)
Selectedltems Gets the currently selected items.
SelectedValue Gets or sets the value of the Selectedltem, obtained by using
SelectedValuePath. (Inherited from Selector.)
SelectedValuePath Gets or sets the path t11at is used to get the SelectedValue from the
Selectedltem. (Inherited from Selector.)
SelectionMode Gets or sets the selection behavior for a ListBox.
416 I PowerShell Studio-A Comprehensive Guide

SnapsToDevicePixels
Gets or sets a value that determines whetheI rendering for this element
sholtld use device-specific pixel settings during rendering. This is a
de_pende11cy property.
Style Gets or sets the sty le used by this ele111ent when it is rendered.
StylusPluglns Gets a collection of all stylus plug-in (customization) objects
associated with this ele1ne11t.
Tab Index Gets or sets a value that determines tl1e order in which elements
receive focus when the user navigates through controls by using the
TAB key.
Tag Gets or sets an arbitrary object value that can be used to store custom
information about this element.
Tem]llate Gets or sets a control template.
TemplatedParent Gets a reference to the template parent of this element. This property is
not relevant if the element \.vas not created through a template.
ToolTip Gets or sets the tool-tip object that is displayed for this element in the
user interface (UI).
TouchesCa1>tured Gets all touch devices that are captured to this ele1nent.
TouchesCa1>turedWithin Gets all touch devices that are captured to this element or any child
eletnents in its visual tree.
ToucbesDirectlyOver Gets all touch devices that are over this element.
TouchesOver Gets all touch devices that are over this element or any child elements
in its visual tree.
Triggers Gets the collection of triggers established directly on this element, or
in child elements.
U.id Gets or sets the unique identifier (for localization) for this eletnent.
This is a dependency property.
U seLayoutRounding Gets or sets a value that indicates "vhether layout roundi11g should be
applied to this ele1nent's size and position during layout.
VerticaW.ignment Gets or sets the vertical alignment characteristics applied to tllis
ele1nent when it is composed \.vithin a parent element sucl1 as a panel
or iten1s control.
VerticalContentAlignment Gets or sets the vertical aligrunent of the control's co11tent.
Vielv Gets or sets a11 object that defi11es ho,;v the data is styled and organized
in a ListVievv control.
Visibility Gets or sets the user interface (UI) visibility of tllis ele1nent. This is a
dependency property.
VisualBitmapEffect Obsolete.Gets or sets the BitmapEffect value for t11e Visual.
VisualBitmapEffectln put Obsolete. Gets or sets the BitmapEffectlnput value for the Vis11al.
VisualBitmapScaJingMode Gets or sets the Bit111apScalingMode for tl1e Visual.
V.isuaJCacheMode Gets or sets a cached representation of the Visual.
V.isu a1Children Count Gets the nwnber of visual child elements within this ele1uent.
V.isuaJClearTypeHint Gets or sets the ClearTypeHint that detennines how ClearType is
rendered in the Visual.
VisualClip Gets or sets the clip region of the Visual as a Geo1netry value.
VisualEdgeMode Gets or sets the edge mode of the Visual as an EdgeMode value.
Pow erShe ll Studio - Referen ce Guide I 417

Visu alEffect
Gets or sets the bitmap effect to apply to the Visual.
VisualOffsct Gets or sets the offset value of the visual object.
VisualOpacity Gets or sets the opacity of the Visual.
VisualOpacityMask Gets or sets the Bn1sh value that represents the opacity mask of the
Visual.
VisualParcnt Gets the vist1al tree parent of the visual object.
VisnaJScrollablcAreaClip Gets or sets a clipped scrollable area for the Visual.
VisualTextBintingMode Gets or sets tl1e TextHintingMode of the Visual.
VisualTcxtRenderingMode Gets or sets the TeAiRenderingMode of the Visual.
VisualTransfonn Gets or sets the Transform value for the Visual.
VisuaJXSnappingGuidelines Gets or sets the x-coordinate (vertical) guideline collection.
VisualYSnappingGuidelines Gets or sets they-coordinate (horizontal) gt1ideline collection.
Width Gets or sets the width of the element.

MASKEDTEXTBOX

Accepts Tab Gets or sets a value deten1lining ho'iV TAB keys are handled for
inultiline coufigurations. This property is not supported by
MaskedTextBox.
AccessibilityObject Gets the AccessibleObject assigned to the control.
Accessib.leDefaultActionDescription Gets or sets the default action description of tl1e control for use by
accessibility client applications.
Accessi bleDescri11tiou Gets or sets the description of the control used by accessibility
client applications.
AccessibleName Gets or sets the name of the control u sed by accessibility client
applications.
AccessibleRole Gets or sets the accessible role of the contTol
AllowDro1> Gets or sets a value indicating whether the control can accept data
that the user drags onto it.
AllowPromptAslnput Gets or sets a value indicating whether Pro1nptCbar can be entered
as valid data by the user.
Anchor Gets or sets the edges of the container to which a control is bound
and detemlines how a control is resized with its parent.
AsciiOnly Gets or sets a value indicating ,;vhether the MaskedTeA1Box
control accepts characters outside of the ASCII character set.
AutoScrollOffset Gets or sets where this control is scrolled to in
Scroll ControllntoView.
AntoSize Gets or sets a value indicating whether the height of the control
automatically aqjusts when the font assigned to tl1e control is
changed.
BackColor Gets or sets the background color of tl1e contr:ol.
418 I PowerShell Studio - A Comprehensive Guide

Backgroundlm age This API supports the product infrastructure and is not intended to
be used directly frotn your code. Tb.is property is not relevant for
this class.
BackgroundlmageLayout This API supports the product infrastructure and is not intended to
be used directly from your code. Tb.is property is not relevant for
this class.
BeepOnError Gets or sets a value indicating wl1ether the masked teA1 box
control raises tl1e system beep for eacl1 user key stroke that it
rejects.
BindingContext Gets or sets the BindingConteA1 for the control.
BorderStyle

Gets or sets tl1e border type of the text box control.
Bottom Gets tl1e distance, in pixels, between the bottom edge of the
control and the top edge of its container's client area.
Bounds Gets or sets the size and location of the control including its
nonclient elements, in pixels, relative to the parent control.
CanEnablelme Gets a value indicating \vhether the ImeMode property can be set
to an active value, to enable Ilv1E support.
CanFocus Gets a value indicating \vl1ether tlle control can receive focus.
CanRaiseEvents Determines if events can be raised on the control.
Can Select Gets a value indicating whether the control can be selected.
CanUndo Gets a value it1dicating \Vhether tl1e user can undo the previous
operation. This property is not supported by MaskedTexffiox.
Ca1>ture Gets or sets a value indicating \vhether the control has captured
tl1e IDOllSe.
CausesValidation Gets or sets a value indicating \hetber the control causes
validation to be perfo1med on any controls that require validatio11
when it receives focus.
ClientRectan gle Gets the rectangle that represents tlle client area of the control.
ClientSize Gets or sets the height and width of tbe client area of the control.
CompanyName Gets tbe name of the co1npany or creator of the application
containing the control.
Container Gets the !Container that contains the Component.
ContainsFocus Gets a value indicating whether the control, or one of its child
controls, clrrrently has the input focus.
CootextMenu Gets or sets U1e sho1tcut menu associated with the control.
ContextMeouStrip Gets or sets the ContextMenuSttip associated \Vitl1 this control.
Controls Gets the collection of controls contained within tl1e control.
Created Gets a value indicating whether tlle control has been created.
CreateParams Gets the required creation paraineters when the control hand1e is
created. (Overrides TextBoxBase. CreateParams.)
Culture Gets or sets the culture information associated \Vitb the 1nasked
teA1 box.
Cursor Gets or sets the cursor that is displayed \Vl1en tl1e inouse pointer is
over the co11trol.
PowerShell Studio - Referen ce Guide. I 419

CutCopyMask:Format Gets or sets a value that detenni11es \.Vhether literals and prompt
characters are copied to the clipboard.
DataBindings Gets the data binclings for the control
DefaultCursor Gets or sets the default ctusor for the control.
DefaultlmeMode Gets tl1e default Input Method Editor (IME) mode supported by
t11e control.
DefaultMargin Gets tl1e space, in pixels, that is specified by default between
controls.
Defau ltMa:l.imumSize Gets the length and height, in pixels, that is specified as the default
maximun1 size of a control.
DefaultMinimumSize Gets the length and height, in pixels, that is specified as the default
minimum size of a control.
DefaultPadding Gets tl1e internal spacing, in pLxels, of the contents of a control.
DefaultSize Gets the default size of the control.
DesignMode Gets a value that indicates wl1ether the Component is Cl1rrently in
design mode.
DisplayRectangle Gets tl1e rectangle that represents the display area of the control.
Disposing Gets a value indicating whether the base Control class is in the
process of disposing.
Dock Gets or sets whicl1 control borders are docked to its parent control
and detennines ho\;y a control is resized \.Vith its parent.
Dou bleBuffered This API supports the product infrastructure and is not intended to
be used directly from your code. Gets or sets a value indicating
\.Vhether control drawing is done in a buffer before the contiol is
displayed. This property is not relevant for this class.
Enabled Gets or sets a value i11dicating whether the control can respond to
user interaction.
Events Gets tl1e list of event liandlers tliat are attached. to this Component.
Focused Gets a value i11dicating whether the control has input focus.
Font Gets or sets the font of the text displayed by tl1e control.
FontHeight Gets or sets the height of the font of the control.
ForeColor Gets or sets the foreground color of the control.
FormatProvider Gets or sets the IFonnatProvider to use when perfon11ing type
validation.
Handle Gets the windovv handle that the control is bound to.
Has Children Gets a value indicating whether tl1e control contains one or more
child controls.
Height Gets or sets the height of the control.
HidePromptOnLeave Gets or sets a value indicating whether the pro1npt characters in
the input mask are hidden when the masked te:x.'t box loses focus.
HideSelection Gets or sets a value indicating whether the selected teA1 in tl1e text
box control remains highlighted when tl1e control loses focus.
ImeMode Gets or sets the Input Method Editor (Thffi) mode of the control.
ImeModeBase Gets or sets the Input Method Editor (IME) mode of a control.
420 I PowerShell Studio - A Comprehensive Guide

Inse11KeyMode Gets or sets the text insertion inode of the masked text box
control.
InvokeRequired Gets a value indicating whether the caller must call an invoke
method when making method calls to the control because the
caller is on a different tlu:ead than the one the control was created
on.
lsAccessible Gets or sets a value indicating wl1ether the control is visible to
accessibility applications.
IsDisposed Gets a value indicating whether the control has been disposed of.
IsHanclleCreated Gets a value indicating whether the control l1as a 11andle associated
with it.
IsMirrored Gets a value indicating whether the control is mirrored.
lsOve1\vriteMode Gets a value that specifies whether new user input overwrites
existing input.
LayoutEngine Gets a cacl1ed instance of the control's layout engine.
Left Gets or sets the distance, in pixels. betwee11 the left edge of the
control and the left edge of its container's client area.
Lines Gets or sets the lines of text in multi line configurations. This
property is not supported by MaskedTeA.1Box.
Location Gets or sets tl1e coordinates of the upper-left comer of the control
relative to the upper-left con1er of its container.
Margin Gets or sets the space between controls.
Mask Gets or sets tl1e input mask to use at nm ti1ne.
MaskCompleted Gets a value indicatil1g whetl1er all required inputs have been
entered into the input mask.
Masked TextProvider Gets a clone of the inask provider associated \.Vith this instance of
tl1e masked text box control.
MaskFull Gets a value indicating whether all required and optional inputs
have been entered into the input mask.
MaximumSize Gets or sets the size that is the upper limit that GetPreferredSize
can specify.
MaxLength Gets or sets t11e 1naxin1um number of characters the user can type
or paste into tl1e teA.1 box control. This property is not supported
by .MaskedTeA.t Box. (Overrides TextBoxBase.MaxLength.)
Minimu mSize Gets or sets the size that is the lower linrit that GetPreferredSize
can specify.
Modified Gets or sets a value that indicates tliat the teA.'t box control has
been modified by the user si11ce tl1e control was created or its
co11tents were last set.
Multiline Gets or sets a value indicating wl1ether this is a mttltiline teJ\1 box
control. This property is not frilly supported by MaskedTextBox.
(Overrides TeA1BoxBase.Multi line.)
Name Gets or sets the naine of the control.
Padding Tlris APJ supports the product infrastructure and is not intended to
be used directly from your code. This prope11y is not relevant for
tllis class.
Parent Gets or sets the parent container of the control.
PowerShell Studio - Reference Guide. I 421

Gets or sets the character to be displayed in substitute for user


input.
PreferredHeight Gets the preferred height for a text box.
PreferrcdSizc Gets the size of a rectangular area into '1vhich the control can fit.
ProductName Gets tl1e product na1ne of the assembly containing the control.
ProductVersion Gets tl1e version of the assembly containing the control.
PromptChar Gets or sets the character used to represent the absence of user
input in MaskedTe>..1:Box.
Read Only Gets or sets a value indicating whether teA.i in the text box is read-
only .
RecreatingHandlc Gets a value indicating whether the control is currently re-creating
its ha11dle.
Region Gets or sets the \indow region associated with the control.
Rcjectln putOnFirstFailure Gets or sets a value indicating whether the parsing of user input
should stop after the frrst il1valid character is reached.
RenderRightToLeft Obsolete.This property is now obsolete.
ResetOnPrompt Gets or sets a value that determines how an input character that
inatches the prompt character should be handled.
RcsetOnSpace Gets or sets a value that detennines how a space input character
should be handled.
ResizeRedraw Gets or sets a val11e indicating whether the control redra,;vs itself
\hen resized.
Right Gets the distance. in pixels, between the right edge of the control
and the left edge of its container's client area.
RightToLeft Gets or sets a value indicating '1vl1etber control's elements are
aligned to support locales using right-to-left fonts .
ScaleChildren Gets a value tliat determines the scaliI1g of cllild controls.
SelectedText Gets or sets the current selection in tl1e MaskedTextBox
control. (Overrides TextBoxBase. SelectedTeA't.)
Selection Length Gets or sets the nmnber of characters selected in the text box.
SelectionSta11 Gets or sets the starting point of te~'t selected in the text box.
ShortcutsEnabled Gets or sets a value indicating '1Vhether the defined shortcuts aTe
enabled.
ShowFocusCues Gets a value indicating whether tl1e control should display focus
rectangles.
ShowKeyboard Cues Gets a value i11dicating whether the user i11terface is in.the
appropriate state to sl1ow or hide keyboard accelerators.
Site Gets or sets the site ofth.e control.
Size Gets or sets the height and width of the control.
Ski11Literals Gets or sets a value indicating whether the user is allo\ved to
reenter literal values.
Tab Index Gets or sets the tab order of the control within its container.
TabStop Gets or sets a value indicating whether the user can give the focus
to this control using the TAB key.
Tag Gets or sets the object that co11tains data about the control.
422 I PowerShell Studio - A Comprehensive Guide

Text Gets or sets the text as it is currently displayed to the user.


(Overrides TeA.1:BoxBase.TeA.1:.)
TextAlign Gets or sets .how text is aligned in a masked text box control.
TextLength Gets the length of the displayed text. (Overrides
TextBoxBase.TextLengtl1.)
TextMaskFormat Gets or sets a value that detem1ines whether literals and prompt
characters are included in the fonnatted string.
Top Gets or sets the distance, in pixels, between the top edge of the
control and the top edge of its container's client area
TopLevelControl Gets the parent co11trol that is not parented by another Windows
Fom1s control Typically, this is t11e outennost Fonn that the
control is contained in.
UseSystemPasswordChar Gets or sets a value indicating wl1ether the operating system-
supplied. password character should be used.
UseW aitCu rso r Gets or sets a value indicating \.Vhether to use the wait cursor for
the current control and all clrild controls.
V aJidatingType Gets or sets the data type used to verify the data input by the user.
Visible Gets or sets a value indicating \.vhether the control and all its child
controls are displayed.
Width Gets or sets the 'vidth of tl1e control.
Winclo,vTarget This API supports tl1e product infrastn1cture and is 11ot intended to
be used directly fro1n your code. Tllis property is not relevai1t for
this class.
WorclWrap Gets or sets a value indicating whether a multiline tex1 box control
auto1natically wraps words to the beginning of the ne>..1 li11e when
necessary. This property is not Sl1pported by MaskedTextBox.

MENUSTRIP

,
AccessibilityObject Gets tl1e AccessibleObject assigned to the control.
AccessibleDefaultActionDescri1>tion Gets or sets the default action description of the control for use
by accessibility client applications.
AccessibleDescription Gets or sets the description of the co.ntrol used by accessibility
client applications.
AccessibleN ame Gets or sets the name of the control used by accessibility client
applications.
Accessible~oJe Gets or sets the accessible role of the control
AllowDrOJ> Gets or sets a value i.ndicatin.g whether drag-and-drop and item
reorde1ing are handled through events that you in1plen1ent.
AllowItemReorder Gets or sets a value indicating whether drag-and-drop and item
reordering are handled privately by the ToolStrip class.
AllowMerge Gets or sets a value indicating \.Vhether multiple MenuStrip,
ToolStripDropDownMenu, ToolStripMenuiten1, and other types
can be combined.
PowerShell Studio - Reference Guide. I 423

Anchor Gets or sets the edges of the container to which a ToolStrip is


bound and determines how a ToolStrip is resized with its parent.
AutoScroll This API supports the product i11frastn1cture and is not intended
to be used directly from your code. This property is not relevant
for this class.
AutoScrollMargi n This API supports the product infrastructure and is not intended
to be used directly from yo1u code. This property is not relevant
for this class.
AutoScrollMinSize Tltis API supports the product infrastructure and is 11ot intended
to be used directly fron1 your code. This property is not relevant
for tlus class.
AutoScrollOffset Gets or sets \here this control is scrolled to in
ScrollControllntoView.
AutoScrollPosition This API supports the product infrastructure and is not intended
to be used directly from your code. Tlris property is not relevant
for tltis class.
AutoSize Gets or sets a value indicating whether the control is
automatically resized to display its entire contents.
BackColor This API supports the product infrastn1cture and is not intended
to be used directly from your code. Gets or sets tl1e backgTotu1d
color for the ToolStrip.
Backgroundlmage Gets or sets the background i1nage displayed in the control.
Backgrou odlmageLayout Gets or sets the background in1age layout as defined in the
ImageLayout enun1eration.
BindingCootext Gets or sets the binding context for the ToolStrip.
Bottom Gets the distance, in pixels, between the bottom edge of the
control and the top edge of its contaiI1er's client area.
Bounds Gets or sets the size and location of the control including its
nonclient ele1nents, in pixels, relative to the parent control.
CanEnablelme Gets a value indicating \V hether the ImeMode property can be
set to an active value, to enable IME support.
CanFocus Gets a value indicating 'vhether the control can receive focus.
CaoOverflolv Gets or sets a value indicating whether the MenltStrip supports
overflovv functionality .
CanRaiseEveots Determines if events can be raised on the control.
CanSelect Gets a value indicating whether the control can be selected.
Capture Gets or sets a value i11dicating '1Vhetl1er the control bas captured
the 1nouse.
CausesValidation Gets or sets a value indicating whether the ToolStrip causes
validation to be perfonned on any controls that require
validation \vhen it receives focus.
ClientRectan gle Gets the rectangle that represents the client area of the control.
ClientSize Gets or sets the height and width of the client area of the
control.
CompanyName Gets the name of the company or creator of the application
containing the control.
Container Gets the !Container that contains the Component
ContainsFocus Gets a value indicating whetl1er the control, or one of its child
controls~ currently bas tl1e input focus.
424 I PowerShell Studio - A Comprehensive Guide

ContextMenu Gets or sets the shortcut menu associated \Vith the control.
ContextMenuStrip Gets or sets the Co11textMenuStrip associated \Vith this control.
Controls This API supports the product infrastruct1ue and is not intended
to be used directly from your code. This property is not relevant
for this class.
Created Gets a value indicating whether tl1e control has been created.
CreatcParams Gets the required creation para1neters 'vhen the control handle is
created.
Cursor Gets or sets the cursor that is displayed when the mouse pointer
is over tl1e ToolStrip.
DataBindings Gets the data bindings for the control.
DefaultCursor Gets or sets the defatdt cursor for the co11trol.
DefaultDock Gets the docking location of the ToolStrip, indicating \vllich
borders are docked to the container.
DefauJtDropDownDirection Gets or sets a value represe11ting tl1e defatdt direction in which a
Too1StripDropDo'1vn control is displayed relative to the
ToolStrip.
DefaultGripMargin Gets the default spacing, in pL"Xels, bet\veen the sizn1g g1ip and
the edges of the MenuStrip.(Overrides
ToolStrip.DefaultGripMargin.)
DefaultlmeMode Gets the default Input Method Editor (IlvfE) mode supported by
the control.
DefaultMargin Gets the spacing in pixels, bet\veen tl1e ToolStrip and the
ToolStripContainer.
DefaultMa:ximu mSize Gets tl1e lengtl1 and height, in pixels, that is specified as the
default maximtun size of a control.
DefaultMinimumSize Gets the length ai1d height, in pixels, that is specified as the
default minimu1n size of a control.
DefaultPadding Gets the spacing in pixels, benveen the left, right, top, and
bottom edges of the Menus trip from the edges of the
f otm. (Overrides ToolStrip.Defa1dtPadding.)
DefaultSholvltemToolTips Gets a value indicating \hether ToolTips are sho'1vn for the
MenuStrip by default.(Overrides
ToolStrip.DefaultShowltemToolTips.)
DefauJtSize Gets the 11orizontal and vertical din1ensions, in pixels, of the
MenuStrip when it is first created.(Overrides
ToolStrip.DefaultSize.)
DesignMode Gets a value that indicates whether the Co1nponent is cturently
in design n1ode.
Dis1llayedltcms Gets the subset of ite.ms that are currently displayed on the
ToolStrip, including ite1ns that are automatically added into the
ToolStrip.
DisplayRectangle This API supports the product infrastructtue and is not intended
to be used directly from your code. Retrieves the current display
rectangle.
Disposing Gets a value indicating \Vhether the base Control class is in the
process of disposing.
PowerShell Studio - Reference Guide. I 425

Dock Gets or sets which ToolStrip borders are docked to its parent
control and determines 11ow a ToolS trip is resized with its
parent.
DockPadding Gets the dock padding settings for all edges of tl1e control.
DoubleBuffered Gets or sets a value .indicating \V hetl1er this control should
redra\v its surface using a secondary buffer to red11ce or prevent
flicker.
Enabled Gets or sets a value indicating whether the control can respond
to user interaction.
Events Gets the list of event handlers that are attached to tllis
Component.
Focused Gets a value indicating whetl1er the control has input focus.
Font Gets or sets the font used to display text in t11e control.
FontHeight Gets or sets t11e height of the font of tl1e control.
ForeColor Gets or sets the foreground color of the ToolStrip.
GriJlDisplayStyle Gets the orientation of the ToolS trip move 11andle.
GripMargin Gets or sets the space around the ToolStiip 1nove ha11dle.
GripRectangle Gets the botu1daries of the ToolStrip move haI1dle.
Grit>Style Gets or sets the visibility of the grip used to reposition U1e
control.
Handle Gets the windo"v handle tliat the control is bound to.
Has Children This API supports the product infrastructure and is not intended
to be used directly from your code. This property is not relevant
for this class.
Height Gets or sets the height of the control.
HorizontaJScroll Tlris API supports the product infrastntctme and is not intended
to be used directly fron1 your code. This property is not relevant
for tl1is class.
HScroll Gets or sets a value indicating whether the horizontal scroll bar
is visible.
ImageList Gets or sets the image list tliat contains the image displayed on a
Too lStrip ite1n.
ImageScalingSize Gets or sets the size, in pixels, of an image used on a ToolStrip.
ImeMode Gets or sets the Input Method Editor (IME) rnode of the control.
lmeModeBase Gets or sets the IME mode of a control.
InvokeRequired Gets a value indicating \Vhether the caller must call an invoke
method when n1aking 1netl1od calls to the control because tl1e
caller is on a different thread than the 011e the control 'vas
created ou
IsAccessible Gets or sets a value i11dicating whether the control is visible to
accessibility applications.
lsCurrentlyDragging Gets a value indicating whether the user is currently moving the
ToolStrip from one ToolStripContainer to anotl1er.
IsDisposed Gets a value indicating whetl1er the control has been disposed
of.
IsDropDown Gets a value indicating whether a ToolStrip is a
ToolStripDropDown control.
IsHandleCreated Gets a value indicating whether the control bas a handle
associated \Vith it.
426 I PowerShell Studio - A Comprehensive Guide

IsMinored Gets a value indicating vvhether the control is mirrored.


Items Gets all the items that belong to a ToolStrip.
LayoutEngine Passes a reference to the cached LayoutEngine returned by the
layout engine interlace.
LayoutSettings Gets or sets layout scheme characteristics.
LayoutStyle Gets or sets a value indicating hovv the ToolStrip lays out the
items collection.
Left Gets or sets the distance, in pixels, between the left edge of the
control and the left edge of its co11tainer's client area.
Location Gets or sets the coordinates of the upper-left corner of the
control relative to the upper-left con1er of its container.
Margin Gets or sets the space betvveen controls.
MaximumSize Gets or sets the size that is the upper liinit that GetPreferredSize
can specify.
Maxltem.Size Gets the 1llilXilnum height and 'vidtl1, in pixels, of tl1e ToolStiip.
MdiWindowListltem Gets or sets the ToolStripMenuitem that is used to display a list
of Multiple-document inte1face (MDI) child forms.
MinimumSize Gets or sets the size that is the lower limit that GetPreferredSize
can specify.
Name Gets or sets the name of the control.
Orientation Gets the orie11tation of the ToolStripPanel.
OverflowButton Gets the ToolStripltem that is the ove1flo"v button for a
ToolStrip with overflo\v enabled.
Padding Gets or sets padding vvitlrin the control.
Parent Gets or sets the parent container of the control.
PreferredSize Gets the size of a rectangttlar area into which the control can fit.
ProductName Gets the product name of the asse1nbly containiI1g the control.
ProductVersion Gets the version of tl1e assembly containing the control.
RecreatingHandle Gets a value indicating whether the control is cturently re-
creating its handle.
Region Gets or sets tl1e vvindow region associated with the control.
Renderer Gets or sets a ToolStripRenderer used to custonlize the look and
feel of a ToolStrip.
RenderMode Gets or sets a value that indicates 'vhich visual styles will be
applied to the ToolStrip.
RenderRightToLeft Obsolete. This property is now obsolete.
ResizeRedraw Gets or sets a value indicating whether the control redraws itself
when resized.
Right Gets the distance, in pixels, between the 1ight edge of the
control and the left edge of its co11tainer's client area.
RightToLeft Gets or sets a value indicating vvhether control's elen1ents are
aligned to support locales using right-to-left fonts.
ScaleChildren Gets a value tl1at detennines the scaling of child controls.
ShowFocusCues Gets a value indicating ' hether the control should display focus
rectangles.
ShowltemToolTips Gets or sets a value indicating whetl1er ToolTips are shown for
the MenuSt:Iip.
PowerShell Studio - Reference Guide I 427

ShowKeyboardCues Gets a value indicating whetheT the 11ser interface is in the


appropriate state to show or hide keyboard accelerators.
Site Gets or sets the site of the control.
Size Gets or sets the height and width of the control.
Stretch Gets or sets a value indicating whether the MenuStrip stTetches
fro1n end to end in its container.
TabIndex Gets or sets the tab order of the control ,;vithin its container.
TabStO}l Gets or sets a value indicating whether the user can give the
focus to an item in tl1e ToolStrip using the TAB key.
Tag Gets or sets the object that contains data about the control.
Text Gets or sets the text associated with this control.
TextDirection Gets or sets the direction in which to dra'\\' tex1 on a ToolStrip.
Top Gets or sets the distance, in pixels, between the top edge of the
control and the top edge of its container's client area.
To1>LevelControl Gets the parent control that is not parented by another Windows
Fonns co11trol. Typically. this is the outermost Fo1m that the
control is contained in.
UseW aitCu rso r Gets or sets a value indicating whether to use the wait cursor for
the current control and all cllild controls.
VerticalScroll This API supports the product infrastni.cture and is not intended
to be used directly from yo1u code. This property is not relevant
for tltis class.
Visible Gets or sets a value indicating whether the control and all its
child controls are displayed.
VScroll Gets or sets a value indicating whether tl1e ve1tical scroll bar is
visible.
Width Gets or sets the \Vidth of the control.
Window Target This API supports the product infrastructure and is not inte11ded
to be used directly fron1 your code. This property is not relevant
for tltis class.

MONTHCALENDAR

AccessibilityObject Gets the AccessibleObject assigned to the control.


AccessibleDefaultActi.onDescription Gets or sets the default action description of tl1e control for use by
accessibility client applications.
AccessibJeDescription Gets or sets tl1e description of tl1e control used by accessibility
client applicatio11s.
AccessibJeName Gets or sets the name of the control used by accessibility client
applications.
AccessibleRole Gets or sets the accessible role of the contTol
AllowDrop Gets or sets a value indicating \vhether the control can accept data
that the useT drags onto it.
Anchor Gets or sets the edges of the container to which a control is bound
and detennines how a control is resized with its parent.
428 I PowerShell Studio - A Comprehensive Guide

AnnuallyBoldedD ates Gets or sets the array ofDateTime objects that detennines which
annual days are displayed in bold.
AutoScrollOfl'set Gets or sets vvhere this control is scrolled to in
ScrollControllntoView.
Auto Size This AP! supports the product infrastructure and is not intended to
be used directly from your code. This property is 11ot relevant for
this class.
Bacl<Color Gets or sets the background color for the control.(Overrides
Control.BackColor.)
Backgroundlmage This API supports the product infrastn1cture and is not intended to
be used directly from your code. Gets or sets tl1e background image
for the MonthCalendar(Overrides Control.Backgroundlrnage.)
Backgroundlm ageLayout This API supports the product infrastn1cture and is not intended to
be used directly from your code. Gets or sets a value il1dicating the
layout for the Backgroundlmage.(Overrides
Co11trol.BackgroundI1nageLayout.)
BindingContext Gets or sets the BindingContex't for the control.
BoldedDates Gets or sets the array of DateTime objects that determines which
nonrecurring dates are displayed in bold.
Bottom Gets the distance, in pixels, between the bottom edge of the control
and the top edge of its container's client area.
Bounds Gets or sets the size and location of the control including its
nonclient ele111ents, in pixels, relative to the parent control.
CalendarDimensions Gets or sets tl1e number of columns and rows of 1nonths displayed.
CanEnablelme Gets a value indicating ~ hether the ImeMode property can be set to
ai1 active value, to enable IME support.
CanFocus Gets a value indicating whetl1er the control can receive focus.
Can RaiseEvents Detennines if events can be raised on the control.
Can Select Gets a value indicating whether the control can be selected.
Ca1>ture Gets or sets a value indicating wl1ether the control bas captured the
1nouse.
CausesVaJidation Gets or sets a value indicating whether tl1e control causes validation
to be perfonned on any controls that require validation wl1en it
receives focus.
ClientRectan gle Gets the rectangle that represents the client area of the control.
ClientSize Gets or sets the height and width of the client area of the control.
Com1>anyName Gets the name of the company or creator of the application
containing tl1e control.
Container Gets the !Container that contains the Component.
ContainsFocus Gets a value indicating whetl1er the contro~ or one of its child
controls, Currently has tl1e input focus.
ContextMenu Gets or sets the shortcut menu associated with the control
ContextMenuStrip Gets or sets the ContextMenuStrip associated witl1 this control.
Controls Gets the collection of controls contained within the control
Created Gets a value indicating whether the control has been created.
PowerShell Studio - Reference Guide I 429

CreateParams Gets a System.Windows.Fonns.CreateParams for creating a


MonthCalendar control. (Overrides Control. CreateParams.)
Cursor Gets or sets the cursor that is displayed when the mouse pointer is
over the control.
DataBinllings Gets the data bindings for the control.
DefaultCnrsor Gets or sets the default cursor for the control.
DefanltlmeMode Gets a value indicati11g the input method editor for the
MonthCalendar. (Overrides Control.Defaultin1eMode.)
Defau ltMargin Gets the defa11lt margin settings for the Montl1Calendar
control.(Overrides Control.DefaultMargin.)
DefaultMaximumSize Gets the length and height, in pixels, that is specified as the default
maximum size of a co11trol.
Defau ltMinimumSize Gets the length and height, in pixels, that is specified as the default
minimu1n size of a control.
DefaultPad(fing Gets the internal spacing, in pixels, of the contents of a control.
DefaultSize Gets the default size of the calendar. (Overrides
Contro l.DefaultSize.)
DesignMode Gets a value that indicates whether tl1e Component is currently in
design mode.
DisJJlayRectangle Gets the rectangle that represents the display area of the control
Dis1Josing Gets a value indicating whether the base Control class is in the
process of disposing.
Dock Gets or sets which control borders are docked to its parent control
and determines bow a control is resized with its paient.
DoubleBuffered Gets or sets a value indicating whether the control should redraw its
surface using a secondary buffer.(Overrides
ControLDoubleBuffered.)
Enabled Gets or sets a value indicating whether the control can respond to
user interaction.
Events Gets the list of event handlers that are attached to this Component.
FirstDayOtweek Gets or sets the first day of the week as displayed in tl1e month
calendar.
Focused Gets a value indicating whether the control has input focus.
Font Gets or sets the font of tl1e te>..1: displayed by the control.
FootHeight Gets or sets the height of the font of the control
ForeColor Gets or sets the foreground color of tl1e control.(Overrides
ControLForeColor.)
Handle Gets the windo"v handle tl1at the control is bound to.
HasCbildren Gets a value indicating whether the control contains one or tnore
child controls.
Height Gets or sets the height of the control.
ImeMode This API supports the product infrastructure aitd is not i11tended to
be used directly from yo1rr code. Gets or sets the Input Method
Editor (Th.ffi) mode supported by this control.
ImeMocleBase Gets or sets the Th.ffi rnode of a control.
430 I PowerShell Studio - A Comprehensive Guide

InvokeRequired
Gets a value indicating whether the caller must call an invoke
method when making method calls to the control because the caller
is on a different tluead than the one the control ,vas created on.
IsAccessibJe Gets or sets a v alue indicating whether tl1e control is visible to
accessibility applicatio1is.
lsDisposed Gets a value indicating whether the control has been disposed of.
lsHandleCreated Gets a value indicating whether tl1e control has a handle associated
with it.
IsMirrored Gets a value indicating whether the control is mirrored.
LayoutEngine Gets a cached instance of the control's layout engine.
Left Gets or sets the distance, in pixels, between tl1e left edge of the
control and the left edge of its container's client area.
Location Gets or sets tl1e coordinates of the upper-left corner of the control
relative to tl1e upper-left comer of its container.
Margin Gets or sets the space bet"\>veen controls.
MaxDate Gets or sets the 1naximurn allowable date.
Maximu mSize Gets or sets the size tllat is the upper limit that GetPreferredSize
can specify .
MaxSelection Coo nt Gets or sets the inax.imum nu1nber of days tl1at can be selected in a
montl1 calendar control.
Min Date Gets or sets the minimum allo"vable date.
MinimumSize Gets or sets the size that is the lower linlit that GetPreferredSize
can specify.
MonthlyBoJdedDates Gets or sets the array of DateTi1ne objects that detennine "vhich
montltly days to bold.
Name Gets or sets the name of ll1e control.
Padding This API supports the product infrastruchrre and is not intended to
be used directly from your code. Gets or sets the space between the
edges of a MonthCalendar control and its contents.
Parent Gets or sets tl1e parent container of the control.
PreferredSize Gets the size of a rectangular area into which tl1e coritrol can fit.
ProductN ame Gets the product name of the assembly co11taining the control.
ProductVersion Gets the version of the assembly contaiiling the control.
Recreatin gHandle Gets a value indicating \.vhether the control is CUITently re-creating
its handle.
Region Gets or sets the window region associated with the control.
RenderRightToLeft Obsolete.This property is now obsolete.
ResizeRedraw Gets or sets a value indicating "\>vhether the control redraws itself
when resized.
Right Gets the distance, i11 pixels, betieen tl1e right edge of the control
and tl1e left edge of its container's client area.
RightToLeft Gets or sets a value indicating whether control's elements are
aligned to support locales 11sing right-to-left fonts.
RigbtToLeftLayout Gets or sets a value indicating whether tl1e control is laid out fron1
right to left.
PowerShell Studio - Reference Guide. I 431
[

ScaleChildren Gets a value tbat detenni nes the scaling of child controls.
Scroll Change Gets or sets the scroll rate for a month calendar control.
SelectionEnd Gets or sets the end date of the selected range of dates.
SelectionRange Gets or sets the selected range of dates for a montl1 calendar
control.
SelectionStart Gets or sets the start date of tl1e selected range of dates.
ShowFocusCues Gets a value indicating vvhether the control should display focus
rectangles.
SholvKeyboard Cu es Gets a value i11dicatiJ.1g wl1ether the user interface is in the
appropriate state to show or hide keyboard accelerators.
Gets or sets a value indicating 'vhetl1er the date represented by the
TodayDate property is displayed at the botto1u of tl1e control.
ShowTodayCircle Gets or sets a value indicating 'vl1ether today's date is identified
witl1 a circle or a square.
ShowWeekNumbers Gets or sets a value indicating \vhether the montl1 calendar control
displays "veek numbers (1-52) to the left of each row of days.
SingleMontbSize Gets the minimum size to display one month of the calendar.
Site Gets or sets the site of the control.
Size Gets or sets the size of the MonthCalendar control.
Tab Index Gets or sets the tab order of the control within its container.
TabStop Gets or sets a value indicating whetl1er tl1e user can give tl1e focus
to this control using the TAB key.
Tag Gets or sets the object that contains data about the control.
Text This API supports the product infrastructure and is not intended to
be used directly from your code. Gets or sets the text to display on
the MonthCalendar.(Overrides Control.TeA1.)
TitleBacl\:COIO r Gets or sets a value indicating the background color of the title area
of tl1e calendar.
TitleForeColor Gets or sets a value indicating the fore ground color of the title area
of the calendar.
TodavDate

Gets or sets the value tliat is used by MonthCalendar as today's
date.
TodayDateSet Gets a value indicating w hetber the Today Date property has been
explicitly set.
Top Gets or sets the distance, in pixels, between the top edge of the
control and the top edge of its container's client area.
To1>LevelControl Gets the parent control that is not parented by anotl1er Windows
Forms control. Typically, tlris is the outermost Fom1 that the
control is contained in.
TrallingForeColor Gets or sets a value indicating the color of days in montl1s that are
not fully displayed in the control.
UseW aitCursor Gets or sets a value indicatingwhetl1er to use the wait cursor for the
current control and all child controls.
Visible Gets or sets a value indicating 'vhetl1er the control and all its child
controls are displayed.
Width Gets or sets the width of the control.
432 I PowerShell Studio - A Comprehensive Guide

Window Target This API supports the product infrastructure and is not intended to
be used directly from your code. This property is not relevant for
tllis class.

NOTIFYICON

PROPERTY DESCRIPTION
BalloonTipIcon Gets or sets the icon to display on tl1e balloon tip
associated with the Notify Icon.
Balloon Tip Text Gets or sets the text to display on the balloon tip
associated with the NotifyIcon.
BalloonTip Title Gets or sets the title of the balloon tip displayed on the
Notify Icon.
Container I Gets the !Container that contains the Component.
ContextMenu Gets or sets the shortcut inenu for the icon.
ContextMenuStrip Gets or sets the shortcut inent1associated with the
I Notify Icon.
Icon Gets or sets the current icon.
Site Gets or sets the ISite of the Component.
Tag Gets or sets an object that contains data about the
Notify Icon.
Text Gets or sets the ToolTip text displayed \vhen the
inouse poi.J1ter rests on a notification area icon.
Visible Gets or sets a value indicating \.vhether the icon is
visible in the notification area of the taskbar.

NUMERICUPDOWN

Accelerations Gets a collection of sorted acceleration objects for the


NumericUpDown control.
AccessibilityO bject Gets the AccessibleObject assigned to the controt
AccessibleDefaultActionDescription Gets or sets the default action description of the control for use
by accessibility client applications.
AccessibleDescription Gets or sets the description of the control used by accessibility
client applications.
AccessibleName Gets or sets the na1ne of the control used by accessibility client
applications.
AccessibleRole Gets or sets the accessible role of the control
Active Control Gets or sets the active control on the container control.
AllowDrop Gets or sets a value indicating \.vhether the control can accept
data that the user drags onto it.
PowerShell Studio - Reference Guide. I 433

Anchor Gets or sets the edges of the container to which a control is


bound and determines how a control is resized with its parent.
Au toScaleDimensions Gets or sets the dirnensions that the control was designed to.
AutoScaleFactor Gets the scaling factor between t11e current and design-time
automatic scaling din1ensions.
AntoScaleMode Gets or sets the automatic scaling mode of the control.
AutoScroll This API supports the product infrastructure a11d is not inte11ded
to be used directly from your code. Gets a value indicating
whether the container 'vill allow the user to scroll to ai1y controls
placed outside of its visible boundaries.
AutoScrollMargin Tllis API supports the product infrastn1cture and is not intended
to be used directly fro1n your code. Gets or sets the size of the
auto-scroll margin.
AutoScrollMinSize This API supports the product infrastn1cture and is not intended
to be used directly from your code. Gets or sets the minimum
size of the auto-scroll area.
AutoScroUOffset Gets or sets ,;vhere this control is scrolled to iI1
ScrollControllntoView .
AutoScroUPosition Gets or sets the location. of the auto-scroll position.
Auto Size Gets or sets a value indicating whether the control should
automatically resize based on its contents.
AutoValidate Gets or sets a value that indicates vvhetber controls in this
container ,vilJ be autoniatically validated when the focus
chai1ges.
BackColor Thls API supports the product infrastn1cture and is not intended
to be used directly fro111 your code. Gets or sets the background
color for the text box portion of the spin box (also k11o"vn as an
up-down control).
Back.g roundlmage Thls API supports the product infrastn1cture and is not iI1tended
to be used directly from your code. Gets or sets the backgro11nd
image for the UpDownBase.
BackgroundlmageLayout This API supports the product infrastructure and is not intended
to be used directly fron1 your code. Gets or sets the layout of the
Backgroundhnage of the UpDo,vnBase.
BindingContext Gets or sets the BindiI1gContext for the control.
BorderStyle Gets or sets the border style for the spin box (also known as an
up-down control).
Bottom Gets the distance, in p.L~els, benveen the bottom edge of the
control and tlle top edge of its container's client area.
Bounds Gets or sets the size and locatio11 of the control including its
nonclient elements, in pixels, relative to the parent control.
CanEnablelme Gets a value il1dicatingwhether the ImeMode property can be set
to an active value, to enable 1ME support.
CanFocus Gets a value indicating \vhether the control can receive focus .
CanRaiseEvents Detennines if events Call be raised on the control.
CanSelect Gets a value indicating whether the control can be selected.
434 I PowerShell Studio - A Comprehensive Guide

Capture Gets or sets a value indicating whether the control has captured
tl1e mouse.
CausesValidation Gets or sets a value indicating 'vhether the control causes
validation to be performed on any controls that require validation
whe11 it receives focus.
ChangingTex1 Gets or sets a value indicating whether the text property is being
changed intenlally by its parent class.
ClientRectan gle Gets the rectangle that represents the client area of the control.
ClientSize Gets or sets the height ai1d width of the client area of tl1e control.
CompanyName Gets the name of the co111pany or creator of the application
containing the control.
Container Gets the !Container that contains the Component
ContainsFocus Gets a value indicating whether the control, or 011e of its child
controls, currently has the input focus.
ContextMenu This API supports tl1e product infrastructure and is not intended
to be used directly from your code. Gets or sets the shortct1t
n1enu associated with the spin box (also known as an up-do\vn
co11trol).
ContextMenuStrip Gets or sets 01e shortcut 111enu for the spin box (also kno,vn as an
up-do,vu control).
Controls Gets the collection of controls contained within the control.
Created Gets a value indicatiug \vhether the control has been created.
CreateParams This API suppo11s the product infrastructure and is not inteuded
to be used directly fro1n your code. Gets the required creation
paraineters when the control handle is created.
CurrentAutoScaleDimensions Gets the ct1rrent n1n-ti111e dimensions of the screen.
Cursor Gets or sets the cursor that is displayed when the mouse pointer
is over the control.
DataBindings Gets the data bindings for the control.
DecimalPlaces Gets or sets the number of decimal places to display in the spin
box (also known as an up-dowi1 co11trol).
DefaultCursor Gets or sets the default cursor for the control.
DefaultlmeMode Gets the default Input Method Editor (IME) mode supported by
the control.
DefaultMargin Gets the space, in pixels, that is specified by default bet"veen
controls.
DefanltMaximumSize Gets the length and height in pixels that is specified as the
defatilt maximum size of a coutrol.
DefaultMinimumSize Gets the length and height, iI1 pixels, that is specified as the
default nriuimwn size of a control.
DefaultPadding Gets the internal spacing, in pixels, of tl1e co11tents of a co11trol.
DefaultSize Gets the default size of the control.
DesignMode Gets a value that indicates whether the Component is currently in
design mode.
DisplayRectangle Gets the recta11gle tl1at represents the virtual display area of the
control.
PowerShell Studio - Reference Guide I 435

Disposing Gets a value indicating whether the base Control class js in the
process of disposing.
Dock Gets or sets which control borders are docked to its parent
control and determines how a co11trol is resized ,;vitl1 its parent.
DockPadding This API supports the product infrastnicture and is not intended
to be used directly from your code. Gets the dock padding
settings for all edges of the UpDownBase control.
DoubleBuffered Gets or sets a value indicating whether this control should redraw
its surface using a secondary buffer to reduce or prevent flicker.
Enabled Gets or sets a value indicating whether the control can respond to
user interaction.
Events Gets tl1e list of event handlers tliat are attached to this
Compo neut.
Focused Gets a value indicating whether the control has input focus.
Font Gets or sets the font of the te;x.'t displayed by the control.
FontHeight Gets o:r sets the height of the font of the control.
ForeColor Gets or sets the foreground color of the spit1 box (also known as
an up-down control).
Handle Gets the windo"v handle that the control is bo1u1d to.
Has Children Gets a value indicating whether the control contains one or more
child controls.
Height Gets or sets the height of the control.
Hexadecimal Gets or sets a value indicating \vhether the spin box (also known
as an up-down control) should display the value it contains in
hexadecin1al fonnat.
Ho rizontaJScroU Gets the characteristics associated 'ith tl1e ho1izontal scroll bar.
HScroll Gets or sets a value indicating ,;vhether the horizontal scroll bar is
visible.
ImeMode Gets or sets the Input Method Editor (Thtffi) mode of the control
I:mcModeBase Gets or sets the IME niode of a control.
Increment Gets or sets the value to increment or decrement tl1e spin box
(also known as an up-do,~11 control) when the up or down bl1ttons
are clicked.
InterceptArrowKeys Gets or sets a value indicating '\-Vhether the user can use the UP
ARROW and DOWN ARROW keys to select values.
InvokcRequired Gets a value indicating whether the caller must call an invoke
method whe111naking 1nethod calls to tl1e co11tTol because the
caller is on a different thread than the one the control was created
on.
IsAccessible Gets or sets a value indicating ,;vhether the control is visible to
accessibility applicatio11s.
IsDisposed Gets a value indicating whether the control has bee11 disposed of.
IsHandleCreated Gets a value indicating wl1ether the control has a handle
associated with it.
IsMirrored Gets a value indicating whether the control is 1nirrored.
436 I PowerShell Studio - A Comprehensive Guide

LayoutEngine Gets a cached instance of the control's layout engine.


Left Gets or sets the distru.1ce, in pixels, between the left edge of the
control and the left edge of its container's client area
Location Gets or sets the coordinates of the upper-left coiner of the control
reJative to the upper-left con1er of its container.
Margin Gets or sets the space between controls.
Ma..runum Gets or sets the maximmn value for the spin box (also kno"\ivn as
an up-down control).
MaximumSize Gets or sets the ma'Ximum size of the spin box (also .kJ.10,vn as an
up-do,:vn control).
M ..
1n1mum Gets or sets the mini1ntun allo,;ved value for the spin box (also
known as a11 up-down control).
MinimumSize Gets or sets the minimum size of the spin box (also kno"\ivn as an
up-do,:vn control).
Name Gets or sets the nan1e of the control.
Padding This API supports the product infrastructure and is not intended
to be used directly from your code. Gets or sets the space
between the edges of a NumericUpDown control and its contents.
Parent Gets or sets the parent container of the control.
Pare.o tForm Gets the fo1m that the container control is assigned to.
PreferredHeigbt Gets the height of the spin box (also kno'm as an up-do\vn
control).
PreferredSize Gets the size of a rectangular area into which the control can fit.
ProductName Gets the prodtict naine of the assembly containing the co11trol.
ProductVersion Gets the version of the assembly co11tailtlng the control.
Read Only Gets or sets a value indicating whether the text can be chru.1ged
by the use of the up or do'n buttons only.
RecreatingHandJe Gets a value indicating whether the control is cmTently re-
creating its handle.
Region Gets or sets the window region associated 'vith tl1e control.
ReoderRigbtToLeft Obsolete. This property is no"v obsolete.
ResizeRedraw Gets or sets a value indicating ' vhetl1er the control redraws itself
whe11 resized.
Right Gets the distance, in pixels, between tl1e right edge of the control
and the left edge of its container's client area.
RightToLeft Gets or sets a value indicating 'vhetl1er control's ele1nents are
aligned to Sltpport locales usi11g right-to-left fonts.
ScaJeChildreo Gets a value tl1at deter1nines the scaling of child controls.
Sho\v FocusCues Gets a value indicating "vhether the control should display focus
rectru.1gles.
ShowKeyboardCues Gets a value indicating whether the user iI1terface is in the
approp1iate state to show or ltlde keyboard accelerators.
Site Gets or sets the site of the control.
Size Gets or sets the height and '\-Vidth of the control.
PowerShell Studio - Reference Guide I 437

Tab Index Gets or sets the tab order of the control witltin its container.
Tab Stop Gets or sets a value indicating whether the user can give the
focus to this control using the TAB key.
Tag Gets or sets the object that contains data about the control.
Text This API supports the product infrastructure and is not intended
to be used directly fron1 your code. Gets or sets the text to be
displayed in the NwnericUpDown control.(Overrides
UpDownBase.Text.)
TextAlign Gets or sets the alignment of the text in the spin box (also knovvn
as an up-down control).
TbonsandsSe11arator Gets or sets a val11e indicating vvhether a thousands separator is
displayed in the spin box (also knov.in as an up-do,vn control)
~;vhen appropriate.
TO)l Gets or sets the distance, in pixels, betvveen the top edge of the
control and the top edge of its container's client area.
TopLeveJControl Gets the parent control that is not parented by another Windo,;vs
F onns control. Typically, this is the outennost Fonn that the
co11trol is contained in.
UpDownAlign Gets or sets the aligrunent of the up and down buttons on the spin
box (also kno\vn as an up-down control).
UserEdit Gets or sets a value indicating whether a value has been ei1tered
by the user.
UseW aitCu rso r Gets or sets a value indicating whether to use the wait cursor for
the current control and all child controls.
Value Gets or sets the value assigned to the spi11 box (also knovvn as an
up-down control).
VerticalSci-oll Gets the characteristics associated \Vith the vertical scroll bar.
Visible Gets or sets a value indicating \vhether the control and all its
cllild controls are displayed.
VScroll Gets or sets a value indicating \vhether the vertical scroll bar is
visible.
Width Gets or sets the width of the control
Window Target This API supports the product infrastn1cture and is not intended
to be used directly from your code. This property is not relevant
for this class.

OPENFILEDIALOG

AutoUpgradeEnabled Gets or sets a value indicating 'vhether tllis FileDialog instance should
automatically upgrade appearance and behavior when running on Windows
Vista and above.
CbeckFileExists Gets or sets a value indicating whether the dialog box displays a warning if
the user specifies a file name that does not exist. (Overrides
FileDialog.CheckFileExists.)
438 I PowerShell Studio - A Comprehensive Guide

I
I

CheckP athExists Gets or sets a value indicating whether the dialog box displays a warning if
the user specifies a path that does not exist. (Inherited fro1n FileDialog.)
Container Gets the !Container that contains the Component. (lnhe1ited fro111
Component.)
CustomPlaces Gets the custom places collection for this FileDialog instance. (Inherited
from FileDialog.)
DefaultExt Gets or sets the defa1Llt file na1ne e>..1ension. (111.herited from FileDialog.)
DereferenccLinks Gets or sets a value indicating whet11er the dialog box retil1rns the location of
the file referenced by the shortcut or \hether it returns the location of the
shortcut (. lnk). (Inl1erited fro1nFileDialog.)
FileNaine Gets or sets a string contai1ung the file name selected in the file dialog box.
(Inherited fro111FileDialog.)
FileNames Gets the file nan1es of all selected files in the dialog box. (Inherited fro1n
FileDialog.)
Filter Gets or sets the current file i1ame filter st1i ng, wluch detemlines the choices
that appear in t11e "Save as file type" or "Files of type" box in tl1e dialog box.
(hlherited fro1n FileDialog.)
FilterIndex Gets or sets the index of the filter currently selected in the file dialog box.
(Inherited from FileDialog.)
InitialDirectorv

Gets or sets t11e initial directory displayed by the file dialog box. (Inl1erited
fro1n FileDialog.)
Mu ltiselect Gets or sets a value indicating whether the dialog box allows inultiple files
to be selected.
Read OnlyChccked Gets or sets a value indicating whether the read-only check box is selected.
RestoreDirectory Gets or sets a value indicating whether the dialog box restores the directory
to tl1e previously selected directo1y before closing. (Inherited fro1n
FileDialog.)
SafeFileN ame Gets the file name and extension for the file selected in the dialog box. The
file name does not include the path.
SafeFileN aines Gets an array of file names and eA1ensions for all the selected files in the
dialog box. The file names do not include the path.
ShowHelp Gets or sets a value indicating whether the Help button is displayed in the
file dialog box. (l1lherited fro1n FileDialog.)
SholvReadOnly
Gets or sets a value indicating whether the dialog box contains a read-only
check box.
Site Gets or sets the !Site of the Component. (In11erited fro1n Component.)
Sup portMultiDottedExtensions Gets or sets whether the dialog box supports displaying and saving files that
have inultiple file name eA1ensions. (Inherited from FileDialog.)
Tag Gets or sets an object that contains data about the control. (Inl1erited from
Co mn10 nD ialo g.)
Title Gets or sets the file dialog box title. (Inherited fromFileDialog.)
ValidateNaines Gets or sets a value indicating whetl1er the dialog box accepts 01tly valid
Win32 file names. (Inhe1ited fro1n FileDialog.)

PANEL
PowerShell Studio - Reference Guide. I 439

r '
ActualHeight Gets the rendered height of this element.
ActualWidth Gets the rendered 'vidth of this eleme11t.
AllowDrop Gets or sets a value indicating '1vhether this element can be lISed as the
target of a drag-and-drop operation. This is a dependency property.
AreAnyTouchesCaptured Gets a value that indicates whether at least one tot1cl1 is capttued to this
element.
AreAnyTouchesCapturedWitbin Gets a value that indicates whether at least one touch is captured to this
elen1ent or to any child ele1nents in its visual tree.
AreAnyTouchesDirectlyOver Gets a value that indicates whether at least one touch is pressed over
this ele1nent.
AreAnyTouchesOver Gets a value that indicates whether at least one touch is pressed over
this element or any child elements in its visual tree.
Bacl<grouncl Gets or sets a Brush that is used to fill the area between tlle borders of
a Panel.
BindingGroup Gets or sets the BindingGroup that is used for the ele1nent.
BitmapEffect Obsolete.Gets or sets a bitmap effect that applies directly to tl1e
rendered content for this elen1ent. Th.is is a dependency property .
BitmapEffectlnput Obsolete. Gets or sets an input sotrrce for the bitmap effect that applies
directly to the rendered content for this ele1nent. This is a dependency
property.
CacheMode Gets or sets a cached representation of the UIElement.
Children Gets a UIEle1nentCollection of child ele1nents of this Panel.
Clip Gets or sets the geo1netJy used to define the outline of the contents of
an element. This is a dependency property.
Cli11T0Bounds Gets or sets a value indicating whether to clip the content of this
element (or content coining from the child ele1nents of this element) to
fit into the size of the contaiiring element. This is a dependency
property.
Command Bindings Gets a collection of Conm1a11d.Binding objects associated \Vitl1 tl1is
element. A Con1111and.Binding enables connnand handling for this
ele111ent, and declares tbe linkage between a cormnand its events, and
the ha11dlers attached by tllis element.
ContextMenu Gets or sets tbe context menu element that should appear whenever the
context iuenu is requested tlrrough user interface (Ul) fro1n within tllis
element.
Cursor Gets or sets the cursor that displays when the mouse pointer is over
tllis elen1ent.
DataConte:\'t Gets or sets the data conte>..1 for an elen1ent when it participates in data
binding.
DefaultStyleKey Gets or sets t11e key to use to reference t11e style for tllis control, when
theme styles are used or defined.
DependencyObjectType Gets the DependencyObjectType that '1vraps the CLR type of tllis
instai1ce. (Inherited from DependencyObject.)
DesiredSize Gets the size that this element computed during the measure pass of
the layou~rocess.
Dis11atcher Gets the Dispatcher this DispatcberObject is associated with. (Inherited
from DispatcherObject.)
440 I PowerShell Studio - A Comprehensive Guide


Effect Gets or sets the bitmap effect to apply to the UIEJement. This is a
dependency property.
FlowDirection Gets or sets the direction that text ru1d other user interface CUD
elements flo'v "vithin any parent element that controls their layout.
Focusable Gets or sets a value that indicates whether U1e elen1ent can recei e
focus. This is a dependency prope1ty.
FocusVisuaJStyle

Gets or sets a property that enables custonuzation of appearru1ce.
effects. or other sly le characteristics that \Vill apply to this ele1nent
when it capllrres keyboard focus.
ForceCursor Gets or sets a value that indicates "'' hether this Fra1ne\vork.Elen1ent
should force the user interface (UI) to render the cursor as declared by
the Cursor properly.
HasAnim atedP ro11erties Gets a value indicating \hether this elen1ent has any anilnated
properties.
HasEffectiveKevboardFocu

s Gets a value that indicates \:vhether the UIElen1ent has focus.
HasLogicaJOrien tation Gets a value that indicates \vhether this Panel arranges its descendants
in a single di1nension.
HasLogical01ientationPublic Gets a value that indicates \Vhether this Pa11el arranges its descendants
in a single dllnension.
Height Gets or sets the suggested height of the elc1nent.
HorizontalAlignment Gets or sets the 11orizontal alignment characteristics applied to this
ele1nent ' vhen it is composed \vithin a parent element. such as a panel
or ite1ns co11trol.
lnheritanceBehavior Gets or sets the scope li1nits for property value iI1heritance. resource
key lookup, and RelativeSource FindAncestor lookup.
lnputBindings Gets the collection of input bi11dings associated '"ith this element.
In11utScope Gets or sets tl1e context for input used by this Fr3111e\vorkElement.
lntemaJChildren Gets a UIElementCollection of child ele1nents.
lsArrangeValid Gets a value indicating vYhether the computed size and position of
child ele1nents in tlris element's layout are valid.
lsEnabled Gets or sets a value indicating vvhether this element is enabled in the
user interface (Ul). This is a dependency property.
IsEnabledCore Gets a value that becomes the return value of lsEnabled in derived
classes.
IsFocused Gets a value that detemlines \Vhether this element has logical focus .
This is a dependency property.
IsHitTestVisible Gets or sets a value that declares \vheU1er this ele1nent can possibly be
returned as a hit test result from some portion of its rendered content.
This is a dependency property.
lslnitialized Gets a value that indicates \vhether this element has been initialized,
either during processing by a XAML processor, or by explicitly having
its Endinit method called.
lslnputMethodEnabled Gets a value indicating v-Ybether an input n1ethod system~ such as an
Input Method Editor (IlvfE) is enabled for processing the input to this
element.
lsItem sHost Gets or sets a value that indlcates that this Panel is a container for user
interface (Ul) ite1ns that are generated by an Ite1nsControl.
PowerShe ll Studio - Refere nce Guide. I 441

IsKeyboardFocused '
Gets a value indicating whether this element has keyboard focus. This
is a dependency property.
IsKeyboardFocusWithin

Gets a value indicating whether keyboard focus is anywhere \Vithin the
element or its visual tree child elen1ents. This is a dependency
property.
IsLoaded Gets a value that indicates wl1ether this element has been loaded for
presentation.
IsManipulationEnabled Gets or sets a value that indicates whether manipulation events are
enabled on this UIElement.
IsMeasu reValid Gets a value indicating whether the current size returned by layout
measure is valid.
lsMouseC aptured Gets a value indicating ,;vhether the inouse is captured to this elen1e11t.
This is a depende11cy property.
IsMouseC aptu reWithin Gets a value that detennines wl1ether mouse capture is held by this
element or by child elements in its visual tree. This is a dependency
property.
IsMouseDirectlyOver Gets a value that indicates \vhether the position of the inouse pointer
corresponds to hit test results, \.Vhich take ele1nent compositing into
account. This is a dependency property.
l sMouseOver Gets a value indicating whether the 1nouse pointer is located over this
element (including child elements in the visual tree). This is a
dependency property.
IsSealed Gets a value that indicates whether this instance is currently sealed
(read-only).(lnherited fro1n DependencyObject.)
IsStylusCaptured Gets a value indicating whether the stylus is captured by this ele1nent.
This is a dependency property .
IsStylusCaptureWithin Gets a value that detennines whether stylus capture is held by this
elen1ent, or an ele1nent within the ele1nent bounds and its visual tree.
This is a dependency property.
lsStylusDirectlyOver Gets a value that indicates whether the stylus position co1responds to
hit test results, which take ele1nent co1npositing into account. This is a
dependency property.
IsStylusOver Gets a value indicating whether the stylus cursor is located over tllis
element (including visual child elements). This is a depende11cy
property.
IsVisible Gets a value indicating whether this element is visible in the user
interface (Ul). This is a dependency property.
La.oguage Gets or sets localization/globalization language information that
applies to an element.
LayoutTra.osfo rm Gets or sets a graphics transformation that sl1ould apply to this element
when layout is performed.
LogicalChildren Gets an entlIDerator that cm1 iterate the logical child elements of tllis
Panel element. (Overrides Frame,;vorkEleme11t.Lo gicalChildren.)
LogicalOrientation The Orientation of the panel if tl1e pm1el supports layout in only a
si11gle dimension.
LogicaJOrientationPublic The Orie11tatio11 of the panel, if the panel supports layout in only a
single dimension.
Margi.o Gets or sets the outer niargiI1 of an element.
442 I PowerShell Studio - A Comprehensive Guide

Max Height
Gets or sets tbe maximum height constraint of the element.
MaxWidth Gets or sets the maximum width constraint of tl1e element.
MinHeight Gets or sets the mini mum height co11straint of the element.
MinWidth Gets OT sets the 1ninimum ,;vidth constraint of the element.
Name Gets or sets the identifying naine of tl1e element. The ruune provides a
reference so tl1at code-behin~ such as event handler code, ca11 refer to
a n1arkup ele1nent after it is constructed during processing by a XAML
processor.
Opacity Gets or sets the opacity factor applied to the entire UIEle111ent when it
is rendered in the user interface (UI). Tllis is a dependency property.
OpacityMask Gets or sets an opacity uiask, as a B1ush implementation that is applied
to any alpha-cllal1Ilel maskil1g for the rendered content of this element.
This is a dependency property.
OverridesDefaultStyle Gets or sets a value that indicates vvhether tllis elen1ent incorporates
style properties fro111 theme styles.
Parent Gets the logical parent ele1nent of this ele1nent.
Persistld Obsolete.Gets a value that uniquely identifies this element.
RendcrSize Gets (or sets, but see Remarks) the final render size of tllis element.
Ren.derTransform Gets or sets trai1sform information that affects tl1e rendering position of
this element. Tllis is a dependency property.
RenderTransformOrigin Gets or sets the center point of any possible render trai1sfor1n declared
by RenderTransforni, relative to the bounds of the element. This is a
dependency property.
Resources Gets or sets the locally-defined resource dictionary.
SnapsToDevicePi'tels Gets or sets a valtte that detennines whetl1er rendering for tllis element
should use device-specific pixel settings dming rendering. This is a
dependency property.
Style Gets OT sets the style used by tllis ele1nent when it is rendered.
StylusPlu gins Gets a collection of all stylus plug-in (customizatio11) objects
associated with this element.
Tag Gets or sets au arbitrary object value that cai1 be used to store custo1n
infomiation about this element.
Tero platedParent Gets a reference to the template parent of this ele1neut. Tllis property is
not releva11t if the elen1ent ,;vas not created through a te1nplate.
ToolTiJ.> Gets or sets the tool-tip object that is displayed for tllis element in the
user interface (UI).
TouchesCaptured Gets all toucl1 devices tliat are captured to this ele1nent.
TouchesCa1>turedWitbin Gets all touch devices that are captured to this element or any child
elements in its visual tree.
Tou chesD irectlyOver

Gets all touch devices tliat are over this element.
ToucbesOver Gets all to11ch devices that are over this element or any child elements
in its visual tree.
Triggers Gets the collection of triggers established directly on this element, or
in child elen1ents.
PowerShell Studio - Reference Guide I 443

Uid Gets or sets the unique identifier (for localization) for this element.
This is a dependency property.
UseLayoutRou.ncling Gets or sets a value that indicates 'vhether layout rounding should be
applied to this element's size and position during layout.
VerticalAlignment Gets or sets the vertical alignment characteristics applied to this
element when it is composed within a parent element such as a panel
or items control.
Visibility Gets or sets the user interface (Ul) visibility of this element. This is a
dependency property.
Visu alBitmapEffect Obsolete.Gets or sets the BitmapEffect value for the Visual.
Visu alBitm apEffectln put Obsolete.Gets or sets the BitmapEffectlnput value for the Visual.
VisuaIBitmapScalingMode Gets or sets tl1e BittnapScalingMode for the Visual.
VisualCacheMode Gets or sets a cached representation of the Visual.
VisualChildrenCount Gets the number of child Visual objects in this instance of
Panel. (Overrides Framework.Element. VisualChildrenCount.)
Visu alClearTypeHint Gets or sets the ClearTypeHint that determines bo'v ClearType is
rendered in the Visual.
VisuaJCliJ> Gets or sets the clip region of the Visual as a Geometry value.
VisualEdgeMode Gets or sets the edge inode of the Visual as a11 EdgeMode value.
VisualEffect Gets or sets the bitmap effect to apply to the Visual.
VisualOffset Gets or sets the offset value of the visual object.
VisualOpacity Gets or sets the opacity of the Visual.
VisualOpacityMask Gets or sets the Bn1sh value that represents the opacity mask of the
Visual.
VisualParent Gets the visual tree parent of the visual object.
VisuaJScrollableAreaClip Gets or sets a clipped scrollable area for the Visual.
Viso alTextHintingMode Gets or sets the TextHintingMode of the Visual
VisualTextRenderingMode Gets or sets the TextRenderingMode of the Visual.
Visu alTransfo rm Gets or sets the Transfor1n value for tl1e Visual.
VisualXSnappingGuidelines Gets or sets the x-coordinate (vertical) guideline collection.
VisuaJYSnappingGuidelines Gets or sets the y-coordiJIBte (horizontal) guideline collectio11.
Width Gets or sets the width of the elen1ent.

PICTUREBOX

PROPERTY DESCRIPTION
AccessibilityO b ject Gets the AccessibleObject assigned to the control.
AccessibleDefaultActionDescri 11tion Gets or sets tl1e default action descriptio11 of the
control for use by accessibility client applications.
444 I PowerShell Studio - A Comprehensive Guide

Accessi bleDescription Gets or sets the description of the control used by


accessibility client aE_plications.
Accessi bleN ame Gets or sets the name of the control used by
accessibility client applications.
Accessible:R..ole Gets or sets the accessible role of the control
Allo'\vDrop This API supports the product infrastructure and is not
intended to be used directly from your code.
Overrides the Control.AllowDrop property .(Overrides
Control.AllowDrop.)
Anchor Gets or sets the edges of the container to which a
control is bound and deter1nines how a control is
resized ,;vith its parent.
AutoScroUOtl'set Gets or sets vvhere this control is scrolled to in
ScrollControllnto Vie,;v.
Auto Size This API supports the product infrastn1cture and is not
intended to be used directly from your code. This
property is 11ot relevai1t for this class.
BackColor Gets or sets the background color for the co11trol.
Backgrou_ndlmage Gets or sets the background ilnage displayed in the
control.
Bacl{groundlmageLayout Gets or sets the background iniage layout as defined
in the ImageLayout enumeration.
BindingContext Gets or sets the BindingContext for the control.
BorderStyle

Ind1cates tl1e border style for tl1e control.
Bottom Gets the distance, in pixels, between t11e bottom edge
of the control and the top edge of its container's client
area.
Bouods Gets or sets the size a11d location of the control
including its nonclient elements, in pixels, relative to
the parent control.
CanEnablelme Gets a value indicating whether the ImeMode
property ca11 be set to an active value, to enable IlME
support.
CanFocus Gets a value indicating whether the control ca11
receive focus .
CanR.aiseEvents Determines if events can be raised on the control.
Can Select Gets a value indicating vvhether the control can be
selected.
Capture Gets or sets a value indicating whether the control has
captured the n1ouse.
CausesValidation This API supports the product infrastl11cture ai1d is not
intended to be used directly from your code.
Overrides the Co11trol. Causes Validation property.
ClientRectangle Gets the rectangle iliat represents the client area of the
control.
ClientSize Gets or sets the height and width of tl1e clie11t area of
the control.
CompanyName Gets the name of the co1npany or creator of the
application containing the control.
PowerShe ll Studio - Refere nce Guide I 445

Container Gets the !Container that contains the Component.


ContainsFocus Gets a value indicating ,;vl1ether the control, or one of
its child controls, currently has the input focus.
ContextMenu Gets or sets the shortcut menu associated with the
control.
ContextMenuStrip Gets or sets the ContextMenuStrip associated with
this control.
Controls Gets the collection of controls contaiI1ed within tl1e
control.
Created Gets a value indicating ,;vhether the control has been
created.
CreateParams This API st1pports the product infrastructure and is 11ot
intended to be used directly from yo tu code.
Overrides the Control.CreateParams
property .(Overrides Control. CreateParams.)
Cursor Gets or sets the cursor that is displayed when the
mouse pointer is over the control.
DataBindings Gets the data bindings for the control.
Defau ltCu rsor Gets or sets the default cursor for tl1e control.
DefaultlmeMode Gets a value indicating the mode for Input Method
Editor (Th1E) for the PictureBox.(Overrides
Control.Defaultl1neMode.)
DefaultMargin Gets the space, in pix.els, that is specified by default
bet\veen controls.
Defau ltMaximumSize Gets the length and height, in pixels, that is specified
as the default n1axi1nUin size of a control.
DefaultMinimumSize Gets the length and height, in pi,~e ls, that is specified
as tl1e default mini1num size of a control.
DefaultPadding Gets the internal spacing, in pixels, of the contents of
a control.
DefaultSize Gets the default size of the control. (Overrides
Control.DefaultSize.)
Design.Mode Gets a value that indicates ,;vhether the Co1uponent is
c11rrently in design n1ode.
DisplayRectangle Gets the rectangle that represe11ts tl1e display area of
the controI.
Disposing Gets a value indicati11g whether tl1e base Control class
is .i n the process of disposing.
Dock Gets or sets '\-Vhicl1 control borders aJe docked to its
parent control and determines 11ow a control is resized
with its parent
DoubleBoffered Gets or sets a value indicating \hether tllis control
should redraw its surface using a secondary buffer to
reduce or prevent flicker.
Enabled Gets or sets a value indicating,vl1ether the control can
respond to user interaction.
Er1orlmage Gets or sets the image to display when an e1Tor occurs
dUiing the image-loading process or if the iluage load
is canceled.
446 I PowerShell Studio - A Comprehensive Guide

Events Gets the list of event handlers that are attached to this
Component.
Focused Gets a value il1dicating 'vhetl1er the control has input
focus.
Font This API supports the product infrastn1ct11re and is not
intended to be used directly from your code. Gets or
sets the font of the te>..'t displayed by the
control.(Overrides Control.Font.)
FontHeight Gets or sets the height of the font of the control
ForeColor This API supports the product infrastn1chrre and is not
intended to be used directly from your code.
Overrides tl1e Control.ForeColor property.(Ove1rides
Control.ForeColor.)
Handle Gets the window handle that the co11trol is bound to.
Has Children Gets a value indicating 'vhether the control contains
one or 1nore child controls.
Height Gets or sets the height of the control.
Image Gets or sets the image that is displayed by PictureBox.
lmageLocation Gets or sets tl1e path or URL for the image to display
in the PictureBox.
lmeMode Gets or sets the Input Metl1od Editor(IME) 1node
supported by this control.
ImeModeBase Gets or sets the Ilv1E nlode of a control.
lnitiallm.age Gets or sets tl1e image displayed in the PictureBox
control when the main image is loading.
Invo.k eRequired Gets a value indicating whether the caller inust call an
invoke n1ethod when making 1netl1od calls to the
control because the caller is on a different thread tba11
the one tl1e control ,;vas created on.
IsAccessible Gets or sets a value il1dicating whether the control is
visible to accessibility applications.
IsDisposed Gets a value indicating vvhether the control has been
disposed of.
lsHandleCreated Gets a value indicating whether the control has a
handle associated vvitl1 it.
IsMirrored Gets a value indicating whether the control is
nrirrored.
LayoutEngine Gets a cached instance of the control's layollt engine.
Left Gets or sets the distance, in pixels, between tl1e left
edge of the control and the left edge of its container's
client area.
Location Gets or sets the coordinates of the tipper-left comer of
the control relative to the upper-left comer of its
contai11er.
Margin Gets or sets the space ben.veen controls.
Ma'timumSize Gets or sets the size that is the upper limit that
GetPreferredSize can specify.
PowerShell Studio - Reference Guide I 447

MinimumSize Gets or sets the size that is the lo,ver limit that
GetPreferredSize can specify.
Name Gets or sets the name of the control.
Padding Gets or sets padding within the control.
Parent Gets or sets the parent contaiJ.1er of the control.
PreferredSize Gets the size of a rectangular area into vvhich the
control can fit.
ProductName Gets the product name of the assembly containing the
control.
ProductVersion Gets the version of the assembly containing the
control.
RecreatingHandle Gets a value indicating \;vhether the co11trol is
currently re-creating its handle.
Region Gets or sets tl1e window region associated wit11 the
control.
RenclerRigbtToLeft Obsolete.This property is now obsolete.
ResizeRed ra'v Gets or sets a value indicating "vhether the control
redraws itself \he11 resized.
Right Gets the distance, in pixels, beti;veen the right edge of
the control and the left edge of its container's client
area.
RightToLeft This API supports the product infrastruct1ue and is not
intended to be used directly fron1 your code. Gets or
sets a value indicating whether control's elements are
aligned to support locales usiJ.1g right-to-left
languages.(Ovenides Control.RightToLeft.)
ScaleChildren Gets a value that detenuines tl1e scaling of child
controls.
ShowFocusCues Gets a value indicating \;vhether the control shottld
display focus rectangles.
SholvKeyboardCues Gets a value indicating \ hethe.r the user iJ.1terface is in
the appropriate state to show or hide keyboard
accelerators.
Site Gets or sets the site of the control.
Size Gets or sets tl1e height a11d width of the control.
SizeMocle Indicates how the iniage is displayed.
TabIndex This API supports the product infrastructure and is not
it1tended to be used directly from your code. Gets or
sets the tab index value.
TabStop This API supports the product infrastructtue and is not
i11tended to be used directly from your code. Gets or
sets a value that indicates "vhether the user can give
the focus to this control by using the TAB key.
Tag Gets or sets the object that contaillS data about the
control.
Text This API supports the product infrastructt1re and is not
intended to be used direc~y from your code. Gets or
448 I PowerShell Studio - A Comprehensive Guide

sets the text of the PictureBox. (Overrides


Control. Text.)
Top Gets or sets the distaI1ce, in pixels, between the top
edge of the control and the top edge of its container's
client area.
TopLeveLControl Gets the parent control that is not parented by another
Windows Forms control. Typically, this is the
outermost Form that the control is co11tained in
UseW aitCursor Gets or sets a value indicating 'vhether to use the ' vait
cursor for the current control and all child controls.
Visible Gets or sets a value indicating vvhether the control and
all its child controls are displayed.
WaitOnLoad Gets or sets a value indicating whether an image is
loaded synchronously.
Width Gets or sets the widtl1 of the control.
Win.do,vTarget This API supports the product infTastruct1rre and is not
intended to be used directly fro1nyour code. This
property is not relevant for tlris class.

PROGRESSBAR AND PROGRESSBAROVERLA Y

AccessibilityObject
Gets the AccessibleObject assigned to the control.
AccessibleDefaultActionDescriptiou Gets or sets the default action description of the control for use by
accessibility client applications.
AccessibleDescri11tion Gets or sets the description of the control used by accessibility
client applications.
AccessibleName Gets or sets the nan1e of the control used by accessibility client
~plications.
AccessibleRole Gets or sets the accessible role of the control
AllowDrop This API supports the product infrastructure and is not intended to
be tlSed directly from your code. Gets or sets a value indicating
whether the conuol can accept data that the user drags onto
it.(Overrides Control.AllowDrop.)
Anchor Gets or sets the edges of the container to wllicl1 a control is bound
and detennines how a control is resized \Vith its parent.
AutoScrollOfl'set Gets or sets \.V here tills co11trol is scrolled to in
ScrollControllntoView.
Auto Size This API supports the product illfrastructure and is not intended to
be used directly fro1n your code. Tllis property is not relevai1t for
this class.
Bacl<.Color Gets or sets the background color for the control.
Backgroundlmage This API supports the product infrastructure and is not intended to
be used directly from your code. Gets or sets the background
ilnage for the ProgressBar control.(Overrides
Co11trol.Backgrou11dlmage.)
PowerShell Studio - Reference Guide I 449

BackgroundlmageLayou t This API supports the product infrastructure and is not intended to
be used directly from your code. Gets or sets the layout of the
background image of the progress bar.(Overri,des
Control.Backgroundl.lnageLayout.)
Bin din.g Contcxt Gets or sets the BindingContext for the control.
Bottom Gets the distance, in pixels. benveen U1e bottom edge of the
control and the top edge of its container's client area.
Bounds Gets or sets the size and location of the control including its
nonclient ele1nents, in pi.xels, relative to tl1e p arent control.
CanEnabJelme Gets a value indicating \vhether the ImeMode property can be set
to an active value. to enable 1ME support.
CanFocus Gets a value indicating whether the control can receive focus.
CanRaiscEvents Detem1ines if events can be raised on the control.
CanSelect Gets a value indicati11g whether the control can be selected.
Capture Gets or sets a value indicating ,,hether the control has captured
the tnouse.
CausesVaJidation This API supports the product infrastructure and is not intended to
be used directly from yotir code. Gets or sets a value indicating
\vhether U1e control. \iv hen it receives focus, causes validation to be
perfonned on ai1y co11trols that require validation.
ClientRectan gle Gets tlle rectangle that represents the client area of t11e control.
ClientSize Gets or sets the height and \.vidtl1 of the client area of U1e control.
CompanyN ame Gets the na1ne of the company or creator of the application
contai11ing U1e control.
Container Gets the IContainer that contains the Coniponent.
ContainsFocus Gets a value indicating whether the control or one of its child
controls. currently has the i11put focus.
ContextMenu Gets or sets the shortet1t menu associated v.Ti.th the control.
ContextMenuStrip Gets or sets the ContextMenuStrip associated \Vith lltls control.
Controls Gets the collection of controls contained \vithin the control.
Created Gets a value iL1dicating whether the control has been created.
CreateParams This APT supports the product infrastructure and is not intended to
be used directly from your code. Overrides
Control.CreateParan1s.(Overrides Co11trol.CreateParat11S.)
Cursor Gets or sets the cursor that is disp layed when t he 111ouse pointer is
over the control.
DataBindings Gets the data bindings for the control.
Defau ltCu r so r Gets or sets the default cursor for the control.
DefaultlmeMode Gets the default Input Method Editor (IME) mode supported by
the control.(Overrides Control.DefaultlmeMode.)
DefaultMargin Gets the space. in pi"\'.els, that is specified by default bet\veen
controls.
Defau ltMaximumSize Gets the length and height in pixels, that is specified as U1e default
maximum size of a control.
Defau It Mini 1nu m Size Gets the length and height, in pixels, U1at is specified as the default
1ninimum size of a control.
Defau ltPadding Gets the internal spacing, in pixels, of the contents of a control.
DefaultSize Gets tlle default size of the control.(Overrides
Co ntro l.DefaultSize.)
450 I PowerShe ll St ud io - A Com prehensive Guide

Design Mode Gets a value that indicates ,,hether the Co1nponent is currently in
design mode.
DisplayRectangle Gets the rectangle that represents the display area of the contTol.
Disposing Gets a value indicating \vhether the base Control class is in the
process of disposing.
Dock Gets or sets ' vhich control borders are docked to its parent control
and determines hovv a control is resized 'ith its parent.
DoubleBuffered Gets or sets a value indicating 'vhether the control should redra\v
its surface using a secondary buffer.(Overrides
Control.DoubleBuffered.)
Enabled Gets or sets a value indicating ';vhether the control can respond to
user interaction.
Events Gets tl1e list of event handlers that are attached to this Component.
Focused Gets a value indicating 'vbether the control bas input focus.
Font This API supports the product infrastructure and is not intended to
be used directly from your code. Gets or sets the font of text in the
ProgressBar.(Overrides Control.Font.)
FontBeigbt Gets or sets the height of the font of the control .
ForeColor Gets or sets the foreground color of the control.
Handle Gets the wil1do'v handle that t11e control is b0Lu1d lo.
HasChildreo Gets a value indicating \Vbetl1er the co11trol contains one or more
cllild controls.
Height Gets or sets the height of the control.
ImcMode This API supports the product infrastructure and is not intended to
be used directly fro1n your code. Gets or sets the i11put method
editor (IME) for the ProgressBar
ImeModeBase Gets or sets the IME mode of a control.
InvokeRequircd Gets a value indicating whether the caller must call an invoke
method \Yhen 1naking method calls to the control because the
caller is on a different thread than the one the control 'vas created
011.
IsAccessible Gets or sets a value indicating whether the control is visible to
accessibility applications.
IsDisposcd Gets a value indicating whether the control has been disposed of.
IsHandleCreated Gets a value indicating \vhether the control has a handle associated
\Vith it.
lsMirrored Gets a value indicating 'vhether tl1e control is nlirrored.
LayoutEngine Gets a cached instance of tl1e control's layout engine.
Left Gets or sets the distance, in pixels, between the left edge of the
control and the left edge of its container's client area.
Location Gets or sets the coordinates of the upper-left corner of the control
relative to the upper-left comer of its container.
Margin Gets or sets the space bet\>veen controls.
MarqueeAnimationSpeed Gets or sets the tin1e period, in milliseconds. that it takes tl1e
progress block to scroll across the progress bar.
Maximum Gets or sets the maximtlill value of the range of the control.
MaximumSi7..e Gets or sets the size tl1at is the upper linlit that GeltPreferredSize
can specify .
Minimum Gets or sets tl1e 1nillimum value of U1e range of the control.
PowerShell Studio- Reference Guide I 451

MinimumSize Gets or sets the size tl1at is the lower linlit that GetPreferredSize
can specify .
Name Gets or sets the name of the control.
Padding This API supports the product infrastructure and is not iluended to
be used directly fron1 your code. Gets or sets the space bet,veen
the edges of a ProgressBar control and its contents.
Parent Gets or sets the parent container of the control.
PreferredSize Gets the size of a rectangular area into which tbe control can fit.
ProductN aine Gets the product name of the assen1bly containing the control.
ProductVersion Gets the version of U1e assembly containing U1e control.
RecreatingHandJe Gets a value indicating \Vhether the control is currently re-creating
its handle.
Region Gets or sets U1e \vindolv region associated with the control.
RenderRightToLeft Obsolete.This property is now obsolete.
ResizeRed ra'v Gets or sets a value indicating whell1er the control redra'\\s itself
\vhen resized.
Right Gets the distance. in pi-xels, bet\veen the right edge of the control
and the left edge of its container's client area.
RigbtToLeft Gets or sets a value indicating \heU1er control's elen1ents are
aligned to Sltpport locales using right-to-left fonts.
RightToLeftLayout Gets or sets a value indicating \Yhether the ProgressBar and auy
text it contains is displayed from right to left.
ScaJeChildren Gets a value that detemunes t11e scaling of cl1ild controls.
Sho''' FocusCues Gets a value indicating \vhether the control should display focus
rectangles.
SholvKeyboard

Cues Gets a value indicating \Vhether the user interface is in the
appropriate state to show or hide keyboard accelerators.
Site Gets or sets the site of the control.
Size Gets or sets the height and \Vidth of the control.
Stc1> Gets or sets the an1ount by \vhich a call to the PerformStep method
increases the current position of the progress lbar.
Stvle
~
Gets or sets the 1Tu1nner in which progress shottld be indicated on
the progress bar.
Tablndex Gets or sets the tab order of the control \vitllin its container.
TabStop This API supports the product infrastructure and is not intended to
be used directly fro1u yotu code. Overrides TabStop.
Tag Gets or sets the object that contains data about the control.
Text Tllis API supports ll1e product infrastructure and is not intended to
be used directly from your code. Gets or sets the text associated
~vith this control.(Overrides Control. TeA1.)
Gets or sets the distance, in pi-xels, between the top edge of the
control and the top edge of its contaiuer's client area.
TopLevelControl Gets the parent control that is not parented by anotl1er Windo,vs
Fonns control. Typically. this is the outermost Form that the
control is contaii1ed in.
UseW aitCursor Gets or sets a value indicating whether to use th.e wait cursor for
the current control a11d all child controls.
Value Gets or sets the current position of the progress bar.
452 I PowerShell Studio - A Comprehensive Guide

Visible Gets or sets a value indicating whether the control and all its child
controls are displayed.
Width Gets or sets the width of the control.
WinctowTarget This API supports the product infrastn1cture and is not intended to
be used directly from your code. This property is not relevant for
this class.

PROPERTY GRID

Accessi bilityO bject Gets tl1e AccessibleObject assigned to the control.


AccessibleDefaultActionDescri1Jtion Gets or sets t11e default actio11 description of th.e control for use
by accessibility client applications.
AccessibleDescription Gets or sets the description of the control used by accessibility
client applications.
AccessibleName Gets or sets the ria111e of the control used by accessibility client
applications.
AccessibleRole Gets or sets the accessible role of the control
ActiveControl Gets or sets the active control on the container control.
AllO"\VDro)l Gets or sets a value indicating vvhether the control can accept
data that the user drags onto it.
Anchor Gets or sets the edges of the container to which a control is
bow1d and detennines how a control is resized vvitl1 its parent.
AutoScaleD imension s Gets or sets the di1ne11sions that tl1e co11trol was designed to.
AutoScaleFacto r Gets the scaliI1g factor between the current and design-ti1ne
auto1natic scaling diinensions.
AutoScaleMode Gets or sets the automatic scaling niode of the control.
AutoScroll This API supports the product infrastructure and is not intended
to be used directly from your code. This property is not relevant
for this class.(Overrides ScrollableC011trol.AutoScroll.)
AutoScrollMargin Gets or sets the size of the auto-scroll margin.
AutoScrollM.inSize Gets or sets the inini1num size of tl1e auto-scroll.
AutoScrollOffset Gets or sets vvhere this control is scrolled to in
ScrollControllntoView.
AutoScrollPosition Gets or sets the location of the auto-scroll position.
Auto Size This API supports the product infrastructure and is not intended
to be used directly from your code. This property is not relevant
for this class.
Au to Validate Gets or sets a value that iI1dicates vvhether controls in iliis
container 'vill be auto11iatically validated when tl1e focus
changes.
BackColor Gets or sets the background color for the control. (Overrides
Control.BackColor.)
PowerShell Studio - Reference Guide I 453

Backgroundlmage Thjs API supports the product infrastructure and is not inte11ded
to be used directly fro111 your code. This property is not relevant
for this class. (Overrides Control.Backgroundlrnage.)
BackgroundlmageLayou t Tlus AP! supports the product infrastructure and is not i.J1tended
to be used directly from your code. This property is not relevant
for this class.(Overrides Control.BackgroundimageLayout.)
BindingContext Gets or sets tl1e BindingConte:\.1 for the control.
Bottom Gets the distance, in pixels, bet\veen the bottom edge of the
control and the top edge of its container's client area.
Bounds Gets or sets the size and location of the control including its
nonclient elements, in pixels, relative to the parent control.
Browsab lcAttributes Gets or sets the bro,vsable attributes associated with the object
that the property grid is attached to.
CanEnablelme Gets a value indicating \vhether the ln1eModie property can be set
lo an active value. to enable IME support.
CanFocus Gets a value indicating ~vbether the control can receive focus .
CanRaiscEvents Determines if events can be raised on the control.
CanSelect Gets a value indicating whether the control can be selected.
CanSholvCommands Gets a value indicating \\rhether tl1e conunands pane can be made
visible for the currently selected objects.
CanShowVisu alStyleGlyJlhs Gets or sets a "Value that indicates whether OS-specific visual
style glyphs are used for the e:\.-pansion nodes in the grid area.
Capture Gets or sets a value indicating \Vhether the control has captured
the rnouse.
CategoryForeColor Gets or sets the te>..'t color used for category headings.
CategoryS1>litterColor Gets or sets the color of the line that separates categories in the
grid area.
CausesVaJidation Gets or sets a value indicating \Vbether the control causes
validation to be perfonned on any controls U1al require validation
when it receives focus.
ClientRectangle Gets the rectangle that represents the client area of the control.
ClientSize Gets or sets the height and ' vidth of the client area of the control.
CommandsActiveLinkColor Gets or sets the color of active Links in the executable conu11a.uds
region.
CommandsBackColor Gets or sets the background color of the hot collllnands region.
CommandsBorderColor Gets or sets the color of the border swTotmding the bol
co1runands region.
CommandsDisabledLinkColor Gets or sets the unavailable link color for tbe executable
con11nands region.
CommandsForeColor Gets or sets the foregrotu1d color for the hot comnuu1ds region.
CommandsLinkColor Gets or sets the link color for the executable comn1ands region.
CommandsVisible Gets a value indicating ' vhether the co1nn1ands pane is visible.
Comm andsVisiblelfAvailable Gets or sets a value indicating '\1 hether the con1rna11ds pane is
visible for objects U1at ex-pose verbs.
454 I PowerShell Studio - A Comprehensive Guide

CompanyN ame Gets the name of the cotnpany or creator of the application
containing the control.
Container Gets the !Container that contains the Co111pone11t.
ContainsFocus Gets a value il1dicatingwhether the control, or one of its child
controls, cmrently bas the input focus.
ContextMenu Gets or sets the shortcut menu associated with the control.
ContextMenuDefaultLocation Gets tl1e default location for the shortcut menu.
ContextMenuStrip Gets or sets the Conte~"Ment1S trip associated with this control.
Controls This API supports the product infrastructure and is not intended
to be used directly from your code. This property is not relevant
for tllis class.
Created Gets a value indicatil1g vvhether the control has been created.
CreateParams Gets the required creation para1neters wl1en the control handle is
created.
CurrentAutoScaleDimensions Gets the current run-time di1nensions of the screen.
Cursor Gets or sets the cursor that is displayed \;vhen the mouse pointer
is over the control.
DataBindings Gets the data bindings for the control.
DefaultCursor Gets or sets the default cursor for the control.
DefaultlmcMode Gets the default Input Method Editor (Thill) mode supported by
the control.
DefaultMargin Gets the space, in pixels, that is specified by default between
controls.
DefaultMaximumSize Gets the length and height. in pixels, that is specified as the
defa1llt maxi1nrun size of a control.
DefaultMinimumSize Gets the length and height, in pixels. that is specified as the
defa1llt minin1mn size of a control.
DefaultPadding Gets the internal spacing, in pixels, of tl1e contents of a control.
DefaultSize Gets the default size of the control.(Overrides
Control.DefaultSize.)
DefaultTa.bType Gets the type of the defa1tlt tab.
DesignMode Gets a value tl1at indicates whether tl1e Co1nponent is currently in
design mode.
DisabledltemForeColo r Gets or sets the foregroru1d color of disabled text in the grid area.
DisplayRectangle Gets the rectangle that represents the virtual display area of the
control.
Disposing Gets a value indicating wl1ether the base Control class is in the
process of disposing.
Dock Gets or sets vvbich control borders are docked to its parent
control and detennil1es how a control is resized with its parent.
DockPadding Gets the dock padding settings for all edges of the control.
DoubleBuffered Gets or sets a value indicating vvhether this control should redraw
its surface using a secondary buffer to reduce or prevent flicker.
Dra,vFJatToolbar Gets or sets a value indicating \hether the PropertyGrid control
paints its toolbarwith flat buttons.
PowerShell Studio - Reference Guide I 455

Enabled Gets or sets a value indicating whether the control can respond to
user interaction.
Events Gets the list of event handlers that are attached to this
Component.
Focused Gets a value indicating whether the control has input focus.
Font Gets or sets the font of the text displayed by the control.
FontHeight Gets or sets the height of the font of the control.
ForeColor This API supports the product infrastn1cture and is not intended
to be used directly from your code. This property is not relevant
for this class.(Overrides Control.ForeColor.)
Handle Gets the window handle that the control is bom1d to.
Has Children Gets a value indicating vvhetber the control contains one or inore
child controls.
Height Gets or sets the height of the control.
Hel1>BackColor Gets or sets the backgrotmd color for the Help region.
HelpBorderColor Gets or sets the color of the border surrounding the description
pane.
Hel1>ForeColor Gets or sets the foreground color for the Help region.
HelpVisible Gets or sets a value indicating \;vhether the Help text is visible.
HorizontalScroll Gets tl1e characteristics associated with tl1e horizontal scroll bar.
HScroll Gets or sets a value indicating \;vhether the horizontal scroll bar is
visible.
lmeMode Gets or sets the Input Method Editor (I.ME) inode of the control.
lmeModeBase Gets or sets the Th1E mode of a control.
lnvokeRequired Gets a value indicating whether the caller n1ust call an ii1voke
met11od vvhen maki.I1g 1nethod calls to tlle control because the
caller is on a different thread than the one the control was created
on.
lsAccessible Gets or sets a value indicating whether tl1e control is visible to
accessibility applications.
IsDisposed Gets a value indicating \Vhether the control has been disposed of.
IsHandleCreatecl Gets a value indicating whether the control has a handle
associated "vith it.
IsMirro reel Gets a value iI1dicating whether the control is ininored.
LargeButtons Gets or sets a value indicating whether b11ttons appear in standard
size or in large size.
LayoutEngi.ne Gets a cached instance of the control's layout e11gine.
Left Gets or sets the distance, in pL'<els between the left edge of the
control and the left edge of its container's client area.
LineColor Gets or sets the color of the gridlines and borders.
Location Gets or sets the coordinates of the upper-left comer of the control
relative to the upper-left corner of its container.
Margin Gets or sets the space between controls.
456 I PowerShell Studio - A Comprehensive Guide

-:.::i::,"IO;

MaximumSize Gets or sets the size that is the upper limit that GetPreferredSize
can specify.
MinimumSize Gets or sets the size that is the lower linut that GetPreferredSize
can specify.
Name Gets or sets the na1ne of the control.
Padding This API supports the product infrastructure and is not intended
to be used directly from your code. This property is not relevant
for this class.
Parent Gets or sets the parent container of the control.
ParentForm Gets the fonn that the container control is assigned to.
PreferredSize Gets the size of a rectangular area into \Nhich the control can fit.
ProductN ame Gets the product name of the assembly containing tl1e control.
ProductVersion Gets the version of the assembly contaitung the control.
Pro11ertySort Gets or sets the type of sorting the Property Grid uses to display
properties.
Prope.r tyTabs Gets the collection of property tabs that are displayed in the grid.
Recreatin gHandle Gets a val11e iJ.1dicating \;vhether the co11trol is currently re-
creating its handle.
Region Gets or sets the windo"v region associated with the control.
RenderRigbtToLeft Obsolete.This property is now obsolete.
ResizeRecl raw Gets or sets a value indicating whether the control redraws itself
vv hen resized.
Right Gets the distance, i11 pixels, between the right edge of the control
and the left edge of its co11taiJ.1er's client area.
RightToLeft Gets or sets a value indicating whether control's elen1ents are
aligned to support locales using right-to-left fonts.
ScaleChildren Gets a value that determines the scaling of child controls.
SelectedGridltem Gets or sets the selected grid item.
SelectedltemWithFocusBackColor Gets or sets the backgrotmd color of selected ite1ns that have tl1e
input focus.
SelectedltemWithFocusForeColor Gets or sets the foreground color of selected items that have tl1e
input f OCUS .
Selected Object Gets or sets the object for which the grid displays properties.
Selected Objects Gets or sets the currently selected objects.
SelectedTab Gets the currently selected propert)' tab.
Show FocusCues Gets a value indicating whether the control sho1tld display focus
rectangles. (Overrides Contra l. ShowFocusCues.)
Show Keyboard Cues Gets a value indicating whether the user interface is in the
appropriate state to sho\ or hide keyboard accelerators.
ShowPro11e11yPagelmage Gets the image tltat represents the property page.
Site Gets or sets the site of the control.(Overrides Control.Site.)
Size Gets or sets the height and vvidth of the control.
SortByCategorylmage Gets the image that represents sorting grid items by category.
PowerShell Studio - Reference Guide I 457

SortByPrope1iylmage Gets the itnage tl1at represents sorting grid items by property
name.
Tablndex Gets or sets the tab order of the control '\>vithin its container.
TahSto11 Gets or sets a value indicating whether the user can give the
focus to this control using the TAB key.
Tag Gets or sets the object tllat contains data about the control.
Text Gets or sets the te:\.1 associated with this control.(Overrides
Control.Text.)
ToolbarVisibl.e Gets or sets a va111e indicating wl1etber the toolbar is visible.
ToolStripRenderer Gets or sets the painting functionality for ToolStrip objects.
Top Gets or sets the distance, in pixels, between the top edge of the
control and the top edge of its container's client area.
To11LevelControl Gets the parent control that is not parented by another Windows
Fonns control. Typically, this is the outermost Form that the
control is contained in.
UseCompatibleTextRendering Gets or sets a value that determines whether to use the Graphics
class (GDI+) or the TeA.1Renderer class (GDI) to rendeT text.
UseWaitCursor Gets or sets a value indicating whether to use the wait cursor for
the current control and all child controls.
VerticalScroll Gets the characteristics associated with the vertical scroll bar.
Vie,vBackColor Gets or sets a value indicating the background color in the grid.
ViewBorderColor Gets or sets the color of the border surrounding the grid area.
Vie\vForeColor Gets or sets a value indicating the color of the text in the grid.
Visible Gets or sets a value indicating whether the control and all its
child controls are displayed.
VScroll Gets or sets a value indicating -vvhether tl1e vertical scroll bar is
visible.
Width Gets or sets the widtl1 of the control.
Window Target This API supports the product infrastructure and is not it1tended
to be used directly fro111 your code. This property is not relevant
for this class.

RADIO BUTTON

PROPERTY DESCRIPTION
AccessibilityO bject Gets the AccessibleObject assigned to the control.
AccessibleDefaultActionDescri11tion Gets or sets the default actio11 description of tl1e
control for use by accessibility client applications.
AccessibleDescription Gets or sets the description of the control used by
accessibility client applications.
.A.ccessible:N"aine Gets or sets the name of the control used by
accessibility client applications.
Accessiblellole Gets or sets the accessible role of t11e control
458 I PowerShell Studio - A Comprehensive Guide

Allow Drop Gets or sets a value indicating vvhether the control can
acce_p t data that the user drags onto it
Anchor Gets or sets the edges of tl1e co11tainer to which a
control is botmd and detennines ho'i\7 a control is
resized ,;vith its parent.
A]Jpearance Gets or sets a value determining tl1e appearance of the
RadioButton.
Auto Check Gets or sets a value indicating whether the Checked
value and the appearance of tl1e co11trol automatically
change when the co11trol is clicked.
AutoEllipsis Gets or sets a value indicating whether the ellipsis
character (...) appears at the right edge of tl1e co11trol,
denoting that the control text eA'tends beyond the
specified length of the control.
AutoScrollOfl'set Gets or sets '\>vhere tlris control is scrolled to in
ScrollControllntoView.
Auto Size Gets or sets a value tl1at indicates '\>Vheti1er the control
resizes based on its co11tents.
Bacl<Color Gets or sets the backgrotmd color of the control.
Backgroundlmage Gets or sets the backgrotmd i111age displayed in the
control.
BackgroundlmageLayout Gets or sets the background in1age layout as defined
in the In1ageLayout enumeration.
BindingContext Gets or sets the BindingContext for the control.
Bottom Gets the distance, in pixels, benveen the botton1 edge
of the control and the top edge of its contaiI1er's client
area.
Bounds Gets or sets the size and location of the control
including its nonclient ele1nents, in pi,xels, relative to
the parent control.
CanEnablelme Gets a value indicating whether the I1neMode
property can be set to an active value, to enable IME
support.
CanFocus Gets a value indicating 'vhether the contTol can
receive focus.
CanRaiseEvents Determines if events can be raised on the co11trol
CanSelect Gets a value indicating ,;ybether the control can be
selected.
Ca1.>ture Gets or sets a value indicating whether the control has
captured tl1e moltse.
CausesValidation Gets or sets a value indicating ' vbether the control
ca11ses validation to be performed on any controls that
require validation when it receives focus.
CheckAlign Gets or sets the location of the check box portion of
the RadioButton.
Checl<ed Gets or sets a value indicating whether the control is
checked.
ClientRectan gle Gets the rectangle that representsthe client area of the
control.
PowerShell Studio - Reference Guide I 459

ClientSize Gets or sets the height and \vidth of the client area of
the control.
Com1lanyName Gets the na1ne of the company or creator of tbe
application containing the control.
Container Gets the I Container that contains the Co1nponent.
ContainsFocus Gets a value indicating 'Vhether the control, or one of
its child controls, currently has the input focus.
ContextMenu Gets or sets the shortcut 111enu associated \ith the
control.
ContextMenuStrip Gets or sets the ConteA1MenuStrip associated 'ith
this control.
Controls Gets the collection of controls contained within tl1e
control.
Created Gets a value indicating 'vhether the control has been
created.
CreateP arams This API supports the product infrastructtue and is not
intended to be used directly fro1n your code. Gets tl1e
required creation parameters when the control handle
is created.(Overrides ButtonBase.CreateParams.)
Cursor Gets or sets the cursor that is displayed '1vhen the
mouse pointer is over the contr:ol.
DataBindings Gets the data bindings for tl1e control.
DefaultCursor Gets or sets the default cursor for tl1e control.
Defau ltlmeMode Gets the default Input Method Editor (IlvIE) mode
supported by this control.
DefaultMargin Gets the space, in pixels, that is specified by default
between controls.
DefaultMaximumSize Gets tl1e lengtl1 and height, in pixels, that is specified
as the default maximmn size of a control.
DefaultMinimumSize Gets the lengtl1 and height, in pL-xels, that is specified
as the default minimum size of a control.
DefaultPadding Gets the internal spacing. in pixels. of the contents of
a control.
DefaultSize Gets the defa1tlt size of the control. (Overrides
ButtonBase.DefattltSize.)
DesignMode Gets a value tliat indicates 1'Vhether the Component is
currently in design i11ode.
Dis1>layRectangle Gets the rectangle that represents tbe display area of
the control.
Disposing Gets a value indicati11g \vhether the base Control class
is in the process of disposing.
Dock Gets or sets which control borders are docked to its
parent control and detennines how a control is resized
with its parent.
Dou bleBu ffered Gets or sets a value indicating whether this control
sho1tld redraw its Slrrface using a secondary buffer to
reduce or prevent flicker.
Enabled Gets or sets a value indicating whether the control can
respond to user interaction.
460 I PowerShell Studio - A Comprehensive Guide

Events Gets t11e list of event handlers that are attached to this
Component.
FJatAp1>earan.ce Gets the appearai1ce of the border and the colors used
to indicate check state and mouse state.
FJatStyle Gets or sets the flat style appearance of the butto11
control.
Focused Gets a value b.1dicating "vl1ether the control has input
focus.
Font Gets or sets the font of the te>..'t displayed by the
control.
FontHeight Gets or sets the height of the font of the control.
ForeColor Gets or sets the foreground color of the control.
Handle Gets the window handle that the control is bound to.
Has Children Gets a value indicating "vhether the co11trol contains
011e or more child controls.
Height Gets or sets the height of the control.
Image Gets or sets the image that is displayed on a button
control.
lmageAJign Gets or sets the alignment of the image on the button
control.
lmagelndex Gets or sets the i1nage list index value of the image
displayed on the button control.
lmageKey Gets or sets the key accessor for the image in the
ImageList.
ImageList Gets or sets the lmageList tliat contains the Image
displayed on a button control.
lmeMode This API supports the product infrastructure and is not
intended to be used directly from your code. Gets or
sets the Input Method Editor (IME) n1ode supported
by this control. This property is i1ot relevant for this
class.
ImeModeBase Gets or sets the IME mode of a control.
InvokeRequired Gets a value indicating whetl1er the caller must call a11
invoke method when making method calls to the
control because the caller is on a different thread than
the one the control was created on.
lsAccessible Gets or sets a value i11dicating whether the control is
visible to accessibility applications.
IsDefault Gets or sets a value indicating "\>vhether the button
control is the default button.
IsDisposed Gets a value indicating \vhether the control has been
disposed of.
lsHandJeCreated Gets a value indicating 'vhether the control has a
l1311dle associated \ith it.
IsMirrored Gets a value indicating \Vhetber the control is
mirrored.
LayoutEngine Gets a cacl1ed instance of the control's layout engine.
PowerShell Studio - Reference Guide I 461

Left Gets or sets the distance, in pixels, ben.veen the left


edge of tl1e control and the left edge of its co11tainer's
client area.
Location Gets or sets the coordinates of the upper-left comer of
the control relative to the upper-left comer of its
contai11er.
Margin Gets or sets tl1e space bet\veen controls.
Maximo mSize Gets or sets the size that is the upper limit that
GetPrefe1TedSize can specify.
MinimumSize Gets or sets the size that is the lower limit that
GetPrefe1TedSize can specify.
Name Gets or sets the name of tl1e control.
Padding Gets or sets padding within the control.
Parent Gets or sets the parent container of the control.
PreferredSize Gets the size of a rectangular area into vvhich the
control can fit.
ProductName Gets the product name of the asse1ubly containing the
control.
ProductVersion Gets the version of the assembly contailling tl1e
control.
Recreatin gHandle Gets a value iI1dicating whether tl1e control is
currently re-creating its handle.
Region Gets or sets the wmdow region associated \Vitl1 the
control.
Rend.e rRightToLeft Obsolete.This property is no\:v obsolete.
ResizeRedraw Gets or sets a value indicating \ivhether the control
redraws itself \Vhen resized.
Right Gets the distance, in pixels, ben.veen the right edge of
the control and the left edge of its container's client
area.
RightToLeft Gets or sets a value indicating \Vhether control's
elements are aligned to support locales using right-to-
left fonts.
ScaleChildren Gets a value that determines the scaling of child
controls.
Show FocusCues Gets a value indicating whether the control shotdd
display focus rectangles.
ShowKeyboard Cues Gets a value il1dicating \vhether the user interface is iil
the appropriate state to shovv or hide keyboard
accelerators.
Site Gets or sets the site of the control.
Size Gets or sets the height and \Vidth of the control
Tablndex Gets or sets the tab order of tl1e control within its
container.
TabStop This API s11ppo:rts the product infrastructure and is not
intended to be used directly from your code. Gets or
sets a value indicating whether the user can give the
focus to this control usiI1g the TAB key.
462 I PowerShell Studio - A Comprehensive Guide

Tag Gets or sets the object that contains data about the
control.
Text Gets or sets the teA't associated vvith this control.
TextAlign This API supports the product infrastn1cture and is not
intended to be used directly fron1 your code. Gets or
sets the aligrunent of the text 011 the Radi0Butto11
control. (Overrides ButtonBase. Tea1Align.)
TextlmageRelation Gets or sets the position of text and image relative to
each other.
Top Gets or sets the distance, in pixels, betvveen the top
edge of the control and the top edge of its containe1Js
client area.
TopLevelControJ Gets the parent control that is not parented by another
Windows Forms control. Typically, tl1is is the
outermost Form that the control is contained in.
UseCompatibleTextRendering Gets or sets a value tl1at detennin.es whet11er to use the
Graphics class (GDI+) or the TextRenderer class
(GDD to render teA't.
UseMnemonic Gets or sets a value indicating ,;vhetl1er the first
character that is preceded by ai1 ampersand (& ) is
used as the mnemo1ric key of the control.
UseVisualStyleBackColor Gets or sets a value that determines if the backgrotmd
is drawn using visual styles, iI supported.
UseWaitCursor Gets or sets a value indicating vvhether to use the 'vait
cursor for the current control and all child controls.
Visible Gets or sets a value indicating vvhetller tl1e control and
all its clrild controls are displayed.
Width Gets or sets the widtl1 of t11e co11trol.
Window Target This API supports the product infrastructure ai1d is not
intended to be used directly fron1 your code. TJris
property is not relevant for this class.
RICHTEXTBOX

PROPERTY DESCRIPTION
Acce1>tsRetu rn Gets or sets a value that indicates hovv the teA1 editing
control responds ,;v-hen the user presses the ENTER
key.
Accepts Tab Gets or sets a value t11at indicates how the text editing
control responds ,;vhen the user presses tl1e TAB key.
Actuameight Gets the rendered height of this element.
ActuaIWidtb Gets the rendered ,;vidth of tllis elen1ent.
Allo\vDro1> Gets or sets a value indicating vvhether tlris element
can be used as the target of a drag-and-drop operation.
Tlris is a dependency property.
AreAnyTouchesCaptured Gets a value that indicates whether at least one touch
is captured to this element.
PowerShell Studio - Reference Guide I 463

AreAnyToucbesCapturedWitbin Gets a value that indicates whether at least one touch


is captured to this element or to any child elements in
its visual tree.
AreAnyToucbesDirectlyOver Gets a value that indicates whetl1er at least one toucl1
is pressed over this element.
AreAnyToucbesOver Gets a vall1e that indicates whether at least one touch
is pressed over this element or any child elements in
its visual tree.
AutoWordSelection Gets or sets a value that determines 'vhether when a
user selects part of a word by dragging across it with
the mouse, the rest of the word is selected.
Background Gets or sets a brush that describes tl1e background of a
control.
Bin dingGrou11 Gets or sets the BindingGroup that is used for the
element.
BitmapEffect Obsolete.Gets or sets a bitmap effect that applies
directly to the rendered content for tlus elen1ent. This
is a dependency property.
Bitma11Effectln11ut Obsolete. Gets or sets an input source for the bitmap
effect that applies directly to the rendered content for
this element. This is a dependency property.
BorderBrush Gets or sets a brusl1 that describes tl1e border
backgroru1d of a control.
Bo rderThickness Gets or sets the border thickness of a control.
CacheMode Gets or sets a cached representation of the UIElement.
CanRedo Gets a value that indicates \>vhether the 1nost recent
undo action ca11 be redone.
CanUndo Gets a value that indicates whether the most recent
action can be tu1done.
CaretBrusb Gets or sets the bn1sh that is used to paint the caret of
tl1e text box.
CaretPosition Gets or sets the position of the i11put caret.
Cli11 Gets or sets the geometry used to define the outline of
the contents of an ele1nent. This is a dependency
property.
ClipToBounds Gets or sets a value indicating"vhethet to clip the
content of this element (or conte11t coining fro111 the
child elements of this element) to fit into the size of
the containil1g element. This is a dependency
property.
CommandBindings Gets a collection of CommandBinding objects
associated with this element. A Comn1andBinding
enables co.mn1and handling for this ele1nent, and
declares the linkage bet\veen a comn1and, its events,
and the handlers attached ~y this element.
ContextMenu Gets OI sets the context 1nenu element that should
appear wl1enever tl1e context menu is requested
through user interface (Ul) from 'vitllin this element.
464 I PowerShell Studio - A Comprehensive Guide

Cursor Gets or sets the cursor tliat displays when the 1nouse
pointer is over this element.
Data Context Gets or sets the data couteA1 for fill ele1nent when it
participates in data binding.
DefaultStyleKey Gets or sets the key to use to reference tl1e style for
this control, when theme styles are used or defined.
De11endencyObjectType Gets the DependencyObjectType that wraps the CLR
type of this instance. (Inl1erited from
DependencyObject.)
DesiredSize Gets the size that this elernent computed during the
measure pass of the layout process.
Dis11atcher Gets the Dispatcher this DispatcherObject is
associated \ith. (Inherited frorn DispatcherObject.)
Document Gets or sets the Flo\vDocument that represents the
contents of the RichTeA1Box.
Effect Gets or sets the bitmap effect to apply to the
UIElement. This is a dependency property.
ExtentHeight Gets the vertical size of the visible content area.
ExtentWidth Gets the horizontal size of the visible content area.
Flo,vDirection Gets or sets the direction tltat text and other user
interface (UI) elements flovv \ithin filly parent
ele1nent that controls their layout.
Focusable Gets or sets a value tiiat indicates whether the ele1nent
can receive focus. This is a dependency property.
FocusVisualStyle Gets or sets a property that enables customization of
appearance, effects or other sty le cbaracteristics tliat
\.Vill apply to this eleme11t when it captures keyboard
focus.
FontFamily Gets or sets the font family of the control.
FontSize Gets or sets the font size.
FontStretcb Gets or sets the degree to which a font is condensed or
expanded on tl1e screen.
FontStyle Gets or sets the font sty le.
FontWeight Gets or sets the weight or thickness of the specified
font.
ForceCursor Gets or sets a value that indicates whetl1er this
Frame,vorkElement should force tl1e user interface
(UI) to render the cttrsor as declared by the Ctrrsor
property.
Foreground Gets or sets a bntsh that describes the foreground
color.
HandlesScrolling Gets a value that indicates whether a control supports
scrolling.
HasAnimatedPro11erties Gets a value indicating whether this eleme11t has any
animated properties.
HasEffectiveKevboardFocus
~
Gets a value that indicates whether tl1e UIElement has
focus.
Height Gets or sets the suggested height of the ele1nent.
PowerShe ll Stu dio - Refere nce Guide I 465

HorizontaWignment Gets or sets the horizontal alignment characteristics


applied to this element when it is composed within a
parent ele1nent, such as a panel or items control.
HorizontalContentAlignment Gets or sets the horizontal alignment of the control's
content.
HorizontalOffset Gets or sets the horizontal scroll position.
HorizontalScrollBarVisibility Gets or sets a value that indicates whether a horizontal
scroll bar is shown.
InheritanceBehavior Gets or sets the scope Ji n1its for property value
inheritance, resource key lookup, ai1d RelativeSource
FindAncestor lookup.
lnputBindings Gets the collection of input bindiJ1gs associated with
this element.
In1JutSco1Je Gets or sets t11e context for inp11t used by this
Fra1nework.Ele1nent.
IsArrangeValid Gets a value indicating \ V hether the computed size and
position of child elements in this el ement~s layout are
valid.
IsDocumcntEnabled Gets or sets a value that indicates \ivhether the tlSer can
interact \vith UIElement and ContentEle1nent objects
within the RichTex1:Box.
IsEnabled Gets or sets a value indicating whether this element is
enabled in the user interface (Ul ). This is a
depende11cy property.
lsEnabledCore Gets a value that becomes the return value of
IsEnabled in derived classes.
IsFocused Gets a value that determines vvl1ether this element 11as
logical focus. This is a dependency property.
IsHitTestVisible Gets or sets a value that declares "vhether this element
can possibly be returned as a bit test result from son1e
portio11 of its rendered content. This is a dependency
property.
IslnactiveSelectionHighlightEnabled Gets or sets a value that indicates whether the teA1 box
displays selected text when the teA1 box does not have
focus.
lslnitialized Gets a value tl1at indicates whether this ele1nent has
been initialized. either during processing by a XAML
processor, or by eArplicitly having its Endlnit method
called.
IslnputMethodEnabled Gets a value indicating \Vhether an input method
system, such as an Input Metl1od Editor (Th1E), is
enabled for processing the input to this element.
IsKeyboardFocused Gets a valtte iI1dicating whetl1eT this element has
keyboard focus. This is a dependency property.
lsKeyboardFocusWithin Gets a value indicating \hether keyboard focus is
any\-vl1ere within the ele1nent or its visual tree child
eleme11ts. This is a dependency property .
IsLoaded Gets a value that indicates whether this element has
been loaded for presentation.
466 I PowerShell Studio - A Comprehensive Guide

lsManipu lationEuabled Gets or sets a value that indicates whet11er


1nanipulation events are enabled on tltis UIElement.
IsMeasureValid Gets a value indicating \.V bether the current size
returned by layout measure is valid.
lsMouseCa1>tu red Gets a value indicati.I1g whether the mouse is captured
to this element. Thls is a dependency property.
lsMouseC aptureWithin Gets a value that detennines whether mouse capture is
held by this elen1ent or by cltild ele.ments in its visual
tree. This is a dependency property .
IsMouseDirectlyOver Gets a value that indicates whether the position of the
mouse pointer corresponds to hit test resnlts, which
take eleinent compositing into account. This is a
dependency property.
IsMouseOver Gets a value indicating \vhether tl1e mouse pointer is
located over this ele1nent (including cltild elernents in
the visual tree). This is a dependency property.
IsReadOnly Gets or sets a value that indicates whether the text
editing control is read-only to a user interacting with
the control.
IsReadOnlyCaretVisible Gets or sets a value that indicates whether a read-only
text box displays a caret.
IsSeaJed Gets a value that indicates whether tltis instance is
currently sealed (read-only).(Inberited fro1n
DependencyObject.)
IsSelectionActive Gets a value that indicates whether the tex.1 box has
focus a11d selected text.
IsStylusCaptured Gets a value indicating whether the stylus is captured
by this eleme11t. This is a dependency property.
IsStylusCaptureWithin Gets a value that detennines whether stylus capture is
held by tltis element, or an element \.Vithin the ele1nent
bounds and its visual tree. This is a dependency
property.
IsS tylusDirectlyOver Gets a value that indicates \.Vhether tI1e stylus position
corresponds to hit test results, which take element
compositing into account. This is a dependency
property.
IsStylusOver

Gets a value indicating \ V hether tl1e stylus ci1rsor is
located over tl1is ele111ent (including visual child
elements). Thls is a dependency property.
lsTabStop Gets or sets a value that ii1dicates whether a control is
included in tab navigation.
IsU ndoEnabled Gets or sets a value that indicates whether undo
support is enabled for the tex.1-editing control.
IsVisible Gets a value indicating wl1ether this ele1nent is visible
in the user interface (UI). This is a dependency
property.
Language Gets or sets localization/globalization language
information that applies to an ele1nent.
LayoutTransform Gets or sets a grapltics transfonnatio11 that should
apply to tltis element when layout is perfonned.
PowerShell Studio - Reference Guide I 467

LogicalChildren Gets an enumerator that can iterate the logical


children of the RichTextBox.(Overrides
FraineworkElement.LogicalChildren.)
Margin Gets or sets the outer margin of an element.
Max.Height Gets or sets the maxin1um height constraint of the
ele111ent.
MaxWidth Gets or sets the n1aximum widtl1 constraint of the
element.
MinHeight Gets or sets the ntinimu1n height constraint of the
element.
MinWidth Gets or sets the minim1un width constraint of the
element.
Name Gets or sets the identifying name of the ele1nent. The
name provides a reference so that code-behind, such
as event handler code, can refer to a markup element
after it is constructed during processing by a XA1v1L
processor.
Opacity Gets or sets tl1e opacity factor applied to the entire
UIElement when it is rendered in the user interface
(UI). This is a dependency property.
OpacityMask Gets or sets an opacity mask, as a Bn1sh
implementation that is applied to any alpha-channel
masking for the rendered content of tltis ele1nent. Tltis
is a dependency property.
OverriclesDefaultStyle Gets or sets a value that indicates whether tltis
element incorporates sty le properties from tlleme
styles.
Padding Gets or sets the padding inside a control.
Parent Gets the logical parent element of this element.
Persistld Obsolete.Gets a value that uniquely identifies this
element.
RenderSize Gets (or sets, but see Remarks) the final render size of
this element.
RenderTransform Gets or sets transform infor1113tion that affects the
renderi11g positio11 of this ele1nent. This is a
dependency property.
Ren.d erTransformOrigin Gets or sets tlle center point of any possible render
transfonn declared by RenderTransform, relative to
the bounds of the element. This is a dependency
property.
Resources Gets or sets tlle locally-defined resource dictionary.
Selection Gets a TextSelectionobject containing the current
selection in the RichTe:\1:Box.
SelectionBrush Gets or sets the bn1sh that highlights selected text.
Selection Opacity Gets or sets the opacity of the SelectionBn1sh.
SnapsToDevicePixels Gets or sets a value that detem1ines whether rendering
for this element should use device-specific _Q_ixel
468 I PowerShell Studio - A Comprehensive Guide

settings during rendering. This is a dependency


property.
StlellCheck Gets a SpellCheck object that provides access to
spelling errors in the text contents of a TextBoxBase
or RichTextBox.
Style Gets or sets the sty le used by this eleme11t when it is
rendered.
StylusPluglns Gets a collection of all stylus plug-in (customization)
objects associated with this element.
Tablndex Gets or sets a value that determines the order in \hich
elements receive focus when the user navigates
through controls by using the TAB key.
Tag Gets or sets fill arbitrary object value that can be used
to store custom information about this element.
Tem11late Gets or sets a control te1nplate.
TemplatedParent Gets a reference to the template parent of tltis
element. This property is not relevant if the element
was not created through a template.
ToolTiJl Gets or sets the tool-tip object that is displayed for
this ele1nent in the user inte1f ace (UI).
TouchesCaptured Gets all touch devices that are captured to tltis
ele1nent.
TouchesCapturedWithin Gets all touch devices that are capll1red to this eleme.nt
or any child elen1ents in its visual tree.
TouchesD irectlyOver Gets all touch devices that are over this element.
ToucbesOver Gets all touch devices that are over this element or
any child elements in its visual tree.
Triggers Gets the collection of triggers established directly on
this ele1nent, or in child ele1nen.ts.
Uid Gets or sets the unique identifier (for localization) for
this ele1nent. This is a dependency property.
Undo Limit Gets or sets the number of actions stored in tl1e undo
queue.
UseLayoutRounding Gets or sets a value that indicates whether layout
rounding should be applied to tltis ele1nent's size and
position during layout.
VerticalA.Lignmeot Gets or sets the vertical alignment characteristics
applied to tltis element when it is composed witlti11 a
parent elen1ent such as a panel or items control.
VerticalContentAlignment Gets or sets the vertical alignment of the control's
content.
VerticalOffset Gets or sets the vertical scroll position.
Ve11icalScroUBarVisibility Gets or sets a value that indicates \Vhether a vertical
scroll bar is shown.
ViewportHeight Gets the vertical size of the scrollable content area.
ViewportWidtb Gets the horizontal size of the scrollable content area.
Visibility Gets or sets the user interface (UI) visibility of this
element. Tltis is a dependency property.
PowerShell Studio - Reference Guide I 469

VisualBitmapEffect Obsolete.Gets or sets the BitmapEffect value for tl1e


Visual.
VisualBi.tmapEffectlnput Obsolete. Gets or sets tl1e BitmapEffecth1put value for
the Visual.
Visu alBitm apScalin gMode Gets or sets the BitmapScalingMode for tl1e Visual.
VisualCacbeMode Gets or sets a cached representation of the Visual.
VisualChiJdrenCount Gets the number of visual cllild ele1uents \Vitllin this
element.
Visu alCiearTypeHint Gets or sets the ClearTypeHint that determines how
ClearType is rendered in the Visual.
Visual Clip Gets or sets the clip region of the Visual as a
Geon1etry value.
VisualEdgeMode Gets or sets the edge mode of the Visual as an
EdgeMode value.
VisualEffect Gets or sets the bitmap effect to apply to the Visual.
VisualOffset Gets or sets the offset value of the visual object.
VisualOpacity Gets or sets the opacity of the Visual.
Visu alOpacity Masi< Gets or sets the Bn1sh value that represents the
opacity mask of the Visual.
VisualParent Gets the visual tree parent of the visual object.
VisualScroHableAreaClip Gets or sets a clipped scrollable area for the Visual.
VisualTextBintingMode Gets or sets tl1e TextHiI1tingMode of the Visual.
VisualTextRenderingMocle Gets or sets the TextRenderingMode of the Visual.
VisualTransform Gets or sets the Transfo1m value for the Visual.
VisualXSnappingGuidelines Gets or sets the x-coordinate (vertical) guideline
collection.
VisualYSnappingGuidelines Gets or sets they-coordinate (l101izontal) guideline
collection.
Width Gets or sets the width of the element.

SAVEDDIALOG

PROPERTY DESCRIPTION
AddExtension Gets or sets a value indicating \Vhether the dialog box
automatically adds an extension to a file name if the
user omits the extension.
Auto U1>gradeEnabled Gets or sets a value indicating ,;vhether this FileDialog
instance sl1ould automatically t1pgrade appearance and
behavior when nu1ning on Windo\VS Vista.
CbeekFileExists Gets or sets a value indicating whether the dialog box
displays a wan1ing if the user specifies a file name
that does not exist.
CheckP atbExists Gets or sets a value indicating whetl1er the dialog box
displays a "varni11g if the user specifies a path that
does not exist.
470 I PowerShell St udio - A Comprehensive Guide

Container Gets the IC011tainer that contains the Component.


CreateProm1>t Gets or sets a value indicatil1g whether the dialog box
prompts the user for permission to create a file if the
user specifies a file that does not eA.ist.
CustomPlaces Gets the custon1places collection for this FileDialog
instance.
DefaultExt Gets or sets the default file name e>..rtension.
DereferenceLinks Gets or sets a value indicating "vhether the dialog box
returns the location of the file referenced by the
shortct1t or ,;vhether it returns the location of the
shortcut (.lnk:) .
FileName Gets or sets a string containing the file name selected
in the file dialog box.
FileNames Gets the file names of all selected files in the dialog
box.
Filter Gets or sets the current file name filter string, which
detemlines the choices that appear in the "Save as file
type" or "Files of type" box in the dialog box.
FilterIndex Gets or sets the index of the filter curre11tly selected in
the file dialog box.
InitialDirectory Gets or sets the initial directory displayed by the file
dialog box.
OverwritePrompt Gets or sets a value indicating whether the Save As
dialog box displays a warning if the user specifies a
file name that already exists.
RestoreD i rectory Gets or sets a value i11dicating whether the dialog box
restores the directory to tl1e previously selected
directory before closing.
Sho,vHelp Gets or sets a value indicating \Vhether the Help
button is displayed in the file dialog box.
Site Gets or sets the !Site of the Component.
SupportMultiDottedExtensions Gets or sets whether the dialog box supports
displaying and saving files that have multiple file
name extensions.
Tag Gets or sets an object that contains data about tl1e
control. (Inherited from CommonDialog.)
Title Gets or sets the file dialog box title.
ValiclateN am es Gets or sets a value indicating ,;vhether tl1e dialog box
accepts only valid Win32 file names.

SPLITCONTAINER

PROPERTY DESCRIPTION
AccessibilityObject Gets the AccessibleObject assigned to the control.
AccessibleDefaultActionDescription Gets or sets the default action description of the
control for use by accessibility clie11t applications.
PowerShell Studio - Reference Guide I 471

AccessibleDescription Gets or sets the description of the control used by


accessibility client applications.
AccessibleName Gets or sets the nan1e of the co11troJ used by
accessibility client applications.
AccessibleRole Gets or sets the accessible role of tl1e control
ActiveControl Gets or sets the active control on the container
control.
Allow Drop Gets or sets a value indicating 'vhether the control can
accept data that the user drags onto it.
Anchor Gets or sets the edges of the container to which a
control is bound and determines how a control is
resized with its parent.
AutoScaleDimensions Gets or sets the diJ.nensions that tl1e control was
designed to.
AutoScaleFactor Gets the scaling factor between the current and
design-ti1ne automatic scaling di1nensions.
AutoScaleMode Gets or sets the automatic scaling mode of the control.
Auto Scroll This API supports the product infrastructure a11d is not
intended to be used directly fron1 yotu code. When
overridden in a de1ived class, gets or sets a value
indicating whether scroll bars automatically appear if
co11trols are placed outside the SplitContainer client
area. Tllis property is not relevant to this
class. (Overrides Scrollab leControl. Auto Scroll.)
AutoScrollMargin Tllis API supports the product infrastructure and is not
intended to be used directly from yotrr code. Gets or
sets tl1e size of the auto-scroll margin. Tllis property is
not relevant to this class. This property is not relevant
to tllis class.
AutoScroUMinSize This API supports the prodttct infrastruchue and is uot
intended to be used directly fron1 yotu code. Gets or
sets the minimum size of the scroll bar. This property
is not relevant to tllis class.
AutoScrolJOffset This API supports the prod11ct infrastrucnue and is not
intended to be llSed directly from your code. This
property is not relevant to this class. (Overrides
Control.Auto ScrollOffset.)
AutoScrollPosition This API supports the product infrastructure and is not
intended to be used directly from your code. This
property is not relevant to tllis class.
Auto Size This API supports the product infrastructure and is not
intended to be l1sed directly fro1n your code. Gets or
sets a value indicating whether tlte SplitContainer is
automatically resized to display its entire co11tents.
This property is not relevant to this class. (Ovenides
Control.Auto Size.)
AutoValidate Gets or sets a value that indicates '"''hether controls in
this container will be auto1natically validated when
the focus clmnges.
472 I PowerShell Studio - A Comprehensive Guide

BackColor Gets or sets the backgrotmd color for the control.


Bacl{g1oundlmage Gets or sets the background in1age displayed in the
control. (Overrides Control.Ba.ckgroundlmage.)
Backgrou ndlmageLayout This APT supports the product infrastn1ct11re and is not
intended to be used directly fTom your code. This
property is not relevru1t to this c1ass.(Overrides
Control.BackgroundimageLayot1t.)
BindingContext Gets or sets t11e BindingContext for the
SplitContainer. (Overrides
ContainerContro LB indingConteA.1.)
BorderStvle

Gets or sets the style of border for the SplitContai11er.
Bottom Gets the distance, in pixels, benveen the bottom edge
of the control and the top edge of its container's client
area.
Bounds Gets or sets the size and location of the control
including its nonclient elements, in pixels, relative to
the parent control.
CanEnablelme Gets a value indicating "vhether the In1eMode
property can be set to an active value. to enable IME
support.
CanFocus Gets a value indicating whether the control can
receive focus .
CanRaiseEvents Detenni nes if events can be raised on the control.
CanSelect Gets a value indicating whether the control can be
selected.
Ca1>turc Gets or sets a value indicating whether the control has
captured the nlouse.
CausesValidation Gets or sets a value indicating \vhether the control
causes validation to be perfon11ed on ru1y controls that
require validation when it receives focus .
ClientRectangle Gets the rectangle that represents tl1e client area of tl1e
control.
ClientSize Gets or sets the height and "vidth of tl1e client area of
the control.
CompanyName Gets the nan1e of the company or creator of the
application containing the control.
Container Gets the IContai11er that contains the Compo11ent.
ContainsFocus Gets a value indicating \vhether the control, or one of
its child controls, currently lias the input focus.
ContextMenu Gets or sets the shortcut menu associated with the
control.
ContextMenuStrip Gets or sets the Co11teA.'tMenuShip associated vvith
this control.
Controls This API supports the product infrastructure and is not
intended to be used directly from your code. Gets a
collection of child controls. This property is not
relevant to this class.
Created Gets a value indicating \Vhether the control bas been
created.
PowerShe ll Studio - Referen ce Guide I 473

CreateParams Gets the required creation parameters when the


control handle is created.
CurrentAutoScaleDimensions Gets the current t1m-tilne din1e11sions of the scree11.
Cursor Gets or sets the cursor that is displayed when the
mouse pointer is over the conwol.
DataBindings Gets the data bindings for the control
DefaultCursor Gets or sets the default ctrrsor for tl1e co11trol.
DefaultlmeMode Gets the default Input Method Editor (IME) mode
supported by the control.
DefaultMargin Gets the space, in pixels, tl1at is specified by default
between.controls.
DefaultMaximumSize Gets the length and 11eight, in pixels, that is specified
as the default inaximum size of a control.
Defau ltMinimumSize Gets the length and height, in pixels, that is specified
as the default minim1un size of a control.
DefaultPadding Gets the internal spacing, in pixels of the contents of
a control.
DefaultSize Gets the default size of the SplitContainer.(Overrides
Control.DefaultSize.)
DesignMode Gets a value that indicates whether the Con1pone11t is
currently in design mode.
DisplayRectangle Gets the rectangle tliat represents the virtual display
area of tl1e control.
Disposing Gets a value indicating \Vhether the base Control class
is in the process of disposing.
Dock Gets or sets \Vhich SplitContainer borders are attached
to tl1e edges of the container.
DockPadding Gets the dock padding settings for all edges of the
control.
DoubleBuffered Gets or sets a value indicating whether this control
should 1edraw its surface using a secondary buffer to
reduce or prevent flicker.
Enabled Gets or sets a value indicating whether tl1e control can
respond to user interaction.
Events Gets the list of event handlers that are attached to this
Component.
FixedPanel Gets or sets \lticl1 SplitContainer panel remains the
same size when the container is resized.
Focused Gets a value indicating \Vhether the control has input
focus.
Font Gets or sets the font of tl1e text displayed by tl1e
control.
FontHeight Gets or sets the height of the font of the control.
ForeColor Gets oI sets the foi eground color of tl1e control.
Handle Gets tbe window liandle fuat the control is bound to.
Has Children Gets a value indicating \hether tbe control co11tains
one or more child controls.
Height Gets or sets the height of the control.
474 I PowerShell Studio - A Comprehensive Guide

HorizontalScroll Gets the characteristics associated \ivith the horizontal


scroll bar.
HScroll Gets or sets a value indicating whether tl1e horizontal
scroll bar is visible.
lmeMode Gets or sets the Input Method Editor (IME) mode of
the control.
lmeModeBase Gets or sets the IME mode of a control.
Invo keRequi red Gets a value indicating \hether the caller n1ust call an
invoke method when making metl1od calls to tl1e
control because the caller is on a different thread than
the one the co11trol was created on.
IsAccessible Gets or sets a value indicati11g \:Vhether the control is
visible to accessibility applications.
lsDisposed Gets a value indicating \hetber the control has been
disposed of.
IsHandleCreated Gets a value :indicating whether the control bas a
11andle associated with it.
lsMirrored Gets a value indicating whetl1er the control is
mirrored.
IsS p litterFL\':ed Gets or sets a value indicating whether the splitter is
fixed or movable.
LayoutEngine Gets a cached instance of the control's layout engine.
Left Gets or sets the distance, ir1 pixels, between tl1e left
edge of the control and the left edge of its container's
client area.
Location Gets or sets the coordinates of the upper-left comer of
tl1e control relative to the upper-left corner of its
container.
Marg.in Gets or sets the space ben.veen controls.
MaximumSize Gets or sets the size that is tl1e upper limit that
GetPreferredSize can specify.
Minimum Size Gets or sets the size that is tl1e lower limit that
GetPreferredSize can specify.
Name Gets or sets the nan1e of tl1e contTol.
Orientation Gets or sets a value indicating the horizontal or
vertical orie11tation of the SplitContainer pai1els.
Padding This API supports the product infrastn1cture and is not
intended to be used directly from your code. Gets or
sets the interior spacing, in pixels, bet\lveen the edges
of a Splitte1Pai1el and its contents. This property is not
relevant to this class.
Panell Gets the left or top panel of the SplitContainer,
depending on Orientation.
Pan ellColla1lsed Gets or sets a value determining \hether Panell is
collapsed or expanded.
PanellMinSize Gets or sets the milri1ntun distance in pixels of the
splitter from the left or t~p edge of Panel 1.
Panel2 Gets the rigl1t or bottom pa11el of the SplitContainer,
depending on Orientation.
PowerShell Studio - Reference Guide I 475

Panel2CoUapsed Gets or sets a value determining,vhether Panel2 is


collapsed or expanded.
Panel2Mi.n Size Gets or sets the min.imu1n distance in pixels of the
splitter fron1 the right or bottom edge of Panel2.
Parent Gets or sets the parent container of the co11trol.
ParentForm Gets the form that the container control is assigned to.
Preferred Size Gets the size of a rectangular area into \.vh.ich the
control can fit.
ProcluctName Gets the product nan1e of the asse1nbly containing tl1e
control.
ProductVersion Gets the version of the assembly containing the
control.
Recreatin gBandJe Gets a value indicating whether tl1e control is
currently re-creating its handle.
Region Gets or sets the \vindo\v region associated witl1 the
control.
RenderRightToLeft Obsolete.This property is now obsolete.
ResizeRedra'v Gets or sets a value indicating \Vhether the control
redraws itself when resized.
Right Gets the distance, in pixels, benveen the right edge of
the control and the left edge of its container's client
area.
RightToLeft Gets or sets a value indicating whether control's
elements are aligned to support locales using rigbt-to-
left fonts.
ScaleChildren Gets a value that determines the scaling of child
controls.
Show FocusCues Gets a value indicating \l1ether the control should
display focus rectangles.
Sho'v Kevboarcl
Cues Gets a value i11dicating vvhether the user interface is in
the appropriate state to show or hide keyboard
accelerators.
Site Gets or sets the site of the control.
Size Gets or sets the height and widtl1 of the control.
SplitterDistance Gets or sets the locatio11 of the splitter in pixels, from
the left or top edge of the SplitContainer.
SplitterIncrement Gets or sets a value representing the increment of
splitter move1nent in pixels.
SplitterRectangle Gets the size and location of tl1e splitter relative to the
SplitContainer.
SplitterWidth Gets or sets the width of the splitter in pixels.
Tab Index Gets or sets the tab order of tl1e control within its
container.
TabStop Gets or sets a value indicating whether the user can
give the focus to the splitter using the TAB key.
Tag Gets or sets the object that contains data about the
control.
476 I PowerShell Studio - A Comprehensive Guide

Text This API supports the product infrastructure and is not


intended to be used directly from yom code. This
property is not relevant to this class .(Overrides
Control. TeJrt.)
Top Gets or sets the distance, in pixels, bet\veen the top
edge of the control and the top edge of its contaiI1er's
client area.
TopLevelControl Gets the pare11t control that is not parented by another
Windo\vs Forms control. Typically, this is the
outennost Form that tl1e control is contained in.
UseWaitCursor Gets or sets a value indicating whether to use the ' vait
cursor for the current control and all child controls.
VerticalScroll Gets the characteristics associated vt7ith the vertical
scroll bar.
Visible Gets or sets a value iI1dicating ' vhether the control and
all its child controls are displayed.
VScroll Gets or sets a value indicating whether tl1e ve11ical
scroll bar is visible.
Width Gets or sets the width of the control.
Windo\vTarget This API supports the product infrastn1ct1rre and is not
intended to be used directly from your code. This
property is not relevant for this class.

SPLITTER

PROPERTY DESCRIPTION
AccessibilityObject Gets the AccessibleObject assigned to tl1e control.
AccessibleDefaultActionDescription Gets or sets the default action description of t11e
control for use by accessibility client applications.
AccessibleDescri1ltion Gets or sets file description of tlle control used by
accessibility client applications.
AccessibleName Gets or sets the na1ne of the control used by
accessibility client applications.
.t\ccessible~o1e Gets or sets the accessible role of the control
AllowDrop This API supports the product infrastructme and is not I
intended to be used directly fro1n your code. This
property is not relevant to this class .(Overrides
Control.AllowDrop.)
Anchor This API supports the product infrastn1ct1ue and is not
intended to be used directly from your code. This
property is not relevant to this class.(Overrides
Control. Anchor.)
AutoScrollOffset Gets or sets where this control is scrolled to in
ScrollControllntoView.
Auto Size This API supports the product infrastn1cture and is not
intended to be used directly frotn your code. This
property is not relevant for this class.
PowerShell Studio - Reference Guide I 477

BackColor Gets or sets tl1e background color for the control.


Backgrouncllmage This API supports the product infrastructure and is not
iJ1tended to be used directly from your code. This
property is not relevant to this class. (Overrides
Control.Backgroundlmage.)
Backgroundlm ageLayout This API supports the product infrastructure and is not
intended to be used directly fro1n yolu code. This
property is not relevant to this class. (Ovenides
Control.Backgrow1dlmageLayout.)
Bin dingContext Gets or sets the BindingConte:\.1: for the control.
BorderStyle

Gets or sets the sty le of border for the contro1.
Splitter.BorderStyle has been replaced by
SplitC011tainer.BorderStyle and is provided only for
compatibility with previous versions.
Bottom Gets the distance, in pixels, benveen the bottom edge
of tl1e control and the top edge of its container's client
area.
Bounds Gets or sets the size and location of the control
i11cluding its nonclient elen1ents, in pi'<els, relative to
the parent control.
CanEnablelme Gets a value i11dicating whether the ImeMode
property can be set to an active value, to enable IME
support.
CanFocus Gets a value indicating whether the control can
receive focus.
C anRaiseEvents Deterrnines if events cai1 be raised on the contTol.
CanSelect Gets a value indicatil1g ,;vhether the control can be
selected.
CaJlture Gets or sets a value indicating whether the control has
captured the n1ouse.
CausesValidation Gets or sets a value il1dicating whetl1er the control
causes validation to be perfon11ed on any controls that
require validation when it receives focus.
ClientRectan gle Gets the rectangle that represe11ts the clie11t area of the
control.
ClientSize Gets or sets the height and \iVidth of the client area of
the control.
CompanyName Gets the name of the company or creator of the
application containing tl1e control.
Container Gets the !Container that contains the Component.
ContainsFocus Gets a value indicating ,;v11ether the co11trol, or 011e of
its child controls, currently bas the mput focus.
ContextMenu Gets or sets the shortcut me11u associated with the
control.
ContextMenuStrip Gets or sets the ContextMenuStrip associated with
this control.
Cont.-ols Gets the collection of controls contained wiiliin the
control.
478 I PowerShell Studio - A Comprehensive Guide

Created Gets a value indicating whether the control has been


created.
CreateParams Rett1111s the paran1eters needed to create the 11andle.
(Ovenides Control.CreateParmns.)
Cursor Gets or sets the ctrrsor that is displayed when the
mouse pointer is over the control.
DataBindings Gets the data bindings for the control.
DefaultCursor Gets or sets the default cursor for the
control. (Overrides Control.DefaultCursor.)
DefaultlmeMode Gets the default Input Method Editor (IME) mode
supported by this control.(Over1ides
Control.Defaultl1neMode.)
Defau ItMargin Gets the space, in pi"<els, that is specified by defattlt
between controls.
DefaultMaximumSize Gets the length and height, in pixels, that is specified
as the default maxi1num size of a control.
DefaultMinimumSize Gets the length and height, in pixels, that is specified
as the default minimum size of a control.
DefaultPadding Gets tl1e intenml spacing, in pixels, of the contents of
a control.
DefaultSize Gets the defattlt size of the control. (Overrides
Control.DefaultSize.)
DesignMode Gets a value that indicates vvhether the Component is
currently in design mode.
DisplayRectangle Gets the rectangle that represents tl1e display area of
the control.
Disposing Gets a value i11dicating whether the base Control class
is in the process of disposing.
Dock Gets or sets which Splitter borders are docked to its
parent control and determines how a Splitter is resized
vvith its parent.(Ovenides Control.Dock.)
Dou bleBuffered Gets or sets a value indicating whether this control
should redraw its surface using a secondary buffer to
reduce or prevent flicker.
Enabled Gets or sets a value indicating whether the control can
respond to user interaction.
Events Gets the list of event handlers that are attached to this
Co1npone11t.
Focused Gets a value indicating whether the control has input
focus.
Font This API supports the product infrastructure and is not
intended to be used directly from your code. This
property is not relevm1t to this class .(Overrides
Control.Font.)
FontHeight Gets or sets the height of the font of the control.
ForeColor Tllis API supports the product infrastructure and is not
intended to be used directly from your code. This
property is not relevant to tlris class.(Overrides
Control.ForeColor.)
PowerShell Studio - Reference Guide I 479

Handle Gets the 'vindow handle that the control is bot1nd to.
Has Children Gets a value indicating whether the control contains
one or n1ore child controls.
Height Gets or sets the height of the control.
ImeMode This A.PI supports the prodt1ct infrastructure and is not
intended to be used directly fron1 your code. This
property is not relevant to this class.
ImeModeBase Gets or sets the IME mode of a control.
lnvolteRequ ired Gets a value indicating whether the caller must call an
invoke inethod when inaki11g 1nethod calls to the
control because the caller is on a different thread than
the one the control was created on.
IsAccessible Gets or sets a value indicating whether the control is
visible to accessibility applications.
lsDis11osed Gets a value indicati11g \vhether the co11trol has been
disposed of.
IsHandleCreated Gets a value indicating \Vhether tl1e control has a
hru1dle associated with it.
lsMirrored Gets a value indicating \vhether the co11trol is
mirrored.
Layou tEngine Gets a cached instance of the control's layout engine.
Left Gets or sets the distance. in pixels. benveen the left
edge of the control and the left edge of its container's
client area.
Location Gets or sets the coordinates of the upper-left comer of
the control relative to the upper-left comer of its
container.
Margin Gets or sets the space between controls.
MaximumSize Gets or sets the size that is the upper limit that
GetPreferredSize can specify.
MinExtra Gets or sets the minimum distance that must remail1
between the splitter control and the edge of the
opposite side of tl1e container (or the closest control
docked to that side). Splitter.MinExtra has been
replaced by similar properties in
Sy stein.Windovvs.Forms. SplitContainer and is
provided only for co1npatibility with previous
versions.
MinimumSize Gets or sets the size that is the lower Jimit that
GetPrefe1TedSize can specify.
MinSize Gets or sets the minimum distance that must remain
between the splitter control and tl1e container edge
that the control is docked to. Splitter.MinSize lias
been replaced by SplitContaiI1er.PanellMinSize and
SplitContainer.Panel2MinSize ru1d is provided only
for compatibility with previous versions.
Name Gets or sets the name of the control.
Padding Gets or sets padding withil1 the control.
480 I PowerShell Studio - A Comprehensive Guide

Parent Gets or sets the parent container of the control.


PreferredSize Gets tl1e size of a rectangular area into which the
control can fit.
ProductN ame Gets the product nan1e of the asse111bly containing the
control.
ProductVersion Gets the version of the assembly containing the
control.
RecreatingHandle Gets a value indicating whether the control is
currently re-creating its handle.
Region Gets or sets the "vindovv region associated with the
control.
RenderRightToLeft Obsolete.This property is no,;v obsolete.
ResizeRedraw Gets or sets a value indicating whether the control
redraws itself when resized.
Right Gets the distance, in pixels, between the rigl1t edge of
the control and the left edge of its container's client
area.
RightToLeft Gets or sets a value indicating "vhether control's
elements are aligned to support locales using tight-to-
left fonts.
ScaleChildren Gets a value that determines the scaling of child
controls.
Show FocusCues Gets a value indicating ,;vhether the control should
display focus rectangles.
Sho\v Keyboard Cues Gets a value indicating wbetl1er the user interface is in
the appropriate state to show or hide keyboard
accelerators.
Site Gets or sets the site of the control.
Size Gets or sets the l1eight and width of the control.
SJJlitPosition Gets or sets the distance between the splitter control
and the container edge that tl1e control is docked to.
Splitter.SplitPosition has been replaced by
SplitContainer.Panel lMinSize and
SplitContainer.Panel2MinSize and is provided only
for compatibility "vith previous versions.
Tablndex Gets or sets the tab order of the control "vithin its
container.
TabStop This API supports the product iilfrastn1cture and is not
intended to be used directly fro1n your code. This
Q!Operty is not relevant to tllis class.
Tag Gets or sets the object that contains data about the
control.
Text Tllis API supports tlle product infrastn1cture and is not
intended to be used directly from your code. This
property is not relevai1t to this class.(Overrides
Control.Texi .)
Top Gets or sets the distance, in pixels" between tl1e top
edge of the control and the top edge of its container's
client area.
PowerShell Studio - Reference Guide I 481

TopLevelControl Gets the parent control that is not parented by another


Windows Forms control. Typically, this is the
outermost Form that the control is contained in.
UseW aitCursor Gets or sets a value indicating whether to use the wait
cursor for tl1e current control and all child controls.
Visible Gets or sets a value indicating whether the control and
all its child controls are dis_played.
Width Gets or sets the width of the control.
Window Target This API supports the product infrastructtrre and is not
intended to be used directly fro1n your code. This
property is not relevant for this class.

STATUSBAR

PROPERTY DESCRIPTION
ActualHeight Gets the rendered height of this element.
ActualWidth Gets the rendered width of this ele1nent.
AllowDro1> Gets or sets a value indicating whether this eleme11t
can be used as the target of a drag-and-drop operation.
This is a dependency property.
Alternation Count Gets or sets the nmnber of alten1ating item containers
in the Ite1nsControl, ivhich enables alten1ating
containers to have a unique appeara11ce. (hlherited
from ItemsControl.)
AreAoyTouchesCa1>tu red Gets a value that indicates whether at least one touch
is captured to this element.
AreAnyTouchesCapturedWithin Gets a value that indicates 'hether at least one touch
is capttued to this elen1ent or to any child ele1nents in
its visual tree.
AreAnyTouchesDirectlyOver Gets a value that indicates whether at least one touch
is pressed over this element.
AreAnyTouchesOver Gets a value tliat indicates whether at least one touch
is pressed over this element or any clrild elements i11
its visl1al tree.
Background Gets or sets a brusl1 that describes tl1e background of a
control
BindingGrou Jl Gets or sets the BindingGroup tliat is used for the
element.
BitmapEffect Obsolete.Gets or sets a bitmap effect that applies
directly to the rendered content for this element. This
is a dependency property.
Bitm apEJ'fectln1>ut Obsolete. Gets or sets an input source for the bitmap
effect that applies directly to tl1e rendered co11te11t .for
this element. This is a dependency property.
BorderBrush Gets or sets a brush that describes t11e border
background of a control.
BorderThickness Gets or sets the border thickness of a control.
482 I PowerShell Studio - A Comprehensive Guide

CacheMode Gets or sets a cached representation of the UIElement.


CJip Gets or sets the geometry used to define tl1e outline of
the contents of an element. This is a dependency
property .
CJipToBouncls Gets or sets a value indicating whether to clip the
content of tllis ele111ent (or content coming fro1n the
child elements of this element) to fit into tl1e size of
the containing element. Tlris is a dependency
property.
CommandBinclings Gets a collection of ConnnandBinding objects
associated with tllis ele1nent. A CommandBinding
enables command handling for this eleme11t, and
declares the linkage betvveen a conuikmd, its events,
ai1d tl1e handlers attached by this element.
ContextMenu Gets or sets t11e context 1nenu ele1nent that should
appear \Vhenever the context n1enu is requested
through user interface (UI) from \;vithin this element.
Cursor Gets or sets the cursor that displays \Vhen the 1nouse
pointer is over this ele1nent.
DataContext Gets or sets the data context for an element wl1en it
participates in data binding.
DefaultStyleKey Gets or sets the key to use to reference the style for
this control, when theme styles are i1sed or defined.
DepcndencyObjcctType Gets the DependencyObjectType that wraps the CLR
type of this instance. (Inl1erited from
DependencyObject.)
DesiredSize Gets the size that this element co1nputed during the
111easure pass of tl1e layout process.
Dis1>atcher Gets the Dispatcher this DispatcherObject is
associated with. (Inherited fron1 DispatcherObject.)
Dis11layMem berPath Gets or sets a patl1 to a value on the source object to
serve as the visual representation of tl1e object.
(Inherited fro 1n Ite1nsControl.)
Effect Gets or sets the bitmap effect to apply to the
UIElement. This is a dependency property.
Flow Direction Gets or sets the direction that text and other user
interface (UI) ele1nents flo\V witlrin any parent
ele1nent tllllt controls their layout.
Focusable Gets or sets a value that indicates whether the element
can receive focus. This is a dependency property.
FocusVisualStyle Gets or sets a property that enables customization of
appearance, effects, or other sty le characteristics tllllt
will apply to this element when it captures keyboard
focus.
FontFamily Gets or sets the font fa1nily of the control.
FontSize Gets or sets the font size.
FontStretch Gets or sets the degree to \vhich a font is condensed or
e:Kpanded on the screen.
FontStyJe Gets or sets the font sty le.
PowerShell Studio - Reference Guide I 483

FontWeight Gets orsets the weight or thickness of the specified


font.
ForceCu rso 1 Gets or sets a value that indicates "vhether this
Frame\.vorkElement should force the user interface
(Ul) to render the cursor as declared by the Cwsor
property.
Foreground Gets or sets a brusl1 that describes the foreground
color.
GroupStyle Gets a collection of GroupStyle objects that defiI1e the
appearance of each level of groups. (Inl1erited from
Ite1nsControl.)
GroupStyleSelector Gets or sets a method that enables you to provicle
custon1 selection logic for a GroupStyle to apply to
each group in a collection (111.herited from
lte1nsContro1.)
Han dlesScro Uin.g Gets a value that indicates whether a control supports
scrolling.
HasAnimatedPro11erties Gets a value indicating '\\d1ethe.r this ele1nent has any
animated properties.
HasEffectiveKeyboardFocus Gets a value that indicates ' vhether the UIElement has
focus.
HasItems Gets a value tliat indicates ' vbether the lte1nsControl
contains ite1ns. (Inherited fro1n ItemsControl.)
Height Gets or sets the suggested height of the elen1e11t.
HorizontalAlignment Gets or sets the horizontal aligmnent characteristics
applied to this element when it is composed \.Vithin a
parent element, such as a panel or items control.
HorizontaIContentAlignment Gets or sets the horizontal alignment of the control's
content.
lnheritanceBehavio r Gets or sets the scope limits for property value
inhe1itance, resource key lookup, and RelativeSource
Find.Ancestor lookup.
lnputBindings Gets the collection of input bindings associated with
this element.
In11utScope Gets or sets the context for input used by this
Fra mevvotkElement.
IsArrangeValid Gets a value indicatiI1g whether the computed size and
positio11 of child ele1nents in this element's layout are
valid.
IsEnabled Gets or sets a value indicating whetl1er this eleme11t is
enabled in tl1e user interface (UI). This is a
dependency property.
lsEnabledCore Gets a value that beco1nes the retu1n value of
IsEnabled i11 derived classes.
lsFocused Gets a value that detennines whether this element has
logical focus. This is a dependency property.
IsGrouping Gets a value that indicates whether the control is using
group~g. (Inherited from ItemsControL)
IsHitTestVisible Gets or sets a value that declares whether this element
can possibly be returned as a hit test result from some
484 I PowerShell Studio - A Comprehensive Guide

portion of its rendered content. This is a dependency


property.
Islnjti alized Gets a value that indicates whether th.is eleme11t has
been initialized, either during processing by a X.AML
processor, or by explicitly having its Endlnit method
called.
Isln11utMethodEnabled Gets a value indicating whether an input method
system, such as an Input Metl1od Editor (Th!fE), is
enabled for processing the input to this element
IsKeyboardFocu sed Gets a value indicating vvhether this element has
keyboard focus. This is a dependency property.
IsKeyboardFocu sWithin Gets a value indicating whether keyboard focus is
any\-vhere witllin the element or its visttal tree child
elements. This is a dependency property.
IsLoaded Gets a value that indicates whether this elen1ent has
been loaded for presentation.
IsManj11uJationEnab led Gets or sets a value tl1at indicates vvhether
manipulation events are enabled on tllis UIElement.
lsMeasureValid Gets a value iJ1dicating whether the current size
returned by layout measure is valid.
IsMouseCaptured Gets a value indicating whether the mouse is captured
to this elernent. This is a dependency property.
lsMouseCa11tureWithio Gets a value that detennines whether inouse capture is
held by this element or by child elements in its visual
tree. This is a dependency property .
IsMouseDirectl:vOver

Gets a value that indicates \Vhether the position of the
mouse pointer corresponds to hit test reSttlts, wllich
take element compositing into acco1mt. This is a
dependency property.
IsMouseOver Gets a value indicating \vhether the mouse pointer is
located over tltls ele1nent (including child elements in
the visual tree). Tltls is a dependency property.
IsScaled Gets a value that indicates whether tltls instance is
currently sealed (read-only). (lnherited from
DependencyObject.)
IsStylusCaptured Gets a value indicating vv hether the stylus is capt1rred
by this element. This is a dependency property.
IsS tylusCa11tu reWithin Gets a value that determines whether stylus capture is
l1eld by this element, or an element within the ele1nent
bounds and its vist1al tree. This is a dependency
property.
IsS tylu sDirectlyOver Gets a value that indicates whether the stylus position
co1Tesponds to hit test results, '\ hich take element
compositing into account. This is a dependency
prope11y.
lsStylusOver Gets a value indicating whether the stylus cursor is
located over tllis element (including visual cllild
elements). This is a dependency _property.
IsTabStop Gets or sets a value that indicates ,;vhether a control is
included in tab navigation.
PowerShell Studio - Reference Guide I 485

lsTextSearcbCaseSensitive Gets or sets a value that indicates wl1ether case is a


condition when searching for items.(Inherited from
Ite1nsControl.)
IsTextSearchEnabled Gets or sets a value that indicates whether TeA'tSearcb
is enabled on the Ite11lSControl instance. (Inherited
from ltemsControl.)
IsVisible Gets a value indicating \hether this element is visible
in the user iJ1terface (UT). This is a dependency
property.
ItemBindingGrou11 Gets or sets the BindingGroup that is copied to each
ite111 in the Iten1sControl.(lnherited from
Ite1nsControl.)
ltemContainerGenerator Gets the ItemContainerGenerator that is associated
vvitl1 the control. (Inherited from ItemsControl.)
ltemContainerStyle Gets or sets the Style that is applied to the container
element generated for each item. (Inherited from
ItenlSControl.)
ItemContainerStyleSelector Gets or sets custom style-selection logic for a style
that can be applied to each generated container
element. (Inherited fron1 ItemsControl.)
ItemContainerTemplateSelector Gets or sets the custom logic for choosing a template
used to display each ite1n.
Items Gets the collection used to generate the content of the
Ite1nsControl.(lnherited from ltemsControl.)
ltemsPanel Gets OT sets the te1nplate that defines tl1e panel that
controls the layout of items. (l11herited from
lte1nsControl.)
ItemsSource Gets or sets a collection used to generate the content
of the ItemsControl. (Inherited from ItemsControl.)
ItemStringFormat Gets OT sets a composite string that specifies hovv to
fonnat the items in the Items Control if they are
displayed as strings.(Inherited frorn lte1nsControl.)
ItemTemplate Gets or sets the DataTemplate used to display each
item. (lnl1erited fron1 ItenlSControl.)
Item Tern plateSelecto r Gets or sets the custom logic for choosing a template
used to display eacl1 item. (Inherited fTom
Ite1nsControl.)
Language Gets or sets localization/globalization la11guage
information that applies to an element.
LayoutTransform Gets or sets a graphics transformation that shottld
apply to this element \Vhen layout is petfonned.
LogicalChildren Gets an enmnerator for the logical child objects of the
Ite1nsControl object. (Inherited fron1 ItemsControl.)
Margin Gets or sets the outer margin of an element.
Max Height Gets or sets the maximum height constraint of the
element.
MaxWidth Gets or sets the max:imutn width co11strdint of the
element.
MinHeigbt Gets or sets the mini1num height constraint of the
element.
486 I PowerShell Studio - A Comprehensive Guide

MinWidth Gets or sets the minimum width constraint of the


element.
Name Gets or sets the identifying 11an1e of the element. Tbe
11ame provides a reference so that code-behind, such
as event hau.dler code, can refer to a markup ele1nent
after it is constructed during processing by a XAML
processor.
Opacity Gets or sets the opacity factor applied to the entire
UIElemeut \Vheu it is rendered in the user interface
(UI). This is a dependency property.
OpacityMask Gets or sets an opacity mask~ as a Bn1sh
implementation that is applied to any alpha-channel
masking for the rendered content of this element. This
is a dependency property.
OverridesDefauJtStyle Gets or sets a value that indicates whether tllis
element incorporates sty le properties fron1 theme
styles.
Padding Gets or sets the padding inside a control.
Parent Gets the logical parent element of tllis ele1nent.
Persistld Obsolete.Gets a value that mliquely identifies this
elem.ent.
RenclerSize Gets (or sets, but see Remarks) the final render size of
tllis ele1nent.
RenclerTransfo rm Gets or sets transfonn inforniation tliat affects the
rendering position of this ele1nent. This is a
dependency property.
RenderTransfo rm Origin Gets or sets the center point of any possible render
tra11sform declared by RenderTransfon1i, relative to
the bounds of tl1e elen1ent. Tllis is a dependency
pioperty.
Resources Gets or sets the locally-defined resource dictionary.
System_CAPS_J>u bp ropertySystem _CAPS_static Separators tyleKey
Sna11sT0DevicePixels Gets or sets a value that determines ,;vhether rendering
for this element should use device-specific pL~el
settings during rendering. This is a dependency
property.
Style Gets or sets the style used by this element \Vhen it is
rendered.
StylusPlu gins Gets a collection of all stylus plug-in (customizatio.n)
objects associated with this element.
Tabind ex Gets or sets a value that detenmnes the order iI1 which
ele1nents receive focus ,;vhen the user navigates
through controls by using the TAB key.
Tag Gets or sets an arbitrary object value that can be used
to store custom information abo11t this element.
Tem11late Gets or sets a control ten1plate.
Te.mplatedParent Gets a reference to the template parent of this
ele1nent. This property is not relevant if the element
was not created through a te1nplate.
PowerShell Studio - Reference Guide I 487

ToolTi1> Gets or sets the tool-tip object that is displayed for


this element in the user interface (Ul).
ToucbesCaptured Gets all touch devices that are captured to this
element.
ToucbesCa1>turedWithin Gets all touch devices that are capt11red to this element
or any child ele1nents in its visual tree.
TouchesDhectlyOver Gets all touch devices that are over this element.
ToucbesOver Gets all touch devices that are over this ele1nent or
any child elements in its visual tree.
Triggers Gets the collection of triggers established directly on
this element, or il1 child elements.
Uid Gets or sets tl1e turique identifier (for localization) for
this element. This is a depe11dency property.
UseLayoutRounding Gets or sets a value that indicates whether layout
rounding should be applied to this element's size and
position during layout.
UsesltemContainerTem1>late Gets or sets a value that indicates whether the menu
selects different ite1n containers, depending on the
type of the item in the underlying collection or so1ne
other heuristic.
VerticalAiignment Gets or sets the vertical alignment characteristics
applied to this ele1nent vv hen it is co111posed vvitlrin a
parent element such as a panel or items control.
VerticalContentAligomeot Gets or sets the vertical alignment of the control's
content.
Visibility Gets or sets tl1e user interface (UI) visibility of tlris
element. This is a dependency property.
VisualBitmapEffect Obsolete. Gets or sets the BitmapEffect value for t11e
Visual.
VisuaJBitmapEffectlnput Obsolete. Gets or sets the BitmapEffectlnput value for
the Visual.
Visu alBitmapScalio gMode Gets or sets the BitniapScalingMode for fue Visual.
VisualCacbeMode Gets or sets a cacl1ed representation of the Visual.
VisualChiJdrenCount Gets the number of visual child ele1nents \itl1in this
element.
Visu alCiearTypeHint Gets or sets tl1e ClearTypeHint lliat detennines how
ClearType is rendered in the Visual.
VisualClip Gets or sets the clip region of the Vistial as a
Geometiy value.
VisualEdgeMode Gets or sets the edge mode of the Visual as an
EdgeMode value.
VisualEffect Gets or sets the bitmap effect to apply to the Visual.
Visua.IOffset Gets or sets the offset value of tlie visual object.
Visual Opacity Gets or sets the opacity of tl1e Visual.
VisualOpacityMask Gets or sets the Brush value that represents the
opacity mask of the Visual.
VisualParent Gets the visual tree parent of the visual object.
Visu alScrollab leAreaClip Gets or sets a clipped scrollable area for tl1e Visual.
488 I PowerShell Studio - A Comprehensive Guide

VisuaJTextHintingMode Gets or sets the Tex1HintingMode of the Visual.


VisuaJTextRenderingMode Gets or sets th.e TextRenderingMode of the Visual.
Visual Transform Gets or sets the Transfonn value for the Visual.
VisuaJXSnappingGuideJines Gets or sets the x-coordinate (vertical) guideline
collection.
VisuaJYSna11piogGuideJines Gets or sets they-coordinate (horizontal) guideline
collection.
Width Gets or sets the widt11 of the element.

STATUSSTRIP

PROPERTY DESCRIPTION
--
AccessibilityObject
--
Gets the AccessibleObject assigned to the control.
AccessibleDefaultActionDesc1;ption Gets or sets the default action description of tJ1e
control for use by accessibility client applications.
Accessib leDesc ri 1>tion Gets or sets the description of the control used by
accessibility client applications.
AccessibleName Gets or sets the name of the control used by
accessibility client applications.
J\ccessibleRole Gets or sets the accessible role of the control
Allo,vDrop Gets or sets a value indicating whether diag-and-drop
and item reorderiI1g are handled through events that
you i1nple1nent.
AllowItemReorder Gets or sets a value indicating whether drag-and-drop
and item reordering are handled privately by the
ToolStrip class.
Allow Merge Gets or sets a value indicating \Vhether 1n1tltiple
MenuStrip, ToolStripDropDownMenu,
ToolStripMenultem, and other types can be
combined.
Anchor Gets or sets the edges of tlie container to which a
ToolStrip is bound and detenniI1es how a ToolStrip is
resized ,;vith its parent.
AutoScroll Tllis API supports the product i11frastn1cture and is not
intended to be used directly fro in your code. This
property is not relevant for this class.
AutoScrollMargin Thls API supports tlle product illfrastructure aud is not
intended to be used directly from your code. This
property is not relevant for this class.
AutoScrollMinSize This API supports the product infTastructure a11d is not
intended to be used directly from your code. Tllis
property is not relevaut for this class.
AutoScrollOffset Gets or sets \Vhere this control is scrolled to in
ScrollControllntoView.
AutoScroUPosition Tllis API supports the product infrastructure aud is not
intended to be used directly fron1 your code. Tllis
property is not relevant for this class.
PowerShell Studio - Reference Guide I 489

Auto Size Gets or sets a value indicating \:vhether the control is


automatically resized to display its entire co11tents.
BackCoJor This API supports the product infrastt11cture and is not
intended to be used directly from your code. Gets or
sets tl1e backgrom1d color for the ToolStrip.
Backgrouncllmage Gets or sets the background image displayed in the
control.
BackgroundimageLayout Gets or sets the background. itnage layout as defined.
in tl1e ImageLayo11t enumeration.
Bin dingContext Gets or sets the binding conteA't for the ToolStrip.
Bottom Gets the distance, iI1 pixels, bet\veen the bottom edge
of the control and the top edge of its container's client
area.
Bounds Gets or sets the size and location of the control
incl11ding its nonclient elements, in pixels, relative to
the pare11t control.
CanEnablelme Gets a value indicating vvhether the In1eMode
property can be set to an active value, to enable IME
support.
CanFocus Gets a value indicati11g ,;vhether the co11trol cai1
receive focus.
CanOverflolv Gets or sets a value indicating whether tl1e StatusStrip
supports over.flow fm1ctionality .
C anRaiseEvents Determines if events can be raised on the control.
CanSelect Gets a value indicating \vhether tl1e control can be
selected.
Capture Gets or sets a value indicating 1vhether tl1e control has
captured the inouse.
CausesValidation Gets or sets a value indicating whether the ToolStrip
causes validation to be performed on any controls that
req11ire validation vv.hen it receives focus .
ClientRectangle Gets the rectangle that represents the client area of the
control.
ClientSize Gets or sets the height and widtl1 of the client area of
the contTol.
Com11anyN ame Gets the name of tl1e company or creator of the
application containing the co11trol.
Container Gets the !Container that contains the Component.
ContainsFocus Gets a value indicating \>V hether the co11trol, or 011e of
its child controls, currently has the input focus.
Conte~'tMenu Gets or sets the shortcut menu associated with the
control.
ContextMenuStrip Gets or sets the ContextMenuStrip associated with
this control.
Controls This API supports the product infrastructure and is not
intended to be used directly from your code. This
property is not relevant for tlris class.
Created Gets a value indicating whether the co11trol has been
created.
490 I PowerShell Studio - A Comprehensive Guide

CreateParams Gets the required creation para1neters when the


control handle is created.
Cursor Gets or sets the cursor that is displayed when the
mouse pointer is over the ToolSttip.
DataBindings Gets the data bindings for tl1e control.
DefaultCursor Gets or sets the default cursor for the control.
DefaultDock Gets wh.ich borders of tl1e Stanis Strip are docked to
the Too1St1ipContainer. (Overrides
ToolStrip.DefaultDock.)
DefaultDropDownDirection Gets or sets a value representing the default direction
in which a ToolStripDropDo,;vn control is displayed
relative to tl1e ToolStrip.
DefaultGripMargin Gets the default spacing, in pixels, bet1veen the sizing
grip and the edges of the ToolStrip.
DefaultlmeMode Gets the default Input Metl1od Editor (IJ\.1E) 1uode
supported by tl1e control.
DefaultMargin Gets the spacing, in pixels. between the ToolStiip and
the ToolStripContainer.
Def aultMaximumSize Gets the length and height, il1 pixels, that is specified
as the default maximum size of a control.
DefaultMinimumSize Gets the length and height, in pixels, that is specified
as the default minin1un1 size of a control.
DefaultPadding Gets the spaciI1g, in pixels, benvee:rn the left, right, top,
and bottom edges of the Status Strip from the edges of
the fonn.(Overrides ToolStrip.DefaultPadding.)
DefaultShowItem ToolTips Gets a value indicating ' vhether ToolTips are shown
for tl1e Stah1sStlip by default.(Overrides
ToolStrip.DefaultShowltemToolTips.)
Defau ItSize Gets the size, in pixels, of the StatusStrip when it is
first created.(Overrides ToolStrip.DefaltltSize.)
Design Mode Gets a value that indicates vvhether tl1e Component is
currently in design mode.
Displayedltems Gets the subset of items that are currently displayed
on the ToolStrip, including items that are
automatically added into the ToolStrip.
Dis11IayRectangle This API supports the product infrastructure and is not
intended to be used directly fro1n your code. Retrieves
the cu1Tent display rectangle.
Disposing Gets a value indicating vvhether the base Control class
is in the process of disposing.
Gets or sets which StatusStrip borders are docked to
its parent control and determines how a StatusSttip is
resized with its parent.(Ovenides ToolStrip.Dock.)
DockPadding Gets the dock padding settings for all edges of the
control.
DoubleBuffered Gets or sets a value indicating whetl1er this control
should redraw its surface using a secondary buffer to
reduce or prevent flicker.
Enabled Gets or sets a value indicating whether the control can
respond to user interaction.
PowerShell Studio - Reference Guide I 491

Events Gets the list of event handlers that are attached to this
Component.
Focused Gets a val11e indicati11g whether the co11trol has input
focus.
Font Gets or sets the font used to display text il1 tl1e co11trol.
FontHeight Gets or sets the heigl1t of the font of the control.
ForeColor Gets or sets t11e foreground color of tl1e ToolStrip.
Gri1>Dis11JayStyle Gets the orientation of the ToolStrip move handle.
GripMargin Gets or sets the space around the ToolStrip 111ove
J1andle.
GripRectangle Gets the boundaries of the ToolStrip move hru1dle.
GripStyle Gets or sets the visibility of tl1e grip used to reposition
the control.
Handle Gets the \;vindow handle that the control is bound to.
Has Children This API supports the product infrastructure ru1d is not
intended to be used directly fro1n your code. This
property is not relevant for this class.
Height Gets or sets the heigl1t of the co11tro1.
HorizontaJScroll Tllis API suppo1ts tl1e product infrastructure and is not
intended to be used directly fron1 your code. This
property is not relevant for tllis class.
HScroll Gets or sets a value indicating whether the horizontal
scroll bar is visible.
ImageList Gets or sets the in1age list that contains the ilnage
displayed on a ToolStrip item.
lmageScalingSize Gets or sets tl1e size, in pixels, of ai1 image used on a
ToolStrip.
ImeMode Gets or sets the Input Method Editor (IME) n1ode of
the control.
ImeModeBase Gets or sets the IME mode of a control.
InvokeRequired Gets a value indicati11g ,;v hethe-r the caller n1ust call an
invoke inethod when 1naking method calls to the
control because the caller is on a different thread than
tl1e one the control vvas created on.
IsAccessible Gets or sets a value indicating whether the control is
visible to accessibility applications.
Is CurrentlyDragging Gets a value indicating \\i hether the user is currently
1noving tl1e ToolStiip from. one ToolStripContainer to
another.
IsDisposed Gets a value indicating ,;vhether the control has been
disposed of.
Gets a value indicating 'vhetlter a ToolStrip is a
ToolStripDropDown control.
IsHandleC reated Gets a value indicati11g \hether the co11trol has a
haildle associated with it.
lsMirrored Gets a value indicating whether the control is
mirrored.
492 I PowerShell Studio - A Comprehensive Guide

Items Gets all the items that belong to a ToolStrip.


LayoutEogine Passes a reference to the cached LayoutEngine
returned by the layout engine interface.
LayoutSettin gs Gets or sets layout schen1e characteristics.
LayoutStyle Gets or sets a value indicating how the StatusStrip
lays out the items collection.
Left Gets or sets the distance, i11pixels, bet,veen the left
edge of the control and the left edge of its container's
client area.
Location Gets or sets the coordinates of the upper-left corner of
tl1e control relative to tl1e upper-left con1er of its
container.
Margin Gets or sets the space bet\;veen controls.
Ma.runumSize Gets or sets the size that is the upper li1nit that
GetPreferredSize can specify.
MaxltemSize Gets the n1axiiuum 11eight and \vidtli, in pixels, of the
ToolStrip.
MinimumSize Gets or sets the size tl1at is tl1e lower limit Uiat
GetPreferredSize can specify.
Name Gets or sets the na1ne of tl1e control.
Orientation Gets the orientation of the ToolStripPanel.
Overflo'vButton Gets the ToolStripltem tlIBt is the overflow button for
a ToolStrip vvith overflow enabled.
Padding This API supports the product iufrastn1cture and is not
intended to be used directly fro111 your code. This
property is not relevant for this class.
Parent Gets or sets the parent container of tbe control.
PreferredSize Gets the size of a rectangular area into "'.hich the
control can fit.
ProductN ame Gets the product name of the assembly co11taining the
control.
ProductVersion Gets the version of the assen1bly containing the
control.
RecreatingHancUe Gets a value indicating ,vhether the control is
currently re-creating its handle.
Region Gets or sets the 'vindow region associated with the
control.
Renderer Gets or sets a ToolStripRenderer used to customize
the look and feel of a Too1Strip.
RenderMode Gets or sets a value that indicates which visual styles
'vill be applied to tl1e ToolStrip.
Rende1RightT0Left Obsolete.This property is novv obsolete.
ResizeRedraw Gets or sets a value indicating whether the control
redra,;vs itself when resized.
Right Gets the distance, in pixels, beween the rigl1t edge of
the control and the left edge of its container's client
area.
PowerShell Studio - Reference Guide I 493

RightToLeft Gets or sets a value indicating whether control's


elements are aligned to support locales using 1igl1t-to-
left fonts .
ScaleChildren Gets a value that detennines the scaling of child
controls.
ShowFocusCues Gets a value indicating whether the co11trol should
display focus rectangles.
ShowItemToolTi11s Gets or sets a value indicating whether ToolTips are
shown for the StatusStrip.
ShowKeyboard Cues Gets a value indicating whether the ltser interface is in
tl1e appropriate state to show or hide keyboard
accelerators.
Site Gets or sets the site of the control.
Size Gets or sets the height and ':vidtb of the control.
SizeGripBouncls Gets the boundaries of the sizing handle (grip) for a
Status Strip.
SizingGrip Gets or sets a value indicating \Vhether a sizing handle
(grip) is displayed in the lo,ver-right comer of the
control.
Stretch Gets or sets a vall1e indicating whether the StatusStrip
stretches from end to end in its container.
Tabindex Gets or sets the tab order of the control within its
container.
TabStop Gets or sets a value indicating whetl1er the user can
give the focus to an ite1n in the ToolStrip using the
TAB key.
Tag Gets or sets tl1e object that contains data about the
control.
Text Gets or sets the text associated v1ith this control.
TextDirection Gets or sets the direction in which to dravv text on a
ToolStrip.
Top Gets or sets tl1e distance, in pixels, between fue top
edge of the control and the top edge of its co11tainer's
client area.
To11LevelControl Gets the parent control that is not parented by another
Windows Fonns control. Typically, tlris is the
outermost Forn.1 tliat the control is contained in.
UseWaitCursor Gets or sets a value indicating whether to use the "''ait
cursor for the current control ailJ.d all child controls.
VerticalScroU This API supports the product infrastructtue and is not
intended to be used directly fron1 yo1u code. Tlris
property is not relevant for this class.
Visible Gets or sets a value indicating whether the control and
all its child co11trols are displayed.
VScroll Gets or sets a value indicating whether the vertical
scroll bar is visible.
Width Gets or sets the width of the control.
494 I PowerShell Studio - A Comprehensive Guide

Window Target This API supports the product infrastn1cture and is not
intended to be llSed directly from your code. This
property is not relevant for this class.
TABCONTROL

PROPERTY DESCRIPTION
Accessib.ilityObject Gets the AccessibleObject assigned to the control.
AccessibleDefaultActionDescription Gets or sets the default action description of the
control for use by accessibility client applications.
AccessibleDescri1>tion Gets or sets the description of the control used by
accessibility client applications.
AccessibleN a.me Gets or sets the name of the control used by
accessibility client applications.
AccessibleRole Gets or sets the accessible role of the control
Alignment Gets or sets the area of the control (for example, along
the top) where the tabs are aligned.
Gets or sets a value indicating vvhether the control can
accept data that tbe user drags onto it.
Anchor Gets or sets the edges of tl1e container to vvbich a
control is bou11d and detennines how a control is
resized '.vith its parent.
AJ>pearance Gets or sets the visual appearance of tl1e co11trol's tabs.
AutoScrollOffset Gets or sets where this control is scrolled to il1
ScrollControllntoView.
Auto Size This API supports the product hlfrastn1ctlrre and is not
intended to be used directly fro1n your code. This
property is not relevai1t for this class.
BackCo.l or This API supports tl1e product infrastructure and is not
intended to be used directly from your code. This
n1ember is not n1eaitingful for this control.(Overrides
Control.BackColo r. )
Backgroundlmage This API supports the product infrastructure and is not
intended to be used directly from your code. This
n1ember is not n1eailli1gful for this control.(Overrides
Co11trol.Backgroundl1nage.)
BackgroundlmageLayout This API supports the product infrastn1cture and is not
intended to be used directly fro1n your code. Tlris
n1e1nber is not meairingful for this control.(Overrides
Contro l.BackgroundimageLayout.)
Bin dingContext Gets or sets the BindingContext for the control.
Bottom Gets the distance, in pixels, between tl1e botto1n edge
of the control ai1d the top edge of its container's client
area.
Bounds Gets or sets the size and location of the control
including its nonclient elements, in pixels relative to
the parent control.
PowerShell Studio - Reference Guide I 495

CanEnablelme Gets a value indicating whether the I1neMode


property can be set to an active value, to enable IME
suppo11.
CanFocus Gets a value indicati.I1g ,;vhether the co11trol can
receive focus.
CanRaiseEvents Detenni nes if events can be raised on the control.
CanSelect Gets a value indicating 'vhethe[ the control can be
selected.
Capture Gets or sets a value indicating whether the control has
captured the 1nouse.
CausesValidation Gets or sets a value indicating whether the control
causes validation to be perfonued on any controls that
require validatio11 wl1en it receives focus .
ClientRectan gle Gets the rectangle tl1at represents the cbent area of the
control.
ClientSize Gets or sets the height and \Vidth of the client area of
the control.
Com1>anyName Gets the name of tl1e company or creator of the
application containing tl1e control.
Container Gets the IContainer that contains the Component.
ContainsFocus Gets a value indicati.I1g 'vbether the control, or one of
its child controls, currently has the input focus.
ContextMenu Gets or sets the shortcut n1enu associated with the
control.
ContextMenuStrip Gets or sets the ConteA1MenuStrip associated with
this control.
Controls Gets the collection of controls contained within the
control.
Created Gets a value indicating \Vhether the co11trol has been
created.
CreateParams This API s11pports the product infrastruchue and is not
intended to be used directly from your code. This
member overrides Control. CreateParams. (Overrides
Control. CreateParams.)
Cursor Gets or sets tlle cursor that is displayed when the
mouse pointer is over tlle control.
DataBindings Gets the data bindings for the control.
DefaultCu rsor Gets or sets the defattlt c1usor for the control.
DefaultlmeMode Gets the default Input Method Editor (lME) mode
Sltpported by tlle control.
Defau ltMargin Gets the space, in pixels, that is specified by default
between controls.
DefaultMaximumSize Gets the length and height, in pi..,.els, that is specified
as tlle default maxin1um size of a control.
DefaultMinimumSize Gets the length and height, iI1 pixels, that is specified
as tlle defattlt mini1n11m size of a control.
DefaultPadding Gets the internal spacing. in pixels. of the contents of
a control.
496 I PowerShell Studio - A Comprehensive Guide

DefaultSize Gets the default size of the co11trol.(Overrides


Contro l.D efaultSize.)
DesignModc Gets a value that indicates whether the Component is
ct1.rrently in design mode.
Dis11I ay Rectangle Gets the display area of the co11tro l's tab
pages. (Ovenides Control. DisplayRectangle.)
Dis11osing Gets a value indicating '\ivhether the base Control class
is in the process of disposing.
Dock Gets or sets vvhich control borders are docked to its
parent control and detemlines how a control is resized
with its parent.
DoubleBuffered This API supports the product infrastn1cn1re and is not
intended to be used directly from your code. This
member is not meaningful for this control.(Overrides
Contro l.DoubleBuffered.)
DrawMode Gets or sets the way that the control's tabs are draw11.
Enabled Gets or sets a valne indicating 'vhether the control can
respond to user interaction.
Events Gets the list of event handlers that are attached to this
Con1ponent.
Focused Gets a value indicating \Vhether the control has illput
focus.
Font Gets or sets the font of the text displayed by the
control.
FontHeight Gets or sets the height of the font of the control.
ForeColor This API supports the product infrastructure and is not
intended to be used directly fron1 your code. This
nlember is not meaningful for this control.(Overrides
Control.ForeColor.)
Handle Gets the windo'v handle that the control is bound to.
Has Children Gets a value indicating whether the control contains
one or _more child controls.
Height Gets or sets the height of the control.
HotTrack Gets or sets a value indicating whether the control's
tabs chai1ge in appearance when the mouse passes
over them.
ImageList Gets or sets the images to display on the control's
tabs.
ImeMode Gets or sets the Input Method Editor (IME) rnode of
the control.
ImeModeBase Gets or sets the IME n1ode of a control.
Invol<eRequirecl Gets a value indicating 'vhether the caller mltst call an
i11voke n1etl1od ' vhen making n1ethod calls to tl1e
control because the caller is on a different thread than
the one the control ,;vas created on.
IsAccessible Gets or sets a value indicating whether the control is
visible to accessibility applications.
IsDisposed Gets a value indicating whether the control has been
disposed of.
PowerShell Studio - Reference Guide I 497

lsHandleCreated Gets a value indicating whether the control has a


handle associated with it.
IsMirrored Gets a value indicating wl1ether the control is
mi1rored.
ItemSize Gets or sets the size of the control's tabs.
Layou tEngi ne Gets a cached instance of the control's layout engine.
Left Gets OT sets the distance, in pixels, betvveen the left
edge of the control and the left edge of its co11tainer's
client area.
Location Gets or sets the coordiiiates of tl1e upper-left comer of
the control relative to the upper-left corner of its
container.
Margin Gets or sets the space between controls.
MaximumSize Gets or sets the size that is the upper limit tliat
GetPreferredSize can specify.
MinimumSize Gets OT sets the size that is the lovver li1nit that
GetPreferredSize can specify.
Multiline Gets or sets a value indicating whether more than one
ro\v of tabs ca11 be displayed.
Name Gets or sets the name of the control.
Padding Gets or sets tl1e amount of space around each ite1n on
the control's tab pages.
Parent Gets or sets the parent contaiI1er of the control.
PreferredSize Gets the size of a rectangttlar area into vvlrich the
control can fit.
ProcluctName Gets the product naine of the asse1nbly contailring the
control.
ProductVersion Gets the version of the assembly contai1ring the
control.
Recreatin gHand le Gets a value indicating 'vhether the control is
currently re-creating its handle.
Region Gets or sets the 'vindow region associated vvith the
control.
RenderRigbtToLeft Obsolete.This property is now obsolete.
ResizeRedra\v Gets or sets a value indicating whether fue control
redra\vs itself when resized.
Right Gets the distance, in pixels, betwee11 tl1e right edge of
the control and the left edge of its container's client
area.
RightToLeft Gets or sets a value iI1dicating whether control's
elements are aligned to suppo1t locales using right-to-
left fonts.
RigbtToLeftLayout Gets or sets a val11e indicating whether right-to-left
mirror placement is turned on.
RolvCount Gets the number of ro'vs tliat are currently being
displayed in the control's tab strip.
ScaleCbiJdren Gets a value that detennines tl1e scaling of child
controls.
498 I PowerShell Studio - A Comprehensive Guide

Selectedlndex Gets or sets the index of the curre11tly selected tab


page.
Selected Tab Gets or sets the currently selected tab page.
Show FocusCues Gets a value indicating whether the control should
display focus rectangles.
Sho\vKeyboard Cues Gets a value indicating whether the user interface is in
the appropriate state to show or hide keyboard
accelerators.
ShowToolTips Gets or sets a value indicating vvhether a tab's ToolTip
is sho\Vll when the mouse passes over the tab.
Site Gets or sets the site of the co11trol.
Size Gets or sets the height and width of the control.
SizeMode Gets or sets the \;vay that the co11trol's tabs are sized.
TabCount Gets the nun1ber of tabs in the tab strip.
TabIndex Gets or sets the tab order of the control within its
container.
TabPages Gets the collection of tab pages in this tab control.
TabStop Gets or sets a value indicatiI1g vvhether the user can
give the focus to this control using the TAB key.
Tag Gets or sets the object that contains data about the
control.
Text This API supports the product infrastn1cture and is not
intended to be used directly fro~n your code. This
inember is not meaningful for tlris control.(Overrides
Control.Text.)
Top Gets or sets the distance, in pixels, between the top
edge of the control and the top edge of its container's
client area.
TopLevelControl Gets the parent control that is not parented by another
Windows Forms control. Typically, this is the
outermost Form tliat the control is contained in.
UseW aitCu rsor Gets or sets a value indicating \hether to use the \ait
cursor for the cunent control and all child co11trols.
Visible Gets or sets a value indicating whet11er the control and
all its child controls are displayed.
Width Gets or sets the \-Vidth of the control.
Windo\vTa..get This API supports the product infra.stn1cture and is not
intended to be used directly fro1n your code. This
property is not relevant for this class.

TABLELAYOUTPANEL

PROPERTY DESCRIPTION
AccessibilityOb ject Gets the AccessibleObject assigned to tl1e control.
PowerShell Studio - Reference Guide I 499

AccessibleDefaultActionDescription Gets or sets the default action description of tl1e


control for ltse by accessibility client ap_plications.
AccessibleDescription Gets or sets the description of the control used by
accessibility client aplications.
AccessibleNaine Gets or sets tl1e nan1e of th.e co11trol used by
accessibility client applications.
AccessibleRole Gets or sets the accessible role of the control
AllowDro1> Gets or sets a value indicating 'vhether the control can
accept data that the user drags onto it.
Anchor Gets or sets the edges of the container to which a
control is bound and determines how a control is
resized with its parent.
Auto Scroll Gets or sets a value indicating whether the contait1er
enables the user to scroll to any controls placed
outside of its visible boundai-ies.
AutoScrollMargin Gets or sets the size of the auto-scroll margin.
AutoScrolJMinSize Gets or sets tJ1e miniJnmn size of the auto-scroll.
AutoScrollOffset Gets or sets \here this control is scrolled to in
ScrollC011trollntoVie\.v.
AutoScrollPosition Gets or sets the location of tl1e auto-scroll position.
AutoSize Gets or sets a value that illdicates \Vhether the control
resizes based on its contents.(Inherited fro1n Panel)
AutoSizeMode Indicates the automatic sizing bel1avior of the
control.(Inherited fro1n Panel.)
BackColor Gets or sets the background color for the control.
Backgrouncllmage Gets or sets the background in1age displayed in the
control.
Backgrou ndlm.ageLayou t Gets or sets the background i1nage layout as defined
in the ImageLayout enumeration.
BindingCootext Gets or sets fue BindingContext for the control.
BorderStyle Gets or sets the border style for the panel.
Bottom Gets the distance. in pixels, between the botto1n edge
of the control and tl1e top edge of its container's client
area.
Bounds Gets or sets fue size and location of the control
including its nonclient elements, in pixels, relative to
the parent control.
CanEnablelme Gets a valt1e indicating whether the I1neM.ode
property can be set to an active value, to enable IME
suppo1t.
CanFocus Gets a value indicating whether tl1e co11trol cai1
receive focus.
CanRaiseEvents Determines if events can be raised on the control.
CanSelect Gets a value indicating \:Vhether the control cai1 be
selected.
Capture Gets or sets a value indicating whether the control has
captured the mouse.
500 I PowerShell Studio - A Comprehensive Guide

CausesValidation Gets or sets a value indicating whetl1er the control


causes validation to be perlonned on any controls that
require validation when it receives focus .
CellBo rderStyle
~
Gets or sets the style of the cell borders.
ClientRectangle Gets the rectangle that represents tl1e client area of the
control.
ClientSize Gets or sets the height and width of the clie11t area of
the control.
Column Count Gets or sets the number of columns in the table.
ColumnStyles Gets a collection of coltunn styles for the
TableLayoutPanel.
CompanyName Gets the naine of the company or creator of the
application containing the control.
Container Gets the !Container that contains the Component.
ContainsFocus Gets a value indicating vv hether the control. or one of
its child controls, currently has the input focus.
ContextMenu Gets or sets the shortcut menu associated with the
control.
ContextMenuStrip Gets or sets the Conte>..1MenuStrip associated with
tllis control.
Controls Gets the collection of controls contained within the
TableLayoutPai1el.
Created Gets a value indicating whether the control bas been
created.
CreateParams Gets the required creation paratneters when tl1e
control l1andle is created.(Inherited fro1n Pru.1el.)
Cursor Gets or sets the cursor tl1at is displayed when fue
n1ouse pointer is over the control.
D ataBin din gs Gets the data bindings for the control.
Defau ltCursor Gets or sets the default cursor for the control.
Defau ltlmeMode Gets tl1e default Input Method Editor (IME) inode
supported by tl1e control.
DefaultMargin Gets the space in pixels, that is specified by default
between controls.
DefaultMaximumSize Gets the length ai1d height in pixels that is specified
as the default nlaximlm1 size of a control.
DefaultMinimumSize Gets the length and height, in pixels, that is specified
as the default minimum size of a control.
DefaultPadding Gets the inten1al spacing, in pixels, of tl1e contents of
a control.
DefaultSize Gets the default size of the control.(hlherited fro1n
Panel.)
DesignMode Gets a value that indicates whether tl1e Co1nponent is
Cltrrently in desig11111ode.
Dis1>layRectangle Gets the rectangle that represents tl1e virtual display
area of the control.
Disposing Gets a value indicating \hetl1er the base Control class
is in the process of disposing.
PowerShell Studio - Reference Guide I 501

Dock Gets or sets vvhich control borders are docked to its


parent control and determines 11ow a control is resized
with_its parent.
DockPadding Gets the dock padding settings for all edges of the
control.
DoubJeBuffered Gets or sets a value indicating whether this control
should redraw its surface using a secondary buffer to
reduce or prevent flicker.
Enabled Gets or sets a value indicating \Vl1ether the co11trol ca11
respo11d to user interaction.
Events Gets the list of event handlers that are attached to this
Component.
Focused Gets a val11e indicating whether the control l1as input
focus.
Font Gets or sets the font of the text displayed by the
control.
FontHeight Gets or sets the height of the font of the control.
ForeColor Gets or sets the foreground color of tl1e control.
Gro,vStyle Gets or sets a value indicating whether the
TableLayoutPanel control should expand to
accorru11odate ne\.v cells \vhen all existing cells are
occupied.
Bandle Gets the \Vindo' v handle that tl1e control is bound to.
HasChildren Gets a value indicating \;vhether the control contains
one or niore child controls.
Height Gets or sets the height of the control.
HorizontalScroll Gets the characteristics associated with the horizontal
scroll bar.
BScroll Gets or sets a value indicating whetl1er the horizontal
scroll bar is visible.
lmeMode Gets or sets the Input Method Editor (IJ\1E) 1node of
the control.
ImeModeBase Gets or sets tl1e Itvffi mode of a co11trol.
InvokeRequired Gets a value indicating \;vhether the caller must call an
invoke n1ethod vvhen 111aking method calls to the
control because the caller is on a different thread than
tl1e one the control was created on.
IsAccessible Gets or sets a value indicating whether the control is
visible to accessibility applications.
IsDisposed Gets a value indicating whether tl1e control has been
disposed of.
lsHandleCreated Gets a value indicati11g whether tlie co11trol has a
handle associated with it.
IsMirrored Gets a valt1e in.dicating \vhether the control is
rnirrored.
LayoutEngine Gets a cached instance of the panel's layout
engine. (Overrides Control.LayoutEngine.)
LayoutSettin gs Gets or sets a value representing the table layout
settings.
502 I PowerShell Studio - A Comprehensive Guide

Left Gets or sets the distance, in pixels, between the left


edge of the control and the left edge of its container's
client area.
Location Gets or sets the coordinates of the upper-left comer of
the control relative to tl1e upper-left comer of its
container.
Margin Gets or sets the space between controls.
MaximumSize Gets or sets the size that is the upper limit that
GetPreferredSize can specify.
MinimumSize Gets or sets the size tl1at is the lower limit that
GetPreferredSize can specify.
Name Gets or sets the na1ne of the control.
Padding Gets or sets padding "vitllin the control.
Parent Gets or sets the parent container of the control.
PreferredSize Gets the size of a rectangular area into which the
control can fit.
ProductNa1ne Gets the product ruune of the assembly contai1ling the
control.
ProductVersion Gets the version of t11e assen1bly containing the
control.
Recreatin gHandle Gets a value indicating whether the control is
currently re-creating its handle.
Region Gets or sets the window region associated with the
control.
RenclerRightToLeft Obsolete.TJlis property is now obsolete.
ResizeRedraw Gets or sets a value indicating whether the control
redra,vs itself when resized.
Right Gets the distance, in pixels, behveen the right edge of
the control and the left edge of its container's client
area.
RightToLeft Gets or sets a value indicating whether control's
elen1ents are aligned to support locales using right-to-
left fonts.
RolvCount Gets or sets the number of rows in the table.
RowStyles Gets a collection of ro\V styles for the
TableLayoutPanel.
Scale Children Gets a value that determines the scaling of child
controls.
Show FocusCues Gets a value indicating whether the control should
display focus rectangles.
Show Keyboard Cues Gets a value indicating '\<vhetl1er the user interface is in
the approp1iate state to show or hide keyboard
accelerators.
Site Gets or sets the site of the control.
Size Gets or sets the heigl1t and width of the control
Tablndex Gets or sets the tab order of the control within its
container.
PowerShell Studio - Reference Guide I 503

TabSto11 Gets or sets a value indicating whether tl1e user can


give the focus to this control using the TAB
key.(Inherited fromPanel.)
Tag Gets or sets the object that contains data about the
control.
Text This API supports the product infrastructure and is not
intended to be used directly from your code. This
member is not meaningful for this control.(Inl1erited
from Panel.)
Top Gets or sets the distance, in pixels betvveen the top
edge of the control and the top edge of its container's
client area.
TopLevelControl Gets the parent control that is not pare11ted by another
Windows Forms control. Typically, this is the
outermost Forni that the control is contained in.
UseW aitCu rsor Gets or sets a value indicating "1hether to use tl1e ~vait
cursor for the current control and all child controls.
VcrticalScroJI Gets the characteristics associated with the vertical
scroll bar.
Visible Gets or sets a value indicating \Vhether the control and
all its child controls are displayed.
VScroll Gets or sets a value indicating \.vhether the vertical
scroll bar is visible.
Width Gets or sets the width of the co11trol.
WindolvTarget Tllis API supports the product infrastructure and is not
it1tended to be used directly fro1n your code. This
property is not relevant for this class.

TEXTBOX

PROPERTY DESCRIPTION
AcceptsRetum Gets or sets a value that indicates how the text editing
control responds wl1en the user presses the ENTER
key.
Accepts Tab Gets or sets a value that indicates how tl1e text editing
control responds when tl1e user presses the TAB key.
Actuaffieight Gets the rendered height of tllis element.
ActualWiclth Gets the rendered width of this elernent.
AllowDrop Gets or sets a value indicating whether this element
can be used as the target of a drag-and-drop operation.
This is a dependency property.
AreAnyTouchesCaptured Gets a value that indicates vvhether at least one touch
is captured to this ele1nent.
A:reAnyTouchesCapturedWithin Gets a value that indicates \Vhether at least one touch
is captured to this element or to any child elements in
its visual tree.
AreAnyTouchesDirectlyOver Gets a value that indicates whether at least one touch
is pressed over this elen1ent.
504 I PowerShell Studio - A Comprehensive Guide

AreAnyTouchesOver Gets a value that indicates whether at least one touch


is pressed over this element or any child elements in
its visual tree.
AutoWordSelection Gets OT sets a value that detern1ines \>vhether when a
user selects part of a word by dragging across it with
the mouse, the rest of the \>Vord is selected.
Background Gets or sets a biush that descnbes the background of a
control.
BinclingGroup Gets or sets the BindingGroup that is used for the
element.
BitmapEffect Obsolete. Gets or sets a bitrnap effect that applies
directly to the rendered content for this element. This
is a dependency property.
BitmaJlEffectlnput Obsolete. Gets or sets an input so1uce for the bitmap
effect that applies directly to the rendered content for
this ele1nent. This is a dependency property.
BorclerBrosh Gets or sets a bn1sh that describes the border
background of a control.
Bo rclerThiclrness Gets or sets the border Utickness of a control.
CacheMode Gets or sets a cached representatio11 of the UIEleme11t.
CanRedo Gets a value that indicates whether the most recent
undo action can be redone.
CanUndo Gets a value that indicates \Vhether tl1e most recent
action can be undone.
CaretBrush Gets or sets the brush tl1at is used to paint the caret of
the te:l\.1: box.
Caretlndex Gets or sets the insertio11 positio11 index of the caret.
CharacterCasing Gets or sets ho\v characters are cased \>vhen they are
111anually entered into the text box.
Clip Gets or sets the geometry used to define tl1e outline of
the contents of an ele1nent. This is a dependency
property.
ClipToBounds Gets or sets a value indicating \Vhether to clip the
content of this element (or content conling from the
child elements of tllis elen1ent) to fit into tl1e size of
the containing element. This is a dependency
_property.
CommandBindings Gets a collection of CommandBinding objects
associated witl1 this element. A Co1mna11c1Binding
enables conunand handling for this element, ru1d
declares the Jinkage between a com1nand, its events,
and tl1e hru1dlers attacl1ed by tllis element.
ContextMenu Gets or sets tl1e context menu element that should
appear whenever the context n1enu is requested
through user interface (UI) from within this element.
Cursor Gets or sets the cursor that displays when tl1e mouse
pointer is over this element.
DataContext Gets or sets the data conteA1 for an ele1nent when it
participates in data binding.
PowerShell Studio - Reference Guide I 505

DefaultStyleKey Gets or sets the key to use to reference the style for
this control, when theme styles are used or defined.
Depen dencyOb,icctType Gets the DependencyObjectType that \ivraps tbe CLR
type of this instance. (Inhe1ited fro1n
Dependency Object.)
DesiredSize Gets the size that this element computed during the
measure pass of the layout process.
Gets the Dispatcher tl1is DispatcherObject is
associated with. (Inherited from DispatcherObject.)
Effect Gets or sets the bitmap effect to apply to the
UIEle1nent. This is a dependency property.
ExtentHeigbt Gets the vertical size of the visible content area.
ExtentWidth Gets the horizontal size of the visible content area.
FlowDirection Gets or sets the direction that text and other user
i11terface (UI) elements flo"v within any parent
element that controls their layout.
Focusable Gets or sets a value that indicates whether the eleme11t
can receive focus. This is a depe11dency property.
FocusVisuaJStvJe

Gets or sets a property that enables customization of
appearance, effects, or other style characteristics that
will apply to this element when it captures keyboard
focus.
FontFamily Gets or sets the font family of the control.
FontSize Gets or sets the font size.
FontStretcb Gets or sets the degree to which a font is condensed or
expai1ded on the screen.
FontStyle Gets or sets the font style.
FontWeight Gets or sets t11e weigl1t or thickness of the specified
font.
ForceCursor Gets or sets a value that indicates \vhether this
Frame~1orkEle1ne11t should force the user interface
(UI) to render the cursor as declared by the Cmsor
property.
Foreground Gets or sets a b111sl1 that describes the foreground
color.
Han cllesScrolling Gets a value that indicates whether a co11trol suppo11s
scrolling.
HasAnimatedPro11erties Gets a value indicating \Vhether this element has any
animated properties.
HasEffectiveKeyboardFocus Gets a value that indicates 'vhetl1er the UIElement has
focus.
Height Gets or sets the s11ggested height of the element.
HorizontalAlign:ment Gets or sets the horizontal aligmnent characteristics
applied to this element when it is composed '1vithin a
parent element. such as a panel or items control.
HorizontalContentAlignment Gets or sets the horizontal aligmnent of the control's
conte11t.
HorizontalOffset Gets or sets the horizontal scroill position.
506 I PowerShell Studio - A Comprehensive Guide

HorizontaJScrolIBarVisibility Gets or sets a value that indicates whether a horizontal


scroll bar is shown.
lnh eritauceBeh avior Gets or sets the scope li1nits for property value
inheritance, resource key lookup, and RelativeSource
FindAncestor lookup.
InputBindings Gets the collection of input bindings associated with
this ele1nent
lnputSco1>e Gets or sets the context for input used by this
Framework:Element.
lsArrangeValid Gets a value indicating whether the computed size and
position of child elements in this element's layout are
valid.
lsEnabled Gets or sets a value indicating \hether this elen1ent is
enabled in the user inte1face (UI). This is a
dependency property.
IsEnabledCore Gets a value that becon1es the return value of
IsEnabled in derived classes.
lsFocused Gets a value that determines whether this element has
logical focus. This is a dependency property.
lsHitTestVisible Gets or sets a value tl1at declares whether this element
can possibly be returned as a hit test result fro1n so111e
portion of its rendered content. This is a dependency
property .
IslnactiveSelectiouHigblightEnabled Gets or sets a value tliat indicates whetl1er the text box
displays selected text ,;vhen the text box does not have
focus.
Isin iti alized Gets a value that indicates whether this element has
been initialized, either during processing by a XMv1L
processor, or by eJ\'Plicitly having its Encilnit method
called.
lslnputMetbodEnabled Gets a value indicating whether an input method
system, such as an Input Method Editor (llv1E), is
enabled for processing the input to this element.
lsKeyboardFocu sed Gets a value indicating whether this element has
keyboard focus. This is a dependency property.
IsKeyboardFocusWithin Gets a value indicating vvhether keyboard focus is
anyvvhere witllin the element or its visual tree child
elements. This is a dependency property.
IsLoaded Gets a value that indicates whether this element lias
been loaded for presentation.
IsManipulationEnabled Gets or sets a value that indicates v1hether
manipulation events are enabled on tllis UIElement.
IsMeasu.reValid Gets a value indicating whether the current size
returned by layout measuie is valid.
lsMouseC a1>tu red Gets a value indicating whether the mouse is capttued
to this element. This is a dependency property.
IsMouseCa1JtureWithin Gets a value that determines whether mouse capture is
11eld by this element or by child elements in its ' risual
tree. This is a dependency property .
PowerShe ll Studio - Referen ce Guide I 507

lsMouseDi rectlyOver Gets a value tliat indicates \Vhether the position of the
mouse pointer corresponds to hit test results, which
take element compositing into account. This is a
dependency prope1ty.
lsMouseOver Gets a value indicatil1g ' vhether the mouse pointer is
located over this eleme11t (including child elements in
the visual tree). This is a dependency property.
lsReadOnly Gets or sets a value that indicates whether the text
editing control is read-only to a user interacting with
the control.
IsReadOnlyCaretVisible Gets or sets a value that indicates whether a read-only
text box displays a caret.
IsSeaJed Gets a value tl1at indicates '"hether this instance is
currently sealed (read-only).(Inherited fro1n
Depende11cyObject.)
lsSelectionActive Gets a value that indicates whether the text box has
focus and selected text.
lsStylusCaptured Gets a value indicating wl1ether the stylus is captured
by this element. This is a dependency property .
lsStylusCaptureWitbin Gets a value that detennines whether stylus capture is
held by this element, or an element within the element
bounds and its visual tree. Tlris is a dependency
property .
IsStylusDirectlyOver Gets a value tl1at indicates \.Vhether the stylus position
corresponds to hit test results, wlrich take element
con1positing into account. Tlris is a dependency
property .
IsStylusOver Gets a value :indicating \vhether tl1e sty lus cursor is
located over this element (including visual child
elements). This is a dependency property.
IsTabStop Gets or sets a value that indicates vvhether a control is
i11cluded in tab navigation.
IsUndoEnabled Gets or sets a value that indicates whether undo
support is enabled for tl1e text-editing control.
IsVisible Gets a value indicating whether tlris ele1nent is visible
in the user inte1face (Ul). Tltls is a dependency
property.
Language Gets or sets localization/globalization language
infonnation tllat applies to an ele1nent.
LayoutTransfo rm Gets or sets a graphics transforniation that shottld
apply to this element when layout is perfonned.
LineCount Gets the total 11umber of lines in the text box.
LogicaJChilclren Gets an enu1nerator for the logical child elements of
the TextBox.(Overrides
FraineworkElen1ent.LogicalChildren.)
Margin Gets or sets the outer margin of an element.
MaxHeight Gets or sets the maximum height constraint of the
element.
Gets or sets the maximu1n number of characters that
can be manually entered into the text box.
508 I PowerShell Studio - A Comprehensive Guide

MaxLines Gets or sets the maximum number of visible lines.


Ma,~Width Gets or sets the llllrXiln11m widtl1 constraint of the
element.
Min Height Gets or sets the 1nin:imum heigl1t constraint of tl1e
element.
MinLines Gets or sets the minimum 11umber of visible lines.
MinWidth Gets or sets the 1ninitnum width constraint of the
element.
Name Gets or sets the identifying na1ne of tlle eleme11t. The
name provides a reference so that code-behind, s11ch
as event handler code, can refer to a markup ele1nent
after it is constn1cted dtlfing processing by a XA1\1L
processor.
Opacity Gets or sets the opacity factor applied to the entire
UIElement "vhen it is rendered i11 the user interface
(Ul). This is a dependency property.
01>acityMask Gets or sets an opacity mask, as a Bn1sl1
in1ple111entation tl1at is applied to any alpha-channel
masking for the rendered content of tllis ele1nent. This
is a dependency property.
OverridesDefaultStyle Gets or sets a value that indicates "vhether this
element incorporates sty le properties fron1 theme
styles.
Padding Gets or sets the padcfu1g inside a control.
Parent Gets the logical parent ele1nent of tllis ele1nent.
Persistld Obsolete. Gets a value that uniquely identifies this
ele1nent.
RenderSize Gets (or sets, but see Remarks) the final render size of
tltis eleme11t.
Rende rTransfo rm Gets or sets transform information that affects the
rendering position of tllis element. This is a
dependency property.
RenderTransformOrigin Gets or sets the center point of any possible render
transform declared by RenderTransfonn. relative to
tl1e bounds of the eleme11t. This is a dependency
property .
Resources Gets or sets the locally-defined reso1uce dictionary .
SelectedText Gets or sets the content of the curre11t selection in the
text box.
SelectionBrusb Gets or sets the b1ush tl1at highlights selected te~1.
SelectionLength Gets or sets a value indicating the number of
characters in the cllffent selection in the text box.
Selection01>acity Gets or sets the opacity of the SelectionBrush.
SelectionStart Gets or sets a character index for the begi1ming of the
c1rrrent selection.
Sna1>sT0DevicePixels Gets or sets a value that detennines whether rendering
for this element should use device-specific pi,-xel
PowerShell Studio - Reference Guide I 509

settings during rendering. This is a dependency


property.
S1>ellCheck Gets a SpellCheck object tl1at provides access to
spelling e1rors in the tex1 conte11ts of a Tex1:BoxBase
or RichTextBox.
Style Gets or sets the style used by this element when it is
rendered.
StylnsPluglns Gets a collection of all stylus plug-in (custoinization)
objects associated with this element.
Tablndex Gets or sets a value that determines the order in which
elements receive focus when the user navigates
through controls by using the TAB key.
Tag Gets or sets an arbitrary object value that can be used
to store custom information about this element.
Template Gets or sets a control template.
TemplatedParent Gets a reference to the te1nplate parent of this
element. This property is not relevant if the element
\Vas not created through a template.
Text Gets or sets the text contents of the text box.
TextAlignment Gets or sets the horizontal aligrunent of the contents
of the text box.
TextDecorations Gets the text decorations to apply to the text box.
TextW rapping Gets or sets ho\;v the text box should \>vrap text.
ToolTip Gets or sets the tool-tip object that is displayed for
this element in the user interface (UT).
TouchesCaptured Gets all touch devices that are captured to this
element.
TouchesCapturedWitbin Gets all toucl1 devices tl1at are captured to this element
or any child ele1nents in its visual tree.
TouchesDirectlyOver Gets all touch devices tl1at are over this element.
TouchesOver Gets all touch devices that are over this element or
any child elements in its ' 'isual tree.
T1igge1s Gets the collection of triggers established directly on
this element, or in child elements.
Typography Gets the currently effective typography variations for
the tex1 contents of tl1e text box.
Uid Gets or sets the unique identifier (for localization) for
this ele1ne11t. This is a dependency property.
UndoLimit Gets or sets the number of actions stored in the undo
queue.
UseLayoutRounding Gets or sets a value that indicates whether layout
rounding should be applied to this element's size and
position during layout.
VerticalAlignment Gets or sets the vertical alignment characteristics
applied to this element when it is composed within a
parent element such as a panel or items control.
Ve1iicalContentAlignment Gets or sets the vertical aligm11ent of tl1e control's
conte11t.
510 I PowerShell Studio - A Comprehensive Guide

VerticalOffset Gets or sets the vertical scroll position.


VerticalScrollBarVisibility Gets or sets a value that indicates whether a vertical
scroll bar is shown.
ViewportBeight Gets the vertical size of the scrollable content area.
VielvportWidth Gets the horizontal size of the scrollable conte11t area.
Visibility
~
Gets or sets the user interface (UI) visibility of this
ele1nent. This is a dependency property.
Visu alBitmaJJEffect Obsolete. Gets or sets the BitmapEffect value for the
Visual.
VisualBitmapEffectln put Obsolete. Gets.or sets the BitmapEffectlnput value for
the Visual.
VisuaJBitma1>ScalingMode Gets or sets the BitmapScalingMode for the Visual.
VisualCacbeMode Gets or sets a cached repJesentation of the Visual.
VisuaJChildrenCount Gets the nun1ber of visual child elements \itlu11 this
ele1nent.
VisualCJearTy1>eHint Gets or sets the ClearTypeHint that detennines how
ClearType is rendered in the Visual.
VisuaJClit> Gets or sets the clip region of the Visual as a
Geon1etry value.
VisualEdgeMode Gets or sets the edge mode of the Visual as ru1
EdgeMode value.
VisuaJEffect Gets or sets the bit111ap effect to apply to the Visual.
VisuaJOffset Gets or sets the offset value of the visual object.
VisuaJOpacity Gets or sets the opacity of the Visual.
VisualOpacityMask Gets or sets the Brush value that represents the
opacity mask of the Visual.
Visu alP arent Gets t11e visual tiee parent of the visual object.
VisuaJScrollableAreaClip Gets or sets a clipped scrollable area for the Visual.
VisuaJTextHintingMode Gets or sets the TextHintingMode of the Visual.
Visual TextRencleringMode Gets or sets the TextRenderingMode of the Visual.
VisuaJTransform Gets or sets the Transform value for the Visual.
VisualXSnappingGuidelines Gets or sets the x-coordinate (vertical) guideline
collection.
VisualYSnappingGuidelines Gets or sets they-coordinate (l1orizontal) guideline
collection.
Width Gets or sets the \vidth of tl1e element.

TIMER
PROPERTY DESCRIPTION
Auto Reset Gets or sets a Boolean i11dicating whetl1er tl1e Timer
should raise the Elapsed event only once (false) or
repeatedly (tn1e).
PowerShell Studio - Reference Guide I 511

CanRaiseEvents Gets a value iI1dicati11g \Vhether the component can


raise an event.
Container Gets the !Container that contains tl1e Co1nponent.
DesignMode Gets a value that indicates \vhether the Component is
currently in design 1node.
Enabled Gets or sets a value indicating wl1ether the Timer
should raise the Elapsed event.
Events Gets the list of event handlers that are attached to this
Component.
Interval Gets or sets the interval, expiessed in milliseconds, at
which to raise the Elapsed event.
Site Th.is API supports the product infrastructure and is not
intended to be used directly from your code. Gets or
sets the site that binds the Tin1er to its container i11
design mode.
SynchronizingObject Gets or sets the object used to marshal event-handler
calls that are issued when an interval bas elapsed.

TOOLBAR

PROPERTY DESCRIPTION
Actuaffieight Gets the rendered height of tlris element.
ActualWidth Gets the rendered width of this element.
AllowDrop Gets or sets a value indicating whether this element
can be used as the target of a drag-and-drop operation.
This is a dependency property.
AlternationCount Gets or sets the number of alternating iten1 containers
in the Ite1nsControl, which enables alternating
co.ntainers to have a u1rique appearance. (Inherited
fro1n ItemsControl.)
AreAnyTouchesCa1Jtu red Gets a value tliat i11dicates \svhether at least one touch
is captured to this element.
AreAnyTouchesCaJJturedWithin Gets a value that indicates \Vhether at least one toucl1
is capt1rred to this ele1nent or to any child elements in
its visual tree.
AreAnyTouchesDirectlyOver Gets a value tllat indicates whether at least one touch
is pressed over this element.
AreAnyTouchesOver Gets a value tl1at iI1dicates whether at least one touch
is pressed over this elernent or any child elements in
its visual tree.
Background Gets or sets a bn1sh that describes the background of a
control.
Band Gets or sets a value that indicates where the toolbar
should be located in the ToolBarTray .
Bandlndex Gets or sets the band index r11unber that indicates the
position of the toolbar on the band.
BindingGrou11 Gets or sets the BindingGroup tliat is used for the
ele1nent.
512 I PowerShell Studio - A Comprehensive Guide

BitmapEffect Obsolete. Gets or sets a bitinap effect that applies


directly to the rendered content for this element. This
is a dependency property.
Bitma11Effectlnput Obsolete. Gets or sets an input sotuce for the bitmap
effect that applies directly to the rendered content for
this element. This is a dependency property.
BorderB111sh Gets or sets a brush that describes the border
backgrotmd of a control.
BorderThiclrness Gets or sets the border thickness of a control.
System_CAPS_11ubp ro1>ertySystem _CAPS_static ButtonStyleKey
CacheMode Gets or sets a cacl1ed represe11tation of the UIElement.
System_CAPS_pubpro1>ertySystem_CAPS_static CheckBoxSty leKey
Clip Gets or sets the geometry used to define the outline of
the contents of an element. Tllis is a dependency
property.
Clip To Bounds Gets or sets a value indicating whether to clip the
content of this element (or content coming from the
child elements of this element) to fit into the size of
the containing element. This is a dependency
property.
System_CAPS_11u b1> ropertySystem _CAPS_static ComboBoxStyleKey
CommandBindings Gets a collection of Co1nrnandBil1ding objects
associated with this element. A CommandBinding
enables co1runand handling for this element, and
declares the linkage betvveen a command, its events,
and tl1e handlers attached by this elen1ent.
ContextMenu Gets or sets the contex.'t menu ele1nent that should
appear whenever the context menu is requested
through user interface (UI) fro1n within this element.
Cursor Gets or sets the cursor tl1at displays 'vhen the n1ouse
pointer is over this ele1nent.
DataContext Gets or sets the data context for ru1 ele1nent when it
participates in data binding.
DefaultStyle]{ey Gets or sets the key to use to reference the sty le for
this control, wl1en the1ne sty les are used or defu1ed.
DependencyObjectType Gets the DependencyObjectType that "vraps the CLR
type of this instance. (Inherited from
DependencyObject.)
DesiredSize Gets the size that this element computed during the
meastrre pass of the layout process.
Dis1>atcher Gets the Dispatcher this DispatcherObject is
associated \Vith. (Inherited from DispatcherObject.)
DisplayMembcrPath Gets or sets a path to a value on the source object to
seive as tl1e visual representation of tl1e object.
(Inherited from ItemsControl.)
Effect Gets or sets the bitmap effect to apply to the
UIElement. This is a dependency property.
PowerShell Studio - Reference Guide I 513

FlowDirection Gets or sets tl1e direction tl1at tex.1: and other user
interface (UI) elements flow within any parent
eleme11t that controls their layout.
Focusable Gets or sets a value that indicates "'' hether the element
can receive focus. This is a dependency property .
FocusVisualStyJe Gets or sets a property that enables customization of
appearance, effects. or other sty le characteristics that
will apply to this element when it captures keyboard
focus.
FontFamily Gets or sets the font fanrily of the control.
FontSize Gets or sets the font size.
FontStretcb Gets or sets the degree to which a font is condensed or
expanded on the screen.
FontStyle Gets or sets the font style.
FontWeight Gets or sets the weight or tlrickness of tl1e specified
font.
ForceCursor Gets or sets a value tl1at indicates \Vl1ether this
FrameworkElement should force tl1e user interface
(Ul) to render the cursor as declared by tl1e Cursor
property .
Foreground Gets or sets a brush tl1at describes tl1e foreground
color.
Grou11Style Gets a collection of GroupStyle objects that define the
appearance of each level of groups.(Inherited fro1n
Iten1SControl.)
Grou pStyleSelector Gets or sets a inethod that enables you to provide
custon1 selection logic for a GroupStyle to apply to
each group in a collection (Inherited from
Ite1nsControl.)
HandlesScrolling Gets a value tliat indicates 'vhether a control supports
scrolling.
HasAnimatedProperties Gets a value indicating whether this element has ai1y
animated properties.
HasEffectiveKeyboardFocus Gets a value that indicates whether the UIElen1ent has
focus.
HasHeader Gets a value tl1at indicates "vhetl1er this
Headeredlte1nsControl has a header. (Inherited fro1n
HeaderedltemsControl.)
HasItems Gets a value tliat indicates 'vhether the Iten1sControl
contains ite1ns. (Inherited from ItemsCoutrol.)
HasOverflowItems Gets a value that indicates whether the toolbar has
iten1s that are not visible.
Header Gets or sets the item that labels the control. (lnl1erited
from HeaderedltemsCo ntrol.)
HeaderStringFormat Gets or sets a composite string that specifies ho\v to
fonnat the Header property if it is displayed as a
string.(lnherited fron1 HeadereditemsControl.)
514 I PowerShell Studio - A Comprehensive Guide

HeaderTemplate Gets or sets the template used to display the contents


of the control's header. (Inherited from
HeaderedltemsControl.)
HeaderTem1JlateSelector Gets or sets the object that provides custom selection
logic for a template used to display the header of each
item. (Inherited from HeaderedltemsControl.)
Height Gets or sets the suggested height of the element.
HorizontalAlignment Gets or sets the horizontal alignn1ent characteristics
applied to this element when it is co1nposed within a
parent element, such as a panel or items control.
HorizontaJContentAlignment G'ets or sets the horizontal aligmnent of the control's
content.
InheritanceBehavior Gets or sets the scope li1nits for property value
inheritance, resource key lookup, and RelativeSource
FindAncestor lookup.
lnputBindings Gets the collection of input bindings associated with
this ele1nent.
lnputScope Gets or sets the conte:\.1 for input used by this
Frame\<vorkElement.
IsArrangeValid Gets a value indicating "vhether the computed size and
position of child elements h1 this elen1ent's layout are
valid.
IsEnabled Gets or sets a value indicating whether this ele1ne11t is
enabled in the user interface (UI). This is a
dependency property.
lsEnabledCore Gets a value that beco1nes the retun1 value of
lsEnabled in derived classes.
lsFocused Gets a value that detennines \vhetbeI t11is ele1nent has
logical focus. Tlus is a dependency property.
IsGrouping Gets a value that indicates whether the control is using
grouph1g. (Inherited fro1n Ite111sC011trol.)
lsHitTestVisible Gets or sets a value that declares \vbether tlus ele111ent
can possibly be retun1ed as a hit test result fro1n some
portion of its rendered content. Tlus is a dependency
property .
lslnitialized Gets a value that indicates whether tins element has
been initialized, either during processing by a XAfv1L
processor, or by ex-plicitly having its Endlnit method
called.
lsinputMethodEnabled Gets a value indicating \Vhether an input method
systenl, such as an Input Method Editor (IME), is
enabled for processing the input to this element.
IsKeyboardFocused Gets a value indicating whether this element has
keyboard focus. This is a dependency property.
lsKeyboardFocusWithin Gets a value incticatir1g whether keyboard focus is
any,vhere within the element or its visual tree child
elen1ents. This is a dependency property.
lsLoaded Gets a value thatindicates whether this element has
been loaded for presentation.
Pow erShe ll Studio - Referen ce Guide I 515

IsManipulationEoabled Gets or sets a val11e that indicates whether


manipulation events are enabled on this UIElement.
IsMeasureValid Gets a value indicati11g whether the current size
Ietmned by layo11t measure is valid.
IsMouseCaptured Gets a value it1dicating \V hether the n1ouse is captmed
to this elen1ent. Tltis is a dependency property .
lsMou_s eCaptureWithin Gets a value that detennines whether mouse capture is
held by this element or by child elements in its visual
tree. This is a dependency property .
IsMouseDirectlyOver Gets a value that indicates whether the position of the
mouse pointer conesponds to hit test results, which
take element compositing into account. This is a
depende11cy property.
lsMouseOver Gets a value indicating ,;vhether the mouse pointer is
located over this element (including child elements in
the visual tTee). This is a dependency property.
IsOverflowOpen Gets or sets a value that indicates whetl1er the ToolBar
overflow area is currently visible.
lsSealed Gets a value that indicates whether this instance is
currently sealed (read-only).(Inherited from
Dependency Object.)
IsStylusCaptured Gets a value indicating ,;v11ether the stylus is captured
by this element. This is a depe11dency property.
IsStylusCaptureWithin Gets a value that deter1nines \Vhether stylus capture is
held by this ele1nent. or a11 ele111enJ witltin the elen1ent
bounds ai1d its visual tTee. Tltis is a depe11dency
property.
IsS tylusDi rectlyOver Gets a value that indicates whether the stylus position
corresponds to hit test results, wltic h take element
cornpositing into account Tb.is is a dependency
property.
IsStylusOver Gets a value indicating wl1ether the styl11s cursor is
located over this element (incl11ding visual child
elements). This is a dependency property.
l sTabStop Gets or sets a value that indicates \vhether a control is
included in tab 11avigation.
Is TextSearchC aseSensitive Gets or sets a value that indicates whether case is a
condition wl1en searching for items.(Inherited from
ItemsControl.)
lsTextSearchEnabled Gets or sets a value that indicates \vhether TextSearcl1
is enabled on the ItemsControl instance. (Inherited
from, Ite111sC011trol.)
IsVisible Gets a value i11dicating whethe:r this elen1ent is visible
in tl1e user interface (UI). This is a dependency
property.
ItemBindingGroup Gets or sets the BindingGroup that is copied to each
item it1 the Ite1nsControl. (Inherited from
Ite1nsContro1.)
ItemCootain.e rGeoerator Gets the ItemContainerGenerator tliat is associated
witl1 tl1e control. (Inherited from Iten1sC011trol.)
516 I PowerShell Studio - A Comprehensive Guide

ltemCootainerStyle Gets or sets the Style that is applied to the container


element generated for each item. (Inherited from
ItemsControl.)
Item ContainerStyleSelecto r Gets or sets custom style-selection logic for a style
that can be applied to each generated container
element. (Inherited fro1n ltemsControl.)
Items Gets the collection used to ge11erate the content of the
ItemsControl.(Inberited from ItemsControl.)
ItemsPanel Gets or sets the template that defines the panel tliat
controls the layo11t of items. (Inherited from
lten1sControl.)
Items Source Gets or sets a collection used to generate tl1e content
of the Ite111sC011trol. (Inherited fron1 ItemsControl.)
ItemStringFormat Gets or sets a composite string that specifies how to
fonnat the ite111s in the ItemsControl if they are
displayed as strings.(Inhe1ited from ItemsControl.)
Item Tern 1>late Gets or sets the DataTemplate used to display each
item. (Inherited fro1n Ite1nsControl.)
ItemTemplateSelector Gets or sets the custom logic for choosing a template
used to display each item (Inherited from
ItemsControl.)
Language Gets or sets localization/globalization language
information tliat applies to an eleme11t.
LayoutTransform Gets or sets a graphics transformation that should
apply to tllis ele1nent when layout is perfon11ed.
LogicalChildrcn Gets an enumerator to tl1e logical child elements of
tl1e Headeredlte1nsControl. (hlherited fro111
Headeredlte1nsControl.)
Margin Gets or sets the outer n1argin of an ele1nent.
MaxHeight Gets or sets the 1naxi1num height constrai11t of the
ele1nent.
MaxWidth Gets or sets the 1naxi1nu1n \idth constraint of the
elernent.
System_ CAPS_1>ubpro1>ertySystem_CAPS_static Menu Sty leKey
MinHeight Gets or sets the ininimttm height constraint of tl1e
elen1ent.
MinWidth Gets or sets the lninimum '\ividth constraint of the
ele111ent.
Nam.e Gets or sets the identifying name of the elem.ent. Tl1e
name provides a reference so that code-behind, such
as event handler code, can refer to a markup ele1nent
after it is constructed during processing by a XAML
processor.
Opacity Gets or sets the opacity factor applied to the entire
UIElement when it is rendered il1 the user interface
(UI). Tllis is a depende11cy property.
OpacityMask Gets or sets an opacity mask, as a Bn1sh
imple1nentation that is applied to any alpha-channel
inasking for the rendered content of this element. This
is a dependency property.
PowerShell Studio - Reference Guide I 517

Orientation Gets the orie11tation of the ToolBar.


OverridesDefaultStyle Gets or sets a value that indicates \-Vhether this
element incorporates style properties from theme
styles.
Padding Gets or sets the padding inside a control.
Parent Gets the logical parent element of this element.
Persistlcl Obsolete. Gets a value that uniquely identifies this
element.
System_ CAPS_pubp ropertySystem_CAPS_static RadioB11ttonSty leKey
RenderSize Gets (or sets, but see Remarks) the final re11der size of
this element.
RenderTransform Gets or sets transform infor1nation that affects the
re11dering position of this element. This is a
dependency property.
RenderTransformOrigin Gets or sets tl1e center point of any possible render
transform declared by RenderTransform, relative to
the botmds of the elen1ent. This is a depende11cy
property.
Resources Gets or sets the locally-defined resource dictionary.
System_ CAPS_pub1>rope11ySystem_CAPS_static SeparatorStyleKey
SnapsToDevicePixels Gets or sets a value that detennines whether rendering
for this element should use device-specific pixel
settings dming rendering. This is a dependency
property.
Style Gets or sets tl1e style used by this element whe11 it is
rendered.
StylusPluglns Gets a collection of all stylus plug-u1 (custo1nization)
objects associated with this element.
Tablndex Gets or sets a value tliat determines the order in \hicl1
elements receive focus when the user navigates
through controls by using tl1e TAB key.
Tag Gets or sets an arbitrary object value that can be used
to store custon1 information about this element.
Tem1>late Gets or sets a control template.
Tem.platedParent Gets a reference to the template parent of this
element. This property is not relevant if the element
was not created tllrough a template.
System_CAPS_pubp ropertySystem_CAPS_static Te~1BoxS ty leKey

System_CAPS_pub1> ropertySystem_CAPS_static ToggleButtonSty leKey


ToolTip Gets or sets the tool-tip object that is displayed for
this element in the user interface (UI).
TouchesCaptured Gets all touch devices that are captured to this
element.
TouchesCa1>tu redWithin Gets all touch devices tl1at are capt1rred to tllis element
or any child ele1nents in its visl1al tree.
ToucbesDirectlyOver Gets all touch de\lices tl1at are over this ele1nent.
518 I PowerShell Studio - A Comprehensive Guide

TouchesOver Gets all touch devices t11at are over this element or
any child elements in its visual tree.
Triggers Gets the collection of niggers established directly on
this ele1nent, or in child elements.
Uid Gets or sets the unique identifier (for localization) for
this ele1nent. This is a dependency property.
U seLayoutRounding Gets or sets a value that indicates whether layout
rounding should be applied to this elen1ent's size and
position dtrring layout.
Ve11ica1Alignoient Gets or sets the vertical alignment characteristics
applied to this element when it is composed within a
parent element such as a panel or items control.
VerticalContentAlignment Gets or sets the vertical align1nent of the control's
content.
Visibility

Gets or sets the user interface (UI) visibility of tllis
element. This is a dependency property.
VisualBitmapEffect Obsolete. Gets or sets the BitmapEffect value for the
Visual.
Visu alBitmapEffectln put Obsolete. Gets or sets the BitmapEffectlnput value for
the Visual.
VisuaIBitmapScalingMode Gets or sets the BitmapSca1ingMode for the Visual.
VisualCacheMode Gets or sets a cached representation of tbe Visual.
VisualChildrenCount Gets the number of visual child elements within tllis
element.
VisualClearTypeHint Gets or sets the ClearTypeHint that detennines how
ClearType is rendered in the Visual.
VisualCli1> Gets or sets the clip region of the Visual as a
GeometTy value.
VisualEdgeMode Gets or sets the edge inode of the Visual as a11
EdgeMode value.
VisualEffect Gets or sets the bitmap effect to apply to the Visual.
VisualOffset Gets or sets the offset value of the visual object.
VisualOpacity Gets or sets the opacity of the Visual.
Visu alOpacityMask Gets or sets the B1ush value that represents the
opacity mask of the Visual
VisualParent Gets the visual tree parent of the visual object
VisualScrollableAreaClip Gets or sets a clipped scrollable area for the Visual
Visu aJTe:\."tHintin gMode Gets or sets the TextHintingMode of tl1e Visual.
VisualTextRenderingMode Gets or sets the TextRenderingMode of the Visual.
Visual Transform Gets or sets the Transform value for the Visual.
VisualXSnappingGuidelines Gets or sets the x-coordinate (vertical) guideline
collection.
VisualYSnaJlJlin gGuidelines Gets or sets they-coordinate (horizol}tal) guideline
collection.
Width Gets or sets the \vidth of the ele1nent.
PowerShell Studio - Reference Guide I 519

TOOLSTRIP

PROPERTY DESCRIPTION
AccessibilityObject Gets the AccessibleObject assigned to the control.
AccessibleDefaultActionDescription Gets or sets the default action description of tl1e
control for use by accessibility client applicatio11s.
AccessibleDesc1iption Gets or sets the description of the control used by
accessibility client applications.
AccessibleNaine Gets or sets the name of the co11trol used by
accessibility client applications.
Accessible:R..ole Gets or sets the accessible role of the control
AllowDrop Gets or sets a value indicating l-vhether drag-and-drop
and item reordering are hai1dled through events that
you implement. (Overrides Control.Allo,Drop.)
AllowItemReorder Gets or sets a value indicating l-Vhether drag-and-drop
and item reordering are handled privately by the
ToolStrip class.
AllowMerge Gets or sets a value indicating \<vl1ether multiple
MenuStrip, ToolStripDropDownMenu,
ToolStripMenultem, and other types can be
co1nbined.
Anchor Gets or sets the edges of the container to \fV bicl1 a
ToolStrip is bound a11d detennines how a ToolStrip is
resized with its parent. (Overrides Control.Anchor.)
AutoScroll Tius API supports the product infrastructure and is not
intended to be used directly from your code. This
property is not relevant for this class. (Overrides
ScrollableControl.AutoScroU.)
AutoScrollMargin This API supports the product infrastructure and is not
intended to be used directly from your code. This
property is not relevant for tllis class.
AutoScrollMillSize This API supports the product infrastruct1ue and is not
intended to be used directly fro1n yotu code. Tlris
property is not relevant for tllis class.
AutoScroUOffset Gets or sets where this control is scrolled to in
ScrollCo ntrollnto View.
AutoScrollPosition This API supports the product infrastruct1ue and is not
intended to be used directly from your code. This
property is not relevant for this class.
Auto Size Gets or sets a value indicating whether the control is
automatically resized to display its entire
contents.(Ovenides Control.AutoSize.)
BackColor This API supports the product infrastn1cture ai1d is not
intended to be used directly fro111 yo1u code. Gets or
sets the backgro1u1d color for the ToolStriy.
Backgroundlmage Gets or sets the backgrou.nd image displayed in the
control.
BackgroundlmageLayout Gets or sets the background image layout as defined
in tlle I1nageLayout enun1eration.
520 I PowerShell Studio - A Comprehensive Guide

BindingContext Gets or sets the binding context for the


ToolStrip.(Overrides ControlBindingContext.)
Bottom Gets t11e distance, in pixels, ben;veen t11e botto1n edge
of the control and the top edge of its co11tainer's client
area.
Bounds Gets or sets the size and location of the control
includll1g its nonclient elements, in pixels, relative to
the parent control.
CanEnablelme Gets a value indicating vvhether the ImeMode
property can be set to an active value to enable IME
support.
CanFocus Gets a value indicating whether the control can
receive focus.
CanOverflow Gets or sets a value indicating 'vhether items in the
ToolStrip can be sent to an overflow nlenu.
CanRaiseEvents Detennines if events cai1 be raised on the control.
Can Select Gets a value indicating whether the control can be
selected.
Catlture Gets or sets a value indicating ' vhether t11e control has
caphued the nlot1se.
CausesValidation Gets or sets a value indicating vvhether the ToolStrip
causes validation to be perfonned on any controls that
require validation when it receives focus.
ClientRectangle Gets tl1e rectangle that represents the client area of tl1e
control.
ClientSize Gets or sets the height and vvidth of the client area of
the control.
CompanyName Gets the nan1e of the co1npany or creator of the
application contaiitlng the control.
Container Gets the !Container that contains the Component.
ContainsFocus Gets a value indicating 'vhether the control, or one of
its child controls, cturently has the input focus.
ContextMenu Gets or sets the shortcut menu associated with the
control.
ContextMenuStrip Gets or sets the ContextMenuStrip associated witl1
this control.
Controls This API supports tl1e product infrastn1cture and is not
intended to be used directly from your code. This
prope11y is not relevant for tltls class.
Created Gets a value indicating whether the control has been
created.
CreateParams Gets the reqtlired creation parameters wl1en the
control handle is created.
Cursor Gets or sets the cursor that is displayed when the
1nouse pointer is over the ToolStrip.(Overrides
Contro 1. Cursor.)
DataBindings Gets the data bindings for the control.
DefaultCurso1 Gets or sets the default cursor for the control.
PowerShell Studio - Reference Guide I 521
~

DefaultDock Gets the docking location of the ToolStrip, indicating


which borders are docked to the container.
DefaultD ropDownDirectio n Gets or sets a value representing the default direction
in "vbicha ToolStripDropDown control is displayed
relative to the ToolStrip.
DefaultGri]JMargin Gets the default spacing, in pixels, bet\.veen the sizing
grip and the edges of the ToolStrip.
DefaultlmeMode Gets the default Input Method Editor (Th.ffi) mode
supported by the control.
DefaultMargin Gets the spacing, in pixels, benveen the ToolStrip and
the ToolStripContainer.(Overrides
Control.DefaultMargin.)
DefaultMaximumSize Gets the length and height, in pixels, that is specified
as the default ma.xi.mum size of a control.
DefaultMioimumSize Gets the length and height, in pixels, that is specified
as the default minim1rm size of a control.
DefaultPadding Gets the internal spacing, in pixels, of the contents of
a ToolStrip.(Overrides Co11trol.Defaul1Paddi11g.)
DefaultShowItemToolTi11s Gets a value indicating whether ToolTips are sl1own
for the ToolStiip by defa1tlt.
DefaultSize Gets the default size of the ToolStrip.(Overrides
Control.DefaultSize.)
DesignMode Gets a value that indicates whether the Component is
cunently in design mode.
Displayedltems Gets the subset of ite1ns that are currently displayed
on the ToolStrip, including ite11ns that are
automatically added into the ToolStrip.
Dis1JlayRectangle This API supports the product infrastructure and is not
intended to be used directly fro111 your code. Retrieves
the cunent display rectangle. (Overrides
ScrollableControl.DisplayRectru1gle.)
Disposing Gets a value indicating ' vhether the base Control class
is in the process of disposing.
Dock Gets or sets wlrich ToolStrip borders are docked to its
parent control and deten1lines 11ow a ToolStrip is
resized with its parent.(Overrides Control.Dock.)
DockPadding Gets the dock padding settings for all edges of the
control.
DoubleBuffered Gets or sets a value indicating \vhether this control
shottld redraw its surface using a secondary buffer to
reduce or prevent flicker.
Enabled Gets or sets a value indicating whether the control can
respond to user interaction.
Events Gets the list of event handlers that are attached to tllis
Component.
Focused Gets a value indicating whether the control bas input
focus.
Font Gets or sets tl1e font used to display text in tl1e
control.(Overrides Control.Font.)
FontHeight Gets or sets the height of the font of the control.
522 I PowerShell Studio - A Comprehensive Guide

ForeColor Gets or sets the foreground color of the ToolStrip.


GripDisplayStyle Gets the orientation of the ToolStrip move handle.
Grip Margin Gets or sets the space around the ToolSttip move
handle.
GripRectangle Gets tl1e bow1daries of the ToolStrip inove handle.
Gri11Style Gets or sets whetl1er the ToolStrip move ha11dle is
visible or hidden.
Handle Gets the window handle that the control is bound to.
Has Children This API supports the product infrastructure and is not
il.1tended to be used directly fron1 your code. This
prope1ty is not relevat1t for this class.
Height Gets or sets the 11eight of the control.
HorizontalScroll This API supports the product infrastn1cture and is not
intended to be used directly fro1n your code. This
property is not relevru:1t for tl1is class.
HScroll Gets or sets a value indicating whether the horizontal
scroll bar is visible.
ImageList Gets or sets the i1nage list that contailis the image
displayed on a ToolStrip iten1.
ImageSca1ingSize Gets or sets the size; in pixels, of an image used on a
ToolStrip.
ImeMode Gets or sets the !~put Method Editor (!ME) rnode of
the control.
lmeModeBase Gets or sets the Il\1E 1node of a control.
InvokeRequired Gets a value indicatil.1g whether the caller n1ust call an
invoke 1netl1od \ V hen making 1netl1od calls to the
control because the caller is on a different thread than
the one tl1e control '1vas created on.
IsAccessible Gets or sets a value indicating vvhether the control is
visible to accessibility applications.
ls CurrentlyDragging Gets a value indicating \IV hether the user is currently
moving the ToolStrip from one ToolStripContainer to
another.
IsDisposed Gets a value indicating vvhether the control has bee11
disposed of.
IsDropDown Gets a value indicating \vhetl1e.r a ToolStrip is a
ToolStiipDropDo'1vn control.
IsHandleCreated Gets a value indicating whether the control has a
handle associated with it.
IsMirrored Gets a value indicating whether the control is
nrirrored.
Items Gets all the items that belong to a ToolStrip.
Layou tE ngine Passes a reference to tl1e cached LayoutEngine
returned by the layout engine interface.(Overrides
Control.LayoutEngine.)
LayoutSettings Gets or sets layout scheme characteristics.
LayoutStyle Gets or sets a value indicating 11ow the ToolStrip lays
out the items collection.
PowerShell Studio - Reference Guide I 523

Left Gets or sets the distance, in pixels, bet\;veen the left


edge of the control and the left edge of its container's
client area.
Location Gets or sets the coordinates of the upper-left corner of
tl1e control relative to tl1e upper-left con1er of its
container.
Margin Gets or sets the space betvveen controls.
MaximumSize Gets or sets tl1e size that is the upper li1uit that
Getprefe1TedSize can specjfy .
MaxltemSize Gets the tnaxil11un1 height a11d widtll, in pixels, of the
ToolStrip.
MinimumSize Gets or sets the size that is t11e lo\-ver linut that
GetpreferredSize can specify .
Name Gets or sets the name of the control.
Orientation Gets the orientation of the ToolStripPanel.
OverflowButton Gets the ToolStripltem that is the overflo'v button for
a ToolStrip 'vith overflow enabled.
Padding Gets or sets padding within the control.
Parent Gets or sets the pare11t contail1er of the control.
PrefenedSize Gets the size of a rectangular area into wl1ich the
co11trol can fit.
ProductN ame Gets the product name of the assembly containing the
control.
ProcluctVersion Gets the version of the assembly contailling the
control.
RecreatingHandle Gets a value indicating \hether the control is
currently re-creating its handle.
Region Gets or sets the window region associated with the
control.
Renderer Gets or sets a ToolStripRenderer used to custontize
the look and feel of a ToolStrip.
RenclerMode Gets or sets a value that il1dicates whicl1 visual styles
will be applied to the ToolStrip.
RenclerRigbtToLeft Obsolete.This property is now obsolete.
ResizeRedra\v Gets or sets a value indicating whether the control
redraws itself when resized.
Right Gets the distance, il1 pixels, between the right edge of
the control ai1d the left edge of its container's client
area.
RightToLeft Gets or sets a value indicating \vhether control's
elements are aligned to support locales using right-to-
left fonts.
ScaleChildren Gets a value tliat determines the scalil1g of child
controls.
ShowFocusCues Gets a value indicating \Vhether the co11trol sl1oltld
display focus rectangles.
ShowltemToolTips Gets or sets a value indicating whether ToolTips are
to be displayed on ToolStrip items.
524 I PowerShell Studio - A Comprehensive Guide

Show Keyboard Cues Gets a value indicating whether the user interface is in
the approp1iate state to show or hide keyboard
accelerators.
Site Gets or sets the site of the control.
Size Gets or sets the height and width of the control.
Stretch Gets or sets a value indicating vvhether the ToolStrip
stretches from end to end in the ToolStripContainer.
TabIndex Gets or sets the tab order of the control witlrin its
container.
TabStop Gets or sets a value indicating ,;vhether the user can
give the focus to an item in t11e ToolStrip using tl1e
TAB key.
Tag Gets or sets the object t11at contains data about the
control.
Text Gets or sets the text associated ,;vith tllis control.
TextDirection Gets or sets the direction in which to draw text on a
ToolStrip.
TO)l Gets or sets the distance, in pixels, betvveen tl1e top
edge of the control and the top edge of its contaiI1e1Js
client area.
TopLevelControl Gets the parent control that is not parented by a11other
Windows Fo1n1s control. Typically>tllis is the
outennost Fonn that tl1e control is contai11ed in.
UseW aitCursor Gets or sets a value indicating whetl1er to use the wait
cursor for the current control and all child controls.
VerticalScroll Tllis API supports the product infrastn1cture and is not
intended to be used directly fro1n your code. This
property is not relevant for tllis class.
Visible Gets or sets a value indicating whether the control and
all its cllild controls are displayed.
VScroll Gets or sets a value indicating ,;vhether the vertical
scroll bar is visible.
Width Gets or sets the width of the control.
WindolvTarget Tllis API supports the product infrastn1cture ai1d is not
intended to be used directly fro1n your code. This
property is not releva11t for this class.

TOOLTIP

PROPERTY DESCRIPTION
Active Gets or sets a value indicating whether the ToolTip is
currert~y active.
AutomaticDelay Gets or sets the automatic delay for the ToolTip.
AutoPopDelay Gets or sets the period of time the ToolTip re1nains
visible if the pointer is stationary on a control with
specified ToolTip text.
PowerShell Studio - Reference Guide I 525

BackColor Gets or sets the background color for the ToolTip.


CanRaiseEvents Gets a value indicating ,;vl1ether the co111ponent can
raise an event.
Container Gets the !Container that contains the Co1nponent.
CreateParams This API supports the product infrastructure and is not
intended to be used directly fro1n your code. Gets the
creation parameters for the ToolTip window.
DesignMode Gets a value that indicates whether the Component is
cmTently in desig11 mode.
Events Gets the list of event handlers that are attached to tllis
Component.
ForeColor Gets or sets the foreground color for the ToolTip.
lnitiaIDelay Gets or sets the tiine that passes before tl1e ToolTip
appears.
IsBalloon Gets or sets a value indicating ,;vhether the ToolTip
should use a balloon window.
OwnerDraw Gets or sets a value indicating whether the ToolTip is
dra,vn by the operating syste1n or by code that you
provide.
Resholv Delay Gets or sets the length of ti1ne that must transpire
before subsequent ToolTip ';vindows appear as the
pointer rnoves fro111 one control to a11other.
ShowAlways Gets or sets a value indicating whether a ToolTip
window is displayed, even when its parent control is
not active.
Site Gets or sets tl1e !Site of the Co1nponent.
StripAmpersands Gets or sets a value that determines ho"v ampersand
(&)characters are treated.
Tag Gets or sets the object tl1at contains progranuner-
supplied data associated with tl1e ToolTip.
ToolTiplcon Gets or sets a value that defines the type of ico11 to be
displayed alongside the ToolTip text.
ToolTi11Title Gets or sets a title for the ToolTip ,;yindow.
UseAnimation Gets or sets a value detennining whether an animation
effect should be used wl1e11 displaying the ToolTip.
UseFading Gets or sets a value detennining ,;vhether a fade effect
should be used when displaying the ToolTip.

TRACKBAR

PROPERTY DESCRIPTION
AccessibilityO bject Gets the AccessibleObject assigned to the control.
AccessibleDefaultActionDescription Gets or sets tl1e default action description of t11e
control for use by accessibility client applications.
AccessibleDescription Gets or sets the description of the co11trol used by
accessibility client applications.
526 I PowerShell Studio - A Comprehensive Guide

AccessibleName Gets or sets the na1ne of the control used by


accessibility client ap_plications.
AccessibleRole Gets or sets the accessible role of the control
Allo'v Dro11 Gets or sets a value indicating vvhether the control can
accept data tl1at tl1e use.r drags onto it.
Anchor Gets or sets the edges of the container to "vhich a
control is bound and detennines how a control is
resized '\Vith its parent.
AutoScrollOffset Gets or sets where this control is scrolled to in
ScrollControllntoView.
Auto Size Gets or sets a value indicating whether the height or
vvidth of the track bar is being automatically
sized.(Overrides Control.AutoSize.)
BackColor Gets or sets the backgJound color for the control.
Bacl<.groundlmage This API supports the product infrastn1ch1re and is not
intended to be used directly from your code. Gets or
sets the backgro1md image for the TrackBar
control. (Overrides Contro1.Backgroundlniage.)
BackgroundlmageLayout This API supports the product infrastructure and is not
intended to be used directly fron1 your code. Gets or
sets an ImageLayout value: however, settiI1g this
property has no effect on the TrackBar control.
(Overrides Control.BackgroundlmageLayout.)
BindingContext Gets or sets the BindingContext for tl1e control.
Bottom Gets t11e distance, in pixels, between the bottorn edge
of tlle control and the top edge of its container's client
area.
Bounds Gets or sets the size and location of the control
including its nonclient elements, in pixels, relative to
the parent control.
CanEnablelme Gets a value indicating whether the ImeMode
property can be set to an active value) to enable IME
support.
CanFocus Gets a value n1dicating whetl1er the control can
receive focus.
CanRaiseEvents Dete1mines if events can be raised on the control.
Can Select Gets a value indicating whetl1er the control ca11 be
selected.
Capture Gets or sets a value indicating whether the control has
captured the n1ouse.
CausesValidation Gets or sets a value indicating vvhether the control
causes validation to be perlormed on any co11trols that
require validation when it receives focus.
ClientRectangle Gets the rectangle that represents the client area of the
control.
ClientSize Gets or sets the height and width of tl1e clie11t area of
the control.
CompanyName Gets the nan1e of the company or creator of the
application containing the control.
PowerShell Studio - Reference Guide I 527

Container Gets the IContainer that contains the Component.


ContainsFocus Gets a value indicatiJ.1g wl1ether the co11trol, or one of
its child controls, currently has the input focus.
ContextMenu Gets or sets the shortcut menu associated with the
control.
ContextMenuStrip Gets or sets the ContextMenuS trip associated with
this control.
Controls Gets the collection of controls contained vvithin tl1e
control.
Created Gets a value indicating ,;vhether the co11trol has been
created.
CreateParams This API Sl1pports the prodl1ct infrastruct1ue and is not
intended to be used directly from your code.
Overrides the CreateParams property .(Overrides
Control. CreateParams.)
Cursor Gets or sets the cursor that is displayed when the
mouse pointer is over the control.
DataBindings Gets the data bindings for the control.
Defau It Cursor Gets or sets the default cursor for the control.
DefaultlmeMode This API supports the product infrastructure and is not
intended to be used directly from your code. Gets a
value indicating t11e mode for tl1e Input Method Editor
(IME) for the Track.Bar.(Ovenides
Control.DefaultlmeMode.)
DefaultMargin Gets the space, in pixels, that is specified by default
between controls.
DefaultMaximtLmSjze Gets the length and height, in pixels, that is specified
as the default nlaximum size of a control.
DefaultMinimumSize Gets the lengtl1 and height, in pixels, tliat is specified
as the default minimum size of a control.
DefaultPadding Gets the internal spacing, in pixels, of the contents of
a control.
DefaultSize Gets the default size of the TrackBar.(Ovenides
Control.Defa1tltSize.)
DesignMode Gets a value that indicates whether the Component is
currently in design inode.
DisplayRectangle Gets the rectangle that represents the display area of
the control.
Disposing Gets a value indicating "\>Vhether the base Control class
is in the process of disposing.
Dock Gets or sets wlrich control borders are docked to its
parent control and detennines 110\-v a control is resized
witl1 its parent.
DoubleBuffered Gets or sets a value indicating whether this control
should redraw its surface using a secondary buffer to
reduce or prevent flicker~ however, this property has
no effect on the Track.Bar control (Overrides
Control.DoubleBuffered.)
528 I PowerShell Studio - A Comprehensive Guide

Enabled Gets or sets a value indicating vvhether the control can


respond to user interaction.
Events Gets the list of event handlers that are attached to this
Component.
Focused Gets a value indicati11g whether the control has input
focus.
Font This API supports the product infrastructure and is not
intended to be used directly fro1n your code.
Overrides Font(Overrides Control.Font.)
FontHeight Gets or sets the height of the font of the control.
ForeCoJor This API supports the product infrastructure and is not
intended to be used directly from your code. Gets tl1e
foreground color of the track bar.(Overrides
Control.ForeColor.)
Handle Gets the window handle that tl1e control is botmd to.
Has Children Gets a value indicating whetl1er the control contains
011e or more child controls.
Height Gets or sets the height of the control.
lmcMode This AP! supports the product infrastructure a11d is not
intended to be used directly from your code. Gets or
sets tl1e Input Method Editor (IME) mode supported
by this control.
lmeModeBase Gets or sets the IME 111ode of a control.
lnvokeRequired Gets a value indicating whetl1er the caller 111ust call an
invoke method when making metl1od calls to tl1e
control because the caller is on a different thread thal1
the one the control was created on.
lsAccessible Gets or sets a value indicating \.Vhetl1er the control is
visible to accessibility applications.
lsDisposed Gets a value indicating 'vhetl1er the control has been
disposed of.
lsHandleCreated Gets a value indicating whether the control has a
handle associated with it.
lsMirrored Gets a value indicating whetl1er the control is
nrirrored.
LargeCbange Gets or sets a value to be added to or subtracted fro1n
the Value property when the scroll box is moved a
large distance.
LayoutEnginc Gets a cached instance of the control's layout engine.
Left Gets or sets the distance, in pixels) between tl1e left
edge of the control and the left edge of its container's
client area.
Location Gets or sets the coordinates of the upper-left comer of
the control relative to the upper-left corner of its
container.
Margin Gets or sets the space benvee11 controls.
Ma~imum Gets or sets tlle t1pper limit of the range this Track.Bar
is working ,;vith.
PowerShell Studio - Reference Guide I 529

MaximumSize Gets or sets the size tl1at is the upper limit that
GetPreferredSize can specify.
Minimum Gets or sets the lower limit of the range this TrackBar
is working with.
MinimumSize Gets or sets the size that is the lower linrit that
GetPreferredSize can specify .
Name Gets or sets the name of the control.
Orientation Gets or sets a value indicating the horizontal or
vertical orientation of the track bar.
Padding This API supports the product infrastructure and is not
intended to be used directly from yotrr code. Gets or
sets the space between the edges of a TrackBar
control and its contents.
Parent Gets or sets the parent container of the control.
PrefenedSize Gets the size of a rectangular area into "vlrich tl1e
control can fit.
ProductName Gets the product name of the asselnbly co11taining the
control.
ProductVersion Gets tl1e version of tl1e assembly containing the
control.
RecreatingHandle Gets a value indicating ,;yhether the control is
currently re-creating its handle.
Region Gets or sets the windo\;v region associated with the
control.
RenderRightToLeft Obsolete.This properly is now obsolete.
ResizeRedraw Gets or sets a value indicating whether the control
redraws itself "vhen resized.
Right Gets the distai1ce, in pixels, between the right edge of
the control and the left edge of its container's client
area.
RigbtToLeft Gets or sets a value indicating whether control's
eleme11ts are aligned to support locales using right-to-
left fonts.
RightToLeftLayout Gets or sets a value indicating whether the contents of
the TrackBar will be laid out from right to left.
ScaleCbildren Gets a value that determines tl1e scaling of clrild
controls.
SbowFocusCues Gets a value indicating \;yhether tl1e control should
display focus rectangles.
ShowKeyboard

Cues Gets a value indicating \ hether the user it1terface is in
the appropriate state to sho"v or hide keyboard
accelerators.
Site Gets or sets the site of the control.
Size Gets or sets the height and width of the control
Small Change Gets or sets the value added to or subtracted from the
Value property \hen the scroll box is inoved a small
distance.
Tabln.dex Gets or sets the tab order of tl1e control within its
co ntai11er.
530 I PowerShell Studio - A Comprehensive Guide

TabStop Gets or sets a value indicating whether the tiser can


give the focus to this control using the TAB key.
Tag Gets or sets the object that contains data abot1t the
control
Text Tb.is .API supports the product infrastructure a11d is not
intended to be used directly from yow code. Gets or
sets the teA1 of the TrackBar.(Overrides Co11trol. Text.)
Tick.Frequency Gets or sets a value that specifies the delta between
ticks drawn on the control.
Tick:Style Gets or sets a value indicating ho\.Vto display the tick
1narks on the track bar.
TO)> Gets or sets the distance, in pixels, betvveen the top
edge of the control and the top edge of its container's
client area.
TopLevelControl Gets the parent control that is not parented by ai1other
Windows Forms control. Typically, tlus is the
outennost Fonn that tl1e control is contained in.
UseW aitCu rso r Gets or sets a value indicatit1g whether to use the wait
ctusor for the current control and all child controls.
Value Gets or sets a numeric value that represents the
current position of the scroll box on the track bar.
Visible Gets or sets a value indicatit1g whether the control and
all its child controls are displayed.
Width Gets or sets the \Vidth of tl1e control.
Win.do,vTargct This API supports the product infrastructure and is not
intended to be used directly fro1n your code. This
property is not relevant for this class.

TREEVIEW

PROPERTY DESCRIPTION
Accessibil.ityObject
--
Gets the AccessibleObject assigned to the control.
AccessibleDefaultActionDesc1;ption Gets or sets the default action desc1iption of the
control for use by accessibility clie11t applications.
Accessib leDescri 1>tion Gets or sets the desc1iption of the control used by
accessibility client applications.
AccessibleName Gets or sets the na1ne of the control tISed by
accessibility client applications.
AccessibleRole Gets or sets the accessible role of the control
AllowDrop Gets or sets a value indicating whether the control can
accept data tl1at the user drags onto it.
Anchor Gets or sets the edges of the container to which a
control is bound and detennines how a control is
resized with its parent.
AutoScrollOtfset Gets or sets \.Vhere this control is scrolled to in
ScrollControllntoView.
PowerShell Studio - Reference Guide I 531

Auto Size This API supports the product infrastructure and is not
intended to be used directly from yo1u code. This
property is not relevant for this class.
BackColor Gets or sets the background color for the
control.(Overrides Control.BackColor.)
Backgrouncllm.age This API supports the prod11ct infrastructure and is not
intended to be used directly from your code. Gets or
set tl1e background iI1IBge for the TreeView
control. (Overrides Contra l.Backgroundlmage.)
Backgrou ndlmageLayou t This API supports the product infrastn1cture and is not
intended to be used directly fro1n your code. Gets or
sets the layout of tl1e background image for tl1e
TreeView control.(Overrides
Control.BackgroundlmageLayout.)
Bin dingContext Gets or sets the BindingContext for the control.
BorderStyle Gets or sets the border style of tl1e tree vie'v control.
Bottom Gets the distance, in pLxels, beuveen the bottom edge
of tl1e control and tl1e top edge of its container's client
area.
Bounds Gets or sets the size and location of the control
including its nonclient elen1ents, in pixels, relative to
the pare11t control.
CanEnablelme Gets a value indicating whether the ImeMode
property can be set to an active value, to enable IME
support.
CanFocus Gets a value indicating whether the control can
receive focus.
CanRaiseEvents Determines if events can be raised on the control.
CanSelect Gets a value indicating \V hether the control can be
selected.
Capture Gets or sets a value indicating whether the control has
captured the n1ouse.
CausesValidation Gets or sets a value indicating ' vhetl1er the control
causes validation to be perforn1ed on any controls tl1at
require validation when it receives focus.
CheckBoxes Gets or sets a value indicating whether check boxes
are displayed next to the tree nodes in the tree view
control.
ClientRectan gle Gets the rectangle that represents the client area of tl1e
control.
ClientSize Gets or sets the height and width of the client area of
the contro1.
Com1>anyName Gets the nan1e of the company or creator of the
application containing the co11trol.
Container Gets the IContainer that contains the Co1nponent.
ContainsFocus Gets a value indicating whether the contro~ or one of
its child controls, cu1Tently has the input foCllS.
ContextMenu Gets or sets the shortcut menu associated with the
control.
532 I PowerShell Studio - A Comprehensive Guide

ContextMenuStrip Gets or sets the ContextMenuStrip associated with


this control.
Controls Gets the collection of controls contained 'vitbin the
control.
Created Gets a value indicati11g whether the control has been
created.
CreateParams This API supports the product infrastructure and is not
intended to be used directly from your code. Gets the
required creation parameters \.vl1en the control handle
is created.(Overrides Control.CreateParams.)
Cursor Gets or sets the cursor t:l1at is displayed when the
mouse pointer is over the control.
DataBindings Gets the data bindings for t:l1e control.
DefaultCu rsor Gets or sets the default cursor for the control.
DefanltlmeMode Gets the default Input Method Editor (IME) inode
supported by t:l1e control.
DefaultMargin Gets the space, in pixels, that is specified by default
between co11trols.
Defau ltMaximumSize Gets the length and height, in pixels. t:l1at is specified
as the default maximum size of a control.
DefaultMinimumSize Gets the length and height, in pixels, that is specified
as the default 1nini111um size of a control.
DefaultPadding Gets the internal spacing, in pixels, of t:l1e contents of
a control.
DefaultSize Gets the default size of the control.(Overrides
Control.DefaultSize.)
DesignMode Gets a value that indicates whether the Component is
ctrrrently in design mode.
DisplayRectangle Gets the rectangle that represents the display area of
the control.
DiS)JOSing Gets a value indicati11g whether the base Control class
is in the process of disposing.
Dock Gets or sets which control borders are docked to its
parent control and deternlines how a control is resized
with its parent.
DoubleBuffered Gets or sets a value indicating whether the control
should redraw its surface using a secondary buffer.
The DoubleBuffered property does not affect the
TreeVie\v control. (Ovenides
Control.DoubleBuffered.)
DrawMode Gets or sets the mode in which the control is drawn.
Enabled Gets or sets a value indicating \vhether the control can
respond to user interactio11.
Events Gets the list of event handlers that are attached to this
Con1ponent.
Focused Gets a value indicating whether tlle control has input
focus.
Font Gets or sets the font of the text displayed by tl1e
control.
PowerShell Studio - Reference Guide I 533

FontHeigbt Gets or sets the height of the font of the control.


ForeColor Gets or sets the foreground color of the
control.(Overrides Control.ForeColor.)
Fu llRowSel.ect Gets or sets a value indicatingwhethet the selection
highlight spans the width of the tree view control.
Handle Gets the \Vindow handle that the control is bound to.
HasChildren Gets a value indicating \;vhet11er the control contains
one or more child controls.
Height Gets or sets the 11eight of t11e control.
HideSelection Gets or sets a value indicating \Vhether the selected
tree node remains highlighted even wl1en the tree
vie\.v lias lost the focus.
HotTracking Gets or sets a value indicating whether a tree node
label takes on the appearance of a hyperlillk as the
mouse pointer passes over it.
Imagelndex Gets or sets the in1age-list index value of tl1e default
image tliat is displayed by tl1e tree nodes.
lmageKey Gets or sets the key of the defattlt i1nage for each node
in t11e TreeVie\v control \.Vhe11 it is in an unselected
state.
lmageList Gets or sets the ImageList that contains the In1age
objects that are used by the tree nodes.
lmeMode Gets or sets the I1iput Method Editor (IME) n1ode of
t11e control.
ImeModeBasc Gets or sets the IME mode of a control.
Indent Gets or sets the distance to indent each child tree node
level.
lnvokeRequired Gets a value indicatiJ.1g \hether the caller must call a11
i11voke i11ethod \.Vhe111naking method calls to the
control because the caller is on a different thread than
the one t11e control was created on.
lsAccessible Gets or sets a value indicating whether the control is
visible to accessibility applications.
IsDis)losed Gets a value indicating \vhether the co11trol has been
disposed of.
IsHancUeCreated Gets a value indicati11g whether the co11trol has a
handle associated with it.
IsMirrored Gets a value indicati11g \hether the control is
mirrored.
ItemHeigbt Gets or sets the height of each tree node iI1 t11e tree
view control.
LabelEdit Gets or sets a value indicating whether the label text
of the tree nodes can be edited.
LayoutEngine Gets a cached instance of the control's layout engine.
Left Gets or sets the distance in pixels. between the left
edge of the control and the left edge of its container's
client area.
LineColor Gets or sets the color of the lines connecting the nodes
of tl1e TreeView control.
534 I PowerShell Studio - A Comprehensive Guide

Location Gets or sets the coordinates of the 11pper-left comer of


the control relati,re to the upper-left comer of its
container.
Margin Gets or sets the space between co11trols.
MaximumSize Gets or sets the size that is tl1e llpper limit that
GetPreferredSi.ze can specify.
MinimumSize Gets or sets the size that is tl1e lower limit that
GetPreferredSize can specify.
Name Gets or sets the name of the control.
Nodes Gets the collection of tree nodes tliat are assigned to
tl1e tree view control.
Padding This API supports the product infrastructure and is not
intended to be used directly from your code. Gets or
sets the spacing between the TreeView control's
contents and its edges.
Parent Gets or sets the parent container of the control.
PathSe11arato r Gets or sets the delimiter string that t11e tree node path
uses.
PreferredSize Gets the size of a rectangular area into '" hicl1 the
control can fit.
ProductName Gets the product name of the assembly containing the
control.
ProductVersion Gets the version of the assembly containing the
control.
Recreatin gHanclle Gets a value indicating whet11er the control is
currently re-creating its handle.
Region Gets or sets the \Vindo'v region associated witl1 the
control.
RenderRightToLeft Obsolete.This property is now obsolete.
ResizeRedraw Gets or sets a value indicating whether the control
redra\vs itself when resized.
Right Gets the dista11ce, in pixels, between the rigl1t edge of
tl1e control and the left edge of its container's client
area.
RightToLeft Gets or sets a value indicating 'vhether control's
elements are aligned to support locales using right-to-
left fonts.
RightToLeftLayout Gets or sets a value that indicates 'vhether the
TreeVie'v should be laid out from right-to-left.
ScaleChildren Gets a value that determines the scaling of child
controls.
Scrollable Gets or sets a value indicating whether the tree view
control displays scroll bars when they are needed.
Selectedlmagelnclex Gets or sets the i111age list index value of the image
that is displayed when a tree node is selected.
Selected Im ageKey Gets or sets the key of the default i111age sho,vn when
a TreeNode is iI1 a selected state.
SelectedNode Gets or sets the tree node that is ctrrrently selected in
tl1e tree vie' v control.
PowerShell Studio - Reference Guide I 535

SbowFocusCues Gets a value indicatingwhether the control should


display focus rectangles.
SholYKeyboard Cues Gets a value indicati.J1g wl1ether the user it1terface is in
the appropriate state to show or hide keyboard
accelerators.
ShowLines Gets or sets a value indicating whether lines are drawn
behveen. tree nodes .i.11 the tree vie\ control
ShowNodeToolTips Gets or sets a value indicating ToolTips ai-e sho\n
when the mouse pointeI hovers over a TieeNode.
ShowPJusMinus Gets or sets a value indicating whether pl11s-sign (+)
and minus-sign(-) buttons are displayed next to tree
nodes that contain child tree nodes.
ShowRootLines Gets or sets a value indicating ,;vhether lines are draw11
between the tree nodes that are at tl1e root of the tree
view.
Site Gets or sets the site of the control.
Size Gets or sets the heigl1t and width of the control.
Sorted Gets or sets a val11e indicating whether the tree nodes
in the tree view are sorted.
StatelmageList Gets or sets the in1age list that is used to indicate the
state of tl1e TreeView and its nodes.
Tabln.dex Gets or sets the tab order of the control within its
container.
TabStop Gets or sets a value indicating whether the user can
give the focus to this control using the TAB key.
Tag Gets or sets the object that contains data about the
control.
Text This API supports the product infrastrucnrre and is not
intended to be used directly from your code. Gets or
sets the te>...1 of the TreeView. (Overrides
Control.Text.)
Top Gets or sets the distance, in pixels, between the top
edge of the control and the top edge of its container's
client area.
To1>LevelControl Gets the parent control that is not parented by another
Windows Forms control. Typically, this is the
outermost Forni that the control is contained in.
TopNode Gets or sets the first fully-visible tree node i11 the tree
view control.
TreeViewNodeSorter Gets or sets the implementation of I Comparer to
perforn1 a custo1n sort of tl1e TreeView nodes.
UseWait Cursor Gets or sets a value indicating whether to use the wait
cursor for the current control and all child controls.
Visible Gets or sets a value indicating whether the control and
all its child co11trols are displayed.
VisibleCount Gets the number of tree nodes that can be fully visible
in the tree view control.
Width Gets or sets the width of the control.
536 I PowerShell Studio - A Comprehensive Guide

WindowTarget This API supports the product infrastructme and is not


intended to be used directly from yom code. This
property is not relevant for this class.

VSCROLLBAR

AccessibilityObject
Gets the AccessibleObject assigned to the control.
AccessibleDefaultActionDesc1iption Gets or sets the default action description of the
control for use by accessibility client applications.
AccessibleDescription Gets or sets the description of the control used by
accessibility client applications.
AccessibleN ame Gets or sets the nan1e of the control used by
accessibility client applications.
i\ccessible:R.ole Gets or sets the accessible role of the control
Allo,vDro1> Gets or sets a value indicating vvhether the control can
accept data that the user drags onto it.
Anchor Gets or sets the edges of the container to which a
control is bound and determines how a control is
resized with its parent.
AutoScrollOffset Gets or sets where this contTol is scrolled to in
ScrollControllntoVievv.
Auto Size Gets or sets a value indicating whether the ScrollBar
is automatically resized to fit its contents.(Inherited
from ScrollBar.)
BackColor This API supports the product infrastn1cture and is not
intended to be used directly fro1n.your code. Gets or
sets the background color for the co11trol.(I11herited
from ScrollBar.)
Backgroundlmage This API supports the product infrastructure and is not
intended to be used directly from your code. Gets or
sets the background inIBge displayed in the
control.(Inherited from ScrollBar.)
Backgrou ndlmageLayout This API supports the product infrastn1cture and is 11ot
intended to be used directly fro1n your code. Gets or
sets the background il1i.age layout as defined in the
ImageLayont enumeration. (Inherited from ScrollBar.)
Bin dingContext Gets or sets the BindingContext for the control.
Bottom Gets the distance, in pixels, between tl1e botto1n edge
of the control and the top edge of its container's client
area.
Bounds Gets or sets the size and location of tl1e control
including its nonclient elements, in pixels, relative to
tl1e parent control.
CanEnablelme Gets a value indicating whether the ImeMode
property ca11 be set to an active value, to enable IME
support.
PowerShell Studio - Reference Guide I 537

CanFocus Gets a value indicatingwhether the control can


receive focus.
CanRaiseEvents Detennines if events can be raised on the control.
CanSelect Gets a value indicating wl1ether the control can be
selected.
Capture Gets or sets a value indicating \vl1ether the control has
captured the mouse.
CausesValidation Gets or sets a value indicating whether the control
causes validation to be performed on any controls that
require validation vvben it receives focus.
CtientRectan gle Gets the rectangle that represents the client area of the
control.
CJien.tSize Gets or sets the height and widtl.1 of the client area of
the contro1.
Com1JanyName Gets the name of the company or creator of the
application containing the control.
Container Gets the !Container that contajns the Component.
ContainsFocus Gets a value indicating 'vhether tl1e control. or one of
its child controls, currently has the input focus.
ContextMenu Gets or sets the shortcut rnenu associated with tl1e
control.
ContextMenuStrip Gets or sets the ConteA1MenuStrip associated vvith
this control.
Cont10Js Gets the collection of controls contained within tl1e
control.
Created Gets a value indicating \vhether tl1e control has been
created.
CreateParams This API supports tl1e product infrastructure and is not
intended to be used directly from your code. Gets the
required creation parameters when the control handle
is created.(Overrides ScrollBar.CreateParams.)
Cursor Gets or sets tl1e cursor that is displayed '1vhen tl1e
n1ouse pointer is over tl1e control.
DataBindings Gets the data bindings for the control.
DefaultCursor Gets or sets tl1e default cttrsor for the control.
DefaultlmeMode Gets the default Input Method Editor (Th.1E) .mode
suppo1ted by this control.(Inherited from ScrollBar.)
DefaultMargin Gets the default distance beh:veen the ScrollBar
control edges and its contents. (Inl1e1ited from
ScrollBar.)
DefaultMaximumSize Gets fue lengtl1 and height, in pixels, that is specified
as the defa1tlt niax:in1um size of a control.
DefaultMinimumSize Gets the lengtl1 and height, in pixels, that is specified
as the default minim11m size of a control.
DefaultPadding Gets the intenlal spacing in pixels, of the co11tents of
a control.
DefaultSize Gets the default size of the control.(Overrides
Control.DefattltSize.)
538 I PowerShell Studio - A Comprehensive Guide

DesignMode Gets a value that indicates whether tl1e Component is


Clrrrently in design mode.
DisplayRectangle Gets the rectangle that represents tl1e display area of
the control.
DiSJlOSing Gets a value indicating wbetl1er the base Control class
is in the process of disposing.
Gets or sets which control borders are docked to its
parent control and deten11ines how a control is resized
with its parent.
DoubleBuffered Gets or sets a value indicating whether this control
should redraw its surface using a secondary buffer to
reduce or prevent flicker.
Enabled Gets or sets a value indicating \;vhether the control can
respond to user interaction.
Events Gets the list of event handlers that are attacl1ed to this
Component.
Focused Gets a value indicating whether the control has input
focus.
Font This AP! supports tile product infrastructure and is not
intended to be used directly fro1nyour code. Gets or
sets the font of the text displayed by tlle
control.(Inl1erited frorn ScrollBar.)
FontHeigbt Gets or sets the height of the font of the control.
ForeColor This API supports U1e product infrastruct11re and is not
intended to be used directly fro.in your code. Gets or
sets the foregro1111d color of the scroll bar
control.(I11herited from ScrolIBar.)
Han.die Gets the window handle that tl1e co11trol is bom1d to.
HasChildren Gets a value indicating whether the control contains
one or rnore child controls.
Height Gets or sets the height of the control.
ImeMode Gets or sets the Input Method Editor (IME) mode
supported by this control.(Inl1erited from ScrollBar.)
ImeModeBase Gets or sets the IME inode of a control.
InvokeRequired Gets a value indicating'"'hether the caller must call an
invoke method when making metllod calls to the
control because the caller is on a different thread than
the one tl1e control was created on.
IsAccessible Gets or sets a value indicafu1g vvhether the control is
visible to accessibility applications.
IsDisposed Gets a value indicating whether the control has been
disposed of.
IsHandleCreated Gets a value indicating \hetl1er the control has a
handle associated witl1 it.
IsMir10 red Gets a value indicating whether the control is
mirrored.
LargeChange Gets or sets a value to be added to or subtracted from
the Value property when the scroll box is n1oved a
large distance.(Inherited from ScrolJBar.)
PowerShell Studio - Reference Guide I 539

LayoutEngine Gets a cached instance of the control's layout engine.


Left Gets or sets the distance, in pix:els, between the left
edge of the control and the left edge of its container's
client area.
Location Gets or sets the coordinates of tl1e upper-left corner of
the control relative to the upper-left corner of its
container.
Margin Gets or sets the space bet,;veen controls.
Maximum Gets or sets the upper li1nit of values of the scrollable
range.(Inherited from ScrollBar.)
MaximumSize Gets or sets the size that is the upper limit that
GetPreferredSize can specify.
Minimum Gets or sets the lower li1nit of values of the scrollable
range.(lnherited from ScrollBar.)
MinimumSize Gets or sets tbe size that is the lower li1nit that
GetPrefe1TedSize can specify.
Name Gets or sets the name of the co11trol.
Padding Gets or sets padding within the control.
Parent Gets or sets the pare11t contail.1er of the control.
PrefenedSize Gets the size of a rectangular area into wl1ich the
co11trol can fit.
ProductN ame Gets the product name of the assembly containing the
control.
ProcluctVersion Gets the version of the assembly containing the
control.
RecreatingHandle Gets a value indicating \hether the control is
currently re-creating its handle.
Region Gets or sets the window region associated with the
control.
RenderRightToLeft Obsolete.This property is now obsolete.
ResizeRedraw Gets or sets a value indicating whether the control
redraws itself when resized.
Right Gets tl1e distance, in pixels, betwee11 tl1e right edge of
the control and the left edge of its container's client
area.
RightToLeft This API supports the product infrastructure and is not
intended to be used directly from your code. Gets a
value indicating whether control's ele1nents are
aligned to support locales using right-to-left
fonts.(Overrides Control.RightToLeft.)
ScaleChildren Gets a value that detennines the scaling of child
controls.
SholvFocasCoes Gets a value indicati11g \hether the control should
display focus rectangles.
ShowKeyboard Cues Gets a value indicating\hether the user interface is in
the appropriate state to show or hide keyboard
accelerators.
Site Gets or sets the site of the control.
540 I PowerShell Studio - A Comprehensive Guide

Size Gets or sets the height and width of the control.


Small Change Gets or sets the value to be added to or subtracted
from the Value prope11y when the scroll box is moved
a s1nall dist311ce.(Inherited from ScrollBar.)
Tablndex Gets or sets the tab order of the control within its
container.
TabStop This API supports the product infrastn1cture and is not
intended to be used directly fro1n your code. Gets or
sets a value indicating wl1etber the user can give the
focus to the ScrolJBar control by using the TAB
key. (Inherited fro1n ScrollBar.)
Tag Gets or sets the object that contains data about the
control.
Text This API supports the product infrastructure and is not
intended to be used directly fro1n your code. Gets or
sets the text associated with this control.(Inherited
fro111 ScrollBar.)
Top Gets or sets the distance in pixels, between the top
edge of the control and the top edge of its container's
client area.
TopLevelControl Gets tl1e parent control tlwt is not parented by m1other
Windows Forms control. Typically, this is the
outermost Fonn that the control is contained in.
UseW aitCursor Gets or sets a value indicating wl1ether to use the wait
cursor for the current control and all child controls.
Value Gets or sets a nu1neric value tl1at represents the
current position of tlle scroll box on the scroll bar
control.(l11herited fro1n ScrollBar.)
Visible Gets or sets a value indicating whet11er the control and
all its child controls are displayed.
Width Gets or sets the \idth of the control.
Window Target This API supports the product infrastn1ct1ue and is not
intended to be used directly fro1n your code. This
property is not relevant for this class.

WEBBROWSER

PROPERTY DESCRIPTION
AccessibilityO bject Gets the AccessibleObject assigned to the control.
Accessi.b leDefaultActionDescription Gets or sets the default action desc1iption of the
control for use by accessibility client applications.
AccessibleDescription Gets or sets the description of the control used by
accessibility client applications.
AccessibleName Gets or sets the name of the control used by
accessibility client aeplications.
AccessibleRole Gets or sets the accessible role of the control
PowerShell Studio - Reference Guide I 541

ActiveXlnstance This API supports the product infrastructure and is not


intended to be used directly from your code. Gets the
underlying ActiveX WebBrowser control.(Inherited
from WebBrowserBase.)
AllowDroJJ This API supports the product infrastructure and is not
intended to be used directly fro1n your code. This
property is not supported by this control.(Inherited
from WebBrowserBase.)
AllowNavigation Gets or sets a value indicating whether tl1e control can
11avigate to anotl1er page after its initial page has been
loaded.
AJJowWebBrowserDrop Gets or sets a value indicating whetl1er the
WebBrowser control navigates to documents that are
dropped onto it.
Anchor Gets or sets the edges of the container to \hicl1 a
control is bound a11d determines how a control is
resized vvitb its parent.
AutoScrolJOffset Gets or sets where tllis control is scrolled to in
ScrollControllntoView.
AutoSize This API supports the product infrastructure and is not
intended to be used directly fro1n yo1u code. This
property is not relevant for this class.
BackColor This API supports the product infrastructure and is not
intended to be used directly from your code. This
property is not mea1lingful for this co11trol.(Inherited
from WebBrowserBase.)
Backgroundlmage This API suppo1ts tlle product infrastructure and is not
intended to be used directly fro1n your code. This
property is 11ot supported by this control.(Inherited
fro1n WebBrowserBase.)
Bac.kgrou ndlmageLayou t Tllis API supports the product infrastructure and is not
intended to be used directly from yo1rr code. Tllis
property is not supported by this control.(Inherited
fro1n WebBrowserBase.)
BindingContext Gets or sets the BindingContex.1: for the control.
Bottom Gets the distance, in pixels ben;veen the botto1n edge
of the control and the top edge of its container's client
area.
Bounds Gets or sets the size and location of tl1e control
including its nonclient elements, in pi.~els, relative to
the parent control.
CanEnabJelme Gets a value indicating whether the ImeMode
property can be set to an active value, to enable IME
support.
CanFocus Gets a value indicating \Vhether the control can
receive focus.
CanGoBack Gets a value indicating \hether a previous page in
navigation history is available, which allows the
GoBack method to s11cceed.
542 I PowerShell Studio - A Comprehensive Guide

CanGoForward Gets a value indicating whether a subsequent page in


navigation history is available, which allows the
GoFoiward method to succeed.
CanRaiseEvents Detennines if events can be raised on the control.
CanSclect Gets a value indicating whether the control can be
selected.
Capture Gets or sets a value indicating 'vhetl1er the control has
captured the inotISe.
CausesValidation Gets or sets a value indicating whetl1er the control
causes validation to be perfonned on ai1y controls that
require validation when it receives focus.
ClientRectangle Gets the rectangle that represents tl1e client area of tl1e
control.
C.lientSize Gets or sets the height and width of the client area of
the control.
CompanyName Gets the name of the company or creator of the
application containing the control.
Container Gets the !Container that contains the Component.
ContainsFocus Gets a valtie indicating whether the control, or one of
its clrild controls, currently lias the input focus.
ContextMenu Gets or sets the shortcut menu associated with the
control.
ContextMenuStrip Gets or sets the ContextMenuStrip associated with
this control.
Controls Gets the collection of controls contained within the
control.
Created Gets a value indicating whether the control has been
created.
CreateParams Gets the required creation parameters when the
control handle is created.
Cursor This API supports the product infrastruchrre and is not
intended to be used directly fro1n your code. This
property is not supported by this control. (Inherited
from WebBrowserBase.)
DataBindings Gets tl1e data bindings for the control.
DefaultCursor Gets or sets the default cursor for tl1e control.
Defau ltlmeMode Gets the defa1tlt Input Method Editor (IME) mode
supported by tl1e control.
DefaultMargin Gets the space, in pixels, that is specified by defattlt
between controls.
Defau ltMaximumSize Gets the length and height, in pixels, that is specified
as the default maximum size of a control.
DefaultMinimumSize Gets the length and 11eight, in pixels, that is specified
as the default minimum size of a control.
DefaultPadcting Gets the intenial spacing, in pixels, of the contents of
a control.
DefaultSize Gets the default size of the control.(Overrides
WebBrowserBase.DefaultSize.)
PowerShell Studio - Reference Guide I 543

DesignMode Gets a value tliat indicates vvhether the Component is


currently in design mode.
Dis11layRectangle Gets the rectangle that represents the display area of
the control.
Disposing Gets a value .indicating \Vhether the base ContTol class
is in the process of disposing.
Dock Gets or sets wltlch control borders are docked to its
parent control and detennines 11ow a control is resized
with its parent.
Document Gets an HtmlDocmnent representing the Web page
currently displayed in the WebBrowser control.
DocumentStream Gets or sets a stream containing the contents of the
Web page displayed iI1 the WebBrowser control.
DocumentText Gets or sets the HTML co11tents of the page displayed
in tl1e WebBrovvser control
DocumeotTitle Gets the title of the doc1unent currently displayed in
the WebBrowser control.
DocumentType Gets the type of the docmnent cttrrently displayed in
the WebBro,vser control.
DoubleBuffered Gets or sets a value indicating whetl1er this control
should redraw its s1rrface using a secondary buffer to
reduce or prevent flicker.
Enabled Tllis API supports the product infrastn1cture and .is not
intended to be used directly from yo1u code. This
property is not supported by tllis control.(In11erited
from WebBrowserBase.)
Encryption Level Gets a value indicating the encryption metl1od used by
the document currently displayed in the WebBrowser
control.
Events Gets the list of event handlers that are attached to this
Component.
Focused Gets a value .indicati11g \vhether the co11trol or any of
its cl1ild windows has input focus.(Overrides
Control.Focused.)
Font Tllis API supports the product infrastructure and is not
intended to be used directly fron1 your code. Tlris
property is not 111ea1ringfu1 for this control.(Inherited
fro1n WebBrowserBase.)
FontHeight Gets or sets the height of the font of the control.
ForeColor This API supports the prod11ct infrastructure and is not
intended to be used directly from yotir code. This
property is not meaningfttl for this control.(Inherited
from WebBrowserBase.)
Handle Gets the 'vindow handle that the control is boi1nd to.
Has Children Gets a value indicatiJ.1g whether the control contains
one or 111ore child controls.
Height Gets or sets the height of the control.
ImeMode This API supports the product infrastn1ct1ue and is not
intended to be used directly fro1n your code. Th.is
544 I PowerShell Studio - A Comprehensive Guide

property is not meaningful for this control.(lnherited


from WebBrowserBase.)
lmeModeBase Gets or sets the IME nlode of a control.
InvokeRequired Gets a value indicating whether the caller 1nust call an
invoke method when making rnethod calls to the
control because the caller is on a different thread thai1
the one the control ,;vas created on.
IsAccessible Gets or sets a value indicating wbetl1er the control is
visible to accessibility applications.
IsBusv., Gets a value indicating \Vhether the WebBrowser
control is currently loading a new document.
lsDisposed Gets a value indicating whether the control bas been
disposed of.
IsHandleCreated Gets a value indicating 'vhether the control bas a
llalldle associated \Vith it.
IsMirrored Gets a value i11dicating ,;vhetber the control is
mirrored.
lsOffline Gets a value indicating \Vhetl1er the WebBrowser
control is in offline mode.
IsWebBrowserContextMenuEnabled Gets or a sets a value indicating whether the shortcut
menu of the WebBro,vser control is enabled.
LayoutEngine Gets a cached instance of the control's layout engine.
Left Gets or sets the distance, it1 pixels, between tl1e left
edge of the control and the left edge of its container's
client area.
Location Gets or sets the coordinates of the upper-left comer of
the control relative to the upper-left corner of its
container.
Marg.in Gets or sets the space bet"\veen controls.
MaximumSize Gets or sets the size that is tl1e upper limit tl1at
GetPreferredSize cai1 specify.
Minimum Size Gets or sets the size that is tl1e lo\ver limit that
GetPreferredSize can specify.
Name Gets or sets the name of the control.
ObjectForScripting Gets or sets an object that can be accessed by
scripting code that is contained within a Web page
di~layed in tl1e WebBro\.vser control.
Padding This API supports the product infrastn1cture and is 11ot
intended to be used directly from youT code. This
property is not meanit1gful for tllis control.
Parent Gets or sets the parent container of the control.
PreferredSize Gets the size of a rectangular area into whicl1 the
control can fit.
ProductN ame Gets the product name of the assembly contai1ring the
control.
ProductVersion Gets the version of the assembly containing the
control.
ReadyState Gets a value indicating the current state of tl1e
WebBrowser control.
PowerShell Studio - Reference Guide I 545

RecreatingHancUe Gets a value indicating whether the control is


currently re-creating its handle.
Region Gets or sets the \vindo\;v region associated with the
control.
Rende1RightT0Left Obsolete.This property is now obsolete.
ResizeRedraw Gets or sets a value indicating wl1ether the control
redra'\ivS itself when resized.
Right Gets the distance, iI1 pixels, ben;veen the right edge of
the control and the left edge of its contaiI1er's client
area.
RigbtToLeft This API supports the product infrastructtue and is not
intended to be used directly fron1 your code. This
property is not supported by this control.(In.herited
from WebBrowserBase.)
ScaleChildren Gets a value that deterinines the scaling of child
controls.
ScriptErrorsSupp resscd Gets or sets a value indicating'"hether the
WebBro,vser displays dialog boxes such as script
error messages.
ScrollBarsEnabled Gets or sets a value indicating whether scrolJ bars are
displayed iI1 the WebBrowser control.
ShowFocusCues Gets a value indicating \vhether the control should
display focus rectangles.
Sbo\vKeyboard Cues Gets a value indicating \Vhether the ltser il1terface is in
the appropriate state to show or hide keyboard
accelerators.
Site This API supports the product infrastructure and is not
intended to be used directly from your code. Gets or
sets tl1e site of the control.(Inl1erited from
WebBrowserBase.)
Size Gets or sets U1e height and width of the control.
StatusText Gets the status text of the WebBro\vser control.
Tab Index Gets or sets t11e tab order of the control withll1 its
container.
TabStop Gets or sets a value indicating whether the user can
give the focus to this control using the TAB key.
Tag Gets or sets tl1e object that contains data about the
control.
Text Tllis API supports the product infrastructure and is not
intended to be used directly fron1 yolrr code. This
property is not supported by this control.(Inherited
fro111 WebBrowserBase.)
TO(l Gets or sets the distance, in pixels, bet\;veen the top
edge of the control and the top edge of its co11tainer's
client area.
TopLevelControJ Gets the parent control that is not parented by another
Windows Forms control. Typically, this is tl1e
outermost Forni that tl1e control is contained in.
Uri Gets or sets the URL of the current docu1nent.
546 I PowerShell St udio - A Comprehensive Guide

UseW aitCursor This API supports the product infrastructure and is not
intended to be used directly from your code. This
property is not supported by this control.(Inherited
fro1n WebBro"1serBase.)
Version Gets tl1e version of Internet Explorer installed.
Visible Gets or sets a value indicating whether tlle control and
all its child controls are displayed.
WebBrowserShortcutsEnabled Gets or sets a value indicating whether keyboard
shortcuts are enabled within the WebBro,vser control.
Width Gets or sets the width of the control.
Windo,vTarget This API supports the product infrastn1cture and is not
intended to be used directly from your code. This
property is not relevant for this class.
PowerShell Studio - Reference Guide I 547

INDEX

BREAKPOINTS ..... ...................................... ...... 61


BUILD OPTIONS .............................................. 86
.NET OBJECT BROWSER ............................... 114
BUTION .................. ......... ....... ....... 125, 132, 179
A BUTION EVENTS ........................................... 180
ACCESSIB ILITY ...................................... 119, 153 BUTION MANIPULATION .. ........................... 182
ALLOWDROP ..... 155, 339, 343, 347, 352, 357, c
363,368,374,378,390,395, 401 , 405,4 10,
CACHE.................................................. 327, 329
417,422, 427,432,438, 448,451 , 457, 462,
CALL STACK PANE....................................... 1O7
470, 480,487,493,498,503,510,518,525,
CAUSESVALIDATION. 156, 340, 344, 352, 364,
530, 535, 540
369,375,379, 401,418,423, 428, 433,448,
ALTERNATE CREDENTIALS .............................. 83
453,458,471, 488,49 4, 499, 519,526, 530,
ASSEMBLIES SETIINGS ..................................... 40
536,541
AUTOSCALEMODE ..... 156, 299, 378, 432, 452,
CHART .... ......................... .............. 125, 132, 185
470
CHECK SYNTAX .............................................. 97
AUTOSCROLL ..... 157, 363, 379, 422, 432, 452,
CHECKBOX ..... ... .................................. 125, 191
470, 488, 498, 518
CHECKLISTBOX .. .......................................... 125
AUTOSCROLLMARGIN ....... 157, 363, 379, 422,
CLIPBOARD .................................................... 57
432,452,470,488,498,5 18
COLLECTION PROJECT ....................... 171, 172
AUTOSCROLLMINSIZE 157, 363, 379, 422, 432,
COLOR DIA LOG ................................... 126, 200
452,470,488,498,5 18
COMBOBOX .. 30, 81, 189, 20 l , 202, 203, 208,
AUTOSIZEMODE ............................................ 157
293,336,358,359,361
AUTOVALIDATE .... 155, 299, 379, 432, 452, 471
COMBOBOX ................................ 126, 132, 20 l
B COMPARE FILES .......................................... ... 93
BACKCOLOR ..... 153, 168, 200, 201, 269, 299, CONSOLE LAYOUT ...................................... 105
338,339,343,352,363,369,374,379,401, CONSOLE PANE .......................................... 107
417, 422, 427, 433,448,452, 457, 471,488, CONSOLE SETIINGS ...................................... 27
493, 494, 498,519, 524, 525, 530,535,540 CONTEXTMENUSTRIP. 126, 155, 203, 204, 205,
BACKGROUNDIMAGE ....... 153, 159, 339, 343, 206,208, 214, 263,340,344, 353,364,366,
352,363,369,374,379,401, 417, 422, 427, 367,370,375,380,402,418, 423,428, 433,
433, 448, 452, 457,471,488, 494, 498, 519, 449 , 453,458, 472,489,494, 499,520,526,
525,530, 535, 540 531,536,541
BACKGROUNDIMAGELA YOUT . 153, 299, 339, CONTEXTMENUSTRIP ........................... 126, 203
343,352,363,369,374,379, 401 , 417,422, CONTROL REFERENCE .. ............ .................... 79
427,433, 448, 452,457,471, 488, 494, 498, CONTROLSETS ............................................. 125
519,525, 530,536,540 CONTROLBOX ... ............ .............................. 159
BIT-DEPTH ................... ....................................233 CONTROLS ................................................... 125
CREATE FORM TEMP LA TE .............................. 77 EXPLORER STYLE FORM ........ ........................ 143
CREATE PROPERTY SET ... ............................... 74 EXPORT ............................................................ 79
CUSTOMMENU.INF ......................................... 96
F
D
FILES AND FOLDERS ....................................... 89
DATABASE BROWSER .................................. 114 FILESYSTEMWATCHER ........... ............... 126, 224
DATABINDINGS .. 155, 340, 344, 353, 364, 370, FIND RESULTS PANE ............................... ....... 110
375,380, 402, 418,423, 428, 434,449,453, FIREWALL ......................................................... 20
458,472,489,495,499,520, 526,531,536, FLOWLAYOUTPANEL ........................... 127, 227
541 FOLDERBROWSERDIALOG ... 81, 228, 267, 336
DATA GRID ............................................ 126, 209 FOLDERBROWSERDIALOG .......................... 127
DATAGR IDVIEW ..... 78, 81, 126, 144, 145, 147, FOLDERBROWSERMODERNDIALOG. 127, 228
155, 195, 209, 210, 212, 2 13, 214, 215, 217, FONTDIALOG ........ ............................... 127, 229
336,368, 369,370,371,372,373,374 FONTS AND COLORS ........... .......................... 35
DATAGRIDVIEW ................................... 126, 209 FORM BORDER STYLES................................. 139
DATETIMEPICKER .................................. 126, 215 FORM DESIGN ..................................... 135, 137
DEACTIVATE LICENSE .................................... 21 FORM PROJECTS .......................................... 165
DEBUG CONSOLE PANE ............................. 108 FORM PROPERTIES ....................................... 153
DEBUG LAYOUT ............................................ 105 FORM ATIING SETTINGS ................................. 40
DEBUG PANE ...... .... ........... .... ... .... ........ ... ..... 107 FULL GRID SEARCH TEMP LA TE .................... 144
DEBUGGER SETIINGS..................................... 28 FUNCTION EXPLORER PANE ........................ 111
DEBUGGING ................................................... 60
G
DECLARATION .............................................. 111
DEPLOY ... ... .............. ............ ...... .. ............ . 66, 79 GEN ERA L SETIINGS ........................................ 24
DEPLOYMENT ................................................. 91 G IT........................................................... 51 , l 02
DESIGN ER LAYOUT....................................... l 06 G LOBAL SCOPE ....... ............ ........................ 170
DESIGN ER SETTINGS ....................................... 29 G LOBALS. PSl ............................... 166, 168, 169
DESIGNER TAB ................................................ 68 GRID JOB TEMPLATE ............ ........................ 145
DIA LOG STYLE FORM ..................... .............. 142 GRID SEARCH TEMPLATE ............................. 146
DOCUMENT EXPLORER ................................. 55 GRID TEMPLATE ............................................ 147
DOEVENTS ........... 3 12, 313, 319, 320, 321, 322 GROUPBOX .. .... .................... 230, 269, 275, 307
DOMAINUPDOWN ............................... 126, 217 GROUPBOX .......................................... 127, 230
DOUBLEBUFFERED ...... 155, 340, 345, 353, 365, H
370,376, 380, 402, 418, 424, 429,434,449,
454,459, 472, 490, 495, 500,52 1, 527, 532, HELP PANE .................................................... 112
537, 542 HELP TAB ........................................................ l 03
HELPBUTION ................................................. 160
E HELPPROVIDER .................................... 127, 231
ED IT0 R LAY0 UT. ... ............. ........................... 10 6 HEX ................................................ 200 20 l , 338
I

EDITOR SETIINGS ............................................ 32 HOMETAB ................. ... ................................... 57


ELEVATED PRIVILEGES ................................. 338 HSC ROLLBAR ................................................ 127
EMPTYFORM ....................... 138, 141, 163, 164 I
ERRORPROVIDER ........................... .............. 126
EXECUTION RESTRICTIONS ............................ 84 IMAGELIST ............................................ 127, 232
PowerShell Studio - Reference Guide. I 549

IMEMODE... 155, 340, 341, 344, 345, 352, 354, NOTIFYICON .......... ............................... 129, 262
364, 365, 369, 371,375,376, 379, 381,401, NUMERICUPDOWN ............................. 129, 266
403, 417, 419, 423,425,427, 429, 433, 435,
0
448, 449, 452, 454, 458,459, 471,473,488,
491, 494, 496, 499, 500, 519, 521 , 525,527, OBJECT BROWSER PANE ............................ 114
530, 532, 536, 537, 541 , 543 OFFLINE ACTIVATION .............................. ...... 21
INSTALLATION OPENFILEDIALOG .......... ........ 81, 267, 268, 336
COMPLETE................................................... 19 OPENFILEDIALOG ................................ 129, 267
CUSTOM .. ........... .... .................... ............... .. 19 OUTPUT FOLDER ............................................. 89
TYPICAL ....................................................... 19 OUTPUT PANE ............................................... 115
ISMIDCONTAINER ......................................... 160 OUTPUT SETIINGS ........................................... 82

L p

LABEL .. 167, 222, 234, 235 , 249, 27 6, 291, 293, PACKAGER .................................................... 80
296, 307, 401,403,404 PADDING .... 158, 341, 346, 350, 354, 361, 366,
LA BEL .................................................... 128, 234 372,377, 381,393, 399,403, 409,415,420,
LINKLABEL ............................................. 128, 235 425, 430, 435, 450,455,460, 466, 474, 485,
LISTBOX .................. ............................... 128, 236 491,496, 501, 507,516, 522, 528, 533, 538,
LISTVIEW........................................ 128, 133, 238 544
LOCAL CACHE ............................................... 58 PANEL ................................................... 129, 269
LOCAL SCOPE .............................................. 170 PANEL SETIINGS ............................................. 48
PAN ES ........................................................... l 0 7
M
PERFORMANCE PANE................................. 116
MANIFEST ................................................ 83, 173 PICTUREBOX ........ 270, 271, 307, 444, 445, 447
MASKEDTEXTBOX ................................. 128, 252 PICTUREBOX .......................... ............... 129, 270
MAXIMUMSIZE .... 158, 299, 34 l , 345, 354, 366, PLATFORM ....... ... ............ .... .... ... ..... ... ......... ... . 58
372, 377,381, 403, 420, 425,429 , 435, 450, POWERREGEX ................................................ 98
455, 460, 473, 491 , 496, 501, 522, 528, 533, POWERSHELL BROWSER .............................. 114
538, 543 POWERSHELL HELPWRITER ............................ 98
MDI FORM ..................................................... 165 POWERSHELL SETIINGS ................................. 49
MENU TEMPLATE ........................................... 148 PRESETS .. ......................... ...................... .......... 36
MENUSTRIP ........................................... 128, 257 PRIMALSCRIPT ........... 82, 95, 98, 332, 333, 336
MINIMUM REQUIREMENT ............................... 19 PRIMALSQL ........................................ ............. 98
MIN IMUMSIZE ..... 158, 341 , 345, 354, 366, 372, PRIMALXML .................................................... 98
377, 381 , 403, 420, 425, 429, 435, 450, 455, PRIVATE SCOPES ......................................... 170
460, 473, 491, 496, 501, 522, 528, 533, 538, PROFILE EDITOR ............................................. 98
543 PROGRESSBA R............................. 129, 133, 271
MODULE PROJECTS ..................................... 172 PROGRESSBAROVERLA Y .................... 129, 271
MONTHCALENDAR ............................. 128, 260 PROJECTPANE ............................................ 117
MSI SETIINGS ... ................................................86 PROPERTY PANE .......................................... 119
MULTI-FORM PROJECTS .... .................. 166, 171 PROPERTYGRID .. .................................. 129, 273
N R
NOTIFYICON .................. 20, 129, 262, 265, 266 RADIOBUTION ..................................... 130, 275
RECOVERY DATA ................................... 30, 167 TA BCONTROL ....................... ............... 130, 284
REMOTE CACHE .................................... 59, 329 TABLELAYOUTPANEL ........................... 131, 286
REMOTE CONNECTION ................................. 59 TEMP LA TES ............................................. 73, 138
REMOTE CONSOLE ........................................ 59 TEXT BOX TEMPLATE ..................................... 150
REMOTE SCRIPT EXECUTION ENGINE .......... 20 TEXT BOX WITH SEARCH TEMPLATE ............ 151
RESTORE POINTS ....... ...................... .............. l 00 TEXTBOX 81, 167, 192, 196, 208, 210, 219 , 220,
REWIND ............................ I 100
222,228, 268, 276, 277, 280, 28 1,287,288,
RICHTEXTBOX ................... ..................... 130, 27 6 293, 307,315,317,336, 361, 507
RIGHTTOLEFTLA YOUT. 154, 377, 430, 450, 497, TEXTBOX ....................................... 131, 133, 288
528,534 TIMER .................................................... 131, 289
RSEE DEPLOYMENT ...................................... 33 1 TOO LBAR .............................................. 131, 292
RSEE RESTRICTIONS ...................................... 334 TOOLBOX PANE ........................................... 125
TOOLS TAB ......................................................92
s
TOOLSTRIP ................................ ............ 131 , 293
SA VEF ILEDIALOG .................. 81, 277, 278, 336 TOOLTIP ................................. ............... 131 , 294
SAVEFILEDIALOG ................................. 130, 277 TRACEPOINTS ................................................. 61
SCOPE VARIABLES ....................................... 170 TRACKBAR ............................................ 13 1, 295
SCRIPT ENGINE SETIINGS .............................. 80 TREEVIEW ...................... ......... ............... 131, 30 l
SCRIPT MODULE .......................... l 72, l 73, 174
SCRIPT SCOPE .............................................. 170
u
SCRIPTMERGE ..................................... 19, 93, 94 UPDATES ........................................................ 104
SIGN SCRIPT .................................................... 9 2 USEMNEMON IC ................... 142, 342, 404, 461
SIGN ING .. .... ....... ... ......... ....... .... .... ............... .. . 83 USEWAITCURSORl 54, 342, 347, 356, 367, 374,
SIGN ING ......... .... .... ... ..... ....... .... ........ .... ... ... .... 90 378,383, 404, 421,426, 431,436,451,456,
SIGNING WIZARD ........................................... 90 461,475,493,498,502,523,529,535,539,
SINGLE THREADED APARTMENT ...81 , 155, 336 545
SN IPPET EDITOR ............................................ 121
v
SN IPPETS PANE ............................................. 121
SOURCE CONTROL SETTINGS ....................... 50 VER IFY SCRIPT ....................... ..........................9 7
SOURCE CONTROL TAB ................................ 99 VERSION INFORMATION ................................ 85
SPLITCONTAINER .................................. 130, 278 VERSIONRECALL .......... ...... 26, 51, 98, 100, 101
SPLITIER................................................. 130, 280 VIEWTAB ....................................................... 104
STA ............................................ 8 l , 8 2, l 55, 33 6 VSCROLLBAR ....................................... 132, 302
STAGING FOLDER ................................... ....... 89 w
STARTPOSITION ............................ 158, 159, 299
STARTUP.PSS ......................... 166, 168, 169, 172 WEBBROWSER ...... 303, 540, 542, 543, 544, 545
STATUSBAR ....... ..................................... 130, 28 1 WEBBROWSER ....................... ............... 132, 303
STATUSSTRIP .......................................... 130, 282 WIZARD TEMPLATE ....................................... 152
WMI BROWSER ............................................. 114
T WMI EXPLORER ............ ......... ... .......................98
TAB CONTROL TEMPLATE .................. .......... 149 WRAP COMMANDS ................ ....................... 39
TAB ORDER .............................................. . 72, 73

You might also like