VBScript help

meaty

[H]ard|Gawd
Joined
Dec 13, 2001
Messages
1,466
I'm pretty much a n00b at vbs, I need to remove pst files from all users profiles. I found this script online but I get the follow error when I try to run it. Any help would be appreciated. Thanks

Code:
Const HKEY_LOCAL_MACHINE = &H80000002 
Const HKEY_USERS = &H80000003 
strComputer = "." 
Set WshShell = WScript.CreateObject("WScript.Shell") 
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _ 
    & strComputer & "\root\default:StdRegProv") 
    
Function SID() 
' Get the user SIDs 
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" 
objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys 
SID1 = arrSubKeys 
End Function 
  
' Get the user Outlook Profile 
For Each Subkey in arrSubKeys
strKeyPath2 = SID1 & "\SOFTWARE\Microsoft\Windows NT\Current Version\Windows Messaging Subsystem\Profiles" 
objReg.EnumKey HKEY_USERS, strKeyPath2, arrSubKeys2 
Next
  
For Each subkey in arrSubKeys2 
Return = WshShell.Run("C:\delpst\delpst.exe -p " & subkey & " -f b", 2, true) 
Next

Error
Code:
Microsoft VBScript runtime error (17, 1) : Object not a collection
 
Back
Top