I am having a bit of trouble with batch file I am writing.
First off, the secnario: I am a student worker for an ITT-Tech campus. I was given the task of making a host file to redirect a list of sites, given to me from corp, back to the itt-tech main page, for obvious reasons. Now this is not the issue. I have the host file and it is fine. However, the list is updated almost daily, and while the original file was implamented into our new qaurter image, I can not deploy the file to the 200+ machines on the campus effectively.
So, on to the problem. The host fiel now sits on the campus dc where I can update it as needed day to day. I am in the process of writing a script that grabs the file off the server and replaces it in the sys32 folder where it belongs.
Now of course none of the student accounts have admin rights, again for obvious reasons, so this must be done via administrator. I have a solution to this, but I can not seem to get it to work right.
Here is the test script I am working on:
Note: I have astricted out our dc name, user login, and password for security reasons. This info is not needed for the question I am posing.
Now this is a very simple batch, and I dont understand why it does not function properly. When I run the batch the cmd flashes and closes and I can not see what it is doing, but from my understanding it should work.
I know research is always the best method to solving a problem, and I am continuing to do just that. However, I thought it wise to seek second opinions and outside advice.
Thank you all for taking the time to help me and for reading my post.
-mpiersant@itt-tech.edu
First off, the secnario: I am a student worker for an ITT-Tech campus. I was given the task of making a host file to redirect a list of sites, given to me from corp, back to the itt-tech main page, for obvious reasons. Now this is not the issue. I have the host file and it is fine. However, the list is updated almost daily, and while the original file was implamented into our new qaurter image, I can not deploy the file to the 200+ machines on the campus effectively.
So, on to the problem. The host fiel now sits on the campus dc where I can update it as needed day to day. I am in the process of writing a script that grabs the file off the server and replaces it in the sys32 folder where it belongs.
Now of course none of the student accounts have admin rights, again for obvious reasons, so this must be done via administrator. I have a solution to this, but I can not seem to get it to work right.
Here is the test script I am working on:
Code:
@net use z: \\********\Local\TestA /user:******** password | ********
z:
copy TestDoc.txt \\*********\Local\TestB
Note: I have astricted out our dc name, user login, and password for security reasons. This info is not needed for the question I am posing.
Now this is a very simple batch, and I dont understand why it does not function properly. When I run the batch the cmd flashes and closes and I can not see what it is doing, but from my understanding it should work.
I know research is always the best method to solving a problem, and I am continuing to do just that. However, I thought it wise to seek second opinions and outside advice.
Thank you all for taking the time to help me and for reading my post.
-mpiersant@itt-tech.edu