# Script advice

**URL:** <https://forums.powershell.org/t/script-advice/5770>\
**Category:** PowerShell Help\
**Created:** [February 11, 2016, 10:24pm UTC](https://forums.powershell.org/t/script-advice/5770 "2016-02-11T22:24:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![karl-forster](https://avatars.discourse-cdn.com/v4/letter/k/958977/32.png) [@karl-forster](https://forums.powershell.org/u/karl-forster)\
**Post date:** [February 11, 2016, 10:24pm UTC](https://forums.powershell.org/t/script-advice/5770/1 "2016-02-11T22:24:52Z")

</div>

I have script that does a query of the load of our terminal servers every hour during business hours for capacity planning.  
At the moment the script emails out the details in the following format and we get an email every hour.

\*\*\*\*\*\* TSFarm \*\*\*\*\*\*\*\*

HHG-TS518 36  
HHG-TS519 36  
HHG-TS520 37  
HHG-TS521 36  
HHG-TS522 36  
HHG-TS523 36  
HHG-TS524 36  
HHG-TS525 35  
HHG-TS526 35  
HHG-TS529 23

I would like to change this to a single HTML report, but have it so that the HTML report shows us the stats per server but shows us the number based on every hour, something similar to this:  
\*\*\*\*\*\* TSFarm \*\*\*\*\*\*\*\*  
Server 9am 10am 11am  
HHG-TS518 36 36  
HHG-TS519 36 36  
HHG-TS520 37 37  
HHG-TS521 36 36  
HHG-TS522 36 36  
HHG-TS523 36 36  
HHG-TS524 36 36  
HHG-TS525 35 35  
HHG-TS526 35 35  
HHG-TS529 23 23  
Is there a way to achieve this without getting into piping the results to a SQL database? In my mind the problem is that once the script ends the data is lost unless I store it somewhere.  
Any advice would be appreciated.  
Karl

---

<div class="post-metadata">

**Author:** ![dan-potter1](https://avatars.discourse-cdn.com/v4/letter/d/cab0a1/32.png) [@dan-potter1](https://forums.powershell.org/u/dan-potter1)\
**Post date:** [February 12, 2016, 12:02am UTC](https://forums.powershell.org/t/script-advice/5770/2 "2016-02-12T00:02:57Z")

</div>

Pull in the current html, build on it and replace it.

---

<div class="post-metadata">

**Author:** ![wilfredo-perez](https://avatars.discourse-cdn.com/v4/letter/w/e99b99/32.png) [@wilfredo-perez](https://forums.powershell.org/u/wilfredo-perez)\
**Post date:** [February 12, 2016, 12:51am UTC](https://forums.powershell.org/t/script-advice/5770/3 "2016-02-12T00:51:43Z")

</div>

Check out the free ebook "Creating HTML Reports in PowerShell " under resources

---

<div class="post-metadata">

**Author:** ![karl-forster](https://avatars.discourse-cdn.com/v4/letter/k/958977/32.png) [@karl-forster](https://forums.powershell.org/u/karl-forster)\
**Post date:** [February 12, 2016, 1:15am UTC](https://forums.powershell.org/t/script-advice/5770/4 "2016-02-12T01:15:46Z")

</div>

I think my question may have cause come confusion

let me clarify

If I perform the query at 9am and it returns the following results  
server 9am  
HHG-TS518 36

Then at 10am I perform the same query again

server 9am 10am  
HHG-TS518 36 38

Would it be best to store these in an CSV file and then build the HTML report from the CSV file. Every time the script closes the data would be lost from powershell so need some way to get the previous data.

Karl

---

<div class="post-metadata">

**Author:** ![michael-hefele](https://avatars.discourse-cdn.com/v4/letter/m/d26b3c/32.png) [@michael-hefele](https://forums.powershell.org/u/michael-hefele)\
**Post date:** [February 12, 2016, 6:10am UTC](https://forums.powershell.org/t/script-advice/5770/5 "2016-02-12T06:10:17Z")

</div>

Hi Karl,

I guess, the best practice would be to create objects ([pscustomobject]) and store it in a XML file on disk using Export-Clixml.

Regards,  
Michael

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:42pm UTC](https://forums.powershell.org/t/script-advice/5770/6 "2024-05-16T20:42:54Z")

</div>


