Automation

 View Only
  • 1.  Is there anyway to shared a connection from different shell?

    Posted Jul 06, 2011 12:50 AM

    Let's say I first do a Connect-VIServer, then i can do a Get-VMHost.  However, if I open another powershell window, the previously connected VIServer no longer exists.  Is there anyway to overcome this?  I am working on a multi-process script and I really don't want to connect/disconnect every time.



  • 2.  RE: Is there anyway to shared a connection from different shell?

    Posted Jul 06, 2011 01:38 AM

    This seems to be issue with your login account. I tried  get-esx to esxi server with root account and I was able to access powershell multiple windows. Its also working fine with connect-VIserver command.



  • 3.  RE: Is there anyway to shared a connection from different shell?

    Posted Jul 06, 2011 04:01 AM

    I am also using root access to the esxi server, but I don't see a connection can be shared from different shell.  By the way, how do you launch the shell?  I am using the PowerCLI shortcut on the start menu.



  • 4.  RE: Is there anyway to shared a connection from different shell?
    Best Answer

    Posted Jul 06, 2011 05:35 AM

    That is normal behaviour, if you start a new PS session, you have a new environment.

    All the variables you have in a specific PS session, are unique to that session. They are not copied to a new session you start from within the first session.

    You can start new sessions from within a PS session by executing the powershell.exe command or by executing the Start-Job cmdlet.

    And you could use for example environment variables to pass information between the scripts.



  • 5.  RE: Is there anyway to shared a connection from different shell?

    Posted Jul 06, 2011 06:23 AM

    Thanks for clarifying this!