0%

0/1 Lessons

Course Introduction

• 5min

0 / 2 lessons complete

Getting Started with Windows PowerShell

• 56min

0 / 8 lessons complete

Getting Help and Finding Commands

• 39min

0 / 6 lessons complete

PowerShell Command Syntax

• 33min

0 / 5 lessons complete

PowerShell Objects and Properties

• 35min

0 / 6 lessons complete

The PowerShell Pipeline

• 24min

0 / 2 lessons complete

PowerShell Providers

• 30min

0 / 5 lessons complete

PowerShell Arrays and Variables

• 28min

0 / 4 lessons complete

PowerShell Loops

• 19min

0 / 3 lessons complete

PowerShell Conditional Statements

• 11min

0 / 1 lessons complete

On Premises Lab Setup

• 36min

0 / 8 lessons complete

Basic Domain Administration with Windows PowerShell

• 2hr 27min

0 / 10 lessons complete

Send Emails with PowerShell

• 22min

0 / 2 lessons complete

PowerShell Desired State Configuration (DSC) Basics

• 1hr 48min

0 / 6 lessons complete

PowerShell Modules

• 58min

0 / 7 lessons complete

Powershell Challenges

• 1hr 55min

0 / 23 lessons complete

Section Overview
Full Access Account Required

Video | 5 min

The Trusted Hosts List Challenge
Full Access Account Required

Text | 5 min

The Trusted Hosts List Answer
Full Access Account Required

Video | 5 min

Starting a Remote Session Challenge
Full Access Account Required

Text | 5 min

Starting a Remote Session Answer
Full Access Account Required

Video | 5 min

Rename a Computer Challenge
Full Access Account Required

Text | 5 min

Rename a Computer Answer
Full Access Account Required

Video | 5 min

Change a Password on a Remote Computer Challenge
Full Access Account Required

Text | 5 min

Change a Password on a Remote Computer Answer
Full Access Account Required

Video | 5 min

How to Copy Files To-From a Remote Machine Challenge
Full Access Account Required

Text | 5 min

How to Copy Files To-From a Remote Machine using VSC Answer
Full Access Account Required

Video | 5 min

How to Export Logs to a CSV File Challenge
Full Access Account Required

Text | 5 min

How to Export Logs to a CSV File Answer
Full Access Account Required

Video | 5 min

How to Create Multiple Folders on the Host Machine using Powershell
Full Access Account Required

Text | 5 min

How to Create Multiple Folders on the Host Machine using Powershell Answer
Full Access Account Required

Video | 5 min

Who Rebooted the Server ID1074 Challenge
Full Access Account Required

Text | 5 min

Who Rebooted the Server
Full Access Account Required

Video | 5 min

How can you get Info on all your Hard Drives Challenge
Full Access Account Required

Text | 5 min

How can you get Info on all your Hard Drives Answer
Full Access Account Required

Video | 5 min

How can I get a list of CPU's and Installed Printers, Last Boot-up Time Challenge
Full Access Account Required

Text | 5 min

How can I get a List of CPU's and Installed Printers, Last Boot-up Time Answer
Full Access Account Required

Video | 5 min

How can I Automate Tasks with Task Scheduler Challenge
Full Access Account Required

Text | 5 min

How can I Automate Tasks with the Task Scheduler Answer
Full Access Account Required

Video | 5 min

Course Conclusion

• 1min

0 / 1 lessons complete

Creating a Custom PowerShell Module: Files and Folders

Instructions

Q&A (0)

Notes (0)

Resources (1)

Saving Progress...

Notes can be saved and accessed anywhere in the course. They also double as bookmarks so you can quickly review important lesson material.

Create note

 Now it's time to create a PowerShell module, and we're going to get started by creating the files and folders that we're going to need for this module. And this is actually really exciting because this is a pretty advanced topic, but I'm going to break it down in such a way that anybody can get started doing this again.

You want to make a module whenever you find yourself reusing code over and over again, and maybe different function files or maybe different scripts that you have. Maybe you have a function that you use multiple times throughout multiple scripts. Well, maybe it's time to look at creating your own personal module.

So to get started, what we're going to do is just open PowerShell. And again, I'm running it as an administrator. What we're going to do is find the actual folder path that Where we're going to be installing or creating this module. So again, the environment colon PS module path. This is something that we've done before.

I like to split this dot split, and I like to split it by the semi-colon just because it puts each module path on a single. Now I have this. He uses administrator documents. PowerShell. If I copy this path. I can browse to it. If you get an error message saying you can't browse to this directory, copy back one directory, and just don't do the modules, do the one back, and then you probably have to manually create the modules folder.

It probably just doesn't exist yet. So what we're gonna do… is create our own folder here, and we're going to make a module that is going to compose a kind of like a hello world message or a greeting message that it just gives us a good example of how to create PowerShell modules. We're going to call this module GreetMe, so I'm going to right-click and say new folder, and I'll call it GreetMe.

Now the name of the actual folder does matter. It needs to match the PSM 1 file that we will create inside the folder. Remember, if you name this something else, you need to update all the other names of the files to make sure that it matches. So I would recommend that you just give it the same name.

You'll save yourself a lot of time. All right. Now that we've done that, what I'm going to do is right-click and use open with code. And what this is going to do, it's going to open the folder in visual studio code. And the first thing we're going to see is do you trust the authors of the files in this folder?

I will say yes; I trust the authors of all files and the parent folder modules. What this means is that I won't have to get this pop up for anymore. Modules that I create or any more modules that I copy into this directory. So if you're uncomfortable doing that, you don't have to check it.

It's totally up to you. I'm going to check it, and I'm going to say, yes, I trust the authors because I am the author. So now what I'm going to do is maximize this, and we're going to get started by creating some of the folders here. The first thing we're going to do is make a new folder, and we're going to call this public.

And this is where all of our public functions are going to go we want to be accessible from outside the module, which means when you, when a user imports our module. What functions are they going to have access to? That's going to be all the functions that we placed inside this public folder.

Server Academy Members Only

Sorry, this lesson is only available to Server Academy Full Access members. Become a Full-Access Member now and you’ll get instant access to all of our courses.

0 0 votes
Lesson Rating
Subscribe
Notify of
profile avatar
0 Comments
Inline Feedbacks
View all comments