Long time, no see. Last week I attended the AWESOME PSConfEU 2016. Boy (and girl), what a great event, with a lot of fantastic people and exciting topics. Might be a good time to restart my daily tip series :)
Today I want to show, how we can ensure that a PowerShell script will only run, if a specific module exists on the machine.
It is very simple: we can use the #Requires statement - and I encourage you to read the help site, because there a few other parameter available.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Requires -Modules DoesNotExist | |
'Do Something' |
Keine Kommentare:
Kommentar veröffentlichen