After configuring the Windows PowerShell session on your AirWatch Console server for issuing remote commands to Exchange 2010/2013/2016 or the cloud-based Office 365 service, connect to the server environment to begin the server-side session.

Following contains the commands to control the Exchange mailbox properties:

  • Command to connect to the server-side session and to establish a new session.
                            
                            

    PS C:\Windows\system32> $cred = Get-Credential

    PS C:\Windows\system32> $session = New-PSSession -ConfigurationName

    Microsoft.Exchange -ConnectionUri "https://Exchange.Server.URL.com/powershell/"-Credential $cred -Authentication Basic -AllowRedirection

    Press enter after authentication to execute the $session command.

  • Command to import the server-side session. Issue this command after successfully connecting to the server.
                            
                            

    PS C:\Windows\system32> Import-PSSession $session

    PS C:\Windows\system32>

  • Command to perform mailbox queries – During device enrollment in AirWatch, devices can be configured for exchange through profile distribution. When properly configured, the AirWatch Console will issue commands to enable Exchange ActiveSync for a user’s mailbox on Exchange. The AirWatch console also issues a command to whitelist the device ID being enrolled. To see what devices are whitelisted for a mailbox, use the command Get-CASMailbox to select the allowed devices.

    Command:

    PS C:\Windows\system32> get-casmailbox -Identity "user.name@mail.com" | select {$_.ActiveSyncAllowedDeviceIDs}

    Result:

                            
                            
          
    $_.ActiveSyncAllowedDeviceIDs
    -----------------------------
    {ApplDLXGL5FGDJHF, B058C150E57CC4004DA6B2E1BE4EE572}

    Likewise, query a user’s mailbox to view the blacklisted or blocked device IDs as shown in the following example.

    Command:

    PS C:\Windows\system32> get-casmailbox -Identity "user.name@mail.com" | select {$_.ActiveSyncBlockedDeviceIDs}

    Result:

                            
                            
          
    $_.ActiveSyncBlockedDeviceIDs
    -----------------------------
    {Appl87049106A4S, DT095F898778SDF2E1B3453445DG56}
  • Command to close Server-side session – Always close the console-server session when troubleshooting is complete. To remove the server-side session, use the remove-PSSession command.
                            
                            

    PS C:\Windows\system32> remove-pssession $session

    PS C:\Windows\system32>

  • Command to display the PowerShell version – To know the version of the PowerShell installed, enter $PSVersionTable on the PowerShell command window.
    PS C:\Windows\system32> $PSVersionTable