Questions tagged [cim]

62 questions
2
votes
2 answers

Unable to search directory subtree with WQL query

I am attempting to find all .PST files for the logged on user. However, I seem unable to add a path to 'Drive'. I would like to search all files under C:\users\ + $env:UserName This command seems to find all PST files on C:\ $Res = Get-CimInstance…
tacosnooper
  • 73
  • 1
  • 7
1
vote
0 answers

How can I create a new scheduled Task when running script as "local system"?

I am not able to create a scheduled task under latest Win11 when running a Powershell script as "local system". It gets me an error "New-ScheduledTaskTrigger : Cannot connect to CIM server. Access to a CIM resource was not available to the…
Carsten
  • 1,612
  • 14
  • 21
1
vote
0 answers

.NET 6 - How to use method SetCertificate from Win32_TSGatewayServerSettings with cimSession

My environment : Microsoft Windows Server 2019 Datacenter (Working as an RDS Gateway) Publish Profile (be careful with the runtime target, only win10-x64 is correctly working) : Configuration : Release | Any CPU Framework : .net6.0 Deployment mode :…
FeelProud
  • 11
  • 2
1
vote
1 answer

Get-CIMInstance | Unable to include "-Query" parameter in splatted parameters

I have a script pulling some CIM information, running the command directly from the terminal (on the local machine, not a remote CIM session) is successful: Get-CimInstance -Namespace root\sms\site_SITECODE -Query "SELECT SMS_Collection.* FROM…
mhouston100
  • 1,173
  • 2
  • 19
  • 41
1
vote
2 answers

How do I get the first install date of a disk drive in PowerShell?

In the Device Manager, I can view the properties of any device (disk drives included). In the Details tab, I can select the first install date: In PowerShell, I can get all disk drives by issuing: Get-CimInstance -ClassName CIM_DiskDrive The…
stackprotector
  • 10,498
  • 4
  • 35
  • 64
1
vote
1 answer

Convert the linux command to Cim windows command

What is the equivalent command using Cim instance ? wmic cpu list /format:list
golo
  • 41
  • 7
1
vote
2 answers

How can I get the processor "SocketDesignation" with Get-CimInstance?

Since wmic calls are deprecated by Microsoft, how can I use Get-CimInstance to get the same information as wmic cpu get SocketDesignation?
golo
  • 41
  • 7
1
vote
2 answers

Mimic this very simple powershell command in C#

Trying to mimic the command Get-CimInstance CIM_ManagedSystemElement in C# string NamespacePath = "\\\\.\\Root\\CIMv2"; string ClassName = "CIM_ManagedSystemElement"; //Create ManagementClass ManagementClass oClass = new…
Daniel Cohen
  • 163
  • 1
  • 7
1
vote
1 answer

New-CimSession Auto Downgrade to DCOM / WMI

One of the benefits of CIM is the "fan out" ability; e.g. running the following causes sessions to be created against all servers in parallel, rather than sequentially: $myServers = 1..10 | %{'MyServer{0:00}.mydomain.example.com' -f $_} $cimSessions…
JohnLBevan
  • 22,735
  • 13
  • 96
  • 178
1
vote
1 answer

Using Invoke-CimMethod 'Activate' in order to activate a windows powerplan, instead I get Invalid Class what am I doing wrong?

I followed the Scripting Guy instructions from Microsoft but even with this I still get the same error Scripting Guy article here is my script: $p2=Get-CimInstance -N root\cimv2\power -Class win32_PowerPlan -Filter "ElementName =…
MK Spindel
  • 23
  • 7
1
vote
1 answer

Dealing with CimObjects with PowerShell inside C#

I have a snippet that executes a PowerShell script using (var ps = PowerShell.Create()) { ps.AddScript("function Test() { return Get-Disk -Number 0 } "); ps.Invoke(); ps.AddCommand("Test"); var results = ps.Invoke(); var disk =…
SuperJMN
  • 13,110
  • 16
  • 86
  • 185
1
vote
0 answers

Invalid character with Invoke-CimMethod

I am currently working on PowerShell script to create ZTI deployment with SCCM for our computers. The last step of the script is to clear the old PXE Request so that the computer will be "available" for a new deployment on the next reboot. I am…
Patrick Pruneau
  • 669
  • 3
  • 7
  • 14
0
votes
0 answers

How to run drush cim command for importing all the configurations

I cloned the drupal project on my local. I have a Docker desktop app. so I run docker-compose up -d on command prompt. docker-compose.yml: services: mariadb: image: wodby/mariadb:$MARIADB_TAG container_name: "${PROJECT_NAME}_mariadb" …
Bohdan V.
  • 115
  • 1
  • 11
0
votes
0 answers

Is it possible to implement a provider method on top of python?

I'm trying to control my laptop fan speed using WMI in python. This is my python code: import wmi c = wmi.WMI () cim_fan = c.CIM_Fan() fan_speed = 4000 cim_fan[0].SetSpeed(fan_speed) But it throws this error: Traceback (most recent call last): …
Ali Ent
  • 1,420
  • 6
  • 17
0
votes
0 answers

Open Management Infrastructure (OMI) : List of classes

I installed Open Management Infrastructure (OMI) on WSL "Ubuntu 20.04.3 LTS" as described on https://github.com/Microsoft/omi-script-provider . These examples runs as expected: /opt/omi/bin/omicli ei root/omi OMI_Identify /opt/omi/bin/omicli gc…
remi.chateauneu
  • 109
  • 2
  • 9