giddyup Posted January 20, 2011 Share Posted January 20, 2011 i would like to retrieve a text file of software installed for each user i send this script to, and have it named after the user logged in, and not just software.txt this works fine: ; splashtext .. please wait ... SplashTextOn("Software List", "Please wait....", 400, 100, -1, 300, 16, "", 15) Sleep(1000) SplashOff() ; gets software list, version Run(@ComSpec & " /k" & "wmic /output:c:\software.txt product get name, version", @TempDir, @SW_HIDE) ; moves software file to desktop FileMove("c:\software.txt", @DesktopDir & "\software.txt", 1) WinActivate("C:\WINDOWS\system32\cmd.exe", "") ; msgbox please reply MsgBox(0, "Software List", "Please reply with software.txt file") so far i've tried: $file= "c:\" & @UserName & "software.txt" ; splashtext .. please wait ... SplashTextOn("Software List", "Please wait....", 400, 100, -1, 300, 16, "", 15) Sleep(1000) SplashOff() ; gets software list, version Run(@ComSpec & " /k" & "wmic /output:c:\software.txt product get name, version", @TempDir, @SW_HIDE) ; if user file already listed, then show msgbox, exit script If FileExists($file) Then MsgBox (0, "File Exists", "file Exists Already!", 3) Exit(0) EndIf ; moves software file to desktop FileMove("c:\software.txt", & @DesktopDir & @UserName ".txt", 1) ; msgbox please reply MsgBox(0, "Software List", "Please reply with software.txt file") the if statement runs, but does not display msgbox, and can't seem to get the output named after user(software.txt) thanks for ideas. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted January 20, 2011 Moderators Share Posted January 20, 2011 Hi, Giddyup and welcome to the Forums. Just a point of clarification, are you wanting a list of software installed on each machine in your organization, or a list of software categorized by the user that installed it? That will help greatly in troubleshooting. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
giddyup Posted January 20, 2011 Author Share Posted January 20, 2011 Hi, Giddyup and welcome to the Forums. Just a point of clarification, are you wanting a list of software installed on each machine in your organization, or a list of software categorized by the user that installed it? That will help greatly in troubleshooting.just a list of software for the specific user i send the script to. upgrading computers.i send the script as an .exe,(zipped) and have the user run it, then reply back w/an email, and attach the software.txt.having a @username.txt would help me determine who i already have, plus each would be unique.hope this helps.thanks for the reply. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted January 20, 2011 Moderators Share Posted January 20, 2011 Ok, it sounds as though you are trying to find the software on a list of machines (forgive me if I'm still misunderstanding you). If the machines are on a network and pingable, you could use something similar to what is below to pull the installed applications without needing user interaction. If you have a number of them to query, you could always use a loop to write the array contents to a file and name it the same as the computer name. #include <Array.au3> $Computer = InputBox( "Enter Asset Tag", "What machine would you like to connect to?" ) $ret = _SoftwareInfo() _ArrayDisplay($ret, '') Func _SoftwareInfo($s_RemoteComputer = $Computer) Local $Count = 1 If $s_RemoteComputer <> '' Then $s_RemoteComputer = '\\' & StringReplace($s_RemoteComputer, '\', '') & '\' Local Const $regkey = $s_RemoteComputer & 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall' While 1 $key = RegEnumKey ($regkey, $Count) If @error <> 0 then ExitLoop $line = RegRead ($regkey & '\' & $key, 'Displayname') $line = StringReplace ($line, ' (remove only)', '') If $line <> '' Then If Not IsDeclared('avArray') Then Dim $avArray[1] ReDim $avArray[UBound($avArray) + 1] $avArray[UBound($avArray) - 1] = $line EndIf $Count = $Count + 1 WEnd If Not IsDeclared('avArray') Or Not IsArray($avArray) Then Return(SetError(1, 0, '')) Else $avArray[0] = UBound($avArray) - 1 Return(SetError(0,0, $avArray)) EndIf EndFunc If you need to have the user run it, you could simply modify the first line in the above script to say the following. Hope this helps. $Computer = @ComputerName "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
iamtheky Posted January 20, 2011 Share Posted January 20, 2011 (edited) Heres a simple one Global $sSft Global $create = FileOpen (@UserName & ".txt" , 1) _ComputerGetSoftware($sSft) exit Func _ComputerGetSoftware(ByRef $aSoftwareInfo) Local Const $UnInstKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" Local $i = 1 Dim $aSoftwareInfo[1][1] $input = "ALL" If @Error = 1 Then Exit If $input = 'ALL' Then For $j = 1 To 500 $AppKey = RegEnumKey($UnInstKey, $j) If @error <> 0 Then Exitloop If RegRead($UnInstKey & "\" & $AppKey, "DisplayName") = '' Then ContinueLoop ReDim $aSoftwareInfo[UBound($aSoftwareInfo) + 1][1] $aSoftwareInfo[$i][0] = StringStripWS(StringReplace(RegRead($UnInstKey & "\" & $AppKey, "DisplayName"), " (remove only)", ""), 3) FileWrite($create , $aSoftwareInfo[$i][0] & @CRLF) $i = $i + 1 Next Endif EndFunc Edited January 20, 2011 by iamtheky ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
Malik140786 Posted August 19, 2011 Share Posted August 19, 2011 Hello have tried this script but i am not able to fetch the data from remote computer,it's working for local host also tried with thw Runas command but there is no output also have the admin privilege beacuse i am new to autoit so kindly educate me on the same waiting for reply Thanks in Advance. Link to comment Share on other sites More sharing options...
hannes08 Posted August 19, 2011 Share Posted August 19, 2011 (edited) RunAs() just runs the program LOCALLY under another user account. You can use tools like PSEXEC from Microsoft/Sysinternals to run scripts on remote machines. Also you could try to get the information via WMI. EDIT: Okay, and please don't use sombody else's topics. Create your own. Edited August 19, 2011 by Hannes123 Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
Malik140786 Posted August 22, 2011 Share Posted August 22, 2011 Thanks Hannes But i am new to scripting can u help me to improve. Regards, Malik 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