A: Typically, Windows PowerShell scripts are saved as ps1 files. However, if a file is saved as a psm1 file, it can be treated as a module.

You need to ensure your script has functions defined in it that will become the cmdlet names used. For example,

function Wakeup-Machine<br>
all your existing code}<br><br>

The psm1 file must be saved in a location that's searched when PowerShell starts and that can be viewed and changed via the PSModulePath environment variable.

Additionally when a PowerShell instance starts, your My Documents\WindowsPowerShell\Modules folder is automatically added to the path.

This means if you create a subfolder WindowsPowerShell\Modules within your My Documents folder, you can save your psm1 files to that folder, and they will automatically be available via a 'get-modules -listavailable' and then loaded as required using import-module. To learn more about PowerShell, see our PowerShell FAQs. You might also want to read  "Top 10 Active Directory Tasks Solved with PowerShell."