soze Posted June 2, 2008 Posted June 2, 2008 I'm trying to edit this script so that it clears the contents of the "UCF" directory for everyone who logs on the machine. Right now it only clears the current logged on user. Any help would be appreciated, I have very limited scripting knowledge. Dim objWSHShell :Set objWSHShell = CreateObject("WScript.Shell") Set objFSO = WScript.CreateObject("Scripting.FileSystemObject") DocumentumDir = ExpandEvnVariable("userProfile") & "\Documentum\" If objFSO.folderExists(DocumentumDir & "ucf") Then If objFSO.folderExists(DocumentumDir & "ucf.old") Then objFSO.deleteFolder(DocumentumDir & "ucf.old") End If objFSO.MoveFolder DocumentumDir & "ucf" , DocumentumDir & "ucf.old" End If ''_______________________________________________________________________________________________________________________________ Function ExpandEvnVariable(ExpandThis) ExpandEvnVariable = objWSHShell.ExpandEnvironmentStrings("%" & ExpandThis & "%") End Function
srochford Posted June 2, 2008 Posted June 2, 2008 If you're tring to set it so that when user1 logs on to the machine it clears this folder under docs and settings for each user then you can't :-( The docs and settings folders will be configured so that only the owner has rights to it (so user1 has rights to the user1 folder but not the user2 folder etc) You can do it in the machine startup script but that's hard work unless you can assume that the D&S root is c:\docs and settings. If that's OK then this should be on the right lines - note I haven't checked it but it's about right :-) sDS="c:\documents and settings\" set oFolder=ofso.getfolder(sDS) for each oSubFolder in oFolder.subfolders DocumentumDir = sDS & oSu.name & "\Documentum\" If oFSO.folderExists(DocumentumDir & "ucf") Then If oFSO.folderExists(DocumentumDir & "ucf.old") Then oFSO.deleteFolder(DocumentumDir & "ucf.old") End If oFSO.MoveFolder DocumentumDir & "ucf" , DocumentumDir & "ucf.old" End If next
soze Posted June 2, 2008 Author Posted June 2, 2008 OK, so I just name this with a .vbs and replace this with the old file? If you're tring to set it so that when user1 logs on to the machine it clears this folder under docs and settings for each user then you can't :-( The docs and settings folders will be configured so that only the owner has rights to it (so user1 has rights to the user1 folder but not the user2 folder etc) You can do it in the machine startup script but that's hard work unless you can assume that the D&S root is c:\docs and settings. If that's OK then this should be on the right lines - note I haven't checked it but it's about right :-) sDS="c:\documents and settings\" set oFolder=ofso.getfolder(sDS) for each oSubFolder in oFolder.subfolders DocumentumDir = sDS & oSu.name & "\Documentum\" If oFSO.folderExists(DocumentumDir & "ucf") Then If oFSO.folderExists(DocumentumDir & "ucf.old") Then oFSO.deleteFolder(DocumentumDir & "ucf.old") End If oFSO.MoveFolder DocumentumDir & "ucf" , DocumentumDir & "ucf.old" End If next
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now