pegduffy's Posts

Magneet, Please feel free to use any of my code. And thank you for the hv.helper module. I suspect you tcan integrate the code better than I into that module. I have used the module in my code... See more...
Magneet, Please feel free to use any of my code. And thank you for the hv.helper module. I suspect you tcan integrate the code better than I into that module. I have used the module in my code as you see and thank you again for that. I am now testing my code in a test environment by putting test machines in unreachable_agent state - basically logging into a specific desktop and killing of the Agent service, -  and then refreshing them (my test environment is isolated into a single pool specific test pool). I have tested a bit before posting so the code works for me. Please enjoy. Nice to be able to "pay it forward". Thanks to you, cjrege, and  jrodsguitar!
The solution posted will work. Here is my solution. (different and not yet refactored so forgive)
Interested parties, It took a bit of browsing git hub....but I think I just found code on github that may have the snippet I need. GitHub - cjrege/HorizonView: VMware Horizon View PowerShell M... See more...
Interested parties, It took a bit of browsing git hub....but I think I just found code on github that may have the snippet I need. GitHub - cjrege/HorizonView: VMware Horizon View PowerShell Module Specifically see function Invoke-ViewComposerTask And in that function:    if ($Refresh){    $refreshSpec = New-Object VMware.Hv.DesktopRefreshSpec    $refreshSpecHelper = New-Object VMware.Hv.DesktopService+DesktopRefreshSpecHelper    switch ($LogOffSetting){    "WAIT_FOR_LOGOFF" {    $refreshSpec.LogoffSetting = $refreshSpecHelper.LOGOFF_SETTING_WAIT_FOR_LOGOFF   }    "FORCE_LOGOFF" {    $refreshSpec.LogoffSetting = $refreshSpecHelper.LOGOFF_SETTING_FORCE_LOGOFF   }   default {    throw "Logoff setting not permitted"   }   }    if ($StartTime){    $refreshSpec.StartTime = $StartTime   }    if ($StartNow){    $refreshSpec.StartTime = (Get-Date).AddMinutes(1)   }    $refreshSpec.Machines = $machines.Id    $refreshSpec.StopOnFirstError = $StopOnFirstError    # Execute refresh    Write-Host Refreshing $desktopPool.Base.Name -ForegroundColor Cyan    $desktopService.Desktop_Refresh($HvServices, $desktopPoolId, $refreshSpec)   } Don't know why this was pasted into a table...but here you can see the code above that should refresh the desktop using machine id Written by user cjrege. I am going to try now. Thanks to all and will post when I solve this.
Magneet, I do not want to delete the machine. I want to Refresh it only. Is it possible to do this using only a connection to an HVserver....Connect-HVServer but not using a Connect-VIServer?... See more...
Magneet, I do not want to delete the machine. I want to Refresh it only. Is it possible to do this using only a connection to an HVserver....Connect-HVServer but not using a Connect-VIServer? I did see your code and you solution. Perhaps what I am attempting is not possible. Do you know?
Jose, Thanks so much for your answer. I am sorry I steered you wrong. I am using Horizon 7 Version 7.2 so I can not use snap-ins. The commandlets you are using are no longer available. No Sen... See more...
Jose, Thanks so much for your answer. I am sorry I steered you wrong. I am using Horizon 7 Version 7.2 so I can not use snap-ins. The commandlets you are using are no longer available. No Send-VDILinkedCloneRefresh in this version. Just the View API - VMware API Explorer - VMware {code} View API 7.1.0, Agent version 7.2.0 I would like to do what is on the View Horizon Admin Center Version 7 as Catalog -> Desktop Pools -> Select one of the Pools....-> Look at Inventory of Machines -> Select one -> View Composer -> Refresh So the previous Send-VDILinkedCloneRefresh is probably what I needed prior to this version. I am using VMWare.Hv.Helper....but no equivalent commandlets there that I can tell.
I read this article. Reset/Refresh Horizon Desktop in a Problem State using PowerShell I read the answer here : Various_Scripts/remove_faulty_VDI_desktop.ps1 at master · Magneet/Various_Scri... See more...
I read this article. Reset/Refresh Horizon Desktop in a Problem State using PowerShell I read the answer here : Various_Scripts/remove_faulty_VDI_desktop.ps1 at master · Magneet/Various_Scripts · GitHub Is there a way, not to remove of delete the Agent_Unreachable machine but to just try a desktop refresh or the equivalent, without doing a Connect-VIServer, but using only  the HV server connection? I have tried many of the API commands of this nature but can not seem to find a way to do this without a VIServer connection. Is it possible? Has anyone done it? Would you be willing to share a snippet of your code to guide me. I have been able to get-hvsummary for each Pool, using -State Unreachable. Basically, my VMware sysadmins believe this is possible and I am tryng to write the code. I have looked at many calls in the API but get message like "You need a connection to VI Server." I have a script  making a list of machines in an unreachable state...and then 15 minutes later, by writing results to files and reading previous file back in again....if machine is still unreachable 15 minutes later I want to do whatever is equivalent to a Desktop_Refresh. I have machineids etc. Peg Duffy