1.0.0
Upgrade Instructions
We're breaking up Carbon into smaller and more targeted modules. Hopefully, this will help maintenance, and make it
easier to use Carbon across many versions and editions of PowerShell. This module will be the place where core functions
used by other Carbon modules will be put.
If you're upgrading from Carbon to this module, you should do the following:
- Replace usages of
Test-COSIs64Bit
withTest-COperatingSystem -Is64Bit
. - Replace usages of
Test-COSIs32Bit
withTest-COperatingSystem -Is32Bit
. - Replace usages of
Test-CPowerShellIs32Bit
withTest-CPowerShell -Is32Bit
. - Replace usages of
Test-CPowerShellIs64Bit
withTest-CPowerShell -Is64Bit
. - Rename usages of the
ConvertTo-CBase64
function'sValue
parameter toInputObject
, or pipe the value to the
function instead.
We made a lot of changes to the Invoke-CPowerShell
function:
- The
Invoke-CPowerShell
function no longer allows you to pass script blocks. Instead, convert your script block to
a string, and pass that string to theCommand
parameter. This will base64 encode the command and pass it to
PowerShell's -EncodedCommand property. - The
Invoke-CPowerShell
function no longer hasFilePath
,OutputFormat
,ExecutionPolicy
,NonInteractive
,
orRuntime
parameters. Instead, pass these as arguments to theArgumentList
parameter, e.g.
-ArgumentList @('-NonInteractive', '-ExecutionPolicy', 'Bypasss'). You are now responsible for passing all PowerShell arguments via the
ArgumentList` parameter. - The
Invoke-CPowerShell
function no longer supports running PowerShell 2 under .NET 4. - Remove the
-Encode
switch.Invoke-CPowerShell
now always base64 encodes the value of theCommand
parameter. - The
Invoke-CPowerShell
function only accepts strings to the-Command
parameter. Check all usages to ensure you're
passing a string. - The
Invoke-CPowerShell
function now returns output when running PowerShell as a different user. You may see more
output in your scripts.
Changes Since Carbon 2.9.4
- Migrated
Invoke-CPowerShell
andConvertTo-CBase64
from Carbon. ConvertTo-CBase64
now converts chars, ints (signed and unsigned, 16, 32, and 64-bit sizes), floats, and doubles to
base64. You can now also pipe an array of bytes or chars and it will collect each item in the array and encode them at
as one unit.- Renamed the
ConvertTo-CBase64
function'sValue
parameter toInputObject
. - Created
Test-COperatingSystem
function that can test if the current OS is 32-bit, 62-bit, Windows, Linux, and/or
macOS. This function was adapted from and replaces's Carbon'sTest-COSIs64Bit
andTest-COSIs32Bit
. - Created
Test-CPowerShell
function that can test if the current PowerShell instance is 32-bit, 64-bit, Core edition,
or Desktop edition. It treats versions of PowerShell that don't specify a version as "Desktop". This function was
adapted from and replaces Carbon'sTest-CPowerShellIs32Bit
andTest-CPowerShellIs64Bit
functions. Invoke-CPowerShell
now works on Linux and macOS. On Windows, it will start a new PowerShell process using the same
edition. If you want to use a custom version of PowerShell, pass the path to the PowerShell executable to use to the
newPath
parameter.
Known Issues
- There is a bug in PowerShell Core on Linux/macOS that fails when running
Start-Job
with a custom credential. The
Invoke-CPowerShell
function will fail when run on Linux/MacOS using a custom credential. See
PowerShell/PowerShell#7172 for more information.