Questions tagged [cim]
62 questions
23
votes
2 answers
What Library for Powershell 6 contains the get-wmiobject command?
I am getting the following error upon attempting to use the get-WmiObject command in PowerShell (version 6):
PS C:\Users\zsofi> Get-WmiObject Win32_product | select name, packagecache
Get-WmiObject : The term 'Get-WmiObject' is not recognized as…

Zsofia
- 355
- 1
- 2
- 7
9
votes
2 answers
Objects with no '.Count' Property - use of @() (array subexpression operator) vs. [Array] cast
I am trying to perform some simple if statements, but all of the newer cmdlets that are based upon [Microsoft.Management.Infrastructure.CimInstance] don't seem to expose a .count method?
$Disks = Get-Disk
$Disks.Count
Doesn't return anything. I…

CobyCode
- 193
- 5
3
votes
1 answer
Powershell CIM Method "Delete" is missing in Win32_ShadowCopy?
I try to switch from WMI to CIM, but there are methods missing:
WMI way so select the next best VSS snapshot:
$SnapShot = (Get-WmiObject Win32_ShadowCopy)[0]
And then you have the working method:
$SnapShot.Delete()
However Get-CimInstance does not…

Joachim Otahal
- 272
- 2
- 9
3
votes
1 answer
How do we use CimCmdlets in Powershell Core on Linux Environment?
I'm trying to execute the CimCmdlets on Linux Powershell but it seems like this module is only available for windows. Is there any workaround to run these commands from cmdlets module on…

sadique urf arbaz
- 265
- 4
- 15
3
votes
1 answer
New-CimSession without elevation by providing admin credentials on Windows 10?
I need to query some WMI values using PowerShell from Windows 10 devices. The script is executed in the context of a non-admin user by some software distribution tooling.
There is a local admin account, and for the current purpose (retrieving…

muffel
- 7,004
- 8
- 57
- 98
3
votes
1 answer
WMI deprecated: how to query from .Net Core now?
I've read here that Microsoft is deprecating WMI. I need to start a project in .NET Core and query information from Windows, e.g. Win32_OperatingSystem or Win32_LogicalDisk.
I'v read that you should avoid Get-WmiObject in PowerShell and use…

lufist
- 73
- 1
- 2
- 9
3
votes
0 answers
Replace Get-WmiObject with Get-CimInstance
We're reviewing our code and are trying to replace the WMI CmdLets with the CIM ones. The following code works fine:
$Query = "SELECT InstalledLocation,ProductVersion,ProductName FROM SMS_R_System
JOIN
SMS_G_SYSTEM_Installed_Software on…

DarkLite1
- 13,637
- 40
- 117
- 214
3
votes
2 answers
Convert WMI call to CIM call
The code I am writing is suppose to kick off any patches currently available to a server using CIM. And I have to use CIM due to the required DCOM protocol for my network.
I'm using ` for easier viewing
The following wmi code works:
$ComputerName =…

Keith
- 689
- 10
- 27
3
votes
1 answer
Retrieve specific drive data - Get-WmiObject Win32_logicaldisk
I am attempting to retrieve the FreeSpace for a specific drive using Get-WmiObject.
Using Get-WmiObject Win32_logicaldisk on my machine returns the following:
PS C:\Users\Julian\Desktop\Tools\Powershell> Get-WmiObject Win32_logicaldisk |…

DanishPleb
- 33
- 1
- 1
- 5
2
votes
1 answer
Where can I find the Windows version in a CIM instance?
On the Windows Settings > System > About page, the "Windows specifications" section presents the following information.
Edition Windows 10 Enterprise
Version 20H2
OS build 19042.1288
Using the following reports the Version member as…

lit
- 14,456
- 10
- 65
- 119
2
votes
2 answers
Get-WMIObject Uninstall vs Get-CIMInstance Uninstall
Probably a dumb question but, I'm just curious.
Is there a difference between Get-CIMInstance and Get-WMIObject when Invoking an Uninstall for an application under the Win32_Product class? Only reason I ask is because:
Using Get-CIMInstance to…

Abraham Zinala
- 4,267
- 3
- 9
- 24
2
votes
1 answer
set PolicyStore in CIM instance
the Get-NetFirewallProfile cmdlet has the option -PolicyStore ActiveStore which is the sum of all policies on that computer. When I run it I get the firewall profile state with GPO taken under consideration.
Alternatively I can get the CIM instance…

Maor Dahan
- 356
- 4
- 8
2
votes
1 answer
Connection from Linux OMI (omicli) to Windows WMI fails with DMTF related error
I am implementing OMI client on CentOs in C++ to communicate with windows WMI
I have installed OMI on Linux CentOS 7 and trying to connect to Windows 7
using the sample utility provided by OMI.
Reference: https://github.com/Microsoft/omi
Also…

MUKHTAR INAMDAR
- 85
- 4
- 17
2
votes
1 answer
Casting parameters inside CIMInstance
I'm playing around with the Hyper-V WMI interface and am trying to create a snapshot of one of my local Hyper-V VMs, using C#. I'm trying to do this WITHOUT using System.Management. Instead, I'm using using Microsoft.Management.Infrastructure.…

Rainmaker
- 173
- 3
- 13
2
votes
0 answers
Decoupled MI Provider in C#
So I've inherited three Windows NT-Services written in C#. One of the tasks now is to add WMI-data so the status of the NT-Service can be tracked in our monitoring software.
Searching the internet doesn't provide me with any samples how to create a…

user5423533
- 21
- 1