<commit_before>#ValidationTags#Messaging,FlowControl,Pipeline,CodeStyle#
function Set-DbaAgHadr {
	<#
		.SYNOPSIS
			Changes the Hadr service setting on the specified SQL Server.

		.DESCRIPTION
			In order to build an AG a cluster has to be built and then the Hadr enabled for the SQL Server
			service. This function enables or disables that feature for the SQL Server service.

		.PARAMETER SqlInstance
			The SQL Server that you're connecting to.

		.PARAMETER Credential
			Credential object used to connect to the Windows server itself as a different user

		.PARAMETER Enabled
			Boolean value, supports passing in 0, 1, $true or $false

		.PARAMETER WhatIf
			Shows what would happen if the command were to run. No actions are actually performed.

		.PARAMETER Confirm
			Prompts you for confirmation before executing any changing operations within the command.

		.PARAMETER Silent
			Use this switch to disable any kind of verbose messages

		.NOTES
			Original Author: <NAME> (@wsmelton | http://blog.wsmelton.info)

			Website: https://dbatools.io
			Copyright: (C) <NAME>, <EMAIL>
			License: GNU GPL v3 https://opensource.org/licenses/GPL-3.0

		.LINK
			https://dbatools.io/Set-DbaAgHadr

		.EXAMPLE
			Set-DbaAgHadr -SqlInstance sql2016 -Enabled 1

			Sets Hadr service to enabled for the instance sql2016

		.EXAMPLE
			Set-DbaAgHadr -SqlInstance sql2012\dev1 Enabled 0

			Sets Hadr service to disabled for the instance dev1 on sq2012
	#>
	[CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "High")]
	param (
		[parameter(Mandatory = $true, ValueFromPipeline = $true)]
		[Alias("ServerInstance", "SqlServer")]
		[DbaInstanceParameter[]]$SqlInstance,
		[PSCredential]$Credential,
		[boolean]$Enabled,
		[switch]$Force,
		[switch]$Silent
	)
	begin {
		if (Test-Bound 'Enabled') {
			if ($Enabled -eq $null) {
				Stop-Function -Message "A value must be provided for Enabled"
				return
			}
		}
	}
	process {
		if (Test-FunctionInterrupt) { return }
		foreach ($instance in $SqlInstance) {
			$computer = $instance.ComputerName
			$instanceName = $instance.InstanceName

			$noChange = $false

			switch ($instance.InstanceName) {
				'MSSQLSERVER' { $agentName = 'SQLSERVERAGENT' }
				default { $agentName = "SQLAgent`$$instanceName" }<commit_msg>correcting parameter help<commit_after>#ValidationTags#Messaging,FlowControl,Pipeline,CodeStyle#
function Set-DbaAgHadr {
	<#
		.SYNOPSIS
			Changes the Hadr service setting on the specified SQL Server.

		.DESCRIPTION
			In order to build an AG a cluster has to be built and then the Hadr enabled for the SQL Server
			service. This function enables or disables that feature for the SQL Server service.

		.PARAMETER SqlInstance
			The SQL Server that you're connecting to.

		.PARAMETER Credential
			Credential object used to connect to the Windows server itself as a different user

		.PARAMETER Enabled
			Boolean value, supports passing in 0, 1, $true or $false

		.PARAMETER WhatIf
			Shows what would happen if the command were to run. No actions are actually performed.

		.PARAMETER Confirm
			Prompts you for confirmation before executing any changing operations within the command.
	
		.PARAMETER Force
			Will restart SQL Server and SQL Server Agent service to apply the change.

		.PARAMETER Silent
			Use this switch to disable any kind of verbose messages

		.NOTES
			Original Author: <NAME> (@wsmelton | http://blog.wsmelton.info)

			Website: https://dbatools.io
			Copyright: (C) <NAME>, <EMAIL>
			License: GNU GPL v3 https://opensource.org/licenses/GPL-3.0

		.LINK
			https://dbatools.io/Set-DbaAgHadr

		.EXAMPLE
			Set-DbaAgHadr -SqlInstance sql2016 -Enabled 1 -Force

			Sets Hadr service to enabled for the instance sql2016, and restart the service to apply the change.

		.EXAMPLE
			Set-DbaAgHadr -SqlInstance sql2012\dev1 Enabled 0 -Force

			Sets Hadr service to disabled for the instance dev1 on sq2012, and restart the service to apply the change.
	#>
	[CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "High")]
	param (
		[parameter(Mandatory = $true, ValueFromPipeline = $true)]
		[Alias("ServerInstance", "SqlServer")]
		[DbaInstanceParameter[]]$SqlInstance,
		[PSCredential]$Credential,
		[boolean]$Enabled,
		[switch]$Force,
		[switch]$Silent
	)
	begin {
		if (Test-Bound 'Enabled') {
			if ($Enabled -eq $null) {
				Stop-Function -Message "A value must be provided for Enabled"
				return
			}
		}
	}
	process {
		if (Test-FunctionInterrupt) { return }
		foreach ($instance in $SqlInstance) {
			$computer = $instance.ComputerName
			$instanceName = $instance.InstanceName

			$noChange = $false

			switch ($instance.InstanceName) {
				'MSSQLSERVER' { $agentName = 'SQLSERVERAGENT' }
				default { $agentName = "SQLAgent`$$instanceName" }
{'fraction_non_alphanumeric': 0.08598993288590603, 'fraction_numerical': 0.010486577181208054, 'mean_word_length': 3.7642357642357642, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1654114', 'n_tokens_mistral': 1658, 'n_tokens_neox': 1423, 'n_words': 507}