<commit_before>﻿function Test-DbaSqlManagementObject
{
	<#
		.SYNOPSIS
			Tests to see if the SMO version specified exists on the computer.
		
		.DESCRIPTION
		 	The Test-DbaSqlManagementObject returns True if the Version is on the computer, and False if it does not exist.
		
		.PARAMETER VersionNumber
			This is the specific version number you are looking for and the return will be True.
		
		.PARAMETER Silent
			Use this switch to disable any kind of verbose messages
		
		.NOTES
			Tags: SMO
			Original Author: <NAME> (@DBAduck - http://dbaduck.com)

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

		.LINK
			https://dbatools.io/Test-DbaSqlManagementObject

		.EXAMPLE
			Test-DbaSqlManagementObject -VersionNumber 13
			Returns True if the version exists, if it does not exist it will return False
		
	#>
	[CmdletBinding()]
	param (
		[Parameter(Mandatory = $true, Position = 0)]
		[int]$VersionNumber
	)
	begin
	{
		if ($VersionNumber -lt 9)
		{
			throw "SMO existed from SQL 2005 (version 9) onward. Please use a version after 9. Quitting."
		}
	}
	process
	{
		$smolist = (Get-ChildItem -Path "$($env:SystemRoot)\assembly\GAC_MSIL\Microsoft.SqlServer.Smo" -Filter "$VersionNumber.*" | Sort-Object Name -Desc).Name
		
		if ($smolist.Length -gt 0)
		{
			return $true
		}
		else
		{
			return $false
		}
	}
}
<commit_msg>updates to make remote enabled, etc<commit_after>﻿function Test-DbaSqlManagementObject {
	<#
		.SYNOPSIS
			Tests to see if the SMO version specified exists on the computer.
		
		.DESCRIPTION
		 	The Test-DbaSqlManagementObject returns True if the Version is on the computer, and False if it does not exist.
		
		.PARAMETER ComputerName
			The name of the target you would like to check
	
		.PARAMETER Credential
			This command uses Windows credentials. This parameter allows you to connect remotely as a different user.
	
		.PARAMETER VersionNumber
			This is the specific version number you are looking for and the return will be True.
		
		.PARAMETER Silent
			Use this switch to disable any kind of verbose messages
		
		.NOTES
			Tags: SMO
			Original Author: <NAME> (@DBAduck - http://dbaduck.com)

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

		.LINK
			https://dbatools.io/Test-DbaSqlManagementObject

		.EXAMPLE
			Test-DbaSqlManagementObject -VersionNumber 13
			Returns True if the version exists, if it does not exist it will return False
		
	#>
	[CmdletBinding()]
	param (
		[parameter(ValueFromPipeline)]
		[Alias("ServerInstance", "SqlServer", "SqlInstance")]
		[DbaInstanceParameter[]]$ComputerName = $env:COMPUTERNAME,
		[PSCredential][System.Management.Automation.CredentialAttribute()]
		$Credential,
		[Parameter(Mandatory)]
		[int[]]$VersionNumber,
		[switch]$Silent
	)
	
	begin {
		$scriptblock = {
			foreach ($number in $args) {
				$smolist = (Get-ChildItem -Path "$($env:SystemRoot)\assembly\GAC_MSIL\Microsoft.SqlServer.Smo" -Filter "$number.*" | Sort-Object Name -Descending).Name
				
				if ($smolist) {
					[pscustomobject]@{
						ComputerName = $env:COMPUTERNAME
						Version = $number
						Exists = $true
					}
				}
				else {
					[pscustomobject]@{
						ComputerName = $env:COMPUTERNAME
						Version = $number
						Exists = $false
					}
				}
			}
		}
	}
	process {
		foreach ($computer in $ComputerName.ComputerName) {
			try {
				Invoke-Command2 -ComputerName $computer -ScriptBlock $scriptblock -Credential $Credential -ArgumentList $VersionNumber -ErrorAction Stop
			}
			catch {
				Stop-Function -Continue -Message "Faiure" -ErrorRecord $_ -Target $ComputerName
			}
		}
	}
}
{'fraction_non_alphanumeric': 0.09868597479216948, 'fraction_numerical': 0.0053633681952266025, 'mean_word_length': 3.262857142857143, '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': '3004605', 'n_tokens_mistral': 1408, 'n_tokens_neox': 1159, 'n_words': 360}