开发者

how to check the last 3 characters of the registry entry using a vbscript

We are planning to distribute the device drivers according to the model of the machine, through SCCM. Device drivers are placed in the SCCM share.Device driver folders are named in such a way that only model number will开发者_开发技巧 be there.eg E6410. So we need a script to check the last 3 characters of the registry [HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\BIOS\SystemProductName.] eg:Dell Latitude E6410 ;Last 3 characters =410. so that it will compare the share and if match found then download the corresponding device driver folder to the local machine.


This should achieve the result you are looking for.

Option Explicit

' Open the WScript.Shell object to read the registry key.
Dim objWS, strKeyValue, strKeySuffix
Set objWS = CreateObject("WScript.Shell")
strKeyValue = objWS.RegRead("HKLM\HARDWARE\DESCRIPTION\System\BIOS\SystemProductName")

' Get last three characters of the key value.
strKeySuffix = Right(strKeyValue, 3)


How about getting the registry entry (as string) and get the last 3 chars by creating a substring with starting position string.length - 3 and length 3?

I'm not well versed in vbscript but it should be easy to achieve the same result as in C#:

string key = "your registry key";
string substr = key.Substring(key.Length - 3, 3);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜