[Windows Guest Tools] Cleaner Tool


  • XCP-ng Center Team

    Hello all together!

    I started to build a little tool, that should help to find the problems before installing/updating the Guest Tools in a Windows VM. For now its only a first start, but it can grow to a very usefull tool.

    Any constructive help or hint is very welcome!

    Later (so my plans) it should be a part of a new Guest Tools Installer.

    Issue: https://github.com/xcp-ng/xcp/issues/152
    GIT repository: https://github.com/xcp-ng/win-installer-ng


  • XCP-ng Center Team

    If you have problems to install Citrix(TM) or XCP-ng Windows Guest Tools, please try the first working version of this tool:

    🎆 https://schulzalex.de/builds/xcp-ng/XCP-ng-Windows-Guest-Tools-Cleaner_alpha_1.0.0.0.zip 🎆

    Good

    2e40afde-6030-47dc-afbe-f6f17153c23b-grafik.png

    Bad

    c89d5bf1-7166-4291-8a0e-f9c86439f245-grafik.png



  • Good work ! This tool will help us.



  • @borzel Alex.. thanks for putting this wee tool together.



  • @borzel This looks like a great tool so when complete my studies and ever need to run or update a Windows VM for a client's web application. It will aid in doing so (especially if migrating from Xen Server).



  • @borzel
    I just noticed that your cleaner tool doesn't detect the "liteagent.exe" file which is the "XenServer Interface Service".


  • XCP-ng Center Team

    @siodor thanks for the hint, I added it to https://github.com/xcp-ng/xcp/issues/152



  • Here's a copy of a script I was using to clean XenTools from XenServer 6.0 I believe. Please include all the reg keys and files mentioned. Thanks!

    $appName = 'Citrix Tools for Virtual Machines'
    $appFileName = 'uninstaller.exe'
    $appParameters = '/S /NORESTART'
    $appSourcePath = "${env:ProgramFiles(x86)}\Citrix\XenTools"
    If (($ComputerManufacturer -ne "Xen") -and (Get-InstalledApplication -Name $appName))
    {
        Write-Log -Message "Uninstalling $appName ..." -WriteHost $True -LogType 'CMTrace'
        # http://discussions.citrix.com/topic/347782-unable-to-installuninstall-xen-tools
        Execute-Process -Path "$appSourcePath\$appFileName" -Parameters $appParameters -CreateNoWindow -PassThru
        Remove-Folder -Path "$appSourcePath"
        Remove-File -Path "$env:windir\System32\xennetco.dll"
        Remove-File -Path "$env:windir\System32\drivers\xen*.sys"
        Remove-File -Path "$env:windir\System32\drivers\scsifilt.sys"
        Remove-File -Path "$env:windir\System32\drivers\xevtchn.sys"
        Remove-RegistryKey -Key 'HKLM:\SOFTWARE\Citrix\XenTools' -Recurse
    
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\CurrentControlSet\services\scsifilt' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\CurrentControlSet\services\xenvbd' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\CurrentControlSet\services\xenevtchn' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\CurrentControlSet\services\xennet' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\CurrentControlSet\services\xenvif' -Recurse
    
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\ControlSet001\services\scsifilt' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\ControlSet001\services\xenvbd' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\ControlSet001\services\xenevtchn' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\ControlSet001\services\xennet' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\ControlSet001\services\xenvif' -Recurse
    
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\ControlSet002\services\scsifilt' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\ControlSet002\services\xenvbd' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\ControlSet002\services\xenevtchn' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\ControlSet002\services\xennet' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\ControlSet002\services\xenvif' -Recurse
    
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\CurrentControlSet\services\eventlog\Application\Citrix Xen Guest Agent' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\CurrentControlSet\services\eventlog\Application\xenbvd' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\CurrentControlSet\services\eventlog\Application\xenevtchn' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\CurrentControlSet\services\eventlog\Application\xeniface' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\CurrentControlSet\services\eventlog\Application\xennet' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\CurrentControlSet\services\eventlog\Application\xennet6' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\CurrentControlSet\services\eventlog\Application\xensvc' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\ControlSet002\services\eventlog\Application\xenvif' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\CurrentControlSet\services\eventlog\System\scsifilt' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\CurrentControlSet\services\eventlog\System\xenevtchn' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\CurrentControlSet\services\eventlog\System\xenvbd' -Recurse
    
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\ControlSet001\services\eventlog\Application\Citrix Xen Guest Agent' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\ControlSet001\services\eventlog\Application\xenbvd' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\ControlSet001\services\eventlog\Application\xenevtchn' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\ControlSet001\services\eventlog\Application\xeniface' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\ControlSet001\services\eventlog\Application\xennet' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\ControlSet001\services\eventlog\Application\xennet6' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\ControlSet001\services\eventlog\Application\xensvc' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\ControlSet002\services\eventlog\Application\xenvif' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\ControlSet001\services\eventlog\System\scsifilt' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\ControlSet001\services\eventlog\System\xenevtchn' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\ControlSet001\services\eventlog\System\xenvbd' -Recurse
    
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\ControlSet002\services\eventlog\Application\Citrix Xen Guest Agent' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\ControlSet002\services\eventlog\Application\xenbvd' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\ControlSet002\services\eventlog\Application\xenevtchn' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\ControlSet002\services\eventlog\Application\xeniface' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\ControlSet002\services\eventlog\Application\xennet' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\ControlSet002\services\eventlog\Application\xennet6' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\ControlSet002\services\eventlog\Application\xensvc' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\ControlSet002\services\eventlog\Application\xenvif' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\ControlSet002\services\eventlog\System\scsifilt' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\ControlSet002\services\eventlog\System\xenevtchn' -Recurse
        Remove-RegistryKey -Key 'HKLM:\SYSTEM\ControlSet002\services\eventlog\System\xenvbd' -Recurse
    
        Set-RegistryKey -Key 'HKLM:\SYSTEM\ControlSet001\Control\Class\{4D36E967-E325-11CE-BFC1-08002BE10318}' -Name 'LowerFilters' -Value '' -Type MultiString
    
        If (Get-Service "XenSvc" -ErrorAction 'SilentlyContinue'){(Get-WmiObject -Class Win32_Service -Filter "Name='XenSvc'").Delete()}
        If (Get-Service "XenPVInstall" -ErrorAction 'SilentlyContinue'){(Get-WmiObject -Class Win32_Service -Filter "Name='XenPVInstall'").Delete()}
        Get-WmiObject -Query "SELECT * FROM __Namespace WHERE Name='xenserver'" -Namespace "root\cirix" -ErrorAction SilentlyContinue | Remove-WmiObject
    } 
    ElseIf (($ComputerManufacturer -eq "Xen") -and (Get-InstalledApplication -Name $appName)) 
    {
        Write-Log -Message "$appName is already installed." -WriteHost $True -LogType 'CMTrace'
    }
    Else
    {
        Write-Log -Message "Not a Citrix XenServer virtual machine." -WriteHost $True -LogType 'CMTrace'
    }
    

  • XCP-ng Center Team

    @JonathanPitre cool 🙂

    I edited your post, please wrap code sections always with ```` before and after the textblock


Log in to reply