title: What's the cmd / batch alternative to the deprecated wmic?
body: <p>I'm aware of <code>wmic</code> being deprecated as of 2012 and I now typically use PowerShell anyway, so had moved away from it already.</p>
  
  <p>However, I frequently encounter cases where I need to work within batch files and do not have the option of migrating the solution to PowerShell.</p>
  
  <p>My question is this: with <code>wmic</code> deprecated, what is the recommended alternative for continued access to the Windows Management Instrumentation from the command prompt and from batch files?</p>
  
  <p>The best I can think of currently is something along the lines of:</p>
  
  <pre><code>powershell -command "(Get-CimInstance Win32_Processor) | select *" | some_other_program.exe
  </code></pre>
  
  <p>(this example to get processor attributes)</p>
  
  <p>But one major downside of that is that errorlevels and the environment are no longer accessible. That is, the powershell command completes successfully, even if the command does not). And changes made to the environment in the powershell command do not propagate to the batch file.</p>
  
  <p>Any suggestions on how to specifically address those issues, or on better alternatives to calling powershell from the batch for access to WMI are welcome, but specifically I'd like to know how to run a powershell command and access the results other than the standard out.</p>