Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 8583

Is this a bug with function definitions?

$
0
0

Can anyone explain why the below code works when saved as a script?

function Get-Test {
 Write-Host "In function"
}

Test

The call to the function should be Get-Test. The above code should generate an error but doesn't.

It seems to only work when the Verb on the function name is Get. Anything else generates an error as expected. I've successfully run the code in PS version 2 and 3 at the command line and PS v3 ISE.

 


Viewing all articles
Browse latest Browse all 8583

Trending Articles