<commit_before>$url = 'https://github.com/ctrlbold/dbatools/archive/master.zip'
$path = Join-Path -Path (Split-Path -Path $profile) -ChildPath '\Modules\dbatools'
$zipfile = "$path\sqltools.zip"


if (!(Test-Path -Path $path)){
	Write-Output "Creating directory: $path"
	New-Item -Path $path -ItemType Directory | Out-Null 
} else { 
	Write-Output "Deleting previously installed module"
	Remove-Item -Path "$path\*" -Force -Recurse 
}

Write-Output "Downloading archive from github"
Invoke-WebRequest $url -OutFile $zipfile

Write-Output "Unzipping"
# Keep it backwards compatible
$shell = New-Object -COM Shell.Application
$zipPackage = $shell.NameSpace($zipfile)
$destinationFolder = $shell.NameSpace($path)
$destinationFolder.CopyHere($zipPackage.Items())

Write-Output "Cleaning up"
Move-Item -Path "$path\dbatools-master\*" $path
Remove-Item -Path "$path\dbatools-master"
Remove-Item -Path $zipfile

Remove-Module dbatools -ErrorAction SilentlyContinue
Import-Module "$path\dbatools.psd1"

Write-Output "Done! Please report any bugs to <EMAIL>."
Get-Command -Module dbatools<commit_msg>trying to avoid function not found errors<commit_after>$url = 'https://github.com/ctrlbold/dbatools/archive/master.zip'
$path = Join-Path -Path (Split-Path -Path $profile) -ChildPath '\Modules\dbatools'
$zipfile = "$env:temp\sqltools.zip"


if (!(Test-Path -Path $path)){
	Write-Output "Creating directory: $path"
	New-Item -Path $path -ItemType Directory | Out-Null 
} else { 
	Write-Output "Deleting previously installed module"
	Remove-Item -Path "$path\*" -Force -Recurse 
}

Write-Output "Downloading archive from github"
Invoke-WebRequest $url -OutFile $zipfile

Write-Output "Unzipping"
# Keep it backwards compatible
$shell = New-Object -COM Shell.Application
$zipPackage = $shell.NameSpace($zipfile)
$destinationFolder = $shell.NameSpace($env:temp)
$destinationFolder.CopyHere($zipPackage.Items())

Write-Output "Cleaning up"
Move-Item -Path "$env:temp\dbatools-master\*" $path
Remove-Item -Path "$env:temp\dbatools-master"
Remove-Item -Path $zipfile

#Remove-Module dbatools -ErrorAction SilentlyContinue
#Import-Module "$path\dbatools.psd1"

Write-Output "Done! Please report any bugs to <EMAIL>."
Get-Command -Module dbatools
{'fraction_non_alphanumeric': 0.13734290843806105, 'fraction_numerical': 0.0008976660682226212, 'mean_word_length': 5.174515235457064, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1587105', 'n_tokens_mistral': 734, 'n_tokens_neox': 719, 'n_words': 187}