Open table as spreadsheet
|
To |
Do This |
|---|---|
|
Produce a list of all the files in a folder |
Use the Get-ChildItem cmdlet and supply a value for the folder |
|
Produce a list of all the files in a folder and in the
|
Use the Get-ChildItem cmdlet, supply a value for the folder, and specify the recurse argument |
|
Produce a wide output of the results of a previous cmdlet |
Use the appropriate cmdlet and pipe the resulting object to the Format-Wide cmdlet |
|
Produce a listing of all the
|
Use the cmdlet and pipe the results into the Get-Member cmdlet. Use the -membertype argument and supply the Noun method |
|
Produce a popup box |
Create an instance of the wshShell object by using the New-Object cmdlet. Use the Popup method |
|
Retrieve the currently logged-on
|
Create an instance of the wshNetwork object by using the New-Object cmdlet. Query the username property |
|
Retrieve a listing of all currently mapped
|
Create an instance of the wshNetwork object by using the New-Object cmdlet. Use the EnumNetworkDrives method |
Download CD Content
After completing this chapter, you will be able to:
Understand the role of providers in Windows PowerShell
Use the Get-PSProvider cmdlet
Use the Get-PSDrive cmdlet
Use the Get-Item cmdlet
Use the Set-Location cmdlet
Use the file system model to access data from each of the built-in providers
Windows PowerShell provides a consistent way to access information external to the shell environment. To do this, it uses providers. These providers are actually .NET programs that hide all the ugly details to provide an easy way to access information. The beautiful thing about the way the provider model works is that all the different sources of information are accessed in exactly the same manner. This chapter
By identifying the providers installed with Windows PowerShell, we can begin to understand the capabilities intrinsic to a default installation. Providers expose information contained in different data stores by using a drive and file system analogy. An example of this is obtaining a listing of registry keys-to do this, you would connect to the registry “drive” and use the
Get-ChildItem
cmdlet, which is exactly the same method you would use to obtain a listing of files on the hard drive. The only difference is the specific
| Just the Steps |
To obtain a listing of all the providers, use the
Name Capabilities Drives ---- ------------ ------ Alias ShouldProcess {Alias} Environment ShouldProcess {Env} FileSystem Filter, ShouldProcess {C, D, E, F...} Function ShouldProcess {Function} Registry ShouldProcess {HKLM, HKCU} Variable ShouldProcess {Variable} Certificate ShouldProcess {cert}
|