Archive - January 2011

"The power of imagination makes us infinite." - John Muir 



Index

bar1
Change Workgroup
Fade-in and Fade-out
Environmental Variables in VBScript
RUNAS C$
HStart.exe
CPAU.EXE
Communicator R2 Deployment
Faster Dimming With Sound
Scrolling Splash Screens
bar1


        


 
Δ Friday, January 28th, 2011
bar1
  
      

Δ Change Workgroup
 
How to change workgroup name on Server 2008.

Command:

           

bar1
wmic computersystem where name="%computername%"  call joindomainorworkgroup name="NewWorkgroupName"
bar1

     
 
bar1
 

 
Δ Tuesday, January 25th, 2011
bar1
 
    
      
 
Δ Fade-in and Fade-out to Invisible
 
How to add a fading special effect to your HTA scripted apps.

HTA/VBScript

           

bar1
<html>
<body bgcolor="black">
</body>
</html>

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


<script language="vbscript">
on error resume next
w = 400
h = 300
Return = ResizeWindow(w, h)
Return = CenterWindow(w, h)
Return = ResizeWindow(w, h)
Return = CenterWindow(w, h)

Function ResizeWindow(w, h)
On error resume next
width = w
height = h
window.resizeTo width, height
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
window.moveTo x, y
End Function
</script>

<!--
==========================================================
Name: Progress Bar
Author: Eddie Jackson
Contact: MrNetTek2000@yahoo.com
Created on: 01/31/2011
Modified:
Modified by:
Description: General use fading splash screen
==========================================================
-->

<HEAD>
<TITLE>FAQs</TITLE>
<HTA:APPLICATION ID="FAQs"
BORDER="none"
INNERBORDER="no"
SCROLL="no"
CAPTION="no"
SHOWINTASKBAR="no"
SINGLEINSTANCE="yes"
SYSMENU="no"
WINDOWSTATE="normal"
>
</head>


<BODY bgcolor=#000000 onmouseout="fadein()" onmouseover="fadeout()">
<frameset framespacing="0"; border="0"; bgcolor=#000000>
<iframe id="tuxie" style="FILTER: alpha(opacity=0)" src="faqs.bmp"; name="faqs"; hspace="-20"; vspace="-30"; scrolling="no"; allowtransparency="true"; style="height: 120%; width: 120%; border: 0px solid black;">
</iframe>
</frameset>

<script language="javascript">
value=0;
var t1=null;
var t2=null;

function fadein(){
if (value<100) value+=15;
document.getElementById("tuxie").filters[0].opacity=value;
if (t2!=null) clearTimeout(t2);
t1=setTimeout('fadein()',50);
}
function fadeout(){
setTimeout('self.close()',250);
if (value>0) value-=15;
document.getElementById("tuxie").filters[0].opacity=value;
if (t1!=null) clearTimeout(t1);
t2=setTimeout('fadeout()',50)
}

fadein()

</SCRIPT>
</body>
</html>
bar1

     

bar1



Δ Friday, January 14th, 2011
bar1
  
      
   
Δ Environmental Variables in VBScript
 
How to assign environmental variables in your vbscripts.
 

Examples:

           

bar1
'SET LOCAL TEMP DIRECTORY
LocalTemp = CreateObject("WScript.Shell").ExpandEnvironmentStrings("%temp%")

'SET USERNAME
UserName = CreateObject("WScript.Shell").ExpandEnvironmentStrings("%username%")

'SET COMPUTERNAME
ComputerName = CreateObject("WScript.Shell").ExpandEnvironmentStrings("%computername%")

'SET SYSTEM ROOT c:\windows
SystemRoot = CreateObject("WScript.Shell").ExpandEnvironmentStrings("%systemroot%")

'SET USER PROFILE c:\documents and settings\USERNAME
UserProfile = CreateObject("WScript.Shell").ExpandEnvironmentStrings("%userprofile%")
bar1


bar1





Δ Thursday, January 13th, 2011
bar1
  
      
   
Δ RUNAS C$
 
How to access the admin share on a remote computer with different credentials


VBScript:

           

bar1
<Style>
Body {Background-Color: CornSilk}
</Style>

<HTA:Application
ID="objRUNAS_C$"
APPLICATIONNAME="RUNAS_C$"
ICON=""
SCROLL="no"
SINGLEINSTANCE="yes"
WINDOWSTATE="normal"
SYSMENU= "no"
SHOWINTASKBAR = "yes"
CONTEXTMENU="no"
CAPTION = "no"
>

<Script Language = VBScript>

Sub Window_OnLoad
w = 280
h = 125
Return = ResizeWindow(w, h)
Return = CenterWindow(w, h)
end sub


Sub WindowsLoad
Set objShell = CreateObject("WScript.Shell")


strUser = "YourDomain\"&UserPassword.Value
strPassword = UserName.Value
strComputer = MachineName.Value

ServerShare = "\\"&strComputer&"\c$"


Set NetworkObject = CreateObject("WScript.Network")
Set FSO = CreateObject("Scripting.FileSystemObject")

NetworkObject.MapNetworkDrive "", ServerShare, False, strUser, strPassword

'Set Directory = FSO.GetFolder(ServerShare)
'For Each FileName In Directory.Files
'msgbox FileName.Name
'Next

objShell.Run ServerShare

Set FileName = Nothing
Set Direct = Nothing
Set FSO = Nothing



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
Call Countdown() ''# Call the countdown function
End Function

</Script>


<Body>
Username : <Input Type = "Text" Name = "UserPassword"</p>
Password : <Input Type = "Password" Name = "UserName"</p>
MachineName : <Input Type = "Text" Name = "MachineName"</p>
<Input Type = "Button" Value = "Run Script" Name = "Ok_Button" OnClick = "WindowsLoad">
<Span Id = "DataArea"></Span></Body><Div Align = "Center">  
bar1


bar1







Δ
Wednesday, January 12th, 2011
bar1
        

Δ HStart.exe
 
How to use hstart.exe; useful for launching console windows silently.




Example:

           

bar1
'ENABLED'ELEVATED CACLS
objShell.Run "%comspec% /c echo %windir%\system32\cacls.exe" & " " & chr(34) & "C:\Program Files\InfraRecorder" & chr(34) & " " & "/e /g everyone:f" & ">%temp%\cmd_calcs.cmd",0,true''

'LAUNCHES SILENTLY IN ADMIN SECURITY CONTEXT
objShell.Run "%comspec% /c %temp%\CPAU.exe -u %computername%\administrator -p PASSWORD -ex "&chr(34)&"%temp%\hstart.exe /noconsole %temp%\cmd_calcs.cmd"&chr(34)&" -LWP",0,True
')
bar1


bar1







Δ Tuesday, January 11th, 2011
bar1
  
      
   
Δ CPAU.EXE
 
How to use cpau.exe in your scripts; useful for changing security context.


Usage:
CPAU -u user [-p password] -ex "WhatToRun" [switches]

user User to log on as. Ex: user or domain\user
password User's password
WhatToRun What to execute

Switches: (designated by - or /)
-profile Do local logon with profile instead of net logon
-localwithprofile Alias for -profile
-lwp Alias for -profile
-localwithoutprofile Local logon but do not load profile.
-lwop Alias for -localwithoutprofile
-k Prefix command with cmd /k to leave window open
-c Prefix command with cmd /c to close window after exec.
-pipepwd Special method allows you to pipe password in
-enc Encrypt a job file for later user
-dec Use an ecrypted job file
-file Specify job file to execute or create
-wait Wait for process completion before returning.
-outprocexit Used with -wait, the errorlevel variable has the
exit code of the spawned process instead of cpau.
-cwd x Start at working directory x.
-hide Start the new process in a hidden state.
-title x Allow you specify title of command prompt windows.
-crc file[,file,file] This option allows you to encode
CRC info for files in the job file. When decoded
the CRC have to match or the program bombs. Note that
it will not chase paths looking for the file, you must
specify the exact path.
-nowarn Don't output warning about network logon.


Example:
              

bar1
Elevated_Password = "YourPassword"

'creating the command on the fly
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run "%comspec% /c echo %windir%\system32\net.exe stop wuauserv>%temp%\cmd_wuaserv_off.cmd",0,true

'launching the command
objShell.Run "%comspec% /c %temp%\CPAU.exe -u %computername%\administrator -p " & Elevated_Password & " -ex " & chr(34) & "%temp%\cmd_wuaserv_off.cmd" & chr(34) & " -LWoP -hide -wait",0,True  bar1



One of my actual files (don't forget to create the shell.cmd):


bar1
'note
'resource files should automatically be extracted to user temp folder
'you can achieve this through a compiler

On error resume next

Set objShell = CreateObject("WScript.Shell")

'USE THIS COMPUTER
strComputer = "."

'SET LOCAL TEMP DIRECTORY
LocalTemp = CreateObject("WScript.Shell").ExpandEnvironmentStrings("%Temp%")

'ELEVATED PASSWORD
Elevated_Password = "YOUR_PASSWORD_HERE"

'TRACKER - START PROCESS TRACKER - this is just the lseep.exe command renamed
objShell.Run LocalTemp & "\tracker.exe 3600",0,false

'PROGRESS - START PROGRESSBAR ANIMATION
objShell.Run LocalTemp & "\hta_1.exe " & LocalTemp & "\wait.hta",9,false

'MSG - START MESSAGE COMMAND - feeds timing to progress bar via a compiled .cmd file
objShell.Run LocalTemp & "\msg.exe",0,false

'RUN ELEVATED COMMAND - shell.cmd contains your command to install files silently
objShell.Run LocalTemp & "\CPAU.exe -u %computername%\administrator -p " & Elevated_Password & " -ex " & chr(34) & LocalTemp & "\shell.cmd " & LocalTemp & chr(34) & " -LWOP -hide -wait",0,true

'TRACKER - STOP TRACKER
objShell.Run "%windir%\system32\taskkill.exe /f /im tracker.exe",0,false

'ENABLED'THIS WAITS FOR THE MESSAGE CMD FILE TO END
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 = 'msg.exe'")
If colProcesses.Count = 0 Then
on error resume next
'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

'FAQs - STOP FAQs SOUND
objShell.Run "%windir%\system32\taskkill.exe /f /im FAQs.exe",0,false

'FAQs - STOP FAQs ANIMATION
objShell.Run "%windir%\system32\taskkill.exe /f /im hta_2.exe",0,false

'PROGRESS - STOP PROGRESSBAR ANIMATION
objShell.Run "%windir%\system32\taskkill.exe /f /im hta_1.exe",0,false

objShell.Run "%comspec% /c del /q %temp%\msg.exe",0,false
objShell.Run "%comspec% /c del /q %temp%\msg.cmd",0,false
objShell.Run "%comspec% /c del /q %temp%\faqs.hta",0,false
objShell.Run "%comspec% /c del /q %temp%\faqs.exe",0,false
objShell.Run "%comspec% /c del /q %temp%\shell.cmd",0,false
objShell.Run "%comspec% /c del /q %temp%\wait.hta",0,false

'EXIT
WScript.Quit(0)
bar1


bar1








Δ Friday, January 7th, 2011
bar1
  
  
    

Δ Microsoft Communicator R2 Deployment
 
How to deploy Communicator R2 to your enterprise.

VBScript

           

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

'VARIABLES
on error resume next

Dim filesys, strComputer, OSDetect, objWMIService, colInstances, sUser, strUser, objShell, Install, Update, DELICON, Windows7_OS, XP_OS
Dim SDMCache, AppPath, wshShell, SetupFilesPath, SetupPath, strCurrentDirectory
Dim objAccount, objSubkey, strKeyPath, strSubPath, strValue, REGEDIT
Const HKEY_LOCAL_MACHINE = &H80000002
Elevated_Password = "YOURPASSWORDHERE"

AppPath = "Microsoft\Office2007CommunicatorR2\3.5.6907.206"

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

'SETS CURRENT DIRECTORY TO VARIABLE
strCurrentDirectory = objShell.CurrentDirectory

'PRE-SETUP COMMANDS
on error resume next
Set objShell = CreateObject("Wscript.Shell")
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im cmd.exe",0,True
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im SetupFiles.exe",0,True
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im mshta.exe",0,True
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im communicator.exe",0,True
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im outlook.exe",0,True
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im sndrec32.exe",0,True
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im cpau.exe",0,True

'POLICY DISABLED
'FilterFile = "c:\Program Files\YourProgram\foo.exe"
'If filesys.FileExists(FilterFile) THEN
'WScript.Quit(0)
'End if


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


'GLOBAL FILE EXTRACTION
objShell.Run "%comspec% /c "&chr(34)&strCurrentDirectory&"\GlobalFiles.exe"&chr(34),0,false
objShell.Run "%comspec% /c %windir%\system32\ping.exe -n 7 127.0.0.1",0,true'1 seconds per 3MB of size of GlobalFiles.exe
objShell.Run "%comspec% /c %windir%\system32\taskkill.exe /f /im GlobalFiles.exe",0,false
objShell.Run "%comspec% /c %windir%\system32\ping.exe -n 2 127.0.0.1",0,true
objShell.Run "%comspec% /c del /q "&chr(34)&strCurrentDirectory&"\GlobalFiles.exe"&chr(34),0,false
objShell.Run "%comspec% /c %windir%\system32\ping.exe -n 1 127.0.0.1",0,true
objShell.Run "%comspec% /c del /q "&chr(34)&strCurrentDirectory&"\GlobalFiles.exe"&chr(34),0,false
objShell.Run "%comspec% /c %windir%\system32\ping.exe -n 1 127.0.0.1",0,true
objShell.Run "%comspec% /c move /Y %temp%\RarSFX0\*.* %temp%\",0,true
objShell.Run "%comspec% /c %windir%\system32\ping.exe -n 1 127.0.0.1",0,true


'SET LOCAL TEMP DIRECTORY
LocalTemp = CreateObject("WScript.Shell").ExpandEnvironmentStrings("%Temp%")

'SET WORKSTATION NAME - PRIMARY METHOD
strComputer = "."

'SET WORKSTATION NAME - SECONDARY METHOD
if strComputer = "" then
on error resume next
Set wshNetwork = WScript.CreateObject( "WScript.Network" )
strComputer = wshNetwork.ComputerName
end if

'SET WORKSTATION NAME - TERTIARY METHOD
if strComputer = "" then
on error resume next
strComputer = wshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" )
end if

'ENABLED'PRIMARY OS DETECTION
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20

Set objWMIService = GetObject( "winmgmts://" & strComputer & "/root/CIMV2" )
Set colInstances = objWMIService.ExecQuery( "SELECT * FROM Win32_OperatingSystem", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly )

For Each objInstance In colInstances
on error resume next
'msgbox objInstance.Caption
OSDetect = objInstance.Caption
Next

OSDetect = trim(OSDetect)
'msgbox OSDetect

if OSDetect = "Microsoft Windows XP Professional" then XP()
if OSDetect = "Microsoft Windows XP" then XP()
if OSDetect = "Microsoft Windows XP Home" then XP()
if OSDetect = "Microsoft Windows Vista Ultimate" then Seven()
if OSDetect = "Microsoft Windows Vista Premium" then Seven()
if OSDetect = "Microsoft Windows Vista Home" then Seven()
if OSDetect = "Microsoft Windows Vista Basic" then Seven()
if OSDetect = "Microsoft Windows 7 Enterprise" then Seven()
if OSDetect = "Microsoft Windows 7 Enterprise Edition" then Seven()
if OSDetect = "Microsoft Windows 7 Ultimate" then Seven()
if OSDetect = "Microsoft Windows 7 Ultimate Edition" then Seven()
if OSDetect = "Microsoft Windows Server 2003 Standard" then XP()
if OSDetect = "Microsoft Windows Server 2008 Standard" then Seven()
if OSDetect = "Microsoft Windows Server 2008 Standard Edition" then Seven()
if OSDetect = "Microsoft Windows Server 2008 Enterprise" then Seven()
if OSDetect = "Microsoft Windows Server 2008 Enterprise Edition" then Seven()
if OSDetect <> "Microsoft Windows Server 2008 Enterprise" then XP()
WScript.Quit(0)

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

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


'DISABLED'TERTIARY DETECTION LOGIC
'''##if OSDetect <> "Microsoft Windows 7 Enterprise" then XP()
'END OS DETECTION


'W I N D O W S X P
Sub XP
on error resume next
UserLoggedInStatus()'returns whether a user is logged in or not
Set objShell = CreateObject("Wscript.Shell")

'SET LOCAL TEMP DIRECTORY
LocalTemp = CreateObject("WScript.Shell").ExpandEnvironmentStrings("%Temp%")

'SETS CURRENT DIRECTORY TO VARIABLE
strCurrentDirectory = objShell.CurrentDirectory

'secondary method of copying files into temp folder
'COPIES SOURCE FILES FROM CURRENT DIRECTORY TO USER'S TEMP FOLDER - used for universal access to files
objShell.Run "%comspec% /c copy /y /v "&chr(34)&strCurrentDirectory&"\STARTCOUNTER.hta"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v "&chr(34)&strCurrentDirectory&"\cpau.exe"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v "&chr(34)&strCurrentDirectory&"\Communicator_Install.msi"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v "&chr(34)&strCurrentDirectory&"\Communicator_Patch.msp"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v "&chr(34)&strCurrentDirectory&"\kaplan.jpg"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v "&chr(34)&strCurrentDirectory&"\kaplan.gif"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v "&chr(34)&strCurrentDirectory&"\kaplan.hta"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v "&chr(34)&strCurrentDirectory&"\LANDesk.gif"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v "&chr(34)&strCurrentDirectory&"\LANDesk.jpg"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v "&chr(34)&strCurrentDirectory&"\LANDesk.hta"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v "&chr(34)&strCurrentDirectory&"\sndrec32.reg"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v "&chr(34)&strCurrentDirectory&"\sndrec32.exe"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v "&chr(34)&strCurrentDirectory&"\notify.wav"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v "&chr(34)&strCurrentDirectory&"\progress.wav"&chr(34)&" %temp%\",0,true
WScript.Sleep 500'timing


'THIS WILL CREATE ALL THE ELEVATED FILES---------------------------------------------------------------------------------
'ENABLED'ELEVATED TURN OFF WINDOWS UPDATES
objShell.Run "%comspec% /c echo %windir%\system32\net.exe stop wuauserv>%temp%\cmd_wuaserv_off.cmd",0,true

'ENABLED'CREATE ELEVATED COMMAND - TURN ON WINDOWS UPDATES
objShell.Run "%comspec% /c echo %windir%\system32\net.exe start wuauserv>%temp%\cmd_wuaserv_on.cmd",0,true

'ENABLED'CREATE ELEVATED COMMAND - PATCH FILE - USED TO CHANGE BETWEEN USER AND ADMIN SECURITY CONTEXT
objShell.Run "%comspec% /c echo %windir%\system32\msiexec.exe /p "&chr(34)&"%windir%\system32\Communicator_Patch.msp"&chr(34)&" /qn /norestart /L* %temp%\communicator_patch.log>%temp%\elevated_patch.cmd",0,true

'ENABLED'CREATE ELEVATED COMMAND - INSTALL FILE - USED TO CHANGE BETWEEN USER AND ADMIN SECURITY CONTEXT
objShell.Run "%comspec% /c echo %windir%\system32\msiexec.exe /i "&chr(34)&"%windir%\system32\Communicator_Install.msi"&chr(34)&" /qn /norestart /L* %temp%\communicator_install.log>%temp%\elevated_install.cmd",0,true

'ENABLED'CREATE ELEVATED COMMAND - REMOVE FILE - USED TO CHANGE BETWEEN USER AND ADMIN SECURITY CONTEXT
objShell.Run "%comspec% /c echo %windir%\system32\msiexec.exe /x "&chr(34)&"{0D1CBBB9-F4A8-45B6-95E7-202BA61D7AF4}"&chr(34)&" /QN /norestart /L* %temp%\communicator_remove.log>%temp%\elevated_remove.cmd",0,true

'ENABLED'CREATE ELEVATED COMMAND - COPY MSP TO SYSTEM32 - USED TO CHANGE BETWEEN USER AND ADMIN SECURITY CONTEXT
objShell.Run "%comspec% /c echo copy /v /y "&chr(34)&LocalTemp&"\*.msp"&chr(34) & " \\%computername%\c$\windows\system32\>%temp%\cmd_copy1.cmd",0,true

'ENABLED'CREATE ELEVATED COMMAND - COPY MSI TO SYSTEM32 - USED TO CHANGE BETWEEN USER AND ADMIN SECURITY CONTEXT
objShell.Run "%comspec% /c echo copy /v /y "&chr(34)&LocalTemp&"\*.msi"&chr(34) & " \\%computername%\c$\windows\system32\>%temp%\cmd_copy2.cmd",0,true

'ENABLED'CREATE ELEVATED COMMAND - MD DIRECTORY
objShell.Run "%comspec% /c echo md " & chr(34) & "c:\Progra~1\Microsoft Office Communicator" & chr(34)&">%temp%\cmd_md.cmd",0,true

'ENABLED'CREATE ELEVATED COMMAND - CACLS
objShell.Run "%comspec% /c echo %windir%\system32\cacls.exe" & " " & chr(34) & "C:\Progra~1\Microsoft Office Communicator" & chr(34) & " " & "/e /g everyone:f" & ">%temp%\cmd_calcs.cmd",0,true

'ENABLED'CREATE ELEVATED COMMAND - COPY FILES
objShell.Run "%comspec% /c %temp%\CPAU.exe -u %computername%\administrator -p "&Elevated_Password&" -ex "&chr(34)&"%temp%\cmd_copy1.cmd"&chr(34)&" -LWP -hide -wait",0,true
objShell.Run "%comspec% /c %temp%\CPAU.exe -u %computername%\administrator -p "&Elevated_Password&" -ex "&chr(34)&"%temp%\cmd_copy2.cmd"&chr(34)&" -LWP -hide -wait",0,true
'END ELEVATED FILES--------------------------------------------------------------------------------------------------------

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

'ENABLED'SINGLE LAUNCH FROM TEMP FOLDER ONLY
'LAUNCHES IN USER SECURITY CONTEXT
Err.Number = objShell.Run ("%comspec% /c %temp%\STARTCOUNTER.hta",0,True)'launches splash
WScript.Sleep 2000'timing
ErrorCode0 = Err.Number

'ENABLED'DEFAULT SPLASH ASED UPON FOLDER LOGIC
'LAUNCHES IN USER SECURITY CONTEXT
If filesys.FolderExists(SDMCachePath) THEN
Err.Number = objShell.Run ("%comspec% /c %temp%\LANDesk.hta",0,False)'launches splash
WScript.Sleep 2000'timing
else
Err.Number = objShell.Run ("%comspec% /c %temp%\Kaplan.hta",0,False)'launches splash
WScript.Sleep 2000'timing
ErrorCode0 = Err.Number
end if

'ENABLED'LAUNCH ELEVATED COMMAND - TEMPORARILY TURNS OFF AUTOMATIC UPDATES
'LAUNCHES IN ADMIN SECURITY CONTEXT
on error resume next
Set objShell = CreateObject("WScript.Shell")
objShell.Run "%comspec% /c %temp%\CPAU.exe -u %computername%\administrator -p "&Elevated_Password&" -ex "&chr(34)&"%temp%\cmd_wuaserv_off.cmd"&chr(34)&" -LWP -hide -wait",0,True
WScript.Sleep 1000

'ENABLED'LAUNCH ELEVATED COMMAND - PRE-INSTALLATION MAKE DIRECTORY
'LAUNCHES IN ADMIN SECURITY CONTEXT
objShell.Run "%comspec% /c %temp%\CPAU.exe -u %computername%\administrator -p "&Elevated_Password&" -ex "&chr(34)&"%temp%\cmd_md.cmd"&chr(34)&" -LWP -hide -wait",0,True
WScript.Sleep 1000

'ENABLED'LAUNCH ELEVATED COMMAND - PRE-INSTALLATION SET FOLDER PERMISSIONS
'LAUNCHES IN ADMIN SECURITY CONTEXT
objShell.Run "%comspec% /c %temp%\CPAU.exe -u %computername%\administrator -p "&Elevated_Password&" -ex "&chr(34)&"%temp%\cmd_calcs.cmd"&chr(34)&" -LWP -hide -wait",0,True
WScript.Sleep 1000

'ENABLED'LAUNCH ELEVATED COMMAND - REMOVE APPLICATION - ACTS A REPAIR COMPONENT
'LAUNCHES IN ADMIN SECURITY CONTEXT

MSIRemove = "%comspec% /c %temp%\CPAU.exe -u %computername%\administrator -p "&Elevated_Password&" -ex "&chr(34)&"%temp%\elevated_remove.cmd"&chr(34)&" -LWP -hide -wait"
Err.Number = objShell.Run (MSIRemove,0,True)
WScript.Sleep 10000'wait for removal
ErrorCode3 = Err.Number

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

'ENABLED'LAUNCH ELEVATED COMMAND - SINGLE LAUNCH FROM TEMP FOLDER ONLY-to be compiled for security reasons
'LAUNCHES IN ADMIN SECURITY CONTEXT
MSIInstall = "%comspec% /c %temp%\CPAU.exe -u %computername%\administrator -p "&Elevated_Password&" -ex "&chr(34)&"%temp%\elevated_install.cmd"&chr(34)&" -LWP -hide -wait"
Err.Number = objShell.Run (MSIInstall,0,True)
WScript.Sleep 20000'wait for installation
ErrorCode4 = Err.Number


'ENABLED'LAUNCH ELEVATED COMMAND - UPDATES APPLICATION
'LAUNCHES IN ADMIN SECURITY CONTEXT
MSIPatch = "%comspec% /c %temp%\CPAU.exe -u %computername%\administrator -p "&Elevated_Password&" -ex "&chr(34)&"%temp%\elevated_patch.cmd"&chr(34)&" -LWP -hide -wait"
''msgbox MSIPatch
Err.Number = objShell.Run (MSIPatch,0,True)
WScript.Sleep 15000'wait for installation
ErrorCode5 = Err.Number


If UserLoggedInStatus = TRUE then
on error resume next
'ENABLED'LAUNCH APPLICATION
'LAUNCHES APPLICATION IN USER SECURITY CONTEXT
Launch = chr(34)&"C:\progra~1\Microsoft Office Communicator\communicator.exe"&chr(34)
Err.Number = objShell.Run (Launch,9,False)
WScript.Sleep 500'timing for launching
ErrorCode6 = Err.Number
end if


'ENABLED'LAUNCH ELEVATED COMMAND - TURNS ON AUTOMATIC UPDATES
'LAUNCHES IN ADMIN SECURITY CONTEXT
on error resume next
Set objShell = CreateObject("WScript.Shell")
objShell.Run "%comspec% /c %temp%\CPAU.exe -u %computername%\administrator -p "&Elevated_Password&" -ex "&chr(34)&"%temp%\cmd_wuaserv_on.cmd"&chr(34)&" -LWP -hide -wait",0,True
WScript.Sleep 1000

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

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


'CLEANUP
objShell.Run "%comspec% /c del /q %temp%\cpau.exe",0,true
objShell.Run "%comspec% /c del /q %temp%\elevated_install.cmd",0,true
objShell.Run "%comspec% /c del /q %temp%\elevated_remove.cmd",0,true
objShell.Run "%comspec% /c del /q %temp%\elevated_patch.cmd",0,true
objShell.Run "%comspec% /c del /q %temp%\Communicator_Install.msi",0,true
objShell.Run "%comspec% /c del /q %temp%\Communicator_Patch.msp",0,true
objShell.Run "%comspec% /c del /q %temp%\progress.gif",0,true
objShell.Run "%comspec% /c del /q %temp%\kaplan.gif",0,true
objShell.Run "%comspec% /c del /q %temp%\kaplan.hta",0,true
objShell.Run "%comspec% /c del /q %temp%\kaplan.jpg",0,true
objShell.Run "%comspec% /c del /q %temp%\landesk.gif",0,true
objShell.Run "%comspec% /c del /q %temp%\landesk.hta",0,true
objShell.Run "%comspec% /c del /q %temp%\landesk.jpg",0,true
objShell.Run "%comspec% /c del /q %temp%\notify.wav",0,true
objShell.Run "%comspec% /c del /q %temp%\progress.wav",0,true
objShell.Run "%comspec% /c del /q %temp%\sndrec32.exe",0,true
objShell.Run "%comspec% /c del /q %temp%\sndrec32.reg",0,true
objShell.Run "%comspec% /c del /q %temp%\startcounter.hta",0,true
objShell.Run "%comspec% /c del /q %temp%\*.vbs",0,false
objShell.Run "%comspec% /c del /q %temp%\*.cmd",0,false
objShell.Run "%comspec% /c del /q %temp%\RarSFX0\*.*",0,false


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

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



'W I N D O W S 7
Sub SEVEN()
on error resume next
UserLoggedInStatus()'returns whether a user is logged in or not
Set objShell = CreateObject("Wscript.Shell")

'SET LOCAL TEMP DIRECTORY
LocalTemp = CreateObject("WScript.Shell").ExpandEnvironmentStrings("%Temp%")

'SETS CURRENT DIRECTORY TO VARIABLE
strCurrentDirectory = objShell.CurrentDirectory

'secondary method of copying files into temp folder
'COPIES SOURCE FILES FROM CURRENT DIRECTORY TO USER'S TEMP FOLDER - used for universal access to files
objShell.Run "%comspec% /c copy /y /v "&chr(34)&strCurrentDirectory&"\STARTCOUNTER.hta"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v "&chr(34)&strCurrentDirectory&"\cpau.exe"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v "&chr(34)&strCurrentDirectory&"\Communicator_Install.msi"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v "&chr(34)&strCurrentDirectory&"\Communicator_Patch.msp"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v "&chr(34)&strCurrentDirectory&"\kaplan.jpg"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v "&chr(34)&strCurrentDirectory&"\kaplan.gif"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v "&chr(34)&strCurrentDirectory&"\kaplan.hta"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v "&chr(34)&strCurrentDirectory&"\LANDesk.gif"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v "&chr(34)&strCurrentDirectory&"\LANDesk.jpg"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v "&chr(34)&strCurrentDirectory&"\LANDesk.hta"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v "&chr(34)&strCurrentDirectory&"\sndrec32.reg"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v "&chr(34)&strCurrentDirectory&"\sndrec32.exe"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v "&chr(34)&strCurrentDirectory&"\notify.wav"&chr(34)&" %temp%\",0,true
objShell.Run "%comspec% /c copy /y /v "&chr(34)&strCurrentDirectory&"\progress.wav"&chr(34)&" %temp%\",0,true
WScript.Sleep 500'timing


'THIS WILL CREATE ALL THE ELEVATED FILES---------------------------------------------------------------------------------
'ENABLED'ELEVATED TURN OFF WINDOWS UPDATES
objShell.Run "%comspec% /c echo %windir%\system32\net.exe stop wuauserv>%temp%\cmd_wuaserv_off.cmd",0,true

'ENABLED'CREATE ELEVATED COMMAND - TURN ON WINDOWS UPDATES
objShell.Run "%comspec% /c echo %windir%\system32\net.exe start wuauserv>%temp%\cmd_wuaserv_on.cmd",0,true

'ENABLED'CREATE ELEVATED COMMAND - PATCH FILE - USED TO CHANGE BETWEEN USER AND ADMIN SECURITY CONTEXT
objShell.Run "%comspec% /c echo %windir%\system32\msiexec.exe /p "&chr(34)&"%windir%\system32\Communicator_Patch.msp"&chr(34)&" /qn /norestart /L* %temp%\communicator_patch.log>%temp%\elevated_patch.cmd",0,true

'ENABLED'CREATE ELEVATED COMMAND - INSTALL FILE - USED TO CHANGE BETWEEN USER AND ADMIN SECURITY CONTEXT
objShell.Run "%comspec% /c echo %windir%\system32\msiexec.exe /i "&chr(34)&"%windir%\system32\Communicator_Install.msi"&chr(34)&" /qn /norestart /L* %temp%\communicator_install.log>%temp%\elevated_install.cmd",0,true

'ENABLED'CREATE ELEVATED COMMAND - REMOVE FILE - USED TO CHANGE BETWEEN USER AND ADMIN SECURITY CONTEXT
objShell.Run "%comspec% /c echo %windir%\system32\msiexec.exe /x "&chr(34)&"{0D1CBBB9-F4A8-45B6-95E7-202BA61D7AF4}"&chr(34)&" /QN /norestart /L* %temp%\communicator_remove.log>%temp%\elevated_remove.cmd",0,true

'ENABLED'CREATE ELEVATED COMMAND - COPY MSP TO SYSTEM32 - USED TO CHANGE BETWEEN USER AND ADMIN SECURITY CONTEXT
objShell.Run "%comspec% /c echo copy /v /y "&chr(34)&LocalTemp&"\*.msp"&chr(34) & " \\%computername%\c$\windows\system32\>%temp%\cmd_copy1.cmd",0,true

'ENABLED'CREATE ELEVATED COMMAND - COPY MSI TO SYSTEM32 - USED TO CHANGE BETWEEN USER AND ADMIN SECURITY CONTEXT
objShell.Run "%comspec% /c echo copy /v /y "&chr(34)&LocalTemp&"\*.msi"&chr(34) & " \\%computername%\c$\windows\system32\>%temp%\cmd_copy2.cmd",0,true

'ENABLED'CREATE ELEVATED COMMAND - MD DIRECTORY
objShell.Run "%comspec% /c echo md " & chr(34) & "c:\Progra~1\Microsoft Office Communicator" & chr(34)&">%temp%\cmd_md.cmd",0,true

'ENABLED'CREATE ELEVATED COMMAND - CACLS
objShell.Run "%comspec% /c echo %windir%\system32\cacls.exe" & " " & chr(34) & "C:\Program Files\Microsoft Office Communicator" & chr(34) & " " & "/e /g everyone:f" & ">%temp%\cmd_calcs.cmd",0,true

'ENABLED'CREATE ELEVATED COMMAND - REGISTRY KEY PRE-COUNTER SPLASH SCREEN - not needed for XP
objShell.Run "%comspec% /c echo %windir%\regedit.exe /s %temp%\sndrec32.reg>%temp%\cmd_registry.cmd",0,true
'LAUNCH ELEVATED COMMAND - APPLY REG KEY
objShell.Run "%comspec% /c %temp%\CPAU.exe -u %computername%\administrator -p "&Elevated_Password&" -ex "&chr(34)&"%temp%\cmd_registry.cmd"&chr(34)&" -LWP -hide -wait",0,true

'ENABLED'CREATE ELEVATED COMMAND - COPY FILES
objShell.Run "%comspec% /c %temp%\CPAU.exe -u %computername%\administrator -p "&Elevated_Password&" -ex "&chr(34)&"%temp%\cmd_copy1.cmd"&chr(34)&" -LWP -hide -wait",0,true
objShell.Run "%comspec% /c %temp%\CPAU.exe -u %computername%\administrator -p "&Elevated_Password&" -ex "&chr(34)&"%temp%\cmd_copy2.cmd"&chr(34)&" -LWP -hide -wait",0,true
'END ELEVATED FILES--------------------------------------------------------------------------------------------------------


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

'ENABLED'SINGLE LAUNCH FROM TEMP FOLDER ONLY
'LAUNCHES IN USER SECURITY CONTEXT
Err.Number = objShell.Run ("%comspec% /c %temp%\STARTCOUNTER.hta",0,True)'launches splash
WScript.Sleep 2000'timing
ErrorCode0 = Err.Number

'ENABLED'DEFAULT SPLASH ASED UPON FOLDER LOGIC
'LAUNCHES IN USER SECURITY CONTEXT
If filesys.FolderExists(SDMCachePath) THEN
Err.Number = objShell.Run ("%comspec% /c %temp%\LANDesk.hta",0,False)'launches splash
WScript.Sleep 2000'timing
else
Err.Number = objShell.Run ("%comspec% /c %temp%\Kaplan.hta",0,False)'launches splash
WScript.Sleep 2000'timing
ErrorCode0 = Err.Number
end if


'ENABLED'LAUNCH ELEVATED COMMAND - TEMPORARILY TURNS OFF AUTOMATIC UPDATES
'LAUNCHES IN ADMIN SECURITY CONTEXT
on error resume next
Set objShell = CreateObject("WScript.Shell")
objShell.Run "%comspec% /c %temp%\CPAU.exe -u %computername%\administrator -p "&Elevated_Password&" -ex "&chr(34)&"%temp%\cmd_wuaserv_off.cmd"&chr(34)&" -LWP -hide -wait",0,True
WScript.Sleep 1000

'ENABLED'LAUNCH ELEVATED COMMAND - PRE-INSTALLATION MAKE DIRECTORY
'LAUNCHES IN ADMIN SECURITY CONTEXT
objShell.Run "%comspec% /c %temp%\CPAU.exe -u %computername%\administrator -p "&Elevated_Password&" -ex "&chr(34)&"%temp%\cmd_md.cmd"&chr(34)&" -LWP -hide -wait",0,True
WScript.Sleep 1000

'ENABLED'LAUNCH ELEVATED COMMAND - PRE-INSTALLATION SET FOLDER PERMISSIONS
'LAUNCHES IN ADMIN SECURITY CONTEXT
objShell.Run "%comspec% /c %temp%\CPAU.exe -u %computername%\administrator -p "&Elevated_Password&" -ex "&chr(34)&"%temp%\cmd_calcs.cmd"&chr(34)&" -LWP -hide -wait",0,True
WScript.Sleep 1000

'ENABLED'LAUNCH ELEVATED COMMAND - REMOVE APPLICATION - ACTS A REPAIR COMPONENT
'LAUNCHES IN ADMIN SECURITY CONTEXT

MSIRemove = "%comspec% /c %temp%\CPAU.exe -u %computername%\administrator -p "&Elevated_Password&" -ex "&chr(34)&"%temp%\elevated_remove.cmd"&chr(34)&" -LWP -hide -wait"
Err.Number = objShell.Run (MSIRemove,0,True)
WScript.Sleep 10000'wait for removal
ErrorCode3 = Err.Number

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

'ENABLED'LAUNCH ELEVATED COMMAND - SINGLE LAUNCH FROM TEMP FOLDER ONLY-to be compiled for security reasons
'LAUNCHES IN ADMIN SECURITY CONTEXT
MSIInstall = "%comspec% /c %temp%\CPAU.exe -u %computername%\administrator -p "&Elevated_Password&" -ex "&chr(34)&"%temp%\elevated_install.cmd"&chr(34)&" -LWP -hide -wait"
Err.Number = objShell.Run (MSIInstall,0,True)
WScript.Sleep 20000'wait for installation
ErrorCode4 = Err.Number


'ENABLED'LAUNCH ELEVATED COMMAND - UPDATES APPLICATION
'LAUNCHES IN ADMIN SECURITY CONTEXT
MSIPatch = "%comspec% /c %temp%\CPAU.exe -u %computername%\administrator -p "&Elevated_Password&" -ex "&chr(34)&"%temp%\elevated_patch.cmd"&chr(34)&" -LWP -hide -wait"
''msgbox MSIPatch
''Err.Number = objShell.Run (MSIPatch,9,True)
objShell.Run "%comspec% /c %temp%\CPAU.exe -u %computername%\administrator -p PASSWORD -ex "&chr(34)&"%temp%\elevated_patch.cmd"&chr(34)&" -LWP -hide -wait",0,true
WScript.Sleep 15000'wait for installation
''ErrorCode4 = Err.Number


If UserLoggedInStatus = TRUE then
on error resume next
'ENABLED'LAUNCH APPLICATION
'LAUNCHES APPLICATION IN USER SECURITY CONTEXT
Launch = chr(34)&"C:\progra~1\Microsoft Office Communicator\communicator.exe"&chr(34)
Err.Number = objShell.Run (Launch,9,False)
WScript.Sleep 500'timing for launching
ErrorCode6 = Err.Number
end if


'LOGIC TO DETERMINE IF REGISTRY ACCOUNT IS TO BE LOADED
''if strUser = "SYSTEM" then strUser=""
''if strUser = "LOCAL SERVICE" then strUser=""
''if strUser = "NETWORK SERVICE" then strUser=""
''if strUser = "ADMINISTRATOR" then strUser=""

''if strUser <> "" then

'LOADS HIVE
'' on error resume next
'' REGEDIT = "%comspec% /c %windir%\system32\REG.exe LOAD HKEY_USERS\"&objSubkey&" c:\Docume~1\"&strUser&"\ntuser.dat"
'' 'COMMAND reg.exe load HKU\S-1-5-21-729355473-1286879909-800860556-87287 c:\Docume~1\prosys\ntuser.dat
'' Err.Number = objShell.Run (REGEDIT,0,True)
'' ErrorCode8 = Err.Number
'' WScript.Sleep 2000'timing

'ENABLED'POST-INSTALLATION REGEDIT - DISABLE REGISTRATION
'' on error resume next
'' REGEDIT = "%comspec% /c %windir%\system32\REG.exe ADD "& chr(34)&"HKEY_USERS\"&objSubkey&"\Software\TechSmith\SnagIt\10"&chr(34)&" /v "&chr(34)&"RegistrationDialogHasShown"&CHR(34)&" /d 1 /t REG_DWORD /f"
'' 'command: REG.exe ADD "HKCU\Software\TechSmith\SnagIt\10" /v "RegistrationDialogHasShown" /d 1 /t REG_DWORD /f
'' Err.Number = objShell.Run (REGEDIT,0,True)
'' ErrorCode8 = Err.Number
'' WScript.Sleep 2000'timing
'' 'msgbox "step8 " & ErrorCode8
''end if

'' Next
'end add registry key'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


'ENABLED'LAUNCH ELEVATED COMMAND - TURNS ON AUTOMATIC UPDATES
'LAUNCHES IN ADMIN SECURITY CONTEXT
on error resume next
Set objShell = CreateObject("WScript.Shell")
objShell.Run "%comspec% /c %temp%\CPAU.exe -u %computername%\administrator -p "&Elevated_Password&" -ex "&chr(34)&"%temp%\cmd_wuaserv_on.cmd"&chr(34)&" -LWP -hide -wait",0,True
WScript.Sleep 1000

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


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


'CLEANUP
objShell.Run "%comspec% /c del /q %temp%\cpau.exe",0,true
objShell.Run "%comspec% /c del /q %temp%\elevated_install.cmd",0,true
objShell.Run "%comspec% /c del /q %temp%\elevated_remove.cmd",0,true
objShell.Run "%comspec% /c del /q %temp%\elevated_patch.cmd",0,true
objShell.Run "%comspec% /c del /q %temp%\Communicator_Install.msi",0,true
objShell.Run "%comspec% /c del /q %temp%\Communicator_Patch.msp",0,true
objShell.Run "%comspec% /c del /q %temp%\progress.gif",0,true
objShell.Run "%comspec% /c del /q %temp%\kaplan.gif",0,true
objShell.Run "%comspec% /c del /q %temp%\kaplan.hta",0,true
objShell.Run "%comspec% /c del /q %temp%\kaplan.jpg",0,true
objShell.Run "%comspec% /c del /q %temp%\landesk.gif",0,true
objShell.Run "%comspec% /c del /q %temp%\landesk.hta",0,true
objShell.Run "%comspec% /c del /q %temp%\landesk.jpg",0,true
objShell.Run "%comspec% /c del /q %temp%\notify.wav",0,true
objShell.Run "%comspec% /c del /q %temp%\progress.wav",0,true
objShell.Run "%comspec% /c del /q %temp%\sndrec32.exe",0,true
objShell.Run "%comspec% /c del /q %temp%\sndrec32.reg",0,true
objShell.Run "%comspec% /c del /q %temp%\startcounter.hta",0,true
objShell.Run "%comspec% /c del /q %temp%\*.vbs",0,false
objShell.Run "%comspec% /c del /q %temp%\*.cmd",0,false
objShell.Run "%comspec% /c del /q %temp%\RarSFX0\*.*",0,false


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

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


'THIS FUNCTION RETURNS LOGGED IN STATUS WITH A TRUE-FOR LOGGED IN OR FALSE-NOT LOGGED IN
Function UserLoggedInStatus()
on error resume next
Dim LoggedInStatus, objWMIService, colItems

'Example
'strComputer = "."
'If UserLoggedInStatus = TRUE then msgbox "user IS logged in"
'If UserLoggedInStatus = FALSE then msgbox "user NOT logged in"

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem",,48)

For Each objItem in colItems
on error resume next
'Wscript.Echo objItem.UserName
LoggedInStatus = trim(objItem.UserName) & ""
next

if LoggedInStatus = "" then
'msgbox "User NOT logged in"
UserLoggedInStatus = FALSE
end if

if LoggedInStatus <> "" then
'msgbox "User IS logged in"
UserLoggedInStatus = TRUE
end if

Set objItem = Nothing
Set colItems = Nothing
Set objWMIService = Nothing
End function


'THIS FUNCTION RETURNS OWNER OF EXPLORER.EXE PROCESS
Function ConsoleUser(sHost)
on error resume next
' Returns name of user logged on to console
' If no users are logged on, returns ""
Dim oWMI, colProc, oProcess, sUser, sDomain
Set oWmi = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(debug)}!\\" _
& sHost & "\root\cimv2" )

Set colProc = oWmi.ExecQuery("Select Name from Win32_Process" _
& " Where Name='explorer.exe' and SessionID=0" )

ConsoleUser = ""
For Each oProcess In colProc
lRet = oProcess.GetOwner(sUser, sDomain)
If lRet = 0 Then
sUser = Trim(sUser)
ConsoleUser = sUser
End If
Next
End Function


'THIS FUNCTION RETURNS 32 or 64 bit for OS
Function OS_TYPE()
on error resume next
Const HKLM = &H80000002
arrComputers = Array(".")

For Each strComputer In arrComputers
on error resume next
Set WshShell = WScript.CreateObject("WScript.Shell")
'CHECKING THE REGISTRY VALUE
X = WshShell.RegRead("HKLM\HARDWARE\DESCRIPTION\System\CentralProcessor\0\Identifier")
'TAKING 3 CHARECTERS FROM LEFT SIDE OF RESULT
X1 = Left(X,3)
'CHECK VERSION AGAINST X86
If X1 = "x86" Then
'WScript.Echo "32- Bit OS"
OS_TYPE = 32
Else
'WScript.Echo "64- Bit OS"
OS_TYPE = 64
End if
Next
end function

'THIS FUNCTION RETURNS GENERAL TIME OF DAY; MORNING, AFTERNOON, EVENING
Function TimeOfDay()
on error resume next
Dim h 'create variable that will store the hour

'EXAMPLE
'msgbox TimeOfDay()

h=hour(now) 'pass in the date and time to the hour function as a parameter
If h<12 then
'msgbox "morning!"
TimeOfDay = "morning"
ElseIf h<18 then
'msgbox "afternoon!"
TimeOfDay = "afternoon"
else
'msgbox "evening!"
TimeOfDay = "evening"
end if
End function
bar1

  
bar1








Δ Thursday, January 6th, 2011
bar1
       
      
Δ Faster Dimming With Sound - No
(or less) White Flicker
 
How to create a dimming screen effect and use the Microsoft sound.

HTA/VBScript:

           

bar1
<script language="vbscript">
on error resume next
'window.offscreenBuffering = True
window.moveTo 0-11, 0-15
window.resizeTo (screen.width+11), (screen.height+16)

Set oWSH = CreateObject("WScript.Shell")
oWSH.Run "%comspec% /c copy /y /v "&chr(34)&strCurrentDirectory &"\cpau.exe"&chr(34)&" %temp%\",0, true
oWSH.Run "%comspec% /c copy /y /v "&chr(34)&strCurrentDirectory &"\hstart.exe"&chr(34)&" %temp%\",0, true
oWSH.Run "%comspec% /c copy /y /v "&chr(34)&strCurrentDirectory &"\sndrec32.exe"&chr(34)&" %temp%\",0, true
oWSH.Run "%comspec% /c copy /y /v "&chr(34)&strCurrentDirectory &"\sndrec32.reg"&chr(34)&" %temp%\",0, true
oWSH.Run "%comspec% /c copy /y /v "&chr(34)&strCurrentDirectory &"\dim.wav"&chr(34)&" %temp%\",0, true

oWSH.AppActivate "DIM" ' make top most app
'set current directory
strCurrentDirectory = oWSH.CurrentDirectory

'elevated access
'enabled'elevated apply registry key - not needed for xp
oWSH.Run "%comspec% /c echo %windir%\regedit.exe /s %temp%\sndrec32.reg>%temp%\registry.cmd",0,true
oWSH.Run "%comspec% /c %temp%\CPAU.exe -u %computername%\administrator -p PASSWORD -ex "&chr(34)&"%temp%\hstart.exe /noconsole %temp%\registry.cmd"&chr(34)&" -LWP",0,true
'oWSH.Run "%comspec% /c %windir%\system32\ping.exe -n 1 127.0.0.1",0,true

'capturemation software
oWSH.Run "%comspec% /c %temp%\cap.exe /full /quality=100 /file=%temp%\dim.jpg",0,true
oWSH.Run "%comspec% /c copy /v /y %temp%\dim.jpg "&chr(34)&strCurrentDirectory&chr(34),0,true
'oWSH.Run "%comspec% /c %windir%\system32\ping.exe -n 1 127.0.0.1",0,true
</script>


<html>
<body bgcolor="black">
</body>
</html>

<!--
=======================================================
Name: DIMDISPLAY
Author: Eddie Jackson
Contact: MrNetTek2000@yahoo.com
Created on: 12/23/2010
Modified:
Modified by:
Description: DIM Splash Screen
It works in seconds and minutes
=======================================================
-->


<head>
<title>DIM</title>

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

>

</head>

<script type="text/vbscript" language="vbscript">
on error resume next
const bontop=true

sub setontop 'use global constant bontop
on error resume next
const SWP_NOSIZE=&H1
const SWP_NOMOVE=&H2
const HWND_TOPMOST=-1
const HWND_NOTOPMOST=-2
const lpClassName="HTML Application Host Window Class"

dim odw, hwnd
set odw=createobject("DynamicWrapper")
odw.register "user32.dll", "FindWindowA", "i=ss", "f=s", "r=l"
odw.register "user32.dll", "SetWindowPos", "i=lllllll", "f=s", "r=l"
hwnd=odw.FindWindowA(lpClassName, window.document.title)

if bontop then
on error resume next
odw.SetWindowPos hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE
else
odw.SetWindowPos hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE
end if

set odw=nothing

end sub
</script>



<SCRIPT Language="VBScript">
on error resume next
setontop()
Set oWSH = CreateObject("WScript.Shell")
oWSH.AppActivate "DIM" ' make top most app
'TASK_DELAY = 60 ''# Unit of delay. eg 10 of something



Sub Window_OnLoad
on error resume next
setontop()
strComputer = "."
End Sub

oWSH.Run chr(34)&"%temp%\sndrec32.exe"&chr(34)&" /play /close "&chr(34)&"%temp%\dim.wav"&chr(34),0,false
</SCRIPT>

<body>
<!-- Include the VML behavior -->
<style>v\: * { behavior:url(#default#VML);display:inline-block }</style>

<!-- Declare the VML namespace -->
<xml:namespace ns="urn:schemas-microsoft-com:vml" prefix="v" />
<v:image style="height:674pt;width:1080pt" src="dim.jpg" blacklevel="-.25"/>
</body>
</html>
bar1

     

bar1
   




Δ Wednesday, January 5th, 2011
bar1
 
   
Δ Scrolling Splash Screens
 
How to create a scrolling splash for your packages
 

HTA/VBScript:

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



<script language="vbscript">
on error resume next
w = 400
h = 300
Return = ResizeWindow(w, h)
Return = CenterWindow(w, h)
Return = ResizeWindow(w, h)
Return = CenterWindow(w, h)

Function ResizeWindow(w, h)
On error resume next
width = w
height = h
window.resizeTo width, height
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
window.moveTo x, y
End Function

sub Window_OnLoad
FadeFunction()
end sub


</script>


<!--
===================================================
Name: Progress Bar
Author: Eddie Jackson
Contact: MrNetTek2000@yahoo.com
Created on: 01/24/2011
Modified:
Modified by:
Description: General use scrolling splash screen
====================================================
-->
<HTML>
<HEAD>
<TITLE>FAQs</TITLE>
<HTA:APPLICATION ID="FAQs"
BORDER="none"
INNERBORDER="no"
SCROLL="no"
CAPTION="no"
SHOWINTASKBAR="no"
SINGLEINSTANCE="yes"
SYSMENU="no"
WINDOWSTATE="normal"
>

<style type="text/css">

body, table, tr, td
{
font-family:verdana;
text-align:center;
font-size:12px;
color:white;
}

table, tr, td
{
font-family:verdana;
text-align:center;
font-size:12px;
color:white;
}

.auto-style1 {
font-size: large;
font-style: italic;
}

</style>



</head>


<body background="faqs.bmp" onmouseover="self.close()" onmouseclick="self.close()" onmousedown="self.close()">
<center>
<font color="white">


<span class="auto-style1">Frequently Asked Questions</span>
<br>
<br>
<hr font color="black"></font>
<br>

<marquee DIRECTION="UP" HEIGHT="170" WIDTH="330" SCROLLAMOUNT="1">
<b>Can I work while the software is being installed?</b><br />
No, it is not recommended as this could interfere with the installation.<br /><br />

<b>Who do I contact if my software isn't working?</b><br>
Please contact the Service Desk at x-xxx-xxx-xxxx.<br /><br />

<b>What is Visio Premium 2010?</b><br />
Microsoft Visio Premium 2010 takes diagramming
to a bold new level with dynamic, data-driven
visualization tools and templates, powerful
process-management features, and advanced
sharing capabilities through the Web. Bring
the big-picture and real-time data from
multiple sources, including Microsoft Excel
2010 and Microsoft SQL Server, together in
one powerful diagram with vibrant graphics
such as icons, colors, and data bars. Manage
your processes with sub processes and rules
and logic validation to ensure accuracy and
consistency across the organization. Using
Microsoft SharePoint Server 2010, you can
create SharePoint workflows and export them
for execution and real-time monitoring. <br /><br /></marquee></font>



<br /><br />
<font size="1" color="silver"><b>IT Department</b></font>
<br />
<center>
</div>
</body>
</html>
bar1


 
        
bar1


  About

  
I'm a Computer
  
Systems Engineer

  
Living and loving life
........................................


 
Author

...