Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8602037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:59:01+00:00 2026-06-12T01:59:01+00:00

I am trying to convert one of my PS scripts to query AD with

  • 0

I am trying to convert one of my PS scripts to query AD with Quest AD instead of native tools to speed up processing.

During my testing, I have come to the conclusion that the msExchMailboxGuid property is returned in a format that I need to convert.

This is the command I am running for testing:

$LDAPQuery = "(&(HomeMDB=*)(objectClass=user))"
$OUPath = "OU=users,DC=domain,DC=com"

$SearchResults = Get-QadUser -LdapFilter $LDAPQuery -SearchRoot $OUPath -ShowProgress -SizeLimit 1 -IncludedProperties "msExchMailboxGuid"

The msExchMailboxGuid value is being returned as this:

[PS] C:\Users\sysadmin>$SearchResults | Select msExchMailboxGuid

msExchMailboxGuid
-----------------
35CAF894943052409B77F30A6F8D40B4

If I run this, it returns:

[PS] C:\Users\sysadmin>[guid]"35CAF894943052409B77F30A6F8D40B4"

Guid
----
35caf894-9430-5240-9b77-f30a6f8d40b4

But I know that the msExchMailboxGuid for this user is actually this:

94f8ca35-3094-4052-9b77-f30a6f8d40b4

According to Exchange PS. So it’s close but not quite right.

I wrote a function that converts the value to the right one using substring procedures.

Is there a better/more efficient way of returning the right value?

Function Convert-msExchMailboxGuid
{
    param
    (
        $RawGuid
    )

    $ConvertedGuid = $RawGuid.SubString(6,2) + $RawGuid.SubString(4,2) + $RawGuid.SubString(2,2) + $RawGuid.SubString(0,2) + $RawGuid.SubString(10,2) + $RawGuid.SubString(8,2) + $RawGuid.SubString(14,2) + $RawGuid.SubString(12,2) + $RawGuid.SubString(16)

    return ([guid]$ConvertedGuid).ToString()
}

This works OK but I hope this can be achieved in an easier way:

[PS] C:\Users\sysadmin>Convert-msExchMailboxGuid -RawGuid "35CAF894943052409B77F30A6F8D40B4"
94f8ca35-3094-4052-9b77-f30a6f8d40b4
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T01:59:02+00:00Added an answer on June 12, 2026 at 1:59 am

    I tried a few steps beyond this, and even with certain parameters behind the Get-QADUser commands, the rest was notably slower than my existing script. So I will leave this here in case someone wants to use my function for converting the GUID, but i’m not interested in the answer anymore.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to compile a version of convert (one of the ImageMagick tools) for
I have one python script which i am trying to convert and stuck in
I'm trying to convert one range of numbers to another, maintaining ratio. Maths is
I'm trying to convert a xml document from one format to another and while
I'm trying to convert this line into Batch how would one start this exe
I'm trying to convert my VB project to WPF, and one big problem I'm
I'm trying to convert an ASP/VBScript OAuth library to VBA. One of the challenges
I have this piece of code where I'm trying to convert the below C#
I'm trying convert xml from one format to other using the XslCompiledTransform in c#.
I am trying to convert one of my Perl script to R script. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.