PS C:\util> esxi11 esxi11 : The term ‘Connect-VIServer -Server ESXI-11 -user root -password “************”’ is not recognized as the
name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.
At line:1 char:1
Hmmm yes and no. An alias is a shorter version of the command. Not the command including parameters and values. For example gci is short for Get-ChildItem.
I expected this. Did you read the information in the link I posted? You could set -Server ESXI-11 as the default parameter for Connect-VIServer. When you additionally create an alias for Connect-VIServer with the name esxi you wouldn’t have to type that much anymore … only the password would be needed then.
You should complain this to the MS Powershell team.
Edit:
You still could create a function with everything you want in it.
All of the answers and examples are in the docs and blog posts everywhere. You’ve been told several times you can’t save arguments in an alias yet you keep trying. You could potentially save it all like you want in a variable (with parameters, an anonymous function) but that’s very advanced in comparison to the commands you’re already struggling with. I feel you would have a lot more success, and therefore a lot more enjoyment, if you slow down and actually learn how powershell and these Cmdlets work. Read and play around. Break things down into smaller chunks. Best of luck Tom.