Hi,
As a newbe I'm running into the fact that I cannot start the VI-toolkit for Windows from powershell. Starting the VI-toolkit directly works fine but starting a cmdlet with
Add-PSSnapin VMware.VimAutomation.Core
Initialize-VIToolkitEnvironment.ps1
followed by any VI-toolkit command (for example Get-VICommand) gives the notification : The term 'Get-VICommand' is not recognized as a cmdlet, function, operable program, or script file. Verify the term and try again.
As far as I know I needs this to be able to schedule cmdlets.
I'm running VI-toolkit with 113525 (SP1) + VC 2.5.0 (built 119598) + ESX 3.5.0
Any help woul be appreciated! :smileygrin:
Thanks Peter.
Get-VICommand is a function that is set in the environment script. You can see if it was created by doing dir function:Get-VICommand.
My guess is that this script is not being loaded properly. You may want to try "sourcing" the file, especially if you are using it in your profile.ps1 startup script.
This is what my profile.ps1 contains regarding VMware (note the space after the . in the second line):
Add-PSSnapin VMware.VimAutomation.Core
. "C:\Program Files\VMware\Infrastructure\VIToolkitForWindows\Scripts\Initialize-VIToolkitEnvironment.ps1"
Are you sure the Initialize-VIToolkitEnvironment.ps1 script is executed ?
Check if the aliases are there
Get-Alias Get-VIServer Get-Alias Get-VC Get-Alias Get-ESX
And note that there is no cmdlet Get-VICommand in the VITK.
Try something else like for example
Get-VIToolkitVersion
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Get-VICommand is a function that is set in the environment script. You can see if it was created by doing dir function:Get-VICommand.
My guess is that this script is not being loaded properly. You may want to try "sourcing" the file, especially if you are using it in your profile.ps1 startup script.
This is what my profile.ps1 contains regarding VMware (note the space after the . in the second line):
Add-PSSnapin VMware.VimAutomation.Core
. "C:\Program Files\VMware\Infrastructure\VIToolkitForWindows\Scripts\Initialize-VIToolkitEnvironment.ps1"
Thank you for your input LUCD and ewannema!
When I tried again this morning with something simple like GET-VIToolkitVersion it worked!
When I added
. "C:\Program Files\VMware\Infrastructure\VIToolkitForWindows\Scripts\Initialize-VIToolkitEnvironment.ps1"
the GET-VICommand also worked.
Thanks Guys!