Script help


hi

i have found 1 script , good.

http://gallery.technet.microsoft.com/scriptcenter/powershell-script-to-get-78687c5e#content

need little correction in script per requirement. please me done.
appreciated .

my requirement :

if there test fail in dcdiag: output of report should in red written dc name test fail
if in replication.txt shows error or queue full show red
replication_details.txt:  if file contains fails or error shows output in red
replication_sum.txt: if file shows error or fail should show output in red
services.txt: if file contains services stop should show red otherwise should show green
time.txt:  if file contains error or fails should show red or green.


i have script give me output below txt files:

dcdiag.txt
replication.txt
replication_details.txt
replication_sum.txt
services.txt
time.txt

in above data below:

https://onedrive.live.com/redir?resid=2665b3505200f04a!6767&authkey=!ahjrvo-ljt4as2a&ithint=folder%2c.ps1

hi mr.raj,

the script below may helpful you, not completed, reference:

$result = @()   $i=0 $server = $env:computername $files=@("d:\dcdiag.txt","d:\replication.txt")  $outputreport = "<html><title> server report </title>  <body background-color:peachpuff>  <font color =""#99000"" face=""microsoft tai le"">  <h2> server report </h2></font>  <table border=1 cellpadding=0 cellspacing=0>  <tr bgcolor=gray align=center>  <td><b>server name</b></td>  <td><b>file</b></td></tr>"  foreach($file in $files)   {  get-content $file|foreach{ if($_ -like "*error*" -or $_ -like "*fail*"){ $i=1 } } if ($i -eq 1){ $outputreport += "<tr bgcolor=red>"  }  else{ $outputreport += "<tr>"  } $outputreport += "<td>$server</td><td align=center>$file</td></tr>"  $i=0 }  $outputreport += "</table></body></html>"   $outputreport | out-file c:\scripts\test.htm   invoke-expression c:\scripts\test.htm 

to send email html format, article heplful you:

creating formatted html output

i hope helps.



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Edit Group Policy

Hyper-V VM not reaching OS 'Logon' screen

DNS question...