Last active
October 4, 2021 18:18
-
-
Save asikorski/4943edbdd7217e2282e82cffd4a0d05f to your computer and use it in GitHub Desktop.
Powershell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Connect-AzAccount -ErrorAction Stop | |
| Connect-AzureAD -ErrorAction Stop | |
| az login |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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