1+ [CmdletBinding ()]
2+ param (
3+ [Parameter (Mandatory = $false ,
4+ HelpMessage = " The current path as the value of the path parameter if not passed Path parameter."
5+ )]
6+ [string ]
7+ $Path ,
8+
9+ [Parameter (Mandatory = $false ,
10+ HelpMessage = " The Path parameter and the OutPath parameter are the same if not passed OutPath parameter."
11+ )]
12+ [string ]
13+ $OutPath
14+ )
15+ try {
16+ if (! $PSBoundParameters.ContainsKey (" Path" )) {
17+ $Path = $PSScriptRoot
18+ }
19+
20+ if (! $PSBoundParameters.ContainsKey (" OutPath" )) {
21+ $OutPath = $PSScriptRoot
22+ }
23+
24+ # $DataOfAzModules = (Get-ChildItem -Name -Path $Path)
25+ $DataOfAzModules = Get-Content - Path " D:\_Code\Script\Az.Module.txt"
26+
27+ function Get-AzModuleDataFunction {
28+ param (
29+ $AzModuleData
30+ )
31+ $OutPutTitle = @ (" Module Name,Module Version,Release Date,Cmdlet Name,Cmdlet Type,Az Version" )
32+ $parameters = @ {
33+ TypeName = ' System.Collections.Generic.HashSet[string]'
34+ ArgumentList = ([string []]$OutPutTitle , [System.StringComparer ]::OrdinalIgnoreCase)
35+ }
36+ $AzModuleOutPut = New-Object @parameters
37+
38+ foreach ($AzModule in $AzModuleData ){
39+ # $AzModuleOutPut = New-Object PSObject
40+ # Add-Member -InputObject $AzModuleOutPut -MemberType NoteProperty -Name Module -Value $NULL
41+ # Add-Member -InputObject $AzModuleOutPut -MemberType NoteProperty -Name ModuleVersion -Value $NULL
42+ # Add-Member -InputObject $AzModuleOutPut -MemberType NoteProperty -Name ReleaseDate -Value $NULL
43+ # Add-Member -InputObject $AzModuleOutPut -MemberType NoteProperty -Name AzVersion -Value $NULL
44+ # Add-Member -InputObject $AzModuleOutPut -MemberType NoteProperty -Name CmdletName -Value $NULL
45+ # Add-Member -InputObject $AzModuleOutPut -MemberType NoteProperty -Name CmdletType -Value $NULL
46+
47+ $ModuleName = $AzModule
48+ $ModuleVersion = " "
49+ $ReleaseDate = " "
50+ $CmdletName = " "
51+ $CmdletType = " "
52+ $AzVersion = " "
53+
54+ $ModuleList = find-module $ModuleName - Repository PSgallery - AllVersions
55+ $CmdLetData = Get-Command - Module $ModuleName
56+
57+ foreach ($item in $CmdLetData ){
58+ $ModuleVersion = $ModuleList [0 ].Version
59+ $ReleaseDate = $ModuleList [0 ].PublishedDate
60+ $CmdletName = $item.Name
61+ $CmdletType = $item.CommandType
62+ $AzVersion = $item.Version
63+
64+ $null = $AzModuleOutPut.Add (" $ModuleName ,$ModuleVersion ,$ReleaseDate ,$CmdletName ,$CmdletType ,$AzVersion " )
65+ }
66+ }
67+
68+ $designFile = ' AzModuleDesign.txt'
69+ $outFilePath = Join-Path $OutPath $designFile
70+ $AzModuleOutPut | Out-File - FilePath $outFilePath - Append - ErrorAction Stop
71+
72+ Write-Host - ForegroundColor Green " Genereated $designFile completed in $OutPath . path."
73+ return
74+ }
75+
76+ Get-AzModuleDataFunction - AzModuleData $DataOfAzModules
77+
78+ }
79+ catch {
80+ throw
81+ return
82+ }
0 commit comments