編輯

共用方式為


Provider Samples

This section includes samples of providers that access a Microsoft Access database. These samples include provider classes that derive from all the base provider classes.

In This Section

This section includes the following topics:

AccessDBProviderSample01 Sample This sample shows how to declare the provider class that derives directly from the System.Management.Automation.Provider.Cmdletprovider class. It is included here only for completeness.

AccessDBProviderSample02 This sample shows how to overwrite the System.Management.Automation.Provider.Drivecmdletprovider.Newdrive* and System.Management.Automation.Provider.Drivecmdletprovider.Removedrive* methods to support calls to the New-PSDrive and Remove-PSDrive cmdlets. The provider class in this sample derives from the System.Management.Automation.Provider.Drivecmdletprovider class.

AccessDBProviderSample03 This sample shows how to overwrite the System.Management.Automation.Provider.Itemcmdletprovider.Getitem* and System.Management.Automation.Provider.Itemcmdletprovider.Setitem* methods to support calls to the Get-Item and Set-Item cmdlets. The provider class in this sample derives from the System.Management.Automation.Provider.Itemcmdletprovider class.

AccessDBProviderSample04 This sample shows how to overwrite container methods to support calls to the Copy-Item, Get-ChildItem, New-Item, and Remove-Item cmdlets. These methods should be implemented when the data store contains items that are containers. A container is a group of child items under a common parent item. The provider class in this sample derives from the System.Management.Automation.Provider.Containercmdletprovider class.

AccessDBProviderSample05 This sample shows how to overwrite container methods to support calls to the Move-Item and Join-Path cmdlets. These methods should be implemented when the user needs to move items within a container and if the data store contains nested containers. The provider class in this sample derives from the System.Management.Automation.Provider.Navigationcmdletprovider class.

AccessDBProviderSample06 This sample shows how to overwrite content methods to support calls to the Clear-Content, Get-Content, and Set-Content cmdlets. These methods should be implemented when the user needs to manage the content of the items in the data store. The provider class in this sample derives from the System.Management.Automation.Provider.Navigationcmdletprovider class, and it implements the System.Management.Automation.Provider.Icontentcmdletprovider interface.

See Also

Writing a Windows PowerShell Provider