Last active
May 3, 2017 03:02
-
-
Save irwins/0fcb1cb6cd666e87bf7a to your computer and use it in GitHub Desktop.
Revisions
-
irwins revised this gist
Nov 16, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -41,7 +41,7 @@ $sbADSearchBase= { } $tabExpansion = @{ CommandName = $ADCmdlestWithSearchBase ParameterName = 'SearchBase' ScriptBlock = $sbADSearchBase } -
irwins revised this gist
Nov 16, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,7 @@ Version: Version History: Purpose: Custom Intellisense completion for AD cmdlets with SearchBase parameter ActiveDirectory & TabExpansion++ module is required. Link to Trevor Sullivan's video demonstration: https://goo.gl/0TdWuv -
irwins created this gist
Nov 16, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,50 @@ <# Author: I.C.A. Strachan Version: Version History: Purpose: Custom Intellisense completion for AD cmdlets with SearchBase parameter ActiveDirectory module is required. Link to Trevor Sullivan's video demonstration: https://goo.gl/0TdWuv #> #region Get AD cmdlets with SearchBase parameter $ADCmdlestWithSearchBase = Get-Command -Module ActiveDirectory | ForEach-Object{ $psItem.Name | Where-Object { (Get-Command $psItem).ParameterSets.Parameters.Name -eq 'SearchBase' } } #endregion #region Configure custom intellisense for AD cmdlets with SearchBase $sbADSearchBase= { param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) $ADPaths = ActiveDirectory\Get-ADOrganizationalUnit -filter * foreach ($ADPath in $ADPaths){ $completionResult =@{ CompletionText = $ADPath.DistinguishedName ToolTip = ('The organization unit DistinguishedName {0}' -f $ADPath.DistinguishedName) ListItemText = $ADPath.Name CompletionResultType = 'ParameterValue' } New-CompletionResult @completionResult } } $tabExpansion = @{ CommandName = $ADCmdlestWithSearchBase ParameterName = 'SearchBase' ScriptBlock = $sbADSearchBase } TabExpansion++\Register-ArgumentCompleter @tabExpansion #endregion