# Write-Color is now published as PowerShell Module

Explore the first PowerShell Gallery release of Write-Color, why it was packaged as a reusable module, and how it helps standardize colorful console output.

blog

07 May 2018 es

![Write-Color is now published as PowerShell Module](/wp-content/uploads/2018/05/img_5af03bf7bdf4f.png)

As I tend to use more and more **Write-Color** every day for different projects I decided it's time to publish it as a module for easy usage. At the same time I get pointed that **Write-Host **which is heavily utilized by **Write-Color** is [considered harmful](https://www.jsnover.com/blog/2013/12/07/write-host-considered-harmful/) as stated by [Jeffrey Snover](https://en.wikipedia.org/wiki/Jeffrey_Snover). And since it's THE Jeffrey Snover (Jeffrey Snover is a Microsoft Technical Fellow, **PowerShell Chief Architect**, and the Chief Architect for the Azure Infrastructure and Management group which includes Azure Stack, System Center and Operations Management Suite. Snover is the inventor of Windows PowerShell, an object-based distributed automation engine, scripting language, and command line shell and was the chief architect for Windows Server) so essentially I should care. And I do. I do understand his points.

But the thing is, and he states that clearly that for most of the use cases **Write-Host** will be wrong. But for some … perfectly fine! So use **Write-Color** with that in mind.

> Please notice this article **contains parts of information **(still useful) and **may not reflect all functionalities of this module**. For download, source code and so on you should refer to the dedicated **[PSWriteColor](https://evotec.xyz/hub/scripts/pswritecolor/) **module page. After reading this one… of course! It contains useful *information*, *examples *and *know-how*.

### 💡 Changelog / Version Information for newest 0.5 version

#### Version 0.5 (25th April 2018)

- added backgroundcolor
- added aliases T/B/C to shorter code
- added alias to function (can be used with “WC”)
- fixes to module publishing

#### Version 0.4 (25th April 2018)

- published as module
- fixed small issues

### 💡 Basic examples for PSWriteColor

Basic functionality of this module is to create easy to use colorized output. You can also use it as standard **Write-Host** replacement.

```powershell
Write-Host 'This is a test'
Write-Color 'This is a test'
```

But where it shines a lot…

```powershell
Import-Module PSWriteColor

$line = '========================================================='

do {
    Clear-Host
    Write-Color $line -LinesBefore 1
    Write-Color 'ACTIVE DIRECTORY Domain Services Section' -C Green -StartTab 1
    Write-Color $line
    Write-Color ' 1', ' - ', 'List of Domain Controller and FSMO Roles' -C Yellow, White, Green
    Write-Color ' 2', ' - ', 'Domain Main Configuration' -C Yellow, White, Green
    Write-Color ' 3', ' - ', 'Forest Main Configuration' -C Yellow, White, Green
    Write-Color ' 4', ' - ', 'List all Windows Clients' -C Yellow, White, Green
    Write-Color ' 5', ' - ', 'List all Windows Server' -C Yellow, White, Green
    Write-Color ' 6', ' - ', 'List all Computer (sort by operatingsystem)' -C Yellow, White, Green
    Write-Color ' 7', ' - ', 'Run systeminfo on remote computers' -C Yellow, White, Green
    Write-Color ' 8', ' - ', 'List Domain Admins' -C Yellow, White, Green
    Write-Color ' 9', ' - ', 'Enabled Optional Features' -C Yellow, White, Green
    Write-Color '10', ' - ', 'List of Active GPOs' -C Yellow, White, Green
    Write-Color '11', ' - ', 'Default Password Policy Settings' -C Yellow, White, Green
    Write-Color '12', ' - ', 'Active Directory Sites' -C Yellow, White, Green
    Write-Color '13', ' - ', 'Users Last Logon' -C Yellow, White, Green
    Write-Color '14', ' - ', 'List all Users (enabled)' -C Yellow, White, Green
    Write-Color '15', ' - ', 'List User Details' -C Yellow, White, Green
    Write-Color '16', ' - ', 'List all Groups' -C Yellow, White, Green
    Write-Color '17', ' - ', 'List Group Memberships' -C Yellow, White, Green
    Write-Color '18', ' - ', 'Send message to users Desktop' -C Yellow, White, Green
    Write-Color '19', ' - ', 'Get Logged on User' -C Yellow, White, Green
    Write-Color ' 0', ' - ', 'Quit' -C Yellow, White, Green -LinesAfter 1
    Write-Color $line

    $input = Read-Host 'Select'

    Switch ($input) {
        0 { Exit }
        default {
            Write-Color 'Not implemented...', ' Press any key to continue!' -Color Red, Yellow -LinesBefore 1
            [void][System.Console]::ReadKey($true)
        }
    }
} while ($input -ne '0')
```

The results are as below:

[!\[PSWriteColor Example\](/wp-content/uploads/2018/05/2018-05-07_21-28-54.gif)](/wp-content/uploads/2018/05/2018-05-07_21-28-54.gif)

For **more information**, **usage example**s and **details** visit dedicated [PSWriteColor](https://evotec.xyz/hub/scripts/pswritecolor/) dedicated to this module.

## Proyectos relacionados

Proyectos que encajan con las etiquetas, categorías y contenido de este artículo.

[Todos los proyectos](/es/proyectos/)

Buscando proyectos relacionados...

[Volver al blog](/blog)

## Artículos relacionados

- [Write-Color – 2 year Anniversary Edition – v0.3](/es/blog/write-color-2-year-anniversary-edition-version-0-3/)
- [PowerShell – How to format Write-Host with multiple colors](/es/blog/powershell-how-to-format-powershell-write-host-with-multiple-colors/)
- [PowerBGInfo – PowerShell alternative to Sysinternals BGInfo](/es/blog/powerbginfo-powershell-alternative-to-sysinternals-bginfo/)

<!-- PowerForge markdown artifact sha256:33828D2BD6F7B4C65FCE1763F5C5C7F5C79B2653B1EEBFC81B25C25C318AD52F -->
