Get Dell Service Tag with C#

Source Code

This script has not been checked by Spiceworks. Please understand the risks before using it.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

// This script was initially posted at http://mariohenkel.de/?p=153privatestringGetServiceTag(){stringdellServiceTag="";try{ManagementClasswmi=newManagementClass("Win32_Bios");foreach(ManagementObjectbiosinwmi.GetInstances()){dellServiceTag=bios.Properties["Serialnumber"].Value.ToString().Trim();}returndellServiceTag;}catch(Exceptione){MessageBox.Show("Error while getting Dell Service Tag:\n\n"+e.ToString());dellServiceTag="N/A";returndellServiceTag;}}