SoftVoile Posted December 9, 2008 Share Posted December 9, 2008 (edited) hi, i want to delete all *.doc , *.docx and a file Old_Update.txt from all shared folders. i think i can use the following registry key + RegEnumKey to get path of all shared folder of my pc. HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\WorkgroupCrawler\Sharesam i right? but i don't know how to use this key for deleting files from shared folders of my computer. and maybe i am guessing wrong and there is some other way to do this task. i am not sure please guide me and tell how to do it. Edited December 9, 2008 by SoftVoile Unresolved topics:1- Please help me in Editing or replacing a page in FireFox and IE.Please have a look at them. Link to comment Share on other sites More sharing options...
youknowwho4eva Posted December 9, 2008 Share Posted December 9, 2008 What about Drivegettype? Wouldn't that return if the folder is networked? Giggity Link to comment Share on other sites More sharing options...
SoftVoile Posted December 9, 2008 Author Share Posted December 9, 2008 Success: Returns the type of drive: "Unknown", "Removable", "Fixed", "Network", "CDROM", "RAMDisk"but the (Shared) Folder's names 'll be different on all computers. and i don't know what will be the names of shared folders. also there will be more then on shared folder. Unresolved topics:1- Please help me in Editing or replacing a page in FireFox and IE.Please have a look at them. Link to comment Share on other sites More sharing options...
NeoFoX Posted December 9, 2008 Share Posted December 9, 2008 (edited) Straight from the help file, with a little mod. : $var = DriveGetDrive( "all" ) If NOT @error Then For $i = 1 to $var[0] $type = DriveGetType($var[$i]) if $type = "Network" then MsgBox(1,"Drives" & $i, $var[$i] & " is a network-drive") EndIf Next EndIf Neo Edited December 9, 2008 by NeoFoX [center][font="Arial"]--- The Neo and Only --- [/font][font="Arial"]--Projects---[/font]Image to Text converterText to ASCII converter[/center] Link to comment Share on other sites More sharing options...
SoftVoile Posted December 9, 2008 Author Share Posted December 9, 2008 Straight from the help file, with a little mod. :Neothanks but i asked for shared Folders not Drives. Please read my posts in this thread again. Unresolved topics:1- Please help me in Editing or replacing a page in FireFox and IE.Please have a look at them. Link to comment Share on other sites More sharing options...
November Posted December 9, 2008 Share Posted December 9, 2008 Hi there, Should this help you? $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $Output="" $Output &= "Computer: " & $strComputer & @CRLF $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_ShareToDirectory", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems $Output &= "Share: " & $objItem.Share & @CRLF $Output &= "SharedElement: " & $objItem.SharedElement & @CRLF Next ConsoleWrite($Output) FileWrite(@TempDir & "\Win32_ShareToDirectory.TXT", $Output ) Run(@Comspec & " /c start " & @TempDir & "\Win32_ShareToDirectory.TXT" ) Else Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_ShareToDirectory" ) Endif Cheers Old Scriptology Visual Ping 1.8 - Mass Ping Program with export to txt delimited. Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code. Desktop 2 RGB - Pick a color in the desktop and get the RGB code. ShootIT 1.0 - Screen Capture full and partial screen [font="'Arial Black';"]Remember Remember The Fifth of November.[/font] Link to comment Share on other sites More sharing options...
November Posted December 9, 2008 Share Posted December 9, 2008 why i can not start a new thread in other sections of this forum?Hi,First: Did you run the script that i posted?Second : I beliave you can, just dont start a hello topic.Cheers Old Scriptology Visual Ping 1.8 - Mass Ping Program with export to txt delimited. Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code. Desktop 2 RGB - Pick a color in the desktop and get the RGB code. ShootIT 1.0 - Screen Capture full and partial screen [font="'Arial Black';"]Remember Remember The Fifth of November.[/font] Link to comment Share on other sites More sharing options...
November Posted December 9, 2008 Share Posted December 9, 2008 Hi again... Maybe you'll get the picture with this : $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost";change to a machine name $Output="" $Output &= "Computer: " & $strComputer & @CRLF $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Share", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems $Output &= "Name: " & $objItem.Name & @CRLF $Output &= "Path: " & $objItem.Path & @CRLF Next ConsoleWrite($Output) ConsoleWrite($Output) Else Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_ShareToDirectory" ) Endif Func WMIDateStringToDate($dtmDate) Return (StringMid($dtmDate, 5, 2) & "/" & _ StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _ & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2)) EndFunc Cheers Old Scriptology Visual Ping 1.8 - Mass Ping Program with export to txt delimited. Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code. Desktop 2 RGB - Pick a color in the desktop and get the RGB code. ShootIT 1.0 - Screen Capture full and partial screen [font="'Arial Black';"]Remember Remember The Fifth of November.[/font] Link to comment Share on other sites More sharing options...
SoftVoile Posted December 9, 2008 Author Share Posted December 9, 2008 Hi again... Maybe you'll get the picture with this : ... Cheers thanks, this script gives a list of shared folders in $OutPut along with all info, but i need retrieve/get only path of folders. can you modify it to suit my needs? Unresolved topics:1- Please help me in Editing or replacing a page in FireFox and IE.Please have a look at them. Link to comment Share on other sites More sharing options...
youknowwho4eva Posted December 9, 2008 Share Posted December 9, 2008 Dim $path[1000000] $n = 1 $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost";change to a machine name $Output="" $Output &= "Computer: " & $strComputer & @CRLF $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Share", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems $Output &= "Name: " & $objItem.Name & @CRLF $Output &= "Path: " & $objItem.Path & @CRLF $path[$n] = $objitem.path $n += 1 Next ConsoleWrite($Output) ConsoleWrite($Output) Else Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_ShareToDirectory" ) Endif Func WMIDateStringToDate($dtmDate) Return (StringMid($dtmDate, 5, 2) & "/" & _ StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _ & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2)) EndFunc Maybe something like that? Giggity Link to comment Share on other sites More sharing options...
November Posted December 10, 2008 Share Posted December 10, 2008 (edited) Hi again, You can shape it as you wish... $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost";change to a machine name $Output="" $Output &= "Computer: " & $strComputer & @CRLF $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Share", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems $Output &= "Path: " & $objItem.Path & @CRLF Next ConsoleWrite($Output) ConsoleWrite($Output) Else Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_ShareToDirectory" ) Endif Func WMIDateStringToDate($dtmDate) Return (StringMid($dtmDate, 5, 2) & "/" & _ StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _ & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2)) EndFunc P.S. - i'm not currently in my laptop, later i'll come and check this again Cheers Edited December 10, 2008 by November Old Scriptology Visual Ping 1.8 - Mass Ping Program with export to txt delimited. Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code. Desktop 2 RGB - Pick a color in the desktop and get the RGB code. ShootIT 1.0 - Screen Capture full and partial screen [font="'Arial Black';"]Remember Remember The Fifth of November.[/font] Link to comment Share on other sites More sharing options...
SoftVoile Posted December 10, 2008 Author Share Posted December 10, 2008 (edited) Hi again, You can shape it as you wish... code in previous script CheersHi november, i created a folder D:\Shared_Test and shared it on network. now after running your [last] script the result is as follow. Computer: localhost Path: E:\ Path: Path: D:\ Path: F:\ Path: C:\WINDOWS Path: D:\Shared_Test Path: C:\ Computer: localhost Path: E:\ Path: Path: D:\ Path: F:\ Path: C:\WINDOWS Path: D:\Shared_Test Path: C:\ >Exit code: 0 Time: 0.635 but i want the script to show only the shared path one by one like following D:\Shared_Test can you please tell me how remove all extra paths which script is showing in result? any example of deleting files from shared folders? hi, i want to delete all *.doc , *.docx and a file Old_Update.txt from all shared folders. i think i can use the following registry key + RegEnumKey to get path of all shared folder of my pc. HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\WorkgroupCrawler\Shares am i right? but i don't know how to use this key for deleting files from shared folders of my computer. and maybe i am guessing wrong and there is some other way to do this task. i am not sure please guide me and tell how to do it. i think you converted VBS to AU3, right? but i don't know VBS... trying to do it using autoit. thanks for your efforts and help. Edited December 10, 2008 by SoftVoile Unresolved topics:1- Please help me in Editing or replacing a page in FireFox and IE.Please have a look at them. Link to comment Share on other sites More sharing options...
SoftVoile Posted December 11, 2008 Author Share Posted December 11, 2008 thread started at Dec 9 2008, 03:14 PM Bump i need help... Unresolved topics:1- Please help me in Editing or replacing a page in FireFox and IE.Please have a look at them. Link to comment Share on other sites More sharing options...
November Posted December 11, 2008 Share Posted December 11, 2008 Hi there, Is this ok 4 you m8? #include <array.au3> $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "127.0.0.1";change to a machine name dim $array[1] $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Share", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems $Output = $objItem.Path ConsoleWrite($Output & @CRLF) _ArrayAdd($array, $Output) Next $Alim = UBound($array) ConsoleWrite("lim : " & $Alim & @CRLF) _ArrayDelete($array, $Alim) Else Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_ShareToDirectory" ) Endif _ArrayDisplay($array, "teste") Func WMIDateStringToDate($dtmDate) Return (StringMid($dtmDate, 5, 2) & "/" & _ StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _ & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2)) EndFunc Cheers Old Scriptology Visual Ping 1.8 - Mass Ping Program with export to txt delimited. Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code. Desktop 2 RGB - Pick a color in the desktop and get the RGB code. ShootIT 1.0 - Screen Capture full and partial screen [font="'Arial Black';"]Remember Remember The Fifth of November.[/font] Link to comment Share on other sites More sharing options...
SoftVoile Posted December 11, 2008 Author Share Posted December 11, 2008 Hi again november, i created a folder D:\Shared_Test and shared it on network. now after running your [last] script shows the following. http://i38.tinypic.com/2en3ki9.png just notice that i have shared only one folder which is 'D:\Shared_Test' but the script also shows extra paths like 'F:\Windows' why? and i want the script to show only the shared path one by one like following D:\Shared_Test can you please tell me how remove all extra paths which script is showing in result? any example of deleting files from shared folders using your script? hi, i want to delete all *.doc , *.docx and a file Old_Update.txt from all shared folders. i think i can use the following registry key + RegEnumKey to get path of all shared folder of my pc. CODE HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\WorkgroupCrawler\Shares am i right? but i don't know how to use this key for deleting files from shared folders of my computer. and maybe i am guessing wrong and there is some other way to do this task. i am not sure please guide me and tell how to do it. Thanks for your efforts and help. Unresolved topics:1- Please help me in Editing or replacing a page in FireFox and IE.Please have a look at them. Link to comment Share on other sites More sharing options...
November Posted December 12, 2008 Share Posted December 12, 2008 Hi there, The script is giving you all the shares including the administrative shares, i've changed the script to give you only the your shared folders: #include <array.au3> $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "127.0.0.1";change to a machine name dim $array[1] $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Share WHERE TYPE = 0", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems $Output = $objItem.Path ConsoleWrite($Output & @CRLF) ;Sleep(3000) _ArrayAdd($array, $Output) Next Else Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_ShareToDirectory" ) Endif _ArrayDisplay($array, "Your Shared Places") Func WMIDateStringToDate($dtmDate) Return (StringMid($dtmDate, 5, 2) & "/" & _ StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _ & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2)) EndFunc I hope this helps, Cheers Old Scriptology Visual Ping 1.8 - Mass Ping Program with export to txt delimited. Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code. Desktop 2 RGB - Pick a color in the desktop and get the RGB code. ShootIT 1.0 - Screen Capture full and partial screen [font="'Arial Black';"]Remember Remember The Fifth of November.[/font] Link to comment Share on other sites More sharing options...
99ojo Posted December 12, 2008 Share Posted December 12, 2008 Hi, you get the shares from regkey HKLM\SYSTEM\CurrentControlSet\Services\lanmanservers\shares. you have to extract the sharekeys: e.g. c:\temp as temp$ -> then you have a REG_Multi_SZ key temp$ with the following contents: CSCFlags=0 MaxUses=4294967295 Path=C:\temp Permissions=0 Remark= Type=0 you have to extract the path. this may help you. Link to comment Share on other sites More sharing options...
SoftVoile Posted December 14, 2008 Author Share Posted December 14, 2008 Hi there, The script is giving you all the shares including the administrative shares, i've changed the script to give you only the your shared folders: #include <array.au3> $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "127.0.0.1";change to a machine name dim $array[1] $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Share WHERE TYPE = 0", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems $Output = $objItem.Path ConsoleWrite($Output & @CRLF) ;Sleep(3000) _ArrayAdd($array, $Output) Next Else Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_ShareToDirectory" ) Endif _ArrayDisplay($array, "Your Shared Places") Func WMIDateStringToDate($dtmDate) Return (StringMid($dtmDate, 5, 2) & "/" & _ StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _ & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2)) EndFunc I hope this helps, Cheers Hi again november, Thanks for your efforts and help. one last question. what should be $strComputer = ? you said change it to a machine name in comments.... you mean @ComputerName, right? Unresolved topics:1- Please help me in Editing or replacing a page in FireFox and IE.Please have a look at them. Link to comment Share on other sites More sharing options...
November Posted December 15, 2008 Share Posted December 15, 2008 Hi again, Yes... if you want to. But you can sort remote shares in remote hosts aswell, if you have link and permissions That depends in what your script is intend to do Cheers m8 Old Scriptology Visual Ping 1.8 - Mass Ping Program with export to txt delimited. Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code. Desktop 2 RGB - Pick a color in the desktop and get the RGB code. ShootIT 1.0 - Screen Capture full and partial screen [font="'Arial Black';"]Remember Remember The Fifth of November.[/font] 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