Advertisement
Guest User

IIS Administration

a guest
May 21st, 2018
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Param(
  2.     [string]$Path,
  3.     [string]$Port
  4. )
  5. $ErrorActionPreference = 'Stop';
  6.  
  7. # Empty string for install variables $Path and $Port
  8. $install_vars = ''
  9.  
  10. if ($Path) {
  11.     $install_vars = $install_vars + " -Path $Path"
  12. }
  13. if ($Port) {
  14.     $install_vars = $install_vars + " -Port $Port"
  15. }
  16.  
  17. # Validate windows version, bitness, and elevated
  18. If ($Env:IS_PROCESSELEVATED -eq "false") {
  19.   Write-Error "Package installation must be run as admin"
  20. }
  21.  
  22. If (((Get-OSArchitectureWidth -Compare 64) -eq $false) `
  23.   -or ($Env:OS_PLATFORM -ne "Windows") `
  24.   -or ([Environment]::OSVersion.Version -lt (New-Object 'Version' 6,1))) {
  25.   Write-Error "IIS.Administration requires 64-bit Windows Server 2008 R2 or greater"
  26. }
  27.  
  28. If ($Env:ChocolateyForceX86 -eq "true") {
  29.   Write-Error "IIS.Administration requires a 64 bit architecture to install"
  30. }
  31.  
  32. $toolsDir   = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
  33. $url64      = 'https://github.com/Microsoft/IIS.Administration/releases/download/v2.2.0/IIS.Administration.zip'
  34.  
  35. $packageArgs = @{
  36.   packageName   = $env:ChocolateyPackageName
  37.   unzipLocation = $toolsDir
  38.   url64bit      = $url64
  39.   softwareName  = 'IIS.Administration*'
  40.   checksum64    = 'A6DAF0488B59724A26E5BD634EB87B9DBCC7B86009DF2947D899FE21D7DE7A60'
  41.   checksumType64= 'sha256'
  42. }
  43. Install-ChocolateyZipPackage @packageArgs
  44.  
  45. $setupScript = Join-Path $toolsDir "setup/setup.ps1"
  46.  
  47. if ($install_vars) {
  48. # If we have install vars
  49.     Start-ChocolateyProcessAsAdmin "& `'$setupScript`' Install $install_vars"
  50. } else {
  51. # If we don't have install vars
  52.     Start-ChocolateyProcessAsAdmin "& `'$setupScript`' Install"
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement