Board logo

标题: VBS验证MAC地址 [打印本页]

作者: keyroad    时间: 2008-3-18 09:50     标题: VBS验证MAC地址

StrComputer = "."
MyMac = 00-19-E0-23-08-FF
set ObjMAC =GetObject("Winmgmts:\\" & StrComputer & "\Root\Cimv2")
Set ObjMacs = ObjMac.get("Win32_NetworkAdapterConfiguration.index=1")
    If MyMac = Objmacs.MACAddress Then
set s = WScript.CreateObject("WScript.Shell") '创建WScript.Shell对象
      app=s.Run ("e:\Progra~1\ie.vbs") '
end if
为什么我的代码另存为vbs后不会运行啊    mac填写没错的  ie.vbs 也存在的
作者: keyroad    时间: 2008-3-18 09:51

StrComputer = "."
MyMac = "00-19-E0-23-08-FF"
set ObjMAC =GetObject("Winmgmts:\\" & StrComputer & "\Root\Cimv2")
Set ObjMacs = ObjMac.get("Win32_NetworkAdapterConfiguration.index=1")
    If MyMac = Objmacs.MACAddress Then
set s = WScript.CreateObject("WScript.Shell") '创建WScript.Shell对象
      app=s.Run ("e:\Progra~1\ie.vbs") '
end if
这样也不行啊
作者: myweb9169    时间: 2008-3-18 14:56

这是在我本机上测试通过的代码,参考下
StrComputer = "."
MyMac = "E0:0C:20:52:41:53"
set ObjMAC =GetObject("Winmgmts:\\" & StrComputer & "\Root\Cimv2")
Set ObjMacs = ObjMac.instancesof("Win32_NetworkAdapterConfiguration")
for each objmac in  ObjMacs
    If MyMac = Objmac.MACAddress Then
set s = WScript.CreateObject("WScript.Shell") '创建WScript.Shell对象
      s.Run "c:\1.txt"
      
end if
next
作者: keyroad    时间: 2008-3-18 18:50

set s = WScript.CreateObject("WScript.Shell") '创建WScript.Shell对象
Dim myDate
myDate = #4/13/2008#
if myDate > now then
app=s.Run ("e:\Progra~1\ie.vbs") '

软件是可以运行的,但是问题是,如果他们改了系统时间就可以继续用这软件了 怎么办




欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2