Microsoft cloud engineer - SharePoint, Office 365, Azure, DotNet, Angular, JavaScript.
Microsoft cloud engineer - SharePoint, Office 365, Azure, DotNet, Angular, JavaScript.

Blog

End User PowerShell – Create SharePoint fields from CSV. Provision schema demo.

Live coding demo for to Create SharePoint fields from CSV. Available to any end user and does not require SharePoint tenant admin, site collection admin, or high level access.

Provision list schema and create fields with DisplayName, InternalName, and Data Type from CSV input.

Cheers.

VIDEO

SOURCE CODE

Format-Table with row colors in PowerShell

How to run Format-Table in PowerShell and format output as table with color logic driven from cell value. Full code below. Cheers

VIDEO

SOURCE CODE

# List process and format as table
$proc = Get-Process
$proc | Format-Table @{
    # Add column "Name" to table
    Label = "Name"
    Expression = {
        if ($_.Name -eq "chrome") {
            # Format row color Green when Name is "chrome"
            $color = "32" # Green
        } else {
            # Format row color Red when Name is not "chrome"
            $color = "31" # Red
        }
        # Character 27 is ESC
        $e = [char]27
        # Format row with name and color
        "$e[${color}m$($_.Name)$e[0m"
    }
}, PID, CPU, PM, WS, VM, NPM, Path -AutoSize

© Copyright 2016
@ SPJeff

Return to Top ▲Return to Top ▲