Skip to content

Instantly share code, notes, and snippets.

@deryni
Last active January 2, 2016 03:39
Show Gist options
  • Save deryni/8244997 to your computer and use it in GitHub Desktop.
Save deryni/8244997 to your computer and use it in GitHub Desktop.
Alright powershell people. Explain this behaviour to me if you would.
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
#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