Solved

RUNAS error - windows 7 PC running batch script via unc

Posted on 2011-03-17
10
2,858 Views
Last Modified: 2012-05-11
I have a Windows 7 PC where the user opens a batch file from a mapped drive which then calls a script via a unc path using the runas command to elevate privileges.  This works from an XP machine but not from a Windows 7 machine.

For example the first script on the mapped drive is as follows:

runas /user:scs\chrismanbup \\192.1.3.4\manual_backup\test.bat

The user then keys the password for the chrismanbup account and we get the below error from the Windows 7 machine:

Attempting to start \\192.1.3.4\manual_backup\test.bat as user "scs\chrismanbup" ...
RUNAS ERROR: Unable to run - \\192.1.3.4\manual_backup\test.bat
299: Only part of a ReadProcessMemory or WriteProcessMemory request was completed.

The user is not an administrator but if I use "Run as administrator" it still gives the same error. As mentioned if I run from an XP machine as the same user it runs.

Any ideas?
0
Comment
Question by:scs-paul
  • 6
  • 3
10 Comments
 
LVL 1

Expert Comment

by:villeah
Comment Utility
Hello,

Are you trying with 64-bit or 32-bit Windows 7? What is the script trying to do?
0
 

Author Comment

by:scs-paul
Comment Utility
This is 32bit Windows 7.  The script does the above - it calls a second script on another server using elevated privileges. The script fails with the aforementioned-mentioned error and does not start the second script.
0
 
LVL 68

Expert Comment

by:Qlemo
Comment Utility
It might be because the mapped drive is not available to the other user in runas, so while trying to start the command the working dir is removed. For test, try if running the script locally helps.
0
 

Author Comment

by:scs-paul
Comment Utility
I can map the drive as the user in the runas script from an XP machine but not from a Windows 7 machine. This occurs whether UAC is on or off.
0
 
LVL 68

Expert Comment

by:Qlemo
Comment Utility
How do you try to map the drive? Can you map it outside of the runas script as that user?
0
Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

 

Author Comment

by:scs-paul
Comment Utility
No I cannot map the drive from Windows 7 as the user in the runas script from windows explorer menu but I can do so from an XP machine.
0
 
LVL 68

Expert Comment

by:Qlemo
Comment Utility
Hmm. But you can see the server's share on the W7 PC if you just type   \\servername   in Explorer?
0
 

Author Comment

by:scs-paul
Comment Utility
Tried mapping the share on another Windows 7 machine and it could map as the runas user which was not working on the other Windows 7 machine this morning. Tried again on the original machine  and it is now mapping the share as the runas user.
This has not solved the error when using the first script to call to this share and run the batch file and I assume this is to do with UNC paths and added security to Win7.
I need to use the first script to call the second script with the elevated privileges as the second script deletes/moves some directories and then stops a service on the machine, copies some files and then restarts the service - so needs to run as an administrator.
Mapping the drive on the windows 7 PC and then right clicking the second script batch file (while holding shift) and using "run as different user" and using the RUNAS user from the script has the same error as running the first script to call the second script.

0
 

Accepted Solution

by:
scs-paul earned 0 total points
Comment Utility
This was solved by using the runas /netonly switch.
0
 

Author Closing Comment

by:scs-paul
Comment Utility
Eventually solved this issue by using the /netonly switch in the runas command line.
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
OfficeMate Freezes on login or does not load after login credentials are input.
This Micro Tutorial will go in depth within Systems and Security in Windows 7 and will go into detail regarding Action Center, Windows Firewall, System, etc. This will be demonstrated using Windows 7 operating system.
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now