<commit_before>﻿# ----------------------------------------------------------------------------------
#
# Copyright Microsoft Corporation
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ----------------------------------------------------------------------------------
[CmdletBinding()]
Param(
[Parameter(Mandatory=$False, HelpMessage="Use Install parameter to install Azure modules from PowerShell Gallery.")]
[switch]$Install
)

$error.clear()
try {
	if ($Install.IsPresent) {
		Write-Output @"

Finalizing installation of Azure PowerShell. 
Installing Azure Modules from PowerShell Gallery. 
This may take some time...
"@
		$env:PSModulePath = "$env:USERPROFILE\Documents\WindowsPowerShell\Modules;$env:ProgramFiles\WindowsPowerShell\Modules;$env:SystemRoot\system32\WindowsPowerShell\v1.0\Modules\"

		Import-Module PackageManagement
		
		$result = Get-PackageProvider -Name NuGet -ForceBootstrap

		Import-Module PowerShellGet

		Install-Module AzureRM
		Write-Output "AzureRM $((Get-InstalledModule -Name AzureRM)[0].Version) installed..."
		Update-AzureRM
	} else {
		cd c:\
		$welcomeMessage = @"
For a list of all Azure cmdlets type 'help azure'.
For a list of Azure Pack cmdlets type 'Get-Command *wapack*'.

To use Azure Service Management cmdlets please execute the following cmdlet:
  Install-Module Azure
"@
		Write-Output $welcomeMessage

		$VerbosePreference = "Continue"
	}
}
catch 
{ 
Write-Output "An error occured during installation."
Write-Output $error 
Write-Output "Press any key..."
$host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
}<commit_msg>Fixed broken environment caused by v 0.9.8 uninstall<commit_after>﻿# ----------------------------------------------------------------------------------
#
# Copyright Microsoft Corporation
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ----------------------------------------------------------------------------------
[CmdletBinding()]
Param(
[Parameter(Mandatory=$False, HelpMessage="Use Install parameter to install Azure modules from PowerShell Gallery.")]
[switch]$Install
)

function EnsureRegistryPath
{
	$originalpaths = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PSModulePath).PSModulePath
	if($originalpaths.Contains("$env:ProgramFiles\WindowsPowerShell\Modules") -eq $false)
	{
		Write-Output "Fixing PSModulePath"
		$newPath = "$originalpaths;$env:ProgramFiles\WindowsPowerShell\Modules"
		Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PSModulePath –Value $newPath
	}
	else
	{
		Write-Output "PSModulePath successfuly validated"
	}
}

$error.clear()
try {
	if ($Install.IsPresent) {
		EnsureRegistryPath
		Write-Output @"

Finalizing installation of Azure PowerShell. 
Installing Azure Modules from PowerShell Gallery. 
This may take some time...
"@
		$env:PSModulePath = "$env:USERPROFILE\Documents\WindowsPowerShell\Modules;$env:ProgramFiles\WindowsPowerShell\Modules;$env:SystemRoot\system32\WindowsPowerShell\v1.0\Modules\"

		Import-Module PackageManagement
		
		$result = Get-PackageProvider -Name NuGet -ForceBootstrap

		Import-Module PowerShellGet

		Install-Module AzureRM
		Write-Output "AzureRM $((Get-InstalledModule -Name AzureRM)[0].Version) installed..."
		Update-AzureRM
	} else {
		cd c:\
		$welcomeMessage = @"
For a list of all Azure cmdlets type 'help azure'.
For a list of Azure Pack cmdlets type 'Get-Command *wapack*'.

To use Azure Service Management cmdlets please execute the following cmdlet:
  Install-Module Azure
"@
		Write-Output $welcomeMessage

		$VerbosePreference = "Continue"
	}
}
catch 
{ 
Write-Output "An error occured during installation."
Write-Output $error 
Write-Output "Press any key..."
$host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
}

{'fraction_non_alphanumeric': 0.15857470306313814, 'fraction_numerical': 0.004375911648260054, 'mean_word_length': 3.456824512534819, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3391693', 'n_tokens_mistral': 1332, 'n_tokens_neox': 1285, 'n_words': 422}