<commit_before>Function Invoke-ManagedComputerCommand
{
<#
.SYNOPSIS
Internal command
	
#>	
	[CmdletBinding()]
	param (
		[Parameter(Mandatory = $true)]
		[Alias("Server")]
		[dbainstanceparameter]$ComputerName,
		[System.Management.Automation.PSCredential]$Credential,
		[Parameter(Mandatory = $true)]
		[scriptblock]$ScriptBlock,
		[string[]]$ArgumentList,
		[switch]$Silent # Left in for legacy but this command needs to throw
	)
	
	$ComputerName = $ComputerName.ComputerName
	
	Test-RunAsAdmin -ComputerName $ComputerName
	
	$ipaddr = (Test-Connection $ComputerName -Count 1 -ErrorAction Stop).Ipv4Address
	$ArgumentList += $ipaddr
		
	[scriptblock]$setupScriptBlock = {
		$ipaddr = $args[$args.GetUpperBound(0)]
		
		# Just in case we go remote, ensure the assembly is loaded
		[void][System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SqlServer.SqlWmiManagement')
		
		$wmi = New-Object Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer $ipaddr
		$null = $wmi.Initialize()
	}
	
	$prescriptblock = $setupScriptBlock.ToString()
	$postscriptblock = $ScriptBlock.ToString()
	
	$scriptblock = [ScriptBlock]::Create("$prescriptblock  $postscriptblock")
		
	try
	{
		Invoke-Command2 -ScriptBlock $ScriptBlock -ArgumentList $ArgumentList -Credential $Credential -ErrorAction Stop
	}
	catch
	{
		try
		{
			Write-Message -Level Verbose -Message "Local connection attempt to $ComputerName failed. Connecting remotely."
			
			# For surely resolve stuff
			$hostname = [System.Net.Dns]::gethostentry($ipaddr)
			$hostname = $hostname.HostName
			
			Invoke-Command2 -ScriptBlock $ScriptBlock -ArgumentList $ArgumentList -ComputerName $hostname -ErrorAction Stop
		}
		catch {
			throw "SqlWmi connection failed: $_"
		}
	}
}<commit_msg>made more accurate<commit_after>Function Invoke-ManagedComputerCommand
{
<#
.SYNOPSIS
Internal command
	
#>	
	[CmdletBinding()]
	param (
		[Parameter(Mandatory = $true)]
		[Alias("Server")]
		[dbainstanceparameter]$ComputerName,
		[System.Management.Automation.PSCredential]$Credential,
		[Parameter(Mandatory = $true)]
		[scriptblock]$ScriptBlock,
		[string[]]$ArgumentList,
		[switch]$Silent # Left in for legacy but this command needs to throw
	)
	
	$ComputerName = $ComputerName.ComputerName
	
	Test-RunAsAdmin -ComputerName $ComputerName
	
	$resolved = Resolve-DbaNetworkName -ComputerName $ComputerName
	$ipaddr = $resolved.IpAddress
	$ArgumentList += $ipaddr
		
	[scriptblock]$setupScriptBlock = {
		$ipaddr = $args[$args.GetUpperBound(0)]
		
		# Just in case we go remote, ensure the assembly is loaded
		[void][System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SqlServer.SqlWmiManagement')
		
		$wmi = New-Object Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer $ipaddr
		$null = $wmi.Initialize()
	}
	
	$prescriptblock = $setupScriptBlock.ToString()
	$postscriptblock = $ScriptBlock.ToString()
	
	$scriptblock = [ScriptBlock]::Create("$prescriptblock  $postscriptblock")
		
	try
	{
		Invoke-Command2 -ScriptBlock $ScriptBlock -ArgumentList $ArgumentList -Credential $Credential -ErrorAction Stop
	}
	catch
	{
		try
		{
			Write-Message -Level Verbose -Message "Local connection attempt to $ComputerName failed. Connecting remotely."
			
			# For surely resolve stuff
			$hostname = $resolved.fqdn
			
			Invoke-Command2 -ScriptBlock $ScriptBlock -ArgumentList $ArgumentList -ComputerName $hostname -ErrorAction Stop
		}
		catch {
			throw "SqlWmi connection failed: $_"
		}
	}
}
{'fraction_non_alphanumeric': 0.11394607132502174, 'fraction_numerical': 0.002319512902290519, 'mean_word_length': 4.798319327731092, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, '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': '240690', 'n_tokens_mistral': 1197, 'n_tokens_neox': 1064, 'n_words': 229}