You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- [CmdletBinding(SupportsShouldProcess)]param()
-
- $local:allAliases = @()
-
- $MyAliasScope = 0
- $local:_scope = 0
- $local:_done = $false
- do {
- try {
- $local:newAliases += Get-Alias -Scope $_scope |
- Where-Object {
- ($_.Definition -match "^$MyPSScrtipRoot") -or ($_.Description -match '#MyAlias')
- }
- if( $newAliases ) {
- $allAliases += $newAliases
- $MyAliasScope = $_scope;
- Write-Verbose "`$MyAliasScope is now set to $MyAliasScope"
- }
- $_scope += 1
- } catch {
- $done = $_.Exception.Message -match 'The scope .* exceeds'
- }
- } until ( $done )
-
- $allAliases
|