Muutke küpsiste eelistusi

Learn Windows PowerShell in a Month of Lunches, Third Edition 3rd edition [Pehme köide]

  • Formaat: Paperback / softback, 384 pages, kõrgus x laius x paksus: 234x185x20 mm, kaal: 600 g, Illustrations
  • Ilmumisaeg: 26-Jan-2017
  • Kirjastus: Manning Publications
  • ISBN-10: 1617294160
  • ISBN-13: 9781617294167
Teised raamatud teemal:
  • Formaat: Paperback / softback, 384 pages, kõrgus x laius x paksus: 234x185x20 mm, kaal: 600 g, Illustrations
  • Ilmumisaeg: 26-Jan-2017
  • Kirjastus: Manning Publications
  • ISBN-10: 1617294160
  • ISBN-13: 9781617294167
Teised raamatud teemal:
A guide, which covers PowerShell v3 and up, Windows 7, and Windows Server 2008 R2 and later, explains how to use Windows PowerShell to script Windows administrative tasks and control Windows from the command line.

Summary

Learn Windows PowerShell in a Month of Lunches, Third Edition is an innovative tutorial designed for busy IT professionals. This updated edition covers PowerShell features that run on Windows 7, Windows Server 2008 R2 and later, PowerShell v3 and later, and includes v5 features like PowerShellGet.

Purchase of the print book includes a free eBook in PDF, Kindle, and ePub formats from Manning Publications.

About the Technology

PowerShell is both a scripting language and an administrative shell that lets you control and automate nearly every aspect of Windows. It accepts and executes commands interactively and you can write scripts to manage most Windows servers like Exchange, IIS, and SharePoint, as well as online services like Azure and Office 365.

About the Book

Learn Windows PowerShell in a Month of Lunches, Third Edition is an innovative tutorial designed for busy IT professionals. Just set aside one hour a day - lunchtime would be perfect - for a month, and you'll be automating Windows tasks faster than you ever thought possible. This updated edition covers PowerShell features that run on Windows 7, Windows Server 2008 R2 and later, PowerShell v3 and later, and includes v5 features like PowerShellGet.

What's Inside

  • Learn PowerShell from the beginning, no experience required!
  • Covers PowerShell v3 and up, Windows 7, and Windows Server 2008 R2 and later
  • Each lesson takes you an hour or less

About the Reader

Experience with Windows administration is helpful. No programming or scripting experience needed.

About the Author

Veteran PowerShell MVPs Don Jones and Jeffery Hicks bring years as successful trainers to this concise, easy-to-follow book.

Table of Contents

  1. Before you begin
  2. Meet PowerShell
  3. Using the help system
  4. Running commands
  5. Working with providers
  6. The pipeline: connecting commands
  7. Adding commands
  8. Objects: data by another name
  9. The pipeline, deeper
  10. Formatting - and why it's done on the right
  11. Filtering and comparisons
  12. A practical interlude
  13. Remote control: one-to-one, and one-to-many
  14. Using Windows Management Instrumentation and CIM
  15. Multitasking with background jobs
  16. Working with many objects, one at a time
  17. Security alert!
  18. Variables: a place to store your stuff
  19. Input and output
  20. Sessions: remote control with less work
  21. You call this scripting?
  22. Improving your parameterized script
  23. Advanced remoting configuration
  24. Using regular expressions to parse text files
  25. Additional random tips, tricks, and techniques
  26. Using someone else's script
  27. Never the end
  28. PowerShell cheat sheet
Preface xvii
Acknowledgments xix
About this book xx
About the authors xxii
1 Before you begin
1(8)
1.1 Why you can't afford to ignore PowerShell
1(2)
Life without PowerShell
2(1)
Life with PowerShell
2(1)
1.2 And now, it's just "PowerShell"
3(1)
1.3 Is this book for you?
3(1)
1.4 How to use this book
4(2)
The main chapters
4(1)
Hands-on labs
5(1)
Code samples
5(1)
Supplementary materials
5(1)
Further exploration
5(1)
Above and beyond
5(1)
1.5 Setting up your lab environment
6(1)
1.6 Installing Windows PowerShell
7(1)
1.7 Contacting us
8(1)
1.8 Being immediately effective with PowerShell
8(1)
2 Meet PowerShell
9(11)
2.1 Choose your weapon
9(6)
The console window
11(2)
The Integrated Scripting Environment
13(2)
2.2 It's typing class all over again
15(2)
2.3 Common points of confusion
17(1)
2.4 What version is this?
17(1)
2.5 Lab
18(2)
3 Using the help system
20(17)
3.1 The help system: how you discover commands
20(2)
3.2 Updatable help
22(1)
3.3 Asking for help
23(1)
3.4 Using help to find commands
24(2)
3.5 Interpreting the help
26(7)
Parameter sets and common parameters
26(2)
Optional and mandatory parameters
28(1)
Positional parameters
28(2)
Parameter values
30(3)
Finding command examples
33(1)
3.6 Accessing "about" topics
33(1)
3.7 Accessing online help
34(1)
3.8 Lab
34(2)
3.9 Lab answers
36(1)
4 Running commands
37(14)
4.1 Not scripting, but running commands
37(1)
4.2 The anatomy of a command
38(1)
4.3 The cmdlet naming convention
39(1)
4.4 Aliases: nicknames for commands
40(2)
4.5 Taking shortcuts
42(2)
Truncating parameter names
42(1)
Using parameter name aliases
42(1)
Using positional parameters
42(2)
4.6 Cheating a bit: Show-Command
44(1)
4.7 Support for external commands
44(4)
4.8 Dealing with errors
48(1)
4.9 Common points of confusion
49(1)
Typing cmdlet names
49(1)
Typing parameters
49(1)
4.10 Lab
50(1)
5 Working with providers
51(12)
5.1 What are providers?
51(2)
5.2 Understanding how the filesystem is organized
53(2)
5.3 Understanding how the filesystem is like other data stores
55(1)
5.4 Navigating the filesystem
55(2)
5.5 Using wildcards and literal paths
57(1)
5.6 Working with other providers
58(3)
5.7 Lab
61(1)
5.8 Further exploration
62(1)
5.9 Lab answers
62(1)
6 The pipeline: connecting commands
63(13)
6.1 Connecting one command to another: less work for you
63(1)
6.2 Exporting to a CSV or an XML file
64(5)
Exporting to CSV
65(1)
Exporting to XML
66(1)
Comparing files
67(2)
6.3 Piping to a file or a printer
69(1)
6.4 Converting to HTML
70(1)
6.5 Using cmdlets that modify the system: killing processes and stopping services
71(1)
6.6 Common points of confusion
72(2)
6.7 Lab
74(1)
6.8 Lab answers
75(1)
7 Adding commands
76(13)
7.1 How one shell can do everything
76(1)
7.2 About product-specific "management shells"
77(1)
7.3 Extensions: finding and adding snap-ins
78(2)
7.4 Extensions: finding and adding modules
80(2)
7.5 Command conflicts and removing extensions
82(1)
7.6 On non-Windows operating systems
83(1)
7.7 Playing with a new module
83(2)
7.8 Profile scripts: preloading extensions when the shell starts
85(1)
7.9 Getting modules from the internet
86(1)
7.10 Common points of confusion
87(1)
7.11 Lab
87(1)
7.12 Lab answers
88(1)
8 Objects: data by another name
89(12)
8.1 What are objects?
89(1)
8.2 Understanding why PowerShell uses objects
90(2)
8.3 Discovering objects: Get-Member
92(2)
8.4 Using object attributes, or properties
94(1)
8.5 Using object actions, or methods
94(1)
8.6 Sorting objects
95(1)
8.7 Selecting the properties you want
96(1)
8.8 Objects until the end
97(2)
8.9 Common points of confusion
99(1)
8.10 Lab
99(1)
8.11 Lab answers
100(1)
9 The pipeline, deeper
101(22)
9.1 The pipeline: enabling power with less typing
101(1)
9.2 How PowerShell passes data down the pipeline
101(1)
9.3 Plan A: pipeline input ByValue
102(4)
9.4 Plan B: pipeline input ByPropertyName
106(5)
9.5 When things don't line up: custom properties
111(3)
9.6 Parenthetical commands
114(1)
9.7 Extracting the value from a single property
115(6)
9.8 Lab
121(1)
9.9 Further exploration
122(1)
9.10 Lab answers
122(1)
10 Formatting---and why it's done on the right
123(16)
10.1 Formatting: making what you see prettier
123(1)
10.2 Working with the default formatting
124(3)
10.3 Formatting tables
127(1)
10.4 Formatting lists
128(1)
10.5 Formatting wide lists
129(1)
10.6 Creating custom columns and list entries
130(3)
10.7 Going out: to a file, a printer, or the host
133(1)
10.8 Another out: GridViews
133(1)
10.9 Common points of confusion
133(4)
Always format right
133(2)
One type of object at a time, please
135(2)
10.10 Lab
137(1)
10.11 Further exploration
137(1)
10.12 Lab answers
138(1)
11 Filtering and comparisons
139(9)
11.1 Making the shell give you just what you need
139(1)
11.2 Filtering left
140(1)
11.3 Using comparison operators
140(2)
11.4 Filtering objects out of the pipeline
142(2)
11.5 Using the iterative command-line model
144(1)
11.6 Common points of confusion
145(1)
Filter left, please
145(1)
When $_ is allowed
146(1)
11.7 Lab
146(1)
11.8 Further exploration
147(1)
11.9 Lab answers
147(1)
12 A practical interlude
148(5)
12.1 Defining the task
148(1)
12.2 Finding the commands
148(2)
12.3 Learning to use the commands
150(1)
12.4 Tips for teaching yourself
151(1)
12.5 Lab
152(1)
12.6 Lab answer
152(1)
13 Remote control: one-to-one, and one-to-many
153(18)
13.1 The idea behind remote PowerShell
154(1)
13.2 WinRM overview
155(4)
13.3 Using Enter-PSSession and Exit-PSSession for one-to-one remoting
159(2)
13.4 Using Invoke-Command for one-to-many remoting
161(2)
13.5 Differences between remote and local commands
163(4)
Invoke-Command vs. -computerName
164(1)
Local vs. remote processing
165(1)
Deserialized objects
166(1)
13.6 But wait, there's more
167(1)
13.7 Remote options
168(1)
13.8 Common points of confusion
168(1)
13.9 Lab
169(1)
13.10 Further exploration
170(1)
13.11 Lab answers
170(1)
14 Using Windows Management Instrumentation and CIM
171(14)
14.1 WMI essentials
172(1)
14.2 The bad news about WMI
173(1)
14.3 Exploring WMI
174(3)
14.4 Choose your weapon: WMI or CIM
177(1)
14.5 Using Get-WmiObject
178(4)
14.6 Using Get-Cimlnstance
182(1)
14.7 WMI documentation
182(1)
14.8 Common points of confusion
182(1)
14.9 Lab
183(1)
14.10 Further exploration
184(1)
14.11 Lab answers
184(1)
15 Multitasking with background jobs
185(15)
15.1 Making PowerShell do multiple things at the same time
185(1)
15.2 Synchronous vs. asynchronous
186(1)
15.3 Creating a local job
187(1)
15.4 WMI, as a job
188(1)
15.5 Remoting, as a job
189(1)
15.6 Getting job results
189(3)
15.7 Working with child jobs
192(2)
15.8 Commands for managing jobs
194(2)
15.9 Scheduled jobs
196(1)
15.10 Common points of confusion
197(1)
15.11 Lab
198(1)
15.12 Lab answers
199(1)
16 Working with many objects, one at a time
200(16)
16.1 Automation for mass management
200(1)
16.2 The preferred way: "batch" cmdlets
201(1)
16.3 The CIM/WMI way: invoking methods
202(4)
16.4 The backup plan: enumerating objects
206(5)
16.5 Common points of confusion
211(3)
Which way is the right way?
211(1)
WMI methods vs. cmdlets
212(1)
Method documentation
213(1)
ForEach-Object confusion
213(1)
16.6 Lab
214(1)
16.7 Lab answers
214(2)
17 Security alert!
216(12)
17.1 Keeping the shell secure
216(1)
17.2 Windows PowerShell security goals
217(1)
17.3 Execution policy and code signing
218(7)
Execution policy settings
218(4)
Digital code signing
222(3)
17.4 Other security measures
225(1)
17.5 Other security holes?
225(1)
17.6 Security recommendations
226(1)
17.7 Lab
227(1)
18 Variables: a place to store your stuff
228(16)
18.1 Introduction to variables
228(1)
18.2 Storing values in variables
229(2)
18.3 Using variables: fun tricks with quotes
231(2)
18.4 Storing many objects in a variable
233(4)
Working with single objects in a variable
234(1)
Working with multiple objects in a variable
235(1)
Other ways to work with multiple objects
236(1)
Unrolling properties and methods in PowerShell v3
237(1)
18.5 More tricks with double quotes
237(2)
18.6 Declaring a variable's type
239(2)
18.7 Commands for working with variables
241(1)
18.8 Variable best practices
242(1)
18.9 Common points of confusion
242(1)
18.10 Lab
242(1)
18.11 Further exploration
243(1)
18.12 Lab answer
243(1)
19 Input and output
244(9)
19.1 Prompting for, and displaying, information
244(1)
19.2 Read-Host
245(3)
19.3 Write-Host
248(1)
19.4 Write-Output
249(2)
19.5 Other ways to write
251(1)
19.6 Lab
252(1)
19.7 Further exploration
252(1)
19.8 Lab answers
252(1)
21 Sessions: remote control with less work
253(10)
20.1 Making PowerShell remoting a bit easier
253(1)
20.2 Creating and using reusable sessions
254(1)
20.3 Using sessions with Enter-PSSession
255(2)
20.4 Using sessions with Invoke-Command
257(1)
20.5 Implicit remoting: importing a session
258(2)
20.6 Using disconnected sessions
260(1)
20.7 Lab
261(1)
20.8 Further exploration
262(1)
20.9 Lab answers
262(1)
21 You call this scripting?
263(13)
21.1 Not programming, more like batch files
263(1)
21.2 Making commands repeatable
264(1)
21.3 Parameterizing commands
265(2)
21.4 Creating a parameterized script
267(1)
21.5 Documenting your script
268(2)
21.6 One script, one pipeline
270(3)
21.7 A quick look at scope
273(1)
21.8 Lab
274(1)
21.9 Lab answer
275(1)
22 Improving your parameterized script
276(10)
22.1 Starting point
276(1)
22.2 Getting PowerShell to do the hard work
277(1)
22.3 Making parameters mandatory
278(2)
22.4 Adding parameter aliases
280(1)
22.5 Validating parameter input
281(1)
22.6 Adding the warm and fuzzies with verbose output
282(2)
22.7 Lab
284(1)
22.8 Lab answer
284(2)
23 Advanced remoting configuration
286(10)
23.1 Using other endpoints
286(1)
23.2 Creating custom endpoints
287(4)
Creating the session configuration
288(1)
Registering the session
289(2)
23.3 Enabling multihop remoting
291(1)
23.4 Digging deeper into remoting authentication
292(2)
Defaults for mutual authentication
292(1)
Mutual authentication via SSL
293(1)
Mutual authentication via TrustedHosts
293(1)
23.5 Lab
294(1)
23.6 Lab answer
295(1)
24 Using regular expressions to parse text files
296(7)
24.1 The purpose of regular expressions
297(1)
24.2 A regex syntax primer
297(2)
24.3 Using regex with -Match
299(1)
24.4 Using regex with Select-String
299(2)
24.5 Lab
301(1)
24.6 Further exploration
301(1)
24.7 Lab answers
302(1)
25 Additional random tips, tricks, and techniques
303(13)
25.1 Profiles, prompts, and colors: customizing the shell
303(4)
PowerShell profiles
303(2)
Customizing the prompt
305(1)
Tweaking colors
306(1)
25.2 Operators: -as, -is, -replace, join, -split, -in, -contains
307(3)
-as and -is
307(1)
replace
308(1)
Join and -split
308(1)
-contains and -in
309(1)
25.3 String manipulation
310(1)
25.4 Date manipulation
311(1)
25.5 Dealing with WMI dates
312(1)
25.6 Setting default parameter values
313(2)
25.7 Playing with script blocks
315(1)
25.8 More tips, tricks, and techniques
315(1)
26 Using someone else's script
316(9)
26.1 The script
317(4)
26.2 It's a line-by-line examination
321(1)
26.3 Lab
321(2)
26.4 Lab answer
323(2)
27 Never the end
325(3)
27.1 Ideas for further exploration
325(1)
27.2 "Now that I've read the book, where do I start?"
326(1)
27.3 Other resources you'll grow to love
327(1)
28 PowerShell cheat sheet
328(7)
28.1 Punctuation
328(3)
28.2 Help file
331(1)
28.3 Operators
332(1)
28.4 Custom property and column syntax
332(1)
28.5 Pipeline parameter input
333(1)
28.6 When to use $_
334(1)
Appendix Review labs 335(12)
Index 347
AUTHOR BIO

 





Veteran Powershell MVPs Don Jones and Jeffery Hicks bring years as

successful trainers to this concise, easy-to-follow book. Don blogs at

https://donjones.com/ and you can find Jeff at jdhitsolutions.com/blog.