|
vrodrigues -> RE: VBSCRIPT Help (7/2/2008 1:57:31 PM)
|
The script below should do the trick. '************************* Start of Script ******************************** Option Explicit Dim DebugMode Dim strComputer Dim objFSO Dim objRegistry Dim result Dim ProfSIDKeys Dim ProfSID Dim strProfPath Dim DocumentumDir Const HKEY_LOCAL_MACHINE = &H80000002 Set objFSO = CreateObject("Scripting.FileSystemObject") strComputer = GetWMIAttributeValue("Win32_ComputerSystem","Name") set objRegistry = GetObject("winmgmts:{impersonationLevel=impersonate}!//" & strComputer & "/root/default:StdRegProv") result = objRegistry.EnumKey(HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList", ProfSIDKeys) For Each ProfSID In ProfSIDKeys If (ProfSID <> "S-1-5-18") And (ProfSID <> "S-1-5-19") And (ProfSID <> "S-1-5-20") Then result = objRegistry.GetExpandedStringValue(HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\" & ProfSID, "ProfileImagePath", strProfPath) DocumentumDir = strProfPath & "\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 End If Next Function GetWMIAttributeValue (ClassName,ClassAttribute) Dim value Dim ClassSet Dim ClassInst value="" Set ClassSet = GetObject("winmgmts:").ExecQuery("Select * from " + ClassName) For Each ClassInst In ClassSet value = Trim(ClassInst.properties_(ClassAttribute)) Next GetWMIAttributeValue = value end Function '********************************* End of Script ************************************
|
|
|
|