< Back
New-ScriptFileInfo
Post
NAME New-ScriptFileInfo
SYNOPSIS
Creates a script file with metadata.
SYNTAX
New-ScriptFileInfo [[-Path] <String>] [-Author <String>] [-CompanyName <String>] [-Confirm] [-Copyright <String>] -Description <String>
[-ExternalModuleDependencies <String[]>] [-ExternalScriptDependencies <String[]>] [-Force] [-Guid <Guid>] [-IconUri <Uri>] [-LicenseUri <Uri>]
[-PassThru] [-ProjectUri <Uri>] [-ReleaseNotes <String[]>] [-RequiredModules <Object[]>] [-RequiredScripts <String[]>] [-Tags <String[]>] [-Version
<Version>] [-WhatIf] [<CommonParameters>]
DESCRIPTION
The New-ScriptFileInfo cmdlet creates a PowerShell script file, including metadata about the script.
PARAMETERS
-Author <String>
Specifies the script author.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-CompanyName <String>
Specifies the company or vendor who created the script.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Confirm [<SwitchParameter>]
Prompts you for confirmation before running the cmdlet.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-Copyright <String>
Specifies a copyright statement for the script.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Description <String>
Specifies a description for the script.
Required? true
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-ExternalModuleDependencies <String[]>
Specifies an array of external module dependencies.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-ExternalScriptDependencies <String[]>
Specifies an array of external script dependencies.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Force [<SwitchParameter>]
Forces the command to run without asking for user confirmation.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-Guid <Guid>
Specifies a unique ID for the script.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-IconUri <Uri>
Specifies the URL of an icon for the script. The specified icon is displayed on the gallery web page for the script.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-LicenseUri <Uri>
Specifies the URL of licensing terms.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-PassThru [<SwitchParameter>]
Returns an object representing the item with which you are working. By default, this cmdlet does not generate any output.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-Path <String>
Specifies the path to the module manifest file to update. Wildcards are permitted. The default location is the current directory (.)
Required? false
Position? 0
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-ProjectUri <Uri>
Specifies the URL of a web page about this project.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-ReleaseNotes <String[]>
Specifies a string array that contains release notes or comments that you want to be available to users of this version of the script.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-RequiredModules <Object[]>
Specifies modules that must be in the global session state. If the required modules are not in the global session state, Windows PowerShell imports
them.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-RequiredScripts <String[]>
Specifies an array of required scripts.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Tags <String[]>
Specifies an array of tags.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Version <Version>
Specifies the version of the script.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-WhatIf [<SwitchParameter>]
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
NOTES
Example 1: Create a script file and specify its version, author, and description
PS C:\\>New-ScriptFileInfo -Path "\\temp\\Temp-Scriptfile.ps1" -Version 1.0 -Author "pattif@contoso.com" -Description "My test script file description goes
here"
PS C:\\> Get-Content -Path "\\temp\\Temp-Scriptfile.ps1"
<#PSScriptInfo
.VERSION 1.0
.GUID eb246b19-17da-4392-8c89-7c280f69ad0e
.AUTHOR pattif@microsoft.com
.COMPANYNAME
.COPYRIGHT
.TAGS
.LICENSEURI
.PROJECTURI
.ICONURI
.EXTERNALMODULEDEPENDENCIES
.REQUIREDSCRIPTS
.EXTERNALSCRIPTDEPENDENCIES
.RELEASENOTES
#>
<#
.DESCRIPTION
my test script file description goes here
#>
Param() PS C:\\>Test-ScriptFileInfo -Path "\\temp\\Temp-Scriptfile.ps1"
Version Name Author Description
------- ---- ------ -----------
1.0 temp-scriptfile pattif@contoso.com my test script file description goes here
The first command creates the script file Temp-Scriptfile.ps1 and sets the Version, Author, and Description properties for it.
The second command uses the Get-Content cmdlet to get the contents of the script file and display them.
Example 2: Create a script file with all of the metadata properties
PS C:\\>New-ScriptFileInfo -Path "C:\\temp\\temp_scripts\\New-ScriptFile.ps1" -Verbose
>> -Version 1.0 -Author pattif -Description "my new script file test" -CompanyName "Contoso Corporation" `
>> -Copyright "????????? 2015 Contoso Corporation. All rights reserved." -ExternalModuleDependencies 'ff','bb' `
>> -RequiredScripts 'Start-WFContosoServer', 'Stop-ContosoServerScript' `
>> -ExternalScriptDependencies Stop-ContosoServerScript -Tags @('Tag1', 'Tag2', 'Tag3') `
>> -ProjectUri https://contoso.com -LicenseUri "https://contoso.com/License" -IconUri 'https://contoso.com/Icon' `
>> -Verbose -PassThru `
>> -ReleaseNotes @('contoso script now supports following features',
>> 'Feature 1',
>> 'Feature 2',
>> 'Feature 3',
>> 'Feature 4',
>> 'Feature 5') `
>> -RequiredModules
"1","2",RequiredModule1,@{ModuleName='RequiredModule2';ModuleVersion='1.0'},@{ModuleName='RequiredModule3';RequiredVersion='2.0'},ExternalModule1 `
>>
VERBOSE: Performing the operation "Creating the 'C:\\temp\\temp_scripts\\New-ScriptFile.ps1' PowerShell Script file" on target
"C:\\temp\\temp_scripts\\New-ScriptFile.ps1".
<#PSScriptInfo
.VERSION 1.0
.GUID eb246b19-17da-4392-8c89-7c280f69ad0a
.AUTHOR pattif
.COMPANYNAME Microsoft Corporation
.COPYRIGHT ????????? 2015 Microsoft Corporation. All rights reserved.
.TAGS Tag1 Tag2 Tag3
.LICENSEURI https://contoso.com/License
.PROJECTURI https://contoso.com/
.ICONURI https://contoso.com/Icon
.EXTERNALMODULEDEPENDENCIES ff,bb
.REQUIREDSCRIPTS Start-WFContosoServer,Stop-ContosoServerScript
.EXTERNALSCRIPTDEPENDENCIES Stop-ContosoServerScript
.RELEASENOTES
contoso script now supports following features
Feature 1
Feature 2
Feature 3
Feature 4
Feature 5
#>
#Requires -Module Module1
#Requires -Module Module2
#Requires -Module RequiredModule1
#Requires -Module @{ModuleName = 'RequiredModule2'; ModuleVersion = '1.0'}
#Requires -Module @{RequiredVersion = '2.0'; ModuleName = 'RequiredModule3'}
#Requires -Module ExternalModule1
<#
.DESCRIPTION
my new script file test
#>
Param()
This command creates creates a script file New-ScriptFile.ps1 with all of its metadata properties. The Verbose parameter specifies that the command
display verbose output.
RELATED LINKS
Online Version: http://go.microsoft.com/fwlink/?LinkId=822329
Test-ScriptFileInfo
Update-ScriptFileInfo
SYNOPSIS
Creates a script file with metadata.
SYNTAX
New-ScriptFileInfo [[-Path] <String>] [-Author <String>] [-CompanyName <String>] [-Confirm] [-Copyright <String>] -Description <String>
[-ExternalModuleDependencies <String[]>] [-ExternalScriptDependencies <String[]>] [-Force] [-Guid <Guid>] [-IconUri <Uri>] [-LicenseUri <Uri>]
[-PassThru] [-ProjectUri <Uri>] [-ReleaseNotes <String[]>] [-RequiredModules <Object[]>] [-RequiredScripts <String[]>] [-Tags <String[]>] [-Version
<Version>] [-WhatIf] [<CommonParameters>]
DESCRIPTION
The New-ScriptFileInfo cmdlet creates a PowerShell script file, including metadata about the script.
PARAMETERS
-Author <String>
Specifies the script author.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-CompanyName <String>
Specifies the company or vendor who created the script.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Confirm [<SwitchParameter>]
Prompts you for confirmation before running the cmdlet.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-Copyright <String>
Specifies a copyright statement for the script.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Description <String>
Specifies a description for the script.
Required? true
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-ExternalModuleDependencies <String[]>
Specifies an array of external module dependencies.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-ExternalScriptDependencies <String[]>
Specifies an array of external script dependencies.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Force [<SwitchParameter>]
Forces the command to run without asking for user confirmation.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-Guid <Guid>
Specifies a unique ID for the script.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-IconUri <Uri>
Specifies the URL of an icon for the script. The specified icon is displayed on the gallery web page for the script.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-LicenseUri <Uri>
Specifies the URL of licensing terms.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-PassThru [<SwitchParameter>]
Returns an object representing the item with which you are working. By default, this cmdlet does not generate any output.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-Path <String>
Specifies the path to the module manifest file to update. Wildcards are permitted. The default location is the current directory (.)
Required? false
Position? 0
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-ProjectUri <Uri>
Specifies the URL of a web page about this project.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-ReleaseNotes <String[]>
Specifies a string array that contains release notes or comments that you want to be available to users of this version of the script.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-RequiredModules <Object[]>
Specifies modules that must be in the global session state. If the required modules are not in the global session state, Windows PowerShell imports
them.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-RequiredScripts <String[]>
Specifies an array of required scripts.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Tags <String[]>
Specifies an array of tags.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Version <Version>
Specifies the version of the script.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-WhatIf [<SwitchParameter>]
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
NOTES
Example 1: Create a script file and specify its version, author, and description
PS C:\\>New-ScriptFileInfo -Path "\\temp\\Temp-Scriptfile.ps1" -Version 1.0 -Author "pattif@contoso.com" -Description "My test script file description goes
here"
PS C:\\> Get-Content -Path "\\temp\\Temp-Scriptfile.ps1"
<#PSScriptInfo
.VERSION 1.0
.GUID eb246b19-17da-4392-8c89-7c280f69ad0e
.AUTHOR pattif@microsoft.com
.COMPANYNAME
.COPYRIGHT
.TAGS
.LICENSEURI
.PROJECTURI
.ICONURI
.EXTERNALMODULEDEPENDENCIES
.REQUIREDSCRIPTS
.EXTERNALSCRIPTDEPENDENCIES
.RELEASENOTES
#>
<#
.DESCRIPTION
my test script file description goes here
#>
Param() PS C:\\>Test-ScriptFileInfo -Path "\\temp\\Temp-Scriptfile.ps1"
Version Name Author Description
------- ---- ------ -----------
1.0 temp-scriptfile pattif@contoso.com my test script file description goes here
The first command creates the script file Temp-Scriptfile.ps1 and sets the Version, Author, and Description properties for it.
The second command uses the Get-Content cmdlet to get the contents of the script file and display them.
Example 2: Create a script file with all of the metadata properties
PS C:\\>New-ScriptFileInfo -Path "C:\\temp\\temp_scripts\\New-ScriptFile.ps1" -Verbose
>> -Version 1.0 -Author pattif -Description "my new script file test" -CompanyName "Contoso Corporation" `
>> -Copyright "????????? 2015 Contoso Corporation. All rights reserved." -ExternalModuleDependencies 'ff','bb' `
>> -RequiredScripts 'Start-WFContosoServer', 'Stop-ContosoServerScript' `
>> -ExternalScriptDependencies Stop-ContosoServerScript -Tags @('Tag1', 'Tag2', 'Tag3') `
>> -ProjectUri https://contoso.com -LicenseUri "https://contoso.com/License" -IconUri 'https://contoso.com/Icon' `
>> -Verbose -PassThru `
>> -ReleaseNotes @('contoso script now supports following features',
>> 'Feature 1',
>> 'Feature 2',
>> 'Feature 3',
>> 'Feature 4',
>> 'Feature 5') `
>> -RequiredModules
"1","2",RequiredModule1,@{ModuleName='RequiredModule2';ModuleVersion='1.0'},@{ModuleName='RequiredModule3';RequiredVersion='2.0'},ExternalModule1 `
>>
VERBOSE: Performing the operation "Creating the 'C:\\temp\\temp_scripts\\New-ScriptFile.ps1' PowerShell Script file" on target
"C:\\temp\\temp_scripts\\New-ScriptFile.ps1".
<#PSScriptInfo
.VERSION 1.0
.GUID eb246b19-17da-4392-8c89-7c280f69ad0a
.AUTHOR pattif
.COMPANYNAME Microsoft Corporation
.COPYRIGHT ????????? 2015 Microsoft Corporation. All rights reserved.
.TAGS Tag1 Tag2 Tag3
.LICENSEURI https://contoso.com/License
.PROJECTURI https://contoso.com/
.ICONURI https://contoso.com/Icon
.EXTERNALMODULEDEPENDENCIES ff,bb
.REQUIREDSCRIPTS Start-WFContosoServer,Stop-ContosoServerScript
.EXTERNALSCRIPTDEPENDENCIES Stop-ContosoServerScript
.RELEASENOTES
contoso script now supports following features
Feature 1
Feature 2
Feature 3
Feature 4
Feature 5
#>
#Requires -Module Module1
#Requires -Module Module2
#Requires -Module RequiredModule1
#Requires -Module @{ModuleName = 'RequiredModule2'; ModuleVersion = '1.0'}
#Requires -Module @{RequiredVersion = '2.0'; ModuleName = 'RequiredModule3'}
#Requires -Module ExternalModule1
<#
.DESCRIPTION
my new script file test
#>
Param()
This command creates creates a script file New-ScriptFile.ps1 with all of its metadata properties. The Verbose parameter specifies that the command
display verbose output.
RELATED LINKS
Online Version: http://go.microsoft.com/fwlink/?LinkId=822329
Test-ScriptFileInfo
Update-ScriptFileInfo