Creating a PowerShell Module Manifest and Importing our Custom Module
Full-Access Members Only
Sorry, this lesson is only available to Server Academy Full-Access members. Become a Full-Access member now and get instant access to this and many more premium courses. Click the button below and get instant access now.
Instructions
Q&A (0)
Notes (0)
Resources (0)
Saving Progress...
Resources
There are no resources for this lesson.
Notes can be saved and accessed anywhere in the course. They also double as bookmarks so you can quickly review important lesson material.
Click the toggle below to show the full source code of the completed Module Manifest:
GreetMe.psd1 - Completed Source Code
In this lesson, we're going to be creating our PowerShell module manifest file, and this is any file with the psd1 extension. Now, I want you to know that you can automatically create this by using the new module manifest. Yeah, if I do that, and I give it a path and just call it greet me 2. psd1. This is going to create a manifest for us, but there's a couple of things I don't like about this. For example, we lose our ability to automatically dot source inside of our public and private folders.
We have to actually call them out one by one. So under functions to export, I would have to go here to greet get greeting message and paste that directly in here. It's not the end of the world, but it's not the way that I want to set it up and also has a lot of information that we don't frankly that we frankly do not need.
So I'm just going to delete this and we're just going to create this guy manually. So let's go to greetme. psd1 and I have a link to the documentation here. So if we copy this link and I open my web browser and we browse through this link, what's going to happen is we're going to get all of the actual parameters that we can pass this.
Okay. And we're just going to be using some of these. But I just wanted you to be aware that here's the full list if you want to do this yourself or you want to add you know, specific things in here. So what we're going to do is go over here, get rid of the to do, and we're simply going to create a A hash table by doing the at sign, open curly brace, press enter, and we're just going to pass a couple of values inside of this hash table.
And the first is going to be module version, and that's going to be equal 0. 1. Now, if I go back here, I can hit control F and look for module version. And if I keep hitting the up arrow, I'll probably get to where the first occurrence of this is. This is gonna give us more information about the element itself as well as what kind of values we can pass to it and things like that, and, you know, it gives us examples which could be very useful. So if you wanted to, you know, you can browse through this and populate all the data that you want, but again, we're just gonna do a handful of things.
One of the ones that is really important is route module, and that's gonna be equal to our PSM one file. So greet me dot psm one. Next, we'll do a description, and this is going to be a simple module to generate personalized messages. And the author is going to be Paul Hill and company name is Server Academy. And we can do, why not help info URI and that's U R I is equal to HTTPS. Just putting out a link here, serveracademy. com, which is our website. Okay, so if I hit control S we can validate that this is actually correct by doing the test module manifest and then giving it the name greet me.
psd1. And it's going to tell me if the module manifest is valid. Now if I put in something in here that isn't valid, like invalid, I don't know, key, equals, It's going to actually throw a fit. So if I do the same thing, press the up arrow and press enter, it's going to show me this error. And it's going to say module cannot be imported because it's manifest contains one or more members that are not valid.
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.