File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed
Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change 1+ function Get-Servers101
2+ {
3+ <#
4+ . SYNOPSIS
5+ Servers101
6+ . DESCRIPTION
7+ Gets the list of example servers included in Servers101.
8+
9+ Each server is a self-contained PowerShell script.
10+ . EXAMPLE
11+ Get-Servers101
12+ . EXAMPLE
13+ Servers101
14+ #>
15+ [Alias (' Servers101' )]
16+ param (
17+ # The name of the server. If no name is provided, all servers will be returned.
18+ [SupportsWildcards ()]
19+ [string ]
20+ $Name
21+ )
22+
23+ begin {
24+ $myModuleRoot = $PSScriptRoot | Split-Path
25+ Update-TypeData - TypeName Servers101 - DefaultDisplayPropertySet Name,
26+ Synopsis, Description - Force
27+ }
28+ process {
29+ Get-ChildItem - File - Path $myModuleRoot - Recurse |
30+ Where-Object {
31+ $_.Name -match ' server?[^\.]{0,}\.ps1$' -and
32+ $_.Name -notmatch ' -Server' -and (
33+ (-not $Name ) -or ($_.Name -like $name )
34+ )
35+ } |
36+ ForEach-Object {
37+ $file = $_
38+ $help = Get-Help - Name $file.FullName - ErrorAction Ignore
39+ $file.pstypenames.clear ()
40+ $file.pstypenames.insert (0 , ' Servers101' )
41+ $file |
42+ Add-Member NoteProperty Synopsis $help.Synopsis - Force - PassThru |
43+ Add-Member NoteProperty Description (
44+ $help.Description.text -join [Environment ]::NewLine
45+ ) - Force - PassThru
46+ }
47+ }
48+ }
You can’t perform that action at this time.
0 commit comments