wmi

looking for a MAC address of a physical adapter

こ雲淡風輕ζ 提交于 2019-12-18 16:49:23
问题 I would like to use a unique identifier to determine whether my application moved to a different computer. The MAC address seems to be suitable for this purpose. The code I use is this: Procedure TForm4.GetMacAddress; var item: TListItem; objWMIService : OLEVariant; colItems : OLEVariant; colItem : OLEVariant; oEnum : IEnumvariant; iValue : LongWord; wmiHost, root, wmiClass: string; i: Int32; function GetWMIObject(const objectName: String): IDispatch; var chEaten: Integer; BindCtx: IBindCtx;/

looking for a MAC address of a physical adapter

感情迁移 提交于 2019-12-18 16:49:21
问题 I would like to use a unique identifier to determine whether my application moved to a different computer. The MAC address seems to be suitable for this purpose. The code I use is this: Procedure TForm4.GetMacAddress; var item: TListItem; objWMIService : OLEVariant; colItems : OLEVariant; colItem : OLEVariant; oEnum : IEnumvariant; iValue : LongWord; wmiHost, root, wmiClass: string; i: Int32; function GetWMIObject(const objectName: String): IDispatch; var chEaten: Integer; BindCtx: IBindCtx;/

How to access WinRM in C#

时间秒杀一切 提交于 2019-12-18 14:14:56
问题 I'd like to create a small application that can collect system information (Win32_blablabla) using WinRM as opposed to WMI. How can i do that from C#? The main goal is to use WS-Man (WinRm) as opposed to DCOM (WMI). 回答1: I guess the easiest way would be to use WSMAN automation. Reference wsmauto.dll from windwos\system32 in your project: then, code below should work for you. API description is here: msdn: WinRM C++ API IWSMan wsman = new WSManClass(); IWSManConnectionOptions options =

Remote WMI connection

老子叫甜甜 提交于 2019-12-18 13:24:13
问题 I want to connect to remote PC running Windows 7, from another PC using ManagementScope on a local network. On remote PC I've created a new user account "Samuel" without password and set as administrator. ConnectionOptions options = new ConnectionOptions(); options.Username = "Samuel"; options.Password = ""; ManagementScope scope = new ManagementScope("\\\\192.168.0.2\\root\\cimv2", options); scope.Connect(); The Error I get: Access is denied. (Exception from HRESULT: 0x80070005 (E

Find all instances of sql server programmatically

吃可爱长大的小学妹 提交于 2019-12-18 12:09:49
问题 I know that there's quite a few subjects similar to this one, but none of them provided the correct answer I am looking for. I am struggling to gather all the instances of SQL-Server on our network. It should be able to detect what version of SQl-Server is running. The different versions we have running vary between ' SQL Server 2000 ' and ' SQL Server 2008 R2 ' To give you a little background information, currently I am developing on our local network, but later on it will be run on our

Find all instances of sql server programmatically

风格不统一 提交于 2019-12-18 12:09:48
问题 I know that there's quite a few subjects similar to this one, but none of them provided the correct answer I am looking for. I am struggling to gather all the instances of SQL-Server on our network. It should be able to detect what version of SQl-Server is running. The different versions we have running vary between ' SQL Server 2000 ' and ' SQL Server 2008 R2 ' To give you a little background information, currently I am developing on our local network, but later on it will be run on our

WMI - select from Win32_Product takes a long time

*爱你&永不变心* 提交于 2019-12-18 08:59:17
问题 I am enumerating installed applications using WMI, and this block is taking a relatively long time to complete no matter how I structure it. It takes 13 seconds in my environment every time. Is there a better (faster) way to check if a program is installed? (I'm using iTunes as an example program to check for) private static string Timestamp { get { return DateTime.Now.ToString("HH:mm:ss.ffff"); } } private static void LoadInstalledPrograms() { List<string> installedPrograms = new List<string

How can I find the amount of video Ram installed through a WMI call?

血红的双手。 提交于 2019-12-18 07:14:53
问题 Does anyone know how to get the Video Ram of a PC from a WMI call? I've seen calls to the Win32_VideoController management object's AdapterRAM property, but that only gives the system memory, and is not representative of the video RAM at all. 回答1: Turns out it was the adapter RAM returned, and through an unfortunate coincidence, the wrong conversion was used and gave the system RAM...on two different systems. Thanks for pushing us to look again. For what it's worth, in a C# WinForms app: int

How to query GetMonitorBrightness from C#

你。 提交于 2019-12-18 06:53:49
问题 How does GetMonitorBrightness http://msdn.microsoft.com/en-us/library/ms775205.aspx work? Can someone give me an actual working implementation calling this code in C#? I'm trying to retrieve the allowed brightness levels my laptop supports. I have the following working code that sets the brightness from 1 to ~150. But I'm looking for the allowed input values (min max values). static void SetBrightness(byte targetBrightness) { ManagementScope scope = new ManagementScope("root\\WMI");

How to query GetMonitorBrightness from C#

守給你的承諾、 提交于 2019-12-18 06:52:00
问题 How does GetMonitorBrightness http://msdn.microsoft.com/en-us/library/ms775205.aspx work? Can someone give me an actual working implementation calling this code in C#? I'm trying to retrieve the allowed brightness levels my laptop supports. I have the following working code that sets the brightness from 1 to ~150. But I'm looking for the allowed input values (min max values). static void SetBrightness(byte targetBrightness) { ManagementScope scope = new ManagementScope("root\\WMI");