O'Reilly logo

Microsoft Exchange Server PowerShell Essentials by Biswanath Banerjee

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Writing a basic script

Now, let's use the knowledge that we have gained in the previous sections to write a script, and then we will schedule this script to run using the Windows task scheduler.

Let's try to understand the different sections of this script that will allow us to break the entire script into multiple parts, making it easier for us to understand the logic.

The first part defines parameters accepted by this script. Over here, we have defined the first parameter called $ExportMailbox to be a switch parameter, which is a mandatory one. A switch parameter means it is either true or false. In this case, this parameter has to be present as we have marked it as mandatory. If we use the script without this parameter, it will prompt, and it ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required