<?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>Search results for 'app:forums' matching tags 'windows', 'powershell', and 'get-wmiobject Win32_Product MSI Windows Installer'</title><link>http://powershell.com/cs/search/SearchResults.aspx?q=app:forums&amp;tag=windows,powershell,get-wmiobject+Win32_Product+MSI+Windows+Installer&amp;orTags=0&amp;o=DateDescending</link><description>Search results for 'app:forums' matching tags 'windows', 'powershell', and 'get-wmiobject Win32_Product MSI Windows Installer'</description><dc:language>en-US</dc:language><generator>CommunityServer 2008.5 (Build: 30929.2835)</generator><item><title>Folder and Disk Space utilization report</title><link>http://powershell.com/cs/forums/thread/10070.aspx</link><pubDate>Wed, 20 Apr 2011 05:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:10070</guid><dc:creator>squeekie</dc:creator><description>&lt;p&gt;I have a portion of a script that creates an excel spreadsheet and populates the drives for remote servers, their size as well as used and percentage.&amp;nbsp;(Found it here I believe)&amp;nbsp;What I need to add to this spreadsheet are all of the directories that are listed under the drives by using the get-content pointing to my .txt file.&lt;/p&gt;
&lt;p&gt;I.E. list only directories for each of the logical drives for the server&lt;/p&gt;
&lt;p&gt;here is what I have found thus far, I am able to create the new column, I am not able to populate the information into it.&lt;/p&gt;
&lt;p&gt;$strComputer = Get-Content &amp;lt;path to file&amp;gt;&lt;/p&gt;
&lt;p&gt;$Excel = New-Object -Com Excel.Application&lt;br /&gt;$Excel.visible = $True&lt;br /&gt;$Excel = $Excel.Workbooks.Add()&lt;/p&gt;
&lt;p&gt;$Sheet = $Excel.WorkSheets.Item(1)&lt;br /&gt;$Sheet.Cells.Item(1,1) = &amp;ldquo;Computer&amp;rdquo;&lt;br /&gt;$Sheet.Cells.Item(1,2) = &amp;ldquo;Drive Letter&amp;rdquo;&lt;br /&gt;$Sheet.Cells.Item(1,3) = &amp;ldquo;Description&amp;rdquo;&lt;br /&gt;$Sheet.Cells.Item(1,4) = &amp;ldquo;FileSystem&amp;rdquo;&lt;br /&gt;$Sheet.Cells.Item(1,5) = &amp;ldquo;Size in GB&amp;rdquo;&lt;br /&gt;$Sheet.Cells.Item(1,6) = &amp;ldquo;Free Space in GB&amp;rdquo;&lt;br /&gt;$Sheet.Cells.Item(1,7) = &amp;quot;Free Space in %&amp;quot;&lt;br /&gt;&lt;strong&gt;$Sheet.Cells.Item(1,8) = &amp;quot;Directories&amp;quot;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;$WorkBook = $Sheet.UsedRange&lt;br /&gt;$WorkBook.Interior.ColorIndex = 8&lt;br /&gt;$WorkBook.Font.ColorIndex = 11&lt;br /&gt;$WorkBook.Font.Bold = $True&lt;/p&gt;
&lt;p&gt;$intRow = 2&lt;br /&gt;$wmi1 = Get-wmiObject -class &amp;ldquo;Win32_LogicalDisk&amp;rdquo; -filter &amp;quot;DriveType = 3&amp;quot; -namespace &amp;ldquo;root\CIMV2&amp;quot; -computername $strComputer&lt;/p&gt;
&lt;p&gt;foreach ($objItem in $wmi1) {&lt;br /&gt;$Sheet.Cells.Item($intRow,1) = $objItem.SystemName&lt;br /&gt;$Sheet.Cells.Item($intRow,2) = $objItem.DeviceID&lt;br /&gt;$Sheet.Cells.Item($intRow,3) = $objItem.Description&lt;br /&gt;$Sheet.Cells.Item($intRow,4) = $objItem.FileSystem&lt;br /&gt;$Sheet.Cells.Item($intRow,5) = $objItem.Size / 1GB&lt;br /&gt;$Sheet.Cells.Item($intRow,6) = $objItem.FreeSpace / 1GB&lt;br /&gt;$Sheet.Cells.Item($IntRow,7) = ($objItem.FreeSpace / 1GB) / (($objItem.Size / 1GB))*100&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;lt;the next line of code would go here to populate the fields for each server&amp;gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;$intRow = $intRow + 1&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;$WorkBook.EntireColumn.AutoFit()&lt;br /&gt;Clear&lt;/p&gt;
&lt;p&gt;------------what I am trying to do now----------------------------&lt;/p&gt;
&lt;p&gt;What I have done to retrieve the folders, I run this after I created a psdrive for u:\&lt;/p&gt;
&lt;p&gt;get-childitem u:\ -recurse |&amp;nbsp;where-object {$_.psIscontainer} |&amp;nbsp;Where-Object {$_.fullname.Count -ne 0 }&lt;/p&gt;
&lt;p&gt;Only because I have not been able to query the servers in my .txt file.&amp;nbsp; My thought is to have a nested foreach and take the output of the variable and add it to the cell.&amp;nbsp; Once the query is complete for that server, it begins to&amp;nbsp;query the next server on the list and populate the next row in excel.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>