Hi,
I am new to this, just wonder is there a way the I can use connect-visserver without typing in the password, but using the use authentication that runs the script?
Currently, I am doing this and it works fine:
Connect-VIServer -Server Bla.domain.com -Password blapass
What I want to do is this
Connect-VIServer -Server Bla.domain.com
And it should log me in without asking username or password.
FYI, I am on Windowser Server 2003, 32bit machine.
Thanks,
owz
Yes, that should work. See .
If the user with which you run the Connect-VIServer cmdlet has the required permissions defined on the VC it should work.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
It did not work for me, I am using domain admin account, and there is no permission issue here,
I am getting error if I do this
" connect-viserver -server bla.domain.com"
If I am using the same account from the same prompt, It works perfect and instantly.
"connect-viserver -server bla.domain.com -password pass"
See log below :
PS C:\temp> connect-viserver -server bla.domain.com
There were one or more problems with the server certificate:
A certification chain processed correctly, but terminated in a root certificate which isn't trusted by the trust provi
der.
The certificate's CN name does not match the passed value.
Name Port User
-
-
-
Blaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
PS C:\temp> connect-viserver -server bla.domain.com -password pass
Name Port User
-
-
-
Blaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
Would be usefull if you could describe your environment:
- version VC
- OS version + bit-mode (32/64)
- PowerShell version
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Here is my virtual machine system info, Appreciate your help:
OS Version : Microsoft(R) Windows(R) Server 2003, Standard Edition
Microsoft Windows http://Version 5.2.3790
System Type : X86-based PC
Total Physical Memory: 4025950208
Number Of Processors : 2
PS C:\Program Files\VMware\Infrastructure\VIToolkitForWindows> get-host
Name : ConsoleHost
Version : 1.0.0.0
InstanceId : e54cb0a1-0aa7-4a01-8721-a810fbf066f2
UI : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture : en-US
CurrentUICulture : en-US
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
Powershell vm package was downloaded and installed from here:
Could you also check what version of VC you're running ?
In the VI Client go to <Help><About VMware Infrastructure>.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Here you go, Thanks again!
VM ware infrastructure Client
Version 2.5.0
Build 104215
Strange
The fact that the Connect-VIServer doesn't show a port and server when you use a user and password is not normal.
When I connect I see something like this
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
That is correct, I did see Port number along with server info, I just marked those things off for security reason -:)
I see...
The error message you mentioned in the beginning is that the one about the certification chain ?
You will always get that for the first Connect-VIServer you execute from the shell.
See also my previous screenshot.
If you restart the shell it will be back.
On another track, is the checking of the host certificate disabled ?
In the VI Client go to and set it to verbose.
Then try the Connect-VIServer and check the vpxd log.
Look for entries marked with SSPI.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You are right, the certificate stuff does not mean I am not connected, it is there when the first time login Thanks!
One more question, I want to run my powershell script related to VM ware stuff from the regular command line prompt instead of trigger the script from inside of the VMware VI Toolkit prompt, is there anyway that I can do that?
Here is what I am getting if I trigger the script from regular prompt dos windows:
PS C:\temp> TestStart.ps1
The term 'connect-viserver' is not recognized as a cmdlet, function, operable program, or script file. Verify the term and try again.
Thanks for your help!
That is because the VMware VI Toolkit shortcut also loads the VITK snapin.
You can solve this by using the PowerShell profile.ps1 file.
Add a line like this
Add-PSSnapin -Name "VMware.VimAutomation.Core"
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Working, Thank you very much!
I also found the info from the Administrator's guide, and I am doing this :
Add-PSSnapin VMware.VimAutomation.Core
Initialize-VIToolkitEnvironment.ps1
Again, Thanks much!
Here is what I am getting if I trigger the script from regular prompt dos windows:
Just to make a small correction here for others--what he meant is PowerShell, not "dos".
Author of the upcoming book: Managing VMware Infrastructure with PowerShell
Co-Host, PowerScripting Podcast (http://powerscripting.net)
I'm updating this old thread because a lot of people are viewing it.
If you're looking to connect without typing a password and can't take advantage of SSPI, check out the VI Toolkit Extensions, here there is a function called Connect-Recent that can cache your credentials. I use it all the time, in fact I never use Connect-VIServer anymore.
I'm working on Windows Server 2008 R2 and using the scheduled task. The option "Run with highest privileges" seems to do the trick for me.