Jump to content

script to install XP SP3


Briandr
 Share

Recommended Posts

I would like to tweak the script below to fit my own needs. The script installs Win XP SP3. I like the first section where the user is warned that SP3 is being installed. I intend to change the installation mode from passive to quiet. What I'd like to know is how can I keep the warning about SP3 installing and keep it up until the install is complete? Is it a matter of just changing sleep? Is there a better of way of doing this? My concern about doing that is that SP3 install time may vary computer to computer.

Thank you!

;===================================================================================================

;Hides the AutoIT icon

Opt("TrayIconHide",1)

; 1st section gives the user a warning that the sevice pack install will start

$PID=SplashTextOn("Windows XP SP3 Installation", "Installing Microsoft Windows XP Service Pack 3. The installation can take 30 minutes. Please wait until the completion message appears.", 450, 85, -1, -1, 4, "10")

Sleep(20000)

SplashOff()

ProcessWaitClose($PID)

;RUN WINDOWS XP SP3 IN PASSIVE MODE WITH NO RESTART, NO BACKUP AND A LOG FILE

Run ( "WindowsXP-KB936929-SP3-x86-ENU.exe /passive /norestart /nobackup /log:c:\WindowsXP-KB936929-SP3-x86-ENU.log" )

; WAIT UNTILL SP3 WINDOW IS ACTIVE

WinWaitActive("Software Update Installation Wizard", "")

; SET SP3 WINDOW ACTIVE IF IT DOESN'T HAVE FOCUS

If Not WinActive("Software Update Installation Wizard","") Then WinActivate("Software Update Installation Wizard","")

; HIDE BACK BUTTON

ControlHide ( "Software Update Installation Wizard", "", 12323 )

; HIDE FINISH BUTTON

ControlHide ( "Software Update Installation Wizard", "", 12325 )

;CHANGE FOCUS TO HELP BUTTON

ControlFocus("Software Update Installation Wizard", "", 9)

; HIDE CANCEL BUTTON

ControlHide ( "Software Update Installation Wizard", "", 2 )

; WAIT UNTILL SP3 WINDOW IS ACTIVE

WinWaitActive("Software Update Installation Wizard", "")

Send("{TAB}")

;HIDE HELP BUTTON

ControlHide ( "Software Update Installation Wizard", "", 9 )

;===================================================================================================

Link to comment
Share on other sites

When I did mine here I had it schedule to install at 7'ish after business hours.

Was the more ideal way to do it for myself.

If you wanted to do it at that point of running the script, run it quiet and still have an indictator. Perhaps 'ProgressOn','ProgressSet', and 'ProgressOff' are built in functions that'd be beneficial for you.

Link to comment
Share on other sites

This is probably all you need

;Hides the AutoIT icon
Opt("TrayIconHide",1)

$sFile = "C:\WindowsXP-KB936929-SP3-x86-ENU.exe"
SplashTextOn("Windows XP SP3 Installation", "Installing Microsoft Windows XP Service Pack 3. The installation can take 30 minutes. Please wait until the completion message appears.", 450, 85, -1, -1, 4, "10")
;RUN WINDOWS XP SP3 IN UNATTENDED PASSIVE MODE WITH NO RESTART, NO BACKUP AND A LOG FILE
ShellExecuteWait($sFile, "/quiet /passive /norestart /nobackup /log:c:\WindowsXP-KB936929-SP3-x86-ENU.log");;  Not sure if you even need the passive switch here
SplashOff()

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Hi GEOSoft,

This code adjustment might work for what I need. I don't need the passive switch. As long as the message box stays up via ShellExecuteWait I should be good. I just need to adjust the file location once I know where Altiris dumps the file.

Link to comment
Share on other sites

I just used a dummy file location. If you put the script in the same folder as the file you can replace $sFile = "C:\WindowsXP-KB936929-SP3-x86-ENU.exe" with

$sFile = @ScriptDir & "\WindowsXP-KB936929-SP3-x86-ENU.exe"

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Hi George / Other Folks,

Can you tell me what parameters to use that would allow the message box to me moved around? Right now its centered and locked on the desktop. What about an option to minimize the icon to the taskbar with an option to come back up on the desktop after x number of minutes? If that request is a little more difficult to implement what about at least setting the parameters so the message box is not always on top. As an example if I open Notepad the message box is on top. Would like it to not be on top.

The other thing I noticed is was that it prompted me to open WindowsXP-KB936929-SP3-x86-ENU.exe. I would prefer it just open and not be prompted to open it?

Thank you.

Edited by Briandr
Link to comment
Share on other sites

Don't confuse Splash with a MsgBox(), they are totally different dialogs.

See the help file for the parameters available for SplashTextOn().

This should give you the idea.

;Hides the AutoIT icon
Opt("TrayIconHide",1)

;$sFile = "C:\WindowsXP-KB936929-SP3-x86-ENU.exe"
$sFile = "MsPaint.exe"

$hWnd = SplashTextOn(" Title", "Some string of text goes in here", 400, 100, -1, -1, 18) ;; 2 to remove the ontop attrib + 16 to allow it to be moved
;RUN WINDOWS XP SP3 IN UNATTENDED PASSIVE MODE WITH NO RESTART, NO BACKUP AND A LOG FILE
;$hProc = ShellExecuteWait($sFile, "/quiet /norestart /nobackup /log:c:\WindowsXP-KB936929-SP3-x86-ENU.log")
$hProc = ShellExecuteWait($sFile)
SplashOff()
The example removes the on top attribute and allows the window to be moved.

The standard splash dialog has no tray or taskbar icons and no way to minimize it. To do that, your best solution would be a custom GUI. As for moving the window it could be done using an Adlib function which could also be set to move the dialog off screen and back again using a timer. Again that's doing it the hard way and a custom Dialog would be in order here.

Take a look at (and study) GUI code to see how you can manage to create exactly what you want. All you would need is a basic GUI and a label control. Not only can you do what you want with that, you can do things like set the background color and use different styles, resulting in a better looking interface.

Ass for the last part of the question regarding prompting, that is caused Windows UAC. Although there may be a work-around for it, you can't just go shutting off UAC for all the machines which will use your script and it is really best left alone. You could get the Windows info for that screen and use ControlSend() to click the correct controls so there is really no user interaction required.

If you have further questions please post back but check the help file first. In AutoIt, that is your best friend.

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

The thing that would bother me with Splash is the box always being on top. Thanks for the example showing me how we can control its behavior. Message box vs Splash box it is kinda of a mute point as I have no preference. I just a need a constant, but not in your face reminder to the user so they don't re-start or shutdown. I will certainly explore trying to setup a message box, but I am under time constraints. My lack thereof a scripting background won't make this easy so I am not sure for how long I will hammer away at this. Maybe I will open another topic regarding message box. Not sure.

Let me finally address the Windows UAC. Can you look at the link below (or in my original post in this forum) where I got the code. I am reasonably sure the original example handled the issues with the Windows UAC. I don't recall being prompted to open the file.

https://www-secure.symantec.com/connect/forums/windows-xp-sp3-installation-question

Thanks for all the help.

Edited by Briandr
Link to comment
Share on other sites

I haven't seen Eshwar around here for well over a year now. I do know that he used a combination of VBS and AutoIt to do what he wanted. I'm sure I can work it out to do what he was doing if I had the time to download his VBS but I don't. Since you have a time constraint my best option is for you to let that window come up, then use the AutoIt Windows Information tool to get the details. Paste the results into a reply. You could also put up a screen shot of the Window and I'll see what I can work out from that but it will take a while because I will have to restart my system in XP and again I have time constraints of my own to worry about.

Have you tried the method of just extracting the contents of the file and then using the correct switches to run the setup program itself?

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

George,

Haven't tried extracting and running SP3. Not opposed to the idea if I can get this to come up without a prompt (No Windows UAC) and still have a splash and/or message box. I do need the splash or message box so the end user doesn't re-boot or shutdown.

Edited by Briandr
Link to comment
Share on other sites

Briandr, looking at the page you linked, if you look further down the page, you'll see where Eshwar included some commands to get past the WGA screen that pops up when you install SP3. BTW, it's not a UAC screen, because UAC isn't used in Windows XP, it's a Windows Genuine Advantage prompt screen.

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 don't want to annoy anyone, but let me ask one final thing. First, I was never a huge fan of the code Eshwar put out. I did think I could adjust it for my own needs. Second, I know nothing of AutoIT. I can mess around with VBScript with varied results depending on what I am doing. I did find there is an AutoIT to VBScript converter. It failed to convert my code. Here is the VB code. Can this be used in AutoIT to accomplish my goal of getting some type of message/splash box displayed while the code executes?

Const Hidden=0

Const WaitonReturn=True

Dim FSO

Set FSO=CreateObject("Scripting.FileSystemObject")

set objNetwork=CreateObject("Wscript.Network")

Set WshShell=CreateObject("Wscript.Shell")

strComputerName=wshShell.ExpandEnvironmentStrings("%computername%")

objNetwork.MapNetworkDrive "b:", "\\abcwaltps\software", False, "mydomain\myuser", "mypassword"

wshshell.CurrentDirectory="b:\xpsp3\"

FSO.CopyFile "b:\WindowsXP-KB936929-SP3-x86-ENU.exe", "c:\windows\temp\"

wshshell.CurrentDirectory="c:\windows\temp\"

wshshell.run "c:\windows\temp\WindowsXP-KB936929-SP3-x86-ENU.exe /quiet /norestart /log:c:\windows\temp\WindowsXP-KB936929-SP3-x86-ENU.log",0,True

FSO.CopyFile "c:\windows\temp\windowsxp-kb936929-sp3-x86-enu.log", "b:\xpsp3\Logs\" & strComputerName & ".txt"

Set FSO=nothing

objNetwork.RemoveNetworkDrive "b:"

Not sure which code pieces can be excluded in AutoIT and which ones would need to be converted. By the way the 'VBScript converter v0.52' keeps erroring out with "Line 2634 (File "C:\VBtoAutoIT\vaconvert.exe"). Error: Unknown function name". It throws this error even if the VBScript file has nothing in it.

To all who have helped thus far, thanks.

Edited by Briandr
Link to comment
Share on other sites

This is slightly offtopic, but if you're looking to do an offline update including the installation of SP3 for XP, you may want to look into using WSUS Offline Update: http://www.wsusoffline.net/

You can probably run it from the command line and it will update everything, not just the service pack for XP.

Gerard J. Pinzonegpinzone AT yahoo.com
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...