This topic contains 5 replies, has 2 voices, and was last updated by
October 12, 2017 at 6:24 pm #81932
I wrote a module with a bunch of functions and I also wrote several tools that use those functions. The tools are also functions. I need to share the module and tools with my team and I want the tools to be easy to access so I added them to the module. That allows a user to type verb-toolname and not have to dot source the script from another location to run the tool. I wanted to get others thoughts on this to see what others do or have done.
October 12, 2017 at 7:02 pm #81934
Yep, that's the way to do it! Module with all your stuff in it. If you wanted to get really fancy you could look into setting up a private nuget server to host your modules, then you could use stuff like install-module and find-module to download and install the module, rather than dealing with copying your module folder around.
Edit: Also, if you're not already, now would be a great time to look into putting your module code into some sort of source control system. If you're in a windows shop maybe check with your devs to see if they use TFS. They can carve you off a team site and set up a GIT repository easily enough.
October 12, 2017 at 11:08 pm #81962
Thanks, that reassures that my tools can also be in my module.
I created a network module repository and wrote a "setup" script for my team to use to register the repository. I added a script in the module to update modules in the repository once a week. the "setup" script creates a PS profile and adds a line to it to run the update script. So whenever the console runs it will run update-module against all modules that are in the repository.
Source Control is something I really need to get into. I'm not there yet, but its on my moving up list. Platyps is also something I need to work on too.
October 13, 2017 at 2:39 am #81967
I had a similar process with a network share, trying to keep it all updated. Your solution sounds better than what I had, seems like whatever I tried just resulted in files all over the place and my session would take forever to load. If you've done any downloads from the powershell gallery with the powershellget commands it's pretty clean.
Find-Module Platyps | install-module -scope currentuser
might be one to try out. You get hooked on that and it's hard to go back to a network share.
Oh and on the topic of PlatyPS, it's pretty awesome. If you already have the comment-based help written for each function, it's literally two commands to convert everything over.
October 13, 2017 at 12:56 pm #81986
I know the PowerShell Scriting and Toolmaking book covers PlatyPS. I fumbled through using it, but was hoping to find additional documentation about it (tutorials, or guides). Ironically the PlatyPS help documentation seems slim.
October 13, 2017 at 3:39 pm #82007
The topic ‘Script and Module Best Practice question’ is closed to new replies.