Prevent a script from running without the required module dependencies Add the comment at the top of the script: #Requires -Modules <Module-Name> Running the script without the required modules available will cause an error and prevent the script from running. See Microsoft Learn | About Requires