Team I am doing Win7 to Win10 inplace upgrade on various models, HP, and Dell, and I need to change the bios to UEFI as part of the process. I have this little script I wrote, but for some reason it is not recognizing the device is a HP. When I run it on Dell, it echos it is a dell as expected. When run on HP, it echos that it is a Dell<\/p>\n
$computerSystem = (Get-WmiObject -Class:Win32_ComputerSystem)\nif ($computerSystem.Manufacturer= \"Dell Inc\" )\n#{ Start-process \"cmd.exe\" \"/c C:\\temp\\Win10\\Post_Install\\Dell_BIOS.cmd\"}\n\n{write-host \"this is a Dell\"}\n\nelse\n{write-host \"this is an HP\"}\n<\/code><\/pre>","upvoteCount":6,"answerCount":3,"datePublished":"2019-09-07T16:01:30.000Z","author":{"@type":"Person","name":"zayscott5065","url":"https://community.spiceworks.com/u/zayscott5065"},"acceptedAnswer":{"@type":"Answer","text":"
Advertisement
its -eq not =<\/p>\n
Advertisement
if ($computerSystem.Manufacturer -eq “Dell Inc” )
\nBut I suggest use -match<\/p>\n
$computerSystem = (Get-WmiObject -Class:Win32_ComputerSystem)\nif ($computerSystem.Manufacturer -match \"Dell Inc\" )\n{write-host \"this is a Dell\"\nStart-process \"cmd.exe\" \"/c C:\\temp\\Win10\\Post_Install\\Dell_BIOS.cmd\"\n}\nelse\n{write-host \"this not dell\"}\n<\/code><\/pre>\nin general<\/p>\n
$check=(Get-WmiObject -Class:Win32_ComputerSystem).Manufacturer\nWrite-Host \"Manufacturer is $check\"\n<\/code><\/pre>","upvoteCount":3,"datePublished":"2019-09-07T16:17:21.000Z","url":"https://community.spiceworks.com/t/help-wth-powershell-script/729042/2","author":{"@type":"Person","name":"jitensh","url":"https://community.spiceworks.com/u/jitensh"}},"suggestedAnswer":[{"@type":"Answer","text":"Team I am doing Win7 to Win10 inplace upgrade on various models, HP, and Dell, and I need to change the bios to UEFI as part of the process. I have this little script I wrote, but for some reason it is not recognizing the device is a HP. When I run it on Dell, it echos it is a dell as expected. When run on HP, it echos that it is a Dell<\/p>\n
$computerSystem = (Get-WmiObject -Class:Win32_ComputerSystem)\nif ($computerSystem.Manufacturer= \"Dell Inc\" )\n#{ Start-process \"cmd.exe\" \"/c C:\\temp\\Win10\\Post_Install\\Dell_BIOS.cmd\"}\n\n{write-host \"this is a Dell\"}\n\nelse\n{write-host \"this is an HP\"}\n<\/code><\/pre>","upvoteCount":6,"datePublished":"2019-09-07T16:01:30.000Z","url":"https://community.spiceworks.com/t/help-wth-powershell-script/729042/1","author":{"@type":"Person","name":"zayscott5065","url":"https://community.spiceworks.com/u/zayscott5065"}},{"@type":"Answer","text":"Awesome this worked thanks.<\/p>","upvoteCount":0,"datePublished":"2019-09-09T08:10:21.000Z","url":"https://community.spiceworks.com/t/help-wth-powershell-script/729042/3","author":{"@type":"Person","name":"zayscott5065","url":"https://community.spiceworks.com/u/zayscott5065"}}]}}