Solved

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

Posted on 2013-06-05
15
450 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
  • 6
  • 5
  • 3
15 Comments
 
LVL 76

Expert Comment

by:arnold
Comment Utility
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
Comment Utility
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 76

Expert Comment

by:arnold
Comment Utility
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
 
LVL 32

Expert Comment

by:sarabande
Comment Utility
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
Comment Utility
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 76

Expert Comment

by:arnold
Comment Utility
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 32

Expert Comment

by:sarabande
Comment Utility
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:Vicki05
Comment Utility
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 32

Accepted Solution

by:
sarabande earned 300 total points
Comment Utility
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
Comment Utility
Thanks for the suggestion
0
 
LVL 32

Expert Comment

by:sarabande
Comment Utility
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
Comment Utility
Sorry Sara,

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

Expert Comment

by:sarabande
Comment Utility
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 32

Expert Comment

by:sarabande
Comment Utility
thanks.

Sara
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now