Automation

 View Only
  • 1.  Problems with powershell script

    Posted Dec 19, 2012 08:40 PM

    I am having problems setting up a script through task manager... My script is as follows.

    ------------------------------

    Connect-VIServer NAME-SERVER.xsclient.int
    $a = get-date ((get-date).AddMinutes(2)) -format "yyyy-MM-%d HH:mm
    Get-Desktop -pool_id TEST | Get-DesktopVM | Send-LinkedCloneRefresh -schedule $a

    ## -forcelogoff $true -stoponerror $true

    -------------------------------

    I tried running that directly through powershell aswell which returns a "Not recognized command"

    I run it through the vSphere powercli shortcut on the desktop and get "Could not connect using the requested protocol."

    I also tried setting the protocol using Connect-VIServer NAME-SERVER.xsclient.int -protocol https and still the same result.



  • 2.  RE: Problems with powershell script

    Posted Dec 19, 2012 08:46 PM

    Those are VMware View PowerCLI cmdlets you are trying to use.

    They are not included in PowerCLI.

    Are you running this on a View Connection server ?

    You'll have to load the View PowerCLI snapin

    You can find some more info on using the View cmdlets remotely in Alan's blog post called  Using the View PowerCLI cmdlets from another machine



  • 3.  RE: Problems with powershell script

    Posted Dec 19, 2012 09:22 PM

    I am running this on the host, i have tried jsut the name, the 127 ip and the localhost as the name



  • 4.  RE: Problems with powershell script

    Posted Dec 19, 2012 10:49 PM

    Just noticed, the Get-Desktop cmdlet does in fact not exist, don't you mean to do a Get-Pool there ?

    Something like

    Get-Pool -pool_id TEST | Get-DesktopVM | Send-LinkedCloneRefresh -schedule $a


  • 5.  RE: Problems with powershell script

    Posted Dec 20, 2012 01:21 PM

    Ahh yes...

    I think i would have noticed that down the line, however my problem occurs at the begining and it seems to be something i dont have installed or configured correctly.

    When i type the first command manually i get "Could not connect using the requested protocol." I tried adding -protocol https but this did not work as well.

    EDIT

    Also added the -credential (Get-Credential) same story

    I added a screenshot of the error



  • 6.  RE: Problems with powershell script

    Posted Dec 20, 2012 03:09 PM

    It looks as if the HTTPS protocol doesn't get through.

    Try with explicitely specying -Protocol http.

    Do you run the vCenter on a Windows server that has an active firewall ?

    Can you try switching off that FW for a test ?

    If it works then, you will have to make sure port 442 and 902 are open.



  • 7.  RE: Problems with powershell script

    Posted Dec 20, 2012 06:39 PM

    Server is in production, so i will open those ports and try with only http.



  • 8.  RE: Problems with powershell script

    Posted Feb 17, 2016 09:07 AM

    I've been having this problem on and off for years and couldn't figure out what was going on.    For me the it turns out the problem was the proxy settings in internet explorer.  Disabled the proxy and all is working again. 



  • 9.  RE: Problems with powershell script

    Posted Feb 17, 2016 10:51 AM

    Have a look at the ProxyPolicy parameter on the Set-PowerCLIConfiguration cmdlet.