Automation with PowerShell Scripts

Once you have some experience running interactive PowerShell commands in a console, you'll likely want to save yourself some typing and benefit from automation. This course will start you on your PowerShell scripting journey.
Course info
Rating
(18)
Level
Beginner
Updated
Mar 26, 2018
Duration
2h 55m
Table of contents
Description
Course info
Rating
(18)
Level
Beginner
Updated
Mar 26, 2018
Duration
2h 55m
Description

At some point in your PowerShell experience you'll want to move beyond typing commands at a prompt. This course, Automation with PowerShell Scripts will teach you how to leverage PowerShell scripting to benefit from automation. First, you'll learn to automate processes and tasks so that they are consistent. Next, you'll learn to make sure your automated processes and tasks are documented. Finally you'll learn to make sure your automated processes and tasks are easy to run. By the end of this course, you'll have the beginning scripting knowledge to begin automating your workload with PowerShell.

About the author
About the author

Jeffery Hicks is a Microsoft MVP in Windows PowerShell and an IT veteran with many years of experience, much of it spent as an IT consultant specializing in Microsoft server technologies with an emphasis in automation and efficiency.

More from the author
PowerShell on the Network
Beginner
3h 43m
15 Dec 2017
Putting PowerShell to Work
Beginner
4h 6m
29 Aug 2017
Your First Day with PowerShell
Beginner
1h 46m
8 May 2017
More courses by Jeff Hicks
Section Introduction Transcripts
Section Introduction Transcripts

Course Overview
Hello everyone. PowerShell sensei, Jeff Hicks, here again, to let you know about my latest project from Pluralsight. Now by now your PowerShell experience has led you to working with it interactively to manage things in your organization, but now you're ready to go to the next step and begin automation. PowerShell automation runs across a spectrum, and your first step is creating a PowerShell script. This course is designed to teach you the fundamentals of creating a simple PowerShell script, but don't let the description of simple fool you. You can accomplish a lot of work with a script of only a few lines of code, and as usual, I'll have plenty of sample scripts for you to try. This course will teach you about how PowerShell handles script security, including execution policies, default settings, and how to run a PowerShell script. I want you to be safe. I'll also introduce you to the essential PowerShell scripting concept of scope. This is an area that trips up a lot of beginner scripters all the time, and of course, you'll need some scripting tools, so we'll look at PowerShell's easy to learn scripting language, things like IF statements, arrays, hashtables, and other enumeration techniques. By the end of the course you should feel confident enough to open up the PowerShell ISE and take your skills to the next level. Automation with PowerShell Scripts, execute.

Introduction
Hello everyone, and welcome to my new course, Automation with PowerShell Scripts. My name is Jeff Hicks, and I'll be your author, your teacher, maybe even your sensei as we start a journey into exploring what you can do with PowerShell scripting. Now this course is based upon a premise that you've got some basic PowerShell skills, and you want to go to the next level where you want to start automating, you know, some basic tasks. You want to, in essence, begin to learn how to script with PowerShell, so that's what we're going to look at in this course. Now before we get into that let me quickly explain who I am in case you don't know my name. Long time Microsoft MVP. I've been working with PowerShell since the very beginning, so well over 10 years now, and I've been writing, speaking, and training about PowerShell since day 1 really. I've also written a number of courses for Pluralsight. I appreciate everyone who's taken the time to watch some of my courses, and I spend a lot of the rest of my time writing books and speaking at conferences. Again, I know a number of you have acquired some of the books in your library from my work, especially with Don Jones, and I appreciate your support.

PowerShell Fun
Hello everyone, and welcome back to my Pluralsight course on Automation with PowerShell Scripts. My name is Jeff Hicks, and I hope you have been learning quite a bit about PowerShell scripting and seeing how easy it is. In this lesson we're going to look at some other things that maybe aren't quite as documented as well as they could be or should be, but they are things that I think you will find helpful in adding some details to your PowerShell scripts. During this course we've been pretty serious about PowerShell, but it has a fun and wild side as well. Because it's built on the. NET framework you can take advantage of some of its features to add some functionality to your scripts. Now these are tips and tricks. They're not necessarily well documented, but I use them often in my scripts, and I think you will too. For example, I want to show you how you can work with strings. Very often, we need to create maybe something that's an all uppercase or all lowercase. There are no cmdlets to do that, but I'll show you how you can accomplish that with the. NET framework, or dates, I need to find out what date is it going to be 60 days from now, or what date was it 60 days ago, or I want to build a string based on a date, say the month and the year. I'll show you how to do that, and math. You know, there are no math cmdlets, but there's a math class in the. NET framework, so if I want to round something or create some sort of calculation there are things that we can do with. NET and the math class, and we can do that right within PowerShell, and those are just some of the things that have come to me right off the top of my head. As we get into the demonstrations I have a few other things I think that I'll show you as well that you might find useful.

Walkthrough: Creating a Process Controller Script
Hello everyone, and welcome back to my course on Automation with PowerShell Scripts. We've covered a lot of scripting language, syntax, and concepts, we've even created a few scripts. In this lesson we're going to go one step further with something I call a controller script. Now in the world of PowerShell automation we really have sort of a cycle, if you will, of automation techniques. At the beginning, and the beginning is where you are now, we're creating scripts. We're taking commands that we would normally type interactively and putting them into a ps1 file, a script file that we can execute, and so the commands will run just as if we had typed them. Eventually, you'll learn about creating functions. This is a way of creating your own PowerShell tool using PowerShell scripting language. Once you have your functions, then those are packaged into modules, and then we come back full circle by creating scripts that might employ the functions that are deployed in our modules. For our purposes today, though, we're going to look at something called a controller script. In the PowerShell world a controller script is a little bit different than scripts we have looked at so far in this course, and other PowerShell code that you'll write later in your career. A PowerShell controller script is one that orchestrates or runs other PowerShell commands, functions, and scripts. Eventually you will learn to write those other PowerShell functions and scripts, but for now we're just going to demonstrate a controller script that uses some built-in PowerShell commands.