Skip to content

Instantly share code, notes, and snippets.

@virtualhobbit
Created November 6, 2020 14:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save virtualhobbit/80873ebb95f69532f3f2e04e4a733da3 to your computer and use it in GitHub Desktop.
Save virtualhobbit/80873ebb95f69532f3f2e04e4a733da3 to your computer and use it in GitHub Desktop.
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