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

Blog

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

Launch multiple M365 tenant PowerShell PNP console

Demo how to quickly launch multiple M365 tenant PowerShell PNP console. When supporting PROD, TEST, DEV lifecycle or have multiple M365 tenants we can leverage Devolutions Remote Desktop Manager (RDM) to have many PowerShell “profiles” and quickly authenticate with Client ID and Client Secret.

Great for M365, SharePoint Online SPO, and PowerPlatform tasks including:

  • View SharePoint sites
  • Increase SharePoint site quota
  • Grant SharePoint site administrator
  • Create SharePoint Site App Catalog
  • Generate CSV reports of sites and usage
  • Provision OneDrive users
  • Review M365 tenant security settings

Download RDM

https://devolutions.net/remote-desktop-manager/home/downloadfree

POWERSHELL

# Configuration
$SiteURL        = "https://TENANT-admin.sharepoint.com/"
$ClientID       = "GUID-HERE"
$ClientSecret   = "SECRET-HERE"
# Connect to the Site
Connect-PnPOnline -URL $SiteURL -ClientID $ClientID -ClientSecret $ClientSecret -WarningAction "Ignore"
Get-PnPTenantSite | Format-Table -AutoSize

VIDEO

SCREENSHOT

REFERENCES

https://medium.com/ng-sp/sharepoint-add-in-permission-xml-cheat-sheet-64b87d8d7600

https://pnp.github.io/powershell/

https://pnp.github.io/powershell/cmdlets/Connect-PnPOnline.html

PowerAutomate bypass Microsoft disable inactive MS Flow and always Turn ON

Microsoft 365 has feature with Power Automate to disable infrequently used MS Flow.

Demo will show how to force Turn ON all MS Flow in your tenant. Automatically re-enable flows that were suspended give stability for business process with quarterly, annual, or longer normal times between run.

Cheers.

VIDEO

SCREENSHOTS

REFERENCES

© Copyright 2016
@ SPJeff

Return to Top ▲Return to Top ▲