Skip to content

Report on OneDrive for a tenant

directorcia edited this page Dec 16, 2024 · 1 revision

PowerShell Script: graph-odfb-get.ps1

The graph-odfb-get.ps1 script is designed to interact with the Microsoft Graph API to retrieve and report on OneDrive for Business (ODFB) information for a tenant. Below is a detailed explanation of the script's visible functionality and operation.

Parameters

  • $debug: A switch parameter that, when specified, enables debugging mode. In this mode, the script will not prompt for user input.
  • $csv: A switch parameter that, when specified, indicates that the output should be exported to a CSV file.
  • $prompt: A switch parameter that, when specified, prompts the user for input during the script execution.

Script Metadata

  • Description: The script is intended to report on OneDrive for Business (ODFB) for a tenant.
  • Source: The script is sourced from a GitHub repository.
  • Documentation: Additional documentation is available on a blog.
  • Disclaimer: The script is provided "as is" with no guarantees or warranty.
  • Prerequisites: The script requires the Microsoft Graph module to be installed.

Variables

  • $systemmessagecolor: Sets the color for system messages to cyan.
  • $processmessagecolor: Sets the color for process messages to green.
  • $errormessagecolor: Sets the color for error messages to red.

Summary

  • The script is designed to retrieve and report on OneDrive for Business information using the Microsoft Graph API.
  • It includes parameters for debugging, exporting to CSV, and prompting for user input.
  • The script metadata provides a brief description, source, documentation link, and disclaimer.
  • The script sets up color variables for different types of messages.

Operation

  1. Parameter Handling:
    The script starts by defining parameters that control its behavior. These parameters allow the user to:

    • Enable debugging.
    • Export results to a CSV file.
    • Prompt for input during execution.
  2. Metadata:
    The script includes metadata that describes its:

    • Purpose.
    • Source.
    • Documentation.
    • Disclaimer regarding its usage.
  3. Variables:
    The script defines variables to set message colors for:

    • System messages.
    • Process messages.
    • Error messages.

Expected Functionality (Not Visible in the Provided Excerpt)

The remaining script logic likely includes the following steps:

  • Connecting to Microsoft Graph.
  • Retrieving OneDrive for Business data.
  • Processing the retrieved data.
  • Outputting the results based on the specified parameters.

In summary, this script is designed to fetch and report on OneDrive for Business information from Microsoft Graph, with options for debugging, exporting to CSV, and prompting for user input.