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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Launch VBS on file server from HTML

Status
Not open for further replies.

Mike M

IS-IT--Management
Apr 17, 2020
1
0
0
US
Hello,

I have seen some posts about this but nothing that seems to address my situation.

GOAL:
Copy file from a file server to a local PC location from an HTML link
Launch application after copy of files

WHY?
We use a Java app hosted offsite. When an update is made, new JAVA cache is downloaded to the client stressing the MPLS circuit between us and host.

I can stage the java cache and copy it if changed using a script. The script below works from a desktop icon. I need to do this process from an HTML link because many of our users launch this app from a link on our intranet. Yes, I could eliminate the launch from intranet option but reconditioning 1000 users is not a task I take lightly.

Code in the script checks a trigger file. If the trigger file says update, files are copied and then the app is launched. If there is no update, the app just launches.

<code>
'2/21/2020
'
'Launch APP from Local Network cache
'avoid large downloads over MPLS circuit

'Script wide variables
strUser = CreateObject("Wscript.Network").Username
strLocalPath = "C:\Users\" & strUser & "\appdata\locallow\Sun\Java\Deployment\"
strRemotePath = "\\company.org\network\data\app_stage\cache"

'Read trigger file. 0=No_Update 1=Update
set objFSO = CreateObject("Scripting.FileSystemObject")
set objTriggerFile = objFSO.OpenTextFile("\\company.org\network\data\app_stage\trigger.txt")
strTrigger = objTriggerFile.ReadLine
objTriggerFile.Close
set objFSO = nothing

'Determine if update of local cache is needed
Select Case strTrigger
Case "0"
set objShell = CreateObject("wscript.shell")
objShell.run " set objShell = nothing
Case "1"
resp=MsgBox("There will be slight delay while APP is updated",0,"APP Update")
'Code to update
set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFolder strRemotePath, strLocalPath
'Code to launch
set objShell = CreateObject("wscript.shell")
objShell.run " 'Clear var's
set objFSO = nothing
set objShell = nothing
End Select
</code>

Any help in getting this or something like this to run from intranet would be REALLY appreciated!

TIA!
-Mike M
 
What does the user do? Do they go on to a site and click on a link to run this code?

I'm just wondering whether this can be an hta that they can download and run.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top