|
|
|||||||
Ok so finally i'm able to get something going here...what this script does is to install adobereader 8 and uninstalls all previous versions on all computers. it doesn't seem to run.please help........ Gosub ChkInstaller Gosub MSIparam If Not Exist ("C:\Program Files\Adobe 8.0") MessageBox("Installing Adobe Reader 8.0","ESI International",,2) Shell '%systemroot%\system32\msiexec.exe /qb!- /i"\\william\admin\users\adobereader\8\AdobeReader 8.0.msi"' WriteValue ("HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Acrobat Reader\8.0\AdobeViewer\", "EULA", "1", "REG_DWord") ;-------------------------------------------------------------------------------------------------------------- :UNINSTAR6 ; Purpose: To uninstall AdobeReader 6.x Dim $uninst,$leftpart,$rightpart ; Read Registry key to determine in AR 6 is installed $uninst=ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Acrobat 6.0","UninstallString") If $uninst<>"" If Exist ("C:\Program Files\Adobe\Acrobat 6.0\Acrobat\Acrobat.exe") Exit EndIf ;Acrobat 6 detected, uninstall. Parse string, add '-y' For quiet mode $leftpart=Left($uninst,InStr($uninst,"-f")-2) $rightpart=Right($uninst,Len($uninst)-InStr($uninst,"-f")+1) $uninst=$leftpart+" -y -a -x "+$rightpart Shell $uninst ;============================================================================== :UNINSTAR7 ; Purpose: To uninstall AdobeReader 7.x Dim $uninst,$leftpart,$rightpart ; Read Registry key to determine in AR 7 is installed $uninst=ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Acrobat 7.0","UninstallString") If $uninst<>"" If Exist ("C:\Program Files\Adobe\Acrobat 7.0\Acrobat\Acrobat.exe") Exit EndIf ; Acrobat 7 detected, uninstall. Parse string, add '-y' for quiet mode $leftpart=Left($uninst,InStr($uninst,"-f")-2) $rightpart=Right($uninst,Len($uninst)-InStr($uninst,"-f")+1) $uninst=$leftpart+" -y -a -x "+$rightpart Shell $uninst |
||||||||
|
|
|||||||
This bit here: Code: $uninst=ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Acrobat 7.0","UninstallString") If $uninst<>"" If Exist ("C:\Program Files\Adobe\Acrobat 7.0\Acrobat\Acrobat.exe") Exit EndIf ...is missing an "endif" If I'm reading that right, also, you're exiting the gosub if Acrobat.exe exists before it ever gets uninstalled. Code: $uninst=ReadValue("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Acrobat 7.0","UninstallString") If $uninst <> "" If Exist("C:\Program Files\Adobe\Acrobat 7.0\Acrobat\Acrobat.exe") <here is where you'd perform the uninstall> EndIf EndIf ...seems more like the ticket. |
||||||||
|
|
|||||||
how about this new code........... ;Gosub ChkInstaller ;Gosub MSIparam If Not Exist ("C:\Program Files\Adobe 8.0") MessageBox("Installing Adobe Reader 8.0","ESI International",,2) Shell '%systemroot%\system32\msiexec.exe /qb!- /i"\\william\admin\users\adobereader\8\AdobeReader 8.0.msi"' WriteValue ("HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Acrobat Reader\8.0\AdobeViewer\", "EULA", "1", "REG_DWord") ;-------------------------------------------------------------------------------------------------------------- :UNINSTAR6 ; Purpose: To uninstall AdobeReader 6.x Dim $uninst,$leftpart,$rightpart ; Read Registry key to determine in AR 6 is installed $uninst=ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Acrobat 6.0","UninstallString") If $uninst<>"" If Exist ("C:\Program Files\Adobe\Acrobat 6.0\Acrobat\Acrobat.exe") ;Acrobat 6 detected, uninstall. Parse string, add '-y' For quiet mode $leftpart=Left($uninst,InStr($uninst,"-f")-2) $rightpart=Right($uninst,Len($uninst)-InStr($uninst,"-f")+1) $uninst=$leftpart+" -y -a -x "+$rightpart Shell $uninst ;============================================================================== :UNINSTAR7 ; Purpose: To uninstall AdobeReader 7.x Dim $uninst,$leftpart,$rightpart ; Read Registry key to determine in AR 7 is installed $uninst=ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Acrobat 7.0","UninstallString") If $uninst<>"" If Exist ("C:\Program Files\Adobe\Acrobat 7.0\Acrobat\Acrobat.exe") Exit ; Acrobat 7 detected, uninstall. Parse string, add '-y' for quiet mode $leftpart=Left($uninst,InStr($uninst,"-f")-2) $rightpart=Right($uninst,Len($uninst)-InStr($uninst,"-f")+1) $uninst=$leftpart+" -y -a -x "+$rightpart Shell $uninst EndIf |
||||||||
|
|
|||||||
You're still missing endif's, there has to be one for each "if". It also appears as if you're still exiting the subroutines before you shell out to the uninstaller... Another thing I just noticed...your code references "ChkInstaller" and "MSIParam", but I don't see where those are. Structurally, I think something like this would make more sense: 1) Check for Reader 6, uninstall it if it's there. 2) Check for Reader 7, uninstall it if it's there. 3) Install Reader 8. Really, there's no need for GOSUBs at all, since that would work just fine if you did it as a linear sequence...besides, GOTO and GOSUB generally aren't considered best practice 'round these parts. |
||||||||
|
|
|||||||
Hello selormquarshie and welcome to the board. When you registered you were presented with some information on how to use the board and how to post. Please take a few moments and read this FAQ on how to post. You should post your code within the CODE TAGS to preserve the formatting and make it easier for others to read your code and assist you better. The Post/Reply Formatting Box and How to use it http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=171901 Thanks guy. . |
||||||||
|
|
|||||||
eriqjaffe, correct me if I am wrong. AFAIK, The installation of Adobe Reader 7 uninstalled or upgraded Adobe Reader 6. I presume installing Adobe Reader 8 will uninstall or upgrade versions 6 and 7. If that is true, I do not see the need to uninstall versions 6 or 7. If versions 5 or older are installed on some computers, then they need to be uninstalled first. I would also try to avoid the Gosub statements |
||||||||
|
|
|||||||
Without customization I don't think version 8 cares. During a manual install you can have any version installed and 8 ignores it and installs in it's own directory. . |
||||||||
|
|
|||||||
Have you given it a try? IIRC, the customised install I made at work for version 7.x removed version 6.x. A first try with version 8.0.0, not customised, removed this 7.x customised install from my computer. |
||||||||
|
|
|||||||
Not tested but this rewtite of the code might work. No ugly GoSub's and stuff. Code: Break on $key = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" $ar6 = ReadValue($key + "Adobe Acrobat 6.0","UninstallString") $ar7 = ReadValue($key + "Adobe Acrobat 7.0","UninstallString") $ar8 = Exist("C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe") ; If $ar6 <> "" ;Acrobat 6 detected, uninstall. Parse string, add '-y' For quiet mode $leftpart=Left($uninst,InStr($uninst,"-f")-2) $rightpart=Right($uninst,Len($uninst)-InStr($uninst,"-f")+1) $uninst=$leftpart+" -y -a -x "+$rightpart Shell $uninst EndIf If $ar7 <> "" ; Acrobat 7 detected, uninstall. Parse string, add '-y' for quiet mode $leftpart=Left($uninst,InStr($uninst,"-f")-2) $rightpart=Right($uninst,Len($uninst)-InStr($uninst,"-f")+1) $uninst=$leftpart+" -y -a -x "+$rightpart Shell $uninst EndIf If $ar8 <> "1" MessageBox("Installing Adobe Reader 8.0","ESI International",,2) Shell '%systemroot%\system32\msiexec.exe /qb!- /i"\\william\admin\users\adobereader\8\AdobeReader 8.0.msi"' WriteValue ("HKLM\SOFTWARE\Adobe\Acrobat Reader\8.0\AdobeViewer\", "EULA", "1", "REG_DWord") EndIf |
||||||||
|
|
|||||||
Yes, I installed 8 with a non customized 7 and it left it alone. But I did have the Pro version installed which may have an impact. |
||||||||
|
|
|||||||
This can all be avoided if Adobe Reader is installed using a GPO |
||||||||
|
|
|||||||
good call guys. i will look into this further. happy new year!!! |
||||||||
|
|
|||||||
Take a look at the Adobe Customization Wizard 8 to create a MST file |
||||||||
|
|
|||||||
Originally Posted By: Mart This can all be avoided if Adobe Reader is installed using a GPO ROFL - No thanks - I don't care for that junk either. |
||||||||
|
|
|||||||
with junk you mean GPO installs or Adobe Reader? |
||||||||
|
|
|||||||
GPO Just never was a big fan of those types of installs. |
||||||||
|
|
|||||||
The idea of GPO-controlled software installs and upgrades was nice. However, I think it's a feature more suited for small businesses rather than larger corporations. |
||||||||
|
|
|||||||
Do you have a good alternative? |
||||||||
|
|
|||||||
Larger corporations rather use the likes of Microsoft SMS, Altiris, or other deployment tools. However, they normally have the advantage of manpower and budget to go for those solutions. My company uses SMS to roll out things like Adobe and other software upgrades. |
||||||||
|
|
|||||||
I always use GPO to roll out customized adobe, office and other progs. Works like a charm for me on Corporate networks. |
||||||||
|
|
|||||||
Interesting. How big are these networks? Are all computers on one LAN? |
||||||||
|
|
|||||||
Originally Posted By: Mart Not tested but this rewtite of the code might work. No ugly GoSub's and stuff. Code: Break on $key = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" $ar6 = ReadValue($key + "Adobe Acrobat 6.0","UninstallString") $ar7 = ReadValue($key + "Adobe Acrobat 7.0","UninstallString") $ar8 = Exist("C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe") ; If $ar6 <> "" ;Acrobat 6 detected, uninstall. Parse string, add '-y' For quiet mode $leftpart=Left($uninst,InStr($uninst,"-f")-2) $rightpart=Right($uninst,Len($uninst)-InStr($uninst,"-f")+1) $uninst=$leftpart+" -y -a -x "+$rightpart Shell $uninst EndIf If $ar7 <> "" ; Acrobat 7 detected, uninstall. Parse string, add '-y' for quiet mode $leftpart=Left($uninst,InStr($uninst,"-f")-2) $rightpart=Right($uninst,Len($uninst)-InStr($uninst,"-f")+1) $uninst=$leftpart+" -y -a -x "+$rightpart Shell $uninst EndIf If $ar8 <> "1" MessageBox("Installing Adobe Reader 8.0","ESI International",,2) Shell '%systemroot%\system32\msiexec.exe /qb!- /i"\\william\admin\users\adobereader\8\AdobeReader 8.0.msi"' WriteValue ("HKLM\SOFTWARE\Adobe\Acrobat Reader\8.0\AdobeViewer\", "EULA", "1", "REG_DWord") EndIf Hi Im looking for some code like above. For me the code works only for installing 8.0 he doesnt install a version of 7. does anybody see the problem ? |
||||||||
|
|
|||||||
Well, Mart made it for ya as a re-write of your code with gotos and subs, so it does only checks for version 6 and 7, and then installs 8. I thought that the thing was that you wanted the version 8 to be the only version installed? So, there is no problem more then you want something else |
||||||||
|
|
|||||||
o ok i thought it supposed to uninstall the other version |
||||||||
|
|
|||||||
it does. |