PC Review Forums Newsgroups Windows XP Windows XP WMI Problems with Win32_Directory Delete method

Reply

Problems with Win32_Directory Delete method

 
Thread Tools Rate Thread
Old 08-06-2007, 04:58 PM   #1
Brian MXP
Guest
 
Posts: n/a
Default Problems with Win32_Directory Delete method


Hello-

I'm aware of the post-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.

But even when I copy/paste the code in:

http://www.microsoft.com/technet/sc...05/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
  Reply With Quote
Old 06-04-2008, 08:16 AM   #2
guzarva16
Guest
 
Posts: n/a
Default RE: Problems with Win32_Directory Delete method



"Brian MXP" wrote:

> Hello-
>
> I'm aware of the post-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.
>
> But even when I copy/paste the code in:
>
> http://www.microsoft.com/technet/sc...05/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
>

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off