some helpful powershell commands Archives - Anuj Varma, Hands-On Technology Architect, Clean Air Activist https://www.anujvarma.com/tag/some-helpful-powershell-commands/ Production Grade Technical Solutions | Data Encryption and Public Cloud Expert Sat, 09 Mar 2019 01:29:06 +0000 en-US hourly 1 https://wordpress.org/?v=6.9.4 https://www.anujvarma.com/wp-content/uploads/anujtech.png some helpful powershell commands Archives - Anuj Varma, Hands-On Technology Architect, Clean Air Activist https://www.anujvarma.com/tag/some-helpful-powershell-commands/ 32 32 Helpful Powershell Commands https://www.anujvarma.com/helpful-powershell-commands/ https://www.anujvarma.com/helpful-powershell-commands/#respond Tue, 08 Jan 2019 01:28:00 +0000 http://www.anujvarma.com/?p=5619 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 […]

The post Helpful Powershell Commands appeared first on Anuj Varma, Hands-On Technology Architect, Clean Air Activist.

]]>
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”

The post Helpful Powershell Commands appeared first on Anuj Varma, Hands-On Technology Architect, Clean Air Activist.

]]>
https://www.anujvarma.com/helpful-powershell-commands/feed/ 0