folder ownership
From: dave (anonymous_at_discussions.microsoft.com)
Date: 05/25/04
- Previous message: aelkins: "Smart Card Login fails after renewal"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Tue, 25 May 2004 14:16:09 -0700
I'm trying to take ownership of a redirected "My Documents" folder and all sub-folders. I'm able to take ownership of the %username% and "My Documents" folders, then grant full control to myself ok. The problem is that sub-folders exist whose names I won't necessarily know. Therefore my recursive routine below fails to find the folders because I have no permission on those folders. I can view the folders in Explorer, but can't enumerate them programmatically.
Any thought as to how to get this done?
Note that the changeOwner routine uses WMI which requires the servername and servers local path to the folder, where the recursive routine uses FSO and a drive mapped to the remote machine from the machine running the VBScript.
TIA - Dave
'first the root folder
if changeOwner("intell-01","E:\ClientData\user1","user1") then
wscript.echo "changes successful..."
else
wscript.echo "changes *NOT* successful..."
end if
'second "My Documents"
if changeOwner("intell-01","E:\ClientData\user1\My Documents","user1") then
wscript.echo "changes successful..."
else
wscript.echo "changes *NOT* successful..."
end if
'now do the same with all sub-folders of "My Documents"...
Process_All_Folders objFSO.GetFolder("E:\user1\My Documents")
Sub Process_All_Folders(Folder)
For Each Subfolder in Folder.SubFolders
if changeOwner(strSourceMachine,subFolder.Path,strNewOwner) then
wscript.echo "changes successful..."
else
wscript.echo "changes *NOT* successful..."
end if
Process_All_Folders Subfolder
Next
End Sub 'Process_All_Folders
- Previous message: aelkins: "Smart Card Login fails after renewal"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]