Hello, for desktop support on end user or multi/generic user pcs it is nice to access common commands quickly from a batch file to run under your account. In xp both explorer and control panel apps launched without issues. The primary issue for explorer is it appears to ignore the runas command (but the user has permissions to explorer so no error) while the control panel apps ignores run as well but does not have permissions so generates an error. The other commands all execute as the attempting admin's account.
who it is for: the user with the admin account to execute on the user's desktop whom is a nonadmin
**please note, the commands appear to work if you do have admin rights**, the logged in user does not have admin rights to these utilities like in a common corporate environment.
"windows cannot access the specified device, path or file. You may not have the appropriate permissions to access the item."Issue#1:
With win7 if you do a run as for explorer.exe via batch it will open, but will still be running under the signed in user. I have searched many threads on various sites and have not found a working solution for batch, this may be something I need to retire.
Issue#2: all control panel applets fail to launch through various methods.
SECTIONS THAT I AM STRUGGLING WITH:
runas /user:%auser%@DOMAINNAME "explorer.exe /separate" runas /user:%auser%@DOMAINNAME "cmd /c Start /B rundll32.exe shell32.dll,Control_RunDLL appwiz.cpl"
"cmd /c start appwiz.cpl" also fails
alternative also fails:
runas /user:%auser%@chwi "cmd /c Start /B control.exe"
cls @ECHO OFF set /p auser= Enter your account login id: :MyMenu CLS Echo Use the options below to run as with your admin account id: echo. ECHO 1 - Explorer C:\ - may not work with win7 ECHO 2 - Device Manager ECHO 3 - Event Viewer ECHO 4 - Services ECHO 5 - Computer Management ECHO 6 - REGEDIT ECHO 7 - Command prompt ECHO 8 - Local Users and Groups echo 9 - launch task manager ECHO a - Control Panel - may not work with win7 Echo b - Add/Remove programs - may not work with win7 Echo 0 - Exit echo. SET /P OPT=Please make a selection, and press enter: if %OPT%==1 GOTO OPTION1 if %OPT%==2 GOTO OPTION2 if %OPT%==3 GOTO OPTION3 if %OPT%==4 GOTO OPTION4 if %OPT%==5 GOTO OPTION5 if %OPT%==6 GOTO OPTION6 if %OPT%==7 GOTO OPTION7 if %OPT%==8 GOTO OPTION8 if %OPT%==9 GOTO OPTION9 if %OPT%==a GOTO OPTIONa if %OPT%==b GOTO OPTIONb GOTO exit :OPTION1 ECHO Executing Explorer C: window echo. runas /user:%auser%@DOMAINNAME "explorer.exe /separate" GOTO:mymenu :OPTION2 ECHO Executing Device Manager echo. runas /user:%auser%@DOMAINNAME "cmd /c Start /B devmgmt.msc" GOTO:mymenu :OPTION3 ECHO Executing Event Viewer echo. runas /user:%auser%@DOMAINNAME "cmd /c Start /B eventvwr.msc" GOTO:mymenu :OPTION4 ECHO Executing Services echo. runas /user:%auser%@DOMAINNAME "cmd /c Start /B services.msc" GOTO:mymenu :OPTION5 ECHO Executing Computer Management echo. runas /user:%auser%@DOMAINNAME "cmd /c Start /B compmgmt.msc" GOTO:mymenu :OPTION6 ECHO Executing regedit echo. runas /user:%auser%@DOMAINNAME "cmd /c Start /B regedit" GOTO:mymenu :OPTION7 ECHO Executing command prompt echo. runas /user:%auser%@DOMAINNAME "cmd /c Start /B cmd" GOTO:mymenu :OPTION8 ECHO Executing Local Users and Groups echo. runas /user:%auser%@DOMAINNAME "cmd /c Start /B lusrmgr.msc" :OPTION9 ECHO Executing task manager echo. runas /user:%auser%@DOMAINNAME "cmd /c Start /B taskmgr.exe" :OPTIONa ECHO Executing control panel echo. runas /user:%auser%@DOMAINNAME "cmd /c Start /B control.exe" :OPTIONb ECHO Executing add/remove programs echo. runas /user:%auser%@DOMAINNAME "cmd /c Start /B rundll32.exe shell32.dll,Control_RunDLL appwiz.cpl" GOTO:mymenu GOTO EXIT :EXIT