Skip to content

Commit

Permalink
Changes to xSQLServerSetup
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Replaced StartWin32Process helper function with the cmdlet Start-Process (issue dsccommunity#41, dsccommunity#93 and dsccommunity#126).
  • Loading branch information
johlju committed Jun 3, 2017
1 parent b20cb94 commit 6128584
Show file tree
Hide file tree
Showing 5 changed files with 187 additions and 867 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@
- Removed helper function Grant-ServerPerms because the deprecated resource that was using it was removed.
- Removed helper function Grant-CNOPerms because the deprecated resource that was using it was removed.
- Removed helper function New-ListenerADObject because the deprecated resource that was using it was removed.
- Changes to xSQLServerSetup
- BREAKING CHANGE: Replaced StartWin32Process helper function with the cmdlet Start-Process (issue #41, #93 and #126).

## 7.0.0.0

Expand Down
25 changes: 17 additions & 8 deletions DSCResources/MSFT_xSQLServerSetup/MSFT_xSQLServerSetup.psm1
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
$script:currentPath = Split-Path -Path $MyInvocation.MyCommand.Path -Parent
Import-Module -Name (Join-Path -Path (Split-Path -Path (Split-Path -Path $script:currentPath -Parent) -Parent) -ChildPath 'xSQLServerHelper.psm1')
Import-Module -Name (Join-Path -Path (Split-Path -Path (Split-Path -Path $script:currentPath -Parent) -Parent) -ChildPath 'xPDT.psm1')

<#
.SYNOPSIS
Expand Down Expand Up @@ -851,7 +850,7 @@ function Set-TargetResource
$mediaDestinationPath = Join-Path -Path (Get-TemporaryFolder) -ChildPath $mediaDestinationFolder

New-VerboseMessage -Message "Robocopy is copying media from source '$SourcePath' to destination '$mediaDestinationPath'"
Copy-ItemWithRoboCopy -Path $SourcePath -DestinationPath $mediaDestinationPath
Copy-ItemWithRobocopy -Path $SourcePath -DestinationPath $mediaDestinationPath

Remove-SmbMapping -RemotePath $SourcePath -Force

Expand Down Expand Up @@ -1323,20 +1322,30 @@ function Set-TargetResource

$arguments = $arguments.Trim()
$processArguments = @{
Path = $pathToSetupExecutable
Arguments = $arguments
FilePath = $pathToSetupExecutable
ArgumentList = $arguments
}

if ($Action -in @('InstallFailoverCluster','AddNode'))
{
$processArguments.Add('Credential',$SetupCredential)
}

$process = StartWin32Process @processArguments
$sqlSetupProcess = Start-Process @processArguments -PassThru -Wait -NoNewWindow
Wait-Process -InputObject $sqlSetupProcess -Timeout 120

New-VerboseMessage -Message $process
$processExitCode = $sqlSetupProcess.ExitCode
$setupExitMessage = "Setup exited with code '$processExitCode'."

WaitForWin32ProcessEnd -Path $pathToSetupExecutable -Arguments $arguments
if ($processExitCode -ne 0) {
$setupExitMessage += ' Please see the ''Summary.txt'' log file in the ''Setup Bootstrap\Log'' folder.'

throw $setupExitMessage
}
else
{
Write-Verbose $setupExitMessage
}

if ($ForceReboot -or ($null -ne (Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' -Name 'PendingFileRenameOperations' -ErrorAction SilentlyContinue)))
{
Expand Down Expand Up @@ -1796,7 +1805,7 @@ function Get-FirstItemPropertyValue
.PARAMETER DestinationPath
The path to the destination.
#>
function Copy-ItemWithRoboCopy
function Copy-ItemWithRobocopy
{
[CmdletBinding()]
param
Expand Down
Loading

0 comments on commit 6128584

Please sign in to comment.