D2O365SearchAndDelete
Assign a 'Mailbox Import Export' management role to a user. This script runs through the agent on a Windows machine, pulls and executes a PowerShell script - which talks to the Exchange server.
javascript · D2 (Deprecated)
Source
//+ o365/office365searchdelete.ps1 //Params: Username, Password and Query in exchange syntax if ((env.ARCH !== "amd64") && (env.OS !== "windows")) { throw("Script can run only in 64bit Windows Agents"); } var command = []; command.push("powershell.exe"); command.push("-NonInteractive"); command.push("-NoLogo"); command.push("'" + which("office365searchdelete.ps1")+ "'"); if (typeof (args.password) !== "undefined") { command.push("-password"); command.push("'" + args.password + "'"); } if (typeof (args.username) !== "undefined") { command.push("-username"); command.push(args.username); } if (typeof (args.query) !== "undefined") { command.push("-query"); command.push(args.query); } //pack(command.join(" ")); timeout = 60 * 5; if (typeof (args.timeout) !== "undefined") { //pack('timeout: ' + timeout + '\n'); timeout = args.timeout; } var results = execute(command.join(" "), timeout);//, 'table'); if(results.Error !== "exit status 0" || results.Stderr.length > 0) { throw "script failed with an error. \n" + results.Error + "\nstderr: " + results.Stderr + "\nstdout: " +results.Stdout; } pack(results.Stdout);
README
Assigns a Mailbox Import Export management role to a user. This script runs through the agent on a Windows machine, pulls and executes a PowerShellscript - which talks to the Exchange server.
Script Data
| Name | Description |
|---|---|
| Script Type | javascript |
| Tags | email, office365 |
Inputs
| Argument Name | Description |
|---|---|
| username | The Admin user to use for compliance search. |
| password | The password for the specified user. |
| query | The query to use for finding mails. |
| timeout | he amoun of time to wait before timing out (in seconds). The default is 5 mins. Max is 2 hours. |
Outputs
There are no outputs for this script.