Share via


Fixing ConvertGlobalToUniversalGroup.vbs in HMC 4.0 Migration Kit

Alright, this is a quick one.

For those who are planning to migrate from HMC 3.5 to HMC 4.0, and if you are using the HMC 4.0 Migration Kit (https://www.microsoft.com/downloads/details.aspx?FamilyId=636571AA-6582-49D6-B59E-81E9C27FE240&displaylang=en), you may want to take note that the ConvertGlobalToUniversalGroup.vbs provided for in-place upgrade in the Sample Migration Scripts does not work well.

The script is supposed to convert the groups in each organization from Global to Universal. However, when you run this VBScript, you will find that it will run and it will complete without error and nothing will be converted.

The problem is in the ConvertGroup function where the MyArray was not properly defined and also the error number is not properly reset when it is called again. However, because On Error Resume Next is in place, the error was skipped. If you want to see the error, comment out “On Error Resume Next”.

To fix it, just add the highlighted area in the function as the following,

Function ConvertGroup(objUser)

Wscript.echo "Converting Group = " & objUser.Name On Error Resume NextErr.Number = 0

MyArray = Split(objUser.DistinguishedName, "@")

'if this is a built in MPS group, skip it.If MyArray(0) = "CN=Admins" Then Err.Number = 42 ConvertGroup = Err.Number Exit FunctionEnd If

If MyArray(0) = "CN=CSRAdmins" Then Err.Number = 42 ConvertGroup = Err.Number Exit FunctionEnd If

' convert 0067roup

Set objGroup = GetObject ("LDAP://" & objUser.DistinguishedName)

' NOTE: If you want to make this a Security group instead of a Distribtuion group,' then simply add the following to the below command: OR ADS_GROUP_TYPE_SECURITY_ENABLED.

objGroup.Put "groupType", ADS_GROUP_TYPE_UNIVERSAL_GROUPobjGroup.SetInfo

ConvertGroup = err.Number

End Function

Comments