Team OS : Your Only Destination To Custom OS !!

Welcome to TeamOS Community, Register or Login to the Community to Download Torrents, Get Access to Shoutbox, Post Replies, Use Search Engine and many more features. Register Today!

Locked Need Help Disabling a Device Permanently

Status
Not open for further replies.

drunkbeetle

Member
Downloaded
14 GB
Uploaded
27.5 GB
Ratio
1.97
Seedbonus
144
Upload Count
0 (0)
Member for 6 years
I use an Asus Zenbook and it has a touchpad which can also be used as a numpad. Which can be switched on by mistake and is not needed. I have to use the following code in a shortcut file to remove the device each time I boot up. It would be better if this could be automated and I didn't have to run this file every time I boot.
I've tried setting up a task scheduler to run the shortcut file on windows logon or startup but it is unsuccessful in disabling the device. But running the shortcut file manually works fine.
Shortcut Code:
%windir%\System32\pnputil.exe /remove-device HID\ELAN1401&COL04\5&24D990C1&9&0003

[SOLVED]
Thank you
 
Last edited:

1ntr0v3rt3ch

✅ Verified Member
Member
Downloaded
499 GB
Uploaded
148.8 TB
Ratio
305.41
Seedbonus
3,000,026
Upload Count
0 (0)
Member for 4 years
have you try to make it a vbs or batch file then add it in task scheduler or add it in startup folder?
 

drunkbeetle

Member
Downloaded
14 GB
Uploaded
27.5 GB
Ratio
1.97
Seedbonus
144
Upload Count
0 (0)
Member for 6 years
have you try to make it a vbs or batch file then add it in task scheduler or add it in startup folder?
I've never experimented with a vbs file. I'll have to look that up.
I'm pretty sure I had first tried a .bat file, I will try one more time and report back.
 

drunkbeetle

Member
Downloaded
14 GB
Uploaded
27.5 GB
Ratio
1.97
Seedbonus
144
Upload Count
0 (0)
Member for 6 years
I tried running the shortcut command in CMD first. This is what was returned:

C:\Users\username>%windir%\System32\pnputil.exe /remove-device HID\ELAN1401&COL04\5&24D990C1&9&0003
Microsoft PnP Utility

The system cannot find the path specified.
'24D990C1' is not recognized as an internal or external command,
operable program or batch file.
'9' is not recognized as an internal or external command,
operable program or batch file.
'0003' is not recognized as an internal or external command,
operable program or batch file.
 

1ntr0v3rt3ch

✅ Verified Member
Member
Downloaded
499 GB
Uploaded
148.8 TB
Ratio
305.41
Seedbonus
3,000,026
Upload Count
0 (0)
Member for 4 years
@drunkbeetle did you run it as administrator?
 

Cyler

🤴 Super Admin
⚡OS Master
Downloaded
510.5 GB
Uploaded
24.5 TB
Ratio
49.16
Seedbonus
27,587
Upload Count
1 (1)
Member for 6 years
Actually, whenever you have a command that has spaces inside you need to use quote marks "" for example
command "switch1 switch2"
 

drunkbeetle

Member
Downloaded
14 GB
Uploaded
27.5 GB
Ratio
1.97
Seedbonus
144
Upload Count
0 (0)
Member for 6 years
@drunkbeetle did you run it as administrator?
Yes.

Actually, whenever you have a command that has spaces inside you need to use quote marks "" for example
command "switch1 switch2"
Thanks for this. This helped run the command. When I put the .bat file in the startup folder, it ran, but it did not disable the device. Then I double clicked the .bat file manually, which didn't work. But when I right-click and run as administrator it worked.

How can I run the command as an administrator, without having to right-click so it is automated on startup. Is there a command-line or should I create a shortcut and set its properties to always run as administrator?

Or will I have to create a vbs to run commands with admin rights?
 

Cyler

🤴 Super Admin
⚡OS Master
Downloaded
510.5 GB
Uploaded
24.5 TB
Ratio
49.16
Seedbonus
27,587
Upload Count
1 (1)
Member for 6 years
Yes.


Thanks for this. This helped run the command. When I put the .bat file in the startup folder, it ran, but it did not disable the device. Then I double clicked the .bat file manually, which didn't work. But when I right-click and run as administrator it worked.

How can I run the command as an administrator, without having to right-click so it is automated on startup. Is there a command-line or should I create a shortcut and set its properties to always run as administrator?

Or will I have to create a vbs to run commands with admin rights?
The easy way: Right-click on the bat, and create a shortcut, then right-click on the shortcut and select properties. Select the Shortcut tab, then click advanced, then tick the run as administrator, click close, and apply.
Run the shortcut and not the main bat and it will always run as administrator. If you think you will get confused, rename the shortcut to a different name.

Note: if you have UAC you will need to approve every time.

QzoUXW.jpg


Easy way No2: Use runas command. Example: runas /user:Administrator command.bat Change the user to your administrator name and you are set.

The hard way: Self-elevation but better avoid that for now. See if the above methods work for you and if not we'll get back to self-elevation.
 
Last edited:

juanamm

Uploader
Uploader
Power User
✅ Verified Member
Member
Downloaded
5.7 GB
Uploaded
448.6 GB
Ratio
78.11
Seedbonus
134,973
Upload Count
217 (223)
Member for 5 years
@drunkbeetle, try these lines of code which would go at the beginning of your BAT code.

Bash:
@if (@CodeSection == @Batch) @then
@echo off

:-------------------------------------
:: BatchGotAdmin
REM  --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"

REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
    :echo Requesting administrative privileges...
    goto UACPrompt
) else ( goto gotAdmin )

:UACPrompt
    echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
    echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"

    "%temp%\getadmin.vbs"
    exit /B

:gotAdmin
    if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
    pushd "%CD%"
    CD /D "%~dp0"
 
:--------------------------------------
REM --> YOUR STUFF HERE!
@end


OTHER OPTION:
If you want you can even run minified your BAT file with this same code.

Bash:
@if (@CodeSection == @Batch) @then
@echo off

:-------------------------------------
:: BatchGotAdmin
REM  --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"

REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
    :echo Requesting administrative privileges...
    goto UACPrompt
) else ( goto gotAdmin )

:UACPrompt
    echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
    echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"

    "%temp%\getadmin.vbs"
    exit /B

:gotAdmin
    if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
    pushd "%CD%"
    CD /D "%~dp0"
  
:--------------------------------------

:: SET YOUR BAT FILE PATH HERE!

Set MY_PATH=C:\Users\xxx\Desktop\
START /MIN CMD.EXE /C "%MY_PATH%\your_bat_file.bat"

@end
 
Last edited:

drunkbeetle

Member
Downloaded
14 GB
Uploaded
27.5 GB
Ratio
1.97
Seedbonus
144
Upload Count
0 (0)
Member for 6 years
The easy way: Right-click on the bat, and create a shortcut, then right-click on the shortcut and select properties. Select the Shortcut tab, then click advanced, then tick the run as administrator, click close, and apply.
Run the shortcut and not the main bat and it will always run as administrator. If you think you will get confused, rename the shortcut to a different name.

Note: if you have UAC you will need to approve every time.

Easy way No2: Use runas command. Example: runas /user:Administrator command.bat Change the user to your administrator name and you are set.

The hard way: Self-elevation but better avoid that for now. See if the above methods work for you and if not we'll get back to self-elevation.

Setting a shortcut in the following directory did not remove the device. I had to run the .bat file manually again.

C:\Users\username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
 

drunkbeetle

Member
Downloaded
14 GB
Uploaded
27.5 GB
Ratio
1.97
Seedbonus
144
Upload Count
0 (0)
Member for 6 years
@if (@CodeSection == @Batch) @then
@echo off

:-------------------------------------
:: BatchGotAdmin
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
@juanamm


REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
:echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )

:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"

"%temp%\getadmin.vbs"
exit /B

:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0"

:--------------------------------------
REM %windir%\System32\pnputil.exe /remove-device "HID\ELAN1401&COL04\5&24D990C1&9&0003"
@end

I tried the first one in cmd. It returned the following error:
Windows cannot find '%~s0'. Make sure you typed the name correctly and try again.
 

kVertix

Member
Downloaded
12 GB
Uploaded
779.8 GB
Ratio
64.87
Seedbonus
1,160
Upload Count
0 (0)
Member for 8 years
I'm unsure if you did try one thing at very start: did you try putting your original shortcut inside All Users Startup folder:
%ProgramData%\Microsoft\Windows\Start Menu\Programs\StartUp
Which Windows OS do you have?
 
Last edited:

drunkbeetle

Member
Downloaded
14 GB
Uploaded
27.5 GB
Ratio
1.97
Seedbonus
144
Upload Count
0 (0)
Member for 6 years
I'm unsure if you did try one thing at very start: did you try putting your original shortcut inside All Users Startup folder:
%ProgramData%\Microsoft\Windows\Start Menu\Programs\StartUp
Which Windows OS do you have?
Hi,

I am running Windows 11. I have put the original shortcut with 'Run as Administrator' enabled into the folder you suggested. And it still doesn't work. When I look at Startup items within Task Manager the .bat file is listed. I believe it runs in the background but it doesn't work as an Administrator even though it is set to run as an administrator.

 

Cyler

🤴 Super Admin
⚡OS Master
Downloaded
510.5 GB
Uploaded
24.5 TB
Ratio
49.16
Seedbonus
27,587
Upload Count
1 (1)
Member for 6 years
First of all, I hope you dont have the REM in front of the command.
REM %windir%\System32\pnputil.exe /remove-device "HID\ELAN1401&COL04\5&24D990C1&9&0003"
@end
That instructs the bat file to ignore the command and treat it as a comment. If you have it, remove it.

Second, and just to make sure we speak the same language, you are supposed to put the shortcut which is marked to run as admin and NOT the bat file itself in the autostart.

Third, have you tried runas? for example, make a second bt file to test and issue
runas /user:administrator "%windir%\System32\pnputil.exe /remove-device HID\ELAN1401&COL04\5&24D990C1&9&0003"


Now that I remember, I think some windows and defender options, blocks scripts from running elevated at startup for fear of viruses etc. so let's try a different way.

Run Task scheduler (press start and type "task sche", it should show it) and then Task schedule library--->Create task
In the windows that will pop, and:
Under the general tab, add a name, click on run with highest privileges,
Under the triggers tab, select at start-up and tick enable at the bottom,
Under the Action tab, click new, point to your bat file path,
click ok and restart to test.
 
Last edited:

drunkbeetle

Member
Downloaded
14 GB
Uploaded
27.5 GB
Ratio
1.97
Seedbonus
144
Upload Count
0 (0)
Member for 6 years
That instructs the bat file to ignore the command and treat it as a comment. If you have it, remove it.

Second, and just to make sure we speak the same language, you are supposed to put the shortcut which is marked to run as admin and NOT the bat file itself in the autostart.
Thank you for your reply.
I've removed the REM and when I run it in CMD, the script doesn't make it past the %~s0.
and gives me the following error:
Windows cannot find '%~s0'. Make sure you typed the name correctly and try again.

And yes I've been putting shortcut files in the startup folder. Which have their properties set to run as administrators.

I will try doing it through task scheduler.

I still haven't tried runas command.
Can you clarify if I leave the code as runas /user:administrator
or
runas /drunkbeetle:administrator

taking into account the windows username is drunkbeetle.
 

kVertix

Member
Downloaded
12 GB
Uploaded
779.8 GB
Ratio
64.87
Seedbonus
1,160
Upload Count
0 (0)
Member for 8 years
What I find odd is that it gets stuck at "%~s0".
The following does work on my win10:
Bash:
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
First line writes the file "getadmin.vbs" inside "%temp%" folder with contents "Set UAC = CreateObject("Shell.Application")"
Second adds content "UAC.ShellExecute "C:\Users\username~1\Desktop\test.cmd", "", "", "runas", 1" to previously created "getadmin.vbs"
Do you see a "getadmin.vbs" inside your %temp% folder? (Press WIN+R to call Run box, type %temp% in there and press Enter, it opens Local Temporary files folder)
If it exists there then what is written as the address of the BAT/CMD file on second line?

You can try Cyler's runas idea like this:
Press WIN+R, then in the Run box type cmd. Inside the terminal window paste:
runas /user:administrator "%windir%\System32\pnputil.exe /remove-device HID\ELAN1401&COL04\5&24D990C1&9&0003"
And see what the terminal responds with.
 
Last edited:

drunkbeetle

Member
Downloaded
14 GB
Uploaded
27.5 GB
Ratio
1.97
Seedbonus
144
Upload Count
0 (0)
Member for 6 years
What I find odd is that it gets stuck at "%~s0".
The following does work on my win10:
Bash:
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
First line writes the file "getadmin.vbs" inside "%temp%" folder with contents "Set UAC = CreateObject("Shell.Application")"
Second adds content "UAC.ShellExecute "C:\Users\username~1\Desktop\test.cmd", "", "", "runas", 1" to previously created "getadmin.vbs"
Do you see a "getadmin.vbs" inside your %temp% folder? (Press WIN+R to call Run box, type %temp% in there and press Enter, it opens Local Temporary files folder)
If it exists there then what is written as the address of the BAT/CMD file on second line?

You can try Cyler's runas idea like this:
Press WIN+R, then in the Run box type cmd. Inside the terminal window paste:
runas /user:administrator "%windir%\System32\pnputil.exe /remove-device HID\ELAN1401&COL04\5&24D990C1&9&0003"
And see what the terminal responds with.
Thank you for your response.

I was able to disable it completely. And tested it twice.
@Cyler 's suggestion of adding the .bat into a task schedule to run at user logon works. Run with highest privileges is enabled. I also set it to Configure for: Windows 10.

I find it funny that windows re-enables or re-adds this device on every fresh boot. It would be great if I could block it from re-installing everytime, as it gets disabled anyway. But that might be another beast of its own and I'm happy with this solution as most of the time the laptop is put to sleep.

Thanks for everyone who has chipped in.

And yes the getadmin.vbs is in the %temp% folder in Windows 11.
And when I tried the following in CMD:
runas /user:administrator "%windir%\System32\pnputil.exe /remove-device HID\ELAN1401&COL04\5&24D990C1&9&0003"
It asked for the admin password.
Which I tried the account password, but it said wrong password. Then I tried a blank password and got:
"

RUNAS ERROR: Unable to run - C:\WINDOWS\System32\pnputil.exe /remove-device HID\ELAN1401&COL04\5&24D990C1&9&0003
1327: Account restrictions are preventing this user from signing in. For example: blank passwords aren't allowed, sign-in times are limited, or a policy restriction has been enforced.
"

Anyhow, problem solved :D
 
Last edited:

Cyler

🤴 Super Admin
⚡OS Master
Downloaded
510.5 GB
Uploaded
24.5 TB
Ratio
49.16
Seedbonus
27,587
Upload Count
1 (1)
Member for 6 years
Thank you for your response.

I was able to disable it completely. And tested it twice.
@Cyler 's suggestion of adding the .bat into a task schedule to run at user logon works. Run with highest privileges is enabled. I also set it to Configure for: Windows 10.
I think I was right in my assumption that windows blocks scripts (bat files, cmd files, PowerShell, etc) to run with admin rights from autostarting. To say it better the bat file does run as admin, but the commands inside that call other programs (in this case pnputil.exe) will not run as admin which probably caused the issues.

Glad the task scheduler solution works out (my preferred method too).

Thank you all for the suggestions, this community is amazing. Cheers to all.
QzuEpd.gif
 

juanamm

Uploader
Uploader
Power User
✅ Verified Member
Member
Downloaded
5.7 GB
Uploaded
448.6 GB
Ratio
78.11
Seedbonus
134,973
Upload Count
217 (223)
Member for 5 years
@drunkbeetle, I was late to the party, but @kVertix correctly explained the code that I shared and cleared up your doubts.
I'm glad you were able to fix it with @Cyler's help.
 
Status
Not open for further replies.
Top