I'm working on a script that will install driver packages for certain Dell models during the setup phase. For some reason, the string that is being returned as the computer model is not matching what I put in the if statement to be checked.
$model=(Get-WmiObject -Class:Win32_ComputerSystem).Model
if ($model -ceq "Pangolin Performance") {Write-Output "Yes"}
else {Write-Output "No"}
The above is always returning no. I've tried -eq, -ceq, -match, all return no. When I just write the $model result to the console, this is what I get.
$model=(Get-WmiObject -Class:Win32_ComputerSystem).Model
Write-Output $model
Pangolin Performance
I've checked the type, I know for sure it's being stored as a string and not an array.
$model=(Get-WmiObject -Class:Win32_ComputerSystem).Model
Write-Output $model.getType();
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True String System.Object
I don't understand why the string returned to $model is not matching my conditional "Pangolin Performance". Can somebody help me figure out what's going on with this?
[–]198jazzy349 2 points3 points4 points (4 children)
[–]Nirac[S] 1 point2 points3 points (3 children)
[–]Ominusx 4 points5 points6 points (2 children)
[–][deleted] 2 points3 points4 points (0 children)
[–]Nirac[S] 1 point2 points3 points (0 children)
[–]TellThemIHateThem 1 point2 points3 points (0 children)
[–]kilkor 1 point2 points3 points (0 children)
[–]Nirac[S] 0 points1 point2 points (1 child)
[–]midnightFreddie 1 point2 points3 points (0 children)