Okay, I admit it; I'm a total n00b. Take a look at this code scrap:
$colItems = Get-WmiObject -Class "Win32_ComputerSystem" -Namespace "root\CIMV2"
foreach ($objItem in $colItems) {
Write-Host $objItem.Manufacturer
[Environment]::SetEnvironmentVariable("Manufacturer", "$objItem.Manufacturer", "Machine")
Write-Host $objItem.Model
[Environment]::SetEnvironmentVariable("Model", "$objItem.Model", "Machine")
}
Write-Host $env:Manufacturer
Write-Host $env:Model
The results are:
Dell Inc.
OptiPlex 7010
(Double-backslash)CO-ITS-025407\root\CIMV2:Win32_ComputerSystem.Name="CO-ITS-025407".Manufacturer
(Double-backslash)CO-ITS-025407\root\CIMV2:Win32_ComputerSystem.Name="CO-ITS-025407".Model
In other words, attempting to assign the WMI object attribute value results in two different outcomes. I need thevalue, not the path to the value. What gives? :(
Thanks.