Extract S/N from Bios
Keywords: extract s/n from bios wmi
Question:
I was able to extract the S/N from Bios with a VBS script but it only seemed to work on W2K systems. I found a Pascal script that worked but I am unfamilier with Pascal. Can Winbatch get this job. Attached is the VBS script if it helps.Dim FSO, AFile, AFileStream Dim strSrcDir ' Set variables strSrcDir = "c:\" Set SNSet = GetObject("winmgmts:").InstancesOf ("Win32_BIOS") Set FSO = CreateObject("Scripting.FileSystemObject") Set AFileStream = FSO.OpenTextFile("C:\SN.txt",8) for each SN in SNSet AFileStream.WriteLine SN.SerialNumber NextAnswer:
If you have a current version of WinBatch.Locator = ObjectOpen("WbemScripting.SWbemLocator") Service = Locator.ConnectServer() Security = Service.Security_ Security.ImpersonationLevel = 3 Class = "Win32_Bios" Instance = Service.InstancesOf(Class) hEnum = ObjectCollectionOpen(Instance) While 1 Obj = ObjectCollectionNext(hEnum) If Obj == 0 Then Break sn=Obj.SerialNumber desc=Obj.Description Message(Class, StrCat(desc,@CRLF,sn)) EndWhile ObjectCollectionClose(hEnum) ObjectClose(Instance) ObjectClose(Security) ObjectClose(Service) ObjectClose(Locator)
Article ID: W15357