Last active
January 20, 2023 08:51
-
-
Save MSAdministrator/d8293d4fc4b35e94bcdde5e89d23ab6c to your computer and use it in GitHub Desktop.
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 characters
$methods = @('Get-AttckTool', 'Get-AttckTechnique', 'Get-AttckTactic', 'Get-AttckMitigation', 'Get-AttckMalware', 'Get-AttckActor') | |
foreach ($method in $methods){ | |
$properties = @('Name', 'Id') | |
foreach ($prop in $properties){ | |
${"($method)NameScriptBlock"} = { | |
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameters) | |
(& $method)."$prop".ForEach({ | |
"'" + $_ + "'" | |
}) | |
}.GetNewClosure() | |
Register-ArgumentCompleter -CommandName $method -ParameterName $prop -ScriptBlock ${"($method)NameScriptBlock"} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment