• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 374
  • Last Modified:

Hide Window

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
Bianchi928
Asked:
Bianchi928
  • 8
  • 6
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
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
 
Bianchi928Author Commented:
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
 
RobSampsonCommented:
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Bianchi928Author Commented:
Thanks Rob. I'll give that a try and let you know.
Cheers
0
 
Bianchi928Author Commented:
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
 
RobSampsonCommented:
Hmmm, try
WshShell.Run "cmd /c start /wait ""Remove Excel 2007"" MsiExec.exe /X{90120000-0016-0000-0000-0000000FF1CE} /qn", 0,True

Rob.
0
 
Bianchi928Author Commented:
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
 
RobSampsonCommented:
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
 
Bianchi928Author Commented:
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
 
RobSampsonCommented:
That's strange....can you check your Application event log and see if the MSIExec message show anything going on?

Rob.
0
 
Bianchi928Author Commented:
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
 
RobSampsonCommented:
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
 
Bianchi928Author Commented:
What does this line mean ?

<OptionState Id=”ACCESSFiles” State=”absent” Children=”force” />
0
 
RobSampsonCommented:
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
 
Bianchi928Author Commented:
Solved my uninstallation progress display problem.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 8
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now