Δ Monday, May 31st 2010
bar1


Δ HTA Auto-Refresh

      Readline Refresh Read


How to auto refresh your HTA and read in updating message

bar1
Here are our specs:
Create HTA counter that will count down in seconds
Changes progress text based upon text file input
bar1

<TITLE>&nbsp;</TITLE>
<META HTTP-EQUIV="Refresh" CONTENT="2;" "">
<HTA:APPLICATION ID="Progress Bar"
BORDER="thick"
INNERBORDER="yes"
SCROLL="no"
CAPTION="yes"
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: lightgray;
}
#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: #dcdcdc;
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>

</HEAD>

<BODY>
<SCRIPT Language="VBScript">
On error resume next
Sub Window_Onload
On error resume next
strComputer = "."
'Return screen resolution
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
On error resume next
w = 400
h = 100
Return = ResizeWindow(w, h)
Return = CenterWindow(w, h)
End Sub

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

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

'This reads in the progress message
ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("YourMessageFile.txt", ForReading)
strLine = objFile.ReadLine
'msgbox strLine
DataArea.InnerHTML = strLine
objFile.Close

End Function

</SCRIPT>
<center>
<h4><span id=DataArea></span></h4>
<IMG src="progress.gif" application="yes" width="100%" height="35%" marginwidth="0" marginheight="0" frameborder="0">

</IMG>

bar1






Δ Friday, May 28th 2010
bar1

Δ
Install Printer For A No-Access User
      Shell VBScript


This allows a no-access user to temporarily use the defined printer
 
@Echo off
Title Connect to printer
echo On error resume next>%temp%\installprinter.vbs
echo Set WshNetwork = WScript.CreateObject("WScript.Network")>>%temp%\installprinter.vbs
echo PrinterPath="\\server\printername">>%temp%\installprinter.vbs

echo WshNetwork.RemovePrinterConnection PrinterPath, true, true>>%temp%\installprinter.vbs
echo WshNetwork.RemovePrinterConnection "LPT1", true, true>>%temp%\installprinter.vbs
rem Security Context - Username Account
echo WshNetwork.AddPrinterConnection "LPT1", PrinterPath, True, "domain\username", "password">>%temp%\installprinter.vbs
echo WshNetwork.AddWindowsPrinterConnection PrinterPath, "domain\username", "password">>%temp%\installprinter.vbs
%temp%\installprinter.vbs
echo.>%temp%\installprinter.vbs




Δ
Runas + Hstart + SubinAcl + Sanur + Text Token

Changing permissions on folders

 
IF NOT EXIST "%USERPROFILE%\perm.txt" (
ECHO SubInAcl.exe /subdirectories "c:\Documents and Settings\No_Access_User" /SETOWNER=domain\username /grant=everyone=F>%temp%\extrasetperm.cmd
ECHO if exist "c:\Documents and Settings\No_Access_User.%computername%" SubInAcl /subdirectories "c:\Documents and Settings\No_Access_User.%computername%" /SETOWNER=domain\username /grant=everyone=F>>%temp%\extrasetperm.cmd

ECHO SubInAcl.exe /subdirectories "c:\Documents and Settings\No_Access_User\*.*" /SETOWNER=domain\username /grant=everyone=F>>%temp%\extrasetperm.cmd
ECHO if exist "c:\Documents and Settings\No_Access_User.%computername%" SubInAcl /subdirectories "c:\Documents and Settings\No_Access_User.%computername%\*.*" /SETOWNER=domain\username /grant=everyone=F>>%temp%\extrasetperm.cmd
RUNAS /u:domain\username "c:\windows\system32\hstart.exe /noconsole %temp%\extrasetperm.cmd" | c:\windows\system32\pw.exe password
ECHO permissions set > "%USERPROFILE%\perm.txt"
)

Syntax
      RUNAS [/profile] [/env] [/netonly] /user:user Program

Key
   /profile   Option to load the user's profile (registry)
   /env       Use current environment instead of user's.
   /netonly   Use the credentials specified only for remote connections.
   /user      Username in form USER@DOMAIN or DOMAIN\USER (USER@DOMAIN is not compatible with /netonly)
   Program    The command to execute


bar1







Δ
Thursday, May 27th 2010
bar1



Δ
Adobe Reader Command Line Printing

Silent installation for  Adobe Reader

command1 = chr(34)&"C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe"&chr(34)&" /t "&chr(34)&"c:\Documents and Settings\*.pdf"&chr(34)&" "&"\\server\printname"


Δ Runas + MSHTA + Sanur

* How to runas an HTA file *

runas /U:domain\username "c:\windows\system32\mshta.exe \"C:\Program Files\YourHTA.hta\"" | "c:\windows\system32\pw.exe" password

Syntax
     
RUNAS [/profile] [/env] [/netonly] /user:user Program

Key
   /profile    Option to load the user's profile (registry)
   /env        Use current environment instead of user's.
   /netonly   Use the credentials specified only for remote connections.
   /user       Username in form USER@DOMAIN or DOMAIN\USER
                 (USER@DOMAIN is not compatible with /netonly)
   Program   The command to execute

bar1






Δ
Tuesday, May 25th 2010
bar1


Δ
Automated Client Backups Into Timestamped Folder Shell For Else

Quick and easy way of performing compressed backups of specified folders
 

@ECHO OFF
title Backuping Up Client Workstations
setLocal EnableDelayedExpansion

:MAIN
@rem DATE STAMP
for /f "tokens=2-4 skip=1 delims=(-./)" %%i in ('echo.^|date') do (
for /f "tokens=1-4 delims=-./ " %%m in ('date /t') do ((set dow=%%m)&(set %%i=%%n)&(set %%j=%%o)&(set yy=%%p)))
For /F "tokens=1,2 delims=:, " %%i in ('TIME /T') Do (Set HHMM=%%i%%j)
SET datedone=%yy%%mm%%dd%


:BACKUP
@rem VERIFY ONLINE STATUS
for /f "tokens=* delims= " %%a in (c:\panel\testing\mstcomputers.txt) do (
ping %%a -n 1 -w 100 | find "Reply">nul
if errorlevel 1 (echo %%a is Offline & echo %date% %time%, %%a >> c:\panel\testing\offline.txt

) else (
@rem CREATE TIME STAMP FOR FOLDER
title Backing Up Client Workstation: %%a
Echo Processing...
For /F "tokens=1,2 delims=:, " %%i in ('TIME /T') Do (Set HHMM=%%i%%j)
FOR /f "tokens=*" %%c IN ('DIR \\%%a\c$\docume~1 /b /ad') DO (

@rem CREATES REQUIRED FOLDERS ON SERVER
md "\\Server\Share\%%a\%yy%%mm%%dd%-%HHMM%\%%c"
md "\\Server\Share\%%a\%yy%%mm%%dd%-%HHMM%\%%c\My Documents\"
md "\\Server\Share\%%a\%yy%%mm%%dd%-%HHMM%\%%c\Desktop"
md "\\Server\Share\%%a\%yy%%mm%%dd%-%HHMM%\%%c\Favorites"

@rem NORMAL BACKUP
rem xcopy "\\%%a\c$\docume~1\%%c\My Documents\*.*" /s /e /c "\\Server\Share\%%a\%yy%%mm%%dd%-%HHMM%\%%c\My Documents"
rem xcopy "\\%%a\c$\docume~1\%%c\Desktop\*.*" /s /e /c "\\Server\Share\%%a\%yy%%mm%%dd%-%HHMM%\%%c\Desktop"
rem xcopy "\\%%a\c$\docume~1\%%c\Favorites\*.*" /s /e /c "\\Server\Share\%%a\%yy%%mm%%dd%-%HHMM%\%%c\Favorites"

@rem COMPRESSED BACKUP
dir /o:n /s "\\%%a\c$\docume~1\%%c\My Documents\*.*" > "\\Server\Share\%%a\%yy%%mm%%dd%-%HHMM%\%%c\My Documents Manifest.txt"
pkzipc -add -directories=relative "\\Server\Share\%%a\%yy%%mm%%dd%-%HHMM%\%%c\My Documents\%yy%%mm%%dd%-%HHMM%.zip" "\\%%a\c$\docume~1\%%c\My Documents\*.*"
dir /o:n /s "\\%%a\c$\docume~1\%%c\Desktop\*.*" > "\\Server\Share\%%a\%yy%%mm%%dd%-%HHMM%\%%c\Desktop Manifest.txt"
pkzipc -add -directories=relative "\\server\Share\%%a\%yy%%mm%%dd%-%HHMM%\%%c\Desktop\%yy%%mm%%dd%-%HHMM%.zip" "\\%%a\c$\docume~1\%%c\Desktop\*.*"
dir /o:n /s "\\%%a\c$\docume~1\%%c\Favorites\*.*" > "\\Server\Share\%%a\%yy%%mm%%dd%-%HHMM%\%%c\Favorites Manifest.txt"
pkzipc -add -directories=relative "\\Server\Share\%%a\%yy%%mm%%dd%-%HHMM%\%%c\Favorites\%yy%%mm%%dd%-%HHMM%.zip" "\\%%a\c$\docume~1\%%c\Favorites\*.*"

@rem LOG
echo %date% %time%, %%a >> c:\panel\testing\online.txt
)
)
)
@rem TESTING - 60 seconds
cls
Echo Sleeping for 60 seconds...
sleep 60

@rem 24 HOURS
@rem sleep 86400
goto main
:END

bar1







Δ
Monday, May 24th 2010
bar1

Δ
Read/Writing Text File - Building/Using Object Dictionary

Manipulating text files for input, output, and variable assignment
 

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objDictionary = CreateObject("Scripting.Dictionary")
Const ForReading = 1

Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("c:\windows\temp\ProfilesinPath.txt", True)

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFldr = objFSO.GetFolder("C:\Documents and Settings")
Set Fldrs = objFldr.SubFolders
For Each Fldr In Fldrs
'Wscript.Echo Fldr

'THIS WRITES THE PROFILE PATH TO A TEXT FILE
a.WriteLine(fldr)
Next
'CLOSES THE FILE FOR WRITING
a.Close


Set objFile = objFSO.OpenTextFile ("c:\windows\temp\ProfilesinPath.txt", ForReading)
i = 0
Do Until objFile.AtEndOfStream
strNextLine = objFile.Readline

'FILTERS - ADD FOLDERS YOU DON'T WANT TO PROCESSED HERE
'THIS WILL CLEANUP(remove from processing) WHAT PROFILES CAN BE ACCESSED BY THE EXECUTION PART OF THE SCRIPT
If strNextLine = "C:\Documents and Settings\All Users" then strNextLine = ""
If strNextLine = "C:\Documents and Settings\Local Administrator" then strNextLine = ""
If strNextLine = "C:\Documents and Settings\LocalService" then strNextLine = ""
If strNextLine = "C:\Documents and Settings\NetworkService" then strNextLine = ""
If strNextLine = "C:\Documents and Settings\Guest" then strNextLine = ""
If strNextLine <> "" Then

'THIS BUILDS YOUR OBJECT DICTIONARY EXCLUDING THE ABOVE FILTERS
objDictionary.Add i, strNextLine
End If
i = i + 1
Loop
'CLOSES THE FILE FOR READING
objFile.Close


'EXECUTION PART OF THE SCRIPT
'YOU COULD COPY AND REMOVE FILES TO THESE PROFILES VIA THIS METHOD
For Each strLine in objDictionary.Items
WScript.Echo strLine

'YOUR CODE GOES HERE, EACH PROFILE LISTED IN DICTIONARY WILL BE EFFECTED

Next

bar1







Δ
Thursday, May 20th 2010
bar1

Δ
Read Files In Folder

How to read file names in folder and assign to a variable
 

On Error Resume Next
Dim fso, folder, files, NewsFile,sFolder

Set fso = CreateObject("Scripting.FileSystemObject")
sFolder = Wscript.Arguments.Item(0)
If sFolder = "" Then
sFolder = "C:\windows\system32"
End If
Set NewFile = fso.CreateTextFile(sFolder&"\ReadFilesInFolder.txt", True)
Set folder = fso.GetFolder(sFolder)
Set files = folder.Files

For each folderIdx In files
NewFile.WriteLine(folderIdx.Name)
Next

NewFile.Close



Δ Ftp Script

Setting up the FTP command text file

username
password
ascii
cd eddiejackson.22web.net
cd htdocs
cd _SITEBAK
lcd c:\panel\ftp\_SITEBAK\files
mput *.*
quit

FTP -v -d -i -n -g -s:filename -a -A -x:sendbuffer -r:recvbuffer -b:asyncbuffers -w:windowsize host

-v Suppresses display of remote server responses.

-n Suppresses auto-login upon initial connection.

-i Turns off interactive prompting during multiple file transfers.

-d Enables debugging.

-g Disables filename globbing (see GLOB command).

-s:filename Specifies a text file containing FTP commands; the commands will automatically run after FTP starts.

-a Use any local interface when binding data connection.

-A login as anonymous.

-x:send sockbuf Overrides the default SO_SNDBUF size of 8192.

-r:recv sockbuf Overrides the default SO_RCVBUF size of 8192.

-b:async count Overrides the default async count of 3

-w:windowsize Overrides the default transfer buffer size of 65535. host Specifies the host name or IP address of the remote host to connect to.

Notes:
- mget and mput commands take y/n/q for yes/no/quit.
- Use Control-C to abort commands.

bar1





Δ Wednesday, May 19th 2010
bar1



Δ Picasa Silent Installation

Silent install
picasa.exe /S for silent installation
If the /S switch is used Picasa automatically starts up.


Silent uninstall
Use the Uninstall.exe, located in the picasa folder
The uninstall is not completely quiet as it still asks if you wish to remove the database
Using the /S gets rid of all of the prompts except for the Yes/No for the database as stated above.
Be aware that the /S switch must be written in upper case.
You can add /L to it so it doesn't launch picasa. So it would be picasa.exe /S /L


Δ Keep Your HTA On Top Of Other Windows

How to keep your HTA on top of other windows

Do This
regsvr32 dynwrap.dll /c

AND

Add This To Your HTA
 

'<script type="text/vbscript" language="vbscript">
'ref setwindowpos http://msdn.microsoft.com/en-us/library/ms633545%28VS.85%29.aspx
'ref findwindow http://msdn.microsoft.com/en-us/library/ms633499%28VS.85%29.aspx
'ref hand-on http://support.microsoft.com/kb/84251
'ref lpclassname http://blogs.windowsclient.net/tamirk/default.aspx?PageIndex=6

const bontop=true
sub setontop 'use global constant bontop

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'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'window.onload=getRef("setontop")'
</script>

bar1





Δ
Tuesday, May 18th, 2010
bar1


Δ WinPDF Silent Installation

If you are deploying Win2PDF to a large number of computers (50+), Dane Prairie Systems can create a customized version of the Win2PDF install program that will automatically enter license codes and company information for each installed copy of Win2PDF.


Installing Win2PDF 5

The following command line options are supported by the Win2PDF install:

/SILENT, /VERYSILENT
Instructs Setup to be silent or very silent. When Setup is silent the wizard and the background window are not displayed but the installation progress window is. When a setup is very silent this installation progress window is not displayed. Everything else is normal so for example error messages during installation are displayed and the startup prompt is (if you haven't disabled it with the '/SP-' command line option explained above). If a restart is necessary and the '/NORESTART' command isn't used (see below) and Setup is silent, it will display a "Reboot now?" message box. If it's very silent it will reboot without asking.


/NORESTART
Instructs Setup not to reboot even if it's necessary. If you invoke the install with the following command line, it will bypass all user intervention, hide the progress bar, and it will not reboot
even if necessary.


w2pdf.exe /VERYSILENT /NORESTART
The Win2PDF install only has to reboot if you are upgrading a previous installation of Win2PDF.


/SUPPRESSWARNINGS=nowarnings
Instructs Setup to suppress Win2PDF specific warnings that can occur when installing on terminal servers, such as the following message: "Server operating system detected. If you decide to purchase Win2PDF and intend on using the product in a multi user server based application, you must purchase a server license of Win2PDF."


6 Win2PDF

/SUPPRESSMSGBOXES
Instructs Setup to suppress message boxes. Only has an effect when combined with '/SILENT'
and '/VERYSILENT'.

The default response in situations where there's a choice is:

-Yes in a 'Keep newer file?' situation.

-No in a 'File exists, confirm overwrite.' situation.

-Abort in Abort/Retry situations.

-Cancel in Retry/Cancel situations.

-Yes
(=continue) in a DiskSpaceWarning/DirExists/DirDoesntExist/NoUninstallWarning/ExitSetupMessage/
ConfirmUninstall situation.

-Yes (=restart) in a FinishedRestartMessage/UninstalledAndNeedsRestart situation.



5 message boxes are not suppressible:

-The About Setup message box.

-The Exit Setup? message box.

-The FileNotInDir2 message box displayed when Setup requires a new disk to be inserted and the disk was not found.

-Any (error) message box displayed before Setup (or Uninstall) could read the command line parameters.

-Any message box displayed by [Code] support function MsgBox.



/LOG
Causes Setup to create a log file in the user's TEMP directory detailing file installation and [Run] actions taken during the installation process. This can be a helpful debugging aid. For example, if you suspect a file isn't being replaced when you believe it should be (or vice versa), the log file will tell you if the file was really skipped, and why. The log file is created with a unique name based on the current date. (It will not overwrite or append to existing files.)

The information contained in the log file is technical in nature and therefore not intended to be understandable by end users. Nor is it designed to be machineparseable; the format of the file is subject to change without notice.


/LOG="filename"
Same as /LOG, except it allows you to specify a fixed path/filename to use for the log file. If a file with the specified name already exists it will be overwritten. If the file cannot be created, Setup will abort with an error message.



/NOCANCEL
Prevents the user from cancelling during the installation process, by disabling the Cancel button and ignoring clicks on the close button. Useful along with '/SILENT' or '/VERYSILENT'.
bar1





Δ
Monday, May 17th, 2010
bar1



Δ Safari Browser Silent Installation

Safari.exe /quiet /norestart



Δ Flash + Shockwave Silent Installation

Silent install for Flash Player AX (Flash Player Active X)
CMD /C start "" Flash_Installer_10_active_x.exe /Q & ping -n 10 127.0.0.1 & taskkill /f /im Flash_Installer_10_active_x.exe


Δ Silent install for Shockwave for IE and Netscape

CMD /C start "" Shockwave_Installer_Full.exe /S & ping -n 10 127.0.0.1 & taskkill /f /im Shockwave_Installer_Full.exe

Download from http://www.macromedia.com/go/fl_sw_installer

Includes Flash - No YAHOO Toolbar!

Typical -qb- MSI command line.
You will need to set Registry Keys to disable auto updates.

[HKEY_LOCAL_MACHINE\SOFTWARE\Macromedia\FlashPlayer]
"AutoUpdateTest"=""

[HKEY_LOCAL_MACHINE\SOFTWARE\Macromedia\Shockwave 10\AutoUpdate]
@="n"

Quiet Uninstall String
MsiExec.exe -qb- /X{7D1D6A24-65D4-454C-8815-4F08A5FFF12C}

MsiExec.exe /i file.msi /q REBOOT=ReallySuppress



The below script is what I use to deploy Shockwave Player over AD with a GPO. Just copy and paste the text between the "" and change the paths as appropriate.

The script assumes you have the licensed msi-installer available and that the script is run from eg a dfs-share.

It's known that the Shockwave msi-installer only installs correctly for Internet Explorer. The two copy-lines assures you also get Shockwave to play nicely with Firefox without any fuss.

Tested with IE7 and FF3 on WinXP and WinXP x64, and found to work as expected.

---
 
@echo off
echo Installing Shockwave Player v10. Please wait...

if exist "%windir%\System32\Macromed\Shockwave 10\plugin.dll" goto swinstalled else goto install

:install
msiexec /i "domain\dfs\msi\Adobe Players\Shockwave Player 10\sw_lic_full_installer.msi" /qb

echo Adding Firefox plugins...
copy /Y "domain\dfs\msi\Adobe Players\Shockwave Player 10\v11\np32dsw.dll" "%programfiles%\Mozilla Firefox\plugins"
copy /Y "domain.local\dfs\msi\Adobe Players\Shockwave Player 10\v11\ShockwavePlugin.class" "%programfiles%\Mozilla Firefox\plugins"


:swinstalled
---

Uninstall Shockwave Player 11.x:
 
if exist "%WINDIR%\system32\adobe\shockwave 11\unwise.exe" (

"%WINDIR%\system32\adobe\shockwave 11\unwise.exe" /S %WINDIR%\system32\adobe\shockw~1\install.log

reg delete HKLM\SOFTWARE\Adobe\Shockwave 11 /f
)

if exist "%WINDIR%\system32\adobe\shockwave 11" rd /s /q "%WINDIR%\system32\adobe\shockwave 11"



Δ Real Player Silent Installation VBScript filesys appactivate


'To Install

 
On error resume next
'DEFINE VARIABLES
SET oShell = CreateObject("WScript.Shell")
SET filesys = CreateObject("Scripting.FileSystemObject")

'LOGIC
If filesys.FileExists("C:\_ResourceFiles\RealPlayer11Gold.exe") THEN
On error resume next
'SILENT INSTALLATION
strCommand2 = "CMD /C C:\_ResourceFiles\RealPlayer11Gold.exe /s"
oShell.Run strCommand2,0, True
WScript.Quit
END IF

'LOGIC
If NOT filesys.FileExists("C:\_ResourceFiles\RealPlayer11Gold.exe") THEN
On error resume next
'SILENT UNINSTALL
strCommand6 = "CMD /c taskkill /f /im realplay.exe & exit"
oShell.Run strCommand6, True

strCommand5 = "CMD /c taskkill /f /im realsched.exe & exit"
oShell.Run strCommand5, True

strCommand7 = "cmd /c c:\windows\system32\taskkill.exe /f /im msiexec.exe"
oShell.Run strCommand7,0, False

strCommand3 = "CMD /c move "& chr(34)&"C:\Program Files\Real"&chr(34)&" "&chr(34)&"c:\Program Files\Real_Old"&chr(34)
oShell.Run strCommand3, True

strCommand4 = "CMD /c move "& chr(34)&"C:\Program Files\Real"&chr(34)&" "&chr(34)&"c:\Program Files\Real_Old"&chr(34)
oShell.Run strCommand4, True

'To UnInstall
strCommand1 = "CMD /c "&chr(34)&"C:\Program Files\Common Files\Real\Update_OB\r1puninst.exe"&chr(34)&" " &"-all"
oShell.Run strCommand1,0, False

callTESTWINDOW = "cmd /c c:\windows\system32\wscript.exe c:\Windows\System32\UninstallationComplete.vbs"
oShell.Run callTESTWINDOW,0, False
END IF


----------- Separate File -----------

'NAME: UninstallationComplete.vbs

On error resume next

SET oShell = CreateObject("WScript.Shell")
SET filesys = CreateObject("Scripting.FileSystemObject")

strCommand0 = "c:\windows\system32\ping.exe -n 5 127.0.0.1"
oShell.Run strCommand0,0, True

Do
On error resume next
Set objWshShell = Wscript.CreateObject("Wscript.Shell")
check = objWshShell.AppActivate("Uninstallation Complete")
If check = true then

strCommand1 = "cmd /c c:\windows\system32\taskkill.exe /f /im r1puninst.exe"
oShell.Run strCommand1,0, False

strCommand2 = "cmd /c c:\windows\system32\taskkill.exe /f /im r1puninst.exe"
oShell.Run strCommand2,0, False

strCommand3 = "cmd /c c:\windows\system32\taskkill.exe /f /im msiexec.exe"
oShell.Run strCommand3,0, False

strCommand4 = "cmd /c c:\windows\system32\taskkill.exe /f /im msiexec.exe"
oShell.Run strCommand4,0, False

strCommand5 = "cmd /c c:\windows\system32\taskkill.exe /f /im msiexec.exe"
oShell.Run strCommand5,0, False

IF filesys.FileExists("C:\Documents and Settings\All Users\Desktop\RealPlayer.lnk") THEN
On error resume next
filesys.DeleteFile "C:\Documents and Settings\All Users\Desktop\RealPlayer.lnk", FALSE
END IF

IF filesys.FolderExists("c:\Program Files\Real_Old\") THEN
On error resume next
DIM filesys, demofolder
set filesys = CreateObject ("Scripting.FileSystemObject")
foldername = "c:\Program Files\Real_Old"
set demofolder = filesys.GetFolder(foldername)
demofolder.Delete
WScript.Quit
END IF


ELSE
On error resume next
PINGWAIT = "c:\windows\system32\ping.exe -n 2 127.0.0.1"
oShell.Run PINGWAIT,0, True
END IF

Loop




Deployment Information

I installed the Real Player with silent switches, then applied the EULA/other settings via a "after" snapshot MSI.

How to cripple the Music store
-remove
del /s /q C:\Program Files\Real\RealPlayer\DataCache\mstore\mstore.ini
del /s /q C:\Program Files\Real\RealPlayer\DataCache\mstore\mstore.ver
del /s /q C:\Program Files\Real\RealPlayer\DataCache\mstore\mstorehome.ini


How to cripple the "RollingStone" in Music store
rd /s /q "C:\Program Files\Real\RealPlayer\DataCache\RollingStone"

Gracefully disable Real Guide, Music & My Library, and Music store buttons (web search too)
::gracefully disable Real Guide, Music & My Library, Music store, web search too!
::BUT keep \Prefs (keeps prefs menu in order)
::and keep \Formats (CD in Prefs menu will blow up without it)
xcopy "C:\Program Files\Real\RealPlayer\DataCache\prefs\." "%TEMP%\DataCache\prefs\" /s /v
xcopy "C:\Program Files\Real\RealPlayer\DataCache\Formats\." "%TEMP%\DataCache\Formats\" /s /v
Pause
rd /s /q "C:\Program Files\Real\RealPlayer\DataCache"
xcopy "%TEMP%\DataCache\." "C:\Program Files\Real\RealPlayer\DataCache\" /s /v
Del /q "C:\Program Files\Real\RealPlayer\DataCache\Formats\*.bmp"



Accept EULA
[HKEY_CURRENT_USER\Software\RealNetworks\RealPlayer\6.0\Preferences\EulaAcceptedVersion]
@="2"

*Disable the call home on first run*
rd /s /q "C:\Program Files\Real\RealPlayer\Firstrun"

Kill the "Universal Player" feature
By default RealPlayer wants to take all media file associations.
In fact, if you just browse the preferences, *Look* at media types and click OK you've just associated everything to RealPlayer. This reg tweak prevents this.

[HKEY_CURRENT_USER\Software\RealNetworks\RealPlayer\6.0\Preferences\UniversalPlayback]
@="0"

Gracefully disable Message Center completely
del /q "C:\Program Files\Common Files\Real\Update_OB\rnms3270.dll
del /q "C:\Program Files\Common Files\Real\Update_OB\RealOneMessageCenter.exe
rd /s /q "C:\Documents and Settings\%USERNAME%\Application Data\Real\Msg"


Now you can also delete:
[HKEY_CURRENT_USER\Software\RealNetworks\Msg]
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Software\RealNetworks\Msg]

*Remove GoogleDesktopSearch*
"C:\Program Files\Common Files\Real\GToolbar\GDSSetup.exe" -uninstall
pause
rd /s /q "C:\Program Files\Google"

Now truly clean out Google bar
Regsvr32 /u "C:\Program Files\Common Files\Real\GToolbar\BarControl.dll"
pause
rd /s /q "C:\Program Files\Common Files\Real\GToolbar"

Regsvr32 /u "C:\Program Files\Common Files\Real\WeatherBug\MiniBugTransporter.dll"
pause
rd /s /q "C:\Program Files\Common Files\Real\WeatherBug"


Now you can also delete:
[HKEY_CLASSES_ROOT\Software\RealNetworks\Update\6.0\Preferences\Components\gds:1.0]
[HKEY_CLASSES_ROOT\Software\RealNetworks\Update\6.0\Preferences\Components\gtoolbar:6.2]
[HKEY_CLASSES_ROOT\CLSID\{2B96D5CC-C5B5-49A5-A69D-CC0A30F9028C}]
[HKEY_CLASSES_ROOT\Software\RealNetworks\Update\6.0\Preferences\Components\weatherbug:2.0]


Disable Check Update in tools menu
del /q "C:\Program Files\Common Files\Real\Update_OB\rnup3270.dll
del /q "C:\Program Files\Common Files\Real\Update_OB\upgr3270.dll
del /q "C:\Program Files\Common Files\Real\Update_OB\upgrdhlp.exe
del /q "C:\Program Files\Common Files\Real\Update_OB\realsched.exe


rd /s /q "C:\Documents and Settings\%USERNAME%\Application Data\Real\Msg"

Garbage to take out if repackaging\
::not needed since we are doing MSI
rd /s /q "C:\Program Files\Real\RealPlayer\Setup"

Not needed, file are created on the fly. No config info here either:
rd /s /q "C:\Documents and Settings\%USERNAME%\Application Data\Real"
rd /s /q "C:\Documents and Settings\%USERNAME%\Cookies"



Tips on Editting the package
-The prefs.ini is a non Standard INI file. Delete it from the INI section and add it back as a regular file.
del /q C:\Program Files\Real\RealPlayer\DataCache\prefs\prefs.ini

Files -> delete:
del /q \Program Files\Real\RealPlayer\subscription.rnx
de /q \Program Files\Common Files\Real\Update_OB\r1puninst.exe


Shortcuts -> delete:
-RealPlayer Subscription
-Uninstall RealPlayer
-Check for RealPlayer Updates

Registry -> delete:
HKEY_CURRENT_USER\Software\Microsoft\Windows Media\WMSDK\General
(This stuff is created on-the-fly by WMP, not RealPlayer)

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DirectDraw\MostRecentApplication
(This changes everytime an app uses DD)

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
(Prevents RealSched.exe from running)

fix the 1904 errors
With testing, 1904 errors occurred while the package was self-registering DLLs.
-Error 1904. Module C:\Program Files\Real\RealPlayer\rpplugins\MPACore.dll failed to register.
-Error 1904. Module C:\Program Files\Real\RealPlayer\rpplugins\rjmisc.dll failed to register.

I decided to set the order for all self-registering DLLs according to the order to the original RealNetworks' install.  This is the order that I got for the English version:
05-C:\Program Files\Common Files\Real\Update_OB\nprfxins.dll
15-C:\Program Files\Real\RealPlayer\rpplugins\MPACore.dll
20-C:\Program Files\Real\RealPlayer\rpplugins\rjmisc.dll
23-C:\Program Files\Real\RealPlayer\rpplugins\rpcomproxy.dll
28-C:\Program Files\Real\RealPlayer\rpplugins\ierpplug.dll
29-C:\Program Files\Real\RealPlayer\rpplugprot.dll
29-C:\Program Files\Real\RealPlayer\rpshell.dll
30-C:\Program Files\Real\RealPlayer\rdsf3260.dll
30-C:\Program Files\Real\RealPlayer\CDDBRealControl.dll
40-C:\WINDOWS\system32\rmoc3260
61-C:\Program Files\Real\RealPlayer\rpau3260.dll
72-C:\Program Files\Real\RealPlayer\rpshellsearch.dll
76-C:\Program Files\Common Files\xing shared\mpeg encode\xmencmp3.dll
83-C:\Program Files\Real\RealPlayer\plugins\tdwnmgr.dll
84-C:\Program Files\Real\RealPlayer\ierjplug.dll

C:\Program Files\Internet Explorer\PLUGINS\RichFX\Player\nprfxins.dll was also set to self-register in the original MSI package but I decided not to self-register this DLL at all.


prevent the application error with IE, for good
This is the tricky part. At this point you should get a package that gets an application error with IE when RP is used for the first time from within IE. After that everything is ok.
It seems RP keeps a list of what modules it consists of and keeps some kind of hash for each key file. To prevent the error we need to capture what it does to the registry and add those changes into the package.

To do this:
-Install ARM (Active Registry Monitor)
-Open IE to the RP test page.
-Launch ARM to take a snapshot of the registry.
-From inside IE trigger RealPlayer stream, wait for the error.
-Close the Error box and RealPlayer.
-Use ARM to take 2nd snapshot of the registry.
-Use ARM to create a Fix.reg (redo) and an Unfix.reg (undo) file.
the Fix.reg file to remove the garbage and reduce it until you get only what will fix it. Use the UnFix.reg file to undo the fix each time you need to test a smaller fix.reg file.
-Add the contents of the fix.reg file to the package
-Compile a new MSI and test again

Add Profile fixup Active setup
The last this is to add an Active Setup to trigger a profile fixup for each new user.

cacls "C:\\program files\real\RealPlayer" /T /C /E /G "Administrators":F "Power Users":F "Users":F

Remove the registry items that have large keys and then import it using MSI script.

I am using Wise Package Studio 6.01. It's not that difficult. (Provided by theBug) If you want to disable the GoogleToobar setup on the first run add:

HKCU\Software\RealNetworks\RealPlayer\6.0\Preferences\ConfigurationComplete\\Default = 1

I took the information from misterd's post to get a package that installed correctly and did not produce any errors in installation, execution or removal. In order to reduce errors and improve consistency between iterations, I created a batch file that took care of the file operations and a VB script that handled all of the registry operations. I have included these here below for all concerned. Additionally, the Fix.reg file has been included as well.

The package was run as a repackage operation using the Installation Monitoring option in AdminStudio 7.5. The prerequisites for the package included the following:
- no updating allowed
- removal of the realsched component
- automatic registration
- EULA acceptance
- no messaging functions
- no Google components
- no Rhapsody components
- leave Windows Media associations alone

To implement this, I removed all checkboxes relating to the extraneous products and manually assigned the file associations. I cleared the checkboxes that were already assigned to Windows Media Player and left the others checked that pointed to RealPlayer. Before completing the repackage operation, I ran the batch file and the VB Script to remove the undesired information (files and reg settings).

Save the MST. The command line you will want to use will include the following information in addition to whatever parameters you want to use for logging, user interface, etc. I used the following command line:

MSIEXEC /i .MSI TRANSFORMS=.MST /L*vx /quiet /norestart

This gives a silent installation that can be distributed using SMS which is the delivery mechanism we are using here.
The only slight problem with the r1puninst.exe file is that it's not silent - it throws up a popup box to let you know that it's uninstalled the files (even if you use the -all switch)...

To get around it, you could try what I did..

1. Get Resource Hacker
2. Copy r1puninst.exe somewhere
3. Open the copied version in Resource Hacker
4. Open "Dialog"
5. Open "912"
6. Right click on "1033" (should be the "Uninstallation complete" dialog box)
7. Select Delete Resources [912:1033]
8. Click Yes
9. Select File, Save

You should now have a modified version which is silent when using the -all switch.



Δ VNC Silent Installation

This uses InnoSetup so you can do silent installs:

Server only:
vnc-4_1_1-x86_win32.exe /SILENT /COMPONENTS="!vncviewer, winvnc" /TASKS="installservice, launchservice"

Server + Viewer:
vnc-4_1_1-x86_win32.exe /SILENT /COMPONENTS="vncviewer, winvnc" /TASKS="!quicklaunchicon, desktopicon, installservice, launchservice"

By using the ! symbol you can choose to not install a component as demonstrated above. This all works for V4.1.1, I haven't tried with V4.0.

Also you can use /VERYSILENT if you don't want a progress dialogue.

Uninstallation command line:
"C:\Program Files\RealVNC\VNC4\unins000.exe" /VERYSILENT

MSIEXEC

msiexec /Option <Required Parameter> [Optional Parameter]

Install Options

</package | /i> <Product.msi>
Installs or configures a product

/a <Product.msi>
Administrative install - Installs a product on the network

/j<u|m> <Product.msi> [/t <Transform List>] [/g <Language ID>]
Advertises a product - m to all users, u to current user

</uninstall | /x> <Product.msi | ProductCode>
Uninstalls the product

Display Options
/quiet
Quiet mode, no user interaction

/passive
Unattended mode - progress bar only

/q[n|b|r|f]
Sets user interface level
n - No UI
b - Basic UI
r - Reduced UI
f - Full UI (default)

/help
Help information
Restart Options

/norestart
Do not restart after the installation is complete

/promptrestart
Prompts the user for restart if necessary

/forcerestart
Always restart the computer after installation
Logging Options

/l[i|w|e|a|r|u|c|m|o|p|v|x|+|!|*] <LogFile>
i - Status messages
w - Nonfatal warnings
e - All error messages
a - Start up of actions
r - Action-specific records
u - User requests
c - Initial UI parameters
m - Out-of-memory or fatal exit information
o - Out-of-disk-space messages
p - Terminal properties
v - Verbose output
x - Extra debugging information
+ - Append to existing log file
! - Flush each line to the log
* - Log all information, except for v and x options

/log <LogFile>
Equivalent of /l* <LogFile>

Update Options

/update <Update1.msp>[;Update2.msp]
Applies update(s)

/uninstall <PatchCodeGuid>[;Update2.msp] /package <Product.msi | ProductCode>
Remove update(s) for a product Repair Options

/f[p|e|c|m|s|o|d|a|u|v] <Product.msi | ProductCode>
Repairs a product
p - only if file is missing
o - if file is missing or an older version is installed (default)
e - if file is missing or an equal or older version is installed
d - if file is missing or a different version is installed
c - if file is missing or checksum does not match the calculated value
a - forces all files to be reinstalled
u - all required user-specific registry entries (default)
m - all required computer-specific registry entries (default)
s - all existing shortcuts (default)
v - runs from source and recaches local package

Setting Public Properties
[PROPERTY=PropertyValue]


bar1






..About

..
I'm a Computer
..
Systems Engineer

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


..
Author

..