+ Post New Thread
Results 1 to 3 of 3
How do you do....it? Thread, VBSCRIPT in Technical; I'm trying to edit this script so that it clears the contents of the "UCF" directory for everyone who logs ...
  1. #1

    Join Date
    May 2008
    Posts
    14
    Thank Post
    9
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    VBSCRIPT

    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

  2. #2

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,156
    Thank Post
    116
    Thanked 529 Times in 452 Posts
    Blog Entries
    2
    Rep Power
    124
    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 :-)

    Code:
    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

  3. #3

    Join Date
    May 2008
    Posts
    14
    Thank Post
    9
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    OK, so I just name this with a .vbs and replace this with the old file?



    Quote Originally Posted by srochford View Post
    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 :-)

    Code:
    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

SHARE:
+ Post New Thread

Similar Threads

  1. VBScript / SQL Server
    By Gatt in forum Scripts
    Replies: 7
    Last Post: 23rd September 2011, 03:21 PM
  2. VBScript IDE + Debugger
    By Geoff in forum Scripts
    Replies: 4
    Last Post: 13th September 2007, 08:56 PM
  3. VBScript Error
    By sqdge in forum Scripts
    Replies: 20
    Last Post: 13th September 2007, 03:34 PM
  4. VBScript
    By StewartKnight in forum Coding
    Replies: 5
    Last Post: 1st May 2007, 11:04 AM
  5. Printer vbscript ?
    By mac_shinobi in forum Scripts
    Replies: 1
    Last Post: 14th September 2005, 08:21 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •