Discussion Locked

Deleting desktop icon with login script?

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

NT Servers w/ Win95 clients using profiles.

I want to delete an icon (shortcut)from the desktop from users' machines with the login script. The problem is that with profiles the icon is in the c:\windows\profiles\USERNAME\desktop where USERNAMEis different on each PC. Sometimes there are multiple profiles on each PC. It may also be in c:\windows\desktop

Is there a way to search the HD for the file and delete it as you go?

If anymore info is needed, let me know.

5 replies

by ntoz

Using VBS and CSCRIPT (Windows Scripting Host) you can write a script to delete shor-cuts from the desktop. You wouldnt have to search the HD or profiles, as individuals logged on, the shortcut would be deleted. You could also use vbscript to deletethe shortcut from registry directly. You also might look into standardizing your desktops and using roaming profiles and having your default desktop setup exactly the way you needed it.

Pete

by shamen_2

If you know the name of the icon its pretty simple. In the login script type
"del c:\windows\profiles\%username%\desktop\*.*", without the quotations. *.*, being wildcards for the files you want to delete. With the use of %username% the user logging on will have their profile customized to the shortcuts that you want them to have.

You can also accomplish this with policies, but it seems that you want to do this with login scripts.This will work.

by darthbuck

I wish that was the solution. I don't believe you can use the %username% variable in command line or batch files. At least I cannot seem to. Try using it and see what it does. From the command prompt if I type:
cd C:\windows\profiles\%username% It takes me to the C:\windows\profile directory.
If I type:
cd c:\windows\profiles\%username%\desktop I get invalid directory

This discussion is closed to new replies.