Sign in to follow this  
Followers 0
Stealth111

Help with clearing desktop items

1 post in this topic

I hope this is the right place to try to find a solution for my problem.. First a little background on situation.. I am the network admin for a large school district. I do k-12. I have a small problem in a computer lab, with the kids 2nd thru 5th grade rearranging icons on the desktop, deleting icons, renaming icons, and making numerous copies, ect.. It is a lab of 28 computers on a domain, BUT the kids being of young age all login as "student" with NO password, so it is easy for them.. what I want to do is run this script I made to check to see if the computer is part of an array I have pulled from a text file of names (YES I know I can just put the lab pc's in an OU and apply a group policy to just them, but I don't want to do that...) If the computer matches a name in the array I want to basically DELETE the "C:\Documents and Settings\Student\Desktop" folder and all its contents, then make a new folder, then I will copy all the fresh desktop items over to the new desktop. Which is easy enough to do, but here is where the problem is that I CANNOT figure out.. If I drag 3 icons to the right of the screen, then log off the log back on so I am running my autoit script (compiled into exe). which it runs fine and does the task, but when it makes the new desktop folder and copies all the icons back to the new folder in the login script, the 3 icons that I dragged to the right are replaced again by the 3 icons I pushed back to the new desktop.. I DO NOT want the icons remembering their positions at all.. I dont know what I am missing.. If while logged in I delete all my desktop icons, then connect to the server and copy them all back, they are all arranged to the left of the screen like I want them, but when I do it with this script, the icons seem to remember their positions even after deleting the whole folder.. Am I missing something here?? code follows..

#include <File.au3>
#include <Array.au3>
#NoTrayIcon
Dim $a_file, $s_search
search()
Func search()
    $s_search = @ComputerName
    _FileReadToArray(@ScriptDir & "\lab.txt", $a_file)
    $ret = _ArraySearch($a_file, $s_search)
    If $ret <> - 1 Then
    Beep(5000, 500)
    DirRemove("C:\Documents and Settings\Student\Desktop", 1)
        Else
    Exit
    EndIf
EndFunc

Afetr this runs in the login script I am just doing an xcopy later in the same script to copy all the desktop icons back to the client from a folder on the server..

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0