We help IT Professionals succeed at work.
Get Started

VB HTA File Copy by Group

winstalla
winstalla asked
on
298 Views
Last Modified: 2015-07-02
I have a VB/HTA login script that is nearly working. However, I want to be able to copy a file from a network share based on an AD Group. I've managed to get it to create shortcuts based on AD, but not this.

Here is the code I'm trying:-
Const bgGroup1 = "ADgroup1"
Const bgFolder1 = "C:\BG\", bgFile1 = "\\DOMAIN\netlogon\bg\file1*"
Set oFSO = CreateObject("Scripting.FileSystemObject")
If Not oFSO.FolderExists(bgFolder1) Then
  oFSO.CreateFolder bgFolder1
End If
oFSO.CopyFile bgFile1, bgFolder1, Overwrite

Const bgGroup2 = "ADgroup2"
Const bgFolder2 = "C:\BG\", bgFile2 = "\\DOMAIN\netlogon\bg\file2*"
Set oFSO = CreateObject("Scripting.FileSystemObject")
If Not oFSO.FolderExists(bgFolder2) Then
  oFSO.CreateFolder bgFolder2
End If
oFSO.CopyFile bgFile2, bgFolder2, Overwrite

Open in new window


It sounds simple, but all it does is copy both File1 and File2 to the machine, which is obviously not what I'm looking for.

To explain, the FileX.bmp file will be renamed later to a standard BG.bmp file for use with BGInfo. That bit's working! It's just this  bit I'm having problems with.

Any help would be gratefully received.

Thanks!
Comment
Watch Question
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2014
Commented:
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE