> pshdo

Carbon 1.8 Released

Carbon 1.8 is out and is backwards compatible with 1.0 through 1.7. It supports PowerShell 2 and 3. Highlights include:

Get the bits at BitBucket.

Enhancements

General

Certificates

  • Improving error handling when Get-Certificate fails to load a certificate from a file.
  • Install-Certificate now supports installing with an X509Certificate2 object instead of just a path to a certificate.
  • Remove-SslCertificateBinding: improved error handling.
  • Set-SslCertificateBinding: improved error handling.
  • Improved documentation for Get-Certificate.
  • Added extended script property StoreName to X509Store objects to return the store’s System.Security.Cryptography.X509Certificates.StoreName value.
  • Added a table view/format for X509Store objects. PowerShell’s default view is a list, so you’ll have to explicitly format the objects as a table, e.g. dir cert:\LocalMachine | Format-Table.
  • Get-Certificate’s Path parameter now supports wildcards and certificate provider paths, e.g. cert:\.
  • Get-Certificate now writes an error if a certificate isn’t found when getting a certificate by its path.

Computer

Cryptography

  • Protect-String can now encrypt strings as a specific user. Use the Credential parameter.
  • Created New-RsaKeyPair for creating public/private RSA key pair using makecert.exe and pkv2pfx.exe. Requires that you’ve installed a Windows SDK.
  • Protect-String can now encrypt strings using an RSA public key.
  • Unprotect-String can now decrypt strings using an RSA private key.

File System

  • Disable-NtfsCompression: improved error handling.
  • Enable-NtfsCompression: improved error handling.
  • Created Compress-Item function for compressing files/directories into a ZIP file.
  • Created Test-ZipFile function for testing if a file is a ZIP file.
  • Created Expand-Item function for decompressing a ZIP file.
  • New-TempDirectory now supports adding a prefix to the temporary directory’s name, so you can more easily track down those scripts/processes that don’t clean up after themselves.

Firewall

  • Disable-FirewallStatefulFtp: improved error handling.
  • Added Name and LiteralName parameters to Get-FirewallRule to return specific rules instead of all of them.
  • Get-FirewallRule, now returns Carbon.Firewall.Rule objects, instead of anonymous hashes.
  • Added default table format for Get-FirewallRule output.
  • Get-FirewallRule now returns additional rule information: interface type, security, source, description, program, and service. Who knew netsh advfirewall firewall rule show had a verbose switch? RTFM.

INI

MSI

Security

  • Creating Revoke-Permission function for revoking a user’s permission to a file, directory, registry key, or certificate’s private key/key container.
  • Creating ConvertTo-ContainerInheritanceFlags function for converting System.Security.AccessControl.InheritanceFlags and System.Security.AccessControl.PropagationFlag values into a Carbon.Security.ContainerInheritanceFlags value.
  • Get-Permission now supports returning the permissions on private keys/key containers.
  • Grant-Permission now supports granting permissions on private keys//key containers.
  • Test-Permission now supports testing permissions on certificate private keys/key containers.

Services

  • Created Get-ServiceConfiguration function for loading a service’s configuration: description, account name/username, failure actions, etc.
  • Added the following extended type data to System.ServiceController.Service:
    • Description
    • ErrorControl
    • FailureProgram
    • FirstFailure
    • LoadOrderGroup
    • Path
    • RebootDelay
    • RebootDelayMinutes
    • RebootMessage
    • ResetPeriod
    • ResetPeriodDays
    • RestartDelay
    • RestartDelayMinutes
    • SecondFailure
    • StartMode
    • StartType
    • TagID
    • ThirdFailure
    • UserName

Bug Fixes

General

  • Importing Carbon gives an error if PATH environment variable contains an empty path.
  • Improved the error handling in the following functions so they properly catch exceptions and write friendlier errors:

Certificates

  • Get-Certificate couldn’t open CA/CertificateAuthority store (fixes issue #130).
  • Extended script property DisplayName on X509Store objects returning wrong store name for custom stores, now returns an empty string.

File System

Path

Users and Groups

  • The Carbon.Identity.FindByName method and the Resolve-IdentityName and Test-Identity functions now handle identity names with . for the domain/machine name, e.g. .\Administrator.
  • The Carbon.Identity.FullName property returns the wrong value when domain is empty/null, e.g. Resolve-IdentityName -Name 'Everyone' returns \Everyone, when it should return Everyone.
  • The Carbon.Identity.FindByName method and the Resolve-IdentityName and Test-Identity functions unable to resolve LocalSystem account (which is actually NT AUTHORITY\SYSTEM).

Carbon 1.7 Released

Carbon 1.7 is out and is backwards compatible with 1.0 through 1.6. It supports PowerShell 2. It contains mostly bug fixes and some enhancements.

Get the bits at BitBucket.

There is now a Carbon support mailing list.

Enhancements

General

  • Import-Carbon.ps1 now supports the -WhatIf switch.
  • Import-Carbon.ps1 now hides verbose log messages when removing/importing Carbon even when supplying the -Verbose switch because I think the verbose output is too verbose and not helpful at all.
  • Import-Carbon.ps1 now supports adding a prefix when importing the Carbon module (with the Prefix parameter) to avoid name collisions and follow best practices.

Certificates

Bug Fixes

General

  • No more silent errors when importing Carbon on Windows 2012 R2.

Certificates

  • Get-Certificate no longer writes a silent error when a certificate does not exist. Instead, no error is written.

File System

Security

  • Grant-Permission fails when item is hidden.
  • Grant-Permission doesn’t handle non-existent paths, causing cascading errors.
  • Test-Permission always returns $false when testing leaf-level permissions and the ApplyTo parameter is provided, i.e. it doesn’t ignore inheritance/propagation flags on leaves.

Carbon 1.6 Released

Carbon 1.6 is out and is backwards compatible with 1.0 through 1.5.1. It supports PowerShell 2. It contains a few bug fixes and many enhancements.

Get the bits at BitBucket.

Bug Fixes

File System

  • Remove-Junction doesn’t delete a junction when given a relative path to the junction.

Services

Shares

Enhancements

Hosts File

IIS

.NET

  • Created Test-DotNet for testing if v2 or v4 of the .NET framework is installed.

Path

PowerShell

  • Updated Invoke-PowerShell to test if the appropriate .NET framework is installed if the user chooses an explicit runtime to use.

Security

  • Created Test-Permission function for checking if a user/group has a set of permissions and, optionally, a set of inheritance and propagation flags on a file, directory, or registry key.
  • Test-Permission now automatically includes the Synchronize permission when checking for exact permissions, since this permission is always on and can never be removed from a file/directory.

Services

Users and Groups

Windows Features

  • Marked Assert-WindowsFeatureFunctionsSupported as an internal function. Please don’t use. It will be removed from future versions of PowerShell.
  • Updated Test-WindowsFeature to work on Windows 8/2012.
  • Created new Carbon.Identity class for representing identities. It also contains a static FindByName method which uses The Windows LookupAccountName function to find full account names, domains, and sids.
  • Updated Test-Identity to use [Carbon.Identity]::FindByName to find identities so it no longer throws exceptions when an identity can’t be found.
  • Updated Resolve-IdentityName to use [Carbon.Identity]::FindByName to find identities so it no longer throws exceptions when an identity can’t be found.

Carbon v1.5 Released

Carbon v1.5 is out and is backwards compatible with v1.0 through v1.4. This release adds a few new features and some bug fixes to improve PowerShell 3 support.

This is definitely the last release to support PowerShell 2. There were enough bug fixes that I didn’t feel good about making people upgrade to a backwards-incompatible version to get them, so I jumped through some extra hoops to test on PowerShell 2. You’re welcome. ;-)

Get the bits at BitBucket.

Enhancements

IIS

  • Set-IisWebsiteID now attempts to start a website whose ID has changed, since IIS stops a website whenever its ID changes.

Network

  • Added Get-IPAddress function for getting the IPv4/IPv6 addresses currently in use on the local computer’s network interfaces.
  • Added Test-IPAddress function for testing if an IP address is in use on one the local computer’s network interfaces.

Path

  • Added Test-UncPath function for testing if a path is a UNC or not.

PowerShell

Shares

Bug Fixes

Certificates

  • Get-Certificate throws an exception and halts script execution when loading a certificate file with a private key and the user doesn’t have permission to write to Windows’ MachineKeys directory. It now writes an error instead.

PowerShell

  • Invoke-PowerShell doesn’t run under a v2.0 CLR when using parameters -Runtime 'v2.0'.

Carbon v1.4 Released

Carbon v1.4 is out and is backwards compatible with v1.0 through v1.3. This release adds a few new features and some bug fixes introduced in v1.3.

This will most likely be the last version of Carbon tested and supported on PowerShell 2. We’ll be moving the build server to PowerShell 3 sometime around August 15th, which means that’s the version of PowerShell the automated tests will use. We encourage everyone to upgrade to PowerShell 3 as soon as possible.

Get the bits at BitBucket.

Enhancements

File System

  • Created Install-Junction function for creating new and/or updating existing junctions. This is a more idempotent way of creating junctions, as opposed to New-Junction and Remove-Junction which report errors if a junction already exists or doesn’t exist, respectively.

IIS

  • Objects returned by Get-IisWebsite now have a dynamic PhysicalPath script property, so you don’t have to traverse down into the default application’s default virtual directory object to get it.
  • Install-IisApplication, Install-IisWebsite, and Install-IisVirtualDirectory now canonicalize physical paths, i.e. they convert any path with a relative part (e.g. ‘..’) to a full path. It turns out IIS doesn’t like paths with relative parts.
  • Created Get-IisApplication function to get Microsoft.Web.Administration.Application objects for all or specific applications under a website.
  • Install-IisApplication now uses the Microsoft.Web.Administration API instead of appcmd.exe.

PowerShell

Bug Fixes

IIS

.NET

Carbon v1.3 Released

Carbon v1.3 is out, is backwards compatible with v1.0 through v1.2. This release improves PowerShell 3 compatibility, updates Invoke-PowerShell so it can run scripts, and adds ConvertTo-Base64 and ConvertFrom-Base64 functions.

Thanks to Jason Stangroome for the feedback that contributed to the work done in this release.

Get the bits at BitBucket.

Enhancements

PowerShell

  • Invoke-PowerShell now supports running an external script.
  • Added OutputFormat argument to Invoke-PowerShell so your scripts/script blocks can return XML results instead of plain text.
  • Renamed Invoke-PowerShell’s Args parameter to ArgumentList (with backwards compatibile Args alias).
  • Renamed Invoke-PowerShell’s Command parameter to ScriptBlock (with backwards-compatible Command alias).
  • Invoke-PowerShell now runs 64-bit PowerShell from 32-bit PowerShell.
  • Get-PowerShellPath now returns path for 64-bit PowerShell when running 32-bit PowerShell.

Text

Bug Fixes

.NET

Carbon v1.2 Released

Carbon v1.2 is out, is backwards compatible with v1.0 and v1.1 and supports PowerShell 3. (Future releases of Carbon will most likely only support PowerShell 3.) This release features mostly new functionality, including new functions for managing NTFS compression and performing XDT transformations. Thanks to Mark Sargent and Philip Teilmeier for contributing enhancements.

Get the bits at BitBucket.

Enhancements

General

  • Carbon now works under PowerShell v3.0!

Certificates

.NET

File System

IIS

INI

  • Created Remove-IniEntry function for removing entries/settings from an INI file.

Performance Counters

PowerShell

  • Invoke-PowerShell now defaults to running under the current CLR, instead of defaulting to a v2.0 CLR. This makes upgrading to PowerShell v3.0 easier.
  • Invoke-PowerShell now writes an error and returns if running PowerShell v3.0 and you want to run under a v2.0 CLR. Unfortunately, PowerShell v3.0 requires .NET 4.0, so you can’t run anything on an earlier CLR.

Privileges

  • Revoke-Privilege now supports case-insensitive privilege names.
  • Updated Grant-Privilege to better handle when passing a privilege name with the wrong case.
  • Updated Grant-Privilege documentation to make it clear privilege names are case-sensitive.

XML

  • New Convert-XmlFile, for transforming an XML file with Microsoft’s XDT (XML Data Transformation) technology. Thanks to Mark Sargent for the contribution.

Bug Fixes

General

  • Deleted the obsolete variable $CarbonImported. Carbon no longer exports any of its variables.

Certificates

Performance Counters

  • Install-PerformanceCounter couldn’t be used to create counters that used/required a base counter. Thanks to Philip Teilmeier for the contribution.

Desired State Configuration With PowerShell

I recommend finding time to watch Jeffrey Snover and Kenneth Hansen’s Desired State Configuration in Windows Server 2012 R2 PowerShell talk from TechEd 2013. Desired State Configuration is a way of specifying, via new PowerShell language features, how you want a server to get setup and configured. PowerShell then takes that configuration data, and applies it on the server or servers of your choice. It looks like a great piece of technology.

Remember, keep your configuration and your scripts separate.