localscript/Invoke-GenerateCmdlet.ps1
function Invoke-GenerateCmdlet { param( $Path ) $SetFunction = @" function Set-{FUNCTION} { <# .SYNOPSIS Enables or disables the {DISPLAYNAME} .DESCRIPTION The Set-{FUNCTION} cmdlet is used to switch enable or disable the {DISPLAYNAME} .NOTES Written by Jaap Brasser for community usage Twitter: @jaap_brasser GitHub: jaapbrasser .LINK TBD .EXAMPLE Set-{FUNCTION} -Enable Enables the {DISPLAYNAME} .EXAMPLE Set-{FUNCTION} -Disable -Verbose Disables the {DISPLAYNAME} while displaying verbose information #> [CmdletBinding(SupportsShouldProcess = `$true)] Param( [Parameter(Mandatory = `$true, ParameterSetName='Enable', HelpMessage = 'Enable {DISPLAYNAME}')] [switch] `$Enable, [Parameter(Mandatory = `$true, ParameterSetName='Disable', HelpMessage = 'Disable {DISPLAYNAME}')] [switch] `$Disable ) Invoke-ConfigurationData -Parameter `$PSBoundParameters } "@ $GetFunction = @" function Get-{FUNCTION} { <# .SYNOPSIS Enables or disables the {DISPLAYNAME} .DESCRIPTION The Get-{FUNCTION} cmdlet is used to switch enable or disable the {DISPLAYNAME} .NOTES Written by Jaap Brasser for community usage Twitter: @jaap_brasser GitHub: jaapbrasser .LINK TBD .EXAMPLE Get-{FUNCTION} Verifies whether {DISPLAYNAME} is enabled or disabled .EXAMPLE Get-{FUNCTION} -Verbose Verifies whether {DISPLAYNAME} is enabled or disabled, while displaying verbose information #> [CmdletBinding(SupportsShouldProcess = `$true)] Param( ) Invoke-ConfigurationData -Parameter `$PSBoundParameters } "@ $Json = Get-Content -Path $Path -Raw | ConvertFrom-Json $Function = (Get-Item $Path).BaseName $DisplayName = $Function -creplace '(?<!^)([A-Z])',' $1' $SetFunction -replace '{FUNCTION}',$Function -replace '{DISPLAYNAME}',$DisplayName | Out-File -Encoding unicode -FilePath "C:\temp\CustomizeWindows11\public\Set-$Function.ps1" -NoNewline $GetFunction -replace '{FUNCTION}',$Function -replace '{DISPLAYNAME}',$DisplayName | Out-File -Encoding unicode -FilePath "C:\temp\CustomizeWindows11\public\Get-$Function.ps1" -NoNewline } Get-ChildItem './private/data' | % {Invoke-GenerateCmdlet -Path $_.FullName} |