views:

67

answers:

2

I have a project i've been working on that requires me to retrieve the CPU ID of the computer to create a software licence and check it against the current licens registered.

So, said and done i made 2 programs to make this happen. Then i need to implement this solution into my CLR project.

I notice that i can't add System.Management reference in an SQL Project.

So therefor i can't access the said controls to retrieve the CPU ID as i did in my other .NET programs.

Please ive been searching for a solution for this for a week now and any hints would really help. Ive seen people including the System.Management.dll at creation of the SQL Assembly but i really cant grasp how its done.

+1  A: 

Your best bet would probably be to create a web service that does the WMI stuff and returns the cpu id.

Alternatively if you want to go over to the dark side you could you could look at xp_cmdshel and OLE Automation Objects to access external resources.

Ben Robinson
A: 

I think you need to enable the 'unsafe' option in your CLR project to be able to add a reference to System.Management.dll. The System.Management.dll will then need adding to the datbase using CREATE ASSEMBLY.

GrahamMoore