Solved

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

Posted on 2013-01-25
3
375 Views
Last Modified: 2013-01-26
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.
0
Comment
Question by:gbm33
  • 2
3 Comments
 
LVL 43

Accepted Solution

by:
Steve Knight earned 500 total points
ID: 38820625
Can you get to \\hostserver at all from the virtual one?  Are they are on the same domain for instance?  In fact are they on the same vlan / ip range - quite possible that host and clients can't actually communicate directly.

For starters can you do \\hostserver from the hostserver Run / search button itself?

How about \\x.x.x.x ip address from the virtual machine if needed?

Having got that working (or not) then you are best setting up a share on the USB drive, i.e. share the directory as "test" or whatever with suitable permissions for the share and for ntfs security -- if this isn't a domain you will need suitable login users and, for instance, setup mapped drive using user/password.

What you have at the moment won't work as there isn't going to be a share called H:, you could probably use the administrative share H$ but best creating a specific one.

Steve
0
 

Author Comment

by:gbm33
ID: 38821167
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.
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 38822105
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
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

The environment that this is running in is SCCM 2007 R2 running on a Windows 2008 R2 server. The PXE Distribution point is running on its own Windows 2008 R2 box. This is what Event viewer showed after trying to start the WDS service:  An erro…
TOMORROW TOMORROW.BAT is inspired by a question I get asked over and over again; that is, "How can I use batch file commands to obtain tomorrow's date?" The crux of this batch file revolves around the XCOPY command - a technique I discovered w…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

860 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