Solved

shortcuts on desktops

Posted on 2016-10-19
14
51 Views
Last Modified: 2016-10-21
Hi,

is there any way to delete  the shortcuts on user desktops for documents and desktop.  can this be done via GPO or scripting?

some users have shortcuts of their dekstops and documents which points to an old location of home folders on a share.

desktop and documents are redirected to users home folders which we changed the path for. however, noticed some users have shortcuts which points to old location...

what is best option to remove users shortcuts for one time only so that they can create shourtcuts again if they want to as after deleting desktop and my document shourcuts, new short cut would be pointing to new location...

servers are 2012 and desktops are windows 7
0
Comment
Question by:kuzum
  • 8
  • 6
14 Comments
 
LVL 5

Expert Comment

by:Austin Texas
Comment Utility
If you redirect the desktop to a server share, you can set the share permissions to Read.

When redirecting, redirect all users to the same location and ensure the option 'Grant user exclusive rights to <folder>' is unticked.
0
 

Author Comment

by:kuzum
Comment Utility
Hi Tex

I did not understand your comment sorry. desktops are redirected to a new share with no issue. Issue is with those users who has shortcuts of their desktops and documents which is pointing to old location. so solution I need needs to delete short cuts on users desktops for desktop and documents.

when new shortcuts are created it will be automatically pointing to new location.
0
 
LVL 5

Expert Comment

by:Austin Texas
Comment Utility
My apologies, maybe I misunderstood the precise goal. My previous instruction was to give all the users a clean desktop and prevent them from saving anything to it.

If you just want to delete shortcuts from desktops, you can do that with a batch file. Windows shortcuts have the extension .lnk so if you run "del %HOMEPATH%\Desktop\*.lnk" in a login script, that should get rid of all the user created shortcuts.

Let me know if that is what you are needing.
0
 

Author Comment

by:kuzum
Comment Utility
thanks Tex.

so we are now on same line.
del %HOMEPATH%\Desktop\*.lnk"     what does %homepath" do exactly? could you please help me to understand and may be learn form this.  can I add documents folder in here too?
0
 
LVL 5

Expert Comment

by:Austin Texas
Comment Utility
%HOMEPATH% is a system environment variable that defines the file system path to the current user's home directory.

For example, if my username were "texas" then when %HOMEPATH% is used in a batch script, it will resolve to "\users\texas" (depending on the version of Windows) and so "del %HOMEPATH%\Desktop\*.lnk" would become "del \users\texas\Desktop\*.lnk"

This is used so that one command can be used in a login script and work for different users with different paths to their home directory.

Did I explain it well enough? I can try again if you need me to.
0
 
LVL 5

Expert Comment

by:Austin Texas
Comment Utility
One thing I forgot! Put the path in quotes!
Like this:
del "%HOMEPATH%\Desktop\*.lnk"

Open in new window

And yes, you can include any other folders, however you might need to include the /S switch to tell the command to drill down into subfolders.
example:
del /S "%HOMEPATH%\Documents\*.lnk"

Open in new window

0
 

Author Comment

by:kuzum
Comment Utility
thanks Tex, so do I need two one for desktop and one for documents?
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

Author Comment

by:kuzum
Comment Utility
thanks Tex, Just read your last post. I will test this and let you know.
0
 
LVL 5

Accepted Solution

by:
Austin Texas earned 500 total points
Comment Utility
Two commands; One login script.
login.bat
del "%HOMEPATH%\Desktop\*.lnk"
del /S "%HOMEPATH%\Documents\*.lnk"

Open in new window

0
 
LVL 5

Expert Comment

by:Austin Texas
Comment Utility
One more tip: Before I run a "del" command, I first like to run it with "dir" instead so that I can verify it is going to do what I am expecting it to before I start erasing data.
0
 

Author Comment

by:kuzum
Comment Utility
when you say deleting the data, do you mean the content of the shortcuts?

what I need to delete is simply the shortcut icons not the content. hope I'm not confusing you?
0
 
LVL 5

Expert Comment

by:Austin Texas
Comment Utility
Right.
Just the shortcut.
Not the file that the shortcut is pointing to.

To be clear, the shortcut is a file, it is just a file that points to another file. You will be deleting files but they will be shortcut files, not the files they point to.
0
 

Author Closing Comment

by:kuzum
Comment Utility
it worked thanks.
0
 
LVL 5

Expert Comment

by:Austin Texas
Comment Utility
Hooray!  Let me know if you have any other login-scripty stuff you need help with.
0

Featured Post

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.

Join & Write a Comment

A Bare Metal Image backup allows for the restore of an entire system to a similar or dissimilar hardware. They are highly useful for migrations and disaster recovery. Bare Metal Image backups support Full and Incremental backups. Differential backup…
Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.

744 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

9 Experts available now in Live!

Get 1:1 Help Now