Vicki05
asked on
Copy files to D drive then to a Removable Drive from a restricted folder
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
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
ASKER
This is not attached to the network. System has 2 user accounts. I just need to copy specific files from the other user. .
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.
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.
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
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
ASKER
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("WScr ipt.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.FileSystemObje ct")
CurrentDir = Replace(WScript.ScriptFull Name,WScri pt.ScriptN ame,"")
msgbox("Current Drive : " + CurrentDir)
The directory changes to C:\Windows\system 32 folder in the messagebox.
'Option explicit
dim oShell
set oShell= Wscript.CreateObject("WScr
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.FileSystemObje
CurrentDir = Replace(WScript.ScriptFull
msgbox("Current Drive : " + CurrentDir)
The directory changes to C:\Windows\system 32 folder in the messagebox.
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.
The information on current dir is where your script is.
There are other methods/functions to identify the current directory.
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
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
ASKER
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.FileSystemObje ct")
CurrentDir = Replace(WScript.ScriptFull Name,WScri pt.ScriptN ame,"")
msgbox("Current Drive : " + CurrentDir)
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.FileSystemObje
CurrentDir = Replace(WScript.ScriptFull
msgbox("Current Drive : " + CurrentDir)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the suggestion
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
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
ASKER
Sorry Sara,
I wish I could change the grade. Is there a way to do that?
I wish I could change the grade. Is there a way to do that?
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
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
thanks.
Sara
Sara
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.