Archive - October 2010

"Be absolutely determined to enjoy what you do." - Gerry Sikorski



Index

bar1
WMIC Commands
Symantec 11.06 Un-Install
Countdown Installation Timer
Alert Notification v1
Office 2010 Deployment
Generic Splash Screen
Office 2010 Won't Install
Message Command File
BGInfo 4.16 Deployment
Enable WMI In WDS
V-Model Testing

bar1







Δ Friday, October 29th 2010
bar1
  

Δ WMIC Commands
 
How to use some basic WMIC commands

 
Command
           

bar1
WMIC /locale:ms_409 OS

WMIC OS LIST BRIEF

WMIC OS GET csname, locale, bootdevice

WMIC /locale:ms_409 NTEVENT where LogFile='system'

WMIC NTEVENT where "LogFile='system' and Type>'0'"

WMIC SERVICE where caption='TELNET' CALL STARTSERVICE

WMIC PRINTER LIST STATUS

WMIC PRINTER where PortName="LPT1:" GET PortName, Name, ShareName

WMIC /INTERACTIVE:ON PRINTER where PortName="LPT1:" DELETE

WMIC PROCESS where name='evil.exe' delete

WMIC /output:"%computername%.txt" MEMORYCHIP where "memorytype=17" get Capacity

WMIC /node:@workstns.txt /failfast:on PROCESS call create "\\server\share\installer.cmd"

Interactive mode:
C:>START "Windows Management" WMIC
wmic:root\cli>/locale:ms_409
wmic:root\cli>OS get csname
wmic:root\cli>quit
bar1

             


      
   
Δ Symantec 11.06 Uninstall
 
How to uninstall Symantec Anti-Virus 11.06


 
Command
           

bar1
' ----- ExeScript Options Begin -----
' ScriptType: window,highest
' DestDirectory: temp
' Icon: c:\windows\system32\shell32.dll,162
' File: C:\Symantec_11.06_Uninstaller.msi
' OutputFile: C:\Symantec_11.06_Uninstaller.exe
' CompanyName: Commlink Industries
' FileDescription: Symantec 11.06 Removal Tool
' FileVersion: 1.0.0.1
' LegalCopyright: Commlink Industries
' ProductName: Symantec 11.06 Removal Tool
' ProductVersion: 1.0.0.1
' ----- ExeScript Options End -----
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
':: E L I T E   S O L U T I O N S
 :: SCRIPT LANGUAGE: VBScript
':: SCRIPT NAME: SymantecUnInstall.vbs
':: PURPOSE: To be used to remove Symantec 11.06
':: CREATION DATE: 10/29/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 BetaTestPath, SDMCache, AppPath, wshShell, SetupFilesPath, SetupPath

AppPath = "Symantec\Symantec_11.06_UNINSTALL"

Set filesys = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Wscript.Shell")
Set wshShell = WScript.CreateObject("WScript.Shell")

'TESTING DIAGNOSTIC
'msgbox "Begin Time: " & TIME
'
'
'PRE-SETUP
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 Setup.exe",0,True
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im msiexec.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
'KILLS CURRENTLY RUNNING MSIEXEC.EXE
'objShell.Run "%comspec% /c %windir%\SYSTEM32\TASKKILL.EXE /F /IM msiexec.exe",0,True


'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
'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 7 Enterprise" then Seven()

'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

'SET WORKING DIRECTORY AND LAUNCH MESSAGE COMMAND FILE
'WINDOWS XP NORMAL PATH
SDMCachePath = "C:\Progra~1\LANDesk\LDClient\sdmcache\APPS\" & AppPath
If filesys.FolderExists(SDMCachePath) then
on error resume next
objShell.CurrentDirectory = SDMCachePath
End if


'ENABLED'TEMPORARILY TURNS OFF AUTOMATIC UPDATES
on error resume next
Set objShell = CreateObject("WScript.Shell")
objShell.Run "%comspec% /c %windir%\system32\net.exe stop wuauserv",0,True
WScript.Sleep 2000

'UPDATE POLICY - AN UPDATED POLICY THAT WILL NOT HAVE A PASSWORD ASSOCIATED TO THE SYLINK PROFILE
objShell.Run "%comspec% /c %windir%\system32\SC.exe stop " & chr(34) & "Symantec AntiVirus" & chr(34),0,True
objShell.Run "%comspec% /c " & CHR(34)&"C:\Progra~1\Symantec\Symantec Endpoint Protection\Smc.exe" & CHR(34)&" -updateconfig", 0, True
WScript.Sleep 15000

'ENABLED'TURN OFF SYMANTEC RELATED SERVICES SERVICES
TurnOffSMC = "%comspec% /c " & CHR(34)&"C:\Progra~1\Symantec\Symantec Endpoint Protection\Smc.exe" & CHR(34)&" -stop -p PASSWORDHERE"
'msgbox TurnOffSMC
objShell.Run "%comspec% /c %windir%\system32\SC.exe stop " & chr(34) & "Symantec AntiVirus" & chr(34),0,True
Err.Number = objShell.Run (TurnOffSMC,0,True)
WScript.Sleep 2000
Err.Number = objShell.Run (TurnOffSMC,0,True)
WScript.Sleep 2000

'ENABLED'STOP SERVICES
on error resume next
objShell.Run "%comspec% /c %windir%\system32\SC.exe stop " & chr(34) & "Symantec AntiVirus" & chr(34),0,True
WScript.Sleep 5000
objShell.Run "%comspec% /c %windir%\system32\SC.exe stop ccEvtMgr",0,True
WScript.Sleep 3000
objShell.Run "%comspec% /c %windir%\system32\SC.exe stop ccSetMgr",0,True
WScript.Sleep 3000
'WScript.Sleep 2000

'ENABLED'SHUTDOWN PROCESSES
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im Smc.exe",0,true
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im Smc.exe",0,true
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im SmcGui.exe",0,true
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im SmcGui.exe",0,true
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im ccSvcHst.exe",0,true
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im ccSvcHst.exe",0,true
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im Rtvscan.exe",0,true
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im Rtvscan.exe",0,true
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im lucoms~1.EXE",0,true
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im lucoms~1.EXE",0,true
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im SescLU.EXE",0,true
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im SescLU.EXE",0,true
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im mscorsvw.exe",0,true

'ENABLED'STOP SERVICES
objShell.Run "%comspec% /c %windir%\system32\SC.exe stop " & chr(34) & "Symantec AntiVirus" & chr(34),0,True
WScript.Sleep 5000
objShell.Run "%comspec% /c %windir%\system32\SC.exe stop ccEvtMgr",0,True
WScript.Sleep 3000
objShell.Run "%comspec% /c %windir%\system32\SC.exe stop ccSetMgr",0,True
WScript.Sleep 3000


'STEP1 - UNINSTALL SYMANTEC ENDPOINT PROTECTION ###################################################
Remove1 = "%comspec% /c %windir%\system32\msiexec.exe /x"& CHR(34) & "{3C1AE512-3C37-44FA-BA42-ABB721EC5B1D}" & CHR(34) & " /qn /norestart"
Remove1_1 = "%comspec% /c %windir%\system32\msiexec.exe /x"& CHR(34) & "{2EFCC193-D915-4CCB-9201-31773A27BC06}" & CHR(34) & " /qn /norestart"


'msgbox Remove
Err.Number = objShell.Run (Remove1,0,True)
Err.Number = objShell.Run (Remove1_1,0,True)
WScript.Sleep 5000

'ENABLED'STOP SERVICES
objShell.Run "%comspec% /c %windir%\system32\SC.exe stop " & chr(34) & "Symantec AntiVirus" & chr(34),0,True
WScript.Sleep 5000
objShell.Run "%comspec% /c %windir%\system32\SC.exe stop ccEvtMgr",0,True
WScript.Sleep 3000
objShell.Run "%comspec% /c %windir%\system32\SC.exe stop ccSetMgr",0,True
WScript.Sleep 3000


'STEP2 - UNINSTALL LIVE UPDATE #########################################
on error resume next
Remove2 = "%comspec% /c "& CHR(34) & "C:\Progra~1\Symantec\LiveUpdate\LSETUP.EXE" & CHR(34) & " /U /Q"
Err.Number = objShell.Run (Remove2,0,True)
WScript.Sleep 5000

objShell.Run "%comspec% /c %windir%\system32\SC.exe stop " & chr(34) & "Symantec AntiVirus" & chr(34),0,True
WScript.Sleep 5000
objShell.Run "%comspec% /c %windir%\system32\SC.exe stop ccEvtMgr",0,True
WScript.Sleep 3000
objShell.Run "%comspec% /c %windir%\system32\SC.exe stop ccSetMgr",0,True
WScript.Sleep 3000


'STEP3 - CUSTOMIZED REMOVAL ###########################################################

objShell.Run "%comspec% /c copy /v /y Symantec_11.06_Uninstaller.msi %windir%\system32",0,True
objShell.Run "%comspec% /c %windir%\system32\msiexec.exe /x"& CHR(34) & "%windir%\system32\Symantec_11.06_Uninstaller.msi" & CHR(34) & " /qn /norestart",0,True
objShell.Run "%comspec% /c %windir%\system32\msiexec.exe /i"& CHR(34) & "%windir%\system32\Symantec_11.06_Uninstaller.msi" & CHR(34) & " /qn /norestart",0,True
objShell.Run "%comspec% /c %windir%\system32\msiexec.exe /x"& CHR(34) & "{0A2163CB-4F47-44AA-A219-36133260CF17}" & CHR(34) & " /qn /norestart",0,True
objShell.Run "%comspec% /c %windir%\system32\msiexec.exe /x"& CHR(34) & "{8E7332CC-A2E6-4DAD-AAE3-4449563FFD4B}" & CHR(34) & " /qn /norestart",0,True

'ENABLED'PRE-INSTALLATION REGEDIT4
on error resume next
REGEDIT4 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{3C1AE512-3C37-44FA-BA42-ABB721EC5B1D}" & chr(34) & " /f"
Err.Number = objShell.Run (REGEDIT4,0,True)
WScript.Sleep 1000

REGEDIT5 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SYSTEM\ControlSet001\Services\Eventlog\Application\SescLU" & chr(34) & " /f"
Err.Number = objShell.Run (REGEDIT5,0,True)
WScript.Sleep 1000

REGEDIT6 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SOFTWARE\Classes\CLSID\{09FA8089-EE3E-4362-B8C0-1B0F4FD0505D}" & chr(34) & " /f"
Err.Number = objShell.Run (REGEDIT6,0,True)
WScript.Sleep 1000

REGEDIT7 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SOFTWARE\Classes\CLSID\{13BA26BF-ADDB-4033-8012-4768958F4050}" & chr(34) & " /f"
Err.Number = objShell.Run (REGEDIT7,0,True)
WScript.Sleep 1000

REGEDIT8 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SOFTWARE\Classes\CLSID\{173883C3-C6CF-4D17-9889-CDC51DCFF5E1}" & chr(34) & " /f"
Err.Number = objShell.Run (REGEDIT8,0,True)
WScript.Sleep 1000

REGEDIT9 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SOFTWARE\Classes\CLSID\{1CDDD0B9-03AA-4442-9A5B-AC98086513E1}" & chr(34) & " /f"
Err.Number = objShell.Run (REGEDIT9,0,True)
WScript.Sleep 1000

REGEDIT10 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SOFTWARE\Symantec" & chr(34) & " /f"
Err.Number = objShell.Run (REGEDIT10,0,True)
WScript.Sleep 1000

REGEDIT11= "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SOFTWARE\Classes\SyKnAppS.LUCallback" & chr(34) & " /f"
Err.Number = objShell.Run (REGEDIT11,0,True)
WScript.Sleep 1000

REGEDIT12 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SOFTWARE\Classes\SyKnAppS.LUCallback.1" & chr(34) & " /f"
Err.Number = objShell.Run (REGEDIT12,0,True)
WScript.Sleep 1000

REGEDIT13 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SOFTWARE\Classes\Symantec.SSHelper" & chr(34) & " /f"
Err.Number = objShell.Run (REGEDIT13,0,True)
WScript.Sleep 1000

REGEDIT14 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SOFTWARE\Classes\Symantec.SSHelper.1" & chr(34) & " /f"
Err.Number = objShell.Run (REGEDIT14,0,True)
WScript.Sleep 1000

REGEDIT15 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Management\ARPCache\{3C1AE512-3C37-44FA-BA42-ABB721EC5B1D}" & chr(34) & " /f"
Err.Number = objShell.Run (REGEDIT15,0,True)
WScript.Sleep 1000

REGEDIT16 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SOFTWARE\Classes\CLSID\{09FA8089-EE3E-4362-B8C0-1B0F4FD0505D}" & chr(34) & " /f"
'Err.Number = objShell.Run (REGEDIT16,0,True)
WScript.Sleep 1000

REGEDIT17 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SOFTWARE\Classes\CLSID\{09FA8089-EE3E-4362-B8C0-1B0F4FD0505D}" & chr(34) & " /f"
'Err.Number = objShell.Run (REGEDIT17,0,True)
WScript.Sleep 1000

REGEDIT18 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SOFTWARE\Classes\CLSID\{09FA8089-EE3E-4362-B8C0-1B0F4FD0505D}" & chr(34) & " /f"
'Err.Number = objShell.Run (REGEDIT18,0,True)
WScript.Sleep 1000

REGEDIT19 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SOFTWARE\Classes\CLSID\{09FA8089-EE3E-4362-B8C0-1B0F4FD0505D}" & chr(34) & " /f"
'Err.Number = objShell.Run (REGEDIT19,0,True)
WScript.Sleep 1000

REGEDIT20 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SOFTWARE\Classes\CLSID\{09FA8089-EE3E-4362-B8C0-1B0F4FD0505D}" & chr(34) & " /f"
'Err.Number = objShell.Run (REGEDIT20,0,True)
WScript.Sleep 1000

REGEDIT21 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SYSTEM\ControlSet001\Control\VirtualDeviceDrivers" & chr(34) & " /f"
'Err.Number = objShell.Run (REGEDIT21,0,True)
WScript.Sleep 1000
'msgbox "1"
REGEDIT22 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SYSTEM\ControlSet003\Control\VirtualDeviceDrivers" & chr(34) & " /f"
'Err.Number = objShell.Run (REGEDIT22,0,True)
WScript.Sleep 1000

REGEDIT23 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SYSTEM\CurrentControlSet\Control\VirtualDeviceDrivers" & chr(34) & " /f"
'Err.Number = objShell.Run (REGEDIT23,0,True)
WScript.Sleep 1000


REGEDIT24 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{2EFCC193-D915-4CCB-9201-31773A27BC06}" & chr(34) & " /f"
Err.Number = objShell.Run (REGEDIT24,0,True)
WScript.Sleep 1000

'msgbox "2"


'ENABLED'POST-INSTALLATION DELETE FILES
on error resume next
'this deletes symantec install from cache
objShell.Run "%comspec% /c DEL /Q " & chr(34) & "C:\WINDOWS\Installer\{3C1AE512-3C37-44FA-BA42-ABB721EC5B1D}\*.*" & chr(34),0,True
objShell.Run "%comspec% /c RD /y " & chr(34) & "C:\WINDOWS\Installer\{3C1AE512-3C37-44FA-BA42-ABB721EC5B1D}" & chr(34),0,False

'this removes shortcuts from start menu
objShell.Run "%comspec% /c DEL /Q " & chr(34) & "C:\Documents and Settings\All Users\Start Menu\Programs\Symantec Endpoint Protection\*.lnk" & chr(34),0,True
objShell.Run "%comspec% /c RD /Y " & chr(34) & "C:\Documents and Settings\All Users\Start Menu\Programs\Symantec Endpoint Protection" & chr(34),0,True

objShell.Run "%comspec% /c DEL /Q " & chr(34) & "C:\Program Files\Symantec\Symantec Endpoint Protection\*.*" & chr(34),0,True
objShell.Run "%comspec% /c DEL /Q " & chr(34) & "C:\Program Files\Common Files\Symantec Shared\COH\*.*" & chr(34),0,True
objShell.Run "%comspec% /c DEL /Q " & chr(34) & "C:\Program Files\Common Files\Symantec Shared\Global Exceptions\*.*" & chr(34),0,True
objShell.Run "%comspec% /c DEL /Q " & chr(34) & "C:\Program Files\Common Files\Symantec Shared\HWID\*.*" & chr(34),0,True
objShell.Run "%comspec% /c DEL /Q " & chr(34) & "C:\Program Files\Common Files\Symantec Shared\SPManifests\*.*" & chr(34),0,True
objShell.Run "%comspec% /c DEL /Q " & chr(34) & "C:\Program Files\Common Files\Symantec Shared\SymcData\*.*" & chr(34),0,True
objShell.Run "%comspec% /c DEL /Q " & chr(34) & "C:\Program Files\Common Files\Symantec Shared\EENGINE\*.*" & chr(34),0,True
objShell.Run "%comspec% /c DEL /Q " & chr(34) & "C:\Program Files\Common Files\Symantec Shared\Help\*.*" & chr(34),0,True
objShell.Run "%comspec% /c DEL /Q " & chr(34) & "C:\Program Files\Common Files\Symantec Shared\SAVSubmissionEngine\*.*" & chr(34),0,True
objShell.Run "%comspec% /c DEL /Q " & chr(34) & "C:\Program Files\Common Files\Symantec Shared\SRTSP\*.*" & chr(34),0,True
objShell.Run "%comspec% /c DEL /Q " & chr(34) & "C:\Program Files\Common Files\Symantec Shared\VirusDefs\*.*" & chr(34),0,True
objShell.Run "%comspec% /c DEL /Q " & chr(34) & "C:\Documents and Settings\All Users\Application Data\Symantec\*.*" & chr(34),0,True
objShell.Run "%comspec% /c DEL /Q " & chr(34) & "C:\Documents and Settings\All Users\Application Data\Symantec\LiveUpdate\*.*" & chr(34),0,True
objShell.Run "%comspec% /c DEL /Q " & chr(34) & "C:\Program Files\Symantec\LiveUpdate\*.*" & chr(34),0,True
objShell.Run "%comspec% /c DEL /Q " & chr(34) & "%temp%\*.tmp" & chr(34),0,True
objShell.Run "%comspec% /c DEL /Q " & chr(34) & "%temp%\*.*" & chr(34),0,True
objShell.Run "%comspec% /c DEL /Q " & chr(34) & "%windir%\temp\*.tmp" & chr(34),0,True
objShell.Run "%comspec% /c DEL /Q " & chr(34) & "%windir%\temp\%temp%\*.*" & chr(34),0,True

'this allows you to continue another install process without a reboot
REGEDIT25 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired"&chr(34)&" /f"
Err.Number = objShell.Run (REGEDIT25,0,True)
WScript.Sleep 2000

'this allows you to continue another install process without a reboot
REGEDIT26 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SYSTEM\CurrentControlSet\Control\Session Manager"&chr(34)&" /v PendingFileRenameOperations /f"
Err.Number = objShell.Run (REGEDIT26,0,True)
WScript.Sleep 2000
'msgbox "3"
'this allows you to continue another install process without a reboot
REGEDIT27 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SYSTEM\ControlSet001\Control\Session Manager"&chr(34)&" /v PendingFileRenameOperations /f"
Err.Number = objShell.Run (REGEDIT27,0,True)
WScript.Sleep 2000

'this allows you to continue another install process without a reboot
REGEDIT28 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SYSTEM\ControlSet003\Control\Session Manager"&chr(34) & " /v PendingFileRenameOperations /f"
Err.Number = objShell.Run (REGEDIT28,0,True)
WScript.Sleep 2000
'msgbox "4"

'ENABLED'SHUTDOWN PROCESSES
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im Smc.exe",0,true
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im SmcGui.exe",0,true
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im ccSvcHst.exe",0,true
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im Rtvscan.exe",0,true
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im lucoms~1.EXE",0,true
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im SescLU.EXE",0,true
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im mscorsvw.exe",0,true
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im msiexec.exe",0,true

'ENABLED'TURNS ON AUTOMATIC UPDATES
on error resume next
Set objShell = CreateObject("Wscript.Shell")
objShell.Run "%comspec% /c %windir%\SYSTEM32\net.exe start wuauserv",0,False'STARTS THE WINDOWS UPDATE SERVICE
WScript.Sleep 2000
'msgbox "step9 " & ErrorCode9

'ENABLED'HANDLES FINAL ERRORCODE
on error resume next
if ErrorCode3 = 3010 then ErrorCode3 = 0'REBOOT
if ErrorCode3 = 1602 then ErrorCode3 = 0'REPAIR
if ErrorCode3 = "" then ErrorCode3 = 0'EMPTY

'TESTING DIAGNOSTIC
'msgbox "End Time: " & TIME

'QUIT WITH ERROR CODE
WScript.Quit(0)
End Sub


'W I N D O W S 7 ##################################################
Sub SEVEN()
on error resume next

'SET WORKING DIRECTORY AND LAUNCH MESSAGE COMMAND FILE
'WINDOWS XP NORMAL PATH
SDMCachePath = "C:\Progra~2\LANDesk\LDClient\sdmcache\APPS\" & AppPath
If filesys.FolderExists(SDMCachePath) then
on error resume next
objShell.CurrentDirectory = SDMCachePath
End if


'ENABLED'TEMPORARILY TURNS OFF AUTOMATIC UPDATES
on error resume next
Set objShell = CreateObject("WScript.Shell")
objShell.Run "%comspec% /c %windir%\system32\net.exe stop wuauserv",0,True
WScript.Sleep 2000

'UPDATE POLICY - AN UPDATED POLICY THAT WILL NOT HAVE A PASSWORD ASSOCIATED TO THE SYLINK PROFILE
objShell.Run "%comspec% /c %windir%\system32\SC.exe stop " & chr(34) & "Symantec AntiVirus" & chr(34),0,True
objShell.Run "%comspec% /c " & CHR(34)&"C:\Progra~2\Symantec\Symantec Endpoint Protection\Smc.exe" & CHR(34)&" -updateconfig", 0, True
WScript.Sleep 15000

'ENABLED'TURN OFF SYMANTEC RELATED SERVICES SERVICES
TurnOffSMC = "%comspec% /c " & CHR(34)&"C:\Progra~1\Symantec\Symantec Endpoint Protection\Smc.exe" & CHR(34)&" -stop -p PASSWORD"
'msgbox TurnOffSMC
objShell.Run "%comspec% /c %windir%\system32\SC.exe stop " & chr(34) & "Symantec AntiVirus" & chr(34),0,True
Err.Number = objShell.Run (TurnOffSMC,0,True)
WScript.Sleep 5000

'ENABLED'STOP SERVICES
on error resume next
objShell.Run "%comspec% /c %windir%\system32\SC.exe stop " & chr(34) & "Symantec AntiVirus" & chr(34),0,True
WScript.Sleep 5000
objShell.Run "%comspec% /c %windir%\system32\SC.exe stop ccEvtMgr",0,True
WScript.Sleep 3000
objShell.Run "%comspec% /c %windir%\system32\SC.exe stop ccSetMgr",0,True
WScript.Sleep 3000
'WScript.Sleep 2000

'ENABLED'SHUTDOWN PROCESSES
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im Smc.exe",0,true
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im Smc.exe",0,true
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im SmcGui.exe",0,true
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im SmcGui.exe",0,true
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im ccSvcHst.exe",0,true
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im ccSvcHst.exe",0,true
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im Rtvscan.exe",0,true
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im Rtvscan.exe",0,true
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im lucoms~1.EXE",0,true
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im lucoms~1.EXE",0,true
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im SescLU.EXE",0,true
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im SescLU.EXE",0,true
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im mscorsvw.exe",0,true

'ENABLED'STOP SERVICES
objShell.Run "%comspec% /c %windir%\system32\SC.exe stop " & chr(34) & "Symantec AntiVirus" & chr(34),0,True
WScript.Sleep 5000
objShell.Run "%comspec% /c %windir%\system32\SC.exe stop ccEvtMgr",0,True
WScript.Sleep 3000
objShell.Run "%comspec% /c %windir%\system32\SC.exe stop ccSetMgr",0,True
WScript.Sleep 3000


'STEP1 - UNINSTALL SYMANTEC ENDPOINT PROTECTION ###################################################
Remove1 = "%comspec% /c %windir%\system32\msiexec.exe /x"& CHR(34) & "{3C1AE512-3C37-44FA-BA42-ABB721EC5B1D}" & CHR(34) & " /qn /norestart"
Remove1_1 = "%comspec% /c %windir%\system32\msiexec.exe /x"& CHR(34) & "{2EFCC193-D915-4CCB-9201-31773A27BC06}" & CHR(34) & " /qn /norestart"


'msgbox Remove
Err.Number = objShell.Run (Remove1,0,True)
Err.Number = objShell.Run (Remove1_1,0,True)
WScript.Sleep 5000

'ENABLED'STOP SERVICES
objShell.Run "%comspec% /c %windir%\system32\SC.exe stop " & chr(34) & "Symantec AntiVirus" & chr(34),0,True
WScript.Sleep 5000
objShell.Run "%comspec% /c %windir%\system32\SC.exe stop ccEvtMgr",0,True
WScript.Sleep 3000
objShell.Run "%comspec% /c %windir%\system32\SC.exe stop ccSetMgr",0,True
WScript.Sleep 3000


'STEP2 - UNINSTALL LIVE UPDATE #########################################
on error resume next
Remove2 = "%comspec% /c "& CHR(34) & "C:\Progra~2\Symantec\LiveUpdate\LSETUP.EXE" & CHR(34) & " /U /Q"
Err.Number = objShell.Run (Remove2,0,True)
WScript.Sleep 5000

objShell.Run "%comspec% /c %windir%\system32\SC.exe stop " & chr(34) & "Symantec AntiVirus" & chr(34),0,True
WScript.Sleep 5000
objShell.Run "%comspec% /c %windir%\system32\SC.exe stop ccEvtMgr",0,True
WScript.Sleep 3000
objShell.Run "%comspec% /c %windir%\system32\SC.exe stop ccSetMgr",0,True
WScript.Sleep 3000


'STEP3 - CUSTOMIZED REMOVAL ###########################################################

objShell.Run "%comspec% /c copy /v /y Symantec_11.06_Uninstaller.msi %windir%\system32",0,True
objShell.Run "%comspec% /c %windir%\system32\msiexec.exe /x"& CHR(34) & "%windir%\system32\Symantec_11.06_Uninstaller.msi" & CHR(34) & " /qn /norestart",0,True
objShell.Run "%comspec% /c %windir%\system32\msiexec.exe /i"& CHR(34) & "%windir%\system32\Symantec_11.06_Uninstaller.msi" & CHR(34) & " /qn /norestart",0,True
objShell.Run "%comspec% /c %windir%\system32\msiexec.exe /x"& CHR(34) & "{0A2163CB-4F47-44AA-A219-36133260CF17}" & CHR(34) & " /qn /norestart",0,True
objShell.Run "%comspec% /c %windir%\system32\msiexec.exe /x"& CHR(34) & "{8E7332CC-A2E6-4DAD-AAE3-4449563FFD4B}" & CHR(34) & " /qn /norestart",0,True



'ENABLED'PRE-INSTALLATION REGEDIT4
on error resume next
REGEDIT4 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{3C1AE512-3C37-44FA-BA42-ABB721EC5B1D}" & chr(34) & " /f"
Err.Number = objShell.Run (REGEDIT4,0,True)
WScript.Sleep 1000

REGEDIT5 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SYSTEM\ControlSet001\Services\Eventlog\Application\SescLU" & chr(34) & " /f"
Err.Number = objShell.Run (REGEDIT5,0,True)
WScript.Sleep 1000

REGEDIT6 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SOFTWARE\Classes\CLSID\{09FA8089-EE3E-4362-B8C0-1B0F4FD0505D}" & chr(34) & " /f"
Err.Number = objShell.Run (REGEDIT6,0,True)
WScript.Sleep 1000

REGEDIT7 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SOFTWARE\Classes\CLSID\{13BA26BF-ADDB-4033-8012-4768958F4050}" & chr(34) & " /f"
Err.Number = objShell.Run (REGEDIT7,0,True)
WScript.Sleep 1000

REGEDIT8 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SOFTWARE\Classes\CLSID\{173883C3-C6CF-4D17-9889-CDC51DCFF5E1}" & chr(34) & " /f"
Err.Number = objShell.Run (REGEDIT8,0,True)
WScript.Sleep 1000

REGEDIT9 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SOFTWARE\Classes\CLSID\{1CDDD0B9-03AA-4442-9A5B-AC98086513E1}" & chr(34) & " /f"
Err.Number = objShell.Run (REGEDIT9,0,True)
WScript.Sleep 1000

REGEDIT10 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SOFTWARE\Symantec" & chr(34) & " /f"
Err.Number = objShell.Run (REGEDIT10,0,True)
WScript.Sleep 1000

REGEDIT11= "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SOFTWARE\Classes\SyKnAppS.LUCallback" & chr(34) & " /f"
Err.Number = objShell.Run (REGEDIT11,0,True)
WScript.Sleep 1000

REGEDIT12 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SOFTWARE\Classes\SyKnAppS.LUCallback.1" & chr(34) & " /f"
Err.Number = objShell.Run (REGEDIT12,0,True)
WScript.Sleep 1000

REGEDIT13 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SOFTWARE\Classes\Symantec.SSHelper" & chr(34) & " /f"
Err.Number = objShell.Run (REGEDIT13,0,True)
WScript.Sleep 1000

REGEDIT14 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SOFTWARE\Classes\Symantec.SSHelper.1" & chr(34) & " /f"
Err.Number = objShell.Run (REGEDIT14,0,True)
WScript.Sleep 1000

REGEDIT15 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Management\ARPCache\{3C1AE512-3C37-44FA-BA42-ABB721EC5B1D}" & chr(34) & " /f"
Err.Number = objShell.Run (REGEDIT15,0,True)
WScript.Sleep 1000

REGEDIT16 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SOFTWARE\Classes\CLSID\{09FA8089-EE3E-4362-B8C0-1B0F4FD0505D}" & chr(34) & " /f"
'Err.Number = objShell.Run (REGEDIT16,0,True)
WScript.Sleep 1000

REGEDIT17 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SOFTWARE\Classes\CLSID\{09FA8089-EE3E-4362-B8C0-1B0F4FD0505D}" & chr(34) & " /f"
'Err.Number = objShell.Run (REGEDIT17,0,True)
WScript.Sleep 1000

REGEDIT18 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SOFTWARE\Classes\CLSID\{09FA8089-EE3E-4362-B8C0-1B0F4FD0505D}" & chr(34) & " /f"
'Err.Number = objShell.Run (REGEDIT18,0,True)
WScript.Sleep 1000

REGEDIT19 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SOFTWARE\Classes\CLSID\{09FA8089-EE3E-4362-B8C0-1B0F4FD0505D}" & chr(34) & " /f"
'Err.Number = objShell.Run (REGEDIT19,0,True)
WScript.Sleep 1000

REGEDIT20 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SOFTWARE\Classes\CLSID\{09FA8089-EE3E-4362-B8C0-1B0F4FD0505D}" & chr(34) & " /f"
'Err.Number = objShell.Run (REGEDIT20,0,True)
WScript.Sleep 1000

REGEDIT21 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SYSTEM\ControlSet001\Control\VirtualDeviceDrivers" & chr(34) & " /f"
'Err.Number = objShell.Run (REGEDIT21,0,True)
WScript.Sleep 1000
'msgbox "1"
REGEDIT22 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SYSTEM\ControlSet003\Control\VirtualDeviceDrivers" & chr(34) & " /f"
'Err.Number = objShell.Run (REGEDIT22,0,True)
WScript.Sleep 1000

REGEDIT23 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SYSTEM\CurrentControlSet\Control\VirtualDeviceDrivers" & chr(34) & " /f"
'Err.Number = objShell.Run (REGEDIT23,0,True)
WScript.Sleep 1000


REGEDIT24 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{2EFCC193-D915-4CCB-9201-31773A27BC06}" & chr(34) & " /f"
Err.Number = objShell.Run (REGEDIT24,0,True)
WScript.Sleep 1000
'msgbox "2"


'ENABLED'POST-INSTALLATION DELETE FILES
on error resume next
'this deletes symantec install from cache
objShell.Run "%comspec% /c DEL /Q " & chr(34) & "%windir%\Installer\{3C1AE512-3C37-44FA-BA42-ABB721EC5B1D}\*.*" & chr(34),0,True
objShell.Run "%comspec% /c RD /y " & chr(34) & "%windir%\Installer\{3C1AE512-3C37-44FA-BA42-ABB721EC5B1D}" & chr(34),0,False

'this removes shortcuts from start menu
objShell.Run "%comspec% /c DEL /Q " & chr(34) & "C:\Users\Public\Start Menu\Programs\Symantec Endpoint Protection\*.lnk" & chr(34),0,True
objShell.Run "%comspec% /c RD /Y " & chr(34) & "C:\Users\Public\Start Menu\Programs\Symantec Endpoint Protection" & chr(34),0,True

objShell.Run "%comspec% /c DEL /Q " & chr(34) & "C:\Progra~2\Symantec\Symantec Endpoint Protection\*.*" & chr(34),0,True
objShell.Run "%comspec% /c DEL /Q " & chr(34) & "C:\Progra~2\Common Files\Symantec Shared\COH\*.*" & chr(34),0,True
objShell.Run "%comspec% /c DEL /Q " & chr(34) & "C:\Progra~2\Common Files\Symantec Shared\Global Exceptions\*.*" & chr(34),0,True
objShell.Run "%comspec% /c DEL /Q " & chr(34) & "C:\Progra~2\Common Files\Symantec Shared\HWID\*.*" & chr(34),0,True
objShell.Run "%comspec% /c DEL /Q " & chr(34) & "C:\Progra~2\Common Files\Symantec Shared\SPManifests\*.*" & chr(34),0,True
objShell.Run "%comspec% /c DEL /Q " & chr(34) & "C:\Progra~2\Common Files\Symantec Shared\SymcData\*.*" & chr(34),0,True
objShell.Run "%comspec% /c DEL /Q " & chr(34) & "C:\Progra~2\Common Files\Symantec Shared\EENGINE\*.*" & chr(34),0,True
objShell.Run "%comspec% /c DEL /Q " & chr(34) & "C:\Progra~2\Common Files\Symantec Shared\Help\*.*" & chr(34),0,True
objShell.Run "%comspec% /c DEL /Q " & chr(34) & "C:\Progra~2\Common Files\Symantec Shared\SAVSubmissionEngine\*.*" & chr(34),0,True
objShell.Run "%comspec% /c DEL /Q " & chr(34) & "C:\Progra~2\Common Files\Symantec Shared\SRTSP\*.*" & chr(34),0,True
objShell.Run "%comspec% /c DEL /Q " & chr(34) & "C:\Progra~2\Common Files\Symantec Shared\VirusDefs\*.*" & chr(34),0,True
objShell.Run "%comspec% /c DEL /Q " & chr(34) & "C:\ProgramData\Symantec\*.*" & chr(34),0,True
objShell.Run "%comspec% /c DEL /Q " & chr(34) & "C:\ProgramData\Symantec\LiveUpdate\*.*" & chr(34),0,True
objShell.Run "%comspec% /c DEL /Q " & chr(34) & "%temp%\*.tmp" & chr(34),0,True
objShell.Run "%comspec% /c DEL /Q " & chr(34) & "%temp%\*.*" & chr(34),0,True
objShell.Run "%comspec% /c DEL /Q " & chr(34) & "%windir%\temp\*.tmp" & chr(34),0,True
objShell.Run "%comspec% /c DEL /Q " & chr(34) & "%windir%\temp\%temp%\*.*" & chr(34),0,True
'rename C:\Program Files (x86)\Symantec\Symantec Endpoint Protection\SnacNp64.dll to something else

'this allows you to continue another install process without a reboot
REGEDIT25 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired"&chr(34)&" /f"
Err.Number = objShell.Run (REGEDIT25,0,True)
WScript.Sleep 2000

'this allows you to continue another install process without a reboot
REGEDIT26 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SYSTEM\CurrentControlSet\Control\Session Manager"&chr(34)&" /v PendingFileRenameOperations /f"
Err.Number = objShell.Run (REGEDIT26,0,True)
WScript.Sleep 2000
'msgbox "3"
'this allows you to continue another install process without a reboot
REGEDIT27 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SYSTEM\ControlSet001\Control\Session Manager"&chr(34)&" /v PendingFileRenameOperations /f"
Err.Number = objShell.Run (REGEDIT27,0,True)
WScript.Sleep 2000

'this allows you to continue another install process without a reboot
REGEDIT28 = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\SYSTEM\ControlSet003\Control\Session Manager"&chr(34) & " /v PendingFileRenameOperations /f"
Err.Number = objShell.Run (REGEDIT28,0,True)
WScript.Sleep 2000
'msgbox "4"

'ENABLED'SHUTDOWN PROCESSES
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im Smc.exe",0,true
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im SmcGui.exe",0,true
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im ccSvcHst.exe",0,true
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im Rtvscan.exe",0,true
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im lucoms~1.EXE",0,true
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im SescLU.EXE",0,true
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im mscorsvw.exe",0,true
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im msiexec.exe",0,true

'ENABLED'TURNS ON AUTOMATIC UPDATES
on error resume next
Set objShell = CreateObject("Wscript.Shell")
objShell.Run "%comspec% /c %windir%\SYSTEM32\net.exe start wuauserv",0,False'STARTS THE WINDOWS UPDATE SERVICE
WScript.Sleep 2000
'msgbox "step9 " & ErrorCode9

'ENABLED'HANDLES FINAL ERRORCODE
on error resume next
if ErrorCode3 = 3010 then ErrorCode3 = 0'REBOOT
if ErrorCode3 = 1602 then ErrorCode3 = 0'REPAIR
if ErrorCode3 = "" then ErrorCode3 = 0'EMPTY

'TESTING DIAGNOSTIC
'msgbox "End Time: " & TIME

'QUIT WITH ERROR CODE
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

             

bar1
  
   




Δ Thursday, October 28th 2010
bar1
  
      
   
Δ Countdown Installation Timer
 
How to create a countdown timer with built-in pause feature, changes color when paused


 
VBScript/HTA
           

bar1
<script language="vbscript">
on error resume next
Window.ReSizeTo 0,0
Window.moveTo -1500, 0
</script>

<!--
=======================================================
Name: Counter
Author: Eddie Jackson
Contact: MrNetTek2000@yahoo.com
Created on: 10/28/2010
Modified:
Modified by:
Description: This is a basic counter for your scripted apps
It works in seconds and minutes
=======================================================
-->

<html>
<head>
<title>StartCounter</title>

<HTA:APPLICATION
ID="StartCounter"
APPLICATIONNAME="StartCounter"
BORDER="thin"
INNERBORDER="yes"
SCROLL="no"
CAPTION="no"
SHOWINTASKBAR="no"
SINGLEINSTANCE="yes"
SYSMENU="no"
WINDOWSTATE="normal"

>
<style type="text/css">
body { font-family: Arial; font-size: 10pt; background-color:; }
input { font-family: Arial; font-size: 10pt; }
table { font-family: Arial; font-size: 10pt; padding: 50px; }
fieldset { padding: 5px; }
legend { font-family: Arial; font-size: 10pt; font-weight: bold; }
select { font-family: Arial; font-size: 10pt; }
textarea { font-family: Arial; font-size: 8pt; }
.button {font-family: Arial;font-size: 10pt;width: 80px;}
</style>
</head>

<SCRIPT LANGUAGE="VBScript">
On error resume next
Dim timerID

Sub Window_OnLoad
timerID = window.setInterval("RefreshTime", 1000) 'milliseconds
RefreshTime
End Sub

Sub RefreshTime
CurrentTime.InnerHTML = Now
End Sub

Sub OnClickButtonStop()
window.clearInterval(timerID)
End Sub
</SCRIPT>


<SCRIPT Language="VBScript">
On error resume next
TASK_DELAY = 60 ''# Unit of delay. eg 10 of something


Sub Window_OnLoad
On error resume next
document.body.bgColor="lightgreen"
strHTML = strHTML & "<font size=3>Please close all<br>Microsoft Office Applications<b><hr>Installing Office 2010</b><br>in (<span id=CountDownTXT></span>&nbsp;seconds)<br></font><br>"
DataArea.InnerHTML = strHTML
w = 242
h = 150
Return = ResizeWindow(w, h)
Return = CenterWindow(w, h)
End Sub

Function ResizeWindow(w, h)
On error resume next
width = w
height = h
window.resizeTo width, height
End Function

Function CenterWindow(w, h)
On error resume next
x = (screen.width-w)/2
y = (screen.height-h)/2
window.moveTo 1, 1
Call Countdown() ''# Call the countdown function
End Function


Function CountDown() ''# Provides a count down on page in span area
On error resume next
Set oWSH = CreateObject("WScript.Shell")
oWSH.AppActivate "StartCounter" ' make top most app
If TASK_DELAY > 0 Then
CountDownTXT.innerhtml = TASK_DELAY
'setTimeout "CountDown()",60000 ''# Minutes ''# This is the delay factor
setTimeout "CountDown()",1000 ''# Seconds
TASK_DELAY = TASK_DELAY - 1
Else
'Msgbox "Close window " & Document.Title,vbokonly,Document.Title
Self.Close()
End If
End Function


Sub PauseTimer
document.body.bgColor="red"
Msgbox "Press OK to continue installation",48,"paused..."
document.body.bgColor="lightgreen"
window.clearTimeout(idTimer)
End Sub



</SCRIPT>


<script type="text/javascript">
window.onload = FadeFunction
var i = 0
function FadeFunction() {
if (i < 350) {
i=i+3
}
var d = document.body.style
d.filter = "alpha(Opacity="+i+")"
d.opacity = i/350
var num = document.all ? 5 : 350
setTimeout("FadeFunction()",num)
}

</script>

<body>
<Center>
<span id="DataArea"></span>
</center>

<center>
<align="left" valign="top">
<button style="background-color: lightgray; color:black; width=100" onclick="PauseTimer"><font size="2"><b>[pause]</b></button>
</align>
</center>
</body>
</html>  
bar1

             

bar1
  
   





Δ Wednesday, October 27th 2010
bar1
  
      
   
Δ Alert Notification v1
 
How to create an alert notification scrolling text to interact with your end-user, report results
 


bar1
Features:                    
Alerts end-user with popup message
Waits for message to end
Allows end-user to acknowledge receipt of message
Asks a survey question
Waits random amount of time
Writes answer and other tracking info to remote log
bar1

  

VBScript/HTA
           

bar1
<script language="vbscript">
'This loads hta offscreen, stops the HTA flicker
Window.ReSizeTo 0,0
Window.moveTo -500, 0
</script>

<HTML>
<HEAD>
<TITLE>News Alert</title>
<HTA:APPLICATION
ApplicationName="Alert"
ID = "Alert"
Border="none"
Innerborder="no"
SingleInstance="true"
WindowsState="Normal"
Scroll="No"
Navigable="no"
MaximizeButton="No"
SysMenu="no"
showintaskbar="false"
ContextMenu="no"
Caption="no"

></HEAD>


<script language="vbscript">
On error resume next
dim x, y, w, h

Sub Window_OnLoad
On error resume next
w = 1440
h = 47
Return = ResizeWindow(w, h)
Return = ResizeWindow(w, h)
Return = CenterWindow(w, h)
Return = CenterWindow(w, h)
End Sub


Function ResizeWindow(w, h)
On Error Resume Next
width = w
height = h
window.resizeTo width, height
End Function

Function CenterWindow(w, h)
On Error Resume Next
x = (screen.width-w)/2
y = (screen.height-h)/2
window.moveTo x, -15
End Function


Sub ScriptNO
On Error Resume Next
Set objShell = CreateObject("Wscript.Shell")
Set objNetwork = CreateObject("WScript.Network")
objComputerName = objNetwork.ComputerName

Dim fso, tempfile, tfolder, tname, tfile, objFSO, objLogFile, objNetwork, LogEntry
Const ForWriting = 2
Const TemporaryFolder = 2

'THIS CREATES THE OBJECTS FOR TEMP FOLDER
Set fso = CreateObject("Scripting.FileSystemObject")
Set tfolder = fso.GetSpecialFolder(TemporaryFolder)
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile(tfolder&"\answer.cmd")
'THIS CLEARS THE FILE CONTENTS
objFile.Write ""
'THIS CLOSES FILE
objFile.Close

'THIS SETS THE LOGFILE FOR WRITING
Set objLogFile = objFSO.OpenTextFile(tfolder&"\answer.cmd", ForWriting, False)


'THIS SETS THE TIMESTAMP TO A VARIABLE TO BE WRITTEN TO THE HIDDEN QUEUE
LogEntry = Date() & "," & Time() & "," & objNetwork.UserName & "," & objComputerName & "," & "NO"
'THIS CREATES THE CONTENTS OF THE HIDDEN QUEUE COMMAND FILE
objLogFile.WriteLine "set ran=%random:~-2%"
objLogFile.WriteLine "if "& chr(34) & "%ran:~1%"& chr(34) &"==" & chr(34) & chr(34)& " set ran=0%ran%"
objLogFile.WriteLine "set /a ran=1%ran%-99"
objLogFile.WriteLine "ping -n %ran% 127.0.0.1"
objLogFile.WriteLine "echo "&LogEntry&">>\\12650-ejackson\WinINSTALL\log\tickerlog.txt"
'THIS CLOSES FILE
objLogFile.Close

'THIS LAUNCHES THE HIDDEN QUEUE WITH RANDOMIZED COUNTDOWN TIMER, 1-100 SECONDS
Set objShell = CreateObject("WScript.Shell")
AnswerFilePath = tfolder&"\answer.cmd"
objShell.Run AnswerFilePath,0, False
objShell.Run "cmd /c taskkill.exe /f /im mshta.exe",0,False
End Sub

Sub ScriptYES
on error resume next
Set objShell = CreateObject("Wscript.Shell")
Set objNetwork = CreateObject("WScript.Network")
objComputerName = objNetwork.ComputerName

Dim fso, tempfile, tfolder, tname, tfile, objFSO, objLogFile, objNetwork, LogEntry
Const ForWriting = 2
Const TemporaryFolder = 2

'THIS CREATES THE OBJECTS FOR TEMP FOLDER
Set fso = CreateObject("Scripting.FileSystemObject")
Set tfolder = fso.GetSpecialFolder(TemporaryFolder)
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile(tfolder&"\answer.cmd")
'THIS CLEARS THE FILE CONTENTS
objFile.Write ""
objFile.Close

'THIS SETS THE LOGFILE
Set objLogFile = objFSO.OpenTextFile(tfolder&"\answer.cmd", ForWriting, False)

'THIS SETS THE TIMESTAMP TO A VARIABLE TO BE WRITTEN TO THE HIDDEN QUEUE
LogEntry = Date() & "," & Time() & "," & objNetwork.UserName & "," & objComputerName & "," & "YES"
'THIS CREATES THE CONTENTS OF THE HIDDEN QUEUE COMMAND FILE
objLogFile.WriteLine "set ran=%random:~-2%"
objLogFile.WriteLine "if "& chr(34) & "%ran:~1%"& chr(34) &"==" & chr(34) & chr(34)& " set ran=0%ran%"
objLogFile.WriteLine "set /a ran=1%ran%-99"
objLogFile.WriteLine "ping -n %ran% 127.0.0.1"
objLogFile.WriteLine "echo "&LogEntry&">>\\12650-ejackson\WinINSTALL\log\tickerlog.txt"
'This closes the input
objLogFile.Close

'THIS LAUNCHES THE HIDDEN QUEUE WITH RANDOMIZED COUNTDOWN TIMER, 1-100 SECONDS
Set objShell = CreateObject("WScript.Shell")
AnswerFilePath = tfolder&"\answer.cmd"
objShell.Run AnswerFilePath,0, False
objShell.Run "cmd /c taskkill /f /im mshta.exe",0,false
End Sub

sub change
on error resume next
Window.ReSizeTo 0,0
Window.moveTo -1440, -90
Window.ReSizeTo 1440,90
window.moveTo x, -46
end sub


sub returnfalse
on error resume next
Set objShell = CreateObject("Wscript.Shell")
objShell.Run "cmd /c ping -n 1 127.0.0.1",0,True
end sub


</SCRIPT>

<body bgcolor="#000000" ondragstart="returnfalse" onselectstart="returnfalse">
<p style="font-family:verdana,arial,sans-serif;font-size:12px;">
<center>
<align="center">
<table border="0">
<tr>

<td><style type="text/css">
.html-marquee {
height:20px;width:
1440px;background-color:000000;
font-family:Cursive;font-size:15pt;
color:yellow;border-width:0;
}
</style>

<marquee class="html-marquee" direction="left" behavior="scroll" scrollamount="5">
There are currently multiple variations of email phishing scams requesting your password. The Kaplan Help Desk, will not at any time ask that you send your password via email.

&nbsp;&nbsp;
<button style="background-color: #000000; border: 0; color: white; height: 20" onclick="change">{click here to acknowledge and view survey question}</button></marquee>
</td>
<td>&nbsp;&nbsp;&nbsp;</td>
</tr>
</table>


<center>
<table>
<td><align="center"><font size="4"; color="#33ff33">&nbsp;&nbsp;&nbsp;Has anyone ever asked for your password?&nbsp;&nbsp;</font></td>
<td><align="left"><input id=runbutton class="button" type="button" value="Yes" name="Yes" onClick="ScriptNO"></td>
<td><align="left"><input id=runbutton class="button" type="button" value="No" name="No" onClick="ScriptNO"></td>

</table>
</CENTER>
</BODY>
</HTML>  
bar1

             

bar1
  
   





Δ Tuesday, October 26th 2010
bar1
  
      
   
Δ Office 2010 Deployment
 
How to deploy office 2010 to your workstations
 
VBScript: Install

           

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
':: E L I T E  S O L U T I O N S
':: SCRIPT LANGUAGE: VBScript
':: SCRIPT NAME: Office2010Desktop.vbs
':: PURPOSE: To be used to install Office 2010
':: CREATION DATE: 11/02/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 BetaTestPath, SDMCache, AppPath, wshShell, SetupFilesPath, SetupPath, VaultInstallPath, Update1, Update2, Update3, Update4

AppPath = "Microsoft\Office2010Desktop"

Set filesys = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Wscript.Shell")
Set wshShell = WScript.CreateObject("WScript.Shell")

'TESTING DIAGNOSTIC
'msgbox "Begin Time: " & TIME
 
'PRE-SETUP
'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 Setup.exe",0,True
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im msiexec.exe",0,True
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im mshta.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
'KILLS CURRENTLY RUNNING MSIEXEC.EXE
objShell.Run "%comspec% /c %windir%\SYSTEM32\TASKKILL.EXE /F /IM msiexec.exe",0,True

'KILLS CURRENTLY RUNNING setup.exe
objShell.Run "%comspec% /c %windir%\SYSTEM32\TASKKILL.EXE /F /IM setup.exe",0,True

'KILLS CURRENTLY RUNNING word
objShell.Run "%comspec% /c %windir%\SYSTEM32\TASKKILL.EXE /F /IM winword.exe",0,True

'KILLS CURRENTLY RUNNING access
objShell.Run "%comspec% /c %windir%\SYSTEM32\TASKKILL.EXE /F /IM msaccess.exe",0,True

'KILLS CURRENTLY RUNNING excel
objShell.Run "%comspec% /c %windir%\SYSTEM32\TASKKILL.EXE /F /IM excel.exe",0,True

'KILLS CURRENTLY RUNNING infopath
objShell.Run "%comspec% /c %windir%\SYSTEM32\TASKKILL.EXE /F /IM infopath.exe",0,True

'KILLS CURRENTLY RUNNING onenote
objShell.Run "%comspec% /c %windir%\SYSTEM32\TASKKILL.EXE /F /IM onenote.exe",0,True

'KILLS CURRENTLY RUNNING outlook
objShell.Run "%comspec% /c %windir%\SYSTEM32\TASKKILL.EXE /F /IM outlook.exe",0,True

'KILLS CURRENTLY RUNNING powerpoint
objShell.Run "%comspec% /c %windir%\SYSTEM32\TASKKILL.EXE /F /IM powerpnt.exe",0,True

'KILLS CURRENTLY RUNNING powerpoint
objShell.Run "%comspec% /c %windir%\SYSTEM32\TASKKILL.EXE /F /IM communicator.exe",0,True

'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
'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 7 Enterprise" then Seven()

'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

'EXTRACT SPLASH SCREEN FILES
If filesys.FileExists("C:\Progra~1\LANDesk\LDClient\sdmcache\APPS\Microsoft\Office2010Desktop\splash.exe") THEN
objShell.Run "C:\Progra~1\LANDesk\LDClient\sdmcache\APPS\Microsoft\Office2010Desktop\splash.exe",9,True
end if

If NOT filesys.FileExists("C:\Progra~1\LANDesk\LDClient\sdmcache\APPS\Microsoft\Office2010Desktop\splash.exe") THEN
objShell.Run "splash.exe",9,True
end if

'LAUNCH CORRECT SPLASH SCREEN
LANDeskLogo = "C:\Progra~1\LANDesk\LDClient\sdmcache\APPS\Microsoft\Office2010Desktop\LANDesk.hta"
If filesys.FileExists(LANDeskLogo) THEN
'msgbox "LANDesk Logo does exist in LANDesk path"
Err.Number = objShell.Run (LANDeskLogo,9,False)
WScript.Sleep 2000
ErrorCode0 = Err.Number
end if

'secondary logic - to be used for normal installations
If NOT filesys.FileExists(LANDeskLogo) THEN
'msgbox "LANDesk Logo does not exist in LANDesk path"
Err.Number = objShell.Run ("Kaplan.HTA",9,False)
WScript.Sleep 2000
ErrorCode0 = Err.Number
'msgbox "step0 " & ErrorCode0
'WScript.Quit(0)
end if

'SET WORKING DIRECTORY AND LAUNCH MESSAGE COMMAND FILE
'WINDOWS XP NORMAL PATH
SDMCachePath = "C:\Progra~1\LANDesk\LDClient\sdmcache\APPS\" & AppPath
If filesys.FolderExists(SDMCachePath) then
'on error resume next
objShell.CurrentDirectory = SDMCachePath
End if

'DISABLE: RETURN CURRENT USER
'''sUser = ConsoleUser(".")
'''strUser = Trim(sUser)
'MsgBox sUser

'ENABLED'TEMPORARILY TURNS OFF AUTOMATIC UPDATES
'on error resume next
Set objShell = CreateObject("WScript.Shell")
objShell.Run "%comspec% /c %windir%\system32\net.exe stop wuauserv",0,True
WScript.Sleep 2000

'DISABLED'PRE-INSTALLATION MAKE DIRECTORY
'''objShell.Run "cmd /c md " & chr(34) & "%ProgramFiles%\YourProgram" & chr(34),0,True

'DISABLED'PRE-INSTALLATION SET FOLDER PERMISSIONS
'''objShell.Run "c:\windows\system32\cacls.exe" & " " & chr(34) & "%ProgramFiles%\YourProgram" & chr(34) & " " & "/e /g everyone:f",0,True

'ENABLED'PRE-INSTALLATION EXTRACTS FILES REQUIRED SETUP FILES TO SDMCACHE
'on error resume next
Set objShell = CreateObject("WScript.Shell")

'primary logic - to be used for LANDesk installations
SetupFilesPath = "C:\Progra~1\LANDesk\LDClient\sdmcache\APPS\Microsoft\Office2010Desktop\SetupFiles.exe"

If filesys.FileExists(SetupFilesPath) THEN
'msgbox "SetupFiles.exe does exist in LANDesk path"
Err.Number = objShell.Run (SetupFilesPath,0,True)
WScript.Sleep 2000
ErrorCode0 = Err.Number
end if

'secondary logic - to be used for normal installations
If NOT filesys.FileExists(SetupFilesPath) THEN
'msgbox "SetupFiles.exe does not exist in landesk path"
Err.Number = objShell.Run ("SetupFiles.exe",9,True)
WScript.Sleep 2000
ErrorCode0 = Err.Number
'msgbox "step0 " & ErrorCode0
'WScript.Quit(0)
end if

'DISABLED'PRE-INSTALLATION DELETE
'on error resume next
'''DELICON = "%comspec% /c del /q " & chr(34)&"%ALLUSERSPROFILE%\Desktop\Qfiniti Agent Assist*"&chr(34)
'''Err.Number = objShell.Run (DELICON,0,False)
'''WScript.Sleep 2000
'''ErrorCode1 = Err.Number
'msgbox "step1 " & ErrorCode1
'WScript.Quit(0)

'DISABLED'PRE-INSTALLATION REGEDIT
'on error resume next
'''REGEDIT = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\Software\Microsoft\Windows\CurrentVersion\Run"&chr(34)&" /v "&chr(34)&"Qfiniti AME"&CHR(34)&" /f"
'''Err.Number = objShell.Run (REGEDIT,0,False)
'''WScript.Sleep 2000
'''ErrorCode2 = Err.Number
'msgbox "step2 " & ErrorCode2
'WScript.Quit(0)

'DISABLED'PRE-INSTALLATION COPY FILE - this file is used for the uninstall process
'on error resume next
'''CopyCommand = "%comspec% /c COPY /Y " & chr(34) & "%ProgramFiles%\landesk\LDClient\sdmcache\APPS\Microsoft\Visio2007Pro\UnInstallVisioConfig.XML"&chr(34) &" "& chr(34)&"%ProgramFiles%\Microsoft Office\Office12"&chr(34)
'msgbox CopyCommand
'''objShell.Run CopyCommand,0,True

'DISABLED'Remove APPLICATION
''''on error resume next
'''Remove = "%comspec% /c %windir%\SYSTEM32\wscript.exe " & chr(34)& objShell.CurrentDirectory & "\BgInfoUnInstall.vbs" & CHR(34) & ""
'msgbox Remove
'''Err.Number = objShell.Run (Remove,0,True)
'''WScript.Sleep 3000
'''ErrorCode3 = Err.Number
'msgbox "step3 " & ErrorCode3
'WScript.Quit(0)

'ENABLED'INSTALLS APPLICATION WITH SILENT SWITCHES
'on error resume next

'primary logic - used for LANDesk installation
SetupPath = "C:\Progra~1\LANDesk\LDClient\sdmcache\APPS\Microsoft\Office2010Desktop\Setup.exe"
If filesys.FileExists(SetupPath) THEN
Set objShell = CreateObject("WScript.Shell")
'msgbox "Setup.exe does exist in LANDesk path"
Install = "%comspec% /c " & SetupPath
Err.Number = objShell.Run (Install,0,True)
WScript.Sleep 3000
ErrorCode4 = Err.Number
'msgbox "step4 " & ErrorCode4
'WScript.Quit(0)
end if

'secondary logic - used for normal installation
If NOT filesys.FileExists(SetupPath) THEN
Set objShell = CreateObject("WScript.Shell")
'msgbox "Setup.exe does not exist in landesk path"
Install = "SETUP.EXE"
Err.Number = objShell.Run (Install,9,True)
WScript.Sleep 3000
ErrorCode4 = Err.Number
end if


'ENABLED'UPDATES APPLICATION - UPDATES THE SYMANTEC VAULT APPLICATION
'on error resume next

VaultFolderPath = "C:\Progra~1\Enterp~1\EVClient"
VaultInstallPath = "C:\Progra~1\LANDesk\LDClient\sdmcache\APPS\Microsoft\Office2010Desktop\
SymantecEnterpriseVault9.0.1.msi"
VaultInstallNewPath = "%windir%\system32\SymantecEnterpriseVault9.0.1.msi"

if filesys.FolderExists(VaultFolderPath) THEN

VaultFolderPath = "C:\Progra~1\Enterp~1\EVClient"
VaultInstallPath = "C:\Progra~1\LANDesk\LDClient\sdmcache\APPS\Microsoft\Office2010Desktop\
SymantecEnterpriseVault9.0.1.msi"
VaultInstallNewPath = "%windir%\system32\SymantecEnterpriseVault9.0.1.msi"

'on error resume next
Set objShell = CreateObject("Wscript.Shell")
Update1 = "%comspec% /c %windir%\system32\msiexec.exe /x "& CHR(34) & "{980746E3-7AA4-4982-8336-BEE639E5F3F7}" & CHR(34) & " /qn /norestart"
Update2 = "%comspec% /c %windir%\system32\msiexec.exe /x "& CHR(34) & "{980746E3-7AA4-4982-8336-BEE639E5F3F7}" & CHR(34) & " /qn /norestart"

Err.Number = objShell.Run (Update1,0,True)
ErrorCode2_1 = Err.Number
WScript.Sleep 2000
Err.Number = objShell.Run (Update2,0,True)
ErrorCode2_2 = Err.Number
WScript.Sleep 2000

'primary logic - used for LANDesk installations
If filesys.FileExists(VaultInstallPath) then
Set objShell = CreateObject("WScript.Shell")
'msgbox "Vault does exist in LANDesk path"
Update3 = "%comspec% /c %windir%\system32\msiexec.exe /x"& VaultInstallPath & " /qn /norestart"
Update4 = "%comspec% /c %windir%\system32\msiexec.exe /i"& chr(34) & VaultInstallPath & chr(34) & " /qn /norestart"
Err.Number = objShell.Run (Update3,0,True)
ErrorCode2_3 = Err.Number
WScript.Sleep 2000
Err.Number = objShell.Run (Update4,0,True)
ErrorCode2_4 = Err.Number
WScript.Sleep 2000
end if

'secondary logic - used for normal installations
If NOT filesys.FileExists(VaultInstallPath) then
Set objShell = CreateObject("WScript.Shell")
'msgbox "Vault does not exist in LANDesk path"
CopyCon = "%comspec% /c copy /y /v *.msi %windir%\system32"
objShell.Run CopyCon,0,True
Update3 = "%comspec% /c %windir%\system32\msiexec.exe /x" & chr(34) & "%windir%\system32\SymantecEnterpriseVault9.0.1.msi" & chr(34) & " /qn /norestart"
Update4 = "%comspec% /c %windir%\system32\msiexec.exe /i" & chr(34) & "%windir%\system32\SymantecEnterpriseVault9.0.1.msi" & chr(34) & " /qn /norestart"
objShell.Run Update3,0,True
WScript.Sleep 2000
objShell.Run Update4,0,True
WScript.Sleep 2000
end if

end if

'DISABLED'UPDATES APPLICATION
'on error resume next
'''Update = "%comspec% /c %windir%\system32\msiexec.exe /p "& CHR(34) & "%ProgramFiles%\landesk\LDClient\sdmcache\APPS\Etalk3.5\QfinitiInstallation3.5\Q35C1005.msp" & CHR(34) & " /qn /norestart"
'msgbox Update
'''Err.Number = objShell.Run (Update,0,True)
'''WScript.Sleep 2000
'''ErrorCode5 = Err.Number
'msgbox "step5 " & ErrorCode5
'WScript.Quit(0)

'DISABLED'POST-INSTALLATION EXTRACTS FILES TO %PROGRAMFILES%
'on error resume next
'''Err.Number = objShell.Run (chr(34)&"%ProgramFiles%\landesk\LDClient\sdmcache\APPS\Etalk3.5\QfinitiInstallation3.5\extract.exe"&chr(34),9,True)
'''WScript.Sleep 2000
'''ErrorCode6 = Err.Number
'''Err.Number = ""
'msgbox "step6 " & ErrorCode6
'WScript.Quit(0)

'DISABLED'POST-INSTALLATION DELETE DESKTOP ICON FROM ALL USERS
'on error resume next
'''DELICON = "%comspec% /c del /q " & chr(34)&"%ALLUSERSPROFILE%\Desktop\DesktopIconName*"&chr(34)
'''Err.Number = objShell.Run (DELICON,0,False)
'''WScript.Sleep 2000
'''ErrorCode7 = Err.Number
'msgbox "step7 " & ErrorCode7
'WScript.Quit(0)

'DISABLED'POST-INSTALLATION MAKE DIRECTORY
'on error resume next
'''objShell.Run "%comspec% /c md " & chr(34) & "%ProgramFiles%\YourProgram" & chr(34),0,True

'ENABLED'POST-INSTALLATION REGEDIT - DISABLE PSTs
'on error resume next
REGEDIT = "%comspec% /c %windir%\system32\REG.exe ADD "& chr(34)&"HKLM\Software\Microsoft\Office\14.0\Outlook"&chr(34)&" /v "&chr(34)&"DisablePST"&CHR(34)&" /d 1 /t REG_DWORD /f"
'command: REG.exe ADD "HKLM\Software\Microsoft\Office\14.0\Outlook" /v "DisablePST" /d 0 /t REG_DWORD /f
Err.Number = objShell.Run (REGEDIT,0,False)
WScript.Sleep 2000
ErrorCode8 = Err.Number
'msgbox "step8 " & ErrorCode8
'WScript.Quit(0)

'DISABLED'POST-INSTALLATION MONITOR A PROCESS FOR COMPLETION
'''cmd = 1
'''do while cmd = 1
'''Dim cmd
'''Set objWMIService = GetObject("winmgmts:" _
''' & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
'''Set colProcesses = objWMIService.ExecQuery ("Select * from Win32_Process Where Name = 'cmd.exe'")
'''If colProcesses.Count = 0 Then
'Wscript.Echo "cmd.exe is not running."
''' cmd = 0
''' WScript.Sleep 1000
'''Else
'Wscript.Echo "cmd.exe is running."
''' cmd = 1
''' WScript.Sleep 1000
'''End If
'''loop

'ENABLED'TURNS ON AUTOMATIC UPDATES
'on error resume next
Set objShell = CreateObject("Wscript.Shell")
objShell.Run "%comspec% /c %windir%\SYSTEM32\net.exe start wuauserv",0,False'STARTS THE WINDOWS UPDATE SERVICE
WScript.Sleep 2000
'msgbox "step9 " & ErrorCode9

'ENABLED'POST-INSTALLATION TASKKILLS
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im mshta.exe",0,True'KILLS SPLASH SCREEN and LANDesk Logo Screen
'''objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im cmd.exe",0,True'KILLS ANY CMD.EXE

'DISABLED'POST-INSTALLATION DELETE FILES
'''objShell.Run "%comspec% /c del /q msg.txt",0,True'DELETES MSG TEXT FILE

'ENABLED'HANDLES FINAL ERRORCODE
'on error resume next
if ErrorCode4 = 3010 then ErrorCode4 = 0'REBOOT
if ErrorCode4 = 1602 then ErrorCode4 = 0'REPAIR
if ErrorCode4 = "" then ErrorCode4 = 0'EMPTY


'TESTING DIAGNOSTIC
'msgbox "End Time: " & TIME

'QUIT WITH ERROR CODE
WScript.Quit(ErrorCode4)
End Sub



'W I N D O W S 7
Sub SEVEN()
'on error resume next
'SET WORKING DIRECTORY AND LAUNCH MESSAGE COMMAND FILE

'EXTRACT SPLASH SCREEN FILES
If filesys.FileExists("C:\Progra~2\LANDesk\LDClient\sdmcache\APPS\Microsoft\Office2010Desktop\splash.exe") THEN
objShell.Run "C:\Progra~2\LANDesk\LDClient\sdmcache\APPS\Microsoft\Office2010Desktop\splash.exe",9,True
end if

If NOT filesys.FileExists("C:\Progra~2\LANDesk\LDClient\sdmcache\APPS\Microsoft\Office2010Desktop\splash.exe") THEN
objShell.Run "splash.exe",9,True
end if

'LAUNCH CORRECT SPLASH SCREEN
LANDeskLogo = "C:\Progra~2\LANDesk\LDClient\sdmcache\APPS\Microsoft\Office2010Desktop\LANDesk.hta"
If filesys.FileExists(LANDeskLogo) THEN
'msgbox "LANDesk Logo does exist in LANDesk path"
Err.Number = objShell.Run (LANDeskLogo,9,False)
WScript.Sleep 2000
ErrorCode0 = Err.Number
end if

'secondary logic - to be used for normal installations
If NOT filesys.FileExists(LANDeskLogo) THEN
'msgbox "LANDesk Logo does not exist in LANDesk path"
Err.Number = objShell.Run ("Kaplan.HTA",9,False)
WScript.Sleep 2000
ErrorCode0 = Err.Number
'msgbox "step0 " & ErrorCode0
'WScript.Quit(0)
end if

'WINDOWS XP NORMAL PATH
SDMCachePath = "C:\Progra~2\LANDesk\LDClient\sdmcache\APPS\" & AppPath
If filesys.FolderExists(SDMCachePath) then
'on error resume next
objShell.CurrentDirectory = SDMCachePath
End if

'DISABLE: RETURN CURRENT USER
'''sUser = ConsoleUser(".")
'''strUser = Trim(sUser)
'MsgBox sUser

'ENABLED'TEMPORARILY TURNS OFF AUTOMATIC UPDATES
'on error resume next
Set objShell = CreateObject("WScript.Shell")
objShell.Run "%comspec% /c %windir%\system32\net.exe stop wuauserv",0,True
WScript.Sleep 2000

'DISABLED'PRE-INSTALLATION MAKE DIRECTORY
'''objShell.Run "cmd /c md " & chr(34) & "%ProgramFiles%\YourProgram" & chr(34),0,True

'DISABLED'PRE-INSTALLATION SET FOLDER PERMISSIONS
'''objShell.Run "c:\windows\system32\cacls.exe" & " " & chr(34) & "%ProgramFiles%\YourProgram" & chr(34) & " " & "/e /g everyone:f",0,True

'ENABLED'PRE-INSTALLATION EXTRACTS FILES REQUIRED SETUP FILES TO SDMCACHE
'on error resume next
Set objShell = CreateObject("WScript.Shell")

'primary logic - to be used for LANDesk installations
SetupFilesPath = "C:\Progra~2\LANDesk\LDClient\sdmcache\APPS\Microsoft\Office2010Desktop\SetupFiles.exe"

If filesys.FileExists(SetupFilesPath) THEN
'msgbox "SetupFiles.exe does exist in LANDesk path"
Err.Number = objShell.Run (SetupFilesPath,0,True)
WScript.Sleep 2000
ErrorCode0 = Err.Number
end if

'secondary logic - to be used for normal installations
If NOT filesys.FileExists(SetupFilesPath) THEN
'msgbox "SetupFiles.exe does not exist in landesk path"
Err.Number = objShell.Run ("SetupFiles.exe",9,True)
WScript.Sleep 2000
ErrorCode0 = Err.Number
'msgbox "step0 " & ErrorCode0
'WScript.Quit(0)
end if

'DISABLED'PRE-INSTALLATION DELETE
'on error resume next
'''DELICON = "%comspec% /c del /q " & chr(34)&"%ALLUSERSPROFILE%\Desktop\Qfiniti Agent Assist*"&chr(34)
'''Err.Number = objShell.Run (DELICON,0,False)
'''WScript.Sleep 2000
'''ErrorCode1 = Err.Number
'msgbox "step1 " & ErrorCode1
'WScript.Quit(0)

'DISABLED'PRE-INSTALLATION REGEDIT
'on error resume next
'''REGEDIT = "%comspec% /c %windir%\system32\REG.exe DELETE "& chr(34)&"HKLM\Software\Microsoft\Windows\CurrentVersion\Run"&chr(34)&" /v "&chr(34)&"Qfiniti AME"&CHR(34)&" /f"
'''Err.Number = objShell.Run (REGEDIT,0,False)
'''WScript.Sleep 2000
'''ErrorCode2 = Err.Number
'msgbox "step2 " & ErrorCode2
'WScript.Quit(0)

'DISABLED'PRE-INSTALLATION COPY FILE - this file is used for the uninstall process
'on error resume next
'''CopyCommand = "%comspec% /c COPY /Y " & chr(34) & "%ProgramFiles%\landesk\LDClient\sdmcache\APPS\Microsoft\Visio2007Pro\UnInstallVisioConfig.XML"&chr(34) &" "& chr(34)&"%ProgramFiles%\Microsoft Office\Office12"&chr(34)
'msgbox CopyCommand
'''objShell.Run CopyCommand,0,True

'DISABLED'Remove APPLICATION
''''on error resume next
'''Remove = "%comspec% /c %windir%\SYSTEM32\wscript.exe " & chr(34)& objShell.CurrentDirectory & "\BgInfoUnInstall.vbs" & CHR(34) & ""
'msgbox Remove
'''Err.Number = objShell.Run (Remove,0,True)
'''WScript.Sleep 3000
'''ErrorCode3 = Err.Number
'msgbox "step3 " & ErrorCode3
'WScript.Quit(0)

'ENABLED'INSTALLS APPLICATION WITH SILENT SWITCHES
'on error resume next

'primary logic - used for LANDesk installation
SetupPath = "C:\Progra~2\LANDesk\LDClient\sdmcache\APPS\Microsoft\Office2010Desktop\Setup.exe"
If filesys.FileExists(SetupPath) THEN
Set objShell = CreateObject("WScript.Shell")
'msgbox "Setup.exe does exist in LANDesk path"
Install = "%comspec% /c " & SetupPath
Err.Number = objShell.Run (Install,0,True)
WScript.Sleep 3000
ErrorCode4 = Err.Number
'msgbox "step4 " & ErrorCode4
'WScript.Quit(0)
end if

'secondary logic - used for normal installation
If NOT filesys.FileExists(SetupPath) THEN
Set objShell = CreateObject("WScript.Shell")
'msgbox "Setup.exe does not exist in landesk path"
Install = "SETUP.EXE"
Err.Number = objShell.Run (Install,9,True)
WScript.Sleep 3000
ErrorCode4 = Err.Number
end if


'ENABLED'UPDATES APPLICATION - UPDATES THE SYMANTEC VAULT APPLICATION
'on error resume next

VaultFolderPath = "C:\Progra~2\Enterp~1\EVClient"
VaultInstallPath = "C:\Progra~2\LANDesk\LDClient\sdmcache\APPS\Microsoft\Office2010Desktop\
SymantecEnterpriseVault9.0.1.msi"
VaultInstallNewPath = "%windir%\system32\SymantecEnterpriseVault9.0.1.msi"

if filesys.FolderExists(VaultFolderPath) THEN

VaultFolderPath = "C:\Progra~2\Enterp~1\EVClient"
VaultInstallPath = "C:\Progra~2\LANDesk\LDClient\sdmcache\APPS\Microsoft\Office2010Desktop\
SymantecEnterpriseVault9.0.1.msi"
VaultInstallNewPath = "%windir%\system32\SymantecEnterpriseVault9.0.1.msi"

'on error resume next
Set objShell = CreateObject("Wscript.Shell")
Update1 = "%comspec% /c %windir%\system32\msiexec.exe /x "& CHR(34) & "{980746E3-7AA4-4982-8336-BEE639E5F3F7}" & CHR(34) & " /qn /norestart"
Update2 = "%comspec% /c %windir%\system32\msiexec.exe /x "& CHR(34) & "{980746E3-7AA4-4982-8336-BEE639E5F3F7}" & CHR(34) & " /qn /norestart"

Err.Number = objShell.Run (Update1,0,True)
ErrorCode2_1 = Err.Number
WScript.Sleep 2000
Err.Number = objShell.Run (Update2,0,True)
ErrorCode2_2 = Err.Number
WScript.Sleep 2000

'primary logic - used for LANDesk installations
If filesys.FileExists(VaultInstallPath) then
Set objShell = CreateObject("WScript.Shell")
'msgbox "Vault does exist in LANDesk path"
Update3 = "%comspec% /c %windir%\system32\msiexec.exe /x"& VaultInstallPath & " /qn /norestart"
Update4 = "%comspec% /c %windir%\system32\msiexec.exe /i"& chr(34) & VaultInstallPath & chr(34) & " /qn /norestart"
Err.Number = objShell.Run (Update3,0,True)
ErrorCode2_3 = Err.Number
WScript.Sleep 2000
Err.Number = objShell.Run (Update4,0,True)
ErrorCode2_4 = Err.Number
WScript.Sleep 2000
end if

'secondary logic - used for normal installations
If NOT filesys.FileExists(VaultInstallPath) then
Set objShell = CreateObject("WScript.Shell")
'msgbox "Vault does not exist in LANDesk path"
CopyCon = "%comspec% /c copy /y /v *.msi %windir%\system32"
objShell.Run CopyCon,0,True
Update3 = "%comspec% /c %windir%\system32\msiexec.exe /x" & chr(34) & "%windir%\system32\SymantecEnterpriseVault9.0.1.msi" & chr(34) & " /qn /norestart"
Update4 = "%comspec% /c %windir%\system32\msiexec.exe /i" & chr(34) & "%windir%\system32\SymantecEnterpriseVault9.0.1.msi" & chr(34) & " /qn /norestart"
objShell.Run Update3,0,True
WScript.Sleep 2000
objShell.Run Update4,0,True
WScript.Sleep 2000
end if

end if

'DISABLED'UPDATES APPLICATION
'on error resume next
'''Update = "%comspec% /c %windir%\system32\msiexec.exe /p "& CHR(34) & "%ProgramFiles%\landesk\LDClient\sdmcache\APPS\Etalk3.5\QfinitiInstallation3.5\Q35C1005.msp" & CHR(34) & " /qn /norestart"
'msgbox Update
'''Err.Number = objShell.Run (Update,0,True)
'''WScript.Sleep 2000
'''ErrorCode5 = Err.Number
'msgbox "step5 " & ErrorCode5
'WScript.Quit(0)

'DISABLED'POST-INSTALLATION EXTRACTS FILES TO %PROGRAMFILES%
'on error resume next
'''Err.Number = objShell.Run (chr(34)&"%ProgramFiles%\landesk\LDClient\sdmcache\APPS\Etalk3.5\QfinitiInstallation3.5\extract.exe"&chr(34),9,True)
'''WScript.Sleep 2000
'''ErrorCode6 = Err.Number
'''Err.Number = ""
'msgbox "step6 " & ErrorCode6
'WScript.Quit(0)

'DISABLED'POST-INSTALLATION DELETE DESKTOP ICON FROM ALL USERS
'on error resume next
'''DELICON = "%comspec% /c del /q " & chr(34)&"%ALLUSERSPROFILE%\Desktop\DesktopIconName*"&chr(34)
'''Err.Number = objShell.Run (DELICON,0,False)
'''WScript.Sleep 2000
'''ErrorCode7 = Err.Number
'msgbox "step7 " & ErrorCode7
'WScript.Quit(0)

'DISABLED'POST-INSTALLATION MAKE DIRECTORY
'on error resume next
'''objShell.Run "%comspec% /c md " & chr(34) & "%ProgramFiles%\YourProgram" & chr(34),0,True

'ENABLED'POST-INSTALLATION REGEDIT - DISABLE PSTs
'on error resume next
REGEDIT = "%comspec% /c %windir%\system32\REG.exe ADD "& chr(34)&"HKLM\Software\Microsoft\Office\14.0\Outlook"&chr(34)&" /v "&chr(34)&"DisablePST"&CHR(34)&" /d 1 /t REG_DWORD /f"
'command: REG.exe ADD "HKLM\Software\Microsoft\Office\14.0\Outlook" /v "DisablePST" /d 0 /t REG_DWORD /f
Err.Number = objShell.Run (REGEDIT,0,False)
WScript.Sleep 2000
ErrorCode8 = Err.Number
'msgbox "step8 " & ErrorCode8
'WScript.Quit(0)

'DISABLED'POST-INSTALLATION MONITOR A PROCESS FOR COMPLETION
'''cmd = 1
'''do while cmd = 1
'''Dim cmd
'''Set objWMIService = GetObject("winmgmts:" _
''' & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
'''Set colProcesses = objWMIService.ExecQuery ("Select * from Win32_Process Where Name = 'cmd.exe'")
'''If colProcesses.Count = 0 Then
'Wscript.Echo "cmd.exe is not running."
''' cmd = 0
''' WScript.Sleep 1000
'''Else
'Wscript.Echo "cmd.exe is running."
''' cmd = 1
''' WScript.Sleep 1000
'''End If
'''loop

'ENABLED'TURNS ON AUTOMATIC UPDATES
'on error resume next
Set objShell = CreateObject("Wscript.Shell")
objShell.Run "%comspec% /c %windir%\SYSTEM32\net.exe start wuauserv",0,False'STARTS THE WINDOWS UPDATE SERVICE
WScript.Sleep 2000
'msgbox "step9 " & ErrorCode9

'ENABLED'POST-INSTALLATION TASKKILLS
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im mshta.exe",0,True'KILLS SPLASH SCREEN and LANDesk Logo Screen
'''objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im cmd.exe",0,True'KILLS ANY CMD.EXE

'DISABLED'POST-INSTALLATION DELETE FILES
'''objShell.Run "%comspec% /c del /q msg.txt",0,True'DELETES MSG TEXT FILE

'ENABLED'HANDLES FINAL ERRORCODE
'on error resume next
if ErrorCode4 = 3010 then ErrorCode4 = 0'REBOOT
if ErrorCode4 = 1602 then ErrorCode4 = 0'REPAIR
if ErrorCode4 = "" then ErrorCode4 = 0'EMPTY


'TESTING DIAGNOSTIC
'msgbox "End Time: " & TIME

'QUIT WITH ERROR CODE
WScript.Quit(ErrorCode4)
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

         
bar1






Δ
Monday, October 25th 2010
bar1
  
      
   
Δ Batch File Counter
 
How to create a basic counter for your batch file
 
Shell
           

bar1
:LOOP
echo %counter%%% complete...
Set /A counter+=1
%windir%\system32\sleep.exe 30
GOTO :LOOP
bar1

         
bar1






Δ Friday, October 22nd 2010
bar1
  
      
   
Δ Generic Splash Screen
 
How to create an even more generic splash screen that gets its messages from a text file
 

So, on our technical quest to make a PnP splash screen that will work for all your deployment needs, we are one step closer.


bar1
Features:                     
Reads text messages from command text file
Blinking install text
Software logo
Text input logic
animated progress bar
FAQs link
Clean design
bar1

  



HTA/VBScript

           

bar1
<script language="vbscript">
on error resume next
Window.ReSizeTo 0,0
Window.moveTo -1500, 0
</script>

<!--
=========================================================
Name: Progress Bar
Author: Eddie Jackson
Contact: mrnettek2000@yahoo.com
Created on: 10/22/2010
Modified:
Modified by:
Description: General use progress bar + Refresh + Read
                  updating message from text file
=========================================================
-->

<HTML>
<HEAD>
<TITLE>&nbsp;</TITLE>
<HTA:APPLICATION ID="Progress Bar"
BORDER="thin"
INNERBORDER="yes"
SCROLL="no"
CAPTION="no"
SHOWINTASKBAR="no"
SINGLEINSTANCE="yes"
SYSMENU="no"
WINDOWSTATE="normal"

>
<STYLE> body {margin:2}
</STYLE>

<style>
body {
font-family:Verdana;
font-size: 12px;
color: black;
scrollbar-face-color:white;
scrollbar-arrow-color:black;
scrollbar-track-color:#D84419;
text-align:center;
background: white;
}
#outer {
text-align:left;
border:1px solid #000000;
width:950px;
margin:auto;
}

#hdr {
height:80px;
background:white;
}

#bar {
height:25px;
background:#7B6E66;
color: #FFFFFF;
border:solid #000000;
border-width:1px 0 1px 0;
font-size: 12px;
font-weight: bold;
}

#bodyblock {
position:relative;
background: #cccccc;
color: #333333;
width:950px;
padding:0;
}

#l-col {
float:left;
background:#EDEBEA;
color: #D44519;
width:145px;
Height:400px;
}

#cont {
width:795px;
background:#ffffff;
color: #333333;
border:solid #000000;
border-width:0 0 0 1px;
text-align:left;
height:700px;
padding: 5px;
}

#ftr {
height:25px;
background:#c0c0c0;
color: #333333;
border:solid black;
border-width:1px 0 0 0;
margin:0;
}

table {
border-width: thin;
border-color: black;
border-style: groove;
font-size: 10px;
}

td {
border-width: 1px;
padding: 1px;
border-style: solid;
border-color: black;

}


</style>

<style type="text/css">
#blinker{ color: #88f; text-decoration: blink; }
</style>

<script type="text/javascript">

function done(){
var el=document.getElementById('blinker');

// IE has problems with setAttribute on 'style'
// el.setAttribute('style','color: #f00; text-decoration: none;');
// set directly
el.style.color='#f00';
el.style.textDecoration='none';
el.firstChild.nodeValue="Installing Office 2010, please wait...";
var t=setTimeout("countdown()",3800); //3.8 seconds
}

function countdown(){
var el=document.getElementById('blinker');
el.style.color='#88f';
el.style.textDecoration='blink';
var t=setTimeout("done()",3800); //3.8 seconds
}

// attach event after page loads
if( window.addEventListener ) {
window.addEventListener('load',countdown,false); //legacy
} else if( document.addEventListener ) {
document.addEventListener('load',countdown,false); //proper
} else if( window.attachEvent ) {
//window.attachEvent("onload", countdown); //IE only
}

</script>

</head>

<body>

<SCRIPT Language="VBScript">
On Error Resume Next
Dim varMODEL
Dim strComputer
Dim objShell
Dim counter
Dim AppPath
Dim SDMCachePath

Set objShell = CreateObject("Wscript.Shell")
AppPath = "Microsoft\Office2010"

'SET WORKING
SDMCachePath = "C:\Progra~1\LANDesk\LDClient\sdmcache\APPS\z_BETATEST\" & AppPath'
If filesys.FolderExists(SDMCachePath) then
'ON ERROR RESUME NEXT
objShell.CurrentDirectory = SDMCachePath
End if
SDMCachePath = "C:\Progra~2\LANDesk\LDClient\sdmcache\APPS\z_BETATEST\" & AppPath'
If filesys.FolderExists(SDMCachePath) then
'ON ERROR RESUME NEXT
objShell.CurrentDirectory = SDMCachePath
End if
SDMCachePath = "C:\Progra~1\LANDesk\LDClient\sdmcache\APPS\" & AppPath'
If filesys.FolderExists(SDMCachePath) then
'ON ERROR RESUME NEXT
objShell.CurrentDirectory = SDMCachePath
End if
SDMCachePath = "C:\Progra~2\LANDesk\LDClient\sdmcache\APPS\" & AppPath'
If filesys.FolderExists(SDMCachePath) then
'ON ERROR RESUME NEXT
objShell.CurrentDirectory = SDMCachePath
End if

Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20

strComputer = "."
On Error Resume Next
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM " & "Win32_ComputerSystem",
"WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)

On error resume next
Sub Window_Onload
On error resume next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * From Win32_DesktopMonitor")
For Each objItem in colItems
intHorizontal = objItem.ScreenWidth
intVertical = objItem.ScreenHeight
Next
End Sub

sub launch(pgm)
On error resume next
set shell = createobject("wscript.shell")
shell.run pgm
end sub


Sub Window_OnLoad
countdown()
On error resume next
'LAUNCHES THE MSG.CMD WHICH WILL GENERATE MESSAGES FOR THE SPLASH SCREEN
w = 570
h = 645
Return = ResizeWindow(w, h)
Return = ResizeWindow(w, h)
Return = CenterWindow(w, h)
Return = CenterWindow(w, h)


Dim timerID
timerID = window.setInterval("RefreshTime", 3800) 'milliseconds
RefreshTime
End Sub

Sub RefreshTime
On Error Resume Next
'This reads in the progress message
ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("msg.txt", ForReading)
strLine = objFile.ReadLine

if strLine <> "Installation is complete!" then
DataArea1.InnerHTML = "<i><h2>Installing Office 2010, please wait...</h2></i>"
DataArea2.InnerHTML = "<h5>"&"<IMG src="&chr(34)&"progress.gif"&chr(34)&"
application="&chr(34)&"yes"&chr(34)&" width="&chr(34)&"75%"&chr(34)&"
height="&chr(34)&"1%"&chr(34)&" marginwidth="&chr(34)&"0"&chr(34)&"
marginheight="&chr(34)&"0"&chr(34)&" frameborder="&chr(34)&"0"&chr(34)&"></IMG><h5>"
else
DataArea1.InnerHTML = "<h2>Office 2010 Installed Successfully!</h2>"
DataArea2.InnerHTML = "<h5>"&"<IMG src="&chr(34)&""&chr(34)&"
application="&chr(34)&"yes"&chr(34)&" width="&chr(34)&"75%"&chr(34)&"
height="&chr(34)&"1%"&chr(34)&" marginwidth="&chr(34)&"0"&chr(34)&"
marginheight="&chr(34)&"0"&chr(34)&" frameborder="&chr(34)&"0"&chr(34)&"></IMG><h5>"
DataArea3.InnerHTML = "Installation is complete!"
Set objShell = CreateObject("WScript.Shell")
objShell.Run "%comspec% /c ping.exe -n 5 127.0.0.1",0,True
objFile.Close
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im mshta.exe",0,True
end if

if strLine = "" then
DataArea3.InnerHTML = "Accessing setup files..."
else
DataArea3.InnerHTML = strLine
end if

End Sub

Function ResizeWindow(w, h)
On error resume next
width = w
height = h
window.resizeTo width, height
End Function

Function CenterWindow(w, h)
On error resume next
x = (screen.width-w)/2
y = (screen.height-h)/2
window.moveTo x, y

End Function



sub FAQs
Set objShell = CreateObject("Wscript.Shell")
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im notepad.exe"
,0,True
objShell.Run "notepad.exe FAQs.txt",9,False
end sub
</SCRIPT>


<script type="text/javascript">
window.onload = FadeFunction
var i = 0
function FadeFunction() {
if (i < 350) {
i=i+3
}
var d = document.body.style
d.filter = "alpha(Opacity="+i+")"
d.opacity = i/350
var num = document.all ? 5 : 350
setTimeout("FadeFunction()",num)
}

</script>
<center>
<br>
<span id="blinker"><span id=DataArea1></span></span>

<b><a onclick="FAQs">click for FAQs</a></b>
<br>
<br>
<IMG src="Office2010Pro.jpg">
<span id=DataArea2></span>
<h4><span id=DataArea3></span><h4>

</center>

</BODY>
</HTML>
bar1

         
bar1





Δ Thursday, October 21st 2010
bar1
  
      
   
Δ Office 2010 Keeps Failing During Install
 
How to fix an Office 2010 botched installation

There may be a problem with these folders: 

c:\windows\installer
c:\MSOCache
c:\Config.Msi



Commands

           

bar1
Step 1) Run command msiexec /unregister & Run command msiexec /regserver  

Step 2) Give full permissions to the folder c:\windows\installer & Give Full permission to folder c:\windows\temp

Step 3) Delete c:\MSOCache

Step 4) Delete c:\Config.Msi

Step 5) Restart computer.  
bar1

             

bar1

  
   
 
Δ Wednesday, October 20th 2010
bar1
  
 
    
Δ Create Message Command File
 
How to create a message command file that will send messages to your splash screen
 

Shell

bar1
@echo off
title Diagnostic Window

@rem SET THE WORKING DIRECTORY
if exist C:\Progra~1\LANDesk\LDClient\sdmcache\apps\z_BETATEST\Microsoft\Office2010 set DYNPATH=C:\Progra~1\LANDesk\LDClient\sdmcache\apps\z_BETATEST\Microsoft\Office2010
if exist C:\Progra~2\LANDesk\LDClient\sdmcache\apps\z_BETATEST\Microsoft\Office2010 set DYNPATH=C:\Progra~2\LANDesk\LDClient\sdmcache\apps\z_BETATEST\Microsoft\Office2010

if exist C:\Progra~1\LANDesk\LDClient\sdmcache\apps\Microsoft\Office2010 set DYNPATH=C:\Progra~1\LANDesk\LDClient\sdmcache\apps\Microsoft\Office2010
if exist C:\Progra~2\LANDesk\LDClient\sdmcache\apps\Microsoft\Office2010 set DYNPATH=C:\Progra~2\LANDesk\LDClient\sdmcache\apps\Microsoft\Office2010

echo %DYNPATH%

@rem EMPTY THE MSG TEXT FILE
Echo Initializing setup...>%DYNPATH%\msg.txt
%windir%\system32\sleep.exe 1
Echo Initializing setup...>%DYNPATH%\msg.txt

@rem LAUNCH THE SPLASH SCREEN
if exist "%DYNPATH%\splashscreen.hta" start "" /low "%DYNPATH%\splashscreen.hta"

@rem TASKKILL THE PORTAL WINDOW, CLEANER
%windir%\system32\TASKKILL.exe /f /im policy.client.portal.exe


@rem SET VARIABLES
set timing1=15
rem 15
set timing2=30
rem 30
set counter=
set counter=1
set %counter%=1

@rem COPY SLEEP.EXE TO SYSTEM32
copy /y /v "%DYNPATH%\sleep.exe" %windir%\system32
copy /y /v "%DYNPATH%\sleep.exe" %windir%\system32

@rem READ IN PERCENTAGE ALREADY COMPLETE
@rem if exist "%DYNPATH%\msg.txt" (
@rem for /f "tokens=1 delims= " %%a in (%DYNPATH%\msg.txt) do (
@rem set counter=%%a
@rem if %counter% GTR 98 goto :FINAL
@rem if %counter% GTR 50 goto :LOOP2
@rem )
@rem )


@rem SEND FIRST MESSAGE TO TEXT FILE-WHICH GOES TO SPLASH SCREEN
Echo Initializing setup...>%DYNPATH%\msg.txt
Echo Initializing setup...>%DYNPATH%\msg.txt
%windir%\system32\sleep.exe 10

Echo.>"%DYNPATH%\msg.txt"
%windir%\system32\sleep.exe -m 250
Echo 0%% complete...>"%DYNPATH%\msg.txt"
%windir%\system32\sleep.exe 5

:LOOP1
echo %counter%%% complete...
echo %counter%%% complete...>"%DYNPATH%\msg.txt"
Set /A counter+=1
%windir%\system32\sleep.exe 15
if %counter% LSS 40 goto :LOOP1
GOTO :LOOP2

:LOOP2
echo %counter%%% complete...
echo %counter%%% complete...>"%DYNPATH%\msg.txt"
Set /A counter+=1
%windir%\system32\sleep.exe 30
start /min /b /low /wait %windir%\system32\TASKLIST.exe /FI "IMAGENAME eq setup.exe" | %windir%\system32\find.exe /i "setup.exe" && (goto :LOOP2) || (goto :FINAL)
GOTO :LOOP2

:FINAL
echo %counter%%% complete...
echo %counter%%% complete...>"%DYNPATH%\msg.txt"
Set /A counter+=1
%windir%\system32\sleep.exe 1
if %counter% LSS 99 goto :FINAL
echo Finalizing setup...
echo Finalizing setup...>"%DYNPATH%\msg.txt"
%windir%\system32\sleep.exe 5
start /min /b /low /wait %windir%\system32\TASKLIST.exe /FI "IMAGENAME eq setup.exe" | find /i "setup.exe" && (%windir%\system32\sleep.exe 60) || (goto END)
start /min /b /low /wait %windir%\system32\TASKLIST.exe /FI "IMAGENAME eq setup.exe" | find /i "setup.exe" && (%windir%\system32\sleep.exe 60) || (goto END)
start /min /b /low /wait %windir%\system32\TASKLIST.exe /FI "IMAGENAME eq setup.exe" | find /i "setup.exe" && (%windir%\system32\sleep.exe 60) || (goto END)
start /min /b /low /wait %windir%\system32\TASKLIST.exe /FI "IMAGENAME eq setup.exe" | find /i "setup.exe" && (%windir%\system32\sleep.exe 60) || (goto END)
start /min /b /low /wait %windir%\system32\TASKLIST.exe /FI "IMAGENAME eq setup.exe" | find /i "setup.exe" && (%windir%\system32\sleep.exe 60) || (goto END)
goto END

:END
echo Installation is complete!
echo Installation is complete!>"%DYNPATH%\msg.txt"
%windir%\system32\sleep.exe 5
Echo.>"%DYNPATH%\msg.txt"
Exit
bar1


bar1

 


Δ Wednesday, October 13th 2010
bar1
    
    
Δ BGInfo 4.16 Deployment
 
How to create a package to deploy BGInfo
 

VBScript: Install

           

bar1
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
':: E L I T E  S O L U T I O N S
':: SCRIPT LANGUAGE: VBScript
':: SCRIPT NAME: BgInfoInstall.vbs
':: PURPOSE: To be used to install BGInfo 4.16
':: CREATION DATE: 10/14/2010
':: LAST MODIFIED:
':: DIRECTIONS: Send to client workstation
':: AUTHOR: Eddie Jackson
':: EMAIL: MrNetTek2000@yahoo.com
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


'TESTING DIAGNOSTIC
'msgbox "Begin Time: " & TIME

'VARIABLES
'ON ERROR RESUME NEXT
Dim filesys, strComputer, OSDetect, objWMIService, colInstances, sUser, strUser, objShell, Install, Update, DELICON, Windows7_OS, XP_OS
Dim BetaTestPath, SDMCache
Set filesys = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Wscript.Shell")

'TASKKILLS PRE-INSTALLATION
'KILLS CURRENTLY RUNNING MSIEXEC.EXE
objShell.Run "%comspec% /c %windir%\SYSTEM32\TASKKILL.EXE /F /IM msiexec.exe",0,True

'KILLS CURRENTLY RUNNING bginfo.EXE
objShell.Run "%comspec% /c %windir%\SYSTEM32\TASKKILL.EXE /F /IM bginfo.exe",0,True

'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
Set wshShell = WScript.CreateObject( "WScript.Shell" )
strComputer = wshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" )
end if


'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
'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 7 Enterprise" then Seven()


'SETS UP SECONDARY OS DETECTION IF NEEDED
Windows7_OS = "C:\Users\Public"
XP_OS = "C:\Documents and Settings"

'SECONDARY DETECTION LOGIC
If filesys.FolderExists(Windows7_OS) then Seven()
If filesys.FolderExists(XP_OS) then XP()


'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

'SETS WORKING DIRECTORY
BetaTestPath = "C:\Progra~1\LANDesk\LDClient\sdmcache\APPS\Sysinternals\BGInfo_4.16_Prod"
If filesys.FileExists(BetaTestPath) then
'ON ERROR RESUME NEXT
objShell.CurrentDirectory = BetaTestPath
End if

SDMCachePath = "C:\Progra~1\LANDesk\LDClient\sdmcache\APPS\Sysinternals\BGInfo_4.16_Prod"
If filesys.FileExists(SDMCachePath) then
'ON ERROR RESUME NEXT
objShell.CurrentDirectory = SDMCachePath
End if

'ENABLED'TEMPORARILY TURNS OFF AUTOMATIC UPDATES
'ON ERROR RESUME NEXT
Set objShell = CreateObject("WScript.Shell")
objShell.Run "%comspec% /c %windir%\system32\net.exe stop wuauserv",0,True
WScript.Sleep 2000

'ENABLED'Remove APPLICATION
'ON ERROR RESUME NEXT
Remove = "%comspec% /c %windir%\SYSTEM32\msiexec.exe /i" & chr(34)& objShell.CurrentDirectory & "\BGInfo_4.16_UnInstall.msi" & CHR(34) & " /quiet /qn /norestart"
'msgbox Remove
Err.Number = objShell.Run (Remove,0,True)
WScript.Sleep 3000
ErrorCode3 = Err.Number
'msgbox "step3 " & ErrorCode3
'WScript.Quit(0)


'ENABLED'INSTALLS APPLICATION WITH SILENT SWITCHES
'ON ERROR RESUME NEXT
Install = "%comspec% /c %windir%\SYSTEM32\msiexec.exe /i" & chr(34)& objShell.CurrentDirectory & "\BGInfoSetup.msi" & CHR(34) & " /quiet /qn /norestart"
'msgbox "Access 2003 Install: " & Install
'msgbox Install
Err.Number = objShell.Run (Install,0,True)
WScript.Sleep 3000
ErrorCode4 = Err.Number
'msgbox "step4 " & ErrorCode4
'WScript.Quit(0)

'ENABLED'TURNS ON AUTOMATIC UPDATES
'ON ERROR RESUME NEXT
objShell.Run "%comspec% /c %windir%\SYSTEM32\net.exe start wuauserv",0,False
WScript.Sleep 2000
'msgbox "step9 " & ErrorCode9

'ENABLED'POST-INSTALLATION KILLS CURRENTLY RUNNING MSIEXEC.EXE
objShell.Run "%comspec% /c %windir%\SYSTEM32\TASKKILL.EXE /F /IM msiexec.exe",0,True

'ENABLED'HANDLES FINAL ERRORCODE
'ON ERROR RESUME NEXT
if ErrorCode4 = 3010 then ErrorCode4 = 0'REBOOT
if ErrorCode4 = 1602 then ErrorCode4 = 0'REPAIR
if ErrorCode4 = "" then ErrorCode4 = 0'EMPTY
'TESTING DIAGNOSTIC
'''msgbox "End Time: " & TIME
WScript.Quit(ErrorCode4)
End Sub



'W I N D O W S 7
Sub SEVEN()
'ON ERROR RESUME NEXT

'SETS WORKING DIRECTORY
BetaTestPath = "C:\Progra~2\LANDesk\LDClient\sdmcache\APPS\z_BETATEST\Sysinternals\BGInfo_4.16_Prod"
If filesys.FileExists(BetaTestPath) then
'ON ERROR RESUME NEXT
objShell.CurrentDirectory = BetaTestPath
End if

SDMCachePath = "C:\Progra~2\LANDesk\LDClient\sdmcache\APPS\Sysinternals\BGInfo_4.16_Prod"
If filesys.FileExists(SDMCachePath) then
'ON ERROR RESUME NEXT
objShell.CurrentDirectory = SDMCachePath
End if

'ENABLED'TEMPORARILY TURNS OFF AUTOMATIC UPDATES
'ON ERROR RESUME NEXT
Set objShell = CreateObject("WScript.Shell")
objShell.Run "%comspec% /c %windir%\system32\net.exe stop wuauserv",0,True
WScript.Sleep 2000

'ENABLED'Remove APPLICATION
'ON ERROR RESUME NEXT
Remove = "%comspec% /c %windir%\SYSTEM32\msiexec.exe /i" & chr(34)& objShell.CurrentDirectory & "\BGInfo_4.16_UnInstall.msi" & CHR(34) & " /quiet /qn /norestart"
'msgbox Remove
Err.Number = objShell.Run (Remove,0,True)
WScript.Sleep 3000
ErrorCode3 = Err.Number
'msgbox "step3 " & ErrorCode3
'WScript.Quit(0)

'ENABLED'INSTALLS APPLICATION WITH SILENT SWITCHES
'ON ERROR RESUME NEXT
Install = "%comspec% /c %windir%\SYSTEM32\msiexec.exe /i" & chr(34)& objShell.CurrentDirectory & "\BGInfoSetup.msi" & chr(34) & " /quiet /qn /norestart"
'msgbox "Access 2003 Install: " & Install
'msgbox Install
Err.Number = objShell.Run (Install,0,True)
WScript.Sleep 3000
ErrorCode4 = Err.Number
'msgbox "step4 " & ErrorCode4
'WScript.Quit(0)

'ENABLED'POST-INSTALLATION MAKE DIRECTORY
objShell.Run "cmd /c md " & chr(34) & "C:\PROGRA~1\BGInfo" & chr(34),0,True

'ENABLED'POST-INSTALLATION SET FOLDER PERMISSIONS
objShell.Run "%WINDIR%\system32\cacls.exe" & " " & chr(34) & "C:\PROGRA~1\BGINFO" & chr(34) & " " & "/e /g everyone:f",0,True

'ENABLED'POST-INSTALLATION COPY FILES
objShell.Run "%COMSPEC% /c COPY /Y /V " & chr(34) & "C:\PROGRA~2\BGInfo\*.*" & chr(34) & " " & chr(34) & "C:\PROGRA~1\BGInfo" & chr(34),0,True

'ENABLED'TURNS ON AUTOMATIC UPDATES
'ON ERROR RESUME NEXT
objShell.Run "%comspec% /c %windir%\SYSTEM32\net.exe start wuauserv",0,False
WScript.Sleep 2000
'msgbox "step9 " & ErrorCode9

'ENABLED'POST-INSTALLATION KILLS CURRENTLY RUNNING MSIEXEC.EXE
objShell.Run "%comspec% /c %windir%\SYSTEM32\TASKKILL.EXE /F /IM msiexec.exe",0,True

'ENABLED'HANDLES FINAL ERRORCODE
'ON ERROR RESUME NEXT
if ErrorCode4 = 3010 then ErrorCode4 = 0'REBOOT
if ErrorCode4 = 1602 then ErrorCode4 = 0'REPAIR
if ErrorCode4 = "" then ErrorCode4 = 0'EMPTY
'TESTING DIAGNOSTIC
'''msgbox "End Time: " & TIME
WScript.Quit(ErrorCode4)
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




VBScript: Un-Install

bar1
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
':: E L I T E  S O L U T I O N S
':: SCRIPT LANGUAGE: VBScript
':: SCRIPT NAME: BgInfoUnInstall.vbs
':: PURPOSE: To be used to Un-Install BGInfo 4.16
':: CREATION DATE: 10/14/2010
':: LAST MODIFIED:
':: DIRECTIONS: Send to client workstation from LANDesk
':: AUTHOR: Eddie Jackson
':: EMAIL: MrNetTek2000@yahoo.com
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
On error resume next

Dim objFSO, objDictionary, objFile, objShell, strCommand
Dim objSubkey, strSubPath, strValueName, strKeyPath, objRegistry, strComputer, strLine

Set objShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Const HKEY_LOCAL_MACHINE = &H80000002
Const ForReading = 1

'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
Set wshShell = WScript.CreateObject( "WScript.Shell" )
strComputer = wshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" )
end if

'MAIN ROUTINE - THIS HANDLES PROFILES BY SID
Set objRegistry=GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")

strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList"
objRegistry.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubkeys

'THIS WILL CYCLE THROUGH EACH PROFILE, RETURNING A SID, THEN USING THE SID TO ALLOW REG ADD TO CHANGE THE WALLPAPER HIVE KEY TO NOTHING
For Each objSubkey In arrSubkeys
ON ERROR RESUME NEXT
strValueName = "ProfileImagePath"
strSubPath = strKeyPath & "\" & objSubkey
objRegistry.GetExpandedStringValue HKEY_LOCAL_MACHINE,strSubPath,strValueName,strValue

'THESE ARE THE FILTERED SID ACCOUNTS AND WILL NOT BE PROCESSED
if objSubkey = "S-1-5-17" then objSubkey = ""
if objSubkey = "S-1-5-18" then objSubkey = ""
if objSubkey = "S-1-5-19" then objSubkey = ""
if objSubkey = "S-1-5-20" then objSubkey = ""
if objSubkey = "S-1-5-21" then objSubkey = ""

if objSubkey <> "" then
ON ERROR RESUME NEXT
'WScript.Echo objSubkey

strCommand1 = "%WINDIR%\SYSTEM32\reg.exe add "&chr(34)&"HKEY_USERS\"&objSubkey&"\Control Panel\Desktop"&chr(34)&" /v "& chr(34)&"Wallpaper"&chr(34)&" /t REG_SZ /d "&chr(34)&chr(34)&" /f"
'WScript.Echo strCommand1
'EXECUTES COMMAND
objShell.Run strCommand1,0, True

'COMMAND
'reg add "HKEY_USERS\S-1-5-21-729355473-1286879909-800860556-5703585\Control Panel\Desktop" /v Wallpaper /t REG_SZ /d "" /f
end if

Next

ON ERROR RESUME NEXT
'UNINSTALLS BGINFO 4.16
set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "%WINDIR%\SYSTEM32\msiexec.exe /X {B64C7012-5BC2-432D-A7D3-35E6784EDD7C} /quiet /qn /norestart", 0, True
WshShell.Run strCommand,0, True
WshShell.Run "%COMSPEC% /C del /q c:\progra~1\bginfo\*.*",0, True
WshShell.Run "%COMSPEC% /C del /q c:\progra~2\bginfo\*.*",0, True
WshShell.Run "%COMSPEC% /C rd c:\progra~1\bginfo",0, True
WshShell.Run "%COMSPEC% /C rd c:\progra~2\bginfo",0, True

'CLEANUP RESOURCES
Set strCommand1 = ""
Set objSubkey = ""
Set strSubPath = ""
Set strSubValue = ""
Set strKeyPath = ""
Set i = ""
Set strNextLine = ""
Set objFile = ""
Set strComputer = ""
Set objFSO = ""
Set objShell = ""

WScript.Quit
bar1


bar1

 
 
 
 
 
Δ Monday, October 11th 2010
bar1
     
     

Δ
Enable Scripting & WMI In Your WinPE Environment
 
How to make your WinPE bootdisks/PXE work with custom scripts and wmi
 

bar1
dism /image:C:\winpe_x86\mount /Add-Package /PackagePath:"C:\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\winpe-scripting.cab"

dism /image:C:\winpe_x86\mount /Add-Package /PackagePath:"C:\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\en-us\winpe-scripting_en-us.cab"

dism /image:C:\winpe_x86\mount /Add-Package /PackagePath:"C:\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\winpe-wmi.cab"

dism /image:C:\winpe_x86\mount /Add-Package /PackagePath:"C:\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\en-us\winpe-wmi_en-us.cab"  
bar1


bar1



  
Δ Friday, October 8th 2010
bar1
     
  
     
Δ V-Model Software Testing
 
What is the V-Model?
 
 

Types of Testing

As you get involved in the development of a new system a vast number of software tests appear to be required to prove the system. While they are consistent in all having the word "test" in them, their relative importance to each other is not clear. This advice article gives an outline of the various types of software testing and how they fit into the V-Model.

 

The main software testing types are:

Component.

Interface.

System.

Acceptance.

Release.


To put these types of software testing in context requires an outline of the development process.

Development Process

The development process for a system is traditionally as a Waterfall Model where each step follows the next, as if in a waterfall. This shows how various products produced at each step are used in the process following it. It does not imply that any of the steps in a process have to be completed, before the next step starts, or that prior steps will not have to be revisited later in development. It is just a useful model for seeing how each step works with each of the others.

 

1- Business Case

The first step in development is a business investigation followed by a "Business Case" produced by the customer for a system. This outlines a new system, or change to an existing system, which it is anticipated will deliver business benefits, and outlines the costs expected when developing and running the system.

 

2- User Requirements

The next broad step is to define a set of "User Requirements", which is a statement by the customer of what the system shall achieve in order to meet the need. These involve both functional and non-functional requirements. Further details are in the requirements article.

 

3- System Specification

"Requirements" are then passed to developers, who produce a "System Specification". This changes the focus from what the system shall achieve to how it will achieve it by defining it in computer terms, taking into account both functional and non-functional requirements.

  

4- System Design

Other developers produce a "System Design" from the "System Specification". This takes the features required and maps them to various components, and defines the relationships between these components. The whole design should result in a detailed system design that will achieve what is required by the "System Specification".

 

5- Component Design

Each component then has a "Component Design", which describes in detail exactly how it will perform its piece of processing.

 

6- Component Construction

Finally each component is built, and then is ready for the test process.

 

Types of Testing

 
V-Model

The level of test is the primary focus of a system and derives from the way a software system is designed and built up. Conventionally this is known as the "V-Model", which maps the types of test to each stage of development.

 

7- Unit or Component Test

Starting from the bottom the first test level is "Component Test", sometimes called Unit Testing. It involves checking that each feature specified in the "Component Design" has been implemented in the component.

 

In theory an independent tester should do this, but in practise the developer usually does it, as they are the only people who understand how a component works. The problem with a component is that it performs only a small part of the functionality of a system, and it relies on co-operating with other parts of the system, which may not have been built yet. To overcome this, the developer either builds, or uses special software to trick the component into believing it is working in a fully functional system.

 

8- Interface or Integration Test

As the components are constructed and tested they are then linked together to check if they work with each other. It is a fact that two components that have passed all their tests, when connected to each other produce one new component full of faults. These tests can be done by specialists, or by the developers.

 

Interface Testing is not focussed on what the components are doing but on how they communicate with each other, as specified in the "System Design". The "System Design" defines relationships between components, and this involves stating:

 

What a component can expect from another component in terms of services.

How these services will be asked for.

How they will be given.

How to handle non-standard conditions, i.e. errors.

Tests are constructed to deal with each of these.

 

The tests are organised to check all the interfaces, until all the components have been built and interfaced to each other producing the whole system.

 

9- System Test

Once the entire system has been built then it has to be tested against the "System Specification" to check if it delivers the features required. It is still developer focussed, although specialist developers known as systems testers are normally employed to do it.

 

In essence the System Test is not about checking the individual parts of the design, but about checking the system as a whole. In effect it is one giant component.

 

System testing can involve a number of specialist types of test to see if all the functional and non-functional requirements have been met. In addition to functional requirements these may include the following types of testing for the non-functional requirements:

 

Performance - Are the performance criteria met?

Volume - Can large volumes of information be handled?

Stress - Can peak volumes of information be handled?

Documentation - Is the documentation usable for the system?

Robustness - Does the system remain stable under adverse circumstances?

There are many others, the needs for which are dictated by how the system is supposed to perform.

 

10- Acceptance Test

Acceptance Testing checks the system against the "User Requirements". It is similar to systems testing in that the whole system is checked but the important difference is the change in focus:

 

Systems Testing checks that the system that was specified has been delivered.

Acceptance Testing checks that the system delivers what was requested.

The customer, and not the developer should always do acceptance testing. The customer knows what is required from the system to achieve value in the business and is the only person qualified to make that judgement. The forms of the tests may follow those in system testing, but at all times they are informed by the business needs.

 

11- Release Test

Even if a system meets all its requirements, there is still a case to be answered that it will benefit the business. The linking of "Business Case" to Release Testing is looser than the others, but is still important.

 

Release Testing is about seeing if the new or changed system will work in the existing business environment. Mainly this means the technical environment, and checks concerns such as:

 

Does it affect any other systems running on the hardware?

Is it compatible with other systems?

Does it have acceptable performance under load?

These tests are usually run the by the computer operations team in a business. The answers to their questions could have significant a financial impact if new computer hardware should be required, and adversely affect the "Business Case".

 

It would appear obvious that the operations team should be involved right from the start of a project to give their opinion of the impact a new system may have. They could then make sure the "Business Case" is relatively sound, at least from the capital expenditure, and ongoing running costs aspects. However in practise many operations teams only find out about a project just weeks before it is supposed to go live, which can result in major problems.

 

Regression Tests

With modern systems one person's system, becomes somebody else's component. It follows that all the above types of testing could be repeated at many levels in order to deliver the final value to the business.


bar1


  About

   
I'm a Computer
   
Systems Engineer

   
Living and loving life

........................................


 
Author

...