Link to home
Start Free TrialLog in
Avatar of gbm33
gbm33

asked on

script to move files from a virtual server to a USB drive on the host server

I have a Windows 2012 server that is a host to two 2008 virtual servers. There is USB drive connected to the server. It is recognized by the host but not by either of the virtual servers. I have a need to delete and copy files from one of the virtual servers to the USB drive. I would like to use a batch file to schedule a periodic operation. The problem I am having is the code to move across the servers.

Example of the setup and a simple line of code I am attempting:

hostserver has a USB Drive at H: on which there is a test directory.
vserver1
vserver2

The code resides on vserver1

rmdir /s/q "\\hostserver\H:\test"

The error that is returned is "the network name cannot be found."

If I can get the code to see across the server boundries the rest of the code will come easily.
ASKER CERTIFIED SOLUTION
Avatar of Steve Knight
Steve Knight
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gbm33
gbm33

ASKER

dragon-it: I have worked it out with your nudging.  After setting up a share for the USB Drive and allowing others to manipulate the data within the share I have to use a series of net use commands to ensure that I have logged into the hostserver and have permission to do what I desire to do.
Glad that helped.  You can do all and have it remembered:

net use /persistent:yes
net use x: \\hostserver\sharename /user:username password /savecred

If you have all you need select an answer when you are ready or can help more if needed.

Steve