Powershell 7 is missing Get-Wmiobject

Welcome Forums General PowerShell Q&A Powershell 7 is missing Get-Wmiobject

Viewing 4 reply threads
  • Author
    Posts
    • #211872
      Participant
      Topics: 86
      Replies: 138
      Points: 676
      Rank: Major Contributor

      I have installed Powershell 7 and run it side-by-side with PS 5.1 ISE.  I am migrating my PS 5.1 scripts to PS7.  One obstacle I ran into was that the cmdlet

      Get-wmiobject win32_logicaldisk ...

      no longer works.  Powershell 7 considers it an invalide name of a cmdlet.  I am lost on where to obtain this missing cmdlet.  Would be grateful for any advice or tips.  Thanks.

      • This topic was modified 3 months, 1 week ago by Ramon TAN.
    • #211878
      Participant
      Topics: 5
      Replies: 2368
      Points: 5,987
      Helping Hand
      Rank: Community MVP

      Powershell 7 is based on .Net Core and .Net Core does not support WMI. You will have to use CIM instead.

      Get-CimInstance win32_logicaldisk 
    • #211881
      Participant
      Topics: 86
      Replies: 138
      Points: 676
      Rank: Major Contributor

      My sincere thanks Olaf …

    • #212016
      Participant
      Topics: 3
      Replies: 8
      Points: 46
      Rank: Member

      The WMI cmdlets must have been deprecated in PS 7, but you can still work with WMI/CIM using cmdlets from the cimcmdlets module in PS 7.

      get-command -module cimcmdlets

      get-command -module cimcmdlets |measure

       

    • #212028
      js
      Participant
      Topics: 30
      Replies: 828
      Points: 2,554
      Helping Hand
      Rank: Community Hero

      get-ciminstance is almost the same as get-wmiobject. Except with remote computers it uses wsman instead of dcom.

Viewing 4 reply threads
  • The topic ‘Powershell 7 is missing Get-Wmiobject’ is closed to new replies.