Jump to content

Windows 7 works Windows Xp not so much..


Recommended Posts

I am writing a script that I am going to push to all of my clients to get a thorough list of information about their computers. I run the script on a machine with windows 7 and it works without a hitch every time. I tried running it on a PC with windows XP and I get error on line 981. I have spent the last couple of hours trying to track down a command I might have used that isn't supported on windows XP and I seem to be spinning my wheels. Any insight would be greatly appreciated as I am pulling what left of my hair out trying to get this figured out... :-)

#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.6.1
Author:      Sean
Script Function:

#ce ----------------------------------------------------------------------------
#include <Constants.au3>
#include <File.au3>
;Grab Current Username
$UserName=@UserName
; Verify $Username.txt does not exist, if it does delete it.
$FileCHK=FileExists ("C:\Users\" & $UserName & "\Desktop\" & $UserName & ".txt")
if $FileCHK=1 Then
  FileDelete("C:\Users\" & $UserName & "\Desktop\" & $UserName & ".txt")
EndIf
; Create Fresh $Username.txt
_FileCreate("C:\Users\" & $UserName & "\Desktop\" & $UserName & ".txt")
    $FileLoc=("C:\Users\" & $UserName & "\Desktop\" & $UserName & ".txt")
FileWrite($FileLoc, "Basic Computer Information:")
FileWrite($FileLoc, @CR)
FileWrite($FileLoc, @CR)
GetComputerName($FileLoc)
GetOSVersion($FileLoc)
GetOSArch($FileLoc)
FileWrite($FileLoc, @CR)
FileWrite($FileLoc, "*****************************************************************************************************************" & @CR)
FileWrite($FileLoc, @CR)
FileWrite($FileLoc, "Detailed Computer Information:")
FileWrite($FileLoc, @CR)
FileWrite($FileLoc, @CR)
GetDetailedCompInfo($FileLoc)
    FileWrite($FileLoc, @CR)
FileWrite($FileLoc, "*****************************************************************************************************************" & @CR)
FileWrite($FileLoc, @CR)
FileWrite($FileLoc, "MAC Adresses:")
FileWrite($FileLoc, @CR)
FileWrite($FileLoc, @CR)
GetMACAddresses($FileLoc)
FileWrite($FileLoc, @CR)
FileWrite($FileLoc, "*****************************************************************************************************************" & @CR)
FileWrite($FileLoc, @CR)
FileWrite($FileLoc, "Installed Software:")
FileWrite($FileLoc, @CR)
FileWrite($FileLoc, @CR)
GetInstalledSoftware($FileLoc)

;End of program
EndProgram()
; ***************************************************************************************************************** ;
; ================================== ;
;           Functions
; ================================== ;
; ========================================================================= ;
; This function Gets the Name of the Computer And Prints it to a Text File
; ========================================================================= ;
Func GetComputerName($FileLoc)
$ComputerName=@ComputerName
FileWrite($FileLoc,"Computer Name: " & $ComputerName & @CR)
EndFunc
; =========================================================================== ;
; This function Gets the Name of the OS Version And Prints it to a Text File
; =========================================================================== ;
Func GetOSVersion($FileLoc)
$OSVersion=@OSVersion
$OSSvcPack=@OSServicePack
Local $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
    Local $colSettings = $objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
    For $objOperatingSystem In $colSettings
        FileWrite($FileLoc,"OS Version: " & $objOperatingSystem.Caption & " " & $OSSvcPack & @CR)
    Next
EndFunc

; ========================================================================= ;
; This function Gets the Name of the OS Arch And Prints it to a Text File
; ========================================================================= ;
Func GetOSArch($FileLoc)
$OSArch=@OSArch
FileWrite($FileLoc,"OS Arch: " & $OSArch & @CR)
EndFunc
; =================================================================================== ;
; This function Gets the Detailed Computer Information And Prints it to a Text File
; =================================================================================== ;
Func GetDetailedCompInfo($FileLoc)
$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$strComputer = "localhost"
$Output=""
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystemProduct", "WQL", _
                                          $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
If IsObj($colItems) then
For $objItem In $colItems
  FileWrite($FileLoc,"Caption: " & $objItem.Caption & @CR)
  FileWrite($FileLoc,"Description: " & $objItem.Description & @CR)
  FileWrite($FileLoc,"Service Tag: " & $objItem.IdentifyingNumber & @CR)
  FileWrite($FileLoc,"Name: " & $objItem.Name & @CR)
  FileWrite($FileLoc,"UUID: " & $objItem.UUID & @CR)
  FileWrite($FileLoc,"Vendor: " & $objItem.Vendor & @CR)
  FileWrite($FileLoc,"Version: " & $objItem.Version & @CR)
Next
Endif
EndFunc
; ====================================================================================================== ;
; This function Gets the Mac Addresses of the Computers Network Adapters And Prints them to a Text File
; ====================================================================================================== ;
Func GetMACAddresses($FileLoc)
$objWMIService  = ObjGet("winmgmts:{impersonationLevel=impersonate}")
$netAdapterSet = $objWMIService.ExecQuery("select * from Win32_NetworkAdapter")
For $netAdapter in $netAdapterSet
  FileWrite($FileLoc, $netAdapter.Name & ": " & $netAdapter.MACAddress & @CR)
Next
EndFunc
; ==================================================================================== ;
; This Function Gets the Software installed on the computer and Prints it to the File
; ==================================================================================== ;
Func GetInstalledSoftware($FileLoc)
    $sSoftwareName = ''
    Dim $aSoftwareList[1][2]
    $objInstaller = ObjCreate('WindowsInstaller.Installer')
    $Products = $objInstaller.Products
    For $Product In $Products
        If $sSoftwareName <> '' And $sSoftwareName <> $objInstaller.ProductInfo($Product, 'ProductName') Then ContinueLoop
        ReDim $aSoftwareList[UBound($aSoftwareList) + 1][2]
        $aSoftwareList[UBound($aSoftwareList) - 1][0] = $objInstaller.ProductInfo($Product, 'ProductName')
        $aSoftwareList[UBound($aSoftwareList) - 1][1] = $objInstaller.ProductInfo($Product, 'VersionString')
        FileWrite($FileLoc,$objInstaller.ProductInfo($Product, 'ProductName') & " ")
        FileWrite($FileLoc,$objInstaller.ProductInfo($Product, 'VersionString') &@CR)
    Next
EndFunc
; ==================================== ;
; This Function Wraps up the program
; ==================================== ;
Func EndProgram()
EndFunc
; ***************************************************************************************************************** ;
Link to comment
Share on other sites

"C:UsersUsername" doesn't normally exist in WinXP, you should be using @DeskTopDir to get the user's desktop folder name instead of trying to get to it that way.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • Moderators

Hi, smf113. I haven't gotten all the way through your script, but to begin with I noticed you're specifying a static location for your UserName.txt ("C:Users$UserNameDesktop"). This is not going to work for XP, as there is no "C:Users". I would suggest using one of the built in macros in AutoIt, such as @DesktopDir or at least @UserProfileDir.

"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

"C:UsersUsername" doesn't normally exist in WinXP, you should be using @DeskTopDir to get the user's desktop folder name instead of trying to get to it that way.

heh i feel pretty dumb.... thank you that did it for the most part. Now I am just having a issue with the installed software.

Link to comment
Share on other sites

I've considerably shortened up your code by eliminating numerous things that weren't really necessary, also I've eliminated the use of the File.au3 UDF as it's not needed for this script at all. You were also using FileWrite to write everything to a text file, and then you'd have to add in the @CR to every line, if you use FileWriteLine instead, you can bypass having to dothat because it adds that in for you. Plus, you were using an array in your installed software function, and redimming it constantly, but you weren't using that array for anything. ReDim can take a while to do its thing, so redimming an array you're not using is just wasting the script time.

#cs ----------------------------------------------------------------------------
    AutoIt Version: 3.3.6.1
    Author:      Sean
    Script Function:

#ce ----------------------------------------------------------------------------
#include <Constants.au3>

;Grab Current Username
Global $UserName = @UserName
Global $FileName = @DesktopDir & "" & $UserName & ".txt"
; Verify $Username.txt does not exist, if it does delete it.
Global $FileCHK = FileExists($FileName)
If $FileCHK = 1 Then
    FileDelete($FileName)
EndIf
; Create Fresh $Username.txt
Global $FileLoc = FileOpen($FileName, 2)
FileWriteLine($FileLoc, @MON & "/" & @MDAY & "/" & @YEAR & @CRLF & "Basic Computer Information:" & @CR & @CRLF)
FileWriteLine($FileLoc, "Computer Name: " & @ComputerName)
GetOSVersion($FileLoc)
FileWriteLine($FileLoc, "OS Arch: " & @OSArch & @CRLF)
FileWriteLine($FileLoc, "*****************************************************************************************************************" & @CRLF)
FileWriteLine($FileLoc, "Detailed Computer Information:" & @CRLF & @CRLF)
GetDetailedCompInfo($FileLoc)
FileWriteLine($FileLoc, @CRLF & "*****************************************************************************************************************" & @CRLF)
FileWriteLine($FileLoc, "MAC Adresses:" & @CRLF & @CRLF)
GetMACAddresses($FileLoc)
FileWriteLine($FileLoc, @CRLF & "*****************************************************************************************************************" & @CRLF)
FileWriteLine($FileLoc, "Installed Software:" & @CRLF & @CRLF)
GetInstalledSoftware($FileLoc)
;End of program
EndProgram()
; ***************************************************************************************************************** ;
; ================================== ;
;           Functions
; ================================== ;
; =========================================================================== ;
; This function Gets the Name of the OS Version And Prints it to a Text File
; =========================================================================== ;
Func GetOSVersion($FileLoc)
    Local $OSSvcPack = @OSServicePack
    Local $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!.rootcimv2")
    Local $colSettings = $objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
    For $objOperatingSystem In $colSettings
        FileWriteLine($FileLoc, "OS Version: " & $objOperatingSystem.Caption & " " & $OSSvcPack)
    Next
EndFunc   ;==>GetOSVersion

; =================================================================================== ;
; This function Gets the Detailed Computer Information And Prints it to a Text File
; =================================================================================== ;
Func GetDetailedCompInfo($FileLoc)
    Local $wbemFlagReturnImmediately = 0x10
    Local $wbemFlagForwardOnly = 0x20
;~  Local $colItems = ""
    Local $strComputer = "."
    Local $Output = ""
    Local $objWMIService = ObjGet("winmgmts:" & $strComputer & "rootCIMV2")
    Local $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystemProduct", "WQL", _
            $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
    If IsObj($colItems) Then
        For $objItem In $colItems
            FileWriteLine($FileLoc, "Caption: " & $objItem.Caption & @CRLF)
            FileWriteLine($FileLoc, "Description: " & $objItem.Description & @CRLF)
            FileWriteLine($FileLoc, "Service Tag: " & $objItem.IdentifyingNumber & @CRLF)
            FileWriteLine($FileLoc, "Name: " & $objItem.Name & @CRLF)
            FileWriteLine($FileLoc, "UUID: " & $objItem.UUID & @CRLF)
            FileWriteLine($FileLoc, "Vendor: " & $objItem.Vendor & @CRLF)
            FileWriteLine($FileLoc, "Version: " & $objItem.Version & @CRLF)
        Next
    EndIf
EndFunc   ;==>GetDetailedCompInfo
; ====================================================================================================== ;
; This function Gets the Mac Addresses of the Computers Network Adapters And Prints them to a Text File
; ====================================================================================================== ;
Func GetMACAddresses($FileLoc)
    Local $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}")
    Local $netAdapterSet = $objWMIService.ExecQuery("select * from Win32_NetworkAdapter")
    For $netAdapter In $netAdapterSet
        FileWriteLine($FileLoc, $netAdapter.Name & ": " & $netAdapter.MACAddress)
    Next
EndFunc   ;==>GetMACAddresses
; ==================================================================================== ;
; This Function Gets the Software installed on the computer and Prints it to the File
; ==================================================================================== ;
Func GetInstalledSoftware($FileLoc)
    $sSoftwareName = ''
    $objInstaller = ObjCreate('WindowsInstaller.Installer')
    $Products = $objInstaller.Products
    For $Product In $Products
        If $objInstaller.ProductInfo($Product, 'ProductName') <> "" Then FileWriteLine($FileLoc, $objInstaller.ProductInfo($Product, 'ProductName') & " " & $objInstaller.ProductInfo($Product, 'VersionString'))
    Next
EndFunc   ;==>GetInstalledSoftware
; ==================================== ;
; This Function Wraps up the program
; ==================================== ;
Func EndProgram()
    FileClose($FileLoc)
EndFunc   ;==>EndProgram
; ***************************************************************************************************************** ;

Try this and see if it does what you're looking to do.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Wow you didn't have to do that thank you so much. It works great. Though windows XP is still having an issue building the installed software list. Do you know of any issues it would have with the WindowsInstaller.Installer object?

Link to comment
Share on other sites

hmm I'm getting an error on line 623, the output goes as far as the installed software label, but then doesn't list the software. I am using Windows XP Pro SP3 as well. You said you fixed some variables which ones did you modify?

Link to comment
Share on other sites

@ 69255

Line 82 needs to be like this you missed a '&'

If $objInstaller.ProductInfo($Product, 'ProductName') & "" Then FileWriteLine($FileLoc, $objInstaller.ProductInfo($Product, 'ProductName') & " " & $objInstaller.ProductInfo($Product, 'VersionString'))
Edited by Chimaera
Link to comment
Share on other sites

I just tested my script and 69255's script on Windows XP Professional x86 and got no errors, after I fixed the line that was missing the "<>" in the installed software function.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

I just added the #RequireAdmin, no luck. I also changed the login type to administrator. I was logged into the computer as a client to verify the functionality. Still no go. I get the following ouput:

04/10/2012

Basic Computer Information:

Computer Name: ENGTEMP1

OS Version: Microsoft Windows XP Professional Service Pack 3

OS Arch: X86

*****************************************************************************************************************

Detailed Computer Information:

Caption: Computer System Product

Description: Computer System Product

Service Tag: ***** <-- Done intentionally

Name: OptiPlex 780

UUID: <-- Left blank intentionally

Vendor: Dell Inc.

Version:

*****************************************************************************************************************

MAC Adresses:

RAS Async Adapter:

WAN Miniport (L2TP):

WAN Miniport (PPTP): 50:50:54:50:30:30

WAN Miniport (PPPOE): 33:50:6F:45:30:30

Direct Parallel:

WAN Miniport (IP):

Packet Scheduler Miniport: 8C:9B:20:52:41:53

Intel® 82567LM-3 Gigabit Network Connection: F0:4D:A2:0C:AD:D3

Packet Scheduler Miniport: F0:4D:A2:0C:AD:D3

Teefer2 Miniport: F0:4D:A2:0C:AD:D3

Teefer2 Miniport: 8C:9B:20:52:41:53

*****************************************************************************************************************

Installed Software:

Link to comment
Share on other sites

I used this function in an uninstaller program I was working on a long time ago, it reads the Uninstall information from the registry and I've modified it to write that information to the text file in this program. I have it filter out a lot of things, like language packs and updates and updaters. It will also work on x64 machines, because there's a ton of uninstall information that's different depending upon the OS architecture.

;add these lines after your GetInstalledSoftware function call
FileWriteLine($FileLoc, @CRLF & "*****************************************************************************************************************" & @CRLF)
FileWriteLine($FileLoc, "Installed Software:" & @CRLF & @CRLF)
_SoftwareInfo()
;add this section to the end of your script, location doesn't matter
Func _SoftwareInfo()
    Local $Count = 1, $Count1 = 1
    Local $regkey = 'HKLMSOFTWAREMicrosoftWindowsCurrentVersionUninstall'
    While 1
        Local $key = RegEnumKey($regkey, $Count1)
        If @error <> 0 Then ExitLoop
        Local $line = RegRead($regkey & '' & $key, 'Displayname')
        Local $line2 = RegRead($regkey & "" & $key, "MoreInfoURL")
        Local $line3 = RegRead($regkey & "" & $key, "UninstallString")
        If $line <> '' And $line3 <> "" And Not StringInStr($line, "Office Suite Service Pack", 0) And Not StringInStr($line, "Language Pack", 0) And Not StringInStr($line, "update for", 0) Then
            If StringMid($line2, StringLen($line2) - 9, 4) <> "/kb/" Then
                If Not IsDeclared('avArray') Then Local $avArray[100][2]
                If UBound($avArray) - $Count <= 1 Then ReDim $avArray[UBound($avArray) + 100][2]
                $avArray[$Count - 1][0] = $line
                $avArray[$Count - 1][1] = $line3
                $Count = $Count + 1
            EndIf
        EndIf
        $Count1 += 1
    WEnd
    If Not IsDeclared('avArray') Or Not IsArray($avArray) Then
        Return (SetError(1, 0, ''))
    Else
        ReDim $avArray[$Count - 1][2]
    EndIf
    $Count1 = 1
    $regkey = 'HKLMSOFTWAREWOW6432NODEMicrosoftWindowsCurrentVersionUninstall'
    While 1
        $key = RegEnumKey($regkey, $Count1)
        If @error <> 0 Then ExitLoop
        $line = RegRead($regkey & '' & $key, 'Displayname')
        $line2 = RegRead($regkey & "" & $key, "MoreInfoURL")
        $line3 = RegRead($regkey & "" & $key, "UninstallString")
        If $line <> '' And $line3 <> "" And Not StringInStr($line, "Office Suite Service Pack", 0) And Not StringInStr($line, "Language Pack", 0) And Not StringInStr($line, "update for", 0) Then
            If StringMid($line2, StringLen($line2) - 9, 4) <> "/kb/" Then
                If Not IsDeclared('avArray') Then Local $avArray[100][2]
                If UBound($avArray) - $Count <= 1 Then ReDim $avArray[UBound($avArray) + 100][2]
                $avArray[$Count - 1][0] = $line
                $avArray[$Count - 1][1] = $line3
                $Count = $Count + 1
            EndIf
        EndIf
        $Count1 += 1
    WEnd
    If Not IsDeclared('avArray') Or Not IsArray($avArray) Then
        Return (SetError(1, 0, ''))
    Else
        ReDim $avArray[$Count - 1][2]
;       _ArraySort($avArray) <<<<<<<< If you want the output to be sorted alphabetically, uncomment this line and add #Include <Array.au3> to the top of the script.
        For $I = 0 To UBound($avArray) - 1
            FileWriteLine($FileLoc, $avArray[$I][0])
        Next
    EndIf
EndFunc   ;==>_SoftwareInfo

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

BTW, because I swiped this from an uninstaller program I was writing, $avArray[x][3] holds the uninstaller string used to uninstall the program if ever needed. Shellexecute it and it can be used to uninstall programs. ;)

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

;) awesome that did it. This script rocks now. thank you everyone for all your help plus I enjoy the added ability to nail inappropriate software. Really truly this is one of the best programming communities I've been a part of. Thanks for sticking with me guys!!!!
Link to comment
Share on other sites

  • 2 months later...

I know this post is a little dated, and everything seems to be resolved, but I figured I would post here instead of opening a new one. I am basically running into the software list issue myself. The problem that I am having is that I can get the list to show in an _arraydisplay, however I don't want it displayed I just want the installed programs pooled from something other than the registry. The issue is, I have users that have Office 2003 long story, but they need the compatibility pack. If you look at the registry in the uninstall office 2003 has different key values for this {90110409-6000-11D3-8CFE-0150048383C9}and {91110409-6000-11D3-8CFE-0150048383C9} almost the same number except 1. From what I read these string values could be different. I just need something that can check if Office 2003 is installed and continue on from there, without resorting to checking the registry, and without user interaction. Any help with be greatly appreciated. Thanks

Link to comment
Share on other sites

One way to check if Office 2003 is installed is to look in the All Users folder in Documents and settings (or AllUsers in Users) and then look at the shortcuts in the Start Menu, as long as the shortcuts are there, you can determine if it's been installed or not. Not 100% reliable, but can be a quick check to perform.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Sounds like a job for RegEnumKey(), loop that with RegRead() looking for a value that is unique for that app.

Edited by AdmiralAlkex
Link to comment
Share on other sites

@ BrewManNH

I'm not sure this will work I really was hoping for something more surefire

@AdmiralAlkex

The problem with the registry check is that Office 2003 has more than one unique identifier, I am not sure why it has nothing to do with SP as the value doesn't change when you upgrade the SP. Maybe the installer itself, all I know is that some machines I have come across have one some have another and I am not sure if there are some with others. Is it possible to enum the display name, as to check the value of that string value in the whole uninstall key. Basically search HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionUninstall looking for the string value displayname with the value of 'Microsoft Office Professional Edition 2003'?

Sorry new to the AutoIT world appreciate the help :)

Link to comment
Share on other sites

If you look at the code I posted above, what does it return when Office 2003 is installed? One of the array's elements would have to have something telling you that Office 2003 is in the Uninstall key, wouldn't that tell you that it's installed? You said you just needed to know if it is installed, this script should give you that information. Or you could google the registry key needed to identify if it's installed or not and use RegRead to tell you if it's there.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

RegRead ('HKEY_CLASSES_ROOT\INSTALLER\PRODUCTS\9040111900063D11C8EF10054038389C', 'version') ;I have found this key and another key to identify office 2003
If @Error=0 Then
RegRead ('HKEY_CLASSES_ROOT\INSTALLER\PRODUCTS\00002109020090400000000000F01FEC', 'version')
If @error=1 Then
Run (@ScriptDir & '\FileFormatConverters.exe /quiet /norestart')
EndIf
Maybe I should have explained more. I don't want to see if the program is installed for myself. I want the script to see if the program is installed and if it is continue on with the script. The script will be run as one of many start ups. The problem with the registry is I have found 2 keys that identify office 2003. The difference happens in the uninstall key as well. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall. I really don't know why there are 2 different keys that I have found for the same product I just know that there are. I don't know how to use your script enough that I can have the script see if the specific program is installed and if it is continue, as opposed to the nice arraydisplay. Your script is sweet I just need it to to be automated because I will not be present for the check nor do I need a record if that software exists. I just need to ensure that if a machine has 2003 on it, then the compatibilty pack is installed. Please let me know if that doesn't make sense, sometimes feel like I speak nonsense.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...