Using Data Stores and PowerShell Providers
Today's modern computing world makes use of a vast variety of data stores, including the file store, the certificate store, the Registry, etc. With previous tools, each of these data stores are accessed using different and incompatible tools, making it hard for the admin to learn, use, and master. PowerShell take a different approach through the use of providers and standard cmdlets.
A PowerShell provider is a software component that sits between the actual data store and the standard cmdlets. The standard cmdlets call into the provider to return the relevant data and present it in a admin-friendly way. To aid in conversion, PowerShell provides aliases for these standard cmdlets. The provider architecture is shown at http://msdn2.microsoft.com/en-us/library/ms714658.d2eb7674-3a27-4baf-91b7-b8eaf1e8ab2c(en-us,VS.85).gif.
To illustrate this, let's look at the two data stores, the filesystem and the Registry:
PSH [D:\foo]:dir
Directory: Microsoft.PowerShell.Core\FileSystem::D:\foo Mode LastWriteTime Length Name ---- ------------- ------ ---- d---- 14/10/2007 12:04 bar PSH [D:\foo]:cd bar
PSH [D:\foo\bar]:ls
Directory: Microsoft.PowerShell.Core\FileSystem::D:\foo\bar Mode LastWriteTime Length Name ---- ------------- ------ ---- -a--- 14/10/2007 12:04 8 foobar.txt PSH [D:\foo\bar]:cd hklm
: PSH [HKLM:\]:ls
Hive: Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE SKC VC Name Property --- -- ---- -------- 4 0 HARDWARE {} 87 0 SOFTWARE {} 8 ...
Get Windows Server 2008: The Definitive Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.