1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Function Get-IsLaptop {
    $isLaptop = $false
    if(Get-WmiObject -Class win32_systemenclosure | Where-Object { $_.chassistypes -eq 8 -or $_.chassistypes -eq 9 -or $_.chassistypes -eq 10 -or $_.chassistypes -eq 14 -or $_.chassistypes -eq 30}) { $isLaptop = $true }
    Add-Content $LogFile -value "isLaptop => $isLaptop"
    Return $isLaptop
}
 
# The first function does not correctly detect the HP Elite Dragonfly
function Test-IsLaptop {
    $isLaptop = $false
    $HardwareType = (Get-WmiObject -Class Win32_ComputerSystem -Property PCSystemType).PCSystemType
    # Mobile = 2
    if ($HardwareType -eq 2) { $isLaptop = $true }
    Add-Content $LogFile -value "isLaptop => $isLaptop"
    Return $isLaptop
}

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.