﻿#  
# Module manifest for module '%MODULE-NAME%'  
#  
# Generated by: Microsoft Corporation  
#  
# Generated on: %DATE%
#  

$PSDefaultParameterValues.Clear()
Set-StrictMode -Version Latest

%IMPORTED-DEPENDENCIES%

if ($PSVersionTable.PSVersion.Major -ge 5)
{
    $completerCommands = %COMPLETERCOMMANDS%
    
    $completerCommands | ForEach-Object {
        $completerObject = New-Object $_.AttributeType -ArgumentList $_.ArgumentList
        Register-ArgumentCompleter -CommandName $_.Command -ParameterName $_.Parameter -ScriptBlock {
            param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)
            
            $locations = $completerObject.GetCompleterValues()
            $locations | Where-Object { $_ -Like "$wordToComplete*" } | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) }
        }
    }
}

$FilteredCommands = %DEFAULTRGCOMMANDS%

$FilteredCommands | ForEach-Object {
	$global:PSDefaultParameterValues.Add($_,
		{
			$context = Get-AzureRmContext
			if (($context -ne $null) -and $context.ExtendedProperties.ContainsKey("Default Resource Group")) {
				$context.ExtendedProperties["Default Resource Group"]
			} 
		})
}

﻿#  
# Module manifest for module '%MODULE-NAME%'  
#  
# Generated by: Microsoft Corporation  
#  
# Generated on: %DATE%
#  

$PSDefaultParameterValues.Clear()
Set-StrictMode -Version Latest

%IMPORTED-DEPENDENCIES%

if ($PSVersionTable.PSVersion.Major -ge 5)
{
    $completerCommands = %COMPLETERCOMMANDS%
    
    $completerCommands | ForEach-Object {
        $type = $_.AttributeType
        $args = "@()"
        if ($_.ArgumentList.Count -ne 0) {
		    $temp = $_.ArgumentList -join "`", `"" 
            $args = "@(`"" + $temp + "`")" 
        }
        $sb = [scriptblock]::Create("param(`$commandName, `$parameterName, `$wordToComplete, `$commandAst, `$fakeBoundParameter) `
        `$completerObject = New-Object $type -ArgumentList $args `
        `$arguments = `$completerObject.GetCompleterValues() `
        `$arguments | Where-Object { `$_ -Like `"`$wordToComplete*`" } | ForEach-Object { [System.Management.Automation.CompletionResult]::new(`$_, `$_, 'ParameterValue', `$_) }")
        Register-ArgumentCompleter -CommandName $_.Command -ParameterName $_.Parameter -ScriptBlock $sb
    }
}

$FilteredCommands = %DEFAULTRGCOMMANDS%

$FilteredCommands | ForEach-Object {
	$global:PSDefaultParameterValues.Add($_,
		{
			$context = Get-AzureRmContext
			if (($context -ne $null) -and $context.ExtendedProperties.ContainsKey("Default Resource Group")) {
				$context.ExtendedProperties["Default Resource Group"]
			} 
		})
}

Fix error with variable in scriptblock
Fix error with variable in scriptblock
