I discoverd that Win32_Directory problem with subfolders where folder names are GUIDs. Script would just fail. Had to rewrite a script from a nice central/enterprise idea to a locally run FileSystemObject based one. Sigh... -- ....Blackhawk, always learning something new.
"Brian MXP" wrote:
[Quoted Text] > Howdy- > > I'm aware of the post-XP SP2 changes for the Win32_Directory (or Win32_Subdirectory) > Delete methods (where you can't delete a directory if a subdirectory exists), but still > can't seem to successfully do what I want - which is delete user profiles from remote > machines using WMI & VBScript. > > Even if I copy/paste the code in: > > http://www.microsoft.com/technet/scriptcenter/resources/qanda/apr05/hey0405.mspx> > and run it against a strFolderName like "c:\documents and settings\joeuser", I usually end > up with a (null): 0x80041017 error in the line reading: > > For Each objFolder in colSubfolders (or For Each objFolder2 in colSubFolders2) > > and the colSubFolders is set to: > > Set colSubfolders = objWMIService.ExecQuery _ > ("Associators of {Win32_Directory.Name='" & strFolderName & "'} " _ > & "Where AssocClass = Win32_Subdirectory " _ > & "ResultRole = PartComponent") > > > Has anyone found success in using this newer method (enumerating the entire folder tree & > then deleting them from the bottom up)? Or found any problems/better ways to do it? > > Thanks, > Brian >
|