Thin clients and desktops are two different device types and must be handled different. When running PowerShell scripts against these workstations I always have the need to tell if I'm working with a thin client or a desktop. One of the big reasons is to specify different SCCM client install settings such as cache size, compressed installation, etc. This function is the one I use all the time.

This function takes one argument; a computer name. If no computer name is specified it'll default to localhost.

It then attempts a WMI query against the device to find the Model attribute.

In my environment I define a thin client as anything with hp t* in the model name that's not a hp touchsmart model. Your thin clients may differ here.

If it matches hp t* but is not a HP Touch Smart device I define it as a thin client.

If, for some reason, a WMI query won't work I grab the attributes from the remote PC's explorer exe to see if it's compressed or not.

In my environment, all thin clients have a compressed hard drive and no desktops do. I consider this my fallback attempt.

Function Get-DeviceChassis () {
    [CmdletBinding()]
    Param($ComputerName = 'localhost')

    PROCESS { 
        $Output = New-Object PsObject -property @{ComputerName = $ComputerName;Chassis=''}
        try {
            $Model = (Get-WmiObject -Query "SELECT Model FROM Win32_ComputerSystem" -ComputerName $ComputerName).Model;
                if (($Model -like 'hp t*') -and ($Model -notlike 'hp touchsmart*')) {
                    Write-Verbose "Found chassis to be thin client via WMI";
                    $Output.Chassis = 'Thin Client'
	    	} else {
                    Write-Verbose "Found chassis to be desktop via WMI";
                    $Output.Chassis = 'Desktop'
	    	}##endif
        } catch {
            if ((Get-Item "\$ComputerNameadmin$explorer.exe").Attributes -match 'Compressed') {
                Write-Verbose "Found chassis to be thin client via compressed files";
                $Output.Chassis = 'Thin Client'
            } else {
                Write-Verbose "Found chassis to be desktop via compressed files";
                $Output.Chassis = 'Desktop'
            }
        } finally {
            $Output
        }
    }
}

Join the Jar Tippers on Patreon

It takes a lot of time to write detailed blog posts like this one. In a single-income family, this blog is one way I depend on to keep the lights on. I'd be eternally grateful if you could become a Patreon patron today!

Become a Patron!