Clicky

I copied a script from this Site and modified it. It works great but I am running it on remote servers in other states and it took about 10 minutes to gather info for 120 queue on two servers in different states.

Is there any way to speed the script up? I can run a similar VB script and it goes about twice as fast.

One thing about this script is it opens a excel sheet and fills the info in as you watch, is there a way to just make it save the excel sheet to a location and update it instead of doing it real time? Would that speed it up any?

Thanks,

 # Get server list $ServerList = Get-Content "servers.txt";    # Create new Excel workbook $Excel = new-Object -comobject Excel.Application $Excel.visible = $True $Excel = $Excel.Workbooks.Add() $Sheet = $Excel.Worksheets.Item(1) $Sheet.Cells.Item(1,1) = "Server Name" $Sheet.Cells.Item(1,2) = "Printer Name" $Sheet.Cells.Item(1,3) = "IP Address" $Sheet.Cells.Item(1,4) = "Driver Name" $Sheet.Cells.Item(1,5) = "Location" $Sheet.Cells.Item(1,6) = "Comment" $Sheet.Cells.Item(1,7) = "Share Name" $Sheet.Cells.Item(1,8) = "Shared"   $intRow = 2 $WorkBook = $Sheet.UsedRange $WorkBook.Font.Bold = $True  # Get printer information $Printers = Get-WMIObject Win32_Printer -computername $ServerList foreach ($Printer in $Printers) {     $Sheet.Cells.Item($intRow, 1) = $Printer.SystemName     $Sheet.Cells.Item($intRow, 2) = $Printer.Name     $Ports = Get-WmiObject Win32_TcpIpPrinterPort -computername $ServerList         foreach ($Port in $Ports)         {             if ($Port.Name -eq $Printer.PortName)             {             $Sheet.Cells.Item($intRow, 3) = $Port.HostAddress             }         }     $Sheet.Cells.Item($intRow, 4) = $Printer.DriverName     $Sheet.Cells.Item($intRow, 5) = $Printer.Location     $Sheet.Cells.Item($intRow, 6) = $Printer.Comment     $Sheet.Cells.Item($intRow, 7) = $Printer.ShareName     $Sheet.Cells.Item($intRow, 8) = $Printer.Shared     $intRow = $intRow + 1 }    $WorkBook.EntireColumn.AutoFit() $intRow = $intRow + 1 $Sheet.Cells.Item($intRow,1).Font.Bold = $True $Sheet.Cells.Item($intRow,1) = "Done"                             
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 

Select allOpen in new window

asked 12/08/2011 10:56

REIUSA's gravatar image

REIUSA ♦♦


2 Answers:
check here :
http://www.myitforum.com/articles/40/view.asp?id=12305
and this complete site about all scripts of inventory :

http://www.myitforum.com/myITWiki/WPScripts.ashx
link

answered

jordannet's gravatar image

jordannet

Thanks.
link

answered 2011-12-09 at 09:27:14

REIUSA's gravatar image

REIUSA

Your answer
[hide preview]

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Tags:

Asked: 12/08/2011 10:56

Seen: 325 times

Last updated: 12/15/2011 03:35