Questions tagged [system.management]

103 questions
0
votes
1 answer

C# wmi query exception invalid class using ManagmentObjectSearcher

I am trying to run a wmi query using System.Management in c# and keep getting invalid class. It is for wmware virtual desktops using the pcoip protocol. I can use WMI Explorer and it shows like below. Here is just some example c# code. I know its…
JMIII
  • 320
  • 2
  • 16
0
votes
1 answer

System.Management.Automation.SetValueInvocationException

I'm trying to run PowerShell script from my form. I've added a NuGet package named "System Management Automation" to my project that enables interaction with PowerShell from vb.net program. And added project reference to …
Somanna
  • 284
  • 1
  • 13
0
votes
1 answer

Create Runspaces in separate powershell shells with System.Management

I'm trying to run different PowerShell commands using .NET's System.Management library but I see that every time the runspaces share the same shell. To be more specific, if I open one PowerShell window on my OS and I run the following…
Norberth Csorba
  • 312
  • 1
  • 9
0
votes
0 answers

Running Powershell cmdlet in C# application on IIS across domains

We have to domains: NT1 and NT2. We have a C# application that calls Powershell cmdlets on Exchange server (domain NT2). It uses credentials of NT2\User. The excerpt: using System.Management.Automation; using…
dvitonis
  • 263
  • 3
  • 9
0
votes
0 answers

WMI values seems inconsistent

For our licensing / software activation we need to uniquely identify a computer. To do that we're relying on WMI and we're building a unique computer key using BIOS Version, ProcessorID, MainHardDrive serial etc.... It's working great since 4-5…
David CASBONNE
  • 139
  • 2
  • 9
0
votes
0 answers

Using System.Management Object

I write this routine: Public Function LipPCIsOn() As String ' Return TimeSpan.FromMilliseconds(System.Environment.TickCount).ToString() Dim query As New SelectQuery("SELECT LastBootUpTime FROM Win32_OperatingSystem WHERE Primary='true'") Dim…
Antony
  • 83
  • 11
0
votes
0 answers

Enable/Disable driver on UWP application

I need to Enable/Disable a Network driver on a UWP application. System.Management Namespace is available only for .Net applications so I can't use this dll with UWP application. It is forbidden to reach the driver or there is another way to do it?
0
votes
1 answer

Null results after execution Powershell script in Visual Studio C#

I'm trying to get some data from Azure Active Directory using C# code with reference to System.Management.Automation. I've got no errors with code execution, just null results and no output to textfile. Does anyone have this problem before or maybe…
0
votes
1 answer

C++/CX WMI PropertyData array type

I need to read the values of System.Management.PropertyData when it's an array. PropertyData.IsArray Property https://learn.microsoft.com/en-us/dotnet/api/system.management.propertydata.isarray?view=netframework-4.7.2 I have no idea how to convert…
marco
  • 1,686
  • 1
  • 25
  • 33
0
votes
0 answers

serial port sometimes stays open after computer restarts

I have a program that requires serial port connection to be open from the moment software the starts up until it's shutdown. my program starts when the computer starts(it has a shortcut in %startup% folder - windows 7). I'm using process explorer(by…
styx
  • 1,852
  • 1
  • 11
  • 22
0
votes
1 answer

Starting MSTSC using powershell from C#

I am attempting to start an MSTSC / RDP session from C#. For various reasons I've settled on invoking Powershell to do this, partly because I know the powershell commands work, although I wouldn't be averse to attempting other methods to start the…
Phueal
  • 113
  • 5
0
votes
2 answers

Execute Service fabric cmdlets in c# code

I followed the http://jeffmurr.com/blog/?p=142 for calling powershell scripts from C#. But I am getting error like The term 'Connect-ServiceFabricCluster' is not recognized as the name of a cmdlet, function, script file, or operable program.…
Eby Louis
  • 3
  • 4
0
votes
1 answer

Log started processes and events of Windows 2000 and XP Operating Systems using WMI C# 2005

Is there a way that WMI can catch events, for example selecting or accessing the control panel, and processes, for example running "command". I am a beginner on the subject of ManagementEventWatcher and I was wondering if I can catch the moment the…
gibz357
  • 235
  • 1
  • 7
  • 20
0
votes
0 answers

.Net C# System.Management.ManagementObject SECURITY_DESCRIPTOR value getting null on RegistryValueChangeEvent event

I am developing registry monitor for watching particular keys, i am having a problem with System.Management.ManagementObject SECURITY_DESCRIPTOR value getting null on RegistryValueChangeEvent event. Please kindly help
Devrk
  • 1
  • 1
0
votes
1 answer

PowerShell issues via nuget

I'm developing a program that uses System.Management.Automation library so I can create an instance of PowerShell. Something like: using (var instance = System.Management.Automation.PowerShell.Create()) { // do something } In order to avoid…
Mari Faleiros
  • 898
  • 9
  • 24