次の方法で共有


New-PSScriptFileInfo

The cmdlet creates a new script file, including metadata about the script.

構文

Default (既定)

New-PSScriptFileInfo
    [-Path] <String>
    [-Version <String>]
    [-Author <String>]
    -Description <String>
    [-Guid <Guid>]
    [-CompanyName <String>]
    [-Copyright <String>]
    [-RequiredModules <Hashtable[]>]
    [-ExternalModuleDependencies <String[]>]
    [-RequiredScripts <String[]>]
    [-ExternalScriptDependencies <String[]>]
    [-Tags <String[]>]
    [-ProjectUri <String>]
    [-LicenseUri <String>]
    [-IconUri <String>]
    [-ReleaseNotes <String>]
    [-PrivateData <String>]
    [-Force]
    [<CommonParameters>]

説明

The cmdlet creates a new script file containing the required metadata needed to publish a script package.

Example 1: Creating an empty script with minimal information

This example runs the cmdlet using only required parameters. The Path parameter specifies the nane and location of the script. The Description parameter provide the description used in the comment-based help for the script.

New-PSScriptFileInfo -Path ./test_script.ps1 -Description 'This is a test script.'
Get-Content ./test_script.ps1
<#PSScriptInfo

.VERSION 1.0.0.0

.GUID 6ec3934e-a2e0-495b-9a9c-480e555ad1d1

.AUTHOR johndoe

.COMPANYNAME

.COPYRIGHT

.TAGS

.LICENSEURI

.PROJECTURI

.ICONURI

.EXTERNALMODULEDEPENDENCIES

.REQUIREDSCRIPTS

.EXTERNALSCRIPTDEPENDENCIES

.RELEASENOTES

.PRIVATEDATA

#>

<#

.DESCRIPTION
This is a test script.

#>

Example 2: Creating a script with required modules

This example runs the cmdlet with additional parameters, including RequiredModules. RequiredModules is an array of module specifications.

$parameters = @{
    Path = './test_script2.ps1'
    Description = 'This is a test script.'
    Version = '2.0.0.0'
    Author = 'janedoe'
    RequiredModules =  @(
        @{ModuleName = 'PackageManagement'; ModuleVersion = '1.0.0.0' },
        @{ModuleName = 'PSReadLine'}
    )
}
New-PSScriptFileInfo @parameters
Get-Content ./test_script2.ps1
<#PSScriptInfo

.VERSION 2.0.0.0

.GUID 7ec4832e-a4e1-562b-8a8c-241e535ad7d7

.AUTHOR janedoe

.COMPANYNAME

.COPYRIGHT

.TAGS

.LICENSEURI

.PROJECTURI

.ICONURI

.EXTERNALMODULEDEPENDENCIES

.REQUIREDSCRIPTS

.EXTERNALSCRIPTDEPENDENCIES

.RELEASENOTES

.PRIVATEDATA

#>

#Requires -Module PSReadLine
#Requires -Module @{ ModuleName = 'PackageManagement'; ModuleVersion = '1.0.0.0' }

<#

.DESCRIPTION
This is a test script.

#>

パラメーター

-Author

The name of the author of the script.

パラメーターのプロパティ

型:String
規定値:None
ワイルドカードのサポート:False
DontShow:False

パラメーター セット

(All)
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値:False

-CompanyName

The name of the company owning the script.

パラメーターのプロパティ

型:String
規定値:None
ワイルドカードのサポート:False
DontShow:False

パラメーター セット

(All)
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値:False

The copyright information for the script.

型:String
規定値:None
ワイルドカードのサポート:False
DontShow:False
(All)
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値:False

-Description

The description of the script.

パラメーターのプロパティ

型:String
規定値:None
ワイルドカードのサポート:False
DontShow:False

パラメーター セット

(All)
配置:Named
必須:True
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値:False

-ExternalModuleDependencies

The list of external module dependencies taken by this script.

パラメーターのプロパティ

型:

String[]

規定値:None
ワイルドカードのサポート:False
DontShow:False

パラメーター セット

(All)
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値:False

-ExternalScriptDependencies

The list of external script dependencies taken by this script.

パラメーターのプロパティ

型:

String[]

規定値:None
ワイルドカードのサポート:False
DontShow:False

パラメーター セット

(All)
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値:False

-Force

Forces the cmdlet to overwrite any existing file.

パラメーターのプロパティ

型:SwitchParameter
規定値:False
ワイルドカードのサポート:False
DontShow:False

パラメーター セット

(All)
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値:False

-Guid

The unique identifier for the script in GUID format. If you don't provide a GUID, the cmdlet creates a new one automatically.

パラメーターのプロパティ

型:Guid
規定値:Randomly generated
ワイルドカードのサポート:False
DontShow:False

パラメーター セット

(All)
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値:False

-IconUri

A Uniform Resource Identifier (URI) pointing to the icon associated with the script.

パラメーターのプロパティ

型:String
規定値:None
ワイルドカードのサポート:False
DontShow:False

パラメーター セット

(All)
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値:False

-LicenseUri

The URI pointing to the license agreement file associated with the script.

パラメーターのプロパティ

型:String
規定値:None
ワイルドカードのサポート:False
DontShow:False

パラメーター セット

(All)
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値:False

-Path

The filename and location where the script is created.

パラメーターのプロパティ

型:String
規定値:None
ワイルドカードのサポート:False
DontShow:False

パラメーター セット

(All)
配置:0
必須:True
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値:False

-PrivateData

The private data associated with the script.

パラメーターのプロパティ

型:String
規定値:None
ワイルドカードのサポート:False
DontShow:False

パラメーター セット

(All)
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値:False

-ProjectUri

The URI pointing to the project site associated with the script.

パラメーターのプロパティ

型:String
規定値:None
ワイルドカードのサポート:False
DontShow:False

パラメーター セット

(All)
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値:False

-ReleaseNotes

The release notes for the script.

パラメーターのプロパティ

型:String
規定値:None
ワイルドカードのサポート:False
DontShow:False

パラメーター セット

(All)
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値:False

-RequiredModules

The parameter takes an array of module specification hashtables. A module specification is a hashtable that has the following keys.

  • ModuleName - Required Specifies the module name.
  • GUID - Optional Specifies the GUID of the module.
  • It's also Required to specify at least one of the three below keys.
    • ModuleVersion - Specifies a minimum acceptable version of the module.
    • MaximumVersion - Specifies the maximum acceptable version of the module.
    • RequiredVersion - Specifies an exact, required version of the module. This can't be used with the other Version keys.

パラメーターのプロパティ

型:

Hashtable[]

規定値:None
ワイルドカードのサポート:False
DontShow:False

パラメーター セット

(All)
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値:False

-RequiredScripts

The list of scripts required by the script.

パラメーターのプロパティ

型:

String[]

規定値:None
ワイルドカードのサポート:False
DontShow:False

パラメーター セット

(All)
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値:False

-Tags

The tags associated with the script. Tag values are strings that shouldn't contain spaces. For more information, see Tag details.

パラメーターのプロパティ

型:

String[]

規定値:None
ワイルドカードのサポート:False
DontShow:False
Aliases:Tag

パラメーター セット

(All)
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値:False

-Version

The version of the script. If no value is provided Version defaults to 1.0.0.0.

パラメーターのプロパティ

型:String
規定値:None
ワイルドカードのサポート:False
DontShow:False

パラメーター セット

(All)
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

入力

None

出力

Object

メモ

The New-PSScriptFileInfo and Update-PSScriptFileInfo cmdlets place the #requires statements for required modules between the <#PSScriptInfo and comment-based help blocks of the help file. The Get-PSScriptFileInfo expects #requires statements to be placed somewhere before the comment-based help block. Any #requires statements placed after the comment-based help block are ignored by Get-PSScriptFileInfo and Publish-PSResource.