I have a simple script to get-vm and re-scan storage on my esxi.
When I run the ps1 script from powercli commandlline,everything is ok.
Then I create a shortcut on the desktop run the script.
it alwasy show something like 'xxx' property is obsolete. Use 'xxx' instead.
your thread has been moved from VMware ESXi™ 4 to VMware vSphere™ PowerCLI
These messages are just warnings, you can ignore them.
Would you mind showing what is specified in the shortcut ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks LucD. It's pretty new to me.
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -psc "C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1" C:\abc.ps1
Is that the right ?
and the first line of ps1 is
Add-PSSnapin VMware.VimAutomation.Core
The console file vim.psc1 will already load the PowerCLI snapin, so there is no need to do this in your script.
The difference between the PowerCLI prompt and your shortcut is that the prompt will define some functions and aliases with the Initialize-PowerCLIEnvironment.ps1 script. But afaik, you do not need that script if you don't plan using those functions or aliases.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference