Register custom module not loaded

Welcome Forums General PowerShell Q&A Register custom module not loaded

This topic contains 1 reply, has 2 voices, and was last updated by

 
Moderator
5 months, 2 weeks ago.

  • Author
    Posts
  • #128469

    Participant
    Topics: 9
    Replies: 17
    Points: 88
    Rank: Member

    Hi, I wrote a custom module, then reistered it, as I understand

    1-  created a directory in with the same name of the function in

    C:\Windows\System32\WindowsPowerShell\v1.0\Modules

    2 – save the file as psm1 in this directory as "MyFunction-Salam.psm1" , fired PowerShell, when I try to execute the function I get

    The term 'MyFunction-Salam' is not recognized as the name of a cmdlet

    when I issue

    Get-Module -ListAvailable

    I can see my module in the list under

    C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules

    Here is the body of the fucntion

    function global:MyFunction-Salam
    {
    param(
    [Parameter(Position=0,mandatory=$true)]
    [string[]] $FileLocation
    )

    Code Code Code

    Write-Output " $i File Inserted successfully... Below Is list of files"

    }

    Do I need to restart the machine

  • #128484

    Moderator
    Topics: 8
    Replies: 809
    Points: 2,385
    Helping Hand
    Rank: Community Hero

    Well, I (and whoever going to reply after me) will suggest you to take some time to go through some basics. You can read below blog post by Kevin as a quick reference. "Learn PowerShell in a Month of Lunches" is the best recommended book to start with.

    https://kevinmarquette.github.io/2017-05-27-Powershell-module-building-basics/

The topic ‘Register custom module not loaded’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort