Questions tagged [system.management]

103 questions
1
vote
0 answers

Cannot access winsat data from WWI using c#

I am trying to access winsat data . WMI has a class for it . Win32_WinSAT I am trying to get that recent data using query "SELECT * FROM Win32_WinSAT WHERE TimeTaken='MostRecentAssessment'" It will work fine in PowerShell and even in…
Aditya Nadig
  • 203
  • 3
  • 12
1
vote
0 answers

Search For Win32_Directory using the Volume Guid

I am trying to check if a directory exists on a remote computer by using the Volume GUID rather than the Volume Name. Is there any way in WMI to accomplish this? I have a tried a few different approaches but my WQL syntax never seems to be correct,…
cmcginty
  • 235
  • 1
  • 3
  • 9
1
vote
3 answers

How to read errors from Powershell pipeline in c#?

I am using System.Management.Automation.Runspaces.Pipleline to create a powershell pipeline instance and execute my powershell scripts in c# console application, the problem is that if the script end up with an error, then i don't know how to print…
Muhammad Areeb
  • 92
  • 2
  • 14
1
vote
2 answers

"ManagementScope " could not be found

I'm getting this error: CS0246: The type or namespace name 'ManagementScope' could not be found... On this line: private ManagementScope plainScope = null; The project builds fine, however I get the above compiler error during runtime when I try to…
Anthony
  • 12,177
  • 9
  • 69
  • 105
1
vote
0 answers

Returning Values from ObjectReadyEventHandler

I'm writing a program that returns a list of users currently logged in a server. Here's the code that does this: private List GetUsers(string server) { ConnectionOptions options = new ConnectionOptions(); ManagementScope…
GitGawd
  • 53
  • 9
1
vote
1 answer

Why "Disable" or "Restart" methods are not working (Using WMI in C#)

I just wrote 3 different codes. One of them works fine. But other two, don't work and throw an ManagementException with the message: This method is not implemented in any class Here is the code that works fine: string ComputerName =…
1
vote
1 answer

How to pass a cmdlet as parameter value in .NET

How can I pass a cmdlet as a parameter value in C#? In other words, what would the the .NET equivalent of the following be? PS> Get-Content -Path (Some-Cmdlet) I have the following code: var ps =…
Swoogan
  • 5,298
  • 5
  • 35
  • 47
1
vote
2 answers

Create SQL Server Alias Using WMI on x64

I have a small app which automatically creates necessary SQL Server Alias entries for some servers. The bulk of the code looks like this: private static void SetAlias(string aliasName, string server, string protocol, int? port) { …
Jeff
  • 35,755
  • 15
  • 108
  • 220
1
vote
1 answer

disabling net adapter from c# not working

I build an app i it to block surfing when a user didn't chose, but I can’t find a way to stop the net and work adapter from c#. I saw and tried a lot of examples and advices from stackoverflow, but none worked for me. I tried to disabled the…
1
vote
1 answer

Document printed or not in C#

I used following code to print a pdf : var fileName = filepath; ProcessStartInfo psInfo = new ProcessStartInfo(); psInfo.Arguments = ConfigurationManager.AppSettings["printer_name"]; psInfo.FileName = fileName; psInfo.WindowStyle =…
Murali Uppangala
  • 884
  • 6
  • 22
  • 49
1
vote
1 answer

Running Dot Net project exe on Linux which makes use of System.Management to get USB Device information

Hi, I have created a Dot Net application in C# to get USB Device Information like DeviceID, Caption, ClassGUID etc using System.Management Namespace. I'm using the ManagementObjectSearcher Method to fetch the value from Win32_DiskDrive. It's…
1
vote
1 answer

win32_networkaddressconfiguration no ip address

I'm collecting all networkadapterconfigurations from the Win32_NetworkAdapterConfiguration class in C#. I use this query: private String strDetailedInterfaces = @"SELECT * FROM …
DerpyNerd
  • 4,743
  • 7
  • 41
  • 92
1
vote
1 answer

Get-WMIObject fails to enumerate Win32_LogicalDiskToPartiion in elevated powershell

I have a really simple Powershell query: Get-WmiObject -query 'ASSOCIATORS OF {Win32_LogicalDisk.DeviceID="C:"} WHERE AssocClass = Win32_LogicalDiskToPartition' On a Windows 7 (64-bit) machine, running this in a Powershell correctly enumerates a…
Kal
  • 1,887
  • 12
  • 16
1
vote
1 answer

Get the real adapter information only using WMI query?

Im trying to get some system information using WMI but the problem is when i want to get for example Graphic Card information .. i get many drivers (real & virtual) ManagementObjectSearcher searcher = new ManagementObjectSearcher("select Name from "…
Murhaf Sousli
  • 12,622
  • 20
  • 119
  • 185
0
votes
1 answer

ManagementObjectSearcher error

Some of our customers inform us that in some cases following error appears: System.Management.ManagementException: Błąd dostawcy. at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) at …
Piotrek