Sign in to follow this  
Followers 0
flyonthewall

silent install, w/log files

9 posts in this topic

updating software for each end-user and looking for some feedback please.

once the users click the menu option on the intranet, the silent script will start.

i would like to record each @ComputerName and time, and if their file alreadyt exists, then a msgbox will let them know the

update has already been made, and exit script.

if not, then the silent install will begin, and after it's finished, have a quick msgbox letting them know it's complete.

this way we can monitor who has made the update afer we send out the email notification.

many thanks to weaponx for the start. :)

;~ path to folder where msi resides
$root= "\\server\fld1\fld2\fld3\Logs\"

If FileExists ( $root & @ComputerName & "-" & @YEAR & "-" & @MON &"-" & @MDAY & ".log") Then
MsgBox (0, "File Exists", "Update Exists Already!", 1)
Exit(0)
EndIf

RunWait(@ComSpec & ' /c "msiexec /i \\server\fld1\fld2\fld3\filetorun.msi/q"', @TempDir, @SW_HIDE)

;~ create logfile in this format computername-yyyy-mm-dd.log
$log = FileOpen ( $root & @ComputerName & "-" & @YEAR & "-" & @MON &"-" & @MDAY & ".log", 1 )
FileWrite($log, "Started  at " & @HOUR & ":" & @MIN & @CRLF)

;~  update complete msgbox
MsgBox (0, "Update", "Update Complete!", 1)

Share this post


Link to post
Share on other sites



That looks like it will do what you want to me.

If you want suggestions on additional features.... perhaps if you made a file for each computer you are expecting to be updated in your logging folder and having the script delete it when finished. This way you could have a quick way of seeing who had not done so yet.


[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Share this post


Link to post
Share on other sites

That looks like it will do what you want to me.

If you want suggestions on additional features.... perhaps if you made a file for each computer you are expecting to be updated in your logging folder and having the script delete it when finished. This way you could have a quick way of seeing who had not done so yet.

that's even better. just the input i was looking for.

thank you spookmeister, and again weaponx for the start.

Share this post


Link to post
Share on other sites

instead of FileExists i want to search and see if the new software version is already installed from regedit first, if so then exit.

this is not working for me.

thank you for any help.

$installed = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{5C208F54-2B26-47C0-BA94-94801030A79E}", "Installed")

If ($installed)  Then
MsgBox (0, "Current Version", "Current Version Installed!", 3)
Exit(0)
EndIf

full

;~ path to folder where msi resides
$root= "\\server\fld1\fld2\fld3\Logs\"
$installed = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{5C208F54-2B26-47C0-BA94-94801030A79E}", "Installed")

If ($installed)  Then
MsgBox (0, "File Exists", "File Exists Already!", 3)
Exit(0)
EndIf

RunWait(@ComSpec & ' /c "msiexec /i \\server\fld1\fld2\fld3\filetorun.msi/q"', @TempDir, @SW_HIDE)

;~ create logfile in this format computername-yyyy-mm-dd.log
$log = FileOpen ( $root & @ComputerName & "-" & @YEAR & "-" & @MON &"-" & @MDAY & ".log", 1 )
FileWrite($log, "Started  at " & @HOUR & ":" & @MIN & @CRLF)

;~  update complete msgbox
MsgBox (0, "Update", "Update Complete!", 1)

Share this post


Link to post
Share on other sites

got it.

thks anyway.

If $installed = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{5C208F54-2B26-47C0-BA94-94801030A79E}", "Installed") Then
MsgBox(0, "Update", "Update Already Installed!", 3)
Exit(0)
EndIf

Share this post


Link to post
Share on other sites

got it.

thks anyway.

If $installed = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{5C208F54-2B26-47C0-BA94-94801030A79E}", "Installed") Then
 MsgBox(0, "Update", "Update Already Installed!", 3)
 Exit(0)
 EndIf
This code doesn't look correct, are you declaring $installed before this statement? If not then this will always be true.

$result = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{5C208F54-2B26-47C0-BA94-94801030A79E}", "Installed")

If ($result <> "")  Then
MsgBox (0, "Current Version", "Current Version Installed!", 3)
Exit(0)
EndIfoÝ÷ Ù«­¢+ØÀÌØíÉÍÕ±ÐôII ÅÕ½Ðí!-e}1=
1}5
!%9ÀäÈíM=Q]IÀäÈí5¥É½Í½ÐÀäÈí]¥¹½ÝÌÀäÈí
ÕÉɹÑYÉÍ¥½¸ÀäÈíU¹¥¹Íѱ°ÀäÈíìÕÈÀáÔдÉÈØ´ÐÝÀµ    äдäÐàÀÄÀÌÁÜåôÅÕ½Ðì°ÅÕ½Ðí%¹Íѱ±ÅÕ½Ðì¤()9=PII=H¤Q¡¸)5Í    ½à À°ÅÕ½Ðí
ÕÉɹÐYÉÍ¥½¸ÅÕ½Ðì°ÅÕ½Ðí
ÕÉɹÐYÉÍ¥½¸%¹Íѱ±ÌÌìÅÕ½Ðì°Ì¤)á¥Ð À¤)¹%

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

This code doesn't look correct, are you declaring $installed before this statement? If not then this will always be true.

$result = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{5C208F54-2B26-47C0-BA94-94801030A79E}", "Installed")

If ($result <> "")  Then
MsgBox (0, "Current Version", "Current Version Installed!", 3)
Exit(0)
EndIf

i did a declare...just left it out of the reply. ty weaponx

$installed = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{5C208F54-2B26-47C0-BA94-94801030A79E}", "Installed")

If $installed = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{5C208F54-2B26-47C0-BA94-94801030A79E}", "Installed") Then
MsgBox(0, "Update", "Update Already Installed!", 3)
Exit(0)
EndIf
Edited by flyonthewall

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