Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Create HTML output from results

$
0
0

Afternoon

I am hoping someone could point me in the right direction

During the day i run a basic script which checks specific folders on the network and  outputs results to a text file, its a fairly simple process, however i would like the output to be in html, however this doesn't appear to work and returns a blank page, i think it was because i am trying to set each line to the same variable

here is a snippet of my code, it is basically the same but with different locations and this is replicated throughout

I basically test connection to see if the pc is alive, if it is, just produce a get-childitem and output results to the text file, then move onto the next etc

This is so i can monitor that no files are stranded in these particular folders

The outputting to log text file works but i cannot replicate this as a HTML type, preferably with the heading of the pc name after each get childitem

I hope this makes sense

Barrie

if (Test-connection PC1 -Count 1 -quiet){"FOLDER1 in MANCHESTER" >>$logfile"..........................................." >>$logfile"                                           " >>$logfile
Get-ChildItem $PC1\*.pdf |Sort-Object lastwritetime | ft fullname, lastwritetime -AutoSize >>$logfile
}
if (Test-connection PC2 -Count 1 -quiet){"FOLDER1 on PC2 in MANCHESTER" >>$logfile"..........................................." >>$logfile"                                           " >>$logfile
Get-ChildItem $PC2\*.pdf |Sort-Object lastwritetime | ft fullname, lastwritetime -AutoSize >>$logfile
}


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>