Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 8583

slow script

$
0
0

Hello experts

 

I spent some time constructing the below script to retrieve BIOS data from remote computers.

however, the script seems to run for a very long time, I mean hours...

While it runs, the excell spreadsheet opens and does not get data. only when the script finishes, I can see the data populating the excel chart. and that is when I minimize the number of hosts in the list to about 10 hosts.

please assist,

Thanks

Troy

$ErrorActionPreference = "silentlycontinue" 

$strComputer = Get-Content "D:\Scripts\AllStations.txt" 

$objExcel = New-Object -ComObject Excel.Application 
$wb = $objExcel.Workbooks.Add() 
$item = $wb.Worksheets.Item(1) 
$objExcel.Visible = $True 


$item.Cells.Item(1,1= "Computer Name" 
$item.Cells.Item(1,2= "Manufacturer" 
$item.Cells.Item(1,3= "BIOS Name" 
$item.Cells.Item(1,4= "Version" 

$WorkBook = $item.UsedRange 
$WorkBook.Interior.Colorindex = 6 
$WorkBook.Font.Bold = $true 

$BIOS = Get-WmiObject Win32_Bios -ComputerName $strComputer 

$i = 2 

foreach ($strComputer in $BIOS) 

{ 

$item.Cells.Item($i,1= $strComputer.PSComputerName 
$item.Cells.Item($i,2= $strComputer.Manufacturer 
$item.Cells.Item($i,3= $strComputer.Name 
$item.Cells.Item($i,4= $strComputer.Version 

$i++ 

}


Viewing all articles
Browse latest Browse all 8583

Trending Articles