IT Process Automation

Expand all | Collapse all

Create VM with run script operator

  • 1.  Create VM with run script operator

    Posted Sep 25, 2017 01:56 PM

    Hi i am trying to create VM (template) using run script operator with powershell script but the operator is getting stuck in running state or giving error that its not a trusted host. The same script works fine when run locally or using PS Session gives desired output. The connector present in tool also does not have an option to create VM with a template.

    Please help me out with this.



  • 2.  Re: Create VM with run script operator

    Broadcom Employee
    Posted Sep 26, 2017 08:30 AM

    When you said "run locally" do you mean from the Process Automation Orchestrator machine?  I ask because the "not a trusted host" error sounds like perhaps a certificate issue that you might not see if you are running directory on the machine instead of remotely (like from the PAM machine).  What is the exact error you see regarding the trusted host?  When does it give this error versus just stay in a running state?  You might also review the c2o.log for any info being logged while the operator is running.



  • 3.  Re: Create VM with run script operator
    Best Answer

    Posted Sep 26, 2017 11:01 AM

    Hi!

     

    Complementing Andrews point, when you run a powershell/powercli, as long as you are running with the right credentials, you don't have to execute anything remotelly, you just connect to the given vcenter.

     

    From vmware's documentation, a new-vm script is something like this:

     

    New-VM -Name MyVM1 -Template $mySourceTemplate -Datastore $myDatastoreCluster -AdvancedOption $myAdvancedOption -ResourcePool $vmhost

    but prior to that you have to connect to given vcenter using the PowerCli Connect-VIServer

    Connect-VIServer -Server $vcenter -User $usr -Password $pwd

    if you by any reason REALLY need to do anything from a remote server, you have to enable the remote server as a trusted host, and to create a credential string. This is pure powershell, no powercli

     

    $originalTrusteHosts = Get-Item -Path WSMan:\localhost\Client\TrustedHosts
    Set-Item -Path WSMan:\localhost\Client\TrustedHosts -Value $remoteMachine -Concatenate -Force

    create the credentials

    # Create Credentials
    $securepw = ConvertTo-SecureString $password -asplaintext -force
    $cred = new-object -typename System.Management.Automation.PSCredential -argument $user, $securepw

    and finally the session

    # Create and use session
    $session = New-PSSession -credential $cred -ComputerName $remoteMachine



  • 4.  Re: Create VM with run script operator

    Broadcom Employee
    Posted Oct 05, 2017 02:43 AM

    Hello,

     

    We recommend to use vSphere connector which can be installed over PAM and provided various operators to work with VMs. Latest version of connector also available which is compatible for vSphere 6.X

     

    Thanks & Regards

    Madhava



  • 5.  Re: Create VM with run script operator

    Posted Oct 05, 2017 02:58 AM

    Hi Madhava,

     

    Thanks for your reply.

    Can you please help us know the current version of our vsphere connector in PAM and also how to install the latest version of Vsphere connector on PAM.

     

    Regards,

    Akash Singh



  • 6.  Re: Create VM with run script operator



  • 7.  Re: Create VM with run script operator

    Posted Oct 05, 2017 04:16 AM

    Hi Madhava,

     

    As checked we have Vsphere Module version 14 already configured in PAM.

    After reading the prerequisite to install version 15 , I am not sure it may work fine as our Production Environment PAM version is 4.3 HF01 (but in prerequisite its mentioned 4.3.1) and Build is : 4.3.50 HF01 and java version present on this server is 1.7.0_80 and  Vsphere Vcenter version is 5.5 in our environment

    Please recommend , should we go for installing version 15.

     

    Regards,

    Akash



  • 8.  Re: Create VM with run script operator

    Broadcom Employee
    Posted Oct 05, 2017 04:47 AM

    Hi Akash,

     

    Version 15 is compatible for 4.3.50 HF01 as well. But don't upgrade directly in production.

    Install in Dev/Test environment first then once it's working as expected as per your business then install in Production.

     

    Note: Uninstall the r14 version before installing the r15 version. (Connectors doesn't support upgrade)

    To uninstall, we need to execute the same installer and un-select the vSphere checkbox to uninstall it.

     

    Thanks & Regards

    Madhava



  • 9.  Re: Create VM with run script operator

    Posted Oct 05, 2017 07:29 AM

    Hi Madhava,

     

    I have tried to download the connector but I am facing issue doing so.

    I have attached the screenshot of the error.

     

    Regards,

    Akash



  • 10.  Re: Create VM with run script operator

    Posted Oct 05, 2017 08:15 AM

    Hi,

    The version of conector is related with the vsphere version. If your vcenter is still in 5.5, there is no need to upgrade it for the version 15.

    Just use the connector that is already installed in your environment.  



  • 11.  Re: Create VM with run script operator

    Posted Oct 05, 2017 08:43 AM

    Hi Marcel,

     

    The connector present in our environment has create VM operator but it doesn’t have an option to create a VM using template.

    Can you tell us if ITPAM has any such operator which can create VM using template.

     

    Regards,

    Akash Singh