Hi All,
This code appears to be test out fine, no errors. Not 100% sure it works the way I want or if can be tweaked better. I need two checks to be done. I want to read in the computer name first. If it is "ABC" or "DEF" it should jump down and check for Office 2003 viewers. If they exist then delete them. If a computer name was "TABC" or "TDEF" then it should do nothing.
Dim filesys
const Hidden = 0
const WaitOnReturn = true
Set objNet = CreateObject("WScript.Network")
strCompName = objNet.ComputerName
set WshShell = CreateObject("WScript.Shell")
Set filesys = CreateObject("Scripting.FileSystemObject")
If left(strCompName,3) = "ABC" or left(strCompName,6) = "DEF" Then
If filesys.FileExists("C:\Program Files\Microsoft Office\OFFICE11\XLVIEW.EXE") Then
WshShell.Run "MsiExec.exe /x {90840409-6000-11D3-8CFE-0150048383C9} /q",1,true
End If
If filesys.FileExists("C:\Program Files\Microsoft Office\OFFICE11\WORDVIEW.EXE") Then
WshShell.Run "MsiExec.exe /x {90850409-6000-11D3-8CFE-0150048383C9} /q",1,true
End If
If filesys.FileExists("C:\Program Files\Microsoft Office\OFFICE11\PPTVIEW.EXE") Then
WshShell.Run "MsiExec.exe /x {90AF0409-6000-11D3-8CFE-0150048383C9} /q",1,true
End If
End If
This code appears to be test out fine, no errors. Not 100% sure it works the way I want or if can be tweaked better. I need two checks to be done. I want to read in the computer name first. If it is "ABC" or "DEF" it should jump down and check for Office 2003 viewers. If they exist then delete them. If a computer name was "TABC" or "TDEF" then it should do nothing.
Dim filesys
const Hidden = 0
const WaitOnReturn = true
Set objNet = CreateObject("WScript.Network")
strCompName = objNet.ComputerName
set WshShell = CreateObject("WScript.Shell")
Set filesys = CreateObject("Scripting.FileSystemObject")
If left(strCompName,3) = "ABC" or left(strCompName,6) = "DEF" Then
If filesys.FileExists("C:\Program Files\Microsoft Office\OFFICE11\XLVIEW.EXE") Then
WshShell.Run "MsiExec.exe /x {90840409-6000-11D3-8CFE-0150048383C9} /q",1,true
End If
If filesys.FileExists("C:\Program Files\Microsoft Office\OFFICE11\WORDVIEW.EXE") Then
WshShell.Run "MsiExec.exe /x {90850409-6000-11D3-8CFE-0150048383C9} /q",1,true
End If
If filesys.FileExists("C:\Program Files\Microsoft Office\OFFICE11\PPTVIEW.EXE") Then
WshShell.Run "MsiExec.exe /x {90AF0409-6000-11D3-8CFE-0150048383C9} /q",1,true
End If
End If