The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 4,184 other subscribers

When Powershell function won’t work: you define them with commas and parentheses, but call them with spaces and no parentheses

Posted by jpluimers on 2019/08/15

The function or command was called as if it were a method. 
Parameters should be separated by spaces. For information about 
parameters, see the about_Parameters Help topic.

Every now and then I bump into the above error. The reason is this:

  1. Functions are defined with commas between parameters and parentheses around them
  2. One-parameter functions can be called with one parameter surrounded by parentheses
  3. Multi-parameter functions need to be called with spaces between parameters and no parentheses surrounding them

Confused? #MeToo

The problem: [WayBackabout_Parameters_Default_Values | Microsoft Docs

Based on [WayBack] Powershell function won’t work.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: