thepip3r Posted July 28, 2008 Share Posted July 28, 2008 I'm trying to figure out how I can grab all of the folder object names in a specified folder, this is what I have so far. $DNSDomain = @LogonDNSDomain $GPOFolder = "\SYSVOL\" & $DNSDomain & "\Policies" $strComputer = "." $objFSO_GPO = ObjCreate("Scripting.FileSystemObject") If $DNSDomain = "" Then MsgBox(0, "Critical Error", "Target domain could not be obtained.") If Not IsObj($objFSO_GPO) Then MsgBox(0, "Critical Error", "File System Object could not be created.") MsgBox(0, "", $DNSDomain & $GPOFolder) $objFSO_GPO_Folder = $objFSO_GPO.GetFolder("\\" & $DNSDomain & $GPOFolder) $arrGPO_SubFolders = $objFSO_GPO.Subfolders For $folder in $arrGPO_SubFolders MsgBox(0, "", $folder) Next I'm getting an error that "the requested action with this object failed." Can anyone tell me if I'm even headed in the right direction? PLS HELP! TIA. My Additions:- RunAs AdminDeviant Fun:- Variable Sound Volume Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 28, 2008 Share Posted July 28, 2008 (edited) I'm trying to figure out how I can grab all of the folder object names in a specified folder, this is what I have so far. $DNSDomain = @LogonDNSDomain $GPOFolder = "\SYSVOL\" & $DNSDomain & "\Policies" $strComputer = "." $objFSO_GPO = ObjCreate("Scripting.FileSystemObject") If $DNSDomain = "" Then MsgBox(0, "Critical Error", "Target domain could not be obtained.") If Not IsObj($objFSO_GPO) Then MsgBox(0, "Critical Error", "File System Object could not be created.") MsgBox(0, "", $DNSDomain & $GPOFolder) $objFSO_GPO_Folder = $objFSO_GPO.GetFolder("\\" & $DNSDomain & $GPOFolder) $arrGPO_SubFolders = $objFSO_GPO.Subfolders For $folder in $arrGPO_SubFolders MsgBox(0, "", $folder) Next I'm getting an error that "the requested action with this object failed." Can anyone tell me if I'm even headed in the right direction? PLS HELP! TIA. Are you getting that error for .GetFolder or .Subfolders? Post the text of the error. Are you sure the domain name is the same as the server name? Can you connect manually to this ("\\" & $DNSDomain & $GPOFolder)? P.S. Just noticed you are taking .Subfolders of the wrong object. Use $objFSO_GPO_Folder.Subfolders instead. Also, in your For/Next loop nothing will be displayed because $folder is an object, so change that to MsgBox(0, "", $folder.Name) or some such... Edited July 28, 2008 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
thepip3r Posted July 29, 2008 Author Share Posted July 29, 2008 Psalty... YOU ARE THE ****ing MAN!. Ty for pointing out my noob mistakes. My Additions:- RunAs AdminDeviant Fun:- Variable Sound Volume Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now