Microsoft India - Windows Power Shell in Windows Server 2008 R2 Whitepaper


Published on

Organizations today are under increasing pressure to be more productive with fewer resources. However, analysts report that most organizations use over most of their IT budget in maintaining and operating their existing IT infrastructure rather than investing in new systems or new capabilities.
Microsoft® Windows Server® 2008 R2 includes many new and enhanced capabilities to help
enterprises optimize resources and trim costs. The latest version of Microsoft Windows PowerShell™ included in Windows Server 2008 R2 is a command-line and GUI-based scripting tool that helps IT professionals achieve greater productivity and perform system administration more efficiently. Windows PowerShell provides powerful scripting capabilities that can help automate server deployment and configuration and simplify system

Published in: Technology
1 Comment
  • 1.To read more case studies on Microsoft Windows Server 2008 click here:

    2. To get more information on other products and services:

    3. To know more and download the Trial Version of Microsoft Windows Server 2008 :

    4. Contact us for any requirement or Feedback at
    Are you sure you want to  Yes  No
    Your message goes here
  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Microsoft India - Windows Power Shell in Windows Server 2008 R2 Whitepaper

  1. 1. Windows PowerShell in Windows Server 2008 R2 White Paper Published: August 2009 For the latest information, please see © 2009 Microsoft Corporation. All rights reserved. This document is developed prior to the product’s release to manufacturing, and as such, we cannot guarantee that all details included herein will be exactly as what is found in the shipping product. The information contained in this document represents the current view of Microsoft Corporation on the issues discussed as of the date of publication. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the date of publication. The information represents the product at the time this document was printed and should be used for planning purposes only. Information subject to change at any time without prior notice. This whitepaper is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY. Microsoft, Active Directory, Windows PowerShell, Windows, the Windows logo, Windows Vista, and Windows Server are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. All other trademarks are property of their respective owners.
  2. 2. Contents Introduction .................................................................................................................................1 Today’s IT Administrative Challenges ........................................................................................2 Introduction to Windows PowerShell ..........................................................................................3 Windows PowerShell Benefits ....................................................................................................5 Helps to Maximize your IT Investment ...................................................................................5 Lower the Barriers to Entry .....................................................................................................5 Reduce Time-to-Results .........................................................................................................6 Where to Begin ...........................................................................................................................9 Conclusion ............................................................................................................................... 10 Resources ................................................................................................................................ 11
  3. 3. Introduction Organizations today are under increasing pressure to be more productive with fewer resources. However, analysts report that most organizations use over most of their IT budget in maintaining and operating their existing IT infrastructure rather than investing in new systems or new capabilities. ® ® Microsoft Windows Server 2008 R2 includes many new and enhanced capabilities to help enterprises optimize resources and trim costs. The latest version of Microsoft Windows PowerShell™ included in Windows Server 2008 R2 is a command-line and GUI-based scripting tool that helps IT professionals achieve greater productivity and perform system administration more efficiently. Windows PowerShell provides powerful scripting capabilities that can help automate server deployment and configuration and simplify system administration. Windows PowerShell in Windows Server 2008 R2 1
  4. 4. Today’s IT Administrative Challenges In today’s environment, organizations are increasingly reliant on information technology (IT) for mission-critical operations. More users have increasingly diverse roles and demand high information availability. Furthermore, this basic demand for availability is coupled with an expectation that critical information is available anywhere as well as anytime. And increasing numbers of organizations understand that meeting these information demands is essential to overall efficiency, helping to identify problems and opportunities, and responding quickly to those challenges. These requirements entail increasing technological complexity, which in turn increases the IT managerial burden. Currently, most IT costs are related to managing existing systems. Current industrial trends such as a return to large scale data centers, an increase in the use of virtualization, the use of remote management, and an increase in outsourcing are helping to further increase the challenges that IT management faces. Organizations want efficient IT resource administration. With smaller budgets and fewer IT staff, today’s IT departments are expected to manage a diverse set of resources and ensure information availability without compromise. To achieve this, IT staff need tools that reduce complexity, increase manageability, and extend the reach of administration from the physical data center to the virtual data center, and to the desktop. These tools need to work for a diverse set of organizations—small and large organizations, online services, and individuals. In addition, these tools need to work on many layers, including hardware, operating systems, applications, and services. Management solutions are needed at every layer, with each layer relying on the stability and the management of the prior layer. To address the need for streamlined management, Windows Server 2008 R2 delivers a powerful yet easy-to-use management experience that encompasses both tools and best practices. It provides a rich and consistent management experience that enables administrators to complete tasks both locally and remotely with minimal differentiation and effort. At the heart of management improvements is the rising importance of the enhancement and growth of Windows PowerShell. Windows PowerShell in Windows Server 2008 R2 2
  5. 5. Introduction to Windows PowerShell Windows PowerShell is a command-line shell and a scripting language designed to help system administrators achieve greater productivity and manage systems easily. Windows PowerShell accelerates automation of system administration tasks and can help improve your organization’s ability to address the system-management problems of the server or client environment. This automation capability means that tasks that might have previously taken the IT professional hours to perform can now be completed in seconds. Likewise, it also helps to reduce the possibility of human error during the administrative process. Windows Server 2008 R2 introduces Windows PowerShell, which significantly enhances the previous version with the inclusion of more than 240 pre-built cmdlets as well as a new graphical user interface (GUI) that adds professional-level development features for writing scripts. The new interface includes colored syntax, which helps make writing and understanding scripts easier, and helps catch errors during script creation. Also included are new production script debugging capabilities. Server roles and many other features of Windows Server 2008 R2 are strongly integrated with Windows PowerShell. Many of the new management interfaces, such as the new Active Directory Administrative Center (ADAC), are built on Windows PowerShell. Windows PowerShell is more powerful and versatile than its predecessor and is available on both ® Microsoft Windows 7 and Windows Server 2008 R2. Because it does not require a strong background in programming, Windows PowerShell helps to maximize your IT investment, lowers the barrier to entry for automation management, and reduces the time required to experience results. Windows Power Shell works with your existing IT infrastructure, existing scripts, and existing command-line tools. Unlike most shells that accept and return text, Windows PowerShell is built on top of the .NET common language runtime (CLR) and the Microsoft .NET Framework, accepting and returning .NET framework objects. This fundamental change in the environment brings entirely new tools and methods to the management and configuration of Windows. Windows PowerShell enhancements available in Windows Server 2008 R2 include:  New Integrated Scripting Environment (ISE). The new ISE simplifies the scripting process by providing a full featured scripting development environment which includes an interactive shell with Unicode support and colored syntax, a multi-tabbed scripting pane, multiple sessions, and more.  Script remoting. Remoting eases the burden of centralized management. Administrators no longer have to log into a machine directly to run scripts. They can now send commands to another computer remotely across the network and send commands to multiple computers at the same time. For example, using Windows PowerShell, IT professionals can access reliability data from many PCs at one time. This task previously could have taken many hours to accomplish.  Advanced functions. In Windows Server 2008 R2, Windows PowerShell enables you to write functions that provide the same rich user experience as cmdlets. Previously, you had to write C# or VB.NET code to get a rich command-line experience. This change means that IT pros can now get the same rich experience by writing advanced functions using the Windows PowerShell scripting language instead of relying on developers. It also means that advanced functions no longer need to be compiled. In addition, administrators using advanced functions can rely on consistent syntax and semantics between functions and cmdlets.  Asynchronous execution. Asynchronous execution enhances your ability to multitask. Background jobs enable you to run a command or expression in the background without requiring it to interact with the current session. When you start a Windows PowerShell in Windows Server 2008 R2 3
  6. 6. background job, the command prompt returns immediately, even if the job takes an extended time to complete. You can continue to work in the session without interruption while the job runs and query for the job results at your convenience.  Eventing. Eventing enables you to quickly identify issues in order to respond to changing needs. With eventing, you can asynchronously respond to events that are generated by various objects in Windows, which can help automate certain kinds of tasks. You can use eventing to be notified or to take some predefined action when management or system events are raised, file or registry keys are altered, or other managed entities are changed. Additionally, you can use eventing to link together a sequence of actions in order to automate a workflow.  Delegated management. Administrators can delegate management of day-to-day functions that are better handled by the departments or groups that need them. Restricted sessions enable an administrator to create a constrained environment for users that grants limited access to a subset of Windows PowerShell commands, scripts, and language elements.  Consistent management. Windows PowerShell enables consistent management no matter where the system is installed. The Mobile Object Model makes it possible to have management objects travel around the network. This means that you can work with objects across the network rather than just being able to see a read-only copy of those objects.  Improved server role coverage. Windows PowerShell also enables administrators to manage specific Windows Server 2008 R2 roles and features with cmdlets and providers that are designed exclusively for those roles and features.  Cmdlet-based debugger. Windows PowerShell includes a cmdlet-based debugger for scripts and functions. The debugger is supported by a fully documented public API that you can use to build your own debugger or to customize or extend the debugger.  Designed to utilize the .NET Framework. Windows PowerShell is built on the .NET framework and enables you to use the .NET framework classes and types. That means that the more you learn about the .NET framework, the more you will be able to accomplish with Windows PowerShell.  Support for Transactions. Windows PowerShell extends your ability to control execution commitment using transactions. With a PowerShell transaction you are able to carry out a number of grouped operations without committing the changes until you are ready. Windows PowerShell in Windows Server 2008 R2 4
  7. 7. Windows PowerShell Benefits The new and enhanced features in Windows PowerShell mean that even administrators without a background in programming can easily adopt, learn, and use the tools to maximize your current IT investments and increase your productivity. Windows PowerShell does this by providing a common approach to administering both applications and Windows operating ® systems, ranging from individual registries to Active Directory to Microsoft Exchange Server. In addition, Windows PowerShell brings the power of the .NET Framework to command-line users and script writers. Helps to Maximize your IT Investment One of the most important benefits of Windows PowerShell is its ease of adoption and deployment. Because it works within your IT infrastructure and existing scripting tools, Windows PowerShell is easy to adopt and helps maximize your current IT investments. Windows PowerShell is also easy to deploy because it runs on Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7, and Windows Server 2008 R2. This means that deployment is done in production in your current infrastructure. Although Windows PowerShell is a new command line shell and task-based scripting technology, it supports your organization’s current scripts (e.g., .vbs, .bat, .perl, etc.), so there is no need to migrate scripts in order to adopt Windows PowerShell. All existing Windows- based command line tools will run from the Windows PowerShell command line, and many Cmd.exe commands work in Windows PowerShell. There are currently over 240 cmdlets installed by default and Exchange Server 2010 has over 600 cmdlets. However, due to Role Based Access Control (RBAC) not all of the 600 cmdlets in Exchange Server will generally be visible at one time. This easy-to-use command line shell and scripting language was designed specifically for IT administrators. In fact, the comprehensive and uniform tools, utilities, and scripting language enable organizations to standardize on a single scripting language for all Windows system administration tasks. Windows PowerShell requires the .NET Framework, which is available on both the Microsoft Download Center as a redistributable package and through the Windows Update and Microsoft Update services. It requires .NET Framework 2.0 for most features, including the console host and built-in cmdlets. For the Integrated Scripting Environment host and Out- GridView cmdlet, you need .NET Framework 3.5 SP1 or later. For the very first time, this .NET-based functionality exposes the power of .NET technology and Web services via easy- to-understand command line tools, scripting language and utilities so that administrators can more easily control and automate system administration. Lower the Barriers to Entry Windows PowerShell is also designed to be easy to learn—its functionality is easily discoverable. In Windows PowerShell, it is a simple matter to find a cmdlet and learn more about it. After discovering which cmdlet accomplishes a task, you can view its built-in help content to learn more about how it can be used. Windows PowerShell also stresses consistency, and consistent functionality greatly reduces management complexity. This emphasis on consistency also increases script reusability—no more writing point solutions that you stick in a bin folder rarely to be used again. With purpose-built tools finally in the box, scripting is no longer an exercise in workarounds. After you learn the basic functionality, the intuitive design of the Windows PowerShell interface and scripting language help you quickly automate a broad set of bulk administration tasks. Simply put, Windows PowerShell does not require extensive training in order to use Windows PowerShell in Windows Server 2008 R2 5
  8. 8. commands or start writing scripts. Powerful aliasing, history, and profile features enable you to customize the Windows PowerShell environment based on your specific shell preferences. In fact, the interactive command line shell with rich help utilities enables you to learn the scripting language. Learning to use the Windows PowerShell scripting language does not require a background in programming. This is because Windows PowerShell commands and language follow an easy to understand verb-noun syntax (e.g., Get-EventLog; Stop-Process). All commands follow standard naming conventions and work with a small set of intuitive utilities in order to provide consistency and make you more efficient. Tab completion eases discoverability and arguments are positional. Help is built-in, and well- known legacy commands are supported through aliasing and support for traditional binaries (e.g. dir, cls, cd, md , ping.exe, fsutil.exe). As intuitive and easy-to-learn as Windows PowerShell is, extensive learning content and script examples are available online to help make it even easier for you to learn to use Windows PowerShell. In addition, an active and robust community exists for support via blogs, discussion groups, and script sharing. See the Resources section below for reference links. Reduce Time-to-Results As noted above, Windows PowerShell does not require a strong background in programming, does not require you to migrate your existing scripts, and works with existing command line tools. The intuitive, task-based scripting language reduces time to write scripts via consistent syntax, powerful scripting utilities (Sort, Compare, Where, Group, Select), and uniform naming guidelines. This reduced learning curve also drastically reduces time-to-results. Consistent vocabulary and syntax (with verbs such as Add, New, Get, Set, Remove, and Clear, and nouns such as Computer, Connection, EventLog, Member, Printer, Service, Transaction, and WmiObject) make scripting easier to master. It is also easy to compose a script because the interactive environment lends itself to piecemeal (step-by-step / progressive) solutions. In addition, multiple cmdlets can be pipelined end-to-end to solve complex management problems. All of this results in a flexible output where objects can be easily formatted and easily consumed by other cmdlets. Windows PowerShell features that make it easy to use include automated administrative utilities, accelerated automation, pipeline flexibility, integrated scripting environment, increased extensibility, easy command access, powerful debugging features, and fast script testing. Windows PowerShell enables the use and easy creation of automated administration utilities. The simple admin utilities in Windows PowerShell help automate bulk system administration tasks through improved data and object manipulation. These utilities provide improved abilities to filter, sort, group, and compare multiple types of system data including the registry, WMI, and services. Since Windows PowerShell can use WMI, IT professionals can write scripts that perform almost any management task that they want to automate. Windows PowerShell can even leverage the full .NET Framework, providing access to thousands of powerful objects. Windows PowerShell uses a new admin-focused command-line shell, scripting language, consistent syntax, and powerful utilities to help accelerate automation and improve control of system management. Unlike traditional program languages that were designed for the developer, Windows PowerShell is a scripting language that was designed for use by system administrators. It does not require the IT professional to understand complex programming languages like Visual Basic or Visual C++ yet enables IT professionals to create scripts that can perform almost any management task. Windows PowerShell in Windows Server 2008 R2 6
  9. 9. Using a new admin-focused scripting language, hundreds of standard command line tools, and consistent syntax and utilities, Windows PowerShell enables IT professionals to easily control system administration and accelerate automation. And of course, the net result of this automation is increased productivity and a reduction in human error. Windows PowerShell commands return .NET objects that can be manipulated in a pipeline. The pipeline works much like UNIX; however piping objects gives you the added flexibility of getting all the properties and methods of those objects. Windows PowerShell also includes a new full featured Integrated Scripting Environment (ISE). The Windows PowerShell ISE is a host application for Windows PowerShell. In Windows PowerShell ISE, you can run commands and write, test, and debug scripts in a single Windows-based graphic user interface with multiline editing, tab completion, syntax coloring, selective execution, context-sensitive help, and support for right-to-left languages. You can use menu items and keyboard shortcuts to perform many of the same tasks that you would perform in the Windows PowerShell console. The Windows PowerShell ISE also lets you customize some aspects of its appearance. The ISE has its own Windows PowerShell profile, where you can store functions, aliases, variables, and commands you use in the Windows PowerShell ISE. Some of the many features of the Windows PowerShell ISE include:  An interactive shell with syntax coloring and Unicode support.  A multi-tabbed scripting pane for loading / composing multiple files.  The ability to run a script by pressing F5 or clicking Run Script on the toolbar.  The ability to run parts of a script by selecting the desired parts and pressing F8 or clicking Run Selection on the toolbar.  Support for multiple sessions, including remote sessions, inside Windows PowerShell ISE by using the New PowerShell Tab menu item or clicking the New Remote PowerShell button. Windows PowerShell takes extensibility to new level with modules. Modules enable you to extend Windows PowerShell by giving you a comprehensive set of cmdlets that you can use as building blocks. Windows PowerShell modules have hundreds of cmdlets that are available out-of-the-box for everything from managing servers to debugging scripts. This enables you to easily build complex and proprietary solutions. The new Out-GridView cmdlet displays the results of other commands in an interactive table, where you can search, sort, and group the results. For example, you can send the results of a Get-Process, Get-WmiObject, or Get-EventLog command to Out-GridView and use the table features to examine the data. This feature requires Microsoft .NET Framework 3.5 SP1 or later. Windows PowerShell ISE has new debugging features that enable you to set breakpoints on lines, variables, and commands. You can also specify actions to run when the breakpoint is hit. Easily stepping into, over, or out of functions is also supported. It is also simple to get the call stack. That being said, debugging tools are built into Windows PowerShell itself. This enables you to use the new debugging cmdlets in Windows PowerShell to debug any script from the console window as well as the ISE. Windows PowerShell also reduces the script testing phase by providing utilities that enable you to quickly test and control system changes such as –WhatIf, -Confirm, and -Verbose. In addition, unique logging and error-handling capabilities enable you to track script execution and handle errors gracefully. Windows PowerShell extends your ability to control execution commitment using transactions. With a transaction you are able to carry out a number of grouped operations without actually committing your changes. This enables you to roll back your changes if an error or Windows PowerShell in Windows Server 2008 R2 7
  10. 10. unexpected event occurs during your script execution process. For example, say your script is going to make a number of registry changes, however, in the middle of your script an error occurs. Without transactions you would need to determine which changes occurred and undo those changes. With transactions, you can simply rollback the transaction – preventing any of the changes to get written to the registry. Windows PowerShell in Windows Server 2008 R2 8
  11. 11. Where to Begin If you have already been using Windows PowerShell you are well on your way to streamlining your administrative process through scripting. However, if you are new to Windows PowerShell, you might wonder where to begin. One of the best sources of content is available right on the Microsoft Developer Network (MSDN). The Windows PowerShell Getting Started Guide provides an introduction to Windows PowerShell: the language, the cmdlets, the providers, and the use of objects. The Windows PowerShell Programmers Guide is targeted at developers who are interested in providing a command-line management environment for system administrators. This guide shows you how to create cmdlets; how to create Windows PowerShell providers; how to write your own hosting applications that access the Windows PowerShell runtime to process commands and interact with Windows PowerShell providers; how to extend object types and formats for your cmdlets, providers, and applications; how to build a cmdlet, Windows PowerShell provider, or hosting application and add it to Windows PowerShell; how Windows PowerShell works; and provides guidelines for developing cmdlets. The Windows PowerShell SDK provides reference content used to develop cmdlets, providers, and hosting applications. Finally, the Windows PowerShell Managed Reference provides detailed class information. Windows PowerShell in Windows Server 2008 R2 9
  12. 12. Conclusion By enabling applications built on Windows PowerShell to manage anything and everything, be it a server, client, distributed system, application, service, hardware, or other operating system, Windows PowerShell was designed to reduce the cost and effort required to manage your IT infrastructure. The intuitive interface, rich built-in help, and extensive online resources make Windows PowerShell helps to maximize your IT investment, lower the barriers to entry into management automation, and reduce the time required to see results. In addition, Windows PowerShell can help standardize and automate all your management processes, improving administrator efficiency and minimizing human error. Windows PowerShell in Windows Server 2008 R2 10
  13. 13. Resources Windows PowerShell on MSDN Windows PowerShell team blog Channel 9 on Windows PowerShell Windows PowerShell Wiki Windows PowerShell on CodePlex Scripting Guy’s Script Center Windows PowerShell in Windows Server 2008 R2 11