system.management

Why does my .NET Windows service not start automatically sometimes?

Hi all, I have modified a working Windows service that had always been starting beforehand. After adding the System.Management reference it now sometimes will not start automatically. I get the following error: Service cannot be started. System.Runtime.InteropServices.COMException (0x80010002): Call was canceled by the message...

System.Management.ConnectionOptions always requires a password in text?

Hi, I'm using WMI in .NET to connect to remote machines in a web app. When I initialize the connection, the Management ConnectionOptions always require a username and password in text. I was wondering if there was a way for it to use the context of the current Windows user, eg via page.user.identity. If I leave the connectionoptions ...

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) { var scope = new ManagementScope(@"\\.\root\Microsoft\SqlServer\ComputerManagemen...