How to Write a PowerShell Module in visual studio 2017

Create an project in visual studio, let’s call it MyPmTest

Try to build you solution and import the module.

Start a PowerShell prompt

Write Import-Module .\ MyPmTest.psm1

If success Write Get-Module

You can see the default Get-Function already.

Change to visual studio and change you function name

rebuild your solution and reimport the module.

Start a PowerShell prompt

Write Import-Module .\ MyPmTest.psm1

If success Write Get-Module

You can now see that you default Get-Function are gone and you got 2 new functions

Get-MyTest01 and Get-MyTest02

Try to write Get-MyTest01 and Get-MyTest02

Congrats you have created your first PowerShell module and imported it and run 2 function.

Not bad for 5 minutes’ work.