主頁(yè) > 知識(shí)庫(kù) > 用VBScript收集系統(tǒng)信息并上傳到ftp空間

用VBScript收集系統(tǒng)信息并上傳到ftp空間

熱門(mén)標(biāo)簽:辦理膠州400電話財(cái)稅 百度地圖標(biāo)注怎么卸載 外呼營(yíng)銷(xiāo)下單系統(tǒng) 前鋒辦理400電話申請(qǐng) 陜西高頻外呼回?fù)芟到y(tǒng)哪家好 新密防封卡外呼系統(tǒng)違法嗎 打電話的外呼系統(tǒng)貴不貴 海外美發(fā)店地圖標(biāo)注 加盟電銷(xiāo)機(jī)器人好的品牌
之前無(wú)聊整理出來(lái)了一份這個(gè)東西,因?yàn)樵趩挝唤o新入職的員工配電腦時(shí),需要登記一遍設(shè)備,可每次總要查感覺(jué)挺麻煩,結(jié)果下面的這份VBS腳本就誕生了,只可惜這個(gè)腳本做好了卻沒(méi)派上用場(chǎng)哎。。。

這個(gè)腳本的功能是運(yùn)行后自動(dòng)將查詢到的計(jì)算機(jī)相關(guān)信息記錄到一個(gè)文檔中,然后在經(jīng)過(guò)FTP將生成的文件上傳至服務(wù)器保存,最后在清除運(yùn)行腳本是生成的文件并刪除自身。

下面是代碼:
復(fù)制代碼 代碼如下:

'#####收集計(jì)算機(jī)信息_開(kāi)始#####
On Error Resume Next
Set fso = CreateObject("Scripting.FileSystemObject")
Set f1 = fso.CreateTextFile("info")
strComputer = "."
If Err.Description = "" Then
'收集本地計(jì)算機(jī)名稱
Set objWMIService = GetObject("winmgmts:\\" strComputer "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem", , 48)
J = 0
For Each objItem In colItems
If J = 0 Then f1.write (Trim(objItem.Name)) Else f1.write (Trim(objItem.Name)) '收集本地計(jì)算機(jī)名稱
J = J + 1
Next
'收集計(jì)算機(jī)登錄帳戶
f1.write (chr(10))
f1.write (";")
f1.write (chr(10))
Set objWMIService = GetObject("winmgmts:\\" strComputer "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem", , 48)
J = 0
For Each objItem In colItems
If J = 0 Then f1.write (Trim(objItem.UserName)) Else f1.write (Trim(objItem.UserName)) '收集計(jì)算機(jī)登錄帳戶
J = J + 1
Next
'收集CPU信息
f1.write (chr(10))
f1.write (";")
f1.write (chr(10))
Set objWMIService = GetObject("winmgmts:\\" strComputer "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor", , 48)
J = 1
For Each objItem In colItems
If J = 0 Then f1.write (Trim(objItem.Name)) Else f1.write (Trim(objItem.Name) "||")
J = J + 1
Next
'收集內(nèi)存總?cè)萘?
f1.write (chr(10))
f1.write (";")
f1.write (chr(10))
Set objWMIService = GetObject("winmgmts:\\" strComputer "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem", , 48)
J = 2
For Each objItem In colItems
If J = 0 Then f1.write (Trim(objItem.TotalPhysicalMemory)/1024/1024 " GB") Else f1.write (Trim(objItem.TotalPhysicalMemory)/1024/1024 " GB" "||")
J = J + 1
Next
'收集顯卡信息
f1.write (chr(10))
f1.write (";")
f1.write (chr(10))
Set objWMIService = GetObject("winmgmts:\\" strComputer "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_VideoController", , 48)
J = 4
For Each objItem In colItems
If J = 0 Then f1.write (Trim(objItem.Caption) (objItem.VideoModeDescription)) Else f1.write (Trim(objItem.Caption) (objItem.VideoModeDescription) "||")
J = J + 1
Next
'收集硬盤(pán)基本信息
f1.write (chr(10))
f1.write (";")
f1.write (chr(10))
Set objWMIService = GetObject("winmgmts:\\" strComputer "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_DiskDrive", , 48)
J = 5
For Each objItem In colItems
If J = 0 Then f1.write (Trim(objItem.Model) (objItem.Size)/1024/1024/1024 " GB" (objItem.Partitions)) Else f1.write (Trim(objItem.Model) "--" (objItem.Size)/1024/1024/1024 " GB" "--" (objItem.Partitions) "||")
J = J + 1
Next
'收集聲卡信息
f1.write (chr(10))
f1.write (";")
f1.write (chr(10))
Set objWMIService = GetObject("winmgmts:\\" strComputer "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_SoundDevice", , 48)
J = 6
For Each objItem In colItems
If J = 0 Then f1.write (Trim(objItem.ProductName)) Else f1.write (Trim(objItem.ProductName) "||")
J = J + 1
Next
'收集網(wǎng)卡信息
f1.write (chr(10))
f1.write (";")
f1.write (chr(10))
Set objWMIService = GetObject("winmgmts:\\" strComputer "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter", , 48)
J = 7
For Each objItem In colItems
If J = 0 Then f1.write (Trim(objItem.NetConnectionID) (objItem.Description) (objItem.MACAddress) (objItem.Manufacturer)) Else f1.write (Trim(objItem.NetConnectionID) "--" (objItem.ProductName) "--" (objItem.MACAddress) "--" (objItem.Manufacturer) "||")
J = J + 1
Next
End If
f1.Close
'#####收集計(jì)算機(jī)信息_結(jié)束#####
'#####上傳_開(kāi)始#####
Dim WshShell, curDir, wShell, file
Set wShell = WScript.CreateObject("Shell.Application")
Set WshShell = WScript.CreateObject("WScript.Shell")
Set FileSystem = WScript.CreateObject("Scripting.FileSystemObject")
Set OutPutFile = FileSystem.OpenTextFile("upload",2,True)
Set objWMIService = GetObject("winmgmts:\\" strComputer "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem", , 48)
J = 0
For Each objItem In colItems
If J = 0 Then file = "info " Trim(objItem.Name) ".csv" Else file = "info " Trim(objItem.Name) ".csv"
J = J + 1
Next
OutPutFile.WriteLine "open 192.168.0.254 2020"
OutPutFile.WriteLine "user iplog iplog"
OutPutFile.WriteLine "put " file
OutPutFile.WriteLine "bye"
OutPutFile.Close
Wshshell.run "ftp -n -s:upload"

Set wShell = Nothing
Set WshShell = Nothing
Set FileSystem = Nothing
Set OutPutFile = Nothing
'#####上傳_結(jié)束#####
'#####自刪除_開(kāi)始#####
'wscript.sleep 2000
'Set obj = CreateObject("Scripting.FileSystemObject")
'obj.DeleteFile("upload")
'obj.DeleteFile("info")
'obj.DeleteFile(WScript.ScriptName)
WScript.Quit(0)
'#####自刪除_結(jié)束#####

上傳到ftp地址
open 192.168.0.254 2020
user iplog iplog
put info MDXY.csv
bye
您可能感興趣的文章:
  • java使用ftp上傳文件示例分享
  • linux系統(tǒng)mysql自動(dòng)備份并使用ftp上傳的方法
  • python定時(shí)采集攝像頭圖像上傳ftp服務(wù)器功能實(shí)現(xiàn)
  • Http上傳與Ftp上傳的區(qū)別詳解
  • Linux下使用Shell腳本實(shí)現(xiàn)ftp的自動(dòng)上傳下載的代碼小結(jié)
  • linux下自動(dòng)備份MySQL數(shù)據(jù)并上傳到FTP上的shell腳本
  • 關(guān)于c#連接ftp進(jìn)行上傳下載實(shí)現(xiàn)原理及代碼
  • Linux VPS/服務(wù)器 網(wǎng)站及數(shù)據(jù)庫(kù)自動(dòng)本地備份并FTP上傳備份腳本
  • FTP 550 Permission denied 只能建文件夾,沒(méi)法刪除及上傳文件的原因說(shuō)明
  • php ftp文件上傳函數(shù)(基礎(chǔ)版)
  • php下連接ftp實(shí)現(xiàn)文件的上傳、下載、刪除文件實(shí)例代碼
  • 批處理(ftp)上傳文件到服務(wù)器的代碼
  • ftp上傳時(shí)數(shù)據(jù)Socket錯(cuò)誤連接超時(shí)的解決方法
  • FTP自動(dòng)上傳文件的perl腳本以及配置文件
  • ftp自動(dòng)上傳腳本分享

標(biāo)簽:四平 阜陽(yáng) 梅州 武威 伊春 牡丹江 咸陽(yáng) 河南

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《用VBScript收集系統(tǒng)信息并上傳到ftp空間》,本文關(guān)鍵詞  用,VBScript,收集,系統(tǒng),信息,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《用VBScript收集系統(tǒng)信息并上傳到ftp空間》相關(guān)的同類(lèi)信息!
  • 本頁(yè)收集關(guān)于用VBScript收集系統(tǒng)信息并上傳到ftp空間的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章