Editar

Compartir a través de


Windows PowerShell Sample Code

Windows PowerShell samples are available through the Windows SDK. This section contains the sample code that is contained in the Windows SDK samples.

Note

When the Windows SDK is installed, a Samples directory is created in which all the Windows PowerShell samples are made available. A typical installation directory is C:\Program Files\Microsoft SDKs\Windows\v6.0. Start Windows PowerShell and type "cd Samples\SysMgmt\PowerShell" to locate the samples' directory. In this document, the Windows PowerShell Samples directory is referred to as <PowerShell Samples>.

Sample Code Listing

Sample Code Description
AccessDbProviderSample01 Code Sample This is the provider described in Creating a Basic Windows PowerShell Provider.
AccessDbProviderSample02 Code Sample This is the provider described in Creating a Windows PowerShell Drive Provider.
AccessDbProviderSample03 Code Sample This is the provider described in Creating a Windows PowerShell Item Provider.
AccessDbProviderSample04 Code Sample This is the provider described in Creating a Windows PowerShell Container Provider.
AccessDbProviderSample05 Code Sample This is the provider described in Creating a Windows PowerShell Navigation Provider.
AccessDbProviderSample06 Code Sample This is the provider described in Creating a Windows PowerShell Content Provider.
GetProc01 Code Samples This is the basic Get-Process cmdlet sample described in Creating Your First Cmdlet.
GetProc02 Code Samples This is the Get-Process cmdlet sample described in Adding Parameters that Process Command-Line Input.
GetProc03 Code Samples This is the Get-Process cmdlet sample described in Adding Parameters that Process Pipeline Input.
GetProc04 Code Samples This is the Get-Process cmdlet sample described in Adding Non-terminating Error Reporting to Your Cmdlet.
GetProc05 Code Samples This Get-Process cmdlet is similar to the cmdlet described in Adding Non-terminating Error Reporting to Your Cmdlet.
StopProc01 Code Samples This is the Stop-Process cmdlet sample described in Creating a Cmdlet That Modifies the System.
StopProcessSample04 Code Samples This is the Stop-Process cmdlet sample described in Adding Parameter Sets to a Cmdlet.
Runspace01 Code Samples These are the code samples for the runspace described in Creating a Console Application That Runs a Specified Command.
Runspace02 Code Samples This sample uses the System.Management.Automation.Runspaceinvoke class to execute the Get-Process cmdlet synchronously.
RunSpace03 Code Samples These are the code samples for the runspace described in "Creating a Console Application That Runs a Specified Script".
RunSpace04 Code Samples This is a code sample for a runspace that uses the System.Management.Automation.Runspaceinvoke class to execute a script that generates a terminating error.
RunSpace05 Code Sample
RunSpace06 Code Sample
RunSpace07 Code Sample
RunSpace08 Code Sample
RunSpace09 Code Sample
RunSpace10 Code Sample This is the source code for the Runspace10 sample, which adds a cmdlet to System.Management.Automation.Runspaces.Runspaceconfiguration and then uses the modified configuration information to create the runspace.

See Also