Link to home
Start Free TrialLog in
Avatar of chaitanya reddy
chaitanya reddy

asked on

Script to generate report

Hi Guys,

Our requirement is like need info(details inside) of text file from following location in all machines(almost 500)
C:\temp\layers\status.text
 
Text file is like this :
 
VERIFY LAYERS
LatLonGO: 2018-07-25T13:32:48 INFO: version of layer VIC_LANDBASE is 1
LatLonGO: 2018-07-25T13:32:48 INFO: version of layer ELECTRICITY_LAYER is 356793
LatLonGO: 2018-07-25T13:32:48 INFO: version of layer BACKGROUND_LAYER_ELEC is 2
We need a report based on the content of the file, something like this:
 
 
 
Can you help on this.
Avatar of Alex
Alex
Flag of United Kingdom of Great Britain and Northern Ireland image

I've done something similar to this.

$Computers = Get-content 'C:\Powershell Projects\audit\computers.txt'
ForEach ($Computer in $Computers){
    If (test-connection -computername $Computer -quiet -Count 1) 
 {
	Copy-Item -Path "\\$($Computer)\c$\Program Files (x86)\Quest Software\Toad for Oracle 10.5\ClientFiles\QSAuth11.key" -Destination "C:\powershell projects\audit\files\$($Computer).txt"
}

Else { 
        "$($computer) is not online" | Out-File -Append "C:\Powershell Projects\audit\computersnotonline.txt"
      }
}

Open in new window


Modify your location for the file and I would then import it into Excel or something for filtering what you want.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.