Which of the below script gives the name of memory slots installed in a system and the size of each memory slot(RAM)?
-
\$strComputer = "Computer name" \$colRAM = Get-WmiObject -Class "win32_PhysicalMemory" -namespace "root\CIMV2"-computerName \$strComputer Foreach (\$objRAM In \$colRAM) { "Memory Installed: " + \$objRAM.DeviceLocator &quo
-
\$strComputer = "Computer name" \$colRAM = Get-WmiObject -Class "win32_PhysicalMemoryArray" -namespace "root\CIMV2"-computerName \$strComputer Foreach (\$objRAM In \$colRAM) { "Memory Installed: " + \$objRAM.DeviceLocator
-
\$strComputer = "Computer name" \$colRAM = Get-WmiObject -Class "win32_PhysicalMemorySize" -namespace "root\CIMV2"-computerName \$strComputer Foreach (\$objRAM In \$colRAM) { "Memory Installed: " + \$objRAM.DeviceLocator
-
None of the above
A
Correct answer
Explanation
The Win32_PhysicalMemory WMI class provides information about each physical memory module installed in the system. The DeviceLocator property identifies the memory slot location, and the Capacity property indicates the RAM size. Option B uses Win32_PhysicalMemoryArray which describes the memory array hardware rather than individual modules, while Option C references a non-existent WMI class.