PowerShell scripts updated.
* Error traps added. * Tracing added. * Enable-TrustedHosts added to another YAML. * JSON files updated. Change-Id: I76414217fb8cb77575b8b36499b5dfb952adeb5f
This commit is contained in:
parent
7aee81ca7c
commit
e73918da57
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,12 +1,16 @@
|
||||
Scripts:
|
||||
- ../../WindowsPowerShell/Functions/ImportCoreFunctions.ps1
|
||||
- ../../WindowsPowerShell/Functions/Update-ServiceConfig.ps1
|
||||
- ../../WindowsPowerShell/Functions/SQLServerForAOAG.ps1
|
||||
- ../../WindowsPowerShell/Functions/Failover-Cluster.ps1
|
||||
|
||||
Commands:
|
||||
- Name: Install-FailoverClusterPrerequisites
|
||||
Arguments: {}
|
||||
|
||||
- Name: Enable-TrustedHosts
|
||||
Arguments: {}
|
||||
|
||||
- Name: Update-ServiceConfig
|
||||
Arguments:
|
||||
Name: Murano Agent
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -71,12 +71,9 @@ function New-FailoverClusterSharedFolder {
|
||||
}
|
||||
process {
|
||||
trap {
|
||||
Write-LogError $_ -EntireObject
|
||||
break
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
Write-Log "--> New-FailoverClusterSharedFolder"
|
||||
|
||||
Write-Log "Creating shared folder for Failover Cluster ..."
|
||||
@ -139,12 +136,9 @@ function New-FailoverCluster {
|
||||
}
|
||||
process {
|
||||
trap {
|
||||
Write-LogError $_ -EntireObject
|
||||
break
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
Write-Log "ClusterNodes: $($ClusterNodes -join ', ')"
|
||||
|
||||
if ($Credential -eq $null) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
Import-Module CoreFunctions -Force
|
||||
|
||||
|
||||
function Show-InvocationInfo {
|
||||
param (
|
||||
$Invocation,
|
||||
@ -24,6 +25,21 @@ function Show-InvocationInfo {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$TrapHandler = {
|
||||
Write-LogError @("<exception>", $_) -EntireObject
|
||||
Write-LogError "</exception>"
|
||||
break
|
||||
}
|
||||
|
||||
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
|
||||
<#
|
||||
# Usage example for Show-InvocationInfo
|
||||
|
||||
@ -40,6 +56,9 @@ function MyFunction {
|
||||
Show-InvocationInfo $MyInvocation -End
|
||||
}
|
||||
process {
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
# Main code here
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,16 @@ Function Install-SqlServer {
|
||||
[Switch] $MixedModeAuth = $false,
|
||||
[Switch] $UpdateEnabled = $false
|
||||
)
|
||||
begin {
|
||||
Show-InvocationInfo $MyInvocation
|
||||
}
|
||||
end {
|
||||
Show-InvocationInfo $MyInvocation -End
|
||||
}
|
||||
process {
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
if ($SetupRoot -eq '') {
|
||||
if ($MuranoFileShare -eq '') {
|
||||
@ -59,4 +69,5 @@ Function Install-SqlServer {
|
||||
Show-Environment
|
||||
|
||||
New-SqlServer -SetupRoot $SetupRoot -ExtraOptions $ExtraOptions
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,16 @@ function New-SqlServerSystemAccount {
|
||||
|
||||
[String] $PrimaryNode = ' '
|
||||
)
|
||||
begin {
|
||||
Show-InvocationInfo $MyInvocation
|
||||
}
|
||||
end {
|
||||
Show-InvocationInfo $MyInvocation -End
|
||||
}
|
||||
process {
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
if ($PrimaryNode.ToLower() -ne ($Env:ComputerName).ToLower()) {
|
||||
Write-Log "THis function runs on AOAG primary node only."
|
||||
@ -44,4 +54,5 @@ function New-SqlServerSystemAccount {
|
||||
-AccountPassword $(ConvertTo-SecureString -String $SQLServiceUserPassword -AsPlainText -Force) `
|
||||
-Credential $Creds `
|
||||
-ErrorAction 'Stop'
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,10 @@ function Install-SqlServerPowerShellModule {
|
||||
Show-InvocationInfo $MyInvocation -End
|
||||
}
|
||||
process {
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
if ((Get-Module SQLPS -ListAvailable) -ne $null) {
|
||||
Write-Log "Module SQLSP already installed."
|
||||
return
|
||||
@ -79,6 +83,10 @@ function Install-SqlServerForAOAG {
|
||||
Show-InvocationInfo $MyInvocation -End
|
||||
}
|
||||
process {
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
if ($MuranoFileShare -eq '') {
|
||||
$MuranoFileShare = [Environment]::GetEnvironmentVariable('MuranoFileShare')
|
||||
if ($MuranoFileShare -eq '') {
|
||||
@ -126,6 +134,10 @@ function Initialize-AlwaysOnAvailabilityGroup {
|
||||
Show-InvocationInfo $MyInvocation -End
|
||||
}
|
||||
process {
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
$ShareNetworkPath = '\\' + $PrimaryNode + '\' + $ShareName
|
||||
|
||||
$DomainAdminAccountCreds = New-Credential `
|
||||
@ -171,6 +183,10 @@ function New-SharedFolderForAOAG {
|
||||
Show-InvocationInfo $MyInvocation -End
|
||||
}
|
||||
process {
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
if ($PrimaryNode.ToLower() -ne ($Env:ComputerName).ToLower()) {
|
||||
Write-Log "This script runs on primary node only."
|
||||
Write-Log "Exiting script."
|
||||
@ -294,6 +310,10 @@ function Initialize-AOAGPrimaryReplica {
|
||||
Show-InvocationInfo $MyInvocation -End
|
||||
}
|
||||
process {
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
Write-Log "Primary node: '$($PrimaryNode.ToLower())'"
|
||||
Write-Log "Current node: '$(($Env:ComputerName).ToLower())'"
|
||||
|
||||
@ -422,6 +442,10 @@ function Initialize-AOAGSecondaryReplica {
|
||||
Show-InvocationInfo $MyInvocation -End
|
||||
}
|
||||
process {
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
if ($PrimaryNode.ToLower() -eq ($Env:ComputerName).ToLower()) {
|
||||
Write-Log "This function works on any SecondaryNode only."
|
||||
Write-Log "Exiting."
|
||||
@ -459,6 +483,10 @@ function Disable-Firewall {
|
||||
Show-InvocationInfo $MyInvocation -End
|
||||
}
|
||||
process {
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
netsh advfirewall set allprofiles state off
|
||||
}
|
||||
}
|
||||
@ -473,6 +501,10 @@ function Enable-Firewall {
|
||||
Show-InvocationInfo $MyInvocation -End
|
||||
}
|
||||
process {
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
netsh advfirewall set allprofiles state on
|
||||
}
|
||||
}
|
||||
@ -487,6 +519,10 @@ function Enable-TrustedHosts {
|
||||
Show-InvocationInfo $MyInvocation -End
|
||||
}
|
||||
process {
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
Set-Item WSMan:\localhost\Client\TrustedHosts -Value '*' -Force
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,10 @@ function Start-PowerShellProcess {
|
||||
Show-InvocationInfo $MyInvocation -End
|
||||
}
|
||||
process {
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
$StdOut = [IO.Path]::GetTempFileName()
|
||||
$StdErr = [IO.Path]::GetTempFileName()
|
||||
|
||||
|
@ -14,6 +14,10 @@ function Update-ServiceConfig {
|
||||
Show-InvocationInfo $MyInvocation -End
|
||||
}
|
||||
process {
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
$ArgumentList = @('config', "`"$Name`"")
|
||||
|
||||
if ($RunAsLocalService) {
|
||||
|
Loading…
Reference in New Issue
Block a user