Nicky Raven
asked on
Batch File Problems
Hello Everyone
I have recently updated my system to windows 10 from windows 7 and the following batch file i have to launch active directory and the lik on my system is no longer working as it comes up with the following. I had ran the command prompt as my ad min user and this was also elevated so i believe its my code but i would like pointers or even an easier way to do this.
Thank you all in advance.
-------------------------- ---------- ---------- ---------- ------
Enter the password for Company\Admin13:
Attempting to start "C:\Users\ME\Documents\Scr ipts\Toolb ox.bat" /runas as user "Company\Admin13" ...
RUNAS ERROR: Unable to run - "C:\Users\ME\Documents\Scr ipts\Toolb ox.bat" /runas
5: Access is denied.
-------------------------- ---------- ---------- ---------- ------
hear is the batch file in all its glory
I have recently updated my system to windows 10 from windows 7 and the following batch file i have to launch active directory and the lik on my system is no longer working as it comes up with the following. I had ran the command prompt as my ad min user and this was also elevated so i believe its my code but i would like pointers or even an easier way to do this.
Thank you all in advance.
--------------------------
Enter the password for Company\Admin13:
Attempting to start "C:\Users\ME\Documents\Scr
RUNAS ERROR: Unable to run - "C:\Users\ME\Documents\Scr
5: Access is denied.
--------------------------
hear is the batch file in all its glory
@echo off & setlocal enableDelayedExpansion
set /a size=80-1 & rem screen size minus one
if /i "%~1"=="/runas" goto Start
runas.exe /user:Company\Admin13 "\"%~f0\" /runas"
goto :eof
:Start
set s=Running as %UserDomain%\%Username%
for /L %%# in (1,2,!size!) do if "!s:~%size%,1!" == "" set "s= !s! "
set s=!s:~1,%size%!& echo(!s!
:echo.
:set s=================
:for /L %%# in (1,2,!size!) do if "!s:~%size%,1!" == "" set "s= !s! "
:set s=!s:~1,%size%!& echo(!s!
:set s=Active Directory 32-Bit
:for /L %%# in (1,2,!size!) do if "!s:~%size%,1!" == "" set "s= !s! "
:set s=!s:~1,%size%!& echo(!s!
:start "" "dsa.msc" -32
echo.
set s=================
for /L %%# in (1,2,!size!) do if "!s:~%size%,1!" == "" set "s= !s! "
set s=!s:~1,%size%!& echo(!s!
set s=Active Directory 64-bit
for /L %%# in (1,2,!size!) do if "!s:~%size%,1!" == "" set "s= !s! "
set s=!s:~1,%size%!& echo(!s!
start "" "dsa.msc"
echo.
set s==========================
for /L %%# in (1,2,!size!) do if "!s:~%size%,1!" == "" set "s= !s! "
set s=!s:~1,%size%!& echo(!s!
set s=Microsoft Exchange Console
for /L %%# in (1,2,!size!) do if "!s:~%size%,1!" == "" set "s= !s! "
set s=!s:~1,%size%!& echo(!s!
start "" "Exchange Management Console.msc"
echo.
set s=============================
for /L %%# in (1,2,!size!) do if "!s:~%size%,1!" == "" set "s= !s! "
set s=!s:~1,%size%!& echo(!s!
set s=Windows Server Update Service
for /L %%# in (1,2,!size!) do if "!s:~%size%,1!" == "" set "s= !s! "
set s=!s:~1,%size%!& echo(!s!
start "" "C:\Program Files\Update Services\administrationsnapin\wsus.msc"
echo.
set s=========================
for /L %%# in (1,2,!size!) do if "!s:~%size%,1!" == "" set "s= !s! "
set s=!s:~1,%size%!& echo(!s!
set s=Windows Printer Managment
for /L %%# in (1,2,!size!) do if "!s:~%size%,1!" == "" set "s= !s! "
set s=!s:~1,%size%!& echo(!s!
start "" "printmanagement.msc"
echo.
set s=====================
for /L %%# in (1,2,!size!) do if "!s:~%size%,1!" == "" set "s= !s! "
set s=!s:~1,%size%!& echo(!s!
set s=system Lockout Status
for /L %%# in (1,2,!size!) do if "!s:~%size%,1!" == "" set "s= !s! "
set s=!s:~1,%size%!& echo(!s!
start "" "C:\Program Files (x86)\Windows Resource Kits\Tools\lockoutstatus.exe"
:echo =======================
:echo Terminal Services Admin
:start "" "tsadmin.msc"
:echo.
:echo =======================
:echo Lazy Windows Admin (PS)
:start "" "C:\Users\ME\Documents\scripts\Lazy Win Admin.lnk"
pause
Make sure the admin user has at least read permissions on the Batch E\Documents\Scripts\Toolbo x.bat
ASKER
My Admin User is in the administrator group so has access to the full drive
On the Windows 7 machine, have you disabled UAC ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
@John. The UAC is not disabled on the domain for both windows 7 and windows 10 systems.
@Lee W. I have tried this and come up with the same error
this is probably an egocentricity of windows 10 and will have to find another way of getting around this.
@Lee W. I have tried this and come up with the same error
this is probably an egocentricity of windows 10 and will have to find another way of getting around this.
Does it work when you manually use "run as" on any Windows exe or your batch?
If not you might have this problem: https://support.microsoft. com/en-us/ help/97751 3/error-me ssage-when -you-try-t o-use-the- runas-comm and-the-ru n-as-admin is
Different OS but worth to check....
If not you might have this problem: https://support.microsoft.
Different OS but worth to check....
ASKER
@ Michael. this did work with my admin account but not my main account.
i have found out that security replication had not taken place fully on my laptop so my account and my admin account did not have full access to each others area and thus its what Lee W stated permissions even though i had checked this...... I hate windows on the best of days.
thanks all for you posts and information
i have found out that security replication had not taken place fully on my laptop so my account and my admin account did not have full access to each others area and thus its what Lee W stated permissions even though i had checked this...... I hate windows on the best of days.
thanks all for you posts and information