Repository navigation
Description
Issue
I have a script which I would like to be able to directly install using the Install-Script from a (PowerShell Gallery) repository. The way it was setup is to download the script and dot-source the script.
As recommended by Michael Klement (@mklement0), I should actually create *.ps1 file instead of embedded script.
My current script looks like:
<#PSScriptInfo
.VERSION 3.3.6
.GUID 5f167621-6abe-4153-a26c-f643e1716720
.AUTHOR Ronald Bode (iRon)
.DESCRIPTION Stringifys an object to a PowerShell expression (PSON, PowerShell Object Notation).
.COMPANYNAME
.COPYRIGHT
.TAGS PSON PowerShell Object Notation Expression Serialize Stringify
.LICENSE https://github.com/iRon7/ConvertTo-Expression/LICENSE.txt
.PROJECTURI https://github.com/iRon7/ConvertTo-Expression
.ICON https://raw.githubusercontent.com/iRon7/ConvertTo-Expression/master/ConvertTo-Expression.png
.EXTERNALMODULEDEPENDENCIES
.REQUIREDSCRIPTS
.EXTERNALSCRIPTDEPENDENCIES
.RELEASENOTES
.PRIVATEDATA
#>
function ConvertTo-Expression {
[CmdletBinding()][OutputType([scriptblock])] param()
begin {}
process {}
}; Set-Alias ctex ConvertTo-ExpressionIf I change the current script to just a *.ps1 script (preserving the metadata and only the inner script body), I will lose the alias (Set-Alias ctex ConvertTo-Expression).
Also noted by Michael Klement (@mklement0): another problem with using *.ps1 files directly as commands is that on case-sensitive file-systems - notably on Linux by default - you'll only be able to invoke the script if you match the file name's case exactly - which is both inconvenient and unexpected.
And I noticed that I do not see information like Version in the Get-Command ConvertTo-Expression (although it is shown in the Get-InstalledScript ConvertTo-Expression)
Summary of the new feature/enhancement
- Automatically build a manifest from the script's metadata required for publishing
- Add
aliasesinformation tonew-scriptfileinfo/new-scriptfileinfocmdlets - Possibly let the
Install-Scriptcmdlet automatically transform a script into a simplified module using its metadata of the script
I see no reason why the the manual steps provided in How to Write a PowerShell Script Module couldn't be automated (all mandatory steps are straight forward and optional configuration data is already available in the metadata)
Activity
iSazonov commentedon Oct 27, 2020
We discussed previously adding version info in scripts and this was rejected in favor of modules. I think any suggestions for adding meta information to script files will be rejected in favor of modules.
I believe we have a better chance of moving forward if we consider a single file modules.
iRon7 commentedon Nov 16, 2023
Please either mark this issue with something like Resolution-Declined or put it on a kind of wishlist "Issue we would like to prioritize, but we can't commit we will get to it yet
iRon7 commentedon May 15, 2024
Please either mark this issue with something like Resolution-Declined or put it on a kind of wishlist "Issue we would like to prioritize, but we can't commit we will get to it yet
iRon7 commentedon Nov 11, 2024
Please either mark this issue with something like Resolution-Declined or put it on a kind of wishlist "Issue we would like to prioritize, but we can't commit we will get to it yet
For the Alias part, it would probably make more sense to use the
[Alias]type rather than theSet-AliascmdletAs an aside: standalone scripts can also not be referenced in a
Usingstatement. see: How to set script prerequisitesiRon7 commentedon May 11, 2025
Please either mark this issue with something like Resolution-Declined or put it on a kind of wishlist "Issue we would like to prioritize, but we can't commit we will get to it yet
For the Alias part, it would probably make more sense to use the
[Alias]type rather than theSet-AliascmdletAs an aside: standalone scripts can also not be referenced in a
Usingstatement. see: How to set script prerequisitesiRon7 commentedon May 16, 2026
Please triage/tag the issue accordingly to either close or Keep-Open to prevent the microsoft-github-policy-service.
microsoft-github-policy-service commentedon Nov 12, 2026
This issue has not had any activity in 6 months, if there is no further activity in 7 days, the issue will be closed automatically.
Activity in this case refers only to comments on the issue. If the issue is closed and you are the author, you can re-open the issue using the button below. Please add more information to be considered during retriage. If you are not the author but the issue is impacting you after it has been closed, please submit a new issue with updated details and a link to this issue and the original.
iRon7 commentedon Nov 13, 2026
Please triage/tag the issue accordingly to either close or Keep-Open to prevent the microsoft-github-policy-service.