aaa_Dynamic.psm1
<#
.NOTES -------------------------------------------------------------------------------- Code generated by: SAPIEN Technologies, Inc., PowerShell Studio 2019 v5.6.157 Generated on: 2/7/2019 3:01 PM Generated by: olgab Organization: Sapien -------------------------------------------------------------------------------- .DESCRIPTION Script generated by PowerShell Studio 2019 #> <# =========================================================================== Created with: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.145 Created on: 12/8/2017 11:29 AM Created by: olgab Organization: Filename: aaa_Dynamic.psm1 ------------------------------------------------------------------------- Module Name: aaa_Dynamic =========================================================================== #> function Get-ConfigurationFile { [OutputType([System.IO.FileInfo])] [CmdletBinding()] param () DynamicParam { $ParamAttrib = New-Object System.Management.Automation.ParameterAttribute $ParamAttrib.Mandatory = $true $ParamAttrib.ParameterSetName = '__AllParameterSets' $AttribColl = New-Object System.Collections.ObjectModel.Collection[System.Attribute] $AttribColl.Add($ParamAttrib) $configurationFileNames = Get-ChildItem -Path 'C:\Test' | Select-Object -ExpandProperty Name $AttribColl.Add((New-Object System.Management.Automation.ValidateSetAttribute($configurationFileNames))) $RuntimeParam = New-Object System.Management.Automation.RuntimeDefinedParameter('FileName', [string], $AttribColl) $RuntimeParamDic = New-Object System.Management.Automation.RuntimeDefinedParameterDictionary $RuntimeParamDic.Add('FileName', $RuntimeParam) return $RuntimeParamDic } process { $configFileFolder = 'C:\Test' Get-ChildItem -Path $configFileFolder -Filter "$($PSBoundParameters.FileName).txt" } } function Get-Itemzz { [CmdletBinding()] param ( [Parameter(Mandatory = $true)] [string]$path ) #TODO: Place script here } function Write-HelloWorld { Write-Host "Hello World" } Export-ModuleMember -Function Write-HelloWorld, Get-ConfigurationFile, Get-Itemzz |