Sign in to follow this  
Followers 0
giddyup

software list by username

8 posts in this topic

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.

Share this post


Link to post
Share on other sites



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.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#5 ·  Posted (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 by iamtheky

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#7 ·  Posted (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. :mellow:

Edited by Hannes123

Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]

Share this post


Link to post
Share on other sites

Thanks Hannes

But i am new to scripting can u help me to improve.

Regards,

Malik

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0