IT Process Automation

Expand all | Collapse all

Powercli -  inline script never stop

  • 1.  Powercli -  inline script never stop

    Posted 03-23-2015 10:40 AM

    I'm trying to run a .ps1 (PowerCLI) through Operator ' Run Script', and setting its extension like .ps1 and putting the code below:


    Param(  
    [Parameter(Mandatory = $true)]  
    [ValidateNotNullOrEmpty()]  
    [string] $Server,  
    [Parameter(Mandatory = $true)]  
    [ValidateNotNullOrEmpty()]  
    [string[]] $VM  
    )  
    
    try  
    {  
    #force this to run in 32 bit  
    if ($env:Processor_Architecture -ne "x86")  
    {  
    &"$env:WINDIR\syswow64\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line  
    exit  
    }  
    
    cd "${env:ProgramFiles(x86)}\VMware\Infrastructure\vSphere PowerCLI"  
    Add-PSSnapin -Name VMware.VimAutomation.Core | Out-Null  
    Connect-VIServer 10.8.8.8 -User domain\user -Password 123
    Set-Annotation -Entity hostpdi -CustomAttribute "Contact" -Value Poyato
    
    }  
    catch  
    {  
    $error[0].Exception  
    Exit 1  
    }  
    

     

    I pointed the user ID and password for a dataset with data from the PAM server (where is installed PowerCLI), as the image below:

    2015-03-23 11_36_31-CA Process Automation 4.2 SP02.jpg


    When I run the process is looped never stopping.
    Someone could tell me why?


    tks!


    Poyato



  • 2.  Re: Powercli -  inline script never stop

    Posted 03-17-2016 04:00 PM

    We are marking this question as "Assumed Answered" due to age.

     

    Thanks,

    Scott Owens