VMware Cloud Community
spunkybd
Contributor
Contributor

Problems with powershell script

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.

Reply
0 Kudos
8 Replies
LucD
Leadership
Leadership

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


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

spunkybd
Contributor
Contributor

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

Reply
0 Kudos
LucD
Leadership
Leadership

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


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

spunkybd
Contributor
Contributor

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

Reply
0 Kudos
LucD
Leadership
Leadership

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.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
spunkybd
Contributor
Contributor

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

Reply
0 Kudos
benbjamin24
Enthusiast
Enthusiast

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. 

Ben VCP
Reply
0 Kudos
LucD
Leadership
Leadership

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


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos