leandro2k3 Posted June 23, 2009 Share Posted June 23, 2009 I am trying to record given data get on powershell in excel, but I did not discover a way to record the data, somebody I can help me? #### $excel = new-object -comobject excel.application $excel.visible = $true $workbook = $excel.workbooks.add() $workbook.workSheets.item(3).delete() $workbook.WorkSheets.item(2).delete() $workbook.WorkSheets.item(1).Name = "DBUsers" $sheet = $workbook.WorkSheets.Item("DBUsers") $x = 2 $lineStyle = "microsoft.office.interop.excel.xlLineStyle" -as [type] $colorIndex = "microsoft.office.interop.excel.xlColorIndex" -as [type] $borderWeight = "microsoft.office.interop.excel.xlBorderWeight" -as [type] $chartType = "microsoft.office.interop.excel.xlChartType" -as [type] For($b = 1 ; $b -le 5 ; $b++) { $sheet.cells.item(1,$ .font.bold = $true $sheet.cells.item(1,$ .borders.LineStyle = $lineStyle::xlDashDot $sheet.cells.item(1,$ .borders.ColorIndex = $colorIndex::xlColorIndexAutomatic $sheet.cells.item(1,$ .borders.weight = $borderWeight::xlMedium } $sheet.cells.item(1,1) = "Database" $sheet.cells.item(1,2) = "DisplayName" $sheet.cells.item(1,3) = "StorageLimitStatus" $sheet.cells.item(1,4) = "ItemCount" $sheet.cells.item(1,5) = "TotalItemSize" ############excel write ?? $Database = @{n="Database";e={ $stats.database }} $DisplayName = @{n="DisplayName";e={ $stats.Displayname }} $StorageLimitStatus = @{n="StorageLimitStatus";e={ $stats.StorageLimitStatus }} $ItemCount = @{n="ItemCount";e={ $stats.ItemCount }} $TotalItemSize = @{n="TotalItemSize(MB)";e={ $stats.TotalItemSize.Value.ToMB() }} $Servers=get-content c:\servers.txt Foreach($server in $servers) { $stats = get-mailbox -server $server | foreach { $stats = get-mailboxstatistics $_ $_ | select alias, *SMTP*,$Database,$DisplayName,$StorageLimitStatus,$ItemCount,$TotalItemSize $sheet.cells.item($x,1) = $database $sheet.cells.item($x,2) = $Displayname $sheet.cells.item($x,3) = $StorageLimitStatus $sheet.cells.item($x,4) = $ItemCount $sheet.cells.item($x,5) = $TotalItemSize.Value.ToMB $x++ } } ### Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 24, 2009 Share Posted June 24, 2009 I am trying to record given data get on powershell in excel, but I did not discover a way to record the data, somebody I can help me?Perhaps on a PowerShell forum? MSDN? Google with "site:microsoft.com"?, Bing?This is an AutoIt forum. If you want to do this with AutoIt, look at the _Excel* functions in the help file. By looking at the code in the Excel.au3 include file, you might even learn something useful about how to do it in other languages, like MS PowerShell. 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...
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