r/PowerShell • u/samurai_ka • Dec 17 '25
Question Multiple files
Unfortunately, large PowerShell scripts cannot easily be distributed across multiple files in a project. What is your best strategy for this?
5
Upvotes
View all comments
Show parent comment
1
u/BlackV Dec 17 '25
when you say
what do yo mean ?
cause if I do
connect graphit only lids themggraph.authenticationmodule not all themggraphmodulessame if I get
azvaultits not going to load all the AZ modulesif you are using
import-module mggraph(vsimport module mggraph authentication version xxx) then you're causing your own issues not powershellI mean there are another couple of steps
but saving the change to the module and using import module force would reflect that change straight away, same as you saving the change to your script file
as they would with the step of re-importing the module
yes I did figure that was the case
My opinion is id rather write a module which is consistent with the existing way other people write and distribute code/modules
my stuff starts out as a script (normally) just like yours then I wrap a function/module when i "procuctionise" it
end of the day though, if a script works better for you, its works better for you and that's perfect too
your added detail (and logic) wasn't in the first comment and makes your workflow more understandable
p.s. excuse fake code, I'm on mobile