forked from jdhitsolutions/PSScriptTools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGet-PSScriptTools.ps1
More file actions
36 lines (29 loc) · 1.23 KB
/
Copy pathGet-PSScriptTools.ps1
File metadata and controls
36 lines (29 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#display a summary of tools in this module
#I am deviating slightly from the singular noun naming convention because I am thinking of
#PSScriptTools as a singular thing, like a toolbox.
Function Get-PSScriptTools {
[cmdletbinding()]
[OutputType("PSScriptTool")]
Param()
Write-Verbose "Starting $($myinvocation.mycommand)"
#getting commands directly from the module because for some unknown reason,
#probably scope related, when using Get-Command alone to list commands in the module,
#it includes private functions
$mod = Get-Module -name PSScriptTools
$funs =$mod.ExportedFunctions.keys | Get-Command
Write-Verbose "Found $($funs.count) functions"
foreach ($fun in $funs) {
Write-Verbose "Processing $($fun.name)"
#get aliases, ignoring errors for those commands without one
$alias = (Get-Alias -definition $fun.Name -erroraction silentlycontinue).name
[pscustomobject]@{
PSTypeName = "PSScriptTool"
Name = $fun.name
Alias = $alias
Verb = $fun.verb
Synopsis = (Get-Help $fun.name).synopsis
Version = $fun.version
}
}
Write-Verbose "Ending $($myinvocation.mycommand)"
}