Administration and Automation with Windows PowerShell
Course Introduction • 5min
0 / 2 lessons complete
Getting Started with Windows PowerShell • 42min
0 / 7 lessons complete
The Basics of PowerShell
Video | 7 min
Installing and Updating PowerShell
Video | 7 min
The Text Based Console Part 1- An Overview
Video | 7 min
Text Based Console Part 2 - An Overview
Video | 5 min
The ISE (Intelligent Scripting Environment) Part 1
Video | 5 min
The ISE (Intelligent Scripting Environment) Part 2
Video | 5 min
Use the OGV Command to Easily View console data!
Video | 6 min
Getting Help and Finding Commands • 39min
0 / 6 lessons complete
Getting Help and Finding Commands Part 1
Video | 7 min
Getting Help and Finding Commands Part 2
Video | 3 min
Getting Help and Finding Commands Part 3
Video | 4 min
Help System LAB Questions
Video | 6 min
Help System Lab Answers 1-4
Video | 9 min
Help System Lab Answers 5-9
Video | 10 min
PowerShell Command Syntax • 33min
0 / 5 lessons complete
Command Syntax Part 1
Video | 8 min
Command Syntax Part 2
Video | 8 min
Command Syntax Part 3
Video | 5 min
Command Syntax Lab Questions
Video | 4 min
Command Syntax Lab Answers
Video | 8 min
PowerShell Objects and Properties • 35min
0 / 6 lessons complete
Objects, Properties and Methods Part 1
Video | 3 min
Objects, Properties and Methods Part 2
Video | 8 min
Objects, Properties and Methods Part 3
Video | 7 min
Questions 1-9 for Objects, Properties and Methods
Video | 2 min
Answers to Questions 1-7 O-P-M
Video | 11 min
Answers to Questions 8,9 O-P-M
Video | 4 min
The PowerShell Pipeline • 24min
0 / 2 lessons complete
PowerShell Providers • 30min
0 / 5 lessons complete
What are PowerShell Providers
Video | 3 min
Using PS Drive
Video | 6 min
PowerShell Provider CMDlets -1
Video | 12 min
PowerShell Providers CMDlets -2
Video | 7 min
Student Assignments
Text | 2 min
PowerShell Arrays and Variables • 28min
0 / 4 lessons complete
PowerShell Variables
Video | 9 min
PowerShell Arrays
Video | 12 min
PowerShell Variables Challenge
Video | 2 min
PowerShell Variables Solution
Video | 5 min
PowerShell Loops • 19min
0 / 3 lessons complete
PowerShell Conditional Statements • 11min
0 / 1 lessons complete
On Premises Lab Setup • 36min
0 / 8 lessons complete
Should You Watch This Section?
Video | 2 min
Downloading and Installing VirtualBox
Video | 2 min
Downloading Windows Server 2019
Video | 3 min
Creating Your Virtual Network
Video | 2 min
Creating Your Virtual Machines
Video | 7 min
Installing VirtualBox Guest Additions
Video | 2 min
Installing Windows Server
Video | 8 min
Installing the Active Directory Domain Services Role
Video | 10 min
Basic Domain Administration with Windows PowerShell • 2hr 27min
0 / 10 lessons complete
Configuring PowerShell Execution Policy with Group Policy
Video | 13 min
Installing Windows Server Roles and Features with Powershell
Video | 6 min
Running Powershell Scripts as Scheduled Tasks
Video | 8 min
Creating Organizational Units with Powershell
Video | 11 min
Creating and Managing Active Directory User Accounts with PowerShell
Video | 19 min
Move all AD Users in a Group to a Specific Organizational Unit
Video | 7 min
Generate a list of AD Users and their OU
Video | 5 min
PowerShell Splatting
Video | 5 min
Bulk Install Windows MSU Files Automatically with PowerShell
Video | 13 min
Lab: Domain Administration with Windows PowerShell
Lab | 60 min
Send Emails with PowerShell • 22min
0 / 2 lessons complete
Send Emails from Gmail with PowerShell
Video | 9 min
Create Password Expiration Notification Script
Video | 13 min
PowerShell Desired State Configuration (DSC) Basics • 1hr 48min
0 / 6 lessons complete
DSC Overview
Video | 9 min
Enabling PSRemoting with Group Policy
Video | 9 min
The DSC Resource Kit
Video | 7 min
Configuring The Local Config Manager for DSC Push
Free lesson
Video | 14 min
Uninstalling Windows Features with DSC
Video | 9 min
Lab: Desired State Configuration (DSC)
Lab | 60 min
Course Conclusion • 1min
0 / 1 lessons complete
Sign up to access this lesson
Click here to sign up and get access to this lesson!

Saving Progress...
In this lecture, I am going to show you how to create scheduled tasks to run your PowerShell scripts at a specific time on a general basis or just one time whatever the case might be.
So, what we are going to do is we are going to create a simple script that is going to add data to a text file and we are going to call the script to run every minute so that it gives us a good example how to create the scheduled tasks, how to write the scripts, and how to get them to execute.
So, the first thing we are going to do is open the PowerShell editor by hitting Start in the bottom left corner.
Now, I am going to type in powershell, and we are going to run the PowerShell Intelligent Scripting Environment or PowerShell ISE.

Once this loads we can begin writing the script.

We are going to do a simple single-line command that is going to add some text followed by the date. Let’s start with the following and press Play.
$date = date
$content = “This is some cool content $date”

In the bottom pane if we type:
echo $content
This is the result we are going to get each time.

Now, what we need to do is continue editing adding:
$date = date
$content = “This is some cool content $date”
Add-Content C:\Scripts\Content.txt “$content”
exit
Click File > Save to save the script.

And, we are going to This PC > C:\ > and create a new folder called Scripts and name it AddContent.ps1. Click on Save.

Now, if we navigate to the C:\Scripts folder and run the script we should have a new text file called Content.txt

If we open this text file we can see the following:

If we execute the PowerShell script it should add another line. And, we can see the time difference when it was executed.

What I am going to do now is delete the Content.txt and close PowerShell ISE.
Now that we have the script created we need to create a scheduled task to call the script to run every minute or so.
I am going to do that by going to Server Manager > Tools > Task Scheduler

Left-click on the Task Scheduler Library and select Create Task…

In the Name type AddContent trying to keep the naming consistent with what we are doing. Next, in the Description add This adds some content to a txt file.

The next thing we want to do is Change the User or Group, or the user that is running the script. In the search box type Administrator and click on Check Name and select the user account Administrator. Generally, you would want to create a special user account for when you are making scheduled tasks, you generally don’t want to use the Administrator account, and more than that you don’t want to use your own user account.
If I were to set a scheduled task for something like Windows Backup and my user account got locked out because I typed in the wrong password too many times then all the scheduled tasks are going to fail because that user account is locked out.
So, it's generally important that you create a new user account that will have the least amount of privileges necessary for it to complete the running of the script or the operation of the script.
Now, I am using the Administrator account because I don’t want to go through all the work and the hassle of creating a new user account for this simple demonstration, but just keep that in mind for the future.
Sign up to access the rest of this lesson
You must either log in or sign up to access this lesson.

Saving Progress...