Provider cmdlet parameters
Provider cmdlets come with a set of static parameters that are available to all providers that support the cmdlet, as well as dynamic parameters that are added when the user specifies a certain value for certain static parameters of the provider cmdlet.
Provider Cmdlet Static Parameters
Static parameters are defined by Windows PowerShell. A large set of these parameters is implemented by Windows PowerShell to provide consistency across all the providers and to provide a simpler development experience. Examples of these parameters include the literalPath
, exclude
, and include
parameters of the Get-Item
cmdlet. A smaller set of these parameters can be overwritten to provide actions that are specific to your provider. Examples of these parameters include the Path
and Value
parameter of the Set-Item
cmdlet. Here is a list of the parameters that can be overwritten for the provider cmdlets.
Clear-Content
cmdlet
You can define how your provider will use the values passed to the Path
parameter of the Clear-Content
cmdlet by implementing the System.Management.Automation.Provider.Icontentcmdletprovider.Clearcontent* method.
Clear-Item
cmdlet
You can define how your provider will use the values passed to the Path
parameter of the Clear-Item
cmdlet by implementing the System.Management.Automation.Provider.Itemcmdletprovider.Clearitem* method.
Clear-ItemProperty
cmdlet
You can define how your provider will use the values passed to the Path
and Name
parameters of the Clear-ItemProperty
cmdlet by implementing the System.Management.Automation.Provider.Ipropertycmdletprovider.Clearproperty* method.
Copy-Item
cmdlet
You can define how your provider will use the values passed to the Path
, Destination
, and Recurse
parameters of the Copy-Item
cmdlet by implementing the System.Management.Automation.Provider.ContainerCmdletProvider.CopyItem method.
Get-ChildItems cmdlet
You can define how your provider will use the values passed to the Path
and Recurse
parameters of the Get-ChildItem
cmdlet by implementing the System.Management.Automation.Provider.Containercmdletprovider.Getchilditems* and System.Management.Automation.Provider.Containercmdletprovider.Getchildnames* methods.
Get-Content
cmdlet
You can define how your provider will use the values passed to the Path
parameter of the Get-Content
cmdlet by implementing the System.Management.Automation.Provider.Icontentcmdletprovider.Getcontentreader* method.
Get-Item
cmdlet
You can define how your provider will use the values passed to the Path
parameter of the Get-Item
cmdlet by implementing the System.Management.Automation.Provider.Itemcmdletprovider.Getitem* method.
Get-ItemProperty
cmdlet
You can define how your provider will use the values passed to the Path
and Name
parameters of the Get-ItemProperty
cmdlet by implementing the System.Management.Automation.Provider.Ipropertycmdletprovider.Getproperty* method.
Invoke-Item
cmdlet
You can define how your provider will use the values passed to the Path
parameter of the Invoke-Item
cmdlet by implementing the System.Management.Automation.Provider.Itemcmdletprovider.Invokedefaultaction* method.
Move-Item
cmdlet
You can define how your provider will use the values passed to the Path
and Destination
parameters of the Move-Item
cmdlet by implementing the System.Management.Automation.Provider.Navigationcmdletprovider.Moveitem* method.
New-Item
cmdlet
You can define how your provider will use the values passed to the Path
, ItemType
, and Value
parameters of the New-Item
cmdlet by implementing the System.Management.Automation.Provider.Containercmdletprovider.Newitem* method.
New-ItemProperty
cmdlet
You can define how your provider will use the values passed to the Path
, Name
, PropertyType
, and Value
parameters of the New-ItemProperty
cmdlet by implementing the Microsoft.PowerShell.Commands.Registryprovider.Newproperty* method.
Remove-Item
You can define how your provider will use the values passed to the Path
and Recurse
parameters of the Remove-Item
cmdlet by implementing the System.Management.Automation.Provider.Containercmdletprovider.Removeitem* method.
Remove-ItemProperty
You can define how your provider will use the values passed to the Path
and Name
parameters of the Remove-ItemProperty
cmdlet by implementing the System.Management.Automation.Provider.Idynamicpropertycmdletprovider.Removeproperty* method.
Rename-Item
cmdlet
You can define how your provider will use the values passed to the Path
and NewName
parameters of the Rename-Item
cmdlet by implementing the System.Management.Automation.Provider.Containercmdletprovider.Renameitem* method.
Rename-ItemProperty
You can define how your provider will use the values passed to the Path
, NewName
, and Name
parameters of the Rename-ItemProperty
cmdlet by implementing the System.Management.Automation.Provider.Idynamicpropertycmdletprovider.Renameproperty* method.
Set-Content
cmdlet
You can define how your provider will use the values passed to the Path
parameter of the Set-Content
cmdlet by implementing the System.Management.Automation.Provider.Icontentcmdletprovider.Getcontentwriter* method.
Set-Item
cmdlet
You can define how your provider will use the values passed to the Path
and Value
parameters of the Set-Item
cmdlet by implementing the System.Management.Automation.Provider.Itemcmdletprovider.Setitem* method.
Set-ItemProperty
cmdlet
You can define how your provider will use the values passed to the Path
and Value
parameters of the Set-Item
cmdlet by implementing the System.Management.Automation.Provider.Ipropertycmdletprovider.Setproperty* method.
Test-Path
cmdlet
You can define how your provider will use the values passed to the Path
parameter of the Test-Path
cmdlet by implementing the System.Management.Automation.Provider.Itemcmdletprovider.Invokedefaultaction* method.
In addition, you cannot specify the characteristics of these parameters, such as whether they are optional or required, nor can you give these parameters an alias or specify any of the validation attributes. In contrast, you can specify parameter characteristics in stand-alone cmdlets by using attributes such as the Parameters
attribute.
Provider Cmdlet Dynamic Parameters
Dynamic parameters for cmdlet providers are similar to dynamic providers for stand-alone cmdlets. In both cases, the parameters are added to the cmdlet when the user specifies a certain value for one of the default parameters, such as the path
parameter. However, not all of the static parameters can be used to trigger the addition of dynamic parameters. For more information about dynamic parameters, see Provider Cmdlet Dynamic Parameters.