PowerShell - create a script to act as a file watcher and email multiple attachments

CheStaKidSot 1 Reputation point
2022-03-10T13:46:36.737+00:00

I’m new to powershell but I need to create a script that watches a server folder for 4 specific files to appear. I need the script to email these to multiple accounts.
After the process has completed I would like the script to then delete the files from the folder.
I found a few scripts online that are client based and use outlook as the email tool, however this will need to run on a server so all the settings will need to be set by the script, and attach all the files not just one
The other part I need to do is to copy the files into SharePoint online before the script deletes the files.
Is this possible? A lot of the scripts I found for this are for SharePoint on premise, also looked at a couple of apps to find they did not support SharePoint online.

Windows for business Windows Server User experience PowerShell
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Andreas Baumgarten 123.4K Reputation points MVP Volunteer Moderator
    2022-03-10T14:41:25.85+00:00

    Hi @CheStaKidSot ,

    all these tasks should be possible with PowerShell.
    You should start creating a PowerShell script step by step. Like "First monitor folder for the files", next step send the files, next step delete the files .....
    Within each step of the script you will find a lot of examples and information using a search engine of you choice.

    If you started with the script and running in issues please post the script with additional details, like error messages.

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten

    0 comments No comments

  2. CheStaKidSot 1 Reputation point
    2022-03-10T15:29:33.827+00:00

    Thanks, I will make a start and see how far I get

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.