Britbadboy Posted February 4, 2006 Share Posted February 4, 2006 Hi there, am coding a script to install a program remotely. What i want to know is when istalling is it possible to get the user information about the pc. E.g. date, time, userID etc on that machine. Also once I have collected this information I want to save it as a .doc file on a networked drive so I can extract the information later at my convinience from there. How do I write the information on this file? Please guide me on how to go about this. Many thanks. Link to comment Share on other sites More sharing options...
Valuater Posted February 4, 2006 Share Posted February 4, 2006 Maybe this expandcollapse popup; ---------------------------------------------------------------------------- ; ; AutoIt Version: 3.1.1++ ; Author: Chaos2 ; Script Function: output basic hardware info ; ; ---------------------------------------------------------------------------- $objWMIService = objget("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2") $colSettings = $objWMIService.ExecQuery("Select * from Win32_OperatingSystem") $colMemory = $objWMIService.ExecQuery("Select * from Win32_ComputerSystem") $colCPU = $objWMIService.ExecQuery("Select * from CIM_Processor") $colVideoinfo = $objWMIService.ExecQuery("Select * from Win32_VideoController") $colSound = $objWMIService.ExecQuery("Select * from Win32_SoundDevice") $colMouse = $objWMIService.ExecQuery("Select * from Win32_PointingDevice") $colMonitor = $objWMIService.ExecQuery("Select * from Win32_DesktopMonitor") $colNIC = $objWMIservice.ExecQuery("Select * from Win32_NetworkAdapter WHERE Netconnectionstatus = 2") Dim $pcinfo For $object in $colCPU $PcInfo = $pcinfo & StringStripWS($object.Name,1) & @CRLF Next For $objOperatingSystem in $colSettings $PcInfo = $PcInfo & $objOperatingSystem.Caption & " Build " & $objOperatingSystem.BuildNumber & " Servicepack " & $objOperatingSystem.ServicePackMajorVersion & "." & $objOperatingSystem.ServicePackMinorVersion & @CRLF $PcInfo = $PcInfo & "Available Physical Memory: " & String(Int(Number($objOperatingSystem.FreePhysicalMemory) / 1024)) & " Mb" & @CRLF Next For $object in $colMemory $PcInfo = $PcInfo & "Total Physical Memory: " & String(Int(Number($object.TotalPhysicalMemory) / (1024 * 1024))) & " Mb" & @CRLF Next $objFSO = objCreate("Scripting.FileSystemObject") $colDrives = $objFSO.Drives $Opticaldrives = "Opticaldrives : " For $object in $colDrives If ($object.DriveType == 2) then $PcInfo = $PcInfo & "Total space on : " & $object.DriveLetter & ":\ (" & $object.VolumeName & ") = " & String(Round((Number($object.TotalSize) / (1024 * 1024 * 1024)),2)) & " Gb" & @CRLF $PcInfo = $PcInfo & "Free space on : " & $object.DriveLetter & ":\ (" & $object.VolumeName & ") = " & String(Round((Number($object.FreeSpace) / (1024 * 1024 * 1024)),2)) & " Gb" & @CRLF Else $Opticaldrives = $Opticaldrives & $object.DriveLetter & ":\ " EndIf Next $PcInfo = $PcInfo & $Opticaldrives & @CRLF For $object in $colVideoinfo $PcInfo = $PcInfo & "Video card: " & $object.Description & @CRLF Next For $object in $colSound $PcInfo = $PcInfo & "Sound device: " & $object.Description & @CRLF Next For $object in $colMouse $PcInfo = $PcInfo & "Mouse : " & $object.Description & @CRLF Next For $object in $colMonitor $PcInfo = $PcInfo & "Monitor : " & $object.Description & @CRLF Next For $object in $colNIC $Pcinfo = $pcinfo & $object.name & @CRLF Next ClipPut( $pcinfo ) MsgBox(48,"PCinfo",$PcInfo) MsgBox( 48, "PCinfo", "Information was copied to clipboard", 5) works great 8) Link to comment Share on other sites More sharing options...
Britbadboy Posted February 4, 2006 Author Share Posted February 4, 2006 please if you don't mind explain this to me? it doesn't even work, the following erroe is displayed! Link to comment Share on other sites More sharing options...
greenmachine Posted February 4, 2006 Share Posted February 4, 2006 You didn't copy it right. The ; means that the line is a comment. Copy the WHOLE thing, including the white space at the top, and it will work. Link to comment Share on other sites More sharing options...
Britbadboy Posted February 4, 2006 Author Share Posted February 4, 2006 ok now that I have looked into myself, can someone only tell me how do i use macros?! Link to comment Share on other sites More sharing options...
greenmachine Posted February 4, 2006 Share Posted February 4, 2006 What about them? That question wasn't very specific. Link to comment Share on other sites More sharing options...
Britbadboy Posted February 4, 2006 Author Share Posted February 4, 2006 You didn't copy it right. The ; means that the line is a comment. Copy the WHOLE thing, including the white space at the top, and it will work.copied it again and tried running it again too, here is what the error log says:>"C:\Program Files\AutoIt3\SciTe\CompileAU3\CompileAU3.exe" /run /beta /ErrorStdOut /in "F:\AutoIT Files\systeminformation.au3" /autoit3dir "C:\Program Files\AutoIt3\beta" /UserParams >Running AU3Check...C:\Program Files\AutoIt3\SciTe\Defs\Unstable\Au3Check\au3check.dat>AU3Check Ended. No Error(s).>Running: (3.1.1.0):C:\Program Files\AutoIt3\autoit3.exe "F:\AutoIT Files\systeminformation.au3" F:\AutoIT Files\systeminformation.au3 (14) : ==> Unable to parse line.: $colSettings = $objWMIService.ExecQuery("Select * from Win32_OperatingSystem") $colSettings = $objWMIService.E^ ERROR>AutoIT3.exe ended.>Exit code: 0 Time: 1.339 Link to comment Share on other sites More sharing options...
Britbadboy Posted February 4, 2006 Author Share Posted February 4, 2006 In autoit help file it details as follows:AutoIt has an number of Macros that are special read-only variables used by AutoIt. Macros start with the @ character instead of the usual $ so are easy to tell apart. As with normal variables you can use macros in expressions but you cannot assign a value to them.The pre-defined macros are generally used to provide easy access to system information like the location of the Windows directory, or the name of the logged on user.Go here for a complete list.with the bit in orange being the eaxt thing i need to get! so how do i use these macros is my question. Link to comment Share on other sites More sharing options...
greenmachine Posted February 4, 2006 Share Posted February 4, 2006 Get beta.http://www.autoitscript.com/autoit3/files/beta/autoit/Notice the script says 3.1.1++ (means greater than 3.1.1.0) Link to comment Share on other sites More sharing options...
greenmachine Posted February 4, 2006 Share Posted February 4, 2006 In response to your macro question: get Scite and press the @ key, or look it up in the help file.Scite: http://www.autoitscript.com/autoit3/scite/downloads.php Link to comment Share on other sites More sharing options...
Britbadboy Posted February 4, 2006 Author Share Posted February 4, 2006 well I do have scite and am using it at the moment. What am confused about e.g. is if i use @UserName which gives me the information about the current user logged on. How do I use it? Then how do i open up a text file and save the information there? Link to comment Share on other sites More sharing options...
greenmachine Posted February 4, 2006 Share Posted February 4, 2006 (edited) FileWriteLine ("yourfile.txt", @UserName) Smoke help me out here, I'm not sure exactly what he's asking for. Edited February 4, 2006 by greenmachine Link to comment Share on other sites More sharing options...
Britbadboy Posted February 4, 2006 Author Share Posted February 4, 2006 sorry it must be the time of the night thats getting on my nerves too. Well to write all this information i need to create a file then write this information on it. so i tried using Fileopen and filecreate but stuck again! Please tell me how do I use these functions? Link to comment Share on other sites More sharing options...
greenmachine Posted February 4, 2006 Share Posted February 4, 2006 Just read the helpfile. Please. Link to comment Share on other sites More sharing options...
hoppy Posted March 26, 2006 Share Posted March 26, 2006 any easy way to get directX version in this to? 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