Remote drive batch file execution in Win 10.

Working with Windows 1, 64bit.

Using a batch file from a server based mapped directory to add a couple files to a C:\Program Files\ directory.

Even logged in as local administrator I can get it done.

Following is the contents of the bath file:

Net User administrator /active:yes
cd "Documents and Settings\All Users\Application Data\Bentley\MicroStation V8i\WorkSpace\Interfaces\MicroStation"
rd /s /q "C:\programdata\Bentley\MicroStation V8i\WorkSpace\Interfaces\MicroStation\Default"
XCopy *.* "C:\programdata\Bentley\MicroStation V8i\WorkSpace\Interfaces\MicroStation" /E  
cd ..
cd ..
cd standards
Del "C:\programdata\Bentley\MicroStation V8i\WorkSpace\Standards\standards.cfg"
copy *.* "C:\programdata\Bentley\MicroStation V8i\WorkSpace\Standards"
cd ..
cd users
Del "C:\programdata\Bentley\MicroStation V8i\WorkSpace\Users\*.ucf"
copy *.* "C:\programdata\Bentley\MicroStation V8i\WorkSpace\Users"
cd ..
cd ..
cd ..
cd ..
cd ..
cd ..
cd ..
cd "Program Files\Bentley\MicroStation V8i\Config\appl"
Copy *.cfg "C:\Program Files (x86)\Bentley\MicroStation V8i\MicroStation\config\appl"
cd ..
cd system
copy *.cfg "C:\Program Files (x86)\Bentley\MicroStation V8i\MicroStation\config\system"


It's simple, but the last two Copy commands do not work.

As you can see from the first line, I added the "Net User" command, which worked for a while in a previous build of Win 10, but not now...

And advice would be great.

Thanks!!
LVL 1
RKoonsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dean ChafeeIT/InfoSec ManagerCommented:
Have you checked the User Account Control Settings (UAC)?  set it to Never notify.
May or may not be the issue...
0
RKoonsAuthor Commented:
This has already been set as suggested.
0
Adam LeinssServer SpecialistCommented:
Do you have the output of the batch file?  You should be able to do something like this to enable logging:

samplefile.bat > C:\windows\temp\filelog.txt

Open in new window


Then attach filelog.txt here.

Also, you can shorten up your batch file by doing this:

cd\

Open in new window


should take you to the root of the drive, then you could do this:

cd "C:\programdata\Bentley\MicroStation V8i\WorkSpace\Standards\"

Open in new window


cd\

Open in new window


back to root, etc.
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

McKnifeCommented:
Right clicked the batch and selected "run as administrator"? You have to since the commands need elevation even as admin.
0
RKoonsAuthor Commented:
Attached is the output from the batch file.

Unfortunately, the error messages do not show up in the file, but on the CMD window.

So, there was an "Access is Denied" for the last two copy commands.

Also, great Idea from McKnife, but this did not work either.
0
McKnifeCommented:
cd "Documents and Settings\All Users\Application Data\Bentley\MicroStation V8i\WorkSpace\Interfaces\MicroStation"
How should that work? c:\documents and... does not exist in win10. (Didn't see it, first).

That script was mad for win xp, right? Needs revision.
0
Adam LeinssServer SpecialistCommented:
If the log file was attached, I didn't see it.  However, if you are getting Access Denied for the last two commands, then it really comes down to the user account running the batch file not having write access to those two folders.

C:\program files (x86) is owned by TrustedInstaller, however, any account with local admin rights should be able to copy files there.  I just did this on my work computer and I was able to copy files to that folder using a console with "Run as Administrator".

You would need to run the batch file as administrator using deployment software such as PDQDeploy or SCCM.
0
McKnifeCommented:
There is no attachment here, RKoons.
1 click "attach file"
2 select the file
3 then select upload file
0
RKoonsAuthor Commented:
Wow...

Sorry about the attachment issue: Included below.

McKnife:

You are right: This was created back in the XP days. The source content is "Old XP"; the target is correct.

Adam:

I think it might have something to do with copying from a remote directory to a local directory. I had thought it might be worth it to change it so that the files are copied to a local drive first and then to the correct folder.

I am doing this as the local admin.; and I tried running it under "As administrator"

The weird thing is: that first line I added did fix the problem; and then it quit.
batchlog_MS.txt
0
Adam LeinssServer SpecialistCommented:
The issue that I see here is:

Local Administrator rights are needed to copy files to C:\program files (x86) as that folder is owned by TrustedInstaller
The local Administrator account doesn't have rights to network resources

Which goes back to my statement above:

You would need to run the batch file as administrator using deployment software such as PDQDeploy or SCCM.

PDQ Deploy is free (they have a paid version as well).  What that does it is connects to the C$ of the computer needing updates, installs a service and then runs that program under the service locally on the computer.  So you could bundle all of the files into one folder and then execute the batch file with an account that has local administrator rights on the domain.
0
McKnifeCommented:
Getting closer.

Initially, you wrote "the last two Copy commands do not work", while your logfile shows, that only the first xcopy command results in "0 files copied", not the last two. Please explain.
0
RKoonsAuthor Commented:
McKnife:

The "0 Files Copied" is because the files were already copied so it did not do it again.

The last two do not show the errors in the file, only on the CMD window from where the batch file was run from.
0
McKnifeCommented:
I see. Please paste the commands and errors and comment on those if possible.
About permissions: we can see that you have admin permissions, else you wouldn't see files being copied to c:\programdata.
0
RKoonsAuthor Commented:
...Now I find out that you can't access remote drives from the Command Prompt when opened in Administrator mode...

This is getting stupid!!

Those stupid few are making this difficult for the rest of us that claim to know what we are doing...

Sorry...

I fell better now!
0
McKnifeCommented:
you can enable linked connections to be used on the administrative command prompt. See https://support.microsoft.com/en-us/help/3035277/mapped-drives-are-not-available-from-an-elevated-prompt-when-uac-is-co
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RKoonsAuthor Commented:
Thanks, and you have all been very helpful, but I finally found and decided on:

UAC is not completely disabled in Windows 10 even at the lowest setting. To disable UAC completely:

Press Win-R to open the Run dialog.

Open Registry Editor by running regedit.

Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System

Locate the DWORD value called EnableLUA and double-click it.

Change the value to 0 and click OK.

You will be prompted to restart your computer, so please do so.


This basically causes the standard CMD window to act like Windows 7. I'm sure there are other results, because of this change, but I believe I can live with them.
0
RKoonsAuthor Commented:
All participants get a share for your effort.
0
Adam LeinssServer SpecialistCommented:
You can do that, but I wouldn't recommend it:

https://insights.sei.cmu.edu/cert/2015/07/the-risks-of-disabling-the-windows-uac.html

In addition to Protected Mode functionality being disabled: I believe any app from the Windows Store will not run without UAC turned on.

I believe this turned into a bit of the "XY Problem".  If you really want to pull down updates every time you run MicroStation, I would advise that you install it into a folder at the root of the C: drive and adjust the folder permissions accordingly along with opening permissions on C:\programdata\Bentley\.

Use a scalpel not a chainsaw :)
0
Ronald KoonsCommented:
I got everything except the XY Problem.

Is this an actual problem, or reference to how this question progressed into something not at all what was originally intended.

Otherwise, I think this is good info and I will review the article provided. In the end, this might fall under the category of something like "Why is Microsoft trying so hard to protect me from myself..."

However, I realize that there are more and more hackers making this more and more difficult.

The real issue here is nothing to do with how everything works once it's installed, it's simply the initial setup that I am frustrated with.

Thankfully this is just a test machine, so I have flexibility.
0
Adam LeinssServer SpecialistCommented:
What I mean by an XY Problem is instead of getting the batch file to work as it did as in XP, you ask instead:

"I'm trying to push out configurations for Microstation to all of the computers in my company during the initial setup.  What is the best way of doing that?"

One way might be two batch files: one to copy the files down (run as network user) and one to copy the files over (run as local administrator).  Something like:

1_downconfigs.bat

mkdir C:\_MicroConfigs
xcopy /y \\acmeserver\bentlyconfigs\*.* C:\_MicroConfigs 

Open in new window

2_copyfiles.bat
xcopy /y C:\_MicroConfigs\*.*  "C:\programdata\Bentley\MicroStation V8i\WorkSpace\Interfaces\MicroStation"
rd /s /q "C:\programdata\Bentley\MicroStation V8i\WorkSpace\Interfaces\MicroStation\Default"

Del "C:\programdata\Bentley\MicroStation V8i\WorkSpace\Standards\standards.cfg"
xcopy /y C:\_MicroConfigs\*.*  "C:\programdata\Bentley\MicroStation V8i\WorkSpace\Standards"

Del "C:\programdata\Bentley\MicroStation V8i\WorkSpace\Users\*.ucf"
xcopy /y C:\_MicroConfigs\*.ucf "C:\programdata\Bentley\MicroStation V8i\WorkSpace\Users"


xcopy /y C:\_MicroConfigs\*.cfg "C:\Program Files (x86)\Bentley\MicroStation V8i\MicroStation\config\appl"
xcopy /y C:\_MicroConfigs\*.cfg "C:\Program Files (x86)\Bentley\MicroStation V8i\MicroStation\config\system"

cd\
rmdir /q /s C:\_MicroConfigs

Open in new window


I typed this on-the-fly and they would need to be tested, but you get the idea.  Changing the security of Windows 10 to Windows XP mode wouldn't be my recommendation.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows 10

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.