More samples at www.oreil.ly/poweshell-cookbook

Call a local exe

— use the call operator &

Set-Location $composefolder

& ‘C:\Program Files\docker\docker-compose.exe’ “up”

Call another PS script

Invoke-Expression “.\configure-system.ps1”

Show all env vars

Get-ChildItem Env:

Find a particular env variable

Get-ChildItem env: | ? {$_.name -eq ‘Path’} |Format-Table -wrap

Set Persistent Env var (persists after Powershell Session ends)

$CurrentValue = [Environment]::GetEnvironmentVariable(“Path”, “Machine”)

[Environment]::SetEnvironmentVariable(“Path”, $CurrentValue + “;$Env:ProgramFiles\docker”, “Machine”)

Set a Temporary Env Var (only valid for the Powershell session)

$env:PSModulePath = $env:PSModulePath + “;c:\ModulePath”

Anuj holds professional certifications in Google Cloud, AWS as well as certifications in Docker and App Performance Tools such as New Relic. He specializes in Cloud Security, Data Encryption and Container Technologies.

Initial Consultation

Anuj Varma – who has written posts on Anuj Varma, Hands-On Technology Architect, Clean Air Activist.