Solved

Copy files to D drive then to a Removable Drive from a restricted folder

Posted on 2013-06-05
15
456 Views
Last Modified: 2013-06-10
Hi All,

I need to copy files from a restricted folder to D partition using a VBScript, then transfer it over to a USB drive and the drive letter is not the same everytime. The script would reside on the USB drive. I am not a programmer, and I am still learning.

Please advice.

Vicki
0
Comment
Question by:Vicki05
[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
  • 6
  • 5
  • 3
15 Comments
 
LVL 78

Expert Comment

by:arnold
ID: 39224517
The reference suggests that copying of that data should be done especially not to an external storage.

Since the firm has gone to setup this type of data layout, they might (should have) implanted a restriction to prevent attaching xternal storage.

The peculiarity of copying the data as an intermediary step suggests that this is not something to engage in.
0
 

Author Comment

by:Vicki05
ID: 39224625
This is not attached to the network.  System has 2 user accounts. I just need to copy specific files from the other user. .
0
 
LVL 78

Expert Comment

by:arnold
ID: 39224653
That is the difficulty as it sounds as though you are trying to copy something to which you do not/should not have access.

A backup so long as the user under whose credentials the backup runs has access into that folder, the data will be stored in a backup file.

With your existing access rights, can you get into the folder to see the files?

Any vbscript/powershell script will run with your user rights.  If you are not authorized to access the location using windows explorer i.e. c:\users\username\my documents\files, a script that you run from your USB will not grant you that access.
0
The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

 
LVL 34

Expert Comment

by:sarabande
ID: 39224905
to add to before comments:

both the users should 'move' the 'My Documents' folder to a shared/public drive or folder. then they may grant (read) access for other users without restriction.

Sara
0
 

Author Comment

by:Vicki05
ID: 39225776
From what I have researced yesterday, I know it is possible if you have the administrator privileges. I found this script that elevates the script to run as administrator. I had to convert the other script to exe in order for it to work.

'Option explicit
 dim oShell
 set oShell= Wscript.CreateObject("WScript.Shell")
 oShell.Run "runas /user:administrator ""test2.exe"""
 WScript.Sleep 1000
  oShell.Sendkeys "Hello~"

If the test2 is run on its own and does not have to pick the files from the other user, It works. But in order to pick the files from the other user. I have to use the the runas script to call the test2 script. When the data is backed up to D drive, I tried to move it from there to the flash drive. This is where the the drive path changed to System32 folder.  I was hoping a expert might have a solution or another way to do this?



 Set fso = WScript.CreateObject ("Scripting.FileSystemObject")
 CurrentDir = Replace(WScript.ScriptFullName,WScript.ScriptName,"")
 msgbox("Current Drive : " + CurrentDir)

The directory changes to C:\Windows\system 32 folder in the messagebox.
0
 
LVL 78

Expert Comment

by:arnold
ID: 39225969
Replace deals with the parameters you provide.
The information on current dir is where your script is.
There are other methods/functions to identify the current directory.
0
 
LVL 34

Expert Comment

by:sarabande
ID: 39226150
the runas command is a dangerous command if you want to run it without password input, at least on windows xp. it would run without password input if you store the credentials once to your system. after that, any program/script can use the runas command without password only with administrator name. the only way to make the stored credentials invalid is to change the administrator password.

the reason why this security leak is not misused widely is, that runas does work only on windows xp professional and higher but not on home edition. at windows 7 the help of runas shows that you can't save credentials for home and starter edition. that would mean at home editions you could use the runas but the user has to enter the password any time. in my opinion that is the only mode which should be allowed, or you would open your system for any malware that happens to be executed at your system.

Sara
0
 

Author Comment

by:Vicki05
ID: 39228001
Sara,

I am the admin. I have 2 user programs that run under separate user accounts. I just need to collect the data. I have already figured out how to backup the data to D drive. The problem is when I do a runas  the drive path changes from the flash drive to system32 folder.  


Could someone please tell me why my path of my current drive changes to system32 folder when I use the runas script and provide me with assistance.

 Set fso = WScript.CreateObject ("Scripting.FileSystemObject")
 CurrentDir = Replace(WScript.ScriptFullName,WScript.ScriptName,"")
 msgbox("Current Drive : " + CurrentDir)
0
 
LVL 34

Accepted Solution

by:
sarabande earned 300 total points
ID: 39228161
you can try to add /env to the runas call. it is supposed to keep the current environment (especially the current environment variables) rather then make a new environment based on the user's account, what is in your case the administrator's account. i think that also will make the directory where you started the script to keep current. if not, you could start a script instead of runas command, where you set the current folder to an environment variable. then call the runas from script. because of the /env you would be able to evaluate the environment variable in test.exe.

Sara
0
 

Author Comment

by:Vicki05
ID: 39231003
Thanks for the suggestion
0
 
LVL 34

Expert Comment

by:sarabande
ID: 39231555
a C grade is a rather rude way to say thank you.

an A says 'yes, your comment is a solution'
a B says 'thanks, with your help i found a solution'
a C says 'I got some (useful) information and asked for more, but there was no response anymore'

Sara
0
 

Author Comment

by:Vicki05
ID: 39231790
Sorry Sara,

I wish I could change the grade. Is there a way to do that?
0
 
LVL 34

Expert Comment

by:sarabande
ID: 39232969
yes, you could click on the Request Attention button which is located in your original post (bottom-right). then, a Moderator would help you to correct your decision.

but i care not so much for a grade which was given by accident or because of not knowing the grading conventions. i thank you for your response and don't expect further action from you.

Sara
0
 
LVL 34

Expert Comment

by:sarabande
ID: 39236857
thanks.

Sara
0

Featured Post

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Question has a verified solution.

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

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Six Sigma Control Plans

690 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