The current code causes a Powershell error that causes 'temp.csv' to never get attached to the email.
This is because the first PS line saves temp.csv to the user's home directory, whereas the second PS line tries to attach temp.csv from the system32 folder. To fix this I changed the first line to instead save it to system32, which is the default path for an admin Powershell session.
The current code causes a Powershell error that causes 'temp.csv' to never get attached to the email. This is because the first PS line saves temp.csv to the user's home directory, whereas the second PS line tries to attach temp.csv from the system32 folder. To fix this I changed the first line to instead save it to system32, which is the default path for an admin Powershell session.