Let’s face it, when was the last time you opened a command prompt as part of your daily routine? Did you know you can save a lot of time by creating scripts that automate your daily tasks, such as altering your application’s configuration files and then deploy the application to a remote server? There are developers that still think that scripting is the IT department’s domain. But Windows PowerShell is a different story. PowerShell is a scripting language that is more coding than scripting, mostly because its commands return objects, not text.
In this session we will learn what PowerShell is, the basics of coding with it, and how to call it from your .NET code. Most of the session will focus on how developers can benefit from using PowerShell in their day-to-day routine in order to work with XML and JSON, automate deployments, manage certificates, call HTTP services, manipulate file content, and more. Next time you are asked to deploy your application to the server, type, don’t click!
2. About Me
• Senior Architect, Sela Group, Israel
• Co-author of Microsoft courses – “WCF 4” and “Developing
Windows Azure and Web Services”
• Co-author, “Pro .NET Performance” and “Pro Single Page
Application Development”
• Microsoft ASP.NET/IIS MVP
• Focus on server, web, cloud, and DevOps
• Manager of the Israeli Web Developers User Group
3. What is PowerShell?
• A command line interface
• A scripting environment
• A tool to automate routine tasks
• Something that will simplify your life
• The next generation of command-line
7. Why is PowerShell so Great?
• The output of a command is an object
• Objects can be pipelined as input
• Built on top of the .NET Framework
• Easy to discover what you can do
• Has both command-line and GUI
• Supports debugging
• Runs locally and remotely
11. PowerShell Using .NET or
.NET Using PowerShell?
• You can actually do both!
• Call .NET code from PowerShell
• Create new C# classes in PowerShell
• Execute PowerShell script from .NET
13. PowerShell For Developers
• Work with XML and JSON content
• Access system resources, such as registry, files, and
certificates
• Transform text files using regular expressions
• Control platforms, such as IIS, MS-SQL, and Azure
• Cleanup TFS content from VS solutions and project
• Create automatic deployment scripts
• Interact with SOAP and REST services
Samples
Work with XML and json
Cleanup TFS stuff from VS projects
Generate/use certificates, cert:
Update configuration files
Transform text files (lowercase and trim urls for blobs)
Powershell web access
Regex tester
Automatic deployment?
Call http services?
Kill a specific w3wp