Errata

Windows PowerShell 3.0 Step by Step

Errata for Windows PowerShell 3.0 Step by Step

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
foreword
3 paragraph

Report a typo on foreword, no page# from safaribooksonline:

When you have automation and an error occurs, you review the scripts and modify them to it doesn?t happen again.

Should be:

"SO" it doesn't happen again.

Yayen Hu  May 24, 2013 
PDF Page xix
3rd paragraph, 5th sentence

you review the scripts and modify them to <-- should be so, not to.
it doesn?t happen again.

Roger Goodman  Aug 16, 2013 
PDF Page 4
Top of page (script)

When I attempt to run the script, eithe rin ISe or stand-alone, I receive the following error:

At C:\Users\a-amidgett\Desktop\PS3Prereq.ps1:7 char:30
+ {$o.version -gt 6.2} {"$c is Windows 8 or greater"; break}
+ ~
Unexpected token '{' in expression or statement.
At C:\Users\a-amidgett\Desktop\PS3Prereq.ps1:15 char:30
+ {$o.version -lt 6.1} {"$c does not meet standards for PowerShell 3.0"; b ...
+ ~
Unexpected token '{' in expression or statement.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : UnexpectedToken

Anonymous  Jun 03, 2013 
Printed, PDF Page 6
Step 5

Step 5 indicates to separate the HOSTNAME command from the NET STATISTICS WORKSTATION command. The code is shown as:

ipconfig /all >tshoot.txt; route print >>tshoot.txt; netdiag /q >>tshoot
.txt; net statistics workstation >>tshoot.txt

NETDIAG is a server command. Powershell v3 is compatible on Windows 7 desktop systems and on a Windows 7 system, NETDIAG would generate an error. The example should be clarified to indicate it will only work on a server OS or use a command that is applicable to both desktop and server versions of Windows.

John Manning  Apr 27, 2013 
Printed Page 19
# 2

Get-Alias sort is not the command to get a sorted list of aliases. I believe it should be Get-Alias | sort

Deanna Stanley  Apr 17, 2013 
Printed, PDF Page 19
number 2 under creating an alias

The example "Get-Alias sort" will not show an alphabetic listing. There should be a pipe between them, then it shows an alphabetic list, "Get-Alias | sort"

William A Casey  Jun 25, 2013 
ePub Page 49
Step 5

On step 5 it is listed to use the NetDiag which causes the following error:
netdiag : The term 'netdiag' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:56
+ ipconfig /all > tshoot.txt; route print >> tshoot.txt; netdiag /q >> tshoot.txt; ...
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (netdiag:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

This is because the netdiag command does not exist on any machine after Windows Server 2008 (both desktop and servers). Would suggest updating the example to remove NetDiag to eliminate the error that it is causing.

Jeff Lowry  Sep 17, 2013 
Printed Page 59
First Paragraph, Point 2 and Point 4 in section 2

I am just learning PowerShell, but I can't make the where clauses work the way they are printed
gal | where definition -match "Get-ChildItem"
returns an error message on my version 2.0 and my version 3.0 of the product:

Where-Object : Cannot bind parameter 'FilterScript'. Cannot convert the "definition" value of type "System.Stri
ype "System.Management.Automation.ScriptBlock".
At line:1 char:12
+ gal | where <<<< definition -match "Get-ChildItem"
+ CategoryInfo : InvalidArgument: (:) [Where-Object], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.WhereObjectCommand

I believe the correct syntax would be:

PS C:\Users\Mark Halman> gal | where {$_.definition -match "Get-ChildItem"}

CommandType Name Definition
----------- ---- ----------
Alias dir Get-ChildItem
Alias gci Get-ChildItem
Alias ls Get-ChildItem

This would match what you told us in your recorded seminar.

Mark Halman  Sep 17, 2013 
ePub Page 66
Creating folders and files Item #1

Using the Windows 8 OS and typing in the command line as shown will result in the attached error...

PS C:\> Set-Location c:\mytest gi * | where {$_.psiscontainer -AND $_.name -like "*my*"}
Set-Location : A positional parameter cannot be found that accepts argument 'gi'.
At line:1 char:1
+ Set-Location c:\mytest gi * | where {$_.psiscontainer -AND $_.name -like "*my*"}
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Set-Location], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.SetLocationCommand

Bruce W. Darby  Jul 09, 2013 
Printed Page 191
United States

The Resolve-ZipCode.ps1 program/function on page 191 has the input being defined as an integer, yet when you enter a ZIP code beginning with 0 it only takes the digits following the zero(s) - an integer doesn't care about leading zeros where as a ZIP code does.

Daniel Wheeler  Jun 21, 2013 
PDF Page 201

Hello,

I can not reproduce the difference with the MeasureaddOneFilter.ps1 and MeasureaddOneFunction.ps1.

.\MeasureAddOneFilter.ps1
Days : 0
Hours : 0
Minutes : 0
Seconds : 0
Milliseconds : 286
Ticks : 2864823
TotalDays : 3,31576736111111E-06
TotalHours : 7,95784166666667E-05
TotalMinutes : 0,004774705
TotalSeconds : 0,2864823
TotalMilliseconds : 286,4823

.\MeasureAddOneFunction.ps1
Days : 0
Hours : 0
Minutes : 0
Seconds : 0
Milliseconds : 106
Ticks : 1062200
TotalDays : 1,22939814814815E-06
TotalHours : 2,95055555555556E-05
TotalMinutes : 0,00177033333333333
TotalSeconds : 0,10622
TotalMilliseconds : 106,22

With PowerShell Version 4 the difference is getting even bigger:

.\MeasureAddOneFilter.ps1
Days : 0
Hours : 0
Minutes : 0
Seconds : 0
Milliseconds : 226
Ticks : 2266171
TotalDays : 2,62288310185185E-06
TotalHours : 6,29491944444444E-05
TotalMinutes : 0,00377695166666667
TotalSeconds : 0,2266171
TotalMilliseconds : 226,6171



.\MeasureAddOneFunction.ps1
Days : 0
Hours : 0
Minutes : 0
Seconds : 0
Milliseconds : 93
Ticks : 933649
TotalDays : 1,08061226851852E-06
TotalHours : 2,59346944444444E-05
TotalMinutes : 0,00155608166666667
TotalSeconds : 0,0933649
TotalMilliseconds : 93,3649

Kind regards,
Marcel

Marcel Janus  Nov 08, 2013 
Printed Page 268, 269
bottom of 268, top of 269

The bottom of the preceeding page ends with "this techniqure appears here:" but there is no example on this page, nor on page 269.

It appears the example code may have been lost in formatting the document for the book. While some of the output of the missing example code does appear at the top of page 269, it is clearly incomplete.

djdevelop  Aug 15, 2013 
Printed Page 363
3rd and 4th paragraphs

"For example, to obtain the sine of a 45 degree angle, use the SIN static method from the system.math class. This appears here:"

[math]::sin(45)

The above formula return the sine of 45 radians, not 45 degrees.

PowerShell returns

0.850903524534118

which is the sine of 45 radians.

sine of 45 degrees is the square root of 2 divided by 2,
roughly

0.707106781

To obtain the sine of 45 degrees in PowerShell one needs to enter the equivalent of":

[math]::sin(45 * [math]::PI * 2 / 360)

which converts 45 degrees to the equivalent number of radians, recognizing that there are 2 * PI radians per 360 degrees.

Indeed, 45 radians is the equivalent of approximately 58.31 degrees, and the sine of 58.31 degrees - not 45 degrees - is what is returned by the expression given in the text:

[math]::sin(45)

MELVYN  Aug 15, 2013 
Mobi Page 388
United States

Links to MSPress are given in the introduction but no links for learning PowerShell or links to the authors blog. Please add them.

Please add these links early in the book. The Scripting Guy blog is mentioned in the Foreward but no links are given.

Scripting with Windows PowerShell
http://technet.microsoft.com/en-us/scriptcenter/dd742419.aspx

Hey, Scripting Guy! Blog
http://blogs.technet.com/b/heyscriptingguy/



John Spadafora  Feb 11, 2013 
Mobi Page 388
United States

In Kindle PC app, location 388 of 16917

Another important link that should be provided early in the book:

Windows PowerShell

http://technet.microsoft.com/library/bb978526.aspx

John Spadafora  Feb 11, 2013 
Mobi Page 454
2nd paragraph

In the PC Kindle program, location 454 or 16917 a script is introduced "Get-PowerShellRequirements.ps1" prior to any discussion about running scripts. I see that the script is provided in the scripts.zip file but I can't run it because by default, the execution of scripts is disabled on my system even though I'm running powershell as an administrator. It would helpful if some pointer was given so that I could figure out how to run the script being presented. Or maybe you don't intend that we run it. If so, that would be helpful to know too. Also the "ElseIf" lines in the script and the lines in the script generally are inconsistently cased. That is "foreach" is all lowercase" "If" is used and so is "IF". "ElseIf" is used and so is "ELSEIF". I gather case doesn't matter just like it doesn't matter in cmd shells but that is never discussed.

John Spadafora  Feb 11, 2013 
Mobi Page 509
United States

In the PC Kindle app, location 509 of 16917, Security issue with Windows PowerShell are discussed and states "The running of scripts is disabled by default and can be easily managed through group policy. It can also be managed on a per-user or per-session basis." That's great. How is it done? Where do I go from here to learn more because I can't currently run the scripts you are presenting.

John Spadafora  Feb 11, 2013 
Mobi Page 650
United States

In the PC Kindle app, location 650 of 16917, the section Working with the help options mentions the "Update-Help" cmdlet. "Update-Help" is not recognized as the name of a cmdlet, Function, script file, or operable program. This leads me to question which version of PowerShell I'm working with and, sure enough, I'm not using PowerShell 3.0 but I needed to look at the link for the file path to determine this. How does someone verify which version of PowerShell they are using? This should be discussed early in the book somewhere. This is a Step by Step book.

John Spadafora  Feb 11, 2013 
Mobi Page 670
United States

In the Kindle PC app, Location 670 of 16917

The UpdateHelpTrackError.ps1 script is not supplied so I typed it in. The Zero in "-Force -ea 0" looks like an o (oh) character, not a Zero. Since you are emphasizing it, you should mention that it is a zero.

I discovered via google, that I need to run the set-executionpolicy cmdlet to enable running scripts. This isn't mentioned until way after it is needed in the book.

John Spadafora  Feb 11, 2013 
Printed, PDF Page 670
Your Step by Step digital content includes: - box

The downloadable practive files can't be reached at
http://go.microsoft.com/FWLink/?Linkid=275531

The target link (http://examples.oreilly.com/9780735663398-files/) shows:
Not Found
The requested URL /9780735663398-files/ was not found on this server.

peter  Jul 02, 2013 
Mobi Page 911
United States

In Kindle PC app, Location 911 of 16917

The text is talking about "Formatting output with the Format-Wide cmdlet" step 3 says "Use -the -resursive argument" but there is no "-recursive" argument. The argument is called "-recurse" and the example shown is correct but the wording is not.

John Spadafora  Feb 12, 2013