Author Posts

March 1, 2018 at 4:19 am

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.

March 1, 2018 at 12:35 pm

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