Errata

Windows PowerShell Cookbook

Errata for Windows PowerShell Cookbook

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
Printed Page xvii
3rd paragraph

Charlie Parker ***ply*** his ax? ply or play?

Anonymous  Nov 01, 2019 
Printed Page 5-6
Example 1-1

In this example the author has the following:
PS C:\Documents and Settings\Lee> Function Prompt { "PS > " }
PS > pushd .

At this point the current directory is being pushed on to a the stack. Please note that the current directory was c:\Documents and Settings\Lee>

The example continues:
PS > cd \
PS > dir
** A directory listing is shown here
PS > popd
PS > pwd

The result showns is C:\Users\Lee

This is not correct, this was not the current director which was pushed to the stack. It seems as though this was confused through revisions of the book.
I mark this as a serious error (I went back and forth on this) as only a newcomer to PowerShell will probably read this section, and this may cause much confusion.

Bret Slaski  Oct 28, 2013 
Printed Page 13
Below paragraph "Bridging Technologies"

This command line (pasted from ebook):
PS > $xmlContent = [xml] $content
PS > $xmlContent
The first line results in long crazy output on my powershell (version Major Minor Build Revision
------- -------- ------- -----------
5 1 14393 187
) Then the second line output is empty as though the var was not assigned in the first command executed.

tim.cagle  Sep 27, 2016 
ePub Page 36-38
Example 1-4 (page 37-38)

Problem with Windows PowerShell ISE caused by Customized Profile and Prompt.

1.8. Customize your Shell, Profile and Prompt (Page 36-38 of CookBook)
Example 1-4. An example PowerShell prompt.

PROBLEM
When copying and pasting from the ISE Console pane to the Scripting pane, the pasted command in the Scripting pane mysteriously fails, giving an error message along the lines of

?get-host : The term ?get-host? is not recognised as the name of a cmdlet, function etc.?


This caused me trouble for months until I discovered

format-hex filename (must save the Console pane to .ps1 file first of course)

Inspection of the .ps1 file with ?format-hex? revealed the backspace character ?`b? from Scripting panes prompt, had been ?caught up? in the copy and paste process and was now in the .ps1 file. This non-visible character was causing the strife.

CURE
Simply follow the backspace with a visible character i.e. >

Before ?`b?
After ?`b>?

Hoping this helps.

John Nick Murray  Mar 10, 2014 
Printed Page 547
4th paragraph, commencing "If you want ther ISE ..."

The second line of the paragraph ends with "... from the Tools menu." This should read "... from the View menu."
(as a beginner with PowerShell ISE this had me scratching my head for a while)

Phillip Hamilton  Feb 12, 2013 
PDF Page 547
4th paragraph

To confirm Phillip Hamilton's find that on page 547 the "Show Script Pane Maximized from the Tools menu." should read "Show Script Pane Maximized from the View menu."

The Tools menu only exists for the Options... (described on page 550).

Would be so awesome if we could make these edits to the electronic book formats in a wiki-format so that the next person doesn't have to come across the same problem but so they can confirm that it was not the author's original thought also.

Jason Dinkel  Oct 01, 2013 
Printed Page 763
Example 29-1

This example has a associated PS scipt. I have tried to run the script by using the actual downloaded script, and also by cutting and pasting the code from the book directly into the Powershell console. I fell that there may be a technical "Code Issue" because this code will not run. I am still a newbie and do not have the experience to fin d the reasons behind why the code in this example. I thought I would just ask to have it checked if you don't mind.

Anonymous  May 23, 2014 
Printed Page 871
description of second example of array access by range.

Second example of array access by range is $myArray[-1..2]. The range values are then described as 'the first number in the range is positive, and the second number in the range is negative', when it should be 'the first number in the range is negative, and the second number in the range is positive'. (The displayed output, and the description of the output, is correct.)

Chris Anderson  Dec 16, 2018 
Printed Page 975
index entry for "$_(current object variable)"

Several index entries make reference to pages numbered with roman numerals, but those references appear to be wrong. There are many such, but one example is the entry for "$_ (current object variable)", which cites (only) page ix -- a page within the table of contents. Other apparently incorrect references appear in the index entries for "methods, accessing", "_Confirm parameter", "pipeline character(|)", "providers", and quite a few more terms. I've tried to puzzle out what these erroneous references are intended to be, but I haven't been able to infer a consistent pattern. Perhaps they are intended to reference something other than page numbers?

Anonymous  Jun 08, 2013 
PDF Page 975
Index has some page numbers formatted as roman numerals

To confirm the anonymous errata listed here. There are about 89 links that are not formatted with page numbers in the index.

To take the previous example: one example is the entry for "$_ (current object variable)", which cites (only) page ix -- a page within the table of contents.

The link works. It takes me to page 9 where it references the text here: "$_.Handles -ge 500"

The problem is that the formatting for the page number 9 is changed in the index. ix is indeed 9, but the page 9 itself is not called ix.

This regex should help find all the problem lines... I need to buy that book (regular expressions cookbook)
\b(?=[MDCLXVI])M*(C[MD]|D?C*)(X[CL]|L?X*)(I[XV]|V?I*)\b

Here are the first 15 examples (I find 89 examples using the regex above)

$_ (current object variable), ix
preceding variable names, viii, 123, 864
accessing methods or properties, viii, 133,
pipeline character, ix, 89
Active Directory Service Interface (ADSI), xiv,
ADSI (Active Directory Service Interface), xiv,
for cmdlets, vii, 59?61
auto-completion, vii, 55?59, 68
navigating, xvi
CIM (Common Information Model), xiii, 729
cmdlets, vii?vii
aliases for, vii, 59?61
auto-completion for, vii, 55, 68
defined, vii
information about, xi

Jason Dinkel  Oct 01, 2013