$item].Name
	        }
	    }
	    elseif($htPrinter.Count -gt 1)
	    {
                $needCheckNoPrinterInstalled = $false

                #
	        # Ask the user which printer should be the default printer.
	        #
	        $choices = New-Object System.Collections.ArrayList
	        foreach($item in $htPrinter.keys)
	        {
	            $name = $htPrinter[$item].Name
	            $description = $htPrinter[$item].Description
	            $value = $htPrinter[$item].Name
	            $choices += @{"Name" = "$name"; "Description" = "$description"; "Value" = "$value"}
	        }
	        $printerName = Get-DiagInput  -id "IT_SelectPrinter" -choice $choices
	        if($printerName -eq "RESCAN")
	        {
	            $printerName = ""
	            Update-DiagRootCause -id "RC_NoPrinterInstalled" -Detected $true -parameter @{ "DEVICEID" = "ScanOnly"; "PRINTERCOUNT"=$htPrinter.Count}
	            return
	        }
	    }
	}
}

#
# Check no non-virtual printer
#
if($needCheckNoPrinterInstalled)
{
    .\TS_NoPrinterInstalled.ps1
}

if(-not [string]::IsNullorEmpty($printerName))
{
    #
    # Check the default printer
    #
    .\TS_DefaultPrinter.ps1 $printerName
    #
    # Check the printer driver
    #
    .\TS_PrinterDriver.ps1 $printerName

    #
    # Check the default printer's connection.
    #
    .\TS_CannotConnect.ps1 $printerName

    #
    # Check printer power off
    #
    .\TS_PrinterTurnedOff.ps1 $printerName

    #
    # Check the low toner
    #
    .\TS_OutOfToner.ps1 $printerName

    #
    # Check the low paper
    #
    .\TS_OutOfPaper.ps1 $printerName

    #
    # Check the paper jammed
    #
    .\TS_PaperJam.ps1 $printerName

    #
    # Check the current user's print jobs.
    #
    .\TS_PrintJobsStuck.ps1 $printerName

    #
    # Check whether the local printer is shared on the Homegroup
    #
    .\TS_HomeGroup.ps1 $printerName

    #
    # Check whether the printer driver has encountered an err# Copyright  2008, Microsoft Corporation. All rights reserved.


PARAM($printerName)
#
# Check whether the local printer is shared on the Homegroup
#
Import-LocalizedData -BindingVariable localizationString -FileName CL_LocalizationData
Write-DiagProgress -activity $localizationString.progress_ts_homeGroup

. .\CL_Utility.ps1

function Get-HomeGroupName()
{
    $path = "HKLM:\SYSTEM\CurrentControlSet\Services\HomeGroupProvider\ServiceData"
    $item = "PeerGroupName"

    return (Get-ItemProperty -Path $path -Name $item).$item
}

function Test-HomeGroupName()
{
    return [bool](Get-HomeGroupName)
}

[bool]$result = $false

if(Test-HomeGroupName)
{
    $printerSelected = GetPrinterFromPrinterName $printerName
    if(-not $printerSelected.NetWork -and -not (PrinterIsShared $printerName))
    {
        $result = $true
    }
}

if($result)
{
    Update-DiagRootCause -id "RC_HomeGroup" -Detected $true -parameter @{ "PRINTERNAME" = $printerName}
}
else
{
    Update-DiagRootCause -id "RC_HomeGroup" -Detected $false -parameter @{ "PRINTERNAME" = $printerName}
}
