首页 > 编程 > VBScript > 正文

可以得到当前系统信息的脚本sysinfo.vbs

2019-10-26 17:58:01
字体:
来源:转载
供稿:网友
复制代码 代码如下:

if (lcase(right(wscript.fullname,11))="wscript.exe") then
   set objshell=wscript.createobject("wscript.shell")
   objshell.run("cmd.exe /k cscript //nologo "&chr(34)&wscript.scriptfullname&chr(34))
   wscript.quit
end if
with wscript.arguments
if .count>0 then
   ipaddress="."
   outfile=""
   username=""
   password=""
   viewtype=0
   program=0
   for arg=0 to .count-1
      select case left(lcase(.item(arg)),2)
      case "/h","/?","/h","/?"
         usage()
     wscript.quit
      case "/r","/r"
     if arg+3<=.count-1 then
     ipaddress=.item(arg+1)
     username=.item(arg+2)
     password=.item(arg+3)
     else
     wscript.echo "Arguments Error!"&vbcrlf
     usage()
     wscript.quit
     end if
      case "/v","/v"
     viewtype=1
      case "/o","/o"
     outfile=.item(arg+1)
      case "/a","/a"
     program=1
      end select
   next
end if
end with

on error resume next
if outfile<>"" then
   set fs=createobject("scripting.filesystemobject")
   showerr()
   set of=fs.opentextfile(outfile,8,true)
   showerr()
end if
wscript.echo "Getting Infomation...."&vbcrlf
set objlocator=createobject("wbemscripting.swbemlocator")
showerr()
set objswb=objlocator.connectserver(ipaddress,"root/cimv2",username,password)
showerr()
on error goto 0

set obj1=objget("win32_computersystem")
set obj2=objget("win32_operatingsystem")
set col3=objswb.instancesof("win32_processor")
set obj4=objget("win32_logicalmemoryconfiguration")
set obj5=objget("win32_bios")
set obj6=objget("win32_displayconfiguration")
set col7=objswb.instancesof("win32_diskdrive")
set col8=objswb.instancesof("win32_logicaldisk")
set col9=objswb.instancesof("win32_networkadapterconfiguration")
set col10=objswb.instancesof("win32_quickfixengineering")
if program=1 then
   set objswb1=objlocator.connectserver(ipaddress,"root/default",username,password)
   set obj11=objswb1.get("stdregprov")
end if
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表