Table of Contents

Carbon

See Carbon PowerShell module

Carbon is a PowerShell module for automating the configuration of Windows and automating the setup of Windows workstations and servers. More information is available at https://get-carbon.org.

Installation

To install from the PowerShell Gallery, you must be running PowerShell 5 or PowerShell 4 with the Package Management PowerShell Modules Preview installed.

To install, run:

PS> Install-Module -Name 'Carbon' -AllowClobber

Note: You need the -AllowClobber PowerShell switch because Windows 10 / Windows Server 2016 ships with PowerShell modules that contain PowerShell functions with the same name as some of Carbon's functions.

You can now import Carbon by running:

PS> Import-Module 'Carbon'


Via PowerShell

https://get-carbon.org/about_Carbon_Installation.html

PS C:\all> Install-Module -Name 'Carbon' -AllowClobber

NuGet provider is required to continue

PowerShellGet requires NuGet provider version '2.8.5.201' or newer to interact with NuGet-based repositories. The NuGet provider must be available in 'C:\Program Files\PackageManagement\ProviderAssemblies' or 'C:\Users\USERNAME\AppData\Local\PackageManagement\ProviderAssemblies'.

You can also install the NuGet provider by running 'Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force'. Do you want PowerShellGet to install and import the NuGet provider now?

[Y] Yes [N] No [S] Suspend [?] Help (default is “Y”): Y

Untrusted repository

You are installing PowerShell modules from an untrusted repository. If you trust this PowerShell repository, change its InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the PowerShell modules from 'PSGallery'?

[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is “N”): A


Install With Chocolatey

To install with Chocolatey, you'll need Chocolatey installed. With Chocolatey installed, run:

PS> choco install Carbon

This will install Carbon into one of PowerShell's module paths. You can now import Carbon by running:

PS> Import-Module 'Carbon'

Install With Nuget

To install with NuGet, you'll need NuGet installed. With NuGet installed, run:

PS> nuget install Carbon

This will create a Carbon-X.Y.Z directory in your current directory (or the output directory you specified with Nuget's OutputDirectory parameter). You can import Carbon from that directory using the `Import-Carbon.ps1 PowerShell script:

PS> .\Carbon-X.Y.Z\Carbon\Import-Carbon.ps1

Or with PowerShell's Import-Module command:

PS> Import-Module '.\Carbon-X.Y.Z\Carbon'

If you want Carbon available so you can run Import-Module Carbon, copy the Carbon-X.Y.Z\Carbon directory into one of PowerShell's module paths. This command will give you a list:

PS> $env:PSModulePath -split ';'


Error on Installation on December 10, 2021

Import-Module 'Carbon'

At C:\Program Files\WindowsPowerShell\Modules\Carbon\2.11.0\Functions\Initialize-Lcm.ps1:280 char:23 + configuration Lcm + ~~~

System.Management.Automation.PSArgumentException: Cannot process argument because the value of argument “fullFilePath” is not valid.

Change the value of the “fullFilePath” argument and run the operation again.

  at Microsoft.PowerShell.[[DesiredStateConfiguration]].[[CimDSCParser]].[[GetFileContent]]([[String]] [[fullFilePath]])
  at Microsoft.PowerShell.DesiredStateConfiguration.CimDSCParser.[[ParseSchemaMof]](String filePath)
  
  at Microsoft.PowerShell.DesiredStateConfiguration.Internal.[[DscClassCache]].[[ImportClasses]]([[String]] path, [[Tuple]]`2 moduleInfo,
  
Collection`1 errors, Boolean importInBoxResourcesImplicitly)
  at Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache.Initialize(Collection`1 errors, List`1 modulePathList)
  at Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache.LoadDefaultCimKeywords(Dictionary`2 functionsToDefine,

Collection`1 errors, List`1 modulePathList, Boolean cacheResourcesFromMultipleModuleVersions)

  at System.Management.Automation.Language.Parser.ConfigurationStatementRule(IEnumerable`1 customAttributes, Token
configurationToken)

At C:\Program Files\WindowsPowerShell\Modules\Carbon\2.11.0\Functions\Initialize-Lcm.ps1:277 char:5 + { + ~

Missing closing '}' in statement block or type definition.

At C:\Program Files\WindowsPowerShell\Modules\Carbon\2.11.0\Functions\Initialize-Lcm.ps1:279 char:35 + $WhatIfPreference = $false + ~

The PowerShell Try statement is missing its PowerShell Catch or PowerShell Finally block.

At C:\Program Files\WindowsPowerShell\Modules\Carbon\2.11.0\Functions\Initialize-Lcm.ps1:367 char:1 + }

+ ~

Unexpected token '}' in expression or statement.

   + CategoryInfo          : ParserError: (:) [], ParseException
   + FullyQualifiedErrorId : ParserError


Enable-NtfsCompression

NTFS Compression - Enable-NtfsCompression - Enable-NtfsCompression

https://get-carbon.org/Enable-NtfsCompression.html

Turns on NTFS compression on a file/directory.

Syntax Enable-NtfsCompression [-Path] <String[]> [-Recurse] [-WhatIf] [-Confirm] [<CommonParameters>] Description By default, when enabling compression on a directory, only new files/directories created after enabling compression will be compressed. To compress everything, use the -Recurse switch.

Uses Windows' compact.exe command line utility to compress the file/directory. To see the output from compact.exe, set the Verbose switch.

Examples

EXAMPLE 1:

Enable-NtfsCompression -Path C:\Projects\Carbon

Turns on NTFS compression on and compresses the C:\Projects\Carbon directory, but not its sub-directories.

EXAMPLE 2:

Enable-NtfsCompression -Path C:\Projects\Carbon -Recurse

Turns on NTFS compression on and compresses the C:\Projects\Carbon directory and all its sub-directories.

EXAMPLE 3:

Get-ChildItem

Demonstrates that you can pipe the path to compress into Enable-NtfsCompression.