Please feel free to provide feedback or file bugs here.

New #requires parameters: -DotSource/-CallOperator, to allow script authors to indicate how the script must be invoked

Votes from Connect: 8

Original Date Submitted: 11/5/2015 5:13:13 AM

Description:
********Contact Information********
Handle: Kirk Munro
Site Name: PowerShell
Feedback ID: 1981963
***************************************

Problem Description:
Scripts are designed to be either dot-sourced, called, or much less often, both. Yet the vast majority of scripts out there don't have anything in place to make sure that they were invoked the right way. This can lead to a lot of confusion for script consumers that could be easily avoided.

I would like to see the #requires statement expanded with the addition of two new parameters: -DotSource and -CallOperator. When a script is invoked, PowerShell will check to see what the script requires (what invocation methods it supports), and if the invocation method that was used isn't supported by the script, then PowerShell could display an appropriate error message to the user so that they can invoke it correctly.

Product Studio item created by Connect Synchronizer due to creation of feedback ID 1981963 (http://connect.microsoft.com/PowerShell/feedback/ViewFeedback.aspx?FeedbackID=1981963).

Repro Steps:

Internal BugId: 15952

3 votes
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    Signed in as (Sign out)

    We’ll send you updates on this idea

    AdminJoey Aiello [MSFT] (Program Manager, Windows Server) shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    0 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      Submitting...

      Feedback and Knowledge Base