Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBSCRIPT application installation on login

Status
Not open for further replies.

gokussx4

Technical User
Jun 9, 2004
11
US
All of my users workstations do not have admin privileges. I want to uninstall one application if it exists and install anoter if it doesn't exist. I have no problem running my current script as admin. ANyone know how i can authenticate the script as admin if it is being started from the login process as a regular user? The runas command won't work for this situation either since that would defeat the purpose of seamless integration for the software change. Below is a copy of the script. Thank you all!

dim filesys, filever, path, oshell, strComputer, oReg, strPath, strPath2, strKeyPath, strKeyPath2, objnetwork, intdrive, objDrives
set filesys = createobject("scripting.filesystemobject")
set oshell = createobject("wscript.shell")
set objnetwork = createobject("wscript.network")
set objDrives = objnetwork.EnumNetworkDrives

const HKEY_LOCAL_MACHINE = &H80000002
const HKEY_CLASSES_ROOT = &H80000000
strComputer = "."

for i = 0 to objDrives.Count -1 step 2
if objDrives.item(i) = "R:" Then
objnetwork.RemoveNetworkDrive "R:"
end if
Next

objnetwork.MapNetworkDrive "R:", "\\phsstorage\rightfaxclients"

Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")

strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{96750BE9-22E1-4B4F-821B-C4A499F821D7}"
oReg.DeleteKey HKEY_LOCAL_MACHINE, strKeyPath

strKeyPath2 = "Installer\Products\9EB057691E22F4B428B14C4A998F127D"
oReg.DeleteKey HKEY_CLASSES_ROOT, strKeyPath2



if not filesys.FolderExists("C:\Program Files\RightFAX\Client") then
if filesys.FolderExists("C:\Program Files\RightFAX\") Then
set WshEnv = oshell.Environment("Process")
WinPath = WshEnv("SystemRoot")&"\System32\notepad.exe"
oshell.Run "R:\remove7.2\setup.exe",2,True
wscript.sleep 30000
end if
end if

strPath = "C:\Documents and Settings\All Users\Start Menu\Programs\Startup\RightFAX Print-to-Fax Driver.lnk"

if filesys.FileExists(strPath) then
filesys.DeleteFile strPath,true
End if

if not filesys.FolderExists("C:\Program Files\RightFAX\Client") then
oshell.Run "R:\setup.exe",2,True
wscript.sleep 30000
end if

if filesys.FileExists("C:\Documents and Settings\All Users\Start Menu\Programs\RightFax system tray icon.lnk") then
strPath2 = "C:\Documents and Settings\All Users\Start Menu\Programs\RightFax system tray icon.lnk"
if not filesys.FileExists("C:\Documents and Settings\All Users\Start Menu\Programs\Startup\RightFax system tray icon.lnk") Then
filesys.CopyFile strpath2,"C:\Documents and Settings\All Users\Start Menu\Programs\Startup\",True
End if
End if

objnetwork.RemoveNetworkDrive "R:",True
 
Have you tried a startup script instead of a login script ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
That did the trick! Sometimes its the simple things we overlook lol :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top