Windows PowerShell for Developers - Helion
ISBN: 978-14-493-2266-3
stron: 210, Format: ebook
Data wydania: 2012-07-06
Księgarnia: Helion
Cena książki: 63,74 zł (poprzednio: 74,99 zł)
Oszczędzasz: 15% (-11,25 zł)
Want to perform programming tasks better, faster, simpler, and make them repeatable? Take a deep dive into Windows PowerShell and discover what this distributed automation platform can do. Whether you’re a .NET developer or IT pro, this concise guide will show you how PowerShell’s scripting language can help you be more productive on everyday tasks.
Quickly learn how to create PowerShell scripts and embed them into your existing applications, write "little languages" to solve specific problems, and take charge of your code. This book includes example scripts that you can easily pull apart, tweak, and then use in your own PowerShell and .NET solutions.
- Slice and dice text, XML, CSV, and JSON with ease
- Embed PowerShell to provide scripting capabilities for your C# apps
- Create GUI applications five to ten times faster with less code
- Leverage PowerShell’s capabilities to work with the Internet
- Interact with DLLs and create objects, automatically display properties, and call methods in live interactive sessions
- Build domain-specific languages (DSLs) and vocabularies to express solutions more clearly
- Work with Microsoft Office via the Component Object Model (COM)
- Discover PowerShell v3 features included with Windows 8 and Windows Server 2012
Osoby które kupowały "Windows PowerShell for Developers", wybierały także:
- PowerShell. 101 zada 39,90 zł, (19,95 zł -50%)
- Windows PowerShell w miesiąc. Wydanie III 109,00 zł, (54,50 zł -50%)
- ABC systemu Windows 10 PL 39,90 zł, (19,95 zł -50%)
- Windows PowerShell. Najlepsze praktyki 99,00 zł, (49,50 zł -50%)
- Windows PowerShell 4.0 dla programistów .NET 32,90 zł, (16,45 zł -50%)
Spis treści
Windows PowerShell for Developers. Enhance Your Productivity and Enable Rapid Application Development eBook -- spis treści
- Windows Powershell for Developers
- Dedication
- Preface
- Audience
- Assumptions This Book Makes
- Contents of This Book
- Conventions Used in This Book
- Using Code Examples
- Available for Download
- Wed Like to Hear from You
- Safari Books Online
- Acknowledgments
- And Now, the Small Village of Folks Who Helped, Inspired, and Supported Me
- 1. Introduction
- This Is Just the Beginning
- Why Use PowerShell
- Theres a New Game in Town
- An Underutilized Development Tool
- 2. Getting Started
- Installing PowerShell
- Checking the PowerShell Version
- Interactivity, the Key to PowerShell
- Running a PowerShell Script
- Changing the Execution Policy from the Command Line
- RemoteSigned is good for you
- Running scripts with the execution policy set to Restricted
- Now were set to run a script
- Changing the Execution Policy from the Command Line
- PowerShell ISE
- Other PowerShell Editors
- PowerShell and Visual Studio
- The PowerShell Community
- The Future of PowerShell on Windows 8
- Summary
- Installing PowerShell
- 3. The Dime Tour
- The Object Pipeline: The Game Changer
- Automation References
- Semicolons
- Return Statements
- Datatypes
- Exception Handling
- Break
- Continue
- Try/Catch/Finally
- Quoting Rules
- PowerShell Subexpressions in Strings
- Here-Strings
- Great Code Generation Techniques
- C# Code
- Closures, Functions, and Lambdas
- Scriptblocks, Dynamic Languages, and Design Patterns
- Arrays
- Creating an Empty Array
- Adding an Array Item
- Retrieving an Element from an Array
- Array Slicing
- Finding Array Elements
- Reversing an Array
- Assigning Values to Multiple Variables in an Array
- Parentheses and Commas
- Hash Tables
- Creating an Empty Hash Table
- Adding a Hash Table Item
- Initializing a Hash Table with Items
- Concatenating Hash Tables
- Get-Member
- Filtering with Get-Member
- Using Get-Member with Collections
- Inject a GUI into the PowerShell Command Line
- New-Object
- Launching Internet Explorer
- Creating a New PowerShell Object
- PowerShell v3 is more pithy
- Using the .NET Framework
- Add-Member
- Add-Type
- Compiling C# on the Fly
- Newing Up the Class
- Calling the Add Method on MyMathClass
- Wait, I Dont Have the Source
- What Does % Do? and Other Aliases
- Modules
- Summary
- 4. Accelerating Delivery
- Scanning for const Definitions
- Reading a Single C# File
- Using Select-String
- Reading C# Files in a Directory
- Reading a Single C# File
- Working with Template Engines
- The Engine
- A Single Variable
- Multiple Variables
- Multiple Templates
- Complex Logic
- UML Style Syntax
- Reading XML
- Bonus Round
- Generating PowerShell Functions from C# Methods
- Get Parameters
- Pulling It All Together
- Calling PowerShell Functions from C#
- Overriding C# Methods with PowerShell Functions
- The Breakdown
- Looking for PowerShell Functions
- Extracting Metadata and Generating C#
- The PowerShell Module
- Testing It All
- Summary
- Scanning for const Definitions
- 5. Add PowerShell to Your GUI
- Embedding PowerShell in your C# Application
- Beaver Music Application
- PowerShell Console
- Foundational Functions
- New-Album
- Add-Album
- Import-Csv
- Get-Album and Clear-Album
- Managing Applications Better with PowerShell
- Importing Albums from the Web
- Function Get-AlbumFromWeb
- PowerShell v3
- Out-GridView
- Export-ToExcel
- Interacting with MEF
- Discovering the executable commands
- Show-NewAlbumDialog
- Implementing Performance Counters
- Get-PrivateBytes
- Get-YahooMusic
- Wiring a Textbox to Execute PowerShell Code
- Working in the PreviewKeyDown
- Running Script and Debugging the C#
- Getting the PowerShell Console in Your App
- PSConfig.Profile
- PSConfig.AddVariable
- The PowerShell Console Code
- PS.cs
- PSConfig.cs
- Summary
- 6. PowerShell and the Internet
- Net.WebClient
- Wrapping Code in a PowerShell Function
- Reading CSV-Formatted Data from the Web
- Reading XML-Formatted Data from the Web
- The Structure of XML Data
- US Government Data Sources
- Invoke-RestMethod
- Detecting XML
- Detecting JSON
- PowerShell and The New York Times Semantic API
- Reading The New York Times, part 1
- Reading The New York Times, part 2
- New-WebServiceProxy
- Stock WebService
- Dig a Little Deeper
- Invoke-WebRequest
- PowerShell and Google
- The target HTML
- PowerShell and Bing
- PowerShell and the Twitter API
- PowerShell and Google
- Summary
- 7. Building GUI Applications in PowerShell
- Why a Chapter About GUIs?
- Answer: Two Lines of Code
- PowerShell and WinForms
- PowerShell, ShowUI, and the Twitter API
- A Twitter GUI Application
- The Code
- ShowUI Video Player
- Summary
- Why a Chapter About GUIs?
- 8. DLLs, Types, Properties, Methods, and Microsoft Roslyn
- Sending Text to the Clipboard
- Transcoding C# to PowerShell
- First, the C#
- Intermediate PowerShell
- Results
- Converting JSON to PowerShell
- Microsofts Roslyn
- Microsoft Roslyn and PowerShell
- Using PowerShell to Display Visual Studio Detail
- Roslyns Document Methods
- PowerShell Roslyn Class Viewer
- How It Works at a High Level
- Summary
- 9. Writing Little Languages in PowerShell
- Adding a New Construct to PowerShell
- PowerShell: A Better XML
- But WaitTheres More
- Building the New-ToDoList function
- Building the New-ToDoItem function
- Where to put this function?
- Invoking the script block
- The New-ToDoItem Body
- Putting It All Together
- But WaitTheres More
- The Little Language in Action
- Is It Worth Creating Your Own Little Language?
- Graphviz
- Graphviz Hello World
- Hello World Visual
- A PowerShell DSL as a façade to GraphViz
- Building Add-Edge
- Building New-Graph
- Emitting output from New-Graph
- Mix and Match PowerShell and GraphViz
- Kick It Up a Notch: New-Graph Is an Internal DSL
- Graphing the Companies from Get-Process
- Summary
- 10. PowerShell, COM, and More
- Opening a File in Excel Using Invoke-Item
- Working Invoke-Item into a PowerShell Script
- Calling an Excel Function
- Creating an Excel COM Instance
- Discovering Available Excel Functions
- Calling More Excel Functions
- Automating Excel from PowerShell
- Making Excel Visible
- Creating a Workbook and Worksheets
- Putting the Date in a Cell in an Excel Worksheet from PowerShell
- Setting Up Pivot Tables in Excel
- Building an Excel Pivot Table in PowerShell
- Discovering Other COM Applications to Automate
- Automating Internet Explorer as a COM Application
- Summary
- Opening a File in Excel Using Invoke-Item
- 11. PowerShell Version 3
- PowerShell Workflows
- PowerShell Script-Based Workflow
- Running the Workflow
- Running the Workflow on Other Boxes
- Discovering More About Your Workflow
- Visual Studio Workflow
- Import-Module on a XAML workflow
- Getting performance counters in parallel
- Why workflows rock
- Using PowerShell with Web Data: Converting to and from JSON
- Converting JSON to PowerShell Objects and Back Again
- What If a Web/REST Service Returns JSON?
- Creating an Instance of a Microsoft .NET Framework Object
- Get-Content Tail
- ISE v3
- Out-GridView and the -PassThru Parameter
- Scheduling Jobs
- Invoke-WebRequest and Invoke-RestMethod
- PowerShell v3 Items That Are a Must-See
- Show-Command
- Less Typing for ForEach and Where
- Execute PowerShell Commands from the Web
- Windows PowerShell Management ODATA IIS Extensions
- Summary
- PowerShell Workflows
- A. Productive PowerShell
- Getting Automation Approved
- Saving Time with Automation
- Adding Aliases to Your PowerShell Profile
- Adding Variables and Functions to Your PowerShell Profile
- The ql Function
- Adding Variables to $Profile
- Adding Custom PowerShell Functions
- Quick Access to Launching Visual Studio Solutions
- Remote Desktop Connection
- Starting Another PowerShell Session
- Start-Process Can Do More
- Using PowerShells Tokenizer
- PowerShell and Older Tools
- Subversion
- Displaying SVN info on your PowerShell prompt
- The script
- Displaying SVN info on your PowerShell prompt
- Subversion
- Faster, FasterThe Light Is Turning Red
- SlowTrain
- FastTrain
- ForEach-Object Versus ForEach Statement
- Summary
- B. Running PowerShell with the .NET 4.0 Runtime
- About the Author
- Copyright