Login | |
|
 |
RE: vbscript to delete specific files - 8/9/2008 10:02:23 PM
|
|
 |
|
| |
TomRiddle
Posts: 191
Score: 4
Joined: 2/7/2008
Status: offline
|
quote:
because they do not have access somewhere in the GPO to delete files Group policy is blocking your users ability to delete files or is it NTFS permissions? Log in as one of your users and run the script, that will tell you if it is a permission issue or something else. I have not run the script but at a glance it looks ok, I assume it works when you as an admin click on it.
|
|
| |
|
|
|
 |
RE: vbscript to delete specific files - 8/10/2008 11:24:14 AM
|
|
 |
|
| |
adamhaskins
Posts: 5
Score: 0
Joined: 8/7/2008
Status: offline
|
Ok below is my updated script which works great as a Startup script. When I use it on the machines it does exactly what i want it to do. Thing is I need this script to run at each login instead of when the computer starts up. I made a GPO which works fine at startup, but when I try to do it as "login" it gives me a "access denied" when the script tries to delete files. So its obviously a permission issue. I work at a bigger company which has 500 users. Thing is we dont give them access to do anything besides what they need. So everything is locked down where they are not allowed to delete files or even look at any of the drives ect. All they have on there start menu are the programs they need to work effectively. I gave the users full access to the tech directory with full control rights, but the PC still isnt letting the script run. So i just assumed its something that is set it Group policy not allowed these users to delete the files. Does anyone have any idea where i could check or what I could do to give these users access to delete the files in the c:\tech directory? Any help would be appreciated. '***** Notes:****************************************************************************************'***************** 'Initial release of script is 08/1/2008 ' 'Created by: Adam Haskins ' 'Purpose: Delete E-POP Cached files in C:\tech to resolve license issue. ' 'Updates: ' '********************************************************************************************************************************* ' Dim MyFile, filesys, oLogFile, objName, strComp, nLogFile Dim fso2, strText Set filesys = CreateObject("Scripting.FileSystemObject") Const ForAppending = 8 Set oLogFile= filesys.OpenTextFile("c:\tech\EPOPCLRCach.log", ForAppending, True) Set objName = CreateObject("WScript.NetWork") ' Set computer name of PC script is running on strComp = objname.ComputerName Set nLogfile = filesys.OpenTextFile("Private}\Machine" & strComp & ".txt", ForAppending, True) REM Deletes MyShortcuts.IDX If filesys.FileExists("c:\tech\MyShortcuts.IDX") Then Set MyFile = filesys.GetFile("c:\tech\MyShortcuts.IDX") oLogFile.writeLine(now & ": Deleted File " & myFile.shortname & " last modified " & MyFile.DateLastModified) nLogFile.writeLine(now & ": Deleted File " & myFile.shortname & " last modified " & MyFile.DateLastModified) MyFile.Delete end if REM Deletes MyShortcuts.DAT If filesys.FileExists("c:\tech\MyShortcuts.DAT") Then Set MyFile = filesys.GetFile("c:\tech\MyShortcuts.DAT") oLogFile.writeLine(now & ": Deleted File " & myFile.shortname & " last modified " & MyFile.DateLastModified) nLogFile.writeLine(now & ": Deleted File " & myFile.shortname & " last modified " & MyFile.DateLastModified) MyFile.Delete end if REM Deletes MyIdentity.IDX If Filesys.FileExists("c:\tech\MyIdentity.IDX") then Set MyFile = filesys.GetFile("c:\tech\MyIdentity.IDX") oLogFile.writeLine(now & ": Deleted File " & myFile.shortname & " last modified " & MyFile.DateLastModified) nLogFile.writeLine(now & ": Deleted File " & myFile.shortname & " last modified " & MyFile.DateLastModified) MyFile.Delete end if REM Deletes MyIdentity.DAT If Filesys.FileExists("c:\tech\MyIdentity.Dat") then Set MyFile = filesys.GetFile("c:\tech\MyIdentity.DAT") oLogFile.writeLine(now & ": Deleted File " & myFile.shortname & " last modified " & MyFile.DateLastModified) nLogFile.writeLine(now & ": Deleted File " & myFile.shortname & " last modified " & MyFile.DateLastModified) MyFile.Delete end if oLogFile.Close
< Message edited by adamhaskins -- 8/10/2008 11:28:28 AM >
|
|
| |
|
|
|
|
|