1

I am currently writing a powershell script to collect equipment the idea is to write a script that emails clients that have equipment that they havent turned in yet. First it emails the client directly and then after 3 weeks it appends their manager and 3 weeks later their managers manager.

My question is how should I go about storing the username and date in a file so I can call the script and have it know what should be appended. Should I use a text file a .ps1? So I can import the variables and have it have an idea of how long they have been in the system.

Many thanks!!!

Listor
  • 93
  • 9
  • 3
    One way to export PowerShell variables is to use [Export-CliXML](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/export-clixml?view=powershell-7.1). This way you can store the variables including their types. – Olaf Sep 27 '21 at 21:06
  • 2
    Data should be persisted to a database or some other type of data store. A JSON document would probably work and PowerShell has first class support for serialization and deserialization via the `ConvertTo-/ConvertFrom-Json` cmdlets. – Daniel Mann Sep 27 '21 at 21:17
  • 2
    I hope the linked post provides enough inspiration. – mklement0 Sep 27 '21 at 21:58

0 Answers0