<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://powershell.com/cs/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>PowerShell for Windows</title><link>http://powershell.com/cs/forums/200.aspx</link><description>Moderated by PowerShell MVP &lt;a href="http://powershell.com/cs/content/experts.aspx#tobias-weltner"&gt;Dr. Tobias Weltner&lt;/a&gt;</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 (Build: 30929.2835)</generator><item><title>Re: Audit map drives on remote machines</title><link>http://powershell.com/cs/forums/thread/16289.aspx</link><pubDate>Mon, 30 Apr 2012 06:15:39 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:16289</guid><dc:creator>Felipe</dc:creator><slash:comments>0</slash:comments><comments>http://powershell.com/cs/forums/thread/16289.aspx</comments><wfw:commentRss>http://powershell.com/cs/forums/commentrss.aspx?SectionID=200&amp;PostID=16289</wfw:commentRss><description>&lt;p&gt;Hum I see. It&amp;#39;s a bit more complicated.&lt;/p&gt;
&lt;p&gt;Try this:&lt;/p&gt;
&lt;p&gt;&lt;blockquote style="overflow-x: scroll;"&gt;&lt;pre style="margin: 0px;"&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Function SearchOU($OU){&lt;/p&gt;
&lt;p&gt;$dom = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()&lt;/p&gt;
&lt;p&gt;$root = $dom.GetDirectoryEntry()&lt;/p&gt;
&lt;p&gt;$search = [System.DirectoryServices.DirectorySearcher]$root&lt;/p&gt;
&lt;p&gt;$search.Filter = &amp;quot;(OU=$OU)&amp;quot;&lt;/p&gt;
&lt;p&gt;$result = $search.FindAll()&lt;/p&gt;
&lt;p&gt;if($result.count -gt 1){&lt;br /&gt;foreach($r in $result){&lt;br /&gt;if($r.path -match $top){$result = $r}&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;Try{&lt;br /&gt;$path = [ADSI]$result[0].path}&lt;br /&gt;Catch{$path = [ADSI]$result.path}&lt;/p&gt;
&lt;p&gt;$children = $path.psbase.children&lt;/p&gt;
&lt;p&gt;foreach($child in $children){&lt;/p&gt;
&lt;p&gt;if($child.objectcategory -like &amp;#39;*organizational*&amp;#39;){&lt;/p&gt;
&lt;p&gt;SearchOU($child.name)&lt;/p&gt;
&lt;p&gt;}&lt;br /&gt;if($child.objectcategory -like &amp;#39;*person*&amp;#39;){}&lt;/p&gt;
&lt;p&gt;else{&lt;br /&gt;if(Test-Connection -ComputerName $child.name -Count 1 -Quiet){&lt;br /&gt;foreach($drive in (Get-WmiObject win32_systemnetworkconnections -ComputerName $child.name | select -ExpandProperty partcomponent))&lt;/p&gt;
&lt;p&gt;{$drive.split(&amp;quot;.&amp;quot;,4)[1]}}&lt;br /&gt;else{Write-Host $child.name &amp;quot;did not respond.&amp;quot;}&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;}}&lt;/p&gt;
&lt;p&gt;$OU = Read-Host &amp;quot;Type OU name&amp;quot;&lt;br /&gt;$top = $OU&lt;br /&gt;SearchOU($OU)&lt;/p&gt;
&lt;p&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;
&lt;p&gt;Do not replace the OU anymore. It will prompt you for it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Audit map drives on remote machines</title><link>http://powershell.com/cs/forums/thread/16287.aspx</link><pubDate>Mon, 30 Apr 2012 02:40:30 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:16287</guid><dc:creator>pmrku</dc:creator><slash:comments>0</slash:comments><comments>http://powershell.com/cs/forums/thread/16287.aspx</comments><wfw:commentRss>http://powershell.com/cs/forums/commentrss.aspx?SectionID=200&amp;PostID=16287</wfw:commentRss><description>&lt;p&gt;this is an example of the typical structure:&lt;/p&gt;
&lt;p&gt;Xyz.com.au&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xyz&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Melbourne&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Disabled Accounts&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Resources&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; UsersAndGroups&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Workstations&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Sydney&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Computer Accounts&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Groups&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Resources&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; User Accounts&lt;/p&gt;
&lt;p&gt;what i am after is to query all computers in the Melbourne OU, and retrieve all the map drives that have been installed on computers in this OU either by the user or by GPO.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Audit map drives on remote machines</title><link>http://powershell.com/cs/forums/thread/16277.aspx</link><pubDate>Mon, 30 Apr 2012 01:54:57 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:16277</guid><dc:creator>Felipe</dc:creator><slash:comments>0</slash:comments><comments>http://powershell.com/cs/forums/thread/16277.aspx</comments><wfw:commentRss>http://powershell.com/cs/forums/commentrss.aspx?SectionID=200&amp;PostID=16277</wfw:commentRss><description>&lt;p&gt;Is the OU name unique? Is there other OUs inside this OU?&lt;/p&gt;
&lt;p&gt;Also if you are using the Computers container you have to change OU= to CN=&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Audit map drives on remote machines</title><link>http://powershell.com/cs/forums/thread/16276.aspx</link><pubDate>Mon, 30 Apr 2012 00:55:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:16276</guid><dc:creator>pmrku</dc:creator><slash:comments>0</slash:comments><comments>http://powershell.com/cs/forums/thread/16276.aspx</comments><wfw:commentRss>http://powershell.com/cs/forums/commentrss.aspx?SectionID=200&amp;PostID=16276</wfw:commentRss><description>&lt;p&gt;thanks for providing the description. i have tried to run the script but got the following error message:&lt;/p&gt;
&lt;p&gt;The only part i changed was the adding in the OU, is there something i have missed?&lt;/p&gt;
&lt;p&gt;Get-WmiObject : Cannot validate argument on parameter &amp;#39;ComputerName&amp;#39;. The argument is null or empty. Supply an argument that is not null or empty and then try the comman&lt;br /&gt;d again.&lt;br /&gt;At line:2 char:78&lt;br /&gt;+ foreach($drive in (Get-WmiObject win32_systemnetworkconnections -ComputerName &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;nbsp; $child.name | select -ExpandProperty partcomponent))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; + CategoryInfo&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : InvalidData: (:) [Get-WmiObject], ParameterBindingValidationException&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.GetWmiObjectCommand&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Audit map drives on remote machines</title><link>http://powershell.com/cs/forums/thread/16275.aspx</link><pubDate>Sun, 29 Apr 2012 23:51:48 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:16275</guid><dc:creator>Felipe</dc:creator><slash:comments>0</slash:comments><comments>http://powershell.com/cs/forums/thread/16275.aspx</comments><wfw:commentRss>http://powershell.com/cs/forums/commentrss.aspx?SectionID=200&amp;PostID=16275</wfw:commentRss><description>&lt;p&gt;Sure no problem.&lt;/p&gt;
&lt;p&gt;The first line creates an object with information about your domain.&lt;/p&gt;
&lt;p&gt;The second and third line create a searcher.&lt;/p&gt;
&lt;p&gt;The forth sets the filter. (ie which OU to search)&lt;/p&gt;
&lt;p&gt;The fifth store the search&amp;#39;s result.&lt;/p&gt;
&lt;p&gt;The sixth&amp;nbsp;cast it as&amp;nbsp;ADSI resulting in a DirectoryEntry&amp;nbsp;object.&lt;/p&gt;
&lt;p&gt;The seventh get all objects in inside that DirectoryEntry&amp;nbsp;object. (ie all computers in the&amp;nbsp;OU passed as filter)&lt;/p&gt;
&lt;p&gt;Then we query all those computer names&amp;nbsp;one by one getting in return the network drives for each of them.&lt;/p&gt;
&lt;p&gt;The last line is just for readness sake.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Audit map drives on remote machines</title><link>http://powershell.com/cs/forums/thread/16274.aspx</link><pubDate>Sun, 29 Apr 2012 23:33:44 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:16274</guid><dc:creator>pmrku</dc:creator><slash:comments>0</slash:comments><comments>http://powershell.com/cs/forums/thread/16274.aspx</comments><wfw:commentRss>http://powershell.com/cs/forums/commentrss.aspx?SectionID=200&amp;PostID=16274</wfw:commentRss><description>&lt;p&gt;Hi Felipe,&lt;/p&gt;
&lt;p&gt;thankyou for the script, could i trouble you to describe how this script works please.&lt;/p&gt;
&lt;p&gt;Many thanks,&lt;/p&gt;
&lt;p&gt;Ryan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Audit map drives on remote machines</title><link>http://powershell.com/cs/forums/thread/16215.aspx</link><pubDate>Thu, 26 Apr 2012 10:25:42 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:16215</guid><dc:creator>Felipe</dc:creator><slash:comments>0</slash:comments><comments>http://powershell.com/cs/forums/thread/16215.aspx</comments><wfw:commentRss>http://powershell.com/cs/forums/commentrss.aspx?SectionID=200&amp;PostID=16215</wfw:commentRss><description>&lt;p&gt;&lt;blockquote style="overflow-x: scroll;"&gt;&lt;pre style="margin: 0px;"&gt;&lt;/p&gt;
&lt;p&gt;$dom = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()&lt;/p&gt;
&lt;p&gt;$root = $dom.GetDirectoryEntry()&lt;/p&gt;
&lt;p&gt;$search = [System.DirectoryServices.DirectorySearcher]$root&lt;/p&gt;
&lt;p&gt;$search.Filter = &amp;quot;(OU=LabComputers)&amp;quot;&lt;/p&gt;
&lt;p&gt;$result = $search.FindAll()&lt;/p&gt;
&lt;p&gt;$path = [ADSI]$result[0].path&lt;/p&gt;
&lt;p&gt;$children = $path.psbase.children&lt;/p&gt;
&lt;p&gt;foreach($child in $children){&lt;/p&gt;
&lt;p&gt;foreach($drive in (Get-WmiObject win32_systemnetworkconnections -ComputerName $child.name | select -ExpandProperty partcomponent))&lt;/p&gt;
&lt;p&gt;{$drive.split(&amp;quot;.&amp;quot;,4)[1]}}&lt;/p&gt;
&lt;p&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;
&lt;p&gt;Replace LabComputers with your OU.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Audit map drives on remote machines</title><link>http://powershell.com/cs/forums/thread/16212.aspx</link><pubDate>Thu, 26 Apr 2012 05:44:40 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:16212</guid><dc:creator>pmrku</dc:creator><slash:comments>0</slash:comments><comments>http://powershell.com/cs/forums/thread/16212.aspx</comments><wfw:commentRss>http://powershell.com/cs/forums/commentrss.aspx?SectionID=200&amp;PostID=16212</wfw:commentRss><description>&lt;p&gt;hi there,&lt;/p&gt;
&lt;p&gt;i have the need to create a powershell script to list all map drives on remote machines in a particular OU. We are performing a audit of all network shares either created by GPO or manually by users.&lt;/p&gt;
&lt;p&gt;Can someone out there assist please.&lt;/p&gt;
&lt;p&gt;Many thanks,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Ryan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>