Quantcast
Channel: Hey, Scripting Guy! Blog
Viewing all articles
Browse latest Browse all 3333

PowerTip: Require Specific Module in PowerShell Script

$
0
0

Summary: Learn how to require a specific module in a Windows PowerShell script.

Hey, Scripting Guy! Question How can I prevent a Windows PowerShell script from running if it requires the Active Directory module
           and the module is not available?

Hey, Scripting Guy! Answer At first line of the script, use the #Requires statement to require the Active Directory module:

#Requires –Modules ActiveDirectory


Viewing all articles
Browse latest Browse all 3333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>