Skip to main content

How to Create About_ Conceptual Help Files for Your Modules

First off, I want to thank Gaby Kaplan from Microsoft and the PowerShell team for helping find this path to success. 

I needed to find a very simplistic way of creating conceptual help files for my PowerShell modules.  Some of this code gets sent to my students after my PowerShell classes and I like to provide as much information as I can.  You will recognize conceptual help files because they start with About_.  So, here we go.

Step 1. Create a text file in the same directory as your script module.  Mt module is stored in my user account’s Documents\WindowsPowerShell\Modules\PSV3. PSv3 is the name of the module that I will be sending to my class.

Step 2. Name the file correctly. The syntax is About_NameOfYourConcept.help.txt.

Step 3. Add the content to the text file and save it.

Step 4. Import the module.  Whoa!!!! Wait a second. in PowerShell V3, we had auto loading of all of our modules.  That is true and this is what kind of messed me up a bit.  Thanks to Gaby’s time and patience, she was able to find the reason for this.  You will need to import the module manually. In PowerShell V4, you do not.  This is what the PowerShell Project Manager sent to Gaby:

Prior to PowerShell 4.0, the module must be imported into the current session in order for Get-Help to find the topic. This is because Get-Help only looks in $pshome and loaded module folders for About topics. We improved this in PowerShell 4.0 so that the module no longer needs to be imported / loaded. Get-Help will look in all module folders under PSModulePath for a matching About topic.

The PowerShell PM also noted that if you store your help file in the $PSHOME folder, it will be deleted during servicing.

So, in walks Hyper-V and some virtualization.  Utilizing a preview copy of Windows 8.1, I gave this a try.  Like I said, preview copy.  This capability is not there just yet, so I’m going to wait for the full release.

To see what else is new in V4, check out What’s New in PowerShell.

If you would like to give the Windows 8.1 preview a try (as well as PowerShell V4) follow this link to Microsoft.

Comments

Popular posts from this blog

How to list all the AD LDS instances on a server

AD LDS allows you to provide directory services to applications that are free of the confines of Active Directory.  To list all the AD LDS instances on a server, follow this procedure: Log into the server in question Open a command prompt. Type dsdbutil and press Enter Type List Instances and press Enter . You will receive a list of the instance name, both the LDAP and SSL port numbers, the location of the database, and its status.

How to run GPResult on a remote client with PowerShell

In the past, to run the GPResult command, you would need to either physically visit this client, have the user do it, or use and RDP connection.  In all cases, this will disrupt the user.  First, you need PowerShell remoting enabled on the target machine.  You can do this via Group Policy . Open PowerShell and type this command. Invoke-Command –ScriptBlock {GPResult /r} –ComputerName <ComputerName> Replace <ComputerName> with the name of the target.  Remember, the target needs to be online and accessible to you.

Where did a User’s Account Get Locked Out?

Updated: May 15, 2015 When this article was originally published, two extra carriage returns were add causing the code to malfunction.  The code below is correct.   My client for this week’s PowerShell class had a really interesting question. They needed to know where an account is being locked out at. OK, interesting. Apparently users hop around clients and forget to log off, leading to eventual lock out of their accounts. The accounts can be unlocked, but are then relocked after Active Directory replication. This problem is solved in two parts. The first one is to modify the event auditing on the network. The second part is resolved with PowerShell. The first part involves creating a group policy that will encompass your Domain Controllers. In this GPO, make these changes. Expand Computer Configuration \ Policies \ Windows Settings \ Security Settings \ Advanced Audit Policy Configuration \ Audit Policies \ Account Management Double click User Account Management C...