VMware Horizon Community
toon97
Enthusiast
Enthusiast

Scripting VMware View Pool Operations

Hi All,

Does anyone know how I can cancel a scheduled pool task from the command line/View power CLI??

I've written two scripts to do two seperate recompose operations using powershell. We have one script to recompose all virtual desktops that are not in use, set to run every friday night. A seperate script then runs on the saturday night to force users to log-off and then recompose these virtual desktops.


This works, in part, the only problem being that the second task wont run unless I cancel the task which is left running by the first script (the first task is set to wait until users log off, i.e. not forcing them to log-off, so it will sit there forever). I therefore need something to cancel this task so that the second script runs.

See the attached screen-shot which shows the type of task i wish to cancel.


Thanks

Reply
0 Kudos
5 Replies
vmblogza
Enthusiast
Enthusiast

Hi what if you kill the previous task using powershell in your 2nd script ?

Best regards, If you find this information useful, please award points for "correct" or "helpful". Please visit my blog at http://vmblog.co.za
toon97
Enthusiast
Enthusiast

Good idea, any idea what command to use to do that?

Reply
0 Kudos
vmblogza
Enthusiast
Enthusiast

hi,

you can try

$oProcessus = Get-WmiObject Win32_Process -Filter "Name='powershell.exe'"
$oProcessus | ForEach-Object {
$oProcessusOwner = $_.GetOwner()
if ($oProcessusOwner.User = "_csPowerShell") {
exit
}
}

But check this page will probably work better Smiley Happy

http://www.computerperformance.co.uk/powershell/powershell_process_stop.htm

Best regards, If you find this information useful, please award points for "correct" or "helpful". Please visit my blog at http://vmblog.co.za
toon97
Enthusiast
Enthusiast

Thanks for that. The task seems to be created internally within View though, so even if i kill the powershell process it doesnt kill the View task - which has already been scheduled somewhere else.

Reply
0 Kudos
vmblogza
Enthusiast
Enthusiast

Hmm ok ! Do you have vMware support? I would log a ticket to be honest.

Might be low priority but they should be able to help you.

Best regards, If you find this information useful, please award points for "correct" or "helpful". Please visit my blog at http://vmblog.co.za
Reply
0 Kudos