[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[问题求助] VBS硬件获取文件保存指定位置

On Error Resume Next
Temp = 0
Set WSHNetwork = WScript.CreateObject("WScript.Network")
ComputerName = WSHNetwork.ComputerName
TempFiles = desktop & ComputerName &".txt"
Set FSO = CreateObject("Scripting.FileSystemObject")
Set TempFile = FSO.CreateTextFile(TempFiles)
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set CPU = objWMIService.ExecQuery("Select * From Win32_Processor")
For Each Item In CPU
    CPU2 = "CPU:" & Item.Name
Next

Set Board = objWMIService.ExecQuery("Select * From Win32_BaseBoard")
For Each Item In Board
    Board2 = "主板: " & Item.Product
Next
Set colItems = objWMIService.ExecQuery("Select * From Win32_PhysicalMemory",,48)
For Each objItem In colItems
    A = objItem.Capacity/1048576
    Temp = temp+objItem.Capacity
    N = N+1
Next
Memory = Temp/1048576
If N = 1 Then
    Memory2 = "内存: " & N & "条" & A & "M"
Else
    Memory2 = "内存: " & N & "条" & A & "M" &" 总计" & Memory & "M"
End If
Set Video = objWMIService.ExecQuery("Select * From Win32_VideoController",,48)
For Each Item In Video
    Video2 = "显卡: " & Item.Description
    Video3 = "分辨率: " & Item.VideoModeDescription
Next
Set VideoA = objWMIService.ExecQuery("Select * From Win32_DesktopMonitor",,48)
For Each Item In VideoA
    VideoA = "显示器名称: " & Item.Description
    VideoB = "屏幕高度: " & Item.ScreenHeight & "   屏幕宽度: " & Item.ScreenWidth
Next
Set Disk = objWMIService.ExecQuery("Select * From Win32_DiskDrive")
For Each Item In Disk
    Disk2 = Disk2 & Item.Model
    Disk4 = Int(Item.Size/1000/1000/1000) & "G"
Next
Disk3 = "硬盘: " & Trim(Disk2)
Disk5 = "硬盘容量: " & Disk4
Set Network = objWMIService.ExecQuery("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
For Each Item In Network
    Lan = "网卡: " & Item.Description
    IP = "IP地址: " & Item.IPAddress(0)
    MacAdd = "MAC地址:" & Item.MACAddress
Next

TempFile.WriteLine(CPU2)
TempFile.WriteLine(Board2)
TempFile.WriteLine(Memory2)
TempFile.WriteLine(Video2)
TempFile.WriteLine(Video3)
TempFile.WriteLine(VideoA)
TempFile.WriteLine(VideoB)
TempFile.WriteLine(Disk3)
TempFile.WriteLine(Disk5)
TempFile.WriteLine(Lan)
TempFile.WriteLine(Ip)
TempFile.WriteLine(MacAdd)
TempFile.Close


运行此VBS后弹出输入ComputerName ,再以ComputerName保存配置文件,并复制一份至共享盘\\192.168.8.30\XINXIBU     谢谢!

哪位大侠能帮忙处理一下吗,非常感谢!
1、在上面这段获取电脑配置的VBS前,增加一个修改电脑名称的功能,功能如下面BAT
@echo off
echo AppLife.Net
set /p name=请输您的计算机名:
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ActiveComputerName" /v ComputerName /t reg_sz /d %name% /f >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters" /v "NV Hostname" /t reg_sz /d %name% /f >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters" /v Hostname /t reg_sz /d %name% /f >nul 2>nul
echo.
echo 修改计算机名完毕
--------------------------------
2、上面帖子扫描出的电脑配置以修改过的电脑名称保存为txt文件在这个软件目录下面,并复制一份至共享盘
\\192.168.8.30\XINXIBU     谢谢!

TOP

返回列表