atnextc Posted April 30, 2009 Share Posted April 30, 2009 I found a vbs script online that will inventory computers, which is exactly what I need. The problem is I don't know VB cause I need to add somethigns to it. expandcollapse popup'========================================================================== ' ' NAME: <MemProcDiskInventory.vbs> ' ' AUTHOR: Mark D. MacLachlan , ITSynergy ' DATE : 5/15/2003 ' ' COMMENT: <Inventories computer configuration and writes report to disk> '========================================================================== on error resume Next Set oShell = CreateObject("wscript.Shell") Set env = oShell.environment("Process") strComputer = env.Item("Computername") Const HKEY_LOCAL_MACHINE = &H80000002 Const UnInstPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_ ".\root\default:StdRegProv") report = strComputer & " Computer Inventory" & vbCrLf & "******************************************" & vbCrLf & vbCrLf Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48) report = report & vbCrLf & "******************************************" & vbCrLf report = report & "OS Information" & vbCrLf & "******************************************" & vbCrLf & vbCrLf For Each objItem in colItems report = report & strComputer & vbCrLf & "OS Details"& vbCrlf report = report & "Caption: " & objItem.Caption & vbCrLf report = report & "Description: " & objItem.Description & vbCrLf report = report & "EncryptionLevel: " & objItem.EncryptionLevel & vbCrLf report = report & "InstallDate: " & objItem.InstallDate & vbCrLf report = report & "Manufacturer: " & objItem.Manufacturer & vbCrLf report = report & "MaxNumberOfProcesses: " & objItem.MaxNumberOfProcesses & vbCrLf report = report & "Name: " & objItem.Name & vbCrLf report = report & "Organization: " & objItem.Organization & vbCrLf report = report & "OSProductSuite: " & objItem.OSProductSuite & vbCrLf report = report & "RegisteredUser: " & objItem.RegisteredUser & vbCrLf report = report & "SerialNumber: " & objItem.SerialNumber & vbCrLf report = report & "ServicePackMajorVersion: " & objItem.ServicePackMajorVersion & vbCrLf report = report & "ServicePackMinorVersion: " & objItem.ServicePackMinorVersion & vbCrLf report = report & "Version: " & objItem.Version & vbCrLf report = report & "WindowsDirectory: " & objItem.WindowsDirectory & vbCrLf Next Set colSettings = objWMIService.ExecQuery _ ("Select * from Win32_ComputerSystem") report = report & vbCrLf & "******************************************" & vbCrLf report = report & "Memory and Processor Information" & vbCrLf & "******************************************" & vbCrLf & vbCrLf For Each objComputer in colSettings 'report = report & objComputer.Name & vbcrlf report = report & objComputer.TotalPhysicalMemory /1024\1024+1 & "MB Total memory" & vbcrlf Next Set colSettings = objWMIService.ExecQuery _ ("Select * from Win32_Processor") For Each objProcessor in colSettings report = report & objProcessor.Description & " Processor" & vbCrLf Next report = report & vbCrLf & "******************************************" & vbCrLf report = report & "Disk Drive Information" & vbCrLf & "******************************************" & vbCrLf & vbCrLf Set objWMIService = GetObject("winmgmts:") Set objLogicalDisk = objWMIService.Get("Win32_LogicalDisk.DeviceID='c:'") report = report & objLogicalDisk.FreeSpace /1024\1024+1 & "MB Free Disk Space" & vbCrLf report = report & objLogicalDisk.Size /1024\1024+1 & "MB Total Disk Space" & vbCrLf oReg.EnumKey HKEY_LOCAL_MACHINE, UnInstPath, arrSubKeys software = vbCrLf & "******************************************" & vbCrLf software = software & vbCrLf & "Installed Software" & vbCrLf & "******************************************" & vbCrLf & vbCrLf For Each subkey In arrSubKeys 'MsgBox subkey If Left (subkey, 1) <> "{" Then software = software & subkey & vbCrLf End If Next Set fso = CreateObject("Scripting.FileSystemObject") Set ts = fso.CreateTextFile (strComputer & ".txt", ForWriting) ts.write report ts.write software 'MsgBox Report MsgBox "Done" Above is the VB code, can this be "added" into auto it or written in a way in which autoit understands it?? Thanks for any help Link to comment Share on other sites More sharing options...
BrettF Posted April 30, 2009 Share Posted April 30, 2009 Yes. Most of it is very similar... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
atnextc Posted April 30, 2009 Author Share Posted April 30, 2009 Yes. Most of it is very similar... Care to elaborate? Link to comment Share on other sites More sharing options...
bo8ster Posted April 30, 2009 Share Posted April 30, 2009 I don't believe it can be added/injected into a script but it can be converted. I believe what Brett is saying is, it can be converted, the syntax of AutoIt and VB are similar. So if you wanted to convert it - it should not be that hard. Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic] Link to comment Share on other sites More sharing options...
atnextc Posted April 30, 2009 Author Share Posted April 30, 2009 would anyone be kind enough to guide me in the right direction on how I might be able to accomplish this? Since I don't know VB, I obviously don't know what can and can't go in the Autoit script. Link to comment Share on other sites More sharing options...
Juvigy Posted April 30, 2009 Share Posted April 30, 2009 There was a VBscript to Autoit converter. Search for it. Link to comment Share on other sites More sharing options...
atnextc Posted April 30, 2009 Author Share Posted April 30, 2009 I found it shortly after posting this last night, however it doesn't work. There are alot of errors when it converts. Link to comment Share on other sites More sharing options...
BrettF Posted May 1, 2009 Share Posted May 1, 2009 Are you using the full version of SciTE (check my sig)? It should tell you the errors. I imagine the errors are related to constants and the like, but can you post the errors? We ain't physic. Cheers, Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now