Batch file to delete a desktop shortcut

I recently created a batch script that runs on logon, and it copies a shortcut to the desktop of the all users profile.

I want to delete this shortcutr and cannot get a batch script to work.. Any ideas?

Thank you!
nsalamericaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

ZahersyedCommented:
0
nsalamericaAuthor Commented:
Tried this earlier. No good,......
0
L3370Commented:
Permissions problem?  If the script is run under a user without admin rights it could be problematic.
0
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

nsalamericaAuthor Commented:
the users have no admin rights....... any way to do it without admin rights?
0
nsalamericaAuthor Commented:
Actually just tried this again from a domain admin account, and still no good.....
0
L3370Commented:
no admin rights will be an issue. They will not be able to do this. However if you are still having problems with Domain admin, then there is something else wrong.

This batch script runs at logon... Does this mean that the script is saved locally to that computer, and it executed in the startup process? Or does it mean that you have this added into the user's logon script?

If it is saved locally, double check that Domain Admins are in fact listed as local admins, slim chance this is the problem, but if you are using that script Zahersyed linked to it should work.

If you added this to the logon script, make sure this script applies to the proper set of users including domain admins

0
nsalamericaAuthor Commented:
I am using it as a logon script through group policy.
0
johnb6767Commented:
del /F /Q "%allusersprofile%\Desktop\Shortcut.lnk"

No reason that shouldnt work.....

Try it in a Machine Startup Script. Restricted users cant modify that location, even in a login script....
0
nsalamericaAuthor Commented:
Still no good...
0
nsalamericaAuthor Commented:
OK - it sems to work from my domain admin account now.. Anyway to make this work on a machine with no admin rights? I have about 130 of them!!
0
johnb6767Commented:
See my last remark, RE: Machine startup script......
0
johnb6767Commented:
Or PsExec.....
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
Guillermo FeijóoSystems administratorCommented:
PsExec has always worked fine for me. Easy to deploy and to use. It allows to execute processes with user validation, so maybe you can make the script to run under domain admin credentials. This way it should work.
0
oldmanhardingCommented:
Is the profile created in the specific user's desktop folder, or under the "all users" folder?
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
Microsoft DOS

From novice to tech pro — start learning today.