Last active
January 2, 2016 03:39
-
-
Save deryni/8244997 to your computer and use it in GitHub Desktop.
Alright powershell people. Explain this behaviour to me if you would.
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
PS> help .\test.ps1 | |
test.ps1 [-FirstParam] <Object> [-SecondParam] <Object> [<CommonParameters>] | |
PS> .\test.ps1 -fi<tab> | |
# Nothing happens at all. | |
PS> .\test.ps1 | |
.\test.ps1 : The script 'test.ps1' cannot be run because the following snap-ins that are specified by the "#requires" | |
statements of the script are missing: VMware.VimAutomation.Core. | |
... | |
PS> Add-PSSnapin VMware.Vimautomation.Core | |
PS> .\test.ps1 -fi<tab> | |
# Completes to: | |
PS> .\test.ps1 -FirstParam |
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 -PSSnapin VMware.VimAutomation.Core | |
Param ( | |
[Parameter(Mandatory = $True)] | |
$FirstParam, | |
[Parameter(Mandatory = $True)] | |
$SecondParam | |
) | |
Write-Host "Running." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment