|So let's talk WMI. It's the primary way scripts get information from Windows.|
For CMD, WMIC was included as part of Win2K's resource kit. It was then added to WinXP Pro, but it required administrative privileges to run. This means you could not reliably run it until Vista. Even if you could run it on WinXP, the formatting characters changed between versions, so you can't reliably use it in a batch script in a mixed WinXP - Win7 environment. Still, if you're using batch, it is your only choice. Getting the command to work in a FOR loop requires you to know too much about CMD's tokenization, or use temporary files. Neither are ideal.
for /f "usebackq" %a in (`wmic path win32_videocontroller where deviceid^='VideoController1' get pnpdeviceid ^| findstr "."`) do set vid=%a
Set vid = GetObject("winmgmts:Win32_VideoController.DeviceID=""VideoController1""")
Finally, we end up with PowerShell. Included with Vista / Win2K3 SP2(?), it was going to replace CMD and include 100% batch compatibility. This idea was quickly dropped once the PowerShell team actually looked at CMD. Being new, it already has its fair number of version differences, but backward compatibility was a design concern so a script that works in v1.0 (Vista) should run fine on v2.0 (Win7), and presumably v3.0 (Win8) as well. Also, don't be fooled! PowerShell claims it's a shell; it's not. It's a scripting environment that defaults to not running scripts. A committee design if I ever saw one. Finally its script editor, PowerShell ISE, is not 100% compatible with the actual intended execution environment, so watch out for that. I'm told Version 3 fixes at least a few of these compatibility problems, so that's good. Nice language, though. The documentation is built into it, so you don't need to dig around the TechNet/MSDN site.
$vid = Get-WmiObject win32_videocontroller -Filter "deviceid='VideoController1'"
How To Ask Questions The Smart Way