SharePoint Solution Deployer (SPSD) helps you to deploy SharePoint solution packages (.wsp) to multiple SharePoint environments. It deploys, retracts and upgrades one or more WSPs and can be extended to perform additional custom tasks in PowerShell before or afterwards. Unlike the most of the available scripts on the net, it performs all necessary prerequisite checks and post-deployment actions on all servers in the farm to assure the deployment runs smooth.
The logging is not working correctly in Windows Server 2012 R2 with PowerShell 4.
Every entry, that is internally created via the Log function is not logged in the file, only listed in the console.
Alternatively, you can replace Write-Host with Write-Out or Out-Host.
In SPSD_Utilities.ps1, the Write-Host is used 4 times.
It is not working to just replace Write-Host with Write-Output.
For Windows Server 2012 R2, you can just overwrite Write-Output with the following function, just inserted it below (Line 102)
# region Utilities.Logging
# region Log
This is the function to insert:
# replacement for Write-Host, which does not work for specific constellations of PS4 and Win Server 2012 R2
# see Hotfix https://support.microsoft.com/en-us/kb/3014136
Function Write-Host ($message,[switch] $nonewline,$backgroundcolor,$foregroundcolor) {
$Message | Out-Host
}
I don't think, this should be added to the standard SPSD functionality, therefore I did not change it as a Pull request. To create an issue seemed to be a good idea to me. Maybe s.o. finds an intelligent way to include this in the script, has a good place where to put this as a heads up or in the simplest case, maybe just adds this information as comment in the log function...?
The logging is not working correctly in Windows Server 2012 R2 with PowerShell 4. Every entry, that is internally created via the Log function is not logged in the file, only listed in the console.
The cause is a bug in windows server 2012 R2. This issue is also discussed in Technet: https://social.technet.microsoft.com/Forums/windowsserver/en-US/cecc4f32-28c8-4bdc-be63-49ce3d396625/powershell-4-starttranscript-does-not-log-writehost?forum=winserverpowershell There exists a hotfix for windows server: see https://support.microsoft.com/en-us/kb/3014136
Alternatively, you can replace Write-Host with Write-Out or Out-Host. In SPSD_Utilities.ps1, the Write-Host is used 4 times. It is not working to just replace Write-Host with Write-Output. For Windows Server 2012 R2, you can just overwrite Write-Output with the following function, just inserted it below (Line 102)
This is the function to insert:
I don't think, this should be added to the standard SPSD functionality, therefore I did not change it as a Pull request. To create an issue seemed to be a good idea to me. Maybe s.o. finds an intelligent way to include this in the script, has a good place where to put this as a heads up or in the simplest case, maybe just adds this information as comment in the log function...?
Cheers, Achim
Some further information in German related to the logging issue can also be found here: https://www.msxfaq.de/code/powershell/writehostdebugging.htm