![bar1](http://eddiejackson.net/web_images/lightgraybar.bmp)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
':: E L I T E S O L U T I O N S ':: SCRIPT LANGUAGE: VBScript '::
SCRIPT NAME: Communicator_Install.vbs ':: PURPOSE: To be used to install
Communicator R2 ':: CREATION DATE: 01/14/2010 ':: LAST MODIFIED: '::
DIRECTIONS: Send to client workstation ':: AUTHOR: Eddie Jackson '::
EMAIL: MrNetTek2000@yahoo.com
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'VARIABLES on error resume next
Dim filesys, strComputer,
OSDetect, objWMIService, colInstances, sUser, strUser, objShell, Install,
Update, DELICON, Windows7_OS, XP_OS Dim SDMCache, AppPath, wshShell,
SetupFilesPath, SetupPath, strCurrentDirectory Dim objAccount, objSubkey,
strKeyPath, strSubPath, strValue, REGEDIT Const HKEY_LOCAL_MACHINE =
&H80000002 Elevated_Password = "YOURPASSWORDHERE"
AppPath =
"Microsoft\Office2007CommunicatorR2\3.5.6907.206"
Set filesys =
CreateObject("Scripting.FileSystemObject") Set objShell =
CreateObject("Wscript.Shell") Set wshShell =
WScript.CreateObject("WScript.Shell")
'SETS CURRENT DIRECTORY TO VARIABLE
strCurrentDirectory = objShell.CurrentDirectory
'PRE-SETUP COMMANDS on
error resume next Set objShell = CreateObject("Wscript.Shell")
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im cmd.exe",0,True
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im
SetupFiles.exe",0,True objShell.Run "%comspec% /c
%windir%\system32\taskkill.exe /f /im mshta.exe",0,True objShell.Run
"%comspec% /c %windir%\system32\taskkill.exe /f /im communicator.exe",0,True
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im
outlook.exe",0,True objShell.Run "%comspec% /c %windir%\system32\taskkill.exe
/f /im sndrec32.exe",0,True objShell.Run "%comspec% /c
%windir%\system32\taskkill.exe /f /im cpau.exe",0,True
'POLICY DISABLED
'FilterFile = "c:\Program Files\YourProgram\foo.exe" 'If
filesys.FileExists(FilterFile) THEN 'WScript.Quit(0) 'End if
'TASKKILLS PRE-INSTALLATION COMMANDS 'KILLS CURRENTLY RUNNING MSIEXEC.EXE
objShell.Run "%comspec% /c %windir%\SYSTEM32\TASKKILL.EXE /F /IM
msiexec.exe",0,true
'GLOBAL FILE EXTRACTION objShell.Run
"%comspec% /c "&chr(34)&strCurrentDirectory&"\GlobalFiles.exe"&chr(34),0,false
objShell.Run "%comspec% /c %windir%\system32\ping.exe -n 7 127.0.0.1",0,true'1
seconds per 3MB of size of GlobalFiles.exe objShell.Run "%comspec% /c
%windir%\system32\taskkill.exe /f /im GlobalFiles.exe",0,false objShell.Run
"%comspec% /c %windir%\system32\ping.exe -n 2 127.0.0.1",0,true objShell.Run
"%comspec% /c del /q
"&chr(34)&strCurrentDirectory&"\GlobalFiles.exe"&chr(34),0,false objShell.Run
"%comspec% /c %windir%\system32\ping.exe -n 1 127.0.0.1",0,true objShell.Run
"%comspec% /c del /q
"&chr(34)&strCurrentDirectory&"\GlobalFiles.exe"&chr(34),0,false objShell.Run
"%comspec% /c %windir%\system32\ping.exe -n 1 127.0.0.1",0,true objShell.Run
"%comspec% /c move /Y %temp%\RarSFX0\*.* %temp%\",0,true objShell.Run
"%comspec% /c %windir%\system32\ping.exe -n 1 127.0.0.1",0,true
'SET
LOCAL TEMP DIRECTORY LocalTemp =
CreateObject("WScript.Shell").ExpandEnvironmentStrings("%Temp%")
'SET
WORKSTATION NAME - PRIMARY METHOD strComputer = "."
'SET WORKSTATION
NAME - SECONDARY METHOD if strComputer = "" then on error resume next
Set wshNetwork = WScript.CreateObject( "WScript.Network" ) strComputer =
wshNetwork.ComputerName end if
'SET WORKSTATION NAME - TERTIARY METHOD
if strComputer = "" then on error resume next strComputer =
wshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" ) end if
'ENABLED'PRIMARY OS DETECTION Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
Set objWMIService = GetObject(
"winmgmts://" & strComputer & "/root/CIMV2" ) Set colInstances =
objWMIService.ExecQuery( "SELECT * FROM Win32_OperatingSystem", "WQL",
wbemFlagReturnImmediately + wbemFlagForwardOnly )
For Each objInstance In
colInstances on error resume next 'msgbox objInstance.Caption OSDetect
= objInstance.Caption Next
OSDetect = trim(OSDetect) 'msgbox
OSDetect
if OSDetect = "Microsoft Windows XP Professional" then XP()
if OSDetect = "Microsoft Windows XP" then XP() if OSDetect = "Microsoft
Windows XP Home" then XP() if OSDetect = "Microsoft Windows Vista Ultimate"
then Seven() if OSDetect = "Microsoft Windows Vista Premium" then Seven()
if OSDetect = "Microsoft Windows Vista Home" then Seven() if OSDetect =
"Microsoft Windows Vista Basic" then Seven() if OSDetect = "Microsoft Windows
7 Enterprise" then Seven() if OSDetect = "Microsoft Windows 7 Enterprise
Edition" then Seven() if OSDetect = "Microsoft Windows 7 Ultimate" then
Seven() if OSDetect = "Microsoft Windows 7 Ultimate Edition" then Seven()
if OSDetect = "Microsoft Windows Server 2003 Standard" then XP() if OSDetect
= "Microsoft Windows Server 2008 Standard" then Seven() if OSDetect =
"Microsoft Windows Server 2008 Standard Edition" then Seven() if OSDetect =
"Microsoft Windows Server 2008 Enterprise" then Seven() if OSDetect =
"Microsoft Windows Server 2008 Enterprise Edition" then Seven() if OSDetect
<> "Microsoft Windows Server 2008 Enterprise" then XP() WScript.Quit(0)
'SETS UP SECONDARY OS DETECTION IF NEEDED Windows7_OS = "C:\Users\Public"
XP_OS = "C:\Documents and Settings"
'DISABLED'SECONDARY DETECTION LOGIC
'''##If filesys.FolderExists(Windows7_OS) then Seven() '''##If
filesys.FolderExists(XP_OS) then XP()
'DISABLED'TERTIARY DETECTION
LOGIC '''##if OSDetect <> "Microsoft Windows 7 Enterprise" then XP() 'END
OS DETECTION
'W I N D O W S X P Sub XP on error resume next
UserLoggedInStatus()'returns whether a user is logged in or not Set objShell
= CreateObject("Wscript.Shell")
'SET LOCAL TEMP DIRECTORY LocalTemp =
CreateObject("WScript.Shell").ExpandEnvironmentStrings("%Temp%")
'SETS
CURRENT DIRECTORY TO VARIABLE strCurrentDirectory = objShell.CurrentDirectory
'secondary method of copying files into temp folder 'COPIES SOURCE FILES
FROM CURRENT DIRECTORY TO USER'S TEMP FOLDER - used for universal access to
files objShell.Run "%comspec% /c copy /y /v
"&chr(34)&strCurrentDirectory&"\STARTCOUNTER.hta"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v
"&chr(34)&strCurrentDirectory&"\cpau.exe"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v
"&chr(34)&strCurrentDirectory&"\Communicator_Install.msi"&chr(34)&"
%temp%\",0,true objShell.Run "%comspec% /c copy /y /v
"&chr(34)&strCurrentDirectory&"\Communicator_Patch.msp"&chr(34)&"
%temp%\",0,true objShell.Run "%comspec% /c copy /y /v
"&chr(34)&strCurrentDirectory&"\kaplan.jpg"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v
"&chr(34)&strCurrentDirectory&"\kaplan.gif"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v
"&chr(34)&strCurrentDirectory&"\kaplan.hta"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v
"&chr(34)&strCurrentDirectory&"\LANDesk.gif"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v
"&chr(34)&strCurrentDirectory&"\LANDesk.jpg"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v
"&chr(34)&strCurrentDirectory&"\LANDesk.hta"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v
"&chr(34)&strCurrentDirectory&"\sndrec32.reg"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v
"&chr(34)&strCurrentDirectory&"\sndrec32.exe"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v
"&chr(34)&strCurrentDirectory&"\notify.wav"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v
"&chr(34)&strCurrentDirectory&"\progress.wav"&chr(34)&" %temp%\",0,true
WScript.Sleep 500'timing
'THIS WILL CREATE ALL THE ELEVATED
FILES---------------------------------------------------------------------------------
'ENABLED'ELEVATED TURN OFF WINDOWS UPDATES objShell.Run "%comspec% /c echo
%windir%\system32\net.exe stop wuauserv>%temp%\cmd_wuaserv_off.cmd",0,true
'ENABLED'CREATE ELEVATED COMMAND - TURN ON WINDOWS UPDATES objShell.Run
"%comspec% /c echo %windir%\system32\net.exe start
wuauserv>%temp%\cmd_wuaserv_on.cmd",0,true
'ENABLED'CREATE ELEVATED
COMMAND - PATCH FILE - USED TO CHANGE BETWEEN USER AND ADMIN SECURITY CONTEXT
objShell.Run "%comspec% /c echo %windir%\system32\msiexec.exe /p
"&chr(34)&"%windir%\system32\Communicator_Patch.msp"&chr(34)&" /qn /norestart
/L* %temp%\communicator_patch.log>%temp%\elevated_patch.cmd",0,true
'ENABLED'CREATE ELEVATED COMMAND - INSTALL FILE - USED TO CHANGE BETWEEN USER
AND ADMIN SECURITY CONTEXT objShell.Run "%comspec% /c echo
%windir%\system32\msiexec.exe /i
"&chr(34)&"%windir%\system32\Communicator_Install.msi"&chr(34)&" /qn /norestart
/L* %temp%\communicator_install.log>%temp%\elevated_install.cmd",0,true
'ENABLED'CREATE ELEVATED COMMAND - REMOVE FILE - USED TO CHANGE BETWEEN USER AND
ADMIN SECURITY CONTEXT objShell.Run "%comspec% /c echo
%windir%\system32\msiexec.exe /x
"&chr(34)&"{0D1CBBB9-F4A8-45B6-95E7-202BA61D7AF4}"&chr(34)&" /QN /norestart /L*
%temp%\communicator_remove.log>%temp%\elevated_remove.cmd",0,true
'ENABLED'CREATE ELEVATED COMMAND - COPY MSP TO SYSTEM32 - USED TO CHANGE BETWEEN
USER AND ADMIN SECURITY CONTEXT objShell.Run "%comspec% /c echo copy /v /y
"&chr(34)&LocalTemp&"\*.msp"&chr(34) & "
\\%computername%\c$\windows\system32\>%temp%\cmd_copy1.cmd",0,true
'ENABLED'CREATE ELEVATED COMMAND - COPY MSI TO SYSTEM32 - USED TO CHANGE BETWEEN
USER AND ADMIN SECURITY CONTEXT objShell.Run "%comspec% /c echo copy /v /y
"&chr(34)&LocalTemp&"\*.msi"&chr(34) & "
\\%computername%\c$\windows\system32\>%temp%\cmd_copy2.cmd",0,true
'ENABLED'CREATE ELEVATED COMMAND - MD DIRECTORY objShell.Run "%comspec% /c
echo md " & chr(34) & "c:\Progra~1\Microsoft Office Communicator" &
chr(34)&">%temp%\cmd_md.cmd",0,true
'ENABLED'CREATE ELEVATED COMMAND -
CACLS objShell.Run "%comspec% /c echo %windir%\system32\cacls.exe" & " " &
chr(34) & "C:\Progra~1\Microsoft Office Communicator" & chr(34) & " " & "/e /g
everyone:f" & ">%temp%\cmd_calcs.cmd",0,true
'ENABLED'CREATE ELEVATED COMMAND - COPY FILES objShell.Run "%comspec% /c
%temp%\CPAU.exe -u %computername%\administrator -p "&Elevated_Password&" -ex
"&chr(34)&"%temp%\cmd_copy1.cmd"&chr(34)&" -LWP -hide -wait",0,true
objShell.Run "%comspec% /c %temp%\CPAU.exe -u %computername%\administrator -p
"&Elevated_Password&" -ex "&chr(34)&"%temp%\cmd_copy2.cmd"&chr(34)&" -LWP -hide
-wait",0,true 'END ELEVATED
FILES--------------------------------------------------------------------------------------------------------
'SET WORKING DIRECTORY AND LAUNCH MESSAGE COMMAND FILE 'WINDOWS XP
NORMAL PATH FOR THE (x86) SDMCachePath =
"C:\progra~1\LANDesk\LDClient\sdmcache\APPS\" & AppPath If
filesys.FolderExists(SDMCachePath) then on error resume next
objShell.CurrentDirectory = SDMCachePath End if
'ENABLED'SINGLE LAUNCH
FROM TEMP FOLDER ONLY 'LAUNCHES IN USER SECURITY CONTEXT Err.Number =
objShell.Run ("%comspec% /c %temp%\STARTCOUNTER.hta",0,True)'launches splash
WScript.Sleep 2000'timing ErrorCode0 = Err.Number
'ENABLED'DEFAULT
SPLASH ASED UPON FOLDER LOGIC 'LAUNCHES IN USER SECURITY CONTEXT If
filesys.FolderExists(SDMCachePath) THEN Err.Number = objShell.Run ("%comspec%
/c %temp%\LANDesk.hta",0,False)'launches splash WScript.Sleep 2000'timing
else Err.Number = objShell.Run ("%comspec% /c
%temp%\Kaplan.hta",0,False)'launches splash WScript.Sleep 2000'timing
ErrorCode0 = Err.Number end if
'ENABLED'LAUNCH ELEVATED COMMAND - TEMPORARILY TURNS OFF AUTOMATIC UPDATES
'LAUNCHES IN ADMIN SECURITY CONTEXT on error resume next Set objShell =
CreateObject("WScript.Shell") objShell.Run "%comspec% /c %temp%\CPAU.exe -u
%computername%\administrator -p "&Elevated_Password&" -ex
"&chr(34)&"%temp%\cmd_wuaserv_off.cmd"&chr(34)&" -LWP -hide -wait",0,True
WScript.Sleep 1000
'ENABLED'LAUNCH ELEVATED COMMAND - PRE-INSTALLATION
MAKE DIRECTORY 'LAUNCHES IN ADMIN SECURITY CONTEXT objShell.Run "%comspec%
/c %temp%\CPAU.exe -u %computername%\administrator -p "&Elevated_Password&" -ex
"&chr(34)&"%temp%\cmd_md.cmd"&chr(34)&" -LWP -hide -wait",0,True
WScript.Sleep 1000
'ENABLED'LAUNCH ELEVATED COMMAND - PRE-INSTALLATION
SET FOLDER PERMISSIONS 'LAUNCHES IN ADMIN SECURITY CONTEXT objShell.Run
"%comspec% /c %temp%\CPAU.exe -u %computername%\administrator -p
"&Elevated_Password&" -ex "&chr(34)&"%temp%\cmd_calcs.cmd"&chr(34)&" -LWP -hide
-wait",0,True WScript.Sleep 1000
'ENABLED'LAUNCH
ELEVATED COMMAND - REMOVE APPLICATION - ACTS A REPAIR COMPONENT 'LAUNCHES IN
ADMIN SECURITY CONTEXT
MSIRemove = "%comspec% /c %temp%\CPAU.exe -u
%computername%\administrator -p "&Elevated_Password&" -ex
"&chr(34)&"%temp%\elevated_remove.cmd"&chr(34)&" -LWP -hide -wait" Err.Number
= objShell.Run (MSIRemove,0,True) WScript.Sleep 10000'wait for removal
ErrorCode3 = Err.Number
'ENABLED'INSTALLS APPLICATION WITH SILENT
SWITCHES on error resume next
'ENABLED'LAUNCH ELEVATED COMMAND -
SINGLE LAUNCH FROM TEMP FOLDER ONLY-to be compiled for security reasons
'LAUNCHES IN ADMIN SECURITY CONTEXT MSIInstall = "%comspec% /c
%temp%\CPAU.exe -u %computername%\administrator -p "&Elevated_Password&" -ex
"&chr(34)&"%temp%\elevated_install.cmd"&chr(34)&" -LWP -hide -wait"
Err.Number = objShell.Run (MSIInstall,0,True) WScript.Sleep 20000'wait for
installation ErrorCode4 = Err.Number
'ENABLED'LAUNCH ELEVATED
COMMAND - UPDATES APPLICATION 'LAUNCHES IN ADMIN SECURITY CONTEXT MSIPatch
= "%comspec% /c %temp%\CPAU.exe -u %computername%\administrator -p
"&Elevated_Password&" -ex "&chr(34)&"%temp%\elevated_patch.cmd"&chr(34)&" -LWP
-hide -wait" ''msgbox MSIPatch Err.Number = objShell.Run (MSIPatch,0,True)
WScript.Sleep 15000'wait for installation ErrorCode5 = Err.Number
If UserLoggedInStatus = TRUE then on error resume next 'ENABLED'LAUNCH
APPLICATION 'LAUNCHES APPLICATION IN USER SECURITY CONTEXT Launch =
chr(34)&"C:\progra~1\Microsoft Office Communicator\communicator.exe"&chr(34)
Err.Number = objShell.Run (Launch,9,False) WScript.Sleep 500'timing for
launching ErrorCode6 = Err.Number end if
'ENABLED'LAUNCH ELEVATED COMMAND - TURNS ON AUTOMATIC UPDATES 'LAUNCHES
IN ADMIN SECURITY CONTEXT on error resume next Set objShell =
CreateObject("WScript.Shell") objShell.Run "%comspec% /c %temp%\CPAU.exe -u
%computername%\administrator -p "&Elevated_Password&" -ex
"&chr(34)&"%temp%\cmd_wuaserv_on.cmd"&chr(34)&" -LWP -hide -wait",0,True
WScript.Sleep 1000
'ENABLED'POST-INSTALLATION TASKKILLS objShell.Run
"%comspec% /c %windir%\system32\taskkill.exe /f /im mshta.exe",0,False'KILLS
SPLASH SCREEN and Logo Screen objShell.Run "%comspec% /c
%windir%\system32\taskkill.exe /f /im SetupFiles.exe",0,True objShell.Run
"%comspec% /c %windir%\system32\taskkill.exe /f /im sndrec32.exe",0,True
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im
cpau.exe",0,True WScript.Sleep 1000 '''objShell.Run "%comspec% /c
%windir%\system32\taskkill.exe /f /im cmd.exe",0,True'KILLS ANY CMD.EXE
'ENABLED'HANDLES FINAL ERRORCODE
on error resume next if ErrorCode5 = 3010 then ErrorCode4 = 0'REBOOT if
ErrorCode5 = 3509 then ErrorCode4 = 0'SUCCESS if ErrorCode5 = 1602 then
ErrorCode4 = 0'REPAIR if ErrorCode5 = "" then ErrorCode4 = 0'EMPTY
'CLEANUP objShell.Run "%comspec% /c del /q %temp%\cpau.exe",0,true
objShell.Run "%comspec% /c del /q %temp%\elevated_install.cmd",0,true
objShell.Run "%comspec% /c del /q %temp%\elevated_remove.cmd",0,true
objShell.Run "%comspec% /c del /q %temp%\elevated_patch.cmd",0,true
objShell.Run "%comspec% /c del /q %temp%\Communicator_Install.msi",0,true
objShell.Run "%comspec% /c del /q %temp%\Communicator_Patch.msp",0,true
objShell.Run "%comspec% /c del /q %temp%\progress.gif",0,true objShell.Run
"%comspec% /c del /q %temp%\kaplan.gif",0,true objShell.Run "%comspec% /c del
/q %temp%\kaplan.hta",0,true objShell.Run "%comspec% /c del /q
%temp%\kaplan.jpg",0,true objShell.Run "%comspec% /c del /q
%temp%\landesk.gif",0,true objShell.Run "%comspec% /c del /q
%temp%\landesk.hta",0,true objShell.Run "%comspec% /c del /q
%temp%\landesk.jpg",0,true objShell.Run "%comspec% /c del /q
%temp%\notify.wav",0,true objShell.Run "%comspec% /c del /q
%temp%\progress.wav",0,true objShell.Run "%comspec% /c del /q
%temp%\sndrec32.exe",0,true objShell.Run "%comspec% /c del /q
%temp%\sndrec32.reg",0,true objShell.Run "%comspec% /c del /q
%temp%\startcounter.hta",0,true objShell.Run "%comspec% /c del /q
%temp%\*.vbs",0,false objShell.Run "%comspec% /c del /q %temp%\*.cmd",0,false
objShell.Run "%comspec% /c del /q %temp%\RarSFX0\*.*",0,false
'TESTING DIAGNOSTIC 'msgbox "End Time: " & TIME
'QUIT WITH ERROR CODE
WScript.Quit(ErrorCode4) WScript.Quit(0) End Sub
'W I N D O
W S 7 Sub SEVEN() on error resume next UserLoggedInStatus()'returns
whether a user is logged in or not Set objShell =
CreateObject("Wscript.Shell")
'SET LOCAL TEMP DIRECTORY LocalTemp =
CreateObject("WScript.Shell").ExpandEnvironmentStrings("%Temp%")
'SETS
CURRENT DIRECTORY TO VARIABLE strCurrentDirectory = objShell.CurrentDirectory
'secondary method of copying files into temp folder 'COPIES SOURCE FILES
FROM CURRENT DIRECTORY TO USER'S TEMP FOLDER - used for universal access to
files objShell.Run "%comspec% /c copy /y /v
"&chr(34)&strCurrentDirectory&"\STARTCOUNTER.hta"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v
"&chr(34)&strCurrentDirectory&"\cpau.exe"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v
"&chr(34)&strCurrentDirectory&"\Communicator_Install.msi"&chr(34)&"
%temp%\",0,true objShell.Run "%comspec% /c copy /y /v
"&chr(34)&strCurrentDirectory&"\Communicator_Patch.msp"&chr(34)&"
%temp%\",0,true objShell.Run "%comspec% /c copy /y /v
"&chr(34)&strCurrentDirectory&"\kaplan.jpg"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v
"&chr(34)&strCurrentDirectory&"\kaplan.gif"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v
"&chr(34)&strCurrentDirectory&"\kaplan.hta"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v
"&chr(34)&strCurrentDirectory&"\LANDesk.gif"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v
"&chr(34)&strCurrentDirectory&"\LANDesk.jpg"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v
"&chr(34)&strCurrentDirectory&"\LANDesk.hta"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v
"&chr(34)&strCurrentDirectory&"\sndrec32.reg"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v
"&chr(34)&strCurrentDirectory&"\sndrec32.exe"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v
"&chr(34)&strCurrentDirectory&"\notify.wav"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v
"&chr(34)&strCurrentDirectory&"\progress.wav"&chr(34)&" %temp%\",0,true
WScript.Sleep 500'timing
'THIS WILL CREATE ALL THE ELEVATED
FILES---------------------------------------------------------------------------------
'ENABLED'ELEVATED TURN OFF WINDOWS UPDATES objShell.Run "%comspec% /c echo
%windir%\system32\net.exe stop wuauserv>%temp%\cmd_wuaserv_off.cmd",0,true
'ENABLED'CREATE ELEVATED COMMAND - TURN ON WINDOWS UPDATES objShell.Run
"%comspec% /c echo %windir%\system32\net.exe start
wuauserv>%temp%\cmd_wuaserv_on.cmd",0,true
'ENABLED'CREATE ELEVATED
COMMAND - PATCH FILE - USED TO CHANGE BETWEEN USER AND ADMIN SECURITY CONTEXT
objShell.Run "%comspec% /c echo %windir%\system32\msiexec.exe /p
"&chr(34)&"%windir%\system32\Communicator_Patch.msp"&chr(34)&" /qn /norestart
/L* %temp%\communicator_patch.log>%temp%\elevated_patch.cmd",0,true
'ENABLED'CREATE ELEVATED COMMAND - INSTALL FILE - USED TO CHANGE BETWEEN USER
AND ADMIN SECURITY CONTEXT objShell.Run "%comspec% /c echo
%windir%\system32\msiexec.exe /i
"&chr(34)&"%windir%\system32\Communicator_Install.msi"&chr(34)&" /qn /norestart
/L* %temp%\communicator_install.log>%temp%\elevated_install.cmd",0,true
'ENABLED'CREATE ELEVATED COMMAND - REMOVE FILE - USED TO CHANGE BETWEEN USER AND
ADMIN SECURITY CONTEXT objShell.Run "%comspec% /c echo
%windir%\system32\msiexec.exe /x
"&chr(34)&"{0D1CBBB9-F4A8-45B6-95E7-202BA61D7AF4}"&chr(34)&" /QN /norestart /L*
%temp%\communicator_remove.log>%temp%\elevated_remove.cmd",0,true
'ENABLED'CREATE ELEVATED COMMAND - COPY MSP TO SYSTEM32 - USED TO CHANGE BETWEEN
USER AND ADMIN SECURITY CONTEXT objShell.Run "%comspec% /c echo copy /v /y
"&chr(34)&LocalTemp&"\*.msp"&chr(34) & "
\\%computername%\c$\windows\system32\>%temp%\cmd_copy1.cmd",0,true
'ENABLED'CREATE ELEVATED COMMAND - COPY MSI TO SYSTEM32 - USED TO CHANGE BETWEEN
USER AND ADMIN SECURITY CONTEXT objShell.Run "%comspec% /c echo copy /v /y
"&chr(34)&LocalTemp&"\*.msi"&chr(34) & "
\\%computername%\c$\windows\system32\>%temp%\cmd_copy2.cmd",0,true
'ENABLED'CREATE ELEVATED COMMAND - MD DIRECTORY objShell.Run "%comspec% /c
echo md " & chr(34) & "c:\Progra~1\Microsoft Office Communicator" &
chr(34)&">%temp%\cmd_md.cmd",0,true
'ENABLED'CREATE ELEVATED COMMAND -
CACLS objShell.Run "%comspec% /c echo %windir%\system32\cacls.exe" & " " &
chr(34) & "C:\Program Files\Microsoft Office Communicator" & chr(34) & " " & "/e
/g everyone:f" & ">%temp%\cmd_calcs.cmd",0,true
'ENABLED'CREATE ELEVATED
COMMAND - REGISTRY KEY PRE-COUNTER SPLASH SCREEN - not needed for XP
objShell.Run "%comspec% /c echo %windir%\regedit.exe /s
%temp%\sndrec32.reg>%temp%\cmd_registry.cmd",0,true 'LAUNCH ELEVATED COMMAND
- APPLY REG KEY objShell.Run "%comspec% /c %temp%\CPAU.exe -u
%computername%\administrator -p "&Elevated_Password&" -ex
"&chr(34)&"%temp%\cmd_registry.cmd"&chr(34)&" -LWP -hide -wait",0,true
'ENABLED'CREATE ELEVATED COMMAND - COPY FILES objShell.Run "%comspec% /c
%temp%\CPAU.exe -u %computername%\administrator -p "&Elevated_Password&" -ex
"&chr(34)&"%temp%\cmd_copy1.cmd"&chr(34)&" -LWP -hide -wait",0,true
objShell.Run "%comspec% /c %temp%\CPAU.exe -u %computername%\administrator -p
"&Elevated_Password&" -ex "&chr(34)&"%temp%\cmd_copy2.cmd"&chr(34)&" -LWP -hide
-wait",0,true 'END ELEVATED
FILES--------------------------------------------------------------------------------------------------------
'SET WORKING DIRECTORY AND LAUNCH MESSAGE COMMAND FILE 'WINDOWS XP
NORMAL PATH FOR THE (x86) SDMCachePath =
"C:\progra~2\LANDesk\LDClient\sdmcache\APPS\" & AppPath If
filesys.FolderExists(SDMCachePath) then on error resume next
objShell.CurrentDirectory = SDMCachePath End if
'ENABLED'SINGLE LAUNCH
FROM TEMP FOLDER ONLY 'LAUNCHES IN USER SECURITY CONTEXT Err.Number =
objShell.Run ("%comspec% /c %temp%\STARTCOUNTER.hta",0,True)'launches splash
WScript.Sleep 2000'timing ErrorCode0 = Err.Number
'ENABLED'DEFAULT
SPLASH ASED UPON FOLDER LOGIC 'LAUNCHES IN USER SECURITY CONTEXT If
filesys.FolderExists(SDMCachePath) THEN Err.Number = objShell.Run ("%comspec%
/c %temp%\LANDesk.hta",0,False)'launches splash WScript.Sleep 2000'timing
else Err.Number = objShell.Run ("%comspec% /c
%temp%\Kaplan.hta",0,False)'launches splash WScript.Sleep 2000'timing
ErrorCode0 = Err.Number end if
'ENABLED'LAUNCH ELEVATED COMMAND - TEMPORARILY TURNS OFF AUTOMATIC UPDATES
'LAUNCHES IN ADMIN SECURITY CONTEXT on error resume next Set objShell =
CreateObject("WScript.Shell") objShell.Run "%comspec% /c %temp%\CPAU.exe -u
%computername%\administrator -p "&Elevated_Password&" -ex
"&chr(34)&"%temp%\cmd_wuaserv_off.cmd"&chr(34)&" -LWP -hide -wait",0,True
WScript.Sleep 1000
'ENABLED'LAUNCH ELEVATED COMMAND - PRE-INSTALLATION
MAKE DIRECTORY 'LAUNCHES IN ADMIN SECURITY CONTEXT objShell.Run "%comspec%
/c %temp%\CPAU.exe -u %computername%\administrator -p "&Elevated_Password&" -ex
"&chr(34)&"%temp%\cmd_md.cmd"&chr(34)&" -LWP -hide -wait",0,True
WScript.Sleep 1000
'ENABLED'LAUNCH ELEVATED COMMAND - PRE-INSTALLATION
SET FOLDER PERMISSIONS 'LAUNCHES IN ADMIN SECURITY CONTEXT objShell.Run
"%comspec% /c %temp%\CPAU.exe -u %computername%\administrator -p
"&Elevated_Password&" -ex "&chr(34)&"%temp%\cmd_calcs.cmd"&chr(34)&" -LWP -hide
-wait",0,True WScript.Sleep 1000
'ENABLED'LAUNCH
ELEVATED COMMAND - REMOVE APPLICATION - ACTS A REPAIR COMPONENT 'LAUNCHES IN
ADMIN SECURITY CONTEXT
MSIRemove = "%comspec% /c %temp%\CPAU.exe -u
%computername%\administrator -p "&Elevated_Password&" -ex
"&chr(34)&"%temp%\elevated_remove.cmd"&chr(34)&" -LWP -hide -wait" Err.Number
= objShell.Run (MSIRemove,0,True) WScript.Sleep 10000'wait for removal
ErrorCode3 = Err.Number
'ENABLED'INSTALLS APPLICATION WITH SILENT
SWITCHES on error resume next
'ENABLED'LAUNCH ELEVATED COMMAND -
SINGLE LAUNCH FROM TEMP FOLDER ONLY-to be compiled for security reasons
'LAUNCHES IN ADMIN SECURITY CONTEXT MSIInstall = "%comspec% /c
%temp%\CPAU.exe -u %computername%\administrator -p "&Elevated_Password&" -ex
"&chr(34)&"%temp%\elevated_install.cmd"&chr(34)&" -LWP -hide -wait"
Err.Number = objShell.Run (MSIInstall,0,True) WScript.Sleep 20000'wait for
installation ErrorCode4 = Err.Number
'ENABLED'LAUNCH ELEVATED
COMMAND - UPDATES APPLICATION 'LAUNCHES IN ADMIN SECURITY CONTEXT MSIPatch
= "%comspec% /c %temp%\CPAU.exe -u %computername%\administrator -p
"&Elevated_Password&" -ex "&chr(34)&"%temp%\elevated_patch.cmd"&chr(34)&" -LWP
-hide -wait" ''msgbox MSIPatch ''Err.Number = objShell.Run
(MSIPatch,9,True) objShell.Run "%comspec% /c %temp%\CPAU.exe -u
%computername%\administrator -p PASSWORD -ex
"&chr(34)&"%temp%\elevated_patch.cmd"&chr(34)&" -LWP -hide -wait",0,true
WScript.Sleep 15000'wait for installation ''ErrorCode4 = Err.Number
If UserLoggedInStatus = TRUE then on error resume next 'ENABLED'LAUNCH
APPLICATION 'LAUNCHES APPLICATION IN USER SECURITY CONTEXT Launch =
chr(34)&"C:\progra~1\Microsoft Office Communicator\communicator.exe"&chr(34)
Err.Number = objShell.Run (Launch,9,False) WScript.Sleep 500'timing for
launching ErrorCode6 = Err.Number end if
'LOGIC TO
DETERMINE IF REGISTRY ACCOUNT IS TO BE LOADED ''if strUser = "SYSTEM" then
strUser="" ''if strUser = "LOCAL SERVICE" then strUser="" ''if strUser =
"NETWORK SERVICE" then strUser="" ''if strUser = "ADMINISTRATOR" then
strUser=""
''if strUser <> "" then
'LOADS HIVE '' on error
resume next '' REGEDIT = "%comspec% /c %windir%\system32\REG.exe LOAD
HKEY_USERS\"&objSubkey&" c:\Docume~1\"&strUser&"\ntuser.dat" '' 'COMMAND
reg.exe load HKU\S-1-5-21-729355473-1286879909-800860556-87287
c:\Docume~1\prosys\ntuser.dat '' Err.Number = objShell.Run (REGEDIT,0,True)
'' ErrorCode8 = Err.Number '' WScript.Sleep 2000'timing
'ENABLED'POST-INSTALLATION REGEDIT - DISABLE REGISTRATION '' on error resume
next '' REGEDIT = "%comspec% /c %windir%\system32\REG.exe ADD "&
chr(34)&"HKEY_USERS\"&objSubkey&"\Software\TechSmith\SnagIt\10"&chr(34)&" /v
"&chr(34)&"RegistrationDialogHasShown"&CHR(34)&" /d 1 /t REG_DWORD /f" ''
'command: REG.exe ADD "HKCU\Software\TechSmith\SnagIt\10" /v
"RegistrationDialogHasShown" /d 1 /t REG_DWORD /f '' Err.Number =
objShell.Run (REGEDIT,0,True) '' ErrorCode8 = Err.Number '' WScript.Sleep
2000'timing '' 'msgbox "step8 " & ErrorCode8 ''end if
'' Next
'end add registry
key'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'ENABLED'LAUNCH ELEVATED COMMAND - TURNS ON AUTOMATIC UPDATES 'LAUNCHES
IN ADMIN SECURITY CONTEXT on error resume next Set objShell =
CreateObject("WScript.Shell") objShell.Run "%comspec% /c %temp%\CPAU.exe -u
%computername%\administrator -p "&Elevated_Password&" -ex
"&chr(34)&"%temp%\cmd_wuaserv_on.cmd"&chr(34)&" -LWP -hide -wait",0,True
WScript.Sleep 1000
'ENABLED'POST-INSTALLATION TASKKILLS objShell.Run
"%comspec% /c %windir%\system32\taskkill.exe /f /im mshta.exe",0,False'KILLS
SPLASH SCREEN and Logo Screen objShell.Run "%comspec% /c
%windir%\system32\taskkill.exe /f /im SetupFiles.exe",0,True objShell.Run
"%comspec% /c %windir%\system32\taskkill.exe /f /im sndrec32.exe",0,True
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im
cpau.exe",0,True WScript.Sleep 1000 '''objShell.Run "%comspec% /c
%windir%\system32\taskkill.exe /f /im cmd.exe",0,True'KILLS ANY CMD.EXE
'ENABLED'HANDLES FINAL ERRORCODE
on error resume next if ErrorCode5 = 3010 then ErrorCode4 = 0'REBOOT if
ErrorCode5 = 3509 then ErrorCode4 = 0'SUCCESS if ErrorCode5 = 1602 then
ErrorCode4 = 0'REPAIR if ErrorCode5 = "" then ErrorCode4 = 0'EMPTY
'CLEANUP objShell.Run "%comspec% /c del /q %temp%\cpau.exe",0,true
objShell.Run "%comspec% /c del /q %temp%\elevated_install.cmd",0,true
objShell.Run "%comspec% /c del /q %temp%\elevated_remove.cmd",0,true
objShell.Run "%comspec% /c del /q %temp%\elevated_patch.cmd",0,true
objShell.Run "%comspec% /c del /q %temp%\Communicator_Install.msi",0,true
objShell.Run "%comspec% /c del /q %temp%\Communicator_Patch.msp",0,true
objShell.Run "%comspec% /c del /q %temp%\progress.gif",0,true objShell.Run
"%comspec% /c del /q %temp%\kaplan.gif",0,true objShell.Run "%comspec% /c del
/q %temp%\kaplan.hta",0,true objShell.Run "%comspec% /c del /q
%temp%\kaplan.jpg",0,true objShell.Run "%comspec% /c del /q
%temp%\landesk.gif",0,true objShell.Run "%comspec% /c del /q
%temp%\landesk.hta",0,true objShell.Run "%comspec% /c del /q
%temp%\landesk.jpg",0,true objShell.Run "%comspec% /c del /q
%temp%\notify.wav",0,true objShell.Run "%comspec% /c del /q
%temp%\progress.wav",0,true objShell.Run "%comspec% /c del /q
%temp%\sndrec32.exe",0,true objShell.Run "%comspec% /c del /q
%temp%\sndrec32.reg",0,true objShell.Run "%comspec% /c del /q
%temp%\startcounter.hta",0,true objShell.Run "%comspec% /c del /q
%temp%\*.vbs",0,false objShell.Run "%comspec% /c del /q %temp%\*.cmd",0,false
objShell.Run "%comspec% /c del /q %temp%\RarSFX0\*.*",0,false
'TESTING DIAGNOSTIC 'msgbox "End Time: " & TIME
'QUIT WITH ERROR CODE
WScript.Quit(ErrorCode4) WScript.Quit(0) End Sub
'THIS FUNCTION
RETURNS LOGGED IN STATUS WITH A TRUE-FOR LOGGED IN OR FALSE-NOT LOGGED IN
Function UserLoggedInStatus() on error resume next Dim LoggedInStatus,
objWMIService, colItems
'Example 'strComputer = "." 'If
UserLoggedInStatus = TRUE then msgbox "user IS logged in" 'If
UserLoggedInStatus = FALSE then msgbox "user NOT logged in"
Set
objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set
colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem",,48)
For Each objItem in colItems on error resume next 'Wscript.Echo
objItem.UserName LoggedInStatus = trim(objItem.UserName) & "" next
if LoggedInStatus = "" then 'msgbox "User NOT logged in"
UserLoggedInStatus = FALSE end if
if LoggedInStatus <> "" then
'msgbox "User IS logged in" UserLoggedInStatus = TRUE end if
Set
objItem = Nothing Set colItems = Nothing Set objWMIService = Nothing
End function
'THIS FUNCTION RETURNS OWNER OF EXPLORER.EXE PROCESS
Function ConsoleUser(sHost) on error resume next ' Returns name of user
logged on to console ' If no users are logged on, returns "" Dim oWMI,
colProc, oProcess, sUser, sDomain Set oWmi = GetObject("winmgmts:" _ &
"{impersonationLevel=impersonate,(debug)}!\\" _ & sHost & "\root\cimv2" )
Set colProc = oWmi.ExecQuery("Select Name from Win32_Process" _ & "
Where Name='explorer.exe' and SessionID=0" )
ConsoleUser = "" For
Each oProcess In colProc lRet = oProcess.GetOwner(sUser, sDomain) If
lRet = 0 Then sUser = Trim(sUser) ConsoleUser = sUser End If Next
End Function
'THIS FUNCTION RETURNS 32 or 64 bit for OS
Function OS_TYPE() on error resume next Const HKLM = &H80000002
arrComputers = Array(".")
For Each strComputer In arrComputers on
error resume next Set WshShell = WScript.CreateObject("WScript.Shell")
'CHECKING THE REGISTRY VALUE X =
WshShell.RegRead("HKLM\HARDWARE\DESCRIPTION\System\CentralProcessor\0\Identifier")
'TAKING 3 CHARECTERS FROM LEFT SIDE OF RESULT X1 = Left(X,3) 'CHECK
VERSION AGAINST X86 If X1 = "x86" Then 'WScript.Echo "32- Bit OS"
OS_TYPE = 32 Else 'WScript.Echo "64- Bit OS" OS_TYPE = 64 End if
Next end function
'THIS FUNCTION RETURNS GENERAL TIME OF DAY; MORNING,
AFTERNOON, EVENING Function TimeOfDay() on error resume next Dim h
'create variable that will store the hour
'EXAMPLE 'msgbox
TimeOfDay()
h=hour(now) 'pass in the date and time to the hour function
as a parameter If h<12 then 'msgbox "morning!" TimeOfDay = "morning"
ElseIf h<18 then 'msgbox "afternoon!" TimeOfDay = "afternoon" else
'msgbox "evening!" TimeOfDay = "evening" end if End function
![bar1](http://eddiejackson.net/web_images/lightgraybar.bmp)
|