WeslyWest
02-19-2008, 04:40 AM
Hi,
I'm trying to use WMI to grab a collection of winnt user profile folders, then check the folder names to see if they have certain phrase in them and if so then grab the ntuser.dat file in that folder.
I've got this far...
Set colFolderList = objWMI.ExecQuery _
("ASSOCIATORS OF {Win32_Directory.Name='C:\Documents and Settings'} Where " _
& "ResultClass = Win32_Directory")
For Each objFolder In colFolderList
If InStr(objFolder.FileName, "admin") Then
Then I lose it...
Set colDATFile = objWMI.ExecQuery _
("ASSOCIATORS OF {Win32_Directory.Name='C:\Documents and Settings\' & objFolder.FileName} Where " _
& "FileName = NTUser.dat")
I know that's wrong but I can't work outthe syntax.
Please can you help.
Thanks
I'm trying to use WMI to grab a collection of winnt user profile folders, then check the folder names to see if they have certain phrase in them and if so then grab the ntuser.dat file in that folder.
I've got this far...
Set colFolderList = objWMI.ExecQuery _
("ASSOCIATORS OF {Win32_Directory.Name='C:\Documents and Settings'} Where " _
& "ResultClass = Win32_Directory")
For Each objFolder In colFolderList
If InStr(objFolder.FileName, "admin") Then
Then I lose it...
Set colDATFile = objWMI.ExecQuery _
("ASSOCIATORS OF {Win32_Directory.Name='C:\Documents and Settings\' & objFolder.FileName} Where " _
& "FileName = NTUser.dat")
I know that's wrong but I can't work outthe syntax.
Please can you help.
Thanks