SifHelper.psm1
#Requires -RunAsAdministrator #Requires -Modules PKI,WebAdministration Set-StrictMode -Version Latest # TODO remove the module imports for PKI and WebAdministration.. should be done in module .PSD1 if (!(Get-Module PKI)) { Import-Module PKI -ErrorAction Stop } if (!(Get-Module WebAdministration) -or (!(Get-PSDrive IIS -ErrorAction SilentlyContinue))) { Get-Module WebAdministration | Remove-Module Import-Module WebAdministration -ErrorAction Stop } $SitecoreGalleryUrl = "https://sitecore.myget.org/F/sc-powershell/api/v2" if (-not(Get-PSRepository -name SitecoreGallery)) { Register-PSRepository -Name SitecoreGallery -SourceLocation $SitecoreGalleryUrl -InstallationPolicy Trusted } ("SitecoreInstallFramework", "SqlServer") | ForEach-Object -Verbose { if ((Get-InstalledModule -Name $_ -Verbose)) { Update-Module $_ -Confirm:$false -Verbose } else { Install-Module $_ -Confirm:$false -AllowClobber -Force -Verbose } if (!(Get-Module $_)) { Write-Warning "Module '$_' is not loaded!" Import-Module $_ -Force -Verbose } } $scriptRoot = Split-Path -Parent $MyInvocation.MyCommand.Path $privates = Join-Path -Path $scriptRoot -ChildPath 'Private' $publics = Join-Path -Path $scriptRoot -ChildPath 'Public' Get-ChildItem -Path $privates -Filter '*.psm1' | ForEach-Object { Import-Module $_.FullName } Get-ChildItem -Path $publics -Filter '*.psm1;*.ps1' | ForEach-Object { Import-Module $_.FullName -Global } # Dot source to scope # Private must be sourced first - usage in public functions during load ('Private' , 'Public') | ForEach-Object { Get-ChildItem -Path (Join-Path $scriptRoot $_) -Include *.ps1 -Exclude *.Tests.ps1 -File -Recurse | ForEach-Object { try { . $_.FullName } catch { Write-Warning $_.Exception.Message } } } # Export Public functions from the module Get-ChildItem (Join-Path $scriptRoot Public) -Include *.ps1 -Exclude *.Tests.ps1 -File -Recurse | ForEach-Object { Export-ModuleMember -Function $_.BaseName } webpicmd.exe /Install /Products:WDeploy36PS,UrlRewrite2,DACFx /AcceptEula /SuppressReboot |