Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
install_powercli:
stage: install
tags:
- windows
script:
- Write-Host "Installing NuGet"
- Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
- Write-Host "Set the repo installation policy"
- Set-PSRepository PSGallery -InstallationPolicy Trusted
- Write-Host "Installing PowerCLI"
- Install-Module -Name VMware.PowerCLI -Scope CurrentUser -Confirm:$false
- sleep 60
- Set-PowerCLIConfiguration -Scope User -ParticipateInCEIP $false -InvalidCertificateAction Ignore -Confirm:$false
- Write-Host "Importing the helper module"
- Import-Module VMware.VimAutomation.HorizonView
- if (Test-Path $env:Temp\PowerCLI-Example-Scripts){Remove-Item $env:Temp\PowerCLI-Example-Scripts -Recurse -Force -Confirm:$false}
- git clone $exampleScriptURL $env:Temp\PowerCLI-Example-Scripts
- $modulePath = [Environment]::GetEnvironmentVariable('PSModulePath').split(";")[0]
- if (Test-Path $modulePath\PowerCLI-Example-Scripts){Remove-Item $modulePath\PowerCLI-Example-Scripts -Recurse -Force -Confirm:$false}
- Copy-Item -Recurse $env:Temp\PowerCLI-Example-Scripts $modulePath
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment