Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Hide Window

Posted on 2014-04-25
15
Medium Priority
?
373 Views
Last Modified: 2014-04-30
How can I modify these couple of lines so that the script doesn't show the Uninstalling progresss screen. Also it doesn't wait for this process to finish before jumping to the next one..that's the reason why I have added the Wscript.sleep..



If objFSO.FileExists("C:\program files\Microsoft Office\Office12\MSAccess.exe") Then
   WshShell.Run "MsiExec.exe /X{90120000-0015-0000-0000-0000000FF1CE} /qn", ,true
   ObjOutput.WriteLine "Access     : Uninstallation Successful"
   WScript.sleep (1000 * 60)
Else
   ObjOutput.WriteLine "Access     : Not Found"
End If

Thanks
Cheers
0
Comment
Question by:Bianchi928
  • 8
  • 6
15 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 40022113
for the first part, I see you apply already the /qn which should hide the window:
http://msdn.microsoft.com/en-us/library/aa367988%28v=vs.85%29.aspx

I presume that the progress window is hence not the one from msiexec, but from the package that get uninstalled?

for the "waiting", you also seem to do correctly:
http://msdn.microsoft.com/en-us/library/d5fk67ky%28v=vs.84%29.aspx

I would only add the 0 for windowstyle:
WshShell.Run "MsiExec.exe /X{90120000-0015-0000-0000-0000000FF1CE} /qn", 0 ,true

maybe that solves the issue...
0
 

Author Comment

by:Bianchi928
ID: 40022125
Thanks for your quick reply. Unfortunately I have already tried with /qn" ,0,true and the Uninstalling window is not hidden.  The "waiting" also doesn't happen.

Additional info...Windows XP
Running the script from a desktop icon

Cheers
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 40024423
Hi, you can also try this
If objFSO.FileExists("C:\program files\Microsoft Office\Office12\MSAccess.exe") Then
   WshShell.Run "cmd /c start /wait ""Remove Access MUI 2007"" ""MsiExec.exe /X{90120000-0015-0000-0000-0000000FF1CE} /qn""", 0,True
   ObjOutput.WriteLine "Access     : Uninstallation Successful"
   'WScript.sleep (1000 * 60)
Else
   ObjOutput.WriteLine "Access     : Not Found"
End If

Open in new window


Just a note, it looks like that GUID may only relate to the Access 2007 MUI (English) component, and not the full Access product, but you may be doing those separately...

Rob.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:Bianchi928
ID: 40031076
Thanks Rob. I'll give that a try and let you know.
Cheers
0
 

Author Comment

by:Bianchi928
ID: 40033487
Hi Rob,

I tested on a computer with Excel loaded

It comes with an error

If objFSO.FileExists("C:\program files\Microsoft Office\Office12\Excel.exe") Then
   WshShell.Run "cmd /c start /wait ""Remove Excel 2007"" ""MsiExec.exe /X{90120000-0016-0000-0000-0000000FF1CE} /qn""", 0,True
   ObjOutput.WriteLine "Excel      : Uninstallation Successful"
Else
   ObjOutput.WriteLine "Excel      : Not Found"
End If

I've attached the error message
Untitled.gif
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 40033513
Hmmm, try
WshShell.Run "cmd /c start /wait ""Remove Excel 2007"" MsiExec.exe /X{90120000-0016-0000-0000-0000000FF1CE} /qn", 0,True

Rob.
0
 

Author Comment

by:Bianchi928
ID: 40033561
Hi Rob !

Okay I've loaded Excel, Powerpoint & Word on the test computer. That's the full script with your changes included. The problem now is that it removes Excel and then drops out. I have to run it again to get rid of Powerpoint and again for Word. Also the attachment is what I don't want to see displayed...

Set objFSO   = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject("WScript.Shell")
Set objNetwork = WScript.CreateObject("WScript.Network")

strUserName = objNetwork.UserName
strcompName = objNetwork.ComputerName
set OSVersion = wshshell.exec("%comspec% /c ver")
Version = OSversion.stdout.readall
Select Case True
       Case Instr(Version, "n 5.") > 1 : OSName = "XP"
       Case Instr(Version, "n 6.1") > 1 : OSName = "Win 7"
End Select

'wscript.echo strusername, strcompname, OSName
'Logfilename    = "\\tyrenet-14\transfer\" & strusername & ".txt"

If OSName = "Win 7" then
   Logfilename     = "c:\users\" & strusername & "\desktop\" & strusername & ".txt"
Else
   Logfilename     = "c:\documents and settings\" & strusername & "\desktop\" & strusername & ".txt"
End If

Const intForAppending = 8

If objFSO.FileExists(LogFilename) Then
   Set objOutput = objFSO.OpenTextFile(LogFileName, intForAppending, False)
Else
   Set objOutput = objFSO.CreateTextFile(LogFileName, intForAppending, False)
End If

ObjOutput.WriteLine "User name  :" & strusername & " - Computer Name  :" & strcompname

wshShell.Run "TaskKill /im msaccess.exe /f ", , True
wshShell.Run "TaskKill /im excel.exe /f ", , True
wshShell.Run "TaskKill /im powerpnt.exe /f ", , True
wshShell.Run "TaskKill /im winword.exe /f ", , True
wshShell.Run "TaskKill /im visio.exe /f ", , True
wshShell.Run "TaskKill /im winproj.exe /f ", , True

If objFSO.FileExists("C:\program files\Microsoft Office\Office12\MSAccess.exe") Then
   WshShell.Run "cmd /c start /wait ""Remove Access 2007"" MsiExec.exe /X{90120000-0015-0000-0000-0000000FF1CE} /qn", 0,True
   ObjOutput.WriteLine "Access     : Uninstallation Successful"
Else
   ObjOutput.WriteLine "Access     : Not Found"
End If

If objFSO.FileExists("C:\program files\Microsoft Office\Office12\Excel.exe") Then
   WshShell.Run "cmd /c start /wait ""Remove Excel 2007"" MsiExec.exe /X{90120000-0016-0000-0000-0000000FF1CE} /qn", 0,True
   ObjOutput.WriteLine "Excel      : Uninstallation Successful"
Else
   ObjOutput.WriteLine "Excel      : Not Found"
End If

If objFSO.FileExists("C:\program files\Microsoft Office\Office12\Powerpnt.exe") Then
   WshShell.Run "cmd /c start /wait ""Remove PowerPoint 2007"" MsiExec.exe /X{90120000-0018-0000-0000-0000000FF1CE} /qn", 0,True
   ObjOutput.WriteLine "PowerPoint : Uninstallation Successful"
Else
   ObjOutput.WriteLine "PowerPoint : Not Found"
End If


If objFSO.FileExists("C:\program files\Microsoft Office\Office12\Winword.exe") Then
   WshShell.Run "cmd /c start /wait ""Remove Word 2007"" MsiExec.exe /X{90120000-001B-0000-0000-0000000FF1CE} /qn", 0,True
   ObjOutput.WriteLine "Word       : Uninstallation Successful"
Else
   ObjOutput.WriteLine "Word       : Not Found"

End If

If objFSO.FileExists("C:\program files\Microsoft Office\Office12\Visio.exe") Then
   WshShell.Run "cmd /c start /wait ""Remove Visio 2007"" MsiExec.exe /X{90120000-0053-0000-0000-0000000FF1CE} /qn", 0,True
   ObjOutput.WriteLine "Visio      : Uninstallation Successful"
Else
   ObjOutput.WriteLine "Visio      : Not Found"
End If

If objFSO.FileExists("C:\program files\Microsoft Office\Office12\Winproj.exe") Then
   WshShell.Run "cmd /c start /wait ""Remove Project 2007"" MsiExec.exe /X{90120000-003A-0000-0000-0000000FF1CE} /qn", 0,True
   ObjOutput.WriteLine "Project    : Uninstallation Successful"
Else
   ObjOutput.WriteLine "Project    : Not Found"
End If

ObjOutput.close 

Wscript.Quit

Open in new window

Screen.gif
0
 
LVL 65

Accepted Solution

by:
RobSampson earned 800 total points
ID: 40033596
Not sure why you'd need to run it again....unless the previous one isn't completely finished....I've added more logging to this, so see what the log says.

Set objFSO   = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject("WScript.Shell")
Set objNetwork = WScript.CreateObject("WScript.Network")

strUserName = objNetwork.UserName
strcompName = objNetwork.ComputerName
set OSVersion = wshshell.exec("%comspec% /c ver")
Version = OSversion.stdout.readall
Select Case True
       Case Instr(Version, "n 5.") > 1 : OSName = "XP"
       Case Instr(Version, "n 6.1") > 1 : OSName = "Win 7"
End Select

'wscript.echo strusername, strcompname, OSName
'Logfilename    = "\\tyrenet-14\transfer\" & strusername & ".txt"

If OSName = "Win 7" then
   Logfilename     = "c:\users\" & strusername & "\desktop\" & strusername & ".txt"
Else
   Logfilename     = "c:\documents and settings\" & strusername & "\desktop\" & strusername & ".txt"
End If

Const intForAppending = 8

If objFSO.FileExists(LogFilename) Then
   Set objOutput = objFSO.OpenTextFile(LogFileName, intForAppending, False)
Else
   Set objOutput = objFSO.CreateTextFile(LogFileName, intForAppending, False)
End If

ObjOutput.WriteLine "User name  :" & strusername & " - Computer Name  :" & strcompname

wshShell.Run "TaskKill /im msaccess.exe /f ", , True
wshShell.Run "TaskKill /im excel.exe /f ", , True
wshShell.Run "TaskKill /im powerpnt.exe /f ", , True
wshShell.Run "TaskKill /im winword.exe /f ", , True
wshShell.Run "TaskKill /im visio.exe /f ", , True
wshShell.Run "TaskKill /im winproj.exe /f ", , True

If objFSO.FileExists("C:\program files\Microsoft Office\Office12\MSAccess.exe") Then
	intReturn = WshShell.Run("cmd /c start /wait ""Remove Access 2007"" MsiExec.exe /X{90120000-0015-0000-0000-0000000FF1CE} /qn", 0,True)
	If intReturn = 0 Then
		ObjOutput.WriteLine "Access     : Uninstallation Successful"
	Else
		ObjOutput.WriteLine "Access     : Uninstallation failed with return code " & intReturn
	End If
Else
   ObjOutput.WriteLine "Access     : Not Found"
End If

If objFSO.FileExists("C:\program files\Microsoft Office\Office12\Excel.exe") Then
   intReturn = WshShell.Run("cmd /c start /wait ""Remove Excel 2007"" MsiExec.exe /X{90120000-0016-0000-0000-0000000FF1CE} /qn", 0,True)
	If intReturn = 0 Then
		ObjOutput.WriteLine "Excel     : Uninstallation Successful"
	Else
		ObjOutput.WriteLine "Excel     : Uninstallation failed with return code " & intReturn
	End If
Else
   ObjOutput.WriteLine "Excel      : Not Found"
End If

If objFSO.FileExists("C:\program files\Microsoft Office\Office12\Powerpnt.exe") Then
   intReturn = WshShell.Run("cmd /c start /wait ""Remove PowerPoint 2007"" MsiExec.exe /X{90120000-0018-0000-0000-0000000FF1CE} /qn", 0,True)
	If intReturn = 0 Then
		ObjOutput.WriteLine "Powerpoint : Uninstallation Successful"
	Else
		ObjOutput.WriteLine "Powerpoint : Uninstallation failed with return code " & intReturn
	End If
Else
   ObjOutput.WriteLine "PowerPoint : Not Found"
End If

If objFSO.FileExists("C:\program files\Microsoft Office\Office12\Winword.exe") Then
   intReturn = WshShell.Run("cmd /c start /wait ""Remove Word 2007"" MsiExec.exe /X{90120000-001B-0000-0000-0000000FF1CE} /qn", 0,True)
	If intReturn = 0 Then
		ObjOutput.WriteLine "Word       : Uninstallation Successful"
	Else
		ObjOutput.WriteLine "Word       : Uninstallation failed with return code " & intReturn
	End If
Else
   ObjOutput.WriteLine "Word       : Not Found"

End If

If objFSO.FileExists("C:\program files\Microsoft Office\Office12\Visio.exe") Then
   intReturn = WshShell.Run("cmd /c start /wait ""Remove Visio 2007"" MsiExec.exe /X{90120000-0053-0000-0000-0000000FF1CE} /qn", 0,True)
	If intReturn = 0 Then
		ObjOutput.WriteLine "Visio      : Uninstallation Successful"
	Else
		ObjOutput.WriteLine "Visio      : Uninstallation failed with return code " & intReturn
	End If
Else
   ObjOutput.WriteLine "Visio      : Not Found"
End If

If objFSO.FileExists("C:\program files\Microsoft Office\Office12\Winproj.exe") Then
   intReturn = WshShell.Run("cmd /c start /wait ""Remove Project 2007"" MsiExec.exe /X{90120000-003A-0000-0000-0000000FF1CE} /qn", 0,True)
	If intReturn = 0 Then
		ObjOutput.WriteLine "Project    : Uninstallation Successful"
	Else
		ObjOutput.WriteLine "Project    : Uninstallation failed with return code " & intReturn
	End If
Else
   ObjOutput.WriteLine "Project    : Not Found"
End If

ObjOutput.close 

Wscript.Quit

Open in new window


For the progress screen, and for the whole operation, to be honest, it may be better to use a custom config.xml to perform the uninstall by running setup.exe.  See here:
http://technet.microsoft.com/en-us/library/cc982159(v=office.14).aspx

So you can set
<Display Level="none" CompletionNotice="no" SuppressModal="yes" AcceptEula="yes" />

And see this line
<OptionState Id=”ACCESSFiles” State=”absent” Children=”force” />

to set the removal of specific options.

I have never set an uninstall this way, so you will probably need to do some good testing, and fishing around for others that have used this method, but it should work as designed.

Regards,

Rob.
0
 

Author Comment

by:Bianchi928
ID: 40033647
Okay I tested with Accees, Excel, Powerpoint and Word loaded. It only uninstalled Access .
Check the attached log. It shows that the other has been uninstalled, but it's still there.
ZA20611.txt
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 40033720
That's strange....can you check your Application event log and see if the MSIExec message show anything going on?

Rob.
0
 

Author Comment

by:Bianchi928
ID: 40033777
Rob,

I have been able to sort out the problem using setup.exe and config.xml. I've attached one of my config.xml..See if anything should be added.

Thanks
AccessUninstallConfig.xml
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 40033831
Does that work?  I would have thought you need to add state="ABSENT", but as I said, I haven't done it, so I'm not sure.  I guess if it works, and only uninstalls that specific product, you should be good to go.

Rob.
0
 

Author Comment

by:Bianchi928
ID: 40033839
What does this line mean ?

<OptionState Id=”ACCESSFiles” State=”absent” Children=”force” />
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 40033846
See here:
http://technet.microsoft.com/en-us/library/cc179006(v=office.14).aspx

The Absent state means the feature will not be installed, so Setup will remove then.  The Children="force" will remove any child elements of the Access product as well.

Rob.
0
 

Author Closing Comment

by:Bianchi928
ID: 40033889
Solved my uninstallation progress display problem.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome back!  My apologies for taking so long to write part two of this series; it's been a long time coming!  As I promised in Part 1, this article will focus on how to locate those elusive AD properties that you are searching for.  Why is this us…
Well hello again!  Glad to see you've made it this far without giving up.  In this, the fourth installment of my popular series, I'm going to cover functions and subroutines, what they are, and why they are useful.  Just in case you stumbled onto th…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question