Skip to content

Instantly share code, notes, and snippets.

@asikorski
Last active October 4, 2021 18:18
Show Gist options
  • Select an option

  • Save asikorski/4943edbdd7217e2282e82cffd4a0d05f to your computer and use it in GitHub Desktop.

Select an option

Save asikorski/4943edbdd7217e2282e82cffd4a0d05f to your computer and use it in GitHub Desktop.
Powershell
Connect-AzAccount -ErrorAction Stop
Connect-AzureAD -ErrorAction Stop
az login
Install-Module -Name Az -AllowClobber -Scope CurrentUser
Install-Module -Name PSModuleDevelopment -AllowClobber -Scope CurrentUser
Install-Module -Name PSFramework -AllowClobber -Scope CurrentUser
Install-Module -Name AzureAD -AllowClobber -Scope CurrentUser
Install-Module -Name Pester -RequiredVersion 4.10.1 -AllowClobber -Scope CurrentUser
Invoke-WebRequest -Uri https://aka.ms/installazurecliwindows -OutFile .\AzureCLI.msi; Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet'
az extension add --name azure-devops
Import-Module posh-git
$os = Get-WmiObject Win32_OperatingSystem
Write-Host "Operating system: $($os.OSArchitecture) $($os.Caption) version $($os.Version)"
Write-Host "PowerShell version: $($PSVersionTable.PSVersion)"
Push-Location $PSScriptRoot
Get-ChildItem ps*.ps1 | ForEach-Object {. $_.FullName}
function prompt {
$uiTitle = $PWD | Convert-Path | Split-Path -Leaf
$Host.UI.RawUI.WindowTitle = $uiTitle
Write-Host "`n$env:USERNAME" -ForegroundColor Green -NoNewline
if (Test-Administrator) {
Write-Host " as " -NoNewline
Write-Host "Administrator" -ForegroundColor Red -NoNewline
$Host.UI.RawUI.WindowTitle = $uiTitle + " (Administrator)"
}
Write-Host " in " -NoNewline
Write-Host $ExecutionContext.SessionState.Path.CurrentLocation -ForegroundColor Cyan
return "$('>' * ($NestedPromptLevel + 1)) "
}
Pop-Location
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment