UNABLE TO USE CLASSES FROM MODULE

This topic contains 1 reply, has 2 voices, and was last updated by  Richard Siddaway 2 months, 3 weeks ago.

  • Author
    Posts
  • #94845

    SYOB SYOT
    Participant

    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

    Richard Siddaway
    Moderator

    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

You must be logged in to reply to this topic.