Foreword |
|
xv | |
Introduction |
|
xvii | |
|
Chapter 1 Overview of Windows PowerShell 3.0 |
|
|
1 | (20) |
|
Understanding Windows PowerShell |
|
|
1 | (1) |
|
Working with Windows PowerShell |
|
|
2 | (4) |
|
Security issues with Windows PowerShell |
|
|
4 | (2) |
|
Using Windows PowerShell cmdlets |
|
|
6 | (6) |
|
The most common verb: Get |
|
|
6 | (6) |
|
Supplying options for cmdlets |
|
|
12 | (7) |
|
|
13 | (3) |
|
Introduction to parameter sets |
|
|
16 | (2) |
|
Using command-line utilities |
|
|
18 | (1) |
|
Working with Help options |
|
|
19 | (1) |
|
|
20 | (1) |
|
Chapter 2 Using Windows PowerShell cmdlets |
|
|
21 | (20) |
|
Understanding the basics of cmdlets |
|
|
22 | (4) |
|
Common Windows PowerShell parameters |
|
|
22 | (2) |
|
Starting the Windows PowerShell transcript |
|
|
24 | (1) |
|
Stopping and reviewing the Windows PowerShell transcript |
|
|
25 | (1) |
|
Searching the Help topics |
|
|
26 | (4) |
|
Using the Get-Help cmdlet |
|
|
26 | (3) |
|
Using the About conceptual Help topics |
|
|
29 | (1) |
|
Using the Get-Command to find cmdlets |
|
|
30 | (3) |
|
Using the Get-Member cmdlet |
|
|
33 | (1) |
|
Exploring property members |
|
|
34 | (1) |
|
Using the Show-Command cmdlet |
|
|
34 | (2) |
|
Setting the Script Execution Policy |
|
|
36 | (1) |
|
Creating a basic Windows PowerShell profile |
|
|
37 | (2) |
|
Determining if a Windows PowerShell profile exists |
|
|
38 | (1) |
|
Creating a new Windows PowerShell profile |
|
|
38 | (1) |
|
|
39 | (2) |
|
Chapter 3 Filtering, grouping, and sorting |
|
|
41 | (12) |
|
Introduction to the pipeline |
|
|
41 | (1) |
|
Sorting output from a cmdlet |
|
|
42 | (2) |
|
Grouping output after sorting |
|
|
44 | (2) |
|
Grouping information without element data |
|
|
45 | (1) |
|
Filtering output from one cmdlet |
|
|
46 | (4) |
|
|
47 | (2) |
|
|
49 | (1) |
|
Filtering output from one cmdlet before sorting |
|
|
50 | (1) |
|
|
51 | (2) |
|
Chapter 4 Formatting output |
|
|
53 | (16) |
|
|
53 | (5) |
|
Choosing specific properties in a specific order |
|
|
54 | (1) |
|
Controlling the way the table displays |
|
|
55 | (3) |
|
|
58 | (3) |
|
Choosing properties by name |
|
|
59 | (1) |
|
Choosing properties by wildcard |
|
|
59 | (2) |
|
|
61 | (2) |
|
Using the -AutoSize parameter to configure the output |
|
|
61 | (1) |
|
Customizing the Format-Wide output |
|
|
62 | (1) |
|
|
63 | (4) |
|
Sorting output by using the column buttons |
|
|
64 | (2) |
|
Filtering output by using the filter box |
|
|
66 | (1) |
|
|
67 | (2) |
|
|
69 | (10) |
|
Storing data in text files |
|
|
69 | (4) |
|
|
70 | (1) |
|
|
71 | (1) |
|
Controlling the text file |
|
|
72 | (1) |
|
Storing data in .csv files |
|
|
73 | (3) |
|
|
73 | (2) |
|
|
75 | (1) |
|
|
76 | (2) |
|
The problem with complex objects |
|
|
76 | (1) |
|
Using XML to store complex objects |
|
|
76 | (2) |
|
|
78 | (1) |
|
Chapter 6 Leveraging Windows PowerShell providers |
|
|
79 | (20) |
|
Understanding Windows PowerShell providers |
|
|
80 | (1) |
|
Understanding the Alias provider |
|
|
80 | (2) |
|
Understanding the Certificate provider |
|
|
82 | (3) |
|
Understanding the Environment provider |
|
|
85 | (1) |
|
Understanding the File System provider |
|
|
86 | (2) |
|
Understanding the Function provider |
|
|
88 | (1) |
|
Understanding the Registry provider |
|
|
89 | (7) |
|
Understanding the Variable provider |
|
|
96 | (1) |
|
|
97 | (2) |
|
Chapter 7 Using Windows PowerShell remoting |
|
|
99 | (14) |
|
Using Windows PowerShell remoting |
|
|
99 | (2) |
|
|
99 | (2) |
|
Configuring Windows PowerShell remoting |
|
|
101 | (9) |
|
|
103 | (4) |
|
Creating a persisted connection |
|
|
107 | (3) |
|
Troubleshooting Windows PowerShell remoting |
|
|
110 | (1) |
|
|
111 | (2) |
|
|
113 | (14) |
|
Understanding the WMI Model |
|
|
113 | (4) |
|
Working with objects and namespaces |
|
|
114 | (1) |
|
|
114 | (1) |
|
|
115 | (2) |
|
|
117 | (8) |
|
Tell me everything about everything |
|
|
120 | (2) |
|
Tell me selected things about everything |
|
|
122 | (1) |
|
Tell me everything about some things |
|
|
123 | (2) |
|
Tell me selected things about some things |
|
|
125 | (1) |
|
|
125 | (2) |
|
|
127 | (14) |
|
Using CIM cmdlets to explore WMI classes |
|
|
127 | (7) |
|
Using the classname parameter |
|
|
128 | (1) |
|
Finding WMI class methods |
|
|
128 | (2) |
|
Filtering classes by qualifier |
|
|
130 | (3) |
|
Reducing returned properties and instances |
|
|
133 | (1) |
|
Cleaning up output from the command |
|
|
134 | (1) |
|
Working with associations |
|
|
134 | (6) |
|
|
140 | (1) |
|
Chapter 10 Using the Windows PowerShell ISE |
|
|
141 | (12) |
|
Running the Windows PowerShell ISE |
|
|
141 | (7) |
|
Navigating the Windows PowerShell ISE |
|
|
142 | (3) |
|
Working with the Script pane |
|
|
145 | (1) |
|
Tab expansion and Intellisense |
|
|
146 | (2) |
|
Working with Windows PowerShell ISE snippets |
|
|
148 | (3) |
|
Using Windows PowerShell ISE snippets to create code |
|
|
148 | (1) |
|
Creating new Windows PowerShell ISE snippets |
|
|
149 | (1) |
|
Removing user-defined Windows PowerShell ISE snippets |
|
|
150 | (1) |
|
|
151 | (2) |
|
Chapter 11 Using Windows PowerShell scripts |
|
|
153 | (30) |
|
Why write Windows PowerShell scripts? |
|
|
153 | (2) |
|
|
155 | (7) |
|
Running Windows PowerShell scripts |
|
|
155 | (1) |
|
Enabling Windows PowerShell scripting support |
|
|
156 | (1) |
|
Transitioning from command line to script |
|
|
157 | (2) |
|
Running Windows PowerShell scripts |
|
|
159 | (1) |
|
Understanding variables and constants |
|
|
160 | (2) |
|
Using the While statement |
|
|
162 | (3) |
|
Constructing the While statement |
|
|
162 | (2) |
|
A practical example of using the While statement |
|
|
164 | (1) |
|
Using special features of Windows PowerShell |
|
|
164 | (1) |
|
Using the Do While statement |
|
|
165 | (3) |
|
|
166 | (1) |
|
|
166 | (1) |
|
|
167 | (1) |
|
Using the Do Until statement |
|
|
168 | (2) |
|
Using the Windows PowerShell Do...Loop statement |
|
|
168 | (2) |
|
|
170 | (5) |
|
|
170 | (2) |
|
Using the ForEach statement |
|
|
172 | (2) |
|
Exiting the ForEach statement early |
|
|
174 | (1) |
|
|
175 | (4) |
|
Using assignment and comparison operators |
|
|
177 | (1) |
|
Evaluating multiple conditions |
|
|
178 | (1) |
|
Using the Switch statement |
|
|
179 | (3) |
|
Using the basic Switch statement |
|
|
180 | (2) |
|
Controlling matching behavior |
|
|
182 | (1) |
|
|
182 | (1) |
|
Chapter 12 Working with functions |
|
|
183 | (20) |
|
|
183 | (9) |
|
|
190 | (2) |
|
Using multiple input parameters |
|
|
192 | (2) |
|
Using functions to encapsulate business logic |
|
|
194 | (2) |
|
Using functions to provide ease of modification |
|
|
196 | (5) |
|
|
201 | (2) |
|
Chapter 13 Debugging scripts |
|
|
203 | (14) |
|
Understanding debugging in Windows PowerShell |
|
|
203 | (1) |
|
|
203 | (13) |
|
|
204 | (1) |
|
Setting a breakpoint on a line number |
|
|
204 | (2) |
|
Setting a breakpoint on a variable |
|
|
206 | (3) |
|
Setting a breakpoint on a command |
|
|
209 | (2) |
|
Responding to breakpoints |
|
|
211 | (2) |
|
|
213 | (2) |
|
Enabling and disabling breakpoints |
|
|
215 | (1) |
|
|
215 | (1) |
|
|
216 | (1) |
|
Chapter 14 Handling errors |
|
|
217 | (12) |
|
Handling missing parameters |
|
|
217 | (3) |
|
Creating a default value for the parameter |
|
|
218 | (1) |
|
Making the parameter mandatory |
|
|
219 | (1) |
|
|
220 | (5) |
|
Using PromptForChoice to limit selections |
|
|
220 | (2) |
|
Using Test-Connection to identify accessible computers |
|
|
222 | (1) |
|
Using the contains operator to examine contents of an array |
|
|
223 | (2) |
|
|
225 | (2) |
|
|
226 | (1) |
|
Checking for rights and exiting gracefully |
|
|
226 | (1) |
|
|
227 | (1) |
|
|
228 | (1) |
|
Appendix A Windows PowerShell FAQ |
|
|
229 | (10) |
|
Appendix B Windows PowerShell 3.0 coding conventions |
|
|
239 | (8) |
|
General script construction |
|
|
239 | (2) |
|
Include functions in the script that uses the functions |
|
|
239 | (1) |
|
Use full cmdlet names and full parameter names |
|
|
240 | (1) |
|
Use Get-Item to convert path strings to rich types |
|
|
241 | (1) |
|
General script readability |
|
|
241 | (1) |
|
|
242 | (5) |
|
|
244 | (1) |
|
|
244 | (1) |
|
Writing your own functions |
|
|
245 | (1) |
|
Variables, constants, and naming |
|
|
245 | (2) |
Index |
|
247 | |