Automating the world one-liner at a time…
We are finishing up work on Windows PowerShell RC2. While I can't announce an availability date at this point, I know that a lot of you are eager to see what is coming. I think you'll be pleased. Here are our draft release notes for RC2. Note that this documents the major changes and not the bugfixes.
Jeffrey Snover [MSFT]Windows PowerShell/Aspen ArchitectVisit the Windows PowerShell Team blog at: http://blogs.msdn.com/PowerShellVisit the Windows PowerShell ScriptCenter at: http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx
Copyright (c)2006 Microsoft Corporation. All rights reserved.
THIS INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
This document explains the most recent changes to the Windows PowerShell RC1 release. To learn more about Windows PowerShell, see the "Getting Started Guide," the "Windows PowerShell Primer," and the "Quick Reference." You can open them from the the Windows PowerShell Start menu link.
A new object is available by using $host.PrivateData. This object, the ConsoleColorProxy, lets you set the color of output in the shell.
To see the current colors, type "$host.privatedata".
PS > $host.privatedata
ErrorForegroundColor : Red
ErrorBackgroundColor : Black
WarningForegroundColor : Yellow
WarningBackgroundColor : Black
DebugForegroundColor : Yellow
DebugBackgroundColor : Black
VerboseForegroundColor : Yellow
VerboseBackgroundColor : Black
ProgressForegroundColor : Yellow
ProgressBackgroundColor : DarkCyan
To see the properties and methods of the ConsoleColorProxy object, pipe it to Get-Member. For example:
PS > $host.privatedata | get-member
To change the colors, set the value of a property to the desired color. For example, to change the error background color to blue, type:
PS > $host.privatedata.ErrorBackgroundColor = "blue"
The byte quanitifier in Windows PowerShell have been changed from K, M, and G to KB, MB, and GB. For example:
Bad numeric constant: 54K.
At line:1 char:3
+ 54K <<<<
Windows PowerShell includestwo new operators: -Xor (exclusive OR) and -Bxor (bitwise exclusive OR).
PS> 1 -xor 0
PS> 1 -xor 1
PS> 1 -bxor 1
PS> 1 -bxor 0
When a Windows PowerShell provider does not declare the Filter capability, it cannot support the Filter parameter of any cmdlet. Previously, when the Filter parameter was used with a provider that did not support it, the parameter was ignored without error. Now, if you use the Filter parameter with a provider that does not support it, Windows PowerShell generates a ProviderInvocationException and displays an error.
Update.exe installation technology is now used for installing Windows PowerShell on Windows XP and Windows 2003. On Windows Vista, component-based setup technology (CBS) is used instead of the Update.exe-setup.
The location of the Windows PowerShell installation folder is no longer configurable. Setup installs Windows PowerShell under %systemroot%\system32\WindowsPowerShell\V1.0 for x86 systems.
The ADM file that adds the "Turn On Script Execution" group policy for Windows PowerShell is no longer included in the Windows PowerShell. It will be made available separately.
By default, the x64 package installs both the 32-bit and 64-bit bit versions of Windows PowerShell.
64-bit installation folder: %systemroot%\system32\WindowsPowerShell\V1.0
32-bit installation folder: %systemroot%\Syswow64\WindowsPowerShell\V1.0
Two new features have been added to Windows PowerShell to make it easier to refer to directories and files with names that contain an escape character (`) or wildcard characters.
-- Windows PowerShell does not interpret a backtick (`) as an escape character when it appears within single quotation marks. This applies to all single-quoted strings, including strings in scripts.
PS> dir oct`06
Get-ChildItem : Illegal characters in path.
At line:1 char:4
+ dir <<<< oct`06
Get-ChildItem : Cannot find path 'C:\PS\oct 6' because it does not exist.
PS> dir 'oct`06'
-- A "LiteralPath" parameter has been added to all core cmdlets that support wildcard expansion. LiteralPath prevents Windows PowerShell from resolving wildcard patterns in a path.
To access a path that includes both an escape character (`) and wildcard characters, use both the LiteralPath parameter and single quotation marks.
PS > get-content -LiteralPath 'te[s`t].txt'
Three new views were added to Get-Help:
Example: PS >get-help get-item
Example: PS >get-help get-item -detailed
Example: PS >get-help get-item -full
- WMI methods are exposed as part of the WMI Windows PowerShell adapter.
- A new parameter set was added to Get-WmiObject that includes a Query parameter that takes WQL queries.
- Added [WMI] as an intrinsic type that takes a string (such as a WMI PATH).
– You can now instantiate a WMI instance as follows:
This would be the same as:
PS >new-object system.management.managementobject '\\JPSLAP04\root\cimv2:Win32_Process.Handle="0"'
- Designed a new way to deal with CIMDATETIMES that are STRINGS. This was implemented by having a SCRIPT method for System.Management.ManagementObject that does a ConvertToDateTime() and a ConvertFromDateTime().
PS >$wmiclass = [wmiclass]"win32_processstartup"
PS >$dmtfDate = "20020408141835.999999-420"
PS >$dateTime = $wmiclass.ConvertToDateTime($dmtfDate)
PS >$result = $wmiclass.ConvertFromDateTime($dateTime)
No security warnings when you first start the shell:
Users are no longer prompted to trust the Microsoft signing certificate the first time that they start Windows PowerShell. The PS1XML files that are included in Windows PowerShell are signed and trusted even when the Windows PowerShell execution policy is set to "Restricted."
- $host.version now reports the actual host version 220.127.116.11, not the assembly version.
- A Force parameter was added to the ConvertTo-SecureString cmdlet.
- Tab completion now works on property references:
PS >$a = get-process outlook
PS >$a.Mai<tab> => $a.MainModule then $a.MainModule.fi<tab> => $a.MainModule.FileName
- Default attributes can now be used to resolve ambiguous parameter sets. For example, if a cmdlet has two parameter sets, and the command that is entered could be resolved by using either of the parameter sets, the default parameter set is used. Before this change, the command would generate a "cannot resolve parameterset" error.
This isn’t new to Windows 7 (I got the same when upgrading from XP to Vista). However, it still feels