EUCweb / BIS-F

Base Image Script Framework (BIS-F)
https://eucweb.com
GNU General Public License v3.0
96 stars 34 forks source link

Baramundi Software Agent not detected #317

Open citrixguyblog opened 3 years ago

citrixguyblog commented 3 years ago

Is your feature request related to a problem? Please describe. Feature Request. When using Baramundi as software deployment the service is not getting disabled during sealing.

Describe the solution you'd like Disable the service. I attached you the script I am using in the custom folder for the moment. Would be nice to integrate this in the next BIS-F release.

citrixguyblog commented 3 years ago

bisf_baramundi.txt

matthias-schlimm commented 3 years ago

stopping and disabling the service is enough, no deletion of any files, etc. ?

Process {

        $svc = Test-BISFService -ServiceName "$servicename" -ProductName "$product"
        IF ($svc -eq $true)
            {
                Invoke-BISFService -ServiceName "$servicename" -Action Stop -StartType Disabled
                Write-BISFLog -Msg "Clear $Product config"
            }

}
citrixguyblog commented 3 years ago

Customer couldn't tell me. Since they re-open the PVS vDisk to install new software via the baramundi agent this could potential break stuff.

tschuegy commented 3 years ago

@citrixguyblog We use also baramundi for master deployment, but we do not re-open the existing image. We do always redeploy the hole master during baramundi fully unattended. The deployment process is 100% zero touch, also for the BIS-F steps and vhdx integration in Citrix PVS.

Here are the script to uninstall the BMS Agent:

02_PrepBISF_ABX_UninstallBaramundiAgent.ps1

`<# .SYNOPSIS Uninstall Baramundi Agent .DESCRIPTION Uninstall Baramundi Agent on Base Image .EXAMPLE .NOTES Author: ABU Company: XXX

    History:
    31.01.2020 ABU: Script created
    05.02.2020 ABU: Check if BaramundiAgent is installed
    09.03.2020 ABU: Remove Baramundi Installation User from local administrator group

>

Begin { $Script_Path = $MyInvocation.MyCommand.Path $Script_Dir = Split-Path -Parent $script_path $Script_Name = [System.IO.Path]::GetFileName($script_path) }

Process { Write-BISFLog -Msg "Uninstall Baramundi Agent on Base Image" -ShowConsole -Color Cyan

$MyApp =(Get-WmiObject win32_product -filter:"Name= 'baramundi Management Agent'" | Select-Object -property:*)
$MSIProductCode = $MyApp.IdentifyingNumber

if ($MSIProductCode -ne $null) {
    $MSIOpt="/X $MSIProductCode /qn"
    Write-BISFLog -Msg "Run command: msiexec.exe $MSIOpt" -ShowConsole -Color DarkCyan -SubMsg
    $process = Start-Process -FilePath msiexec.exe -ArgumentList $MSIOpt -Wait -PassThru -NoNewWindow

    $ProcessExitCode = $Process.ExitCode
    if (($ProcessExitCode -eq 0 ) -or ($ProcessExitCode -eq $null ))
    {
        Write-BISFLog -Msg "MSI uninstallation completed successfully" -ShowConsole -SubMsg -Color DarkCyan

        $RegLogonProvider = Get-ItemProperty "HKLM:\Software\Classes\CLSID\*" | Where-Object "(Default)" -like "baramundiAutoLogOnProvider"
        if ($RegLogonProvider -ne $null) {
            $LogonProvider = $RegLogonProvider.PSChildName
            Remove-Item "HKLM:\Software\Classes\CLSID\$LogonProvider" -recurse
        }

        $CredProvider = Get-ItemProperty "HKLM:\Software\Microsoft\Windows\CurrentVersion\Authentication\Credential Providers\*" | Where-Object "(Default)" -like "baramundiAutoLogOnProvider"
        if ($CredProvider -ne $null) {
            $CRDProvider = $CredProvider.PSChildName
            Remove-Item "HKLM:\Software\Microsoft\Windows\CurrentVersion\Authentication\Credential Providers\$CRDProvider" -recurse
        }

        Remove-Item "HKLM:\Software\Wow6432Node\baramundi software AG" -recurse
        Remove-Item "${env:ProgramFiles(x86)}\Baramundi" -recurse
        Remove-Item "${env:ALLUSERSPROFILE}\baramundi" -recurse
    }
    else
    {
        Write-BISFLog -Msg "An error occurred while uninstalling $AppName (error: $ProcessExitCode)" -ShowConsole -SubMsg -Type E
    }
}
else {
    Write-BISFLog -Msg "$AppName not installed" -ShowConsole -Color DarkCyan -SubMsg
}

Write-BISFLog -Msg "Remove Baramundi Install User from local administrators group" -ShowConsole -Color DarkCyan -SubMsg
$LAdminGroup = Get-LocalGroup -SID "S-1-5-32-544"
Remove-LocalGroupMember -Group $LAdminGroup.name -Member "domain1\Test01", "domain2\Test02" >$null 2>&1

}

End { Add-BISFFinishLine } `

Hope i can enlarge your mind and give you a hint about an other way to do a master image deployment...