What’s New in the PowerShell Cookbook V3?

Or for that matter, “What’s new in PowerShell V3”?

To help those interested in reviewing the juicy new bits of the PowerShell Cookbook, I’ve been able to compile a rough break-down of what’s new, along with the magnitude of the change. Both the V2 and V3 cookbooks were written in the XML-based DocBook format, which has provided mind-blowing power during the editing and creation cycle.

Some notes:

  • Some recipes were moved between chapters, and therefore look like a vast deletion from one recipe and a vast addition to another similarly-named recipe in another chapter.
  • A few recipes had their titles changed, with a similar effect.
  • The “words” column isn’t completely accurate – it’s anything delimited by a space in the cookbook content, including script content in the Solutions, etc.
  • The content I used to analyze the “V2” version of the cookbook is the XML before it went through the official copy-editing stage. Once you get to the point where Added and Removed basically balance out, those changes are most likely basic grammar / spelling corrections that were done to the book after it left my hands :)

Without further ado, the full data dump! If you want to see the script that generated this comparison, scroll to the very end!

 

Name                                                                               Words Added Removed
—-                                                                               —– —– ——-
ch30.Customize an Activity’s Connection Parameters                                  1870  1870       0
ch30.Write a Workflow                                                               1846  1846       0
ch12.Script a Web Application Session                                               1120  1120       0
ch30.Debug or Troubleshoot a Workflow                                                957   957       0
ch27.Manage Scheduled Tasks on a Computer                                            915   830     135
ch01.Customize PowerShell’s Command Resolution Behavior                              790   790       0
ch29.Create a Task-Specific Remoting Endpoint                                        776   776       0
ch31.Respond to Automatically-Generated Events                                         1     1     758
ch32.Respond to Automatically Generated Events                                       755   755       0
ch09.Parse and Manage Text-Based Log Files                                           737   737       0
ch09.Parse and Manage Text-Based Logfiles                                              1     1     734
ch30.Run a Workflow                                                                  728   728       0
ch12.Parse and Analyze a Web Page from the Internet                                  705   705       0
ch30.Invoke Workflow Actions in Parallel                                             673   673       0
ch28.Access Windows Management Instrumentation and CIM Data                          644   644       0
ch31.Create and Respond to Custom Events                                               1     1     592
ch28.Access Windows Management Instrumentation Data                                    1     1     579
ch01.Supply Default Values for Parameters                                            561   561       0
ch32.Create and Respond to Custom Events                                             549   549       0
ch29.Configure Advanced Remoting Quotas and Options                                  535   535       0
ch12.Connect to a Webservice                                                           1     1     534
ch30.Introduction                                                                    198   170     532
ch30.Safely Experiment With Transactions                                               1     1     524
ch01.Update System Help Content                                                      524   524       0
ch31.Safely Experiment with Transactions                                             523   523       0
ch12.Connect to a Web Service                                                        522   522       0
ch29.Disconnect and Reconnect PowerShell Sessions                                    518   518       0
ch30.Suspend and Resume a Workflow                                                   515   515       0
ch20.Create and Map PowerShell Drives                                                505   505       0
ch31.Introduction                                                                    561   495     295
ch29.Program: Create a Task-Specific Remoting Endpoint                                 1     1     492
ch01.Understand and Customize PowerShell’s Tab Completion                            484   484       0
ch03.Program: Create Instances of Generic Objects                                      1     1     477
ch30.Use PowerShell Activities from a Traditional Windows Workflow…                473   473       0
ch32.Use a Script Block as a .NET Delegate or Event Handler                          473   473       0
ch31.Use a Script Block as a .NET Delegate or Event Handler                            1     1     471
ch11.Add Custom Tags to a Function or Script Block                                   467   467       0
ch11.Add Custom Tags to a Function, or Script Block                                    1     1     461
ch13.Interact With UI Frameworks and STA Objects                                       1     1     455
ch30.Write a Workflow That Requires Human Intervention                               449   449       0
ch01.Customize the Shell to Improve Your Productivity                                  1     1     444
ch12.Interact with REST-based Web APIs                                               436   436       0
ch30.Reference Custom Activities in a Workflow                                       423   423       0
ch10.Parse and Interpret PowerShell Scripts                                          927   416      86
ch03.Create Instances of Generic Objects                                             412   412       0
ch11.Add Help to Scripts or Functions                                                355    23     405
ch30.Change Error Recovery Behavior in Transactions                                    1     1     404
ch13.Interact with MTA Objects                                                       399   399       0
ch28.Modify the Properties of a WMI Instance                                           1     1     396
ch31.Change Error Recovery Behavior in Transactions                                  396   396       0
ch28.Modify the Properties of a WMI or CIM Instance                                  393   393       0
ch16.Test for Administrative Privileges                                              392   392       0
ch01.Run Programs, Scripts, and Existing Tools                                       999   390      20
ch30.Invoke Islands of Traditional PowerShell Script                                 385   385       0
ch01.Customize PowerShell’s User Input Behavior                                      375   375       0
ch16.Access Information About Your Command?s Invocation                              373   373       0
ch20.Interact with Alternate Data Streams                                            369   369       0
ch32.Introduction                                                                    362   362       0
ch20.Access Long File and Directory Names                                            356   356       0
ch13.Access Features of the Host?s User Interface                                    348   348       0
ch13.Access Features of the Host’s User Interface                                      1     1     347
ch03.Define Custom Formatting for a Type                                             342   342       0
ch29.Configure Advanced Remoting Options                                               1     1     336
ch16.Access Information About Your Command’s Invocation                                1     1     332
ch32.Investigate Internal Event Action State                                         322   322       0
ch31.Investigate Internal Event Action State                                           1     1     321
ch12.Download a File from the Internet                                                 1     1     308
ch16.Find Your Script?s Name                                                         306   306       0
ch20.Get the Files in a Directory                                                    586   304      46
ch28.Invoke a Method on a WMI Class                                                    1     1     303
ch12.Upload a File to an FTP Site                                                    287   287       0
ch28.Invoke a Method on a WMI Instance or Class                                      286   286       0
ch12.Download a Web Page from the Internet                                           590   281      73
ch01.Resolve Errors Calling Native Executables                                       606   281      68
ch01.Extend Your Shell with Additional Commands                                      587   281      54
ch32.Forward Events from a Remote Computer                                           274   274       0
ch31.Forward Events from a Remote Computer                                             1     1     272
ch29.Introduction                                                                    485   271      44
ch10.Manage JSON Data Streams                                                        271   271       0
ch24.Get the Parent Process of a Process                                             259   259       0
ch30.Add Raw XAML to a Workflow                                                      257   257       0
ch16.Modify the User or System Path                                                  251   251       0
ch12.Download a File from an FTP or Internet Site                                    250   250       0
ch20.Unblock a File                                                                  236   236       0
ch16.Find Your Script’s Name                                                           1     1     235
ch32.Create a Temporary Event Subscription                                           234   234       0
ch16.Interact with PowerShell’s Global Environment                                     1     1     227
ch16.Interact with PowerShell?s Global Environment                                   225   225       0
ch29.Enable PowerShell Remoting on a Computer                                        571   113     225
ch16.Find Your Script?s Location                                                     212   212       0
ch29.Pass Variables to Remote Sessions                                               519   212      51
ch29.Determine Whether a Script Is Running on a Remote Computer                      202   202       0
ch29.Determine if a Script is Running on a Remote Computer                             1     1     201
ch28.Introduction                                                                    597   194      16
ch11.Invoke Dynamically-Named Commands                                                 1     1     191
ch31.Create a Temporary Event Subscription                                             1     1     190
ch01.Get Help on a Command                                                           605   178     119
ch02.Program: Simplify Most Foreach-Object Pipelines                                 230   176     172
ch11.Invoke Dynamically Named Commands                                               165   165       0
ch24.Get the Owner of a Process                                                      164   164       0
ch18.Securely Store Credentials on Disk                                              537   164      54
ch29.Create Sessions with Full Network Access                                        856   162      33
ch26.List a User’s Group Membership                                                    1     1     153
ch26.List a User?s Group Membership                                                  153   153       0
ch03.Create and Initialize Custom Objects                                            478    52     151
ch03.Add Custom Methods and Properties to Types                                     1213   151      56
ch17.Create Your Own PowerShell Cmdlet                                               542   140      21
ch12.Program: Monitor Website Uptimes                                                139   139       0
ch15.Program: Analyze a Script?s Performance Profile                                 134   134       0
ch15.Program: Analyze a Script’s Performance Profile                                   1     1     134
ch16.Find Your Script’s Location                                                       1     1     132
ch15.Configure Debug, Verbose, and Progress Output                                   473   132      12
ch02.Program: Interactively Filter Lists of Objects                                  233   116       6
ch17.Access Windows API Functions                                                    993    75     112
ch07.Sort a Hashtable by Key or Value                                                383   108       9
ch01.Program: Monitor a Command for Changes                                          105   105       0
ch27.Rename a Computer                                                               103   103       0
ch29.Interactively Manage a Remote Computer                                          739   102      28
ch13.Support Other Languages in Script Output                                        752   101      21
ch03.Work with .NET Objects                                                         1150    99      72
ch28.Convert a VBScript WMI Script to PowerShell                                     961    97      86
ch01.Invoke a Long-Running or Background Command                                     650    94      12
ch29.Configure User Permissions for Remoting                                         471    90      16
ch12.Program: Connect-WebService                                                       1     1      89
ch29.Find Commands That Support Their Own Remoting                                   350    64      88
ch12.Program: Send-MailMessage                                                         1     1      88
ch15.Handle Warnings, Errors, and Terminating Errors                                 808    85      22
ch29.Invoke a Command on a Remote Computer                                          1008    84      73
ch01.Program: Interactively View and Explore Objects                                  80    80       0
ch18.Add and Remove Certificates                                                     246    77      53
ch28.Program: Determine Properties Available to WMI and CIM…                        73    73       0
ch13.Write Culture-Aware Scripts                                                     942    49      71
ch03.Program: Create a Dynamic Variable                                              202    71       7
ch28.Program: Determine Properties Available to WMI Filters                            1     1      70
ch20.Rename a File or Directory                                                      236     5      69
ch20.Find Files That Match a Pattern                                                 832    67      53
ch18.Enable Scripting Through an Execution Policy                                   1002    67      65
ch01.Interactively View and Process Command Output                                   399    43      66
ch01.Program: View PowerShell’s HTML Help                                              1     1      66
ch11.Add Validation to Parameters                                                   1487    65      56
ch03.Display the Properties of an Item as a Table                                    794    39      65
ch19.Introduction                                                                    518    63      60
ch17.Add PowerShell Scripting to Your Own Program                                    623    63      22
ch10.Access Information in an XML File                                               604    26      62
ch01.Launch PowerShell at a Specific Location                                        206    60      61
ch27.Reboot or Shut Down a Computer                                                  342    60       4
ch28.Use .NET to Perform Advanced WMI Tasks                                          306    58      13
ch11.Dynamically Compose Command Parameters                                          416    58      20
ch03.Add Custom Methods and Properties to Objects                                    446    56      18
ch27.Join a Computer to a Domain or Workgroup                                        227    55       8
ch09.Search a File for Text or a Pattern                                             796    54      25
ch11.Handle Cleanup Tasks When a Module Is Removed                                   204    18      52
ch01.Save State Between Sessions                                                     306    17      52
ch03.Display the Properties of an Item as a List                                     559    27      52
ch27.Remove a Computer from a Domain                                                 164    51       6
ch29.Enable Remoting to Workgroup Computers                                          583    37      51
ch01.Find a Command to Accomplish a Task                                             457    51      13
ch02.Work with Each Item in a List or Command Output                                 458    50       4
ch20.Monitor a File for Changes                                                      177    49      40
ch10.Perform an XPath Query Against XML                                              307    13      49
ch02.Program: Simplify Most Where-Object Filters                                     181    47      11
ch18.Manage PowerShell Security in an Enterprise                                     411    46      24
ch29.Program: Invoke a PowerShell Expression on a Remote Machine                     298    45      25
ch05.Split a String on Text or a Pattern                                             447    43      32
ch16.Get the Current Location                                                        254    42      13
ch16.View and Modify Environment Variables                                           564    41      36
ch13.Program: Add a Graphical User Interface to Your Script                          169    41      17
ch18.Disable Warnings for UNC Paths                                                  371    41      10
ch11.Program: Enhance or Extend an Existing Cmdlet                                   253    28      39
ch05.Create a Multiline or Formatted String                                          214     0      37
ch03.Store Information in Variables                                                  403    37       9
ch02.Automate Data-Intensive Tasks                                                   965    36      11
ch12.Send an Email                                                                   141    36      28
ch17.Add Inline C# to Your PowerShell Script                                         429    35      29
ch04.Adjust Script Flow Using Conditional Statements                                 248    34      10
ch01.Store the Output of a Command into a File                                       377    34       3
ch07.Determine Whether an Array Contains an Item                                     128    34       4
ch12.Program: Get-PageUrls                                                           207    32       6
ch16.Determine PowerShell Version Information                                        209    32      16
ch11.Package Common Commands in a Module                                             871    31      28
ch29.Program: Remotely Enable PowerShell Remoting                                    194    31       5
ch11.Provide -WhatIf, -Confirm, and Other Cmdlet Features                            491    30       9
ch26.Test Active Directory Scripts on a Local Installation                           553    25      30
ch01.Program: Search Formatted Output for a Pattern                                  132    29       4
ch01.Program: Create Scripts from Session History                                    120    29       8
ch17.Define or Extend a .NET Class                                                   487    29      26
ch03.Create an Instance of a .NET Object                                             595    29      17
ch23.Retrieve and Filter Event Log Entries                                           852    22      29
ch05.Generate Source Code and Other Repetitive Text                                  646    28      23
ch29.Test Connectivity Between Two Computers                                         491    23      28
ch21.Discover Registry Settings for Programs                                         679    28      20
ch27.Deploy PowerShell-Based Logon Scripts                                           200    18      27
ch01.Run a PowerShell Command                                                        213    26       1
ch14.Debug a Script When It Encounters an Error                                      186    25       7
ch08.Generate a Random Number or Object                                              435    25      19
ch10.Store the Output of a Command in a CSV or Delimited File                        368    25       9
ch01.Invoke a PowerShell Command or Script from Outside…                           589    25      24
ch17.Access Windows Performance Counters                                             534    17      25
ch11.Write a Script                                                                  613    19      24
ch19.Debug a Script                                                                  407    24      24
ch26.Get the Children of an Active Directory Container                               150     1      23
ch22.Verify Integrity of File Sets                                                   300    23      13
ch09.Search and Replace Text in a File                                              1042    23      17
ch06.Simplify Math with Administrative Constants                                     269    23      17
ch01.Program: Learn Aliases for Common Commands                                      201     3      23
ch09.Get the Content of a File                                                       533    23      16
ch03.Access Environment Variables                                                    562    23      15
ch27.Retrieve Printer Information                                                    215    22      10
ch15.View the Errors Generated by a Command                                          450    22      22
ch11.Write Commands That Maintain State                                              395    22      18
ch26.Introduction                                                                    295    13      22
ch17.Access a .NET SDK Library                                                       605    22       9
ch28.Improve the Performance of Large-Scale WMI Operations                           285    22       9
ch02.Filter Items in a List or Command Output                                        391    22      22
ch14.Investigate System State While Debugging                                        622    21       9
ch01.Invoke a Command from Your Session History                                      357    21      16
ch27.Manage Computer Restore Points                                                  425    20      11
ch06.Perform Simple Arithmetic                                                       398    20      19
ch18.Introduction                                                                    346    20      18
ch19.Extend ISE Functionality Through Its Object Model                               333    19       8
ch05.Format a Date for Output                                                        445    19      16
ch11.Access Arguments of a Script, Function, or Script Block                         702    19      16
ch23.Run a PowerShell Script for Windows Event Log Entries                           454    14      19
ch03.Learn About Types and Objects                                                   402    19      13
ch04.Manage Large Conditional Statements with Switches                               496    18      17
ch27.Renew a DHCP Lease                                                              258    18       9
ch11.Find a Verb Appropriate for a Command Name                                      325    18      15
ch11.Selectively Export Commands from a Module                                       389    18      14
ch26.Search for a Computer Account                                                   322    17      13
ch08.Read and Write from the Windows Clipboard                                       153    17       9
ch10.Import CSV and Delimited Data from a File                                       393    17      17
ch03.Get Detailed Documentation About Types and Objects                              635    17      15
ch06.Work with Numbers as Binary                                                     776    17      17
ch14.Set a Script Breakpoint                                                         603    16      10
ch10.Convert Objects to XML                                                          315    16      10
ch20.Clear the Content of a File                                                     158    16       8
ch20.Find All Files Modified Before a Certain Date                                   321    16      10
ch19.Add an Item to the Tools Menu                                                   183    16      10
ch05.Replace Text in a String                                                        358    15      15
ch21.Create a Registry Key Value                                                     190    13      15
ch14.Prevent Common Scripting Errors                                                 467    15      12
ch17.Automate Programs Using COM Scripting Interfaces                                256    13      15
ch05.Create a String                                                                 363    12      15
ch09.Parse and Manage Binary Files                                                   255    15      14
ch24.Stop a Process                                                                  432    15      11
ch18.Securely Handle Sensitive Information                                           609    15      12
ch11.Write Pipeline-Oriented Scripts with Cmdlet Keywords                            865    14      14
ch19.Customize Text and User Interface Colors                                        304    13      14
ch19.Connect to a Remote Computer                                                    172    10      14
ch18.Access User and Machine Certificates                                            293    14      14
ch21.Work with the Registry of a Remote Computer                                     318    14      10
ch11.Organize Scripts for Improved Readability                                       431    13      11
ch21.Modify or Remove a Registry Key Value                                           188    13       6
ch08.Program: Show Colorized Script Content                                          166    13       4
ch23.Back Up an Event Log                                                            455     7      13
ch21.Set the ACL of a Registry Key                                                   285    13      12
ch27.List Network Adapter Properties                                                 314    13      11
ch15.Introduction                                                                    187    13      11
ch01.Customize Your Shell, Profile, and Prompt                                       589    13      12
ch21.Safely Combine Related Registry Modifications                                   419    11      13
ch26.Find the Owner of a Group                                                       164    13       4
ch03.Introduction                                                                    258    13      12
ch20.Manage Files That Include Special Characters                                    276    13      11
ch01.Notify Yourself of Job Completion                                               203    13       8
ch18.Securely Request Usernames and Passwords                                        420    13      12
ch23.Find Event Log Entries by Their Frequency                                       523     7      12
ch10.Easily Import and Export Your Structured Data                                   437    12       8
ch02.Capture and Redirect Binary Process Output                                      448    12       9
ch10.Modify Data in an XML File                                                      470    11      12
ch29.Invoke a Command on Many Computers                                              357    10      12
ch27.Introduction                                                                    140     8      12
ch25.Manage a Running Service                                                        175    12       8
ch11.Access Pipeline Input                                                           351    12      12
ch01.Use Commands from Customized Shells                                             393    12       9
ch24.Introduction                                                                    254    12      12
ch20.Set the ACL of a File or Directory                                              290    11      10
ch06.Perform Complex Arithmetic                                                      603    11       9
ch29.Run a Local Script on a Remote Computer                                         266    11      10
ch20.Program: Move or Remove a Locked File                                           216    10      11
ch05.Search a String for Text or a Pattern                                           545    11       5
ch03.Reduce Typing for Long Class Names                                              352     4      11
ch18.Block Scripts by Publisher, Path, or Hash                                       294    11      10
ch07.Create a Jagged or Multidimensional Array                                       244    11      11
ch17.Program: Invoke Simple Windows API Calls                                        225    11      11
ch14.Introduction                                                                    374    10      11
ch14.Trace Script Execution                                                          513    11       9
ch26.Change a User Password                                                          178    10       8
ch15.Determine the Status of the Last Command                                        347    10       8
ch24.Launch the Application Associated with a Document                               181    10       9
ch27.Program: List Logon or Logoff Scripts for a User                                128     8      10
ch10.Use Excel to Manage Command Output                                              287     9      10
ch18.Program: Run a Temporarily Elevated Command                                     172    10       9
ch14.Create a Conditional Breakpoint                                                 459    10       6
ch11.Return Data from a Script, Function, or Script Block                            424     9      10
ch13.Display Messages and Output to the User                                         659    10       9
ch04.Repeat Operations with Loops                                                    500    10       8
ch11.Accept Script Block Parameters with Local Variables                             241    10       7
ch01.Program: Learn Aliases for Common Parameters                                    269    10       8
ch07.Sort an Array or List of Items                                                  251     7      10
ch09.Create a Temporary File                                                         449    10       7
ch20.Program: Get the MD5 or SHA1 Hash of a File                                     185    10       8
ch05.Combine Strings into a Larger String                                            322    10       8
ch03.Control Access and Scope of Variables and Other Items                           665    10       9
ch22.Compare the Output of Two Commands                                              388     4      10
ch29.Implicitly Invoke Commands from a Remote Computer                               519    10      10
ch05.Insert Dynamic Information in a String                                          259    10       7
ch11.Write a Function                                                                460     9       8
ch18.Sign a PowerShell Script, Module, or Formatting File                            469     9       5
ch02.Introduction                                                                    437     9       8
ch27.Assign a Static IP Address                                                      181     9       5
ch16.Find the Location of Common System Paths                                        560     9       5
ch26.Search for a Security or Distribution Group                                     301     9       9
ch21.Modify Internet Explorer Settings                                               232     9       6
ch04.Make Decisions with Comparison and Logical Operators                            606     9       9
ch02.Automatically Capture Pipeline Output                                           120     9       4
ch05.Place Formatted Information in a String                                         374     9       8
ch05.Generate Large Reports and Text Streams                                         624     9       9
ch26.Create a User Account                                                           218     7       8
ch26.Search for a User Account                                                       303     8       7
ch20.Remove a File or Directory                                                      155     8       5
ch24.Debug a Process                                                                 175     8       7
ch23.Clear or Maintain an Event Log                                                  393     8       4
ch02.Group and Pivot Data by Name                                                    669     7       8
ch06.Measure Statistical Properties of a List                                        462     8       7
ch12.Export Command Output as a Web Page                                             269     8       6
ch27.Uninstall an Application                                                        164     8       6
ch27.Open or Close Ports in the Windows Firewall                                     212     7       6
ch27.Enable or Disable the Windows Firewall                                          159     7       5
ch27.Retrieve Printer Queue Statistics                                               264     7       3
ch14.Program: Get Script Code Coverage                                               244     7       5
ch05.Convert a String to Upper/Lowercase                                             379     7       7
ch07.Create a Hashtable or Associative Array                                         293     7       3
ch05.Introduction                                                                    202     7       5
ch04.Add a Pause or Delay                                                            384     7       7
ch02.Intercept Stages of the Pipeline                                                254     7       6
ch07.Create an Array or List of Items                                                497     7       7
ch20.Determine the Current Location                                                  230     7       5
ch18.Manage Security Descriptors in SDDL Form                                        221     7       2
ch20.Introduction                                                                    259     7       6
ch23.Introduction                                                                    140     4       6
ch03.Program: Retain Changes to Environment Variables Set by a Batch…              290     6       5
ch07.Combine Two Arrays                                                              245     6       1
ch08.Measure the Duration of a Command                                               197     6       4
ch25.List All Running Services                                                       406     6       5
ch10.Introduction                                                                    207     6       4
ch01.Program: Search Help for Text                                                   198     6       5
ch09.Program: View the Hexadecimal Representation of Content                         202     6       4
ch05.Program: Convert Text Streams to Objects                                        219     5       6
ch24.Launch a Process                                                                295     6       2
ch05.Place Special Characters in a String                                            194     6       6
ch18.Program: Search the Certificate Store                                           181     4       6
ch07.Use the ArrayList Class for Advanced Array Tasks                                289     6       3
ch13.Program: Display a Menu to the User                                             132     6       5
ch23.Access Event Logs of a Remote Machine                                           309     6       5
ch05.Prevent a String from Including Dynamic Information                             302     4       5
ch07.Visit Each Element of an Array                                                  219     5       3
ch06.Introduction                                                                    109     4       5
ch20.Program: Add Extended File Properties to Files                                   92     5       4
ch21.Program: Search the Windows Registry                                            130     5       5
ch21.Add a Site to an Internet Explorer Security Zone                                363     5       5
ch29.Enable Remote Desktop on a Computer                                             121     5       4
ch21.Navigate the Registry                                                           136     5       5
ch21.View a Registry Key                                                             228     5       4
ch20.Manage and Change the Attributes of a File                                      284     4       5
ch17.Introduction                                                                    185     5       4
ch07.Access Elements of an Array                                                     410     5       5
ch18.Program: Start a Process as Another User                                        152     4       5
ch11.Write a Script Block                                                            285     4       5
ch16.Introduction                                                                     63     5       5
ch13.Introduction                                                                    127     4       5
ch11.Introduction                                                                    116     5       3
ch07.Remove Elements from an Array                                                   237     5       3
ch15.Output Warnings, Errors, and Terminating Errors                                 158     5       3
ch18.Verify the Digital Signature of a PowerShell Script                             180     4       2
ch11.Write a Pipeline-Oriented Function                                              144     4       1
ch26.List the Users in an Organizational Unit                                        238     4       3
ch29.Limit Networking Scripts to Hosts That Respond                                  205     4       4
ch12.Program: Interact with Internet Protocols                                       317     3       4
ch22.Determine the Differences Between Two Files                                     183     4       3
ch20.Program: Get Disk Usage Information                                             131     2       4
ch23.List All Event Logs                                                             320     4       3
ch23.Find Event Log Entries with Specific Text                                       406     3       4
ch04.Introduction                                                                    124     4       3
ch20.Get the ACL of a File or Directory                                              181     3       3
ch20.Move a File or Directory                                                        125     2       3
ch20.Create a Directory                                                              127     3       3
ch21.Introduction                                                                     98     3       3
ch18.Program: Create a Self-Signed Certificate                                        96     3       1
ch09.Program: Get the Encoding of a File                                             162     2       3
ch13.Read a Key of User Input                                                        200     2       3
ch26.Create a Security or Distribution Group                                         313     3       3
ch26.Create an Organizational Unit                                                   225     3       3
ch15.Manage the Error Output of Commands                                             301     3       2
ch25.Introduction                                                                     48     3       3
ch27.List All IP Addresses for a Computer                                            203     3       2
ch01.Access and Manage Your Console History                                          345     3       2
ch26.Get the Properties of an Organizational Unit                                    191     3       2
ch23.Write to an Event Log                                                           199     1       3
ch26.Program: Import Users in Bulk to Active Directory                               145     3       1
ch26.Modify Properties of an Organizational Unit                                     160     2       1
ch26.Get and List the Properties of a Computer Account                               218     2       2
ch07.Compare Two Lists                                                               125     1       2
ch25.Configure a Service                                                             124     2       1
ch06.Convert Numbers Between Bases                                                   266     2       2
ch11.Diagnose and Interact with Internal Module State                                176     2       0
ch13.Read a Line of User Input                                                       151     2       2
ch24.List Currently Running Processes                                                418     2       1
ch07.Introduction                                                                    101     2       2
ch21.Remove a Registry Key                                                           164     2       1
ch27.Manage Printers and Print Queues                                                218     2       2
ch01.Add Information to the End of a File                                            130     1       2
ch13.Provide Progress Updates on Long-Running Tasks                                  109     2       2
ch16.Safely Build File Paths Out of Their Components                                 130     2       1
ch22.Introduction                                                                     62     2       0
ch20.Program: Create a Filesystem Hard Link                                          117     1       2
ch29.Program: Transfer a File to a Remote Computer                                   149     1       2
ch21.Get the ACL of a Registry Key                                                   185     2       2
ch26.Add a User to a Security or Distribution Group                                  125     1       1
ch26.Remove a User from a Security or Distribution Group                             126     1       1
ch26.Modify Properties of a User Account                                             150     1       1
ch26.Get the Properties of a Group                                                   194     1       1
ch20.Program: Create a ZIP Archive                                                   113     0       1
ch07.Find Items in an Array Greater or Less Than a Value                             226     1       1
ch09.Introduction                                                                     60     1       1
ch05.Trim a String                                                                   290     0       1
ch23.Create or Remove an Event Log                                                   288     1       1
ch21.Program: Get Properties of Remote Registry Keys                                 107     0       1
ch21.Program: Set Properties of Remote Registry Keys                                 106     0       1
ch27.Program: List All Installed Software                                            188     1       1
ch14.Program: Watch an Expression for Changes                                         64     1       1
ch28.Program: Search for WMI Classes                                                  74     1       1
ch13.Program: Invoke a Script Block with Alternate Culture…                         79     1       1
ch03.Use a COM Object                                                                165     1       1
ch07.Find Items in an Array That Match a Value                                       221     1       1
ch21.Program: Get Registry Items from Remote Machines                                110     0       1
ch20.Get the Version of a DLL or Executable                                          167     1       1
ch08.Introduction                                                                     26     0       0
ch12.Introduction                                                                     83     0       0
ch27.Program: Summarize System Information                                            85     0       0
ch27.Determine Whether a Hotfix Is Installed                                         148     0       0
ch15.Program: Resolve an Error                                                        41     0       0
ch27.Program: List Startup or Shutdown Scripts for a Machine                          99     0       0
ch26.List the Members of a Group                                                     137     0       0
ch26.Modify Properties of a Security or Distribution Group                           176     0       0
ch26.Get and List the Properties of a User Account                                   195     0       0
ch26.Delete an Organizational Unit                                                   100     0       0
ch16.Program: Investigate the InvocationInfo Variable                                 59     0       0
ch08.Program: Search the Windows Start Menu                                           65     0       0
ch23.Get the Newest Entries from an Event Log                                        333     0       0
ch17.Program: Query a SQL Data Source                                                121     0       0
ch08.Get the System Date and Time                                                     88     0       0
ch01.Record a Transcript of Your Shell Session                                       126     0       0
ch01.Introduction                                                                    112     0       0

 

The script that generated this all:

 

001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
$v3 = [Ordered] @{}
dir *.xml | %
 {
   
$chapter = $_.
BaseName
   
$xml = [xml] (gc $_); $xml.chapter.sect1 } |
        ? Title | %
 {
           
$v3[$chapter + "." + $_.Title] = -split (($_.Clone() |
                Select-Xml "//text()" | % ToString) -join " ") -join "`r`n"
}

$v2 = [Ordered] @{}
dir *.xml | %
 {
   
$chapter = $_.
BaseName
   
$xml = [xml] (gc $_); $xml.chapter.sect1 } |
        ? Title | %
 {
           
$v2[$chapter + "." + $_.Title] = -split (($_.Clone() |
                Select-Xml "//text()" | % ToString) -join " ") -join "`r`n"
}

foreach($key in $v2.Keys)
{
   
if(-not $v3[$key]) { $v3[$key] = ""
 }
}

$diffResults = [ordered] @{}
foreach($key in $v3.
Keys)
{
   
$v2[$key] | Set-Content c:\temp\v2_temp.txt
    $v3[$key] | Set-Content c:\temp\v3_temp.txt
    $diff = diff.exe c:\temp\v2_temp.txt c:\temp\v3_temp.txt
    $result = [PSCustomObject]
 @{
        Name 
= $key
;
        Words 
= gc c:\temp\v3_temp.txt | Measure-Object | % Count
;
        Added 
= $diff | sls "^>" | Measure-Object | % Count
        Removed = $diff | sls "^<" | Measure-Object | % Count
        Diff = "$diff"
;
    }
   
$diffResults[$key] = $result
}

$diffResults.Values | sort -Desc { [Math]::Max($_.Added, $_.Removed) } |
    Select Name,Words,Added,Removed | ft -auto | clip

Leave a Reply