Microsoft Office PowerShell Documentation and Tools

repository·main·Indexed 20 days ago

https://github.com/microsoftdocs/office-docs-powershell

Documentation and tools for managing Microsoft Office PowerShell cmdlet reference articles on Microsoft Learn. Includes the office-cmdlet-updater (v1.0.0) for updating modules such as Teams, Skype, SharePoint, Whiteboard, Exchange, and StaffHub, as well as conceptual guides for app-only authentication (Certificate Based Authentication) in Exchange Online and Security & Compliance PowerShell.

Tokens
209K
Snippets
554
Records
978
Agent score
56%

What's inside office-docs-powershell

  1. Overview of the Exchange Online PowerShell V3 module

    main

    The Exchange Online PowerShell module (also known as the EXO V3 module) provides a way to connect to all Exchange cloud-related PowerShell environments using modern authentication. It supports both standard authentication and Multi-Factor Authentication (MFA).

    Supported environments include:

    • Exchange Online PowerShell
    • Security & Compliance PowerShell
    • PowerShell for the Built-in security add-on for on-premises mailboxes
  2. Modify Exchange authorization configuration with Set-AuthConfig

    main

    Use the Set-AuthConfig cmdlet to modify the authorization configuration for your Exchange organization. This is primarily used to define Microsoft Exchange as a partner application for server-to-server authentication with applications like Microsoft SharePoint 2013 or Skype for Business Server 2015.

    This cmdlet is used to manage the certificate used for signing tokens, typically when you need to replace a self-signed certificate or update an expired one.

    Note: This cmdlet is available only in on-premises Exchange (Exchange Server 2013, 2016, 2019, and SE).

    Set-AuthConfig -NewCertificateThumbprint DB821B4FCA2A5DA9593B9DE00C86BC5EA35D0FC0 -NewCertificateEffectiveDate 4/17/2014
  3. Create and renew certificates with New-ExchangeCertificate

    main

    The New-ExchangeCertificate cmdlet is used in on-premises Exchange environments to:

    • Create and renew self-signed certificates.
    • Create certificate requests (Certificate Signing Requests or CSRs) for new certificates or renewals from a Certification Authority (CA).

    Note: This cmdlet is only available in on-premises Exchange (Exchange Server 2010, 2013, 2016, 2019, and SE).

    New-ExchangeCertificate
  4. Modify Microsoft Exchange ActiveSync virtual directories with Set-ActiveSyncVirtualDirectory

    main

    The Set-ActiveSyncVirtualDirectory cmdlet is used to modify existing Microsoft Exchange ActiveSync virtual directories within Internet Information Services (IIS) on on-premises Exchange servers. It allows you to configure security settings, authentication methods, and internal/external URL settings.

    Applicability: This cmdlet is available only in on-premises Exchange environments, including Exchange Server 2010, 2013, 2016, 2019, and Exchange Server SE.

    Set-ActiveSyncVirtualDirectory [-Identity] <VirtualDirectoryIdParameter> [-ActiveSyncServer <String>] [-BadItemReportingEnabled <Boolean>] [-BasicAuthEnabled <Boolean>] [-ClientCertAuth <ClientCertAuthTypes>] [-CompressionEnabled <Boolean>] [-Confirm] [-DomainController <Fqdn>] [-ExtendedProtectionFlags <MultiValuedProperty>] [-ExtendedProtectionSPNList <MultiValuedProperty>] [-ExtendedProtectionTokenChecking <ExtendedProtectionTokenCheckingMode>] [-ExternalAuthenticationMethods <MultiValuedProperty>] [-ExternalUrl <Uri>] [-InstallIsapiFilter <Boolean>] [-InternalAuthenticationMethods <MultiValuedProperty>] [-InternalUrl <Uri>] [-MobileClientCertificateAuthorityURL <String>] [-MobileClientCertificateProvisioningEnabled <Boolean>] [-MobileClientCertTemplateName <String>] [-Name <String>] [-RemoteDocumentsActionForUnknownServers <RemoteDocumentsActions>] [-RemoteDocumentsAllowedServers <MultiValuedProperty>] [-RemoteDocumentsBlockedServers <MultiValuedProperty>] [-RemoteDocumentsInternalDomainSuffixList <MultiValuedProperty>] [-SendWatsonReport <Boolean>] [-WhatIf] [-WindowsAuthEnabled <Boolean>] [<CommonParameters>]
  5. How app-only authentication works in Exchange Online PowerShell

    main

    App-only authentication (also known as Certificate Based Authentication or CBA) allows unattended scripts to connect to Exchange Online and Security & Compliance PowerShell without storing user credentials.

    Mechanism:

    1. The PowerShell module uses the Active Directory Authentication Library to fetch an app-only token using the Application ID, Tenant ID (passed via the -Organization parameter), and a Certificate.
    2. The Microsoft Entra application object must have a Directory Role assigned to it.
    3. The access token contains the directory role information, which the session uses to configure Role Based Access Control (RBAC).
  6. Configure ECP Virtual Directory URLs and Roles

    main

    When using New-EcpVirtualDirectory, you can define the connectivity URLs and the specific service role for the directory.

    Connectivity URLs

    • -ExternalUrl: The URL used to connect to the virtual directory from outside the firewall. This is critical for TLS encryption and allows the Autodiscover service to return the correct URL.
    • -InternalUrl: The URL used to connect from inside the firewall. Also critical for TLS and Autodiscover.

    Virtual Directory Roles

    Use the -Role parameter to specify the configuration type:

    • ClientAccess: Configures the directory for Client Access (frontend) services on the Mailbox server.
    • Mailbox: Configures the directory for backend services on the Mailbox server. Note: Clients connect to Client Access services, which then proxy requests to the backend services.

    Applicable Versions: Exchange Server 2013, 2016, 2019, and SE.

  7. What are cmdlet extension agents?

    main

    Cmdlet extension agents are used by Exchange cmdlets in Exchange Server 2010 and later. They allow cmdlets to perform additional operations by running logic on every Exchange server in the organization.

    Note that cmdlets provided by other Microsoft or non-Microsoft products cannot use these agents. Before enabling an agent, ensure you understand its function and the potential impact on your organization.

  8. Configure internal DNS lookups

    main

    You can control how Exchange performs DNS lookups for destinations inside the organization using these parameters:

    • -InternalDNSAdapterEnabled (Boolean): When $true (default), Exchange uses the DNS settings of the network adapter specified by -InternalDNSAdapterGuid. To use a custom list of servers, set this to $false.
    • -InternalDNSAdapterGuid (Guid): Specifies the network adapter used for internal lookups. If no specific GUID is provided (00000000-0000-0000-0000-000000000000), it uses any available network adapter.
    • -InternalDNSServers (MultiValuedProperty): A comma-separated list of IP addresses for internal DNS servers. This is only used if -InternalDNSAdapterEnabled is set to $false.
    • -InternalDNSProtocolOption (ProtocolOption): Specifies the protocol for internal queries. Valid options: Any (default), UseTcpOnly, or UseUdpOnly.

    Note: If -InternalDNSAdapterEnabled is $true, the -InternalDNSServers parameter is ignored.

  9. How REST API connections work in the EXO V3 module

    main

    Since 2023, Exchange Online PowerShell and Security & Compliance PowerShell use REST API connections for all cmdlets. This requires the PowerShellGet and PackageManagement modules to be installed.

    Advantages of REST API connections:

    • Security: Built-in support for modern authentication; does not depend on remote PowerShell sessions or WinRM Basic authentication.
    • Reliability: Includes built-in retries for transient failures like network delays or long-running queries.
    • Performance: Avoids the overhead of setting up a PowerShell runspace.

    Important Limitations:

    • Invoke-Command: The Invoke-Command cmdlet does not work with REST API connections.
    • Timeouts: Cmdlets backed by the REST API have a 15-minute timeout. For bulk operations (e.g., updating thousands of members in a distribution group), you should split the operation into smaller batches to avoid timeouts.
  10. Use New-SettingOverride to create Exchange customizations

    main

    The New-SettingOverride cmdlet allows you to create setting overrides that store Exchange customizations in Active Directory instead of in local XML configuration files (like web.config or exe.config).

    Key Benefits:

    • Persistence: Unlike local XML files, these overrides persist in Active Directory across Exchange Cumulative Updates (CUs).
    • Scope Control: You can apply overrides organization-wide (by omitting the -Server parameter) or to specific servers (using the -Server parameter).

    Caution: Incorrect usage of setting override cmdlets can cause serious damage to your Exchange organization, potentially requiring a full reinstallation of Exchange. Use these only as instructed by Microsoft documentation or support.

    New-SettingOverride -Name "IM Override" -Component OwaServer -Section IMSettings -Parameters @("IMServerName=skype01.contoso.com","IMCertificateThumbprint=CDF34A740E9D225A1A06193A9D44B2CE22775308") -Reason "Configure IM"
  11. Use the -InMemory parameter for staged configuration changes

    main

    The -InMemory switch creates an object reference without committing the changes permanently to the server.

    Workflow:

    1. Call New-CsUserReplicatorConfiguration with the -InMemory flag and assign the output to a variable.
    2. Modify the properties of that variable in your session.
    3. Commit the changes by calling the matching Set-CsUserReplicatorConfiguration cmdlet.
    # Example workflow pattern
    $config = New-CsUserReplicatorConfiguration -Identity "service:Registrar:example.com" -InMemory
    # ... modify $config properties ...
    Set-CsUserReplicatorConfiguration -Identity "service:Registrar:example.com" -Configuration $config
  12. Configure message classification precedence and visibility

    main

    You can control how message classifications appear to users and interact with transport rules using the following parameters:

    • -DisplayPrecedence: Sets the relative importance of the classification. If multiple classifications are applied (e.g., via transport rules), the one with the highest precedence is shown first. Valid values: Highest, Higher, High, MediumHigh, Medium (default), MediumLow, Low, Lower, Lowest.
    • -PermissionMenuVisible: Controls whether users can assign the classification while composing a message.
      • $true (default): Users can assign the classification in Outlook.
      • $false: Users cannot assign it, but received messages will still display the classification info.
    • -RetainClassificationEnabled: Determines if the classification persists when a message is forwarded or replied to. Default is $true.