So I am currently working on a script (ran on logon) to remove 2 icons from the user's desktop (if they exist). The issue I'm running into is that the icons are in "C:\Documents and Settings\All Users\Desktop" and the user login it's attached to does not have the privileges to delete files from that folder. I found a solution that should work, but is not working. As noted in the code, I used the FSO at first and that didn't work due to the permissions.
I also began running the commands in the command prompt on an admin login and found that just doing
workes butCode:C:\>cmd /c del C:\Documents and Settings\All Users\Desktop\Star Reading - Student.lnk
doesn't (with or without the quotes). It does pop up with a command prompt for a sec but it disappears and the shortcuts don't do anything.Code:C:\>runas /noprofile /user:mps\setup "cmd /c del C:\Documents and Settings\All Users\Desktop\Star Reading - Student.lnk"
If anyone has any ideas I'd be very appreciative.
~Wiggz
Code:Dim DesktopPath, WSHShell, Icon Set WSHShell = WScript.CreateObject("WScript.Shell") Set fs = CreateObject("Scripting.FileSystemObject") 'on error resume next DesktopPath = "C:\Documents and Settings\All Users\Desktop" Icon = DesktopPath & "\Accelerated*Reader - Student.lnk" 'MsgBox fs.FileExists(Icon) & Icon If fs.FileExists(Icon) Then 'Set A = fs.GetFile(Icon) Used before but doesn't have privs 'A.Delete WSHShell.Run "runas /noprofile /user:mps\setup ""cmd /c del " & Icon & """ WScript.Sleep 100 WSHShell.Sendkeys myPass 'End If




Reply With Quote
