Solved

Folder copy script assistance

Posted on 2008-06-24
4
274 Views
Last Modified: 2010-07-27
I have this script (attached) that should remove a folder called VPNClient4x and associated contents and replace it by copying over a folder called VPNClient5x and associated contents.  For some reason it isn't copying over the folder as it should.  Could someone please point me in the right direction? Thanks.
Dim objShell, RegLocate
 
'''Create Message Box Dialog
 
msgbox "Beginning the Zone Labs uninstall and VPN Client 5 install", 0, "Zone Labs Uninstall"
 
Set objShell = WScript.CreateObject("WScript.Shell")
 
'''Close Specific Applications
 
On error resume next
 
objShell.run("tskill iclient /a"), 0, True
 
 
objShell.run("tskill vsmon /a"), 0, True
 
'''Zone Labs Uninstall
 
objShell.run("msiexec.exe /X{45295FCF-B5D0-415E-8348-5C60BEE2A903} INSTALLPASSWORD=dakota1 REBOOTPROMPTWITHSILENT=NO REBOOT=R /qb!"), 0, True
 
'''Delete 2 Folders VPNClient4x and Zone Labs)
Set objFSO = CreateObject ("Scripting.FileSystemObject")
objFSO.DeleteFolder("C:\VPNClient4x")
objFSO.DeleteFolder("C:\Program Files\Zone Labs")
 
'''Copy New VPN Client to Laptop
Const OverWriteFiles = True
objFSO.CopyFolder "VPNClient5x" , "C:\VPNClient5x" , OverWriteFiles
 
'''msgbox "The Uninstall Process Is Complete Please press OK to start installing the VPN Client", 0, "Completed"
 
'''Install VPN 5
objShell.run("c:\VPNClient5x\vpnclient_setup.exe /passive"), 0, True
 
WScript.Quit

Open in new window

0
Comment
Question by:fmcsa004
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 7

Expert Comment

by:__Vortex__
ID: 21860382
You will need to enter the full path of the source:

objFSO.CopyFolder "c:\SourceVPNClient5x" , "C:\VPNClient5x" , Overwrite

V
0
 

Author Comment

by:fmcsa004
ID: 21861349
Shouldn't it accept the default of the script location for source path?  i need it to copy from the same directory source location as the script.
0
 
LVL 7

Accepted Solution

by:
__Vortex__ earned 125 total points
ID: 21863672
You are correct, the folder path does default to wherever the script is.

The script runs for me. i had to comment out the Zone Labs Uninstall command, which was giving me problems.

Do you have any debuggers installed, Visual Studio 2005/2008?

The following command allows you to debug the script:
wscript.exe //d //x C:\test.vbs
Dim objShell, RegLocate
 
'''Create Message Box Dialog
 
msgbox "Beginning the Zone Labs uninstall and VPN Client 5 install", 0, "Zone Labs Uninstall"
 
Set objShell = WScript.CreateObject("WScript.Shell")
 
'''Close Specific Applications
 
 on error resume next
 
objShell.run("tskill iclient /a"), 0, True
objShell.run("tskill vsmon /a"), 0, True
 
'''Zone Labs Uninstall
 
'objShell.run("msiexec.exe /X{45295FCF-B5D0-415E-8348-5C60BEE2A903} INSTALLPASSWORD=dakota1 REBOOTPROMPTWITHSILENT=NO REBOOT=R /qb!"), 0, True
 
'''Delete 2 Folders VPNClient4x and Zone Labs)
Set objFSO = CreateObject ("Scripting.FileSystemObject")
objFSO.DeleteFolder("C:\VPNClient4x")
objFSO.DeleteFolder("C:\Program Files\Zone Labs")
 
'''Copy New VPN Client to Laptop
Const OverWriteFiles = True
objFSO.CopyFolder "VPNClient5x" , "C:\VPNClient5x" , OverWriteFiles
 
msgbox "The Uninstall Process Is Complete Please press OK to start installing the VPN Client", 0, "Completed"
 
'''Install VPN 5
objShell.run("c:\VPNClient5x\vpnclient_setup.exe /passive"), 0, True
 
WScript.Quit

Open in new window

0
 

Author Closing Comment

by:fmcsa004
ID: 31470658
Thanks V.  We were finally able to make it work by moving the copy code further up in the script.  ie:

msgbox "Beginning the Zone Labs uninstall and VPN Client 5 install", 0, "Zone Labs Uninstall"

On error resume next

'''Delete Folder VPNClient4x
Set objFSO = CreateObject ("Scripting.FileSystemObject")
objFSO.DeleteFolder("C:\VPNClient4x")

Set objFSO = CreateObject("Scripting.FileSystemObject")
 
'objFSO.CopyFile strFileOrigination, strFileDestination, OverwriteExisting

'''Copy New VPN Client to Laptop
Const OverWriteFiles = True
objFSO.CopyFolder "VPNClient5x" , "C:\VPNClient5x" , OverWriteFiles

'''Close Specific Applications

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

objShell.run("tskill iclient /a"), 0, True


objShell.run("tskill vsmon /a"), 0, True
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Recently I finished a vbscript that I thought I'd share.  It uses a text file with a list of server names to loop through and get various status reports, then writes them all into an Excel file.  Originally it was put together for our Altiris server…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question