Are we restricting this to C\C++? Because if not I have some pretty brutal incompetence here, if we are I'm just going to go ahead and post them anyway.
I have swapped out the names of specific elements. Try to keep in mind that their instructions were to copy all of these scripts and files to thumb drives and for us to run them manually on some 200+ desktops.
'Install.bat'"
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
@echo off
echo Uninstalling Program
"%~dp0package\copyFilesLocally.vbs"
"%~dp0package\runOnce817.vbs"
"%~dp0package\uninstall75.vbs"
shutdown -t 30 -r -f
cls
echo Install Complete
| |
copyFilesLocally.vbs, a few notes about this one 'SERVER' is the DNS name of an actual machine in their network. We are a separate company in a different state with no cross domain access to this machine. Note the copy commands and imagine me trying for 20 mins to explain to them why this is relevant. The file vc_red is a component of the MSVS redistribution package, not the whole thing mind you, just the parts that they
thought we needed. They were wrong of course, their application required the whole thing. I still laugh remembering the conference call when the other companies that were forced to use this didn't figure this out and couldn't understand why the package the client provided didn't work.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
on error resume next
Dim objFSO, objFileCopy
Set objFSO = CreateObject("Scripting.FileSystemObject")
If not objFSO.FolderExists("C:\Build") Then objFSO.CreateFolder("C:\Build")
If not objFSO.FolderExists("C:\Build\logs") Then objFSO.CreateFolder("C:\Build\logs")
If not objFSO.FolderExists("C:\Build\RunOnce\APPLICATION") Then
objFSO.CreateFolder("C:\Build\RunOnce")
objFSO.CreateFolder("C:\Build\RunOnce\APPLICATION")
End If
Set objFileCopy = objFSO.GetFile("\\SERVER\prod$\Apps\DesktopServices\Common\Microsoft Report Viewer Redistributable 2008 SP1\package\ReportViewer.exe")
objFileCopy.Copy ("C:\Build\RunOnce\APPLICATION\ReportViewer.exe")
Set objFileCopy = objFSO.GetFile("\\SERVER\prod$\Apps\DesktopServices\Common\Microsoft Visual C++ 2010 Redistributable\package\x86\vc_red.cab")
objFileCopy.Copy ("C:\Build\RunOnce\APPLICATION\vc_red.cab")
Set objFileCopy = objFSO.GetFile("\\SERVER\prod$\Apps\DesktopServices\Common\Microsoft Visual C++ 2010 Redistributable\package\x86\vc_red.msi")
objFileCopy.Copy ("C:\Build\RunOnce\APPLICATION\vc_red.msi")
Set objFileCopy = objFSO.GetFile("\\SERVER\prod$\Apps\DesktopServices\Common\APPLICATION\package\INSTALLATION_PACKAGE")
objFileCopy.Copy ("C:\Build\RunOnce\APPLICATION\INSTALLATION_PACKAGE")
Set objFileCopy = objFSO.GetFile("\\SERVER\prod$\Apps\DesktopServices\Common\APPLICATION\package\SEPERATE_INSTALLATION_UPDATE_PACKAGE.msi")
objFileCopy.Copy ("C:\Build\RunOnce\APPLICATION\SEPERATE_INSTALLATION_UPDATE_PACKAGE.msi")
Set objFileCopy = objFSO.GetFile("\\SERVER\prod$\Apps\DesktopServices\Common\APPLICATION\package\install_REDACTED.bat")
objFileCopy.Copy ("C:\Build\RunOnce\APPLICATION\install_REDACTED.bat")
| |
runOnce817.vbs:
1 2 3 4 5 6 7 8 9 10 11 12 13
|
on error resume next
dim ws, key1, value1
key1 = "HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce\runOnce_REDACTED"
value1 = "C:\Build\RunOnce\Click 8.1.7\install_REDACTED_.bat"
Set ws = CreateObject("WScript.Shell")
ws.RegWrite key1,value1,"REG_SZ"
WScript.Quit
| |
uninstall75.vbs (note here that REDACTED_SID is the SID of a previous version of this application that no one was ever told about much less given to install.)
1 2 3 4 5 6 7
|
on error resume next
dim ws
set ws = CreateObject("WScript.Shell")
ws.run "cmd /c msiexec /x {REDACTED_SID} /qn",0,true
| |
If anyone is interested I think I have a few more examples of stupidity from these aspiring scriptkiddies.