diff --git a/CHANGELOG.Examples.md b/CHANGELOG.Examples.md index f2f8423..dc021f0 100644 --- a/CHANGELOG.Examples.md +++ b/CHANGELOG.Examples.md @@ -1,5 +1,13 @@ # Examples Change log +## pre-release v0.3 + +**20161020** + +- Adaptations in the scripts, json structure and how to topic to match the main codebase. + +## Before pre-release v0.2 + **20161017** - Due to ISHDeploy's upcoming cmdlet renaming and tutorial changes the `Set-ISHUIFeatures.ps1` was split into diff --git a/CHANGELOG.md b/CHANGELOG.md index d0d42f6..d012301 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Change log +## pre-release v0.3 + +**20161020** + +- Changes in module **xISHServer** + - Use new cmdlet `Get-ISHPrerequisites` for one of the following functions: + - Download the necessary files. + - Initial supported method is with FTP. + - Get the file names of the necessary files. + - The cmdlet `Install-ISHToolAntennaHouse.ps1` will not set the license. + - To add or update the Antenna House Formatter license use cmdlet `Set-ISHToolAntennaHouseLicense.ps1` +- Changes in scripts folder **xISHServer** + - To seed the **xISHServer** module folder with the prerequisites: + - Use **new** script `Get-ISHServerPrerequisites.ps1` and the **xISHServer** module will download the files. + - Use **updated** script `Upload-ISHServerPrerequisites.ps1`. Script uses the `Get-ISHPrerequisites` to know which files to copy. + - Use **new** script `Set-ISHAntennaHouseLicense.ps1` to set the Antenna House Formatter license. + +## Before pre-release v0.2 + **20161011** - Major code refactoring. **Before** this all code expected to access and execute remote code without specifying crendetial. This worked for domain credentials. diff --git a/Examples/Copy-ISHCD.Released.ps1 b/Examples/Copy-ISHCD.Released.ps1 index a735985..0576b6d 100644 --- a/Examples/Copy-ISHCD.Released.ps1 +++ b/Examples/Copy-ISHCD.Released.ps1 @@ -13,12 +13,12 @@ $ishVersion=Get-ISHBootstrapperContextValue -ValuePath "ISHVersion" . "$cmdletsPaths\Helpers\Invoke-CommandWrap.ps1" -$ftpHost=Get-ISHBootstrapperContextValue -ValuePath "FTP.Host" -$ftpIp=Get-ISHBootstrapperContextValue -ValuePath "FTP.Ip" -$ftpUser=Get-ISHBootstrapperContextValue -ValuePath "FTP.User" -$ftpPassword=Get-ISHBootstrapperContextValue -ValuePath "FTP.Password" -$ftpCDFolder=Get-ISHBootstrapperContextValue -ValuePath "FTP.ISHCDFolder" -$ftpCDFileName=Get-ISHBootstrapperContextValue -ValuePath "FTP.ISHCDFileName" +$ftp=Get-ISHBootstrapperContextValue -ValuePath "FTP" -DefaultValue $null +$ftpHost=$ftp.Host +$ftpCredential=Get-ISHBootstrapperContextValue -ValuePath "FTP.CredentialExpression" -Invoke +$ftpAlternateHost=$ftp.AlternativeHost +$ftpCDFolder=$ftp.ISHCDFolder +$ftpCDFileName=$ftp.ISHCDFileName $copyBlock= { $targetPath="C:\IshCD\$ishVersion" @@ -27,12 +27,11 @@ $copyBlock= { if(-not (Test-Connection $ftpHost -Quiet)) { - Write-Warning "Using $ftpIp instead of $ftpHost" - $ftpHost=$ftpIp + Write-Warning "Using alternate host $ftpAlternateHost instead of $ftpHost" + $ftpHost=$ftpAlternateHost } - $sdlCredentials=New-Object System.Management.Automation.PSCredential($ftpUser,(ConvertTo-SecureString $ftpPassword -AsPlainText -Force)) - Set-FTPConnection -Server $ftpHost -Credentials $sdlCredentials -UseBinary -KeepAlive -UsePassive | Out-Null + Set-FTPConnection -Server $ftpHost -Credentials $ftpCredential -UseBinary -KeepAlive -UsePassive | Out-Null $ftpUrl="$ftpCDFolder$ftpCDFileName" $localPath=$env:TEMP @@ -65,7 +64,7 @@ try & "$scriptsPaths\Helpers\Test-Administrator.ps1" } - Invoke-CommandWrap -ComputerName $computerName -Credential $credential -ScriptBlock $copyBlock -BlockName "Copy and Extract ISH.$ishVersion" -UseParameters @("ishVersion","ftpHost","ftpIp","ftpUser","ftpPassword","ftpCDFolder","ftpCDFileName") + Invoke-CommandWrap -ComputerName $computerName -Credential $credential -ScriptBlock $copyBlock -BlockName "Copy and Extract ISH.$ishVersion" -UseParameters @("ishVersion","ftpHost","ftpAlternateHost","ftpCredential","ftpCDFolder","ftpCDFileName") } finally { diff --git a/Examples/Initialize-ISHServer.ps1 b/Examples/Initialize-ISHServer.ps1 index da980b2..4157ec8 100644 --- a/Examples/Initialize-ISHServer.ps1 +++ b/Examples/Initialize-ISHServer.ps1 @@ -7,6 +7,8 @@ $cmdletsPaths="$sourcePath\Cmdlets" $scriptsPaths="$sourcePath\Scripts" . "$PSScriptRoot\Cmdlets\Get-ISHBootstrapperContextValue.ps1" +. "$cmdletsPaths\Helpers\Invoke-CommandWrap.ps1" + $computerName=Get-ISHBootstrapperContextValue -ValuePath "ComputerName" -DefaultValue $null $credential=Get-ISHBootstrapperContextValue -ValuePath "CredentialExpression" -Invoke if(-not $computerName) @@ -15,7 +17,6 @@ if(-not $computerName) } $osUserCredential=Get-ISHBootstrapperContextValue -ValuePath "OSUserCredentialExpression" -Invoke -$prerequisitesSourcePath=Get-ISHBootstrapperContextValue -ValuePath "PrerequisitesSourcePath" $ishVersion=Get-ISHBootstrapperContextValue -ValuePath "ISHVersion" $ishServerVersion=($ishVersion -split "\.")[0] $installOracle=Get-ISHBootstrapperContextValue -ValuePath "InstallOracle" -DefaultValue $false @@ -25,8 +26,35 @@ if(-not $isSupported) { return } +$unc=Get-ISHBootstrapperContextValue -ValuePath "UNC" -DefaultValue $null +$ftp=Get-ISHBootstrapperContextValue -ValuePath "FTP" -DefaultValue $null +if($ftp) +{ + $ftpHost=$ftp.Host + $ftpCredential=Get-ISHBootstrapperContextValue -ValuePath "FTP.CredentialExpression" -Invoke + $ftpISHServerFolder=$ftp.ISHServerFolder + $testHostBlock={ + Test-Connection $ftpHost -Quiet + } + $testHost=Invoke-CommandWrap -ComputerName $computerName -Credential $credential -ScriptBlock $testHostBlock -BlockName "Test $ftpHost" -UseParameters @("ftpHost") + if(-not $testHost) + { + $ftpAlternateHost=$ftp.AlternativeHost + Write-Warning "Using alternate host $ftpAlternateHost instead of $ftpHost" + $ftpHost=$ftpAlternateHost + } +} + +if($unc) +{ + $prerequisitesSourcePath=$unc.ISHServerFolder + & $scriptsPaths\xISHServer\Upload-ISHServerPrerequisites.ps1 -Computer $computerName -Credential $credential -PrerequisitesSourcePath $prerequisitesSourcePath -ISHServerVersion $ishServerVersion +} +if($ftp) +{ + & $scriptsPaths\xISHServer\Get-ISHServerPrerequisites.ps1 -Computer $computerName -Credential $credential -ISHServerVersion $ishServerVersion -FTPHost $ftpHost -FTPCredential $ftpCredential -FTPFolder $ftpISHServerFolder +} -& $scriptsPaths\xISHServer\Upload-ISHServerPrerequisites.ps1 -Computer $computerName -Credential $credential -PrerequisitesSourcePath $prerequisitesSourcePath -ISHServerVersion $ishServerVersion & $scriptsPaths\xISHServer\Install-ISHServerPrerequisites.ps1 -Computer $computerName -Credential $credential -ISHServerVersion $ishServerVersion -InstallOracle:$installOracle if($computerName) @@ -37,26 +65,42 @@ if($computerName) if($useFQDNWithCredSSP) { $fqdn=[System.Net.Dns]::GetHostByName($computerName)| FL HostName | Out-String | %{ "{0}" -f $_.Split(':')[1].Trim() }; - & $scriptsPaths\xISHServer\Initialize-ISHServerOSUser.ps1 -Computer $fqdn -Credential $credential -ISHServerVersion $ishServerVersion -OSUser ($osUserCredential.UserName) -CredSSP + & $scriptsPaths\xISHServer\Initialize-ISHServerOSUser.ps1 -Computer $fqdn -Credential $credential -ISHServerVersion $ishServerVersion -OSUser ($osUserCredential.UserName) -CredSSP } else { $sessionOptionsWithCredSSP=Get-ISHBootstrapperContextValue -ValuePath "SessionOptionsWithCredSSPExpression" -Invoke - & $scriptsPaths\xISHServer\Initialize-ISHServerOSUser.ps1 -Computer $computerName -Credential $credential -ISHServerVersion $ishServerVersion -SessionOptions $sessionOptionsWithCredSSP -OSUser ($osUserCredential.UserName) -CredSSP + & $scriptsPaths\xISHServer\Initialize-ISHServerOSUser.ps1 -Computer $computerName -Credential $credential -ISHServerVersion $ishServerVersion -SessionOptions $sessionOptionsWithCredSSP -OSUser ($osUserCredential.UserName) -CredSSP } } else { - & $scriptsPaths\xISHServer\Initialize-ISHServerOSUser.ps1 -Computer $computerName -Credential $credential -ISHServerVersion $ishServerVersion -OSUser ($osUserCredential.UserName) + & $scriptsPaths\xISHServer\Initialize-ISHServerOSUser.ps1 -Computer $computerName -Credential $credential -ISHServerVersion $ishServerVersion -OSUser ($osUserCredential.UserName) } - & $scriptsPaths\xISHServer\Initialize-ISHServerOSUserRegion.ps1 -Computer $computerName -OSUserCredential $osUserCredential -ISHServerVersion $ishServerVersion + & $scriptsPaths\xISHServer\Initialize-ISHServerOSUserRegion.ps1 -Computer $computerName -OSUserCredential $osUserCredential -ISHServerVersion $ishServerVersion } else { & $scriptsPaths\xISHServer\Initialize-ISHServerOSUser.ps1 -ISHServerVersion $ishServerVersion -OSUser ($osUserCredential.UserName) Write-Warning "Cannot execute $scriptsPaths\xISHServer\Initialize-ISHServerOSUserRegion.ps1 locally." } -& $scriptsPaths\IIS\New-IISSslBinding.ps1 -Computer $computerName -Credential $credential + & $scriptsPaths\IIS\New-IISSslBinding.ps1 -Computer $computerName -Credential $credential + +if($unc) +{ + if($unc.AntennaHouseLicensePath) + { + & $scriptsPaths\xISHServer\Set-ISHAntennaHouseLicense.ps1 -Computer $computerName -Credential $credential -ISHServerVersion $ishServerVersion -FilePath $unc.AntennaHouseLicensePath + } +} +if($ftp) +{ + if($ftp.AntennaHouseLicensePath) + { + & $scriptsPaths\xISHServer\Set-ISHAntennaHouseLicense.ps1 -Computer $computerName -Credential $credential -ISHServerVersion $ishServerVersion -FTPHost $ftpHost -FTPCredential $ftpCredential -FTPPath $ftp.AntennaHouseLicensePath + } +} + if($computerName) { @@ -64,5 +108,5 @@ if($computerName) } else { - Write-Host "Please restart the computer before continuing ..." + Write-Warning "Please restart the computer before continuing ..." } diff --git a/Source/Modules/xISHServer/Get-ISHPrerequisites.ISH12.ps1 b/Source/Modules/xISHServer/Get-ISHPrerequisites.ISH12.ps1 new file mode 100644 index 0000000..39138d6 --- /dev/null +++ b/Source/Modules/xISHServer/Get-ISHPrerequisites.ISH12.ps1 @@ -0,0 +1,63 @@ +. $PSScriptRoot\Get-ISHServerFolderPath.ps1 +. $PSScriptRoot\Get-ISHOSInfo.ps1 + +function Get-ISHPrerequisites +{ + param( + [Parameter(Mandatory=$true,ParameterSetName="From FTP")] + [string]$FTPHost, + [Parameter(Mandatory=$true,ParameterSetName="From FTP")] + [pscredential]$Credential, + [Parameter(Mandatory=$true,ParameterSetName="From FTP")] + [string]$FTPFolder, + [Parameter(Mandatory=$true,ParameterSetName="No Download")] + [switch]$FileNames + ) + # + $filesToDownload=@( + #Common for 12 and 13 + "MSXML.40SP3.msi" + "jdk-8u60-windows-x64.exe" + "jre-8u60-windows-x64.exe" + "javahelp-2_0_05.zip" + "htmlhelp.zip" + "V6-2-M9-Windows_X64_64E.exe" + "V6-2-M9-Windows_X64_64E.exe.iss" + "V6-2-M9-Windows_X64_64E.exe.vcredist_x64.exe" + "V6-2-M9-Windows_X64_64E.exe.vcredist_x86.exe" + "ODTwithODAC121012.zip" + "ODTwithODAC121012.rsp" + + #Specific for 12 + "NETFramework2013_4.5_MicrosoftVisualC++Redistributable_(vcredist_x64).exe" + ) + $osInfo=Get-ISHOSInfo + if($osInfo.IsCore) + { + $filesToDownload+="vbrun60sp6.exe" + } + + switch ($PSCmdlet.ParameterSetName) + { + 'From FTP' { + Import-Module PSFTP -ErrorAction Stop + $localPath=Get-ISHServerFolderPath + Set-FTPConnection -Server $FTPHost -Credentials $Credential -UseBinary -KeepAlive -UsePassive | Out-Null + $filesToDownload | ForEach-Object { + $ftpUrl="$FTPFolder$_" + + Write-Debug "ftpUrl=$ftpUrl" + Get-FTPItem -Path $ftpUrl -LocalPath $localPath -Overwrite | Out-Null + Write-Verbose "Downloaded $ftpUrl" + } + break + } + 'No Download' { + if($FileNames) + { + $filesToDownload + } + break + } + } +} \ No newline at end of file diff --git a/Source/Modules/xISHServer/Get-ISHPrerequisites.ISH13.ps1 b/Source/Modules/xISHServer/Get-ISHPrerequisites.ISH13.ps1 new file mode 100644 index 0000000..1b18730 --- /dev/null +++ b/Source/Modules/xISHServer/Get-ISHPrerequisites.ISH13.ps1 @@ -0,0 +1,73 @@ +. $PSScriptRoot\Get-ISHServerFolderPath.ps1 +. $PSScriptRoot\Get-ISHOSInfo.ps1 + +function Get-ISHPrerequisites +{ + param( + [Parameter(Mandatory=$true,ParameterSetName="From FTP")] + [string]$FTPHost, + [Parameter(Mandatory=$true,ParameterSetName="From FTP")] + [pscredential]$Credential, + [Parameter(Mandatory=$true,ParameterSetName="From FTP")] + [string]$FTPFolder, + [Parameter(Mandatory=$true,ParameterSetName="No Download")] + [switch]$FileNames + ) + # + $filesToDownload=@( + #Common for 12 and 13 + "MSXML.40SP3.msi" + "jdk-8u60-windows-x64.exe" + "jre-8u60-windows-x64.exe" + "javahelp-2_0_05.zip" + "htmlhelp.zip" + "V6-2-M9-Windows_X64_64E.exe" + "V6-2-M9-Windows_X64_64E.exe.iss" + "V6-2-M9-Windows_X64_64E.exe.vcredist_x64.exe" + "V6-2-M9-Windows_X64_64E.exe.vcredist_x86.exe" + "ODTwithODAC121012.zip" + "ODTwithODAC121012.rsp" + + #Specific for 13 + "NETFramework2015_4.6_MicrosoftVisualC++Redistributable_(vc_redist.x64).exe" + ) + + $osInfo=Get-ISHOSInfo + + if($osInfo.Server -eq "2016") + { + } + else + { + $filesToDownload+="NETFramework2015_4.6.1.xxxxx_(NDP461-KB3102436-x86-x64-AllOS-ENU).exe" + } + + if($osInfo.IsCore) + { + $filesToDownload+="vbrun60sp6.exe" + } + + switch ($PSCmdlet.ParameterSetName) + { + 'From FTP' { + Import-Module PSFTP -ErrorAction Stop + $localPath=Get-ISHServerFolderPath + Set-FTPConnection -Server $FTPHost -Credentials $Credential -UseBinary -KeepAlive -UsePassive | Out-Null + $filesToDownload | ForEach-Object { + $ftpUrl="$FTPFolder$_" + + Write-Debug "ftpUrl=$ftpUrl" + Get-FTPItem -Path $ftpUrl -LocalPath $localPath -Overwrite | Out-Null + Write-Verbose "Downloaded $ftpUrl" + } + break + } + 'No Download' { + if($FileNames) + { + $filesToDownload + } + break + } + } +} \ No newline at end of file diff --git a/Source/Modules/xISHServer/Install-ISHToolAntennaHouse.ps1 b/Source/Modules/xISHServer/Install-ISHToolAntennaHouse.ps1 index b0175c3..818a1e9 100644 --- a/Source/Modules/xISHServer/Install-ISHToolAntennaHouse.ps1 +++ b/Source/Modules/xISHServer/Install-ISHToolAntennaHouse.ps1 @@ -59,12 +59,4 @@ function Install-ISHToolAntennaHouse Write-Debug "Installing $filePath using $issFilePath and logging to $logFile" Start-Process $filePath -ArgumentList $arguments -Wait -Verb RunAs Write-Verbose "Installed $fileName" - - $fileName="AHFormatter.lic" - $filePath=Join-Path (Get-ISHServerFolderPath) $fileName - $targetPath=Join-Path $env:ProgramFiles "Antenna House\AHFormatterV62\" - Write-Debug "Copying License $filePath" - Copy-Item $filePath $targetPath - Write-Verbose "License copied $fileName" - } \ No newline at end of file diff --git a/Source/Modules/xISHServer/Set-ISHToolAntennaHouseLicense.ps1 b/Source/Modules/xISHServer/Set-ISHToolAntennaHouseLicense.ps1 new file mode 100644 index 0000000..6beefc1 --- /dev/null +++ b/Source/Modules/xISHServer/Set-ISHToolAntennaHouseLicense.ps1 @@ -0,0 +1,58 @@ +. $PSScriptRoot\Get-ISHServerFolderPath.ps1 + +function Set-ISHToolAntennaHouseLicense +{ + param( + [Parameter(Mandatory=$true,ParameterSetName="From FTP")] + [string]$FTPHost, + [Parameter(Mandatory=$true,ParameterSetName="From FTP")] + [pscredential]$Credential, + [Parameter(Mandatory=$true,ParameterSetName="From FTP")] + [ValidatePattern(".*AHFormatter\.lic")] + [string]$FTPPath, + [Parameter(Mandatory=$true,ParameterSetName="Content")] + $Content + ) + + $antennaHouseLicenseFileName="AHFormatter.lic" + $antennaHouseFolderPath=Join-Path $env:ProgramFiles "Antenna House\AHFormatterV62\" + $antennaHouseLicensePath=Join-Path $antennaHouseFolderPath $antennaHouseLicenseFileName + if(Test-Path $antennaHouseLicensePath) + { + $stamp=Get-Date -Format "yyyyMMdd" + $newFileName="$stamp.ISHServer.$antennaHouseLicenseFileName.bak" + $backupPath=Join-Path (Get-ISHServerFolderPath) $newFileName + if(Test-Path (Join-Path $antennaHouseFolderPath $newFileName)) + { + $stamp=Get-Date -Format "yyyyMMdd-hhmmss" + $newFileName="$stamp.ISHServer.$antennaHouseLicenseFileName.bak" + $backupPath=Join-Path (Get-ISHServerFolderPath) $newFileName + } + Copy-Item -Path $antennaHouseLicensePath -Destination $backupPath + Write-Warning "License $antennaHouseLicensePath already exists. Backup available as $newFileName" + } + + switch ($PSCmdlet.ParameterSetName) + { + 'From FTP' { + Import-Module PSFTP -ErrorAction Stop + Set-FTPConnection -Server $FTPHost -Credentials $Credential -UseBinary -KeepAlive -UsePassive | Out-Null + Write-Debug "FTPPath=$FTPPath" + Get-FTPItem -Path $FTPPath -LocalPath $antennaHouseFolderPath -Overwrite | Out-Null + Write-Verbose "Downloaded $ftpUrl" + break + } + 'Content' { + Write-Debug "Writing License $antennaHouseLicensePath" + if($PSVersionTable.PSVersion.Major -ge 5) + { + Set-Content -Path $antennaHouseLicensePath -Value $Content -NoNewline -Force -Encoding Default + } + else + { + [System.IO.File]::WriteAllText($antennaHouseLicensePath,$Content,[System.Text.Encoding]::Default) + } + Write-Verbose "License copied $antennaHouseLicensePath" + } + } +} \ No newline at end of file diff --git a/Source/Modules/xISHServer/xISHServer.12.psm1 b/Source/Modules/xISHServer/xISHServer.12.psm1 index 2934182..8b4dc17 100644 --- a/Source/Modules/xISHServer/xISHServer.12.psm1 +++ b/Source/Modules/xISHServer/xISHServer.12.psm1 @@ -1,4 +1,4 @@ -#requires -runasadministrator +#Requires -runasadministrator #region Helpers . $PSScriptRoot\Get-ISHOSInfo.ps1 @@ -21,6 +21,7 @@ #region Global . $PSScriptRoot\Get-ISHServerFolderPath.ps1 +. $PSScriptRoot\Get-ISHPrerequisites.ISH12.ps1 . $PSScriptRoot\Initialize-ISHLocale.ps1 . $PSScriptRoot\Initialize-ISHIIS.ps1 . $PSScriptRoot\Initialize-ISHUser.ps1 @@ -45,4 +46,8 @@ #region Regional settings . $PSScriptRoot\Initialize-ISHRegional.ps1 . $PSScriptRoot\Initialize-ISHRegionalDefault.ps1 +#endregion + +#region License +. $PSScriptRoot\Set-ISHToolAntennaHouseLicense.ps1 #endregion \ No newline at end of file diff --git a/Source/Modules/xISHServer/xISHServer.13.psm1 b/Source/Modules/xISHServer/xISHServer.13.psm1 index 7c0d7ae..94ec0a7 100644 --- a/Source/Modules/xISHServer/xISHServer.13.psm1 +++ b/Source/Modules/xISHServer/xISHServer.13.psm1 @@ -1,4 +1,4 @@ -#requires -runasadministrator +#Requires -runasadministrator #region Helpers . $PSScriptRoot\Get-ISHOSInfo.ps1 @@ -21,6 +21,7 @@ #region Global . $PSScriptRoot\Get-ISHServerFolderPath.ps1 +. $PSScriptRoot\Get-ISHPrerequisites.ISH13.ps1 . $PSScriptRoot\Initialize-ISHLocale.ps1 . $PSScriptRoot\Initialize-ISHIIS.ps1 . $PSScriptRoot\Initialize-ISHUser.ps1 @@ -45,44 +46,6 @@ . $PSScriptRoot\Initialize-ISHRegionalDefault.ps1 #endregion -<# -$exportedCmdLetName=@( - "Get-ISHServerFolderPath" - -#region Ports - "Set-ISHFirewallHTTPS" - "Set-ISHFirewallNETBIOS" - "Set-ISHFirewallOracle" - "Set-ISHFirewallHTTPS" - "Set-ISHFirewallSMTP" - "Set-ISHFirewallSQLServer" -#endregion - -#region Global - "Get-ISHServerFolderPath" - "Initialize-ISHLocale" - "Initialize-ISHIIS" - "Initialize-ISHUser" -#endregion - -#region Install - "Install-ISHToolMSXML4" - "Install-ISHToolDotNET" - "Install-ISHToolVisualCPP" - "Install-ISHToolJAVA" - "Install-ISHToolJavaHelp" - "Install-ISHToolHtmlHelp" - "Install-ISHToolAntennaHouse" - "Install-ISHToolOracleODAC" - "Install-ISHWindowsFeature" -#endregion - -#region Regional settings - "Initialize-ISHRegional" - "Initialize-ISHRegionalDefault" -#endregion -) - -$exportedCmdLetName|Export-ModuleMember -Cmdlet $_ - -#> \ No newline at end of file +#region License +. $PSScriptRoot\Set-ISHToolAntennaHouseLicense.ps1 +#endregion \ No newline at end of file diff --git a/Source/Scripts/xISHServer/Get-ISHServerPrerequisites.ps1 b/Source/Scripts/xISHServer/Get-ISHServerPrerequisites.ps1 new file mode 100644 index 0000000..a278501 --- /dev/null +++ b/Source/Scripts/xISHServer/Get-ISHServerPrerequisites.ps1 @@ -0,0 +1,47 @@ +param ( + [Parameter(Mandatory=$false)] + [string]$Computer=$null, + [Parameter(Mandatory=$false)] + [pscredential]$Credential=$null, + [Parameter(Mandatory=$true)] + [ValidateSet("12","13")] + [string]$ISHServerVersion, + [Parameter(Mandatory=$true,ParameterSetName="From FTP")] + [string]$FTPHost, + [Parameter(Mandatory=$true,ParameterSetName="From FTP")] + [pscredential]$FTPCredential, + [Parameter(Mandatory=$true,ParameterSetName="From FTP")] + [string]$FTPFolder +) +$cmdletsPaths="$PSScriptRoot\..\..\Cmdlets" + +. "$cmdletsPaths\Helpers\Write-Separator.ps1" +Write-Separator -Invocation $MyInvocation -Header + +. "$cmdletsPaths\Helpers\Invoke-CommandWrap.ps1" + +if($Computer) +{ + . $cmdletsPaths\Helpers\Add-ModuleFromRemote.ps1 + . $cmdletsPaths\Helpers\Remove-ModuleFromRemote.ps1 +} + +try +{ + if($Computer) + { + $ishServerModuleName="xISHServer.$ISHServerVersion" + $remote=Add-ModuleFromRemote -ComputerName $Computer -Credential $Credential -Name $ishServerModuleName + } + Get-ISHPrerequisites -FTPHost $FTPHost -Credential $FTPCredential -FTPFolder $FTPFolder +} + +finally +{ + if($Computer) + { + Remove-ModuleFromRemote -Remote $remote + } +} + +Write-Separator -Invocation $MyInvocation -Footer \ No newline at end of file diff --git a/Source/Scripts/xISHServer/Set-ISHAntennaHouseLicense.ps1 b/Source/Scripts/xISHServer/Set-ISHAntennaHouseLicense.ps1 new file mode 100644 index 0000000..f3affb0 --- /dev/null +++ b/Source/Scripts/xISHServer/Set-ISHAntennaHouseLicense.ps1 @@ -0,0 +1,61 @@ +param ( + [Parameter(Mandatory=$false)] + [string]$Computer=$null, + [Parameter(Mandatory=$false)] + [pscredential]$Credential=$null, + [Parameter(Mandatory=$true)] + [ValidateSet("12","13")] + [string]$ISHServerVersion, + [Parameter(Mandatory=$true,ParameterSetName="From FTP")] + [string]$FTPHost, + [Parameter(Mandatory=$true,ParameterSetName="From FTP")] + [pscredential]$FTPCredential, + [Parameter(Mandatory=$true,ParameterSetName="From FTP")] + [string]$FTPPath, + [Parameter(Mandatory=$true,ParameterSetName="From File")] + [string]$FilePath +) +$cmdletsPaths="$PSScriptRoot\..\..\Cmdlets" + +. "$cmdletsPaths\Helpers\Write-Separator.ps1" +Write-Separator -Invocation $MyInvocation -Header + +. "$cmdletsPaths\Helpers\Invoke-CommandWrap.ps1" + +if($Computer) +{ + . $cmdletsPaths\Helpers\Add-ModuleFromRemote.ps1 + . $cmdletsPaths\Helpers\Remove-ModuleFromRemote.ps1 +} + +try +{ + if($Computer) + { + $ishServerModuleName="xISHServer.$ISHServerVersion" + $remote=Add-ModuleFromRemote -ComputerName $Computer -Credential $Credential -Name $ishServerModuleName + } + + switch ($PSCmdlet.ParameterSetName) + { + 'From FTP' { + Set-ISHToolAntennaHouseLicense -FTPHost $FTPHost -Credential $FTPCredential -FTPPath $FTPPath + break + } + 'From File' { + $license=Get-Content -Path $FilePath + Set-ISHToolAntennaHouseLicense -Content $license + break + } + } +} + +finally +{ + if($Computer) + { + Remove-ModuleFromRemote -Remote $remote + } +} + +Write-Separator -Invocation $MyInvocation -Footer \ No newline at end of file diff --git a/Source/Scripts/xISHServer/Upload-ISHServerPrerequisites.ps1 b/Source/Scripts/xISHServer/Upload-ISHServerPrerequisites.ps1 index d8fd2c7..6cb8717 100644 --- a/Source/Scripts/xISHServer/Upload-ISHServerPrerequisites.ps1 +++ b/Source/Scripts/xISHServer/Upload-ISHServerPrerequisites.ps1 @@ -30,43 +30,8 @@ try $remote=Add-ModuleFromRemote -ComputerName $Computer -Credential $Credential -Name $ishServerModuleName } - $osInfo=Get-ISHOSInfo - $filesToCopy=@( - "MSXML.40SP3.msi" - "jdk-8u60-windows-x64.exe" - "jre-8u60-windows-x64.exe" - "javahelp-2_0_05.zip" - "htmlhelp.zip" - "AHFormatter.lic" - "V6-2-M9-Windows_X64_64E.exe" - "V6-2-M9-Windows_X64_64E.exe.iss" - "V6-2-M9-Windows_X64_64E.exe.vcredist_x64.exe" - "V6-2-M9-Windows_X64_64E.exe.vcredist_x86.exe" - "ODTwithODAC121012.zip" - "ODTwithODAC121012.rsp" - ) + $filesToCopy=Get-ISHPrerequisites -FileNames - switch ($ISHServerVersion) - { - '12' { - $filesToCopy+="NETFramework2013_4.5_MicrosoftVisualC++Redistributable_(vcredist_x64).exe" - } - '13' { - if($osInfo.Server -eq "2016") - { - } - else - { - $filesToCopy+="NETFramework2015_4.6.1.xxxxx_(NDP461-KB3102436-x86-x64-AllOS-ENU).exe" - } - - $filesToCopy+="NETFramework2015_4.6_MicrosoftVisualC++Redistributable_(vc_redist.x64).exe" - } - } - if($osInfo.IsCore) - { - $filesToCopy+="vbrun60sp6.exe" - } Write-Debug "filesToCopy=$filesToCopy" $filePathToCopy=$filesToCopy|ForEach-Object{Join-Path $PrerequisitesSourcePath $_} diff --git a/Topics/About xISHServer module.md b/Topics/About xISHServer module.md index a6b1b5d..6ee2fee 100644 --- a/Topics/About xISHServer module.md +++ b/Topics/About xISHServer module.md @@ -50,7 +50,6 @@ Some of the pre-requisites require to server to restart. - AntennaHouse - V6-2-M9-Windows_X64_64E.exe - V6-2-M9-Windows_X64_64E.exe.iss - - AHFormatter.lic - Visual Basic Runtime (required only for core variants) - vbrun60sp6.exe. Get it from [Service Pack 6 for Visual Basic 6.0: Run-Time Redistribution Pack (vbrun60sp6.exe)](https://www.microsoft.com/en-us/download/details.aspx?id=24417) and then extract. @@ -78,7 +77,6 @@ Some of the pre-requisites require to server to restart. - AntennaHouse - V6-2-M9-Windows_X64_64E.exe - V6-2-M9-Windows_X64_64E.exe.iss - - AHFormatter.lic - Visual Basic Runtime (required only for core variants) - vbrun60sp6.exe. Get it from [Service Pack 6 for Visual Basic 6.0: Run-Time Redistribution Pack (vbrun60sp6.exe)](https://www.microsoft.com/en-us/download/details.aspx?id=24417) and then extract. diff --git a/Topics/How to use the repository (Examples).md b/Topics/How to use the repository (Examples).md index 6fe571a..05d4fb2 100644 --- a/Topics/How to use the repository (Examples).md +++ b/Topics/How to use the repository (Examples).md @@ -22,21 +22,19 @@ In this example the name of the repository is `asarafian`. # Steps -The process depends on scripts in the examples directory. To help run these scripts we need to use a json file that drives the files. Read more [About Example Scripts](About Example Scripts.md) +The process depends on scripts in the examples directory. To help run these scripts we need to use a json file that drives the files. -1. Publish the repository modules to an internal NuGet Server (asarafian). +1. Publish the repository modules to an internal NuGet Server (mymachine). 1. Initialize PowerShellGet on remote server. 1. Install PackageManagement 1. Update the NuGet package provider. - 1. Register a repository for `asarafian`. + 1. Register a repository for `mymachine`. 1. Install all modules 1. Enable the CredSSP authentication for PSSession. -1. Install the server prerequisites using xISHServer.12 +1. Install the server prerequisites using module **xISHServer.12**. 1. Seed the server with a Content Manager CD. -1. Install a deployment using xISHInstall. -1. Apply code as configuration scripts using one of the following - - ISHDeploy.12.0.0 - - ISHDeploy.12.0.1 +1. Install a deployment using **xISHInstall**. +1. Apply code as configuration scripts using PowerShell module [ISHDeploy.12.0.1](www.powershellgallery.com/packages/ISHDeploy.12.0.1/). Other module variants are also possible 1. Run Pester tests ## Publish the modules to the internal Nuget Server repository @@ -54,20 +52,66 @@ This allows a repeative publish as ofter as we want. ```powershell & .\Examples\Load-ISHBootstrapperContext.ps1 -JSONFile "server01.json" ``` +An obfuscated file for local execution looks like this +```json +{ + "ISHVersion": "12.0.1", + "ISHDeployRepository": "PSGallery", + "PSRepository": [ + ], + "WebCertificate": { + "Authority": "Authority", + "OrganizationalUnit": "OrganizationUnit", + "Organization": "Organization" + }, + "FTP": { + "Host": "host", + "CredentialExpression": "New-Credential -Message \"FTP\"", + "ISHServerFolder": "Download/InfoShare120/ISHServer/", + "ISHCDFolder": "Download/InfoShare120/SP1/", + "ISHCDFileName": "20160815.CD.InfoShare.12.0.3215.1.Trisoft-DITA-OT.exe", + "AntennaHouseLicensePath": "License/AntennaHouse/AHFormatter.lic" + }, + "OSUserCredentialExpression": "New-Credential -Message \"OSUser\"", + "Configuration": [ + { + "XOPUS": [ + { + "LisenceKey": "license", + "Domain": "domain" + } + ], + "ExternalID": "username", + "ADFSComputerName": "adfs.example.com" + } + ], + "ISHDeployment": [ + { + "Name": "InfoShare", + "IsOracle": false, + "ConnectionString": "", + "LucenePort": 9010, + "UseRelativePaths": false, + "Scripts": [ + "ISHDeploy\\Set-ISHCMComponents.ps1", + "ISHDeploy\\Set-ISHCMMenuAndButton.ps1", + "ISHDeploy\\Set-ADFSIntegration.ps1" + ] + } + ] +} +``` -An obfuscated file looks like this +An obfuscated file for remote execution looks like this ```json { - "ComputerName": "SERVER01", - "CredentialExpression": "New-MyCredential", "ISHVersion": "12.0.1", - "CertificateAuthority" : "CertificateAuthority", - "InstallProcessExplorer": true, + "ComputerName": "Server", + "DOMAIN": "Domain", + "CredentialExpression": "New-Credential -Message \"Remote Administrator\"", + "ISHDeployRepository": "PSGallery", "xISHServerRepository": "mymachine", "xISHInstallRepository": "mymachine", - "ISHDeployRepository": "PSGallery", - "PrerequisitesSourcePath": "C:\\inetpubopen\\xISHServer", - "OSUserCredentialExpression": "New-InfoShareServiceUserCredential", "PSRepository": [ { "Name": "mymachine", @@ -75,36 +119,52 @@ An obfuscated file looks like this "InstallationPolicy": "Trusted" } ], + "WebCertificate": { + "Authority": "Authority", + "OrganizationalUnit": "OrganizationUnit", + "Organization": "Organization" + }, "FTP": { - "Host": "host" - "User": "user", - "Password": "password", - "ISHCDFolder": "path", - "ISHCDFileName": "filename" + "Host": "host", + "CredentialExpression": "New-Credential -Message \"FTP\"", + "ISHServerFolder": "Download/InfoShare120/ISHServer/", + "ISHCDFolder": "Download/InfoShare120/SP1/", + "ISHCDFileName": "20160815.CD.InfoShare.12.0.3215.1.Trisoft-DITA-OT.exe", + "AntennaHouseLicensePath": "License/AntennaHouse/AHFormatter.lic" }, - "Pester": [ - "Pester\\Module.Tests.ps1" + "OSUserCredentialExpression": "New-Credential -Message \"OSUser\"", + "Configuration": [ + { + "XOPUS": [ + { + "LisenceKey": "license", + "Domain": "domain" + } + ], + "ExternalID": "username", + "ADFSComputerName": "adfs.example.com" + } ], "ISHDeployment": [ - { - "Name": "InfoShare", - "IsOracle": false, - "ConnectionString": "", - "LucenePort": 9010, - "UseRelativePaths": false, - "Scripts": [ - "ISHDeploy\\Set-ISHCMComponents.ps1", - "ISHDeploy\\Set-ISHCMMenuAndButton.ps1", - "ISHDeploy\\Set-ADFSIntegration.ps1" - ], - "Pester": [ - "Pester\\Basic.Tests.ps1", - ] - } + { + "Name": "InfoShare", + "IsOracle": false, + "ConnectionString": "", + "LucenePort": 9010, + "UseRelativePaths": false, + "Scripts": [ + "ISHDeploy\\Set-ISHCMComponents.ps1", + "ISHDeploy\\Set-ISHCMMenuAndButton.ps1", + "ISHDeploy\\Set-ADFSIntegration.ps1" + ] + } ] } ``` +Please note that if you are already a customer of SDL Knowledge Center, the above FTP paths will not be available. +This is an example of how I currently envision this, without changing the structure much and verified against my very own ftp. + ## Initialize PowerShellGet on remote server ```powershell @@ -162,10 +222,10 @@ Behind the scenes the scripts in folder `Source\Scripts\xISHServer` are executed The `Initialize-ISHServerOSUser.ps1` is the most tricky one because it needs to add the `osuser` to the local administrator group. To do that the remote call needs to access the active directory and this is where the double hop issue appears. Read more on [About CredSSP authentication for PSSession](About CredSSP authentication for PSSession.md). CredSSP requires secure SSL. That means that a session must be created using the Fully Qualified Domain Name of the computer because the certificate should have as Common Name (CN) the same. -As an example if the server is `server01` and the FQDN is `server01.x1.x2.x3` the code that imports implicitly a module looks like +As an example if the server is `server` and the FQDN is `server.x1.x2.x3` the code that imports implicitly a module looks like ```powershell -$session=New-PSSession "server01.x.y.z" -Credential -UseSSL -Authentication CredSSP +$session=New-PSSession "server.x1.x2.x3" -Credential -UseSSL -Authentication CredSSP Import-Module $moduleName -PSSession $session -Force ``` @@ -178,12 +238,11 @@ Then ssl validation will fail with > The SSL certificate contains a common name (CN) that does not match the hostname. For more information, see the about_Remote_Troubleshooting Help topic. -To not use the lengthy FQDN and bypass the certificate common name validation adjust the JSON next to `CredentialForCredSSPExpression` like this +To not use the lengthy FQDN and bypass the certificate common name validation adjust the JSON like this ```json - "CredentialExpression": "New-MyCredential", - "UseFQDNForCredSSPExpression": false, - "SessionOptionsForCredSSPExpression": "New-PSSessionOption -SkipCNCheck", + "UseFQDNWithCredSSP": false, + "SessionOptionsWithCredSSPExpression": "New-PSSessionOption -SkipCNCheck", ``` ## Seed the server with a Content Manager CD @@ -196,11 +255,12 @@ This step uses the values in ```json "FTP": { - "Host": "host" - "User": "user", - "Password": "password", - "ISHCDFolder": "path", - "ISHCDFileName": "filename" + "Host": "host", + "CredentialExpression": "New-Credential -Message \"FTP\"", + "ISHServerFolder": "Download/InfoShare120/ISHServer/", + "ISHCDFolder": "Download/InfoShare120/SP1/", + "ISHCDFileName": "20160815.CD.InfoShare.12.0.3215.1.Trisoft-DITA-OT.exe", + "AntennaHouseLicensePath": "License/AntennaHouse/AHFormatter.lic" } ``` @@ -228,12 +288,12 @@ I've created a script `Invoke-ISHDeployScript.ps1` that wraps up functionality f "LucenePort": 9010, "UseRelativePaths": false, "Scripts": [ - "ISHDeploy\\Set-ISHCMComponents.ps1", - "ISHDeploy\\Set-ISHCMMenuAndButton.ps1", - "ISHDeploy\\Set-ISHSTSRelyingParty.ps1" + "ISHDeploy\\Set-ISHCMComponents.ps1", + "ISHDeploy\\Set-ISHCMMenuAndButton.ps1", + "ISHDeploy\\Set-ISHSTSRelyingParty.ps1" ] } - ] +] ``` You can trigger the sequence with @@ -308,7 +368,7 @@ Declare the test script section in the JSON on the rool level with key `Pester` ```json { "Pester": [ - "Pester\\Module.Tests.ps1" + "Pester\\Module.Tests.ps1" ] } ``` @@ -337,12 +397,12 @@ Declare the test script section in the JSON within a deployment with key `Pester "LucenePort": 9010, "UseRelativePaths": false, "Scripts": [ - "ISHDeploy\\Set-ISHCMComponents.ps1", - "ISHDeploy\\Set-ISHCMMenuAndButton.ps1", - "ISHDeploy\\Set-ADFSIntegration.ps1" + "ISHDeploy\\Set-ISHCMComponents.ps1", + "ISHDeploy\\Set-ISHCMMenuAndButton.ps1", + "ISHDeploy\\Set-ADFSIntegration.ps1" ], "Pester": [ - "Pester\\Basic.Tests.ps1", + "Pester\\Basic.Tests.ps1", ] } ]