PageRenderTime 27ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/tools/InstallLatestSdk.ps1

https://gitlab.com/jslee1/azure-powershell
Powershell | 70 lines | 46 code | 10 blank | 14 comment | 8 complexity | 96ab94b4bfe8f9220abf6d0ed0f0c0d9 MD5 | raw file
  1. # ----------------------------------------------------------------------------------
  2. #
  3. # Copyright Microsoft Corporation
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. # Unless required by applicable law or agreed to in writing, software
  9. # distributed under the License is distributed on an "AS IS" BASIS,
  10. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. # See the License for the specific language governing permissions and
  12. # limitations under the License.
  13. # ----------------------------------------------------------------------------------
  14. function Get-RegistryKeyValues()
  15. {
  16. param
  17. (
  18. [Parameter(Mandatory=1)][string]$regKeyPath,
  19. [Parameter(Mandatory=1)][string]$regKeyValueName
  20. )
  21. $regKeyValue = ""
  22. $regKeyValueObject = Get-ItemProperty -Path $regKeyPath -Name $regKeyValueName -ErrorAction SilentlyContinue
  23. if ($regKeyValueObject -ne $null) {
  24. $regKeyValue = $regKeyValueObject.$regKeyValueName
  25. }
  26. return $regKeyValue
  27. }
  28. #Get WebPI CMD
  29. $WebPi="$scriptFolder\test\WebpiCmd.exe"
  30. $allWebPIVersions = Get-ChildItem HKLM:\SOFTWARE\Microsoft\WebPlatformInstaller -ea SilentlyContinue |
  31. ForEach-Object {
  32. if($_.GetValue("InstallPath", $null) -ne $null)
  33. {
  34. $WebPi = $_.GetValue("InstallPath") + "WebpiCmd.exe"
  35. }
  36. }
  37. Write-Host "using webpi command: $WebPi"
  38. $programFiles = $env:ProgramFiles
  39. if (Test-Path "$env:ProgramW6432"){
  40. $programFiles = $env:ProgramW6432
  41. }
  42. if (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Microsoft SDKs\ServiceHosting\v2.4")) {
  43. Write-Host installing Azure Authoring Tools
  44. Start-Process "$WebPi" "/Install /products:WindowsAzureSDK_Only.2.4 /accepteula" -Wait
  45. }
  46. $detectKey = "HKLM:\SOFTWARE\Microsoft\Windows Azure Emulator";
  47. $producteVersion = Get-RegistryKeyValues $detectKey "FullVersion"
  48. if (!($producteVersion.StartsWith("2.4."))) {
  49. Write-Host installing Azure Compute Emulator
  50. Start-Process "$WebPi" "/Install /products:WindowsAzureEmulator_Only.2.4 /accepteula" -Wait
  51. }
  52. $detectKey = "HKLM:\SOFTWARE\Microsoft\Windows Azure Storage Emulator"
  53. if (${env:ADX64Platform}){
  54. $detectKey = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows Azure Storage Emulator"
  55. }
  56. $producteVersion = Get-RegistryKeyValues $detectKey "FullVersion"
  57. if (!($producteVersion.StartsWith("3.3"))) {
  58. Write-Host installing Azure Storage Emulator
  59. Start-Process "$WebPi" "/Install /products:WindowsAzureStorageEmulator.3.3 /accepteula" -Wait
  60. }