This topic contains 2 replies, has 2 voices, and was last updated by
October 21, 2013 at 4:13 am #10934ParticipantPoints: 0Rank: Member
I have 3 powershell scripts that I created. Now, I want to deploy them to a common server to which various users will have access(using powershell web access) and they can issue cmdlets that I created.
Initially I thought, it would be a pretty simple process. But may be I was wrong or may be I am missing something.
To create a Script module, I copied all my scripts into a single psm1 file.
Next step was how to make sure this is registered. I followed below post to register the module file.
But for some reason I am still not able to see my cmdlets in new session. Are there any clear steps i can follow or what is it i am not doing correctly.
Again, i was not able to edit the PSModulePath using the script in above link so i edited the env variable manually and added my module path. Still i dont see my cmdlets. Please help!
Thanks for the anticipation in advance.
October 21, 2013 at 6:02 am #10938KeymasterPoints: 1,639Rank: Community Hero
What matters is WHERE and HOW you edited your PSModulePath environment variable. You can't do it from within PowerShell – that won't change anything more than the current session. You need to persistently change PSModulePath by changing it from the Windows Control Panel or via GPO.
And you're technically not "registering" the module. It simply needs to live in a place where PowerShell knows to look for it, if you want module auto-loading and auto-discovery to work.
You should be able to open a new shell session, run "$env:psmodulepath", and see your revised PSModulePath. If you don't, then you need to solve that.
October 21, 2013 at 7:55 pm #10966ParticipantPoints: 0Rank: Member
Thanks for the reply. May be i was not explicit in my last line of previous post for setting environment variable. I have set the environment variable manually from control panel.
Now, When i run $env:PSModulePath in a new session of powershell I could see my path there.
But not sure if that path is getting scanned or not, i dont see my modules being registered.
I also tried adding export-modulemember -function
Not sure what else i am missing.
The topic ‘Creating Script Modules’ is closed to new replies.