UNABLE TO USE CLASSES FROM MODULE

Welcome Forums General PowerShell Q&A UNABLE TO USE CLASSES FROM MODULE

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

 
Participant
8 months, 3 weeks ago.

  • Author
    Posts
  • #94845

    Participant
    Points: 0
    Rank: Member

    HELLO PEOPLE,

    I AM TRYING TO USE CLASS DEFINED IN A MODULE INSIDE A POWERSHELL SCRIPT. ALL INTERNET RESOURCES I HAVE FOUND INDICATE THAT THIS CODE SHOULD WORK. BUT IT DOES NOT IN MY CASE.
    C:\TEST.PSM1:

    CLASS TEST{}
    

    C:\TEST.PS1:

    USING MODULE C:\TEST.PSM1;
    [TEST]
    

    WHEN RUNNING THIS SCRIPT, I GET ERROR SAYING THAT TEST IS NOT DEFINED. BUT I HAVE READ INTERNET POSTS ABOUT USING THIS SYNTAX, AND IT WORKES IN THOSE POSTS. I DO NOT KNOW WHY IT DOES NOT WORK FOR ME.

    HAVE ANY IDEA? IS MY POWER SHELL BROKEN?

    FOR ANY POTENTIAL REPLYS, THANK YOU.

  • #94873

    Participant
    Points: 0
    Rank: Member

    I can't reproduce your problem as your code works for me in both ISE and PowerShell console.

    Please stop using all capital letters in your posts it makes them more difficult to read

The topic ‘UNABLE TO USE CLASSES FROM MODULE’ is closed to new replies.