Book Image

Microsoft Windows PowerShell 3.0 First Look

By : Adam Driscoll
Book Image

Microsoft Windows PowerShell 3.0 First Look

By: Adam Driscoll

Overview of this book

<p>In an ever growing and changing computer industry, learning how to manage systems effectively is necessary for any administrator. The new features in PowerShell 3.0 extend the already impressive language to support new features that makes working with complex and distributed systems simpler and faster. <br /><br /><i>Microsoft Windows PowerShell 3.0 First Look</i> offers a quick look into the new features available in the most recent version of the language. Quick, to-the-point examples ensure that you will be able to easily understand the new features. <br /><br />Starting with simple syntactical changes all the way through Windows Worflow integration, you will learn through concise feature analysis and simple examples.</p> <p>Throughout this book you will get to grips with changes to the language to aid usability &ndash; making administrators' lives easier. New features will be explored such as Windows Workflow integration and extended WMI capabilities. This book includes a chapter outlining some of the most important new cmdlets and modules found in Windows 8 and Windows Server 8.<br /><br />Microsoft Windows PowerShell 3.0 First Look will provide a jump start for administrators or power users who want to grasp new features, language changes, and cmdlet offerings found in the new version of Microsoft PowerShell.</p>
Table of Contents (14 chapters)
Microsoft Windows PowerShell 3.0 First Look
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
3
Improved Administration
Index

Automatically creating provider cmdlets


One of the major advantages to the new provider model and the CIM IDE is that the metadata created by Visual Studio can be directly consumed by PowerShell. Instead of having to write functions that expose the functionality, or by using the generic CIM or WMI functions, we can just create specific functions for our provider. In the previous section we created PowerShell metadata as a CDXML file. This file is responsible for generating the functions. In order to generate the functions, we just import the metadata file using Import-Module as follows:

PS C:\> Import-Module "C:\PS_WIN32_NetworkDrive.cdxml" -Verbose
VERBOSE: Importing function 'Disconnect-WIN32NetworkDrive'.
VERBOSE: Importing function 'Get-WIN32NetworkDrive'.

Now that they are imported we can use them just like we would any other function. If we investigate the syntax of the function we will also see that the parameters that we specified in the CIM IDE are exposed. This is done by using...