Questions tagged [system.management]
103 questions
2
votes
3 answers
How to print a pdf in C# by using
I used 'process' to print pdf file in C# app.But i cannot get the print status.I found that it is possible to interact with printer/queue with System.management and System.printing.I did a lot of trial n error using these two namespaces but couldnt…

Murali Uppangala
- 884
- 6
- 22
- 49
2
votes
2 answers
Where to find the System.management dll
I am trying to build an SQL CLR stored procedure that references an IBM WebSphere MQ dll. I'm having problems doing this on my work machine, so I decided to see if I could just get this to work on my home comp using localhost. I've made progress in…

NealR
- 10,189
- 61
- 159
- 299
1
vote
2 answers
Map a DiskIndex to a Volume Label
Current I am able to get all the Drives and their labels in c# by using the DriveInfo.GetDrives(). Then I am able to get the Disk Index / Index of the Partition by this methodology.
var searcher = new ManagementObjectSearcher("root\\CIMV2", "SELECT…

Brad Semrad
- 1,501
- 1
- 11
- 19
1
vote
5 answers
C# System.Management has only 1 class?
I have been trying to utilize WMI for my code, I cannot use the System.Management classes as they are not there. I have tried it on 3.5 and 4 Net. Nothing works.
I have not found any solutions to the issue and was wondering if any of you have ever…

Meh
- 607
- 1
- 9
- 19
1
vote
2 answers
Can't use Get-Printer from PrintManagement PowerShell module inside an ASP.NET Core 5 app
I am trying to fetch the printers associated with my computer inside an ASP.NET Core 5 app using the System.Management.Automation and Microsoft.PowerShell.SDK nuget packages.
PowerShell ps =…

Picassopolo
- 11
- 5
1
vote
0 answers
How can I handle the ManagementObject Class in .Net 6.0?
I'm with Microsoft Visual Studio Community 2022 (64-bit) Version 17.0.2, .Net 6.0, and I'm unable to work with the ManagementObject.
Here is the fragment of code I'm testing:
using System;
using System.Management;
public class Sample
{
public…

Teodoro Marinucci
- 37
- 3
1
vote
1 answer
How Do I Get the Assigned Drive Letter When Mounting an ISO with WMI in C#?
This is the code that I am using to mount the ISO
// With help of WMICodeCreator
ManagementObject mo = new ManagementObject("root\\Microsoft\\Windows\\Storage",
"MSFT_DiskImage.ImagePath='" + isoFile + "',StorageType=1",
null);
// Obtain…

Damien
- 1,463
- 1
- 18
- 30
1
vote
1 answer
Is there a faster way to query a remote filesystem with WMI?
I am trying to recursively get all of the files — 5 or 6 files give or take — under the directory C:\YC. I am bound to one WMI call to a remote computer.
I managed to do this call using the WQL LIKE operator but it's taking around 30 seconds, even…

Yiftach Cohen
- 39
- 1
- 4
1
vote
1 answer
Retrieve Serial Port information with Microsoft.Management.Infrastructure
In order to get information about Serial Port devices, with System.Management, we can do as described in Getting Serial Port Information:
using System;
using System.Management;
using System.Collections.Generic;
using System.Linq;
using…

FriendOfFriend
- 131
- 4
1
vote
1 answer
System.TypeInitializationException: "The type initializer for 'System.Management.ManagementPath' threw an exception."
I just started to code a Programm which detects the USB Sticks and this is my current code:
public enum EventType
{
Inserted = 2,
Removed = 3
}
static void Main(string[] args){
…

TheDeveloper
- 19
- 1
1
vote
0 answers
Use System.Management to get UUID in .NET Core
I am working on a .NET Core application. My requirement is that i have to get the UUID of motherboard. Code is:
static void Main(string[] args)
{
string uuid = string.Empty;
ManagementClass mc = new…

Waleed Naveed
- 2,293
- 2
- 29
- 57
1
vote
0 answers
C# WMI User Access Level detection
I have a WMI query that do event trace for process start-up detection.
The code is similar to this:
var startProcessQuery = new WqlEventQuery("Win32_ProcessStartTrace", $"ProcessName = 'notepad.exe'");
var _startProcessEventWatcher = new…

LoxLox
- 977
- 9
- 16
1
vote
1 answer
Add user to remote windows share using WMI
I have a share on the root of C:\ on a remote computer IMPC-1111, and I'm trying to add a user /w access masks:
FullControl = 2032127
Change = 1245631
[ReadOnly] = 1179817
I've figured out how to read them....but cannot figure out how to…

TonyW
- 766
- 8
- 17
1
vote
0 answers
Permission in web application - System.Management, Generic failure
I want to access to System.Management and add dns record. Current code works fine on windows application, but I looking for a permission to run the code on web application too.
string site = "domain.com";
ConnectionOptions co = new…

مهدی نبوی
- 471
- 5
- 15
1
vote
0 answers
How to detect System.Management.ManagementException "not supported"?
We have some code to counter the brightness dimming on laptops.
It relies on System.Management calls.
It works fine on a laptop but on a PC without power management it throws an Exception: System.Management.ManagementException "not supported"
I do…

Ingmar
- 101
- 1
- 6