????? ??????? ??? PrimaryGroupID ?????? ??? ???????? ???????? ????????

?????? ????????? ?????? ?????????
???? ???????: 297951 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

?? ??? ??????

??????

???? ??? ??????? ????? ????? ????? ?? ???????? ???????? ????????.

??????? ????

?????

??? ?? ????? ????? ??????? ?? ??? ??????? ??????? ??????? ?????? ???????? ???????? ???????? ?? ?????? ??????? ?????? ?????? ActiveX (ADO) ????? ???????? ???? ?????? ?????? ???? (LDAP) ????? "Active Directory" ??? ???? ???????? ???????? ?? ?????? ?? ?? ?????????? ???? ?????? ??????? ???? ?? ??????? ????? ?? ???????? ?? PrimaryGroupToken ?????? PrimaryGroupID ????????. ???? ?? ???? ??? ????????? ?????? ?????? ?? ?????, ???????? ??? ??? ????????? ?? ???? ????.

PrimaryGroupToken ???? ???????? ??? ?????. ??? ???? ?? ????? ??? ????? ?? "Active Directory" ???? ??? ????? ??? ?????? ?? ??? ???? ????? ????? ?????? Active Directory (ADSI). ???? ??? ????? ????? ?? ???? ??????? ?????? ??? ?? ??????? LDAP.

?? ?????? ????? ????? ?????? (SID) ?????? primaryGroup ??? ????? ?? ???????? ?? ???:
  • ????? SID ??????/?????? ?? ?????? ??????? ?????? (RID) ???? RID ????????/????????. ??? ???? ?????? ??? ???? SID ???? ???????? S-1-111-222-333-efg RID ???? ???????? "efg" ???? ????? RID ?????? ?? S-1-111-222-333.
  • ????? PrimaryGroupID ??? ???? ??????/?????? ????? RID ???????? ????????.
  • ??? ?? ???? ???????? ???????? ???????? ?????? ?????? ?? ?????? ??????? ????? ?????????.
  • ???? ?? ???? ???? SID ???????? ???????? ?????? ??? ?????? RID ?????? primaryGroupID ????? ????????. ??? ???? ??????? ?? ???? ?????? RID S-1-111-222-333 ??? ???? ???? primarygroupID ? ? ?. ????? SID ???????? ???????? ?? S-1-111-222-333-abc.
???? ????? ???????? ???????? ?? ??? ??????? ????? ????? SID ???????? ???????? ???????? ?? ???? ????? RID ???????? ?? SID ????? ?? ?? ????????? primarygroupID (???????? ???????? RID). ????????? ???????? ?????? ?? ???? IADsSID ?? ????? ADsSecurity.dll. ??? ADsSecurity.dll ????? ?? ?????? ????? ??????? (SDK) 2.5 ?????? ???? ???? Active Directory (ADSI). ?????? 2.5 SDK ?????? ???? ???? Active Directory ?? ?????? ???? Microsoft ?????? ??? ?????:
http://technet.microsoft.com/en-us/library/cc749949.aspx
????? ????? IADsSID ????? ?????? ?????? ??????? ?????? ?????? SID raw ??? ????? ??? ????? ???? ?????? (SDDL) ???????? API ConvertSidToStringSid. ????? API ??? ??? Windows 2000 ? Windows Server 2003 ???.

??? ???? ??? ??????? ????????? ??? ???? ????? ??? Windows NT 4.0 ? ??? ????? SID raw ??? ?????? ???????? ?? ????? ????????? ??? ???? ??????? ?? ??? ????? ??????? COM DLL ????. ??? ????? ???? ?? ????? ????? ????? SDDL SID ??? Widows NT 4.0 ?? ????? "????? ????? Microsoft" ???????:

286182????? ??????? Microsoft Visual Basic ??? ????? SID ????? ??? ????? SID

??????? ??????? ?????? SID ?????? ?????? ?? ??????

  1. ??? ???? ????????.
  2. ??????? ??????? ObjectSID ????? ????????.
  3. ?? ??????? ???? IADsSID ?????? SID ???????? ?? ?? ??????? ?? ??????? SDDL.
  4. ?????? ????? RID ???????? ?? ??????? SDDL SID.
  5. ??????? ??????? PrimaryGroupID ???????? ?? ?????? ??? ????? ????? ??? ?????.
  6. ????? ????? ????? PrimaryGroupID ???????? ??????? SID.
  7. ??????? IADsSID ????? ??????? SDDL SID ??? Windows NT ?? ADsPath LDAP ????? ??.
  8. ??? ADsPath ??????? ?? ??????? ??? ???????? ???????? ???? ??????.

?????? Visual Basic ????? ???? ???????? ???????? ?????? ??? ADsPath ????

'
' The following VBS code illustrates how to determine the primary group
' given an ADsPath as a single argument. The script determines if the
' string passed is a WinNT or LDAP path and then uses the appropriate
' method for retrieving the Primary Group path.
'
' ADsSecurity Constants
'
const ADS_SID_RAW         = 0
const ADS_SID_HEXSTRING	  = 1
const ADS_SID_SAM         = 2
const ADS_SID_UPN         = 3
const ADS_SID_SDDL        = 4
const ADS_SID_WINNT_PATH  = 5
const ADS_SID_ACTIVE_DIRECTORY_PATH = 6
const ADS_SID_SID_BINDING = 7
'-------------------------------------------------
' Function StrRID returns and unsigned long of
' the given RID value
' 
' If the most significant bit is set in a VB Long
' then VB will interpret the value as a negative number
' and CStr will convert the unsigned long into a string with a leading
' "-" sign.
'
' This function checks to see if the most significant bit
' is set, then tricks the CStr function into outputting
' and unsigned long value by using a double float value
' to store the RID value, then uses the CStr function to get the
' string version.
'
function StrRID( inVal )
  dim dLocal
  if( (inVal and &H80000000) <> 0 ) then
    dLocal = CDbl((inval and &H7FFFFFFF))
    dLocal = dLocal + 2^31
    StrRID = cstr(dLocal)
  else
    StrRID = Cstr(inVal)
  end if
end function
'=================================================
' Main Script
'
' Assumes that the first argument is a WinNT or
' LDAP user path
'
set args = WScript.Arguments
WScript.Echo "Start: "& Now
set ADsSid = CreateObject("ADsSID")
'
' Determine if we are using the LDAP or WinNT providers
'
userAdsPath = args(0)
if( InStr(userAdsPath,"LDAP") <> 0 ) then
  '
  ' LDAP ADS Path, need to work with the an Active Directory Path
  '
  ADS_SID_Constant = ADS_SID_ACTIVE_DIRECTORY_PATH
else
  '
  ' WinNT Path, working with the WinNT provider
  '
  ADS_SID_Constant = ADS_SID_WINNT_PATH
end if
'  
' Initialize the IADsSID object and retrieve
' the SDDL form of the SID
'
ADsSID.SetAs ADS_SID_Constant, CStr(userADsPath)
DomainSID = ADsSID.GetAs(ADS_SID_SDDL)
'
' We have the SDDL form of the user's SID.
' Remove the user's RID ( the last sub authority)
' up to the "-"
'
DomainSID = mid(DomainSID,1,(InStrREV(DomainSID,"-")))
'
' Bind to the user object to retrieve the PrimaryGroupID.
' Build the SID of the Primary group
' from the domainSID and the Primary Group RID in
' the PrimaryGroupID.
'
set obj = GetObject(userADsPath)
lngGroupID = obj.Get("primaryGroupID")
strGroupRID = StrRID( lngGroupID )
DomainSID = DomainSID & strGroupRID
'
' Use ADsSID to retrieve a WinNT path or 
' a SID Bind string to locate the LDAP path
'
ADsSID.SetAs ADS_SID_SDDL, CStr(DomainSID)
if( ADS_SID_Constant = ADS_SID_ACTIVE_DIRECTORY_PATH ) then
   '
   ' With the LDAP provider, build a SID bind string and
   ' retrieve the Group object via this bind string
   '
   SIDBindStr = ADsSID.GetAs(ADS_SID_HEXSTRING)
   SIDBindStr = "LDAP://<SID=" & SIDBindStr & ">"
   set oGrp = GetObject(SIDBindStr)
   strPrimaryGroupADsPath = oGrp.Get("DistinguishedName")
   set oGrp = Nothing
else
   '
   ' Its a WinNT path, retrieve the ADsPath for the WinNT object
   '
   strPrimaryGroupADsPath = ADsSID.GetAs( ADS_SID_Constant )
end if
WScript.Echo "Primary group ADS Path for user : " & userADsPath
WScript.Echo "Is: " & strPrimaryGroupADsPath
WScript.Echo "Finished: " & Now
				

???????

???? ???????: 297951 - ????? ??? ??????: 25/?? ?????/1427 - ??????: 6.2
????? ???
  • Microsoft Active Directory Service Interfaces 2.5
  • Microsoft Visual Basic Enterprise Edition for Windows 6.0
  • Microsoft Visual Basic 6.0 Enterprise Edition Service Pack 3
  • Microsoft Visual Basic 6.0 Enterprise Edition Service Pack 4
  • Microsoft Visual Basic 6.0 Enterprise Edition Service Pack 5
  • Microsoft Active Directory Client Extension, ????? ?????? ??:
    • Microsoft Windows NT 4.0
????? ??????: 
kbmt kbdswadsi2003swept kb32bitonly kbhowto KB297951 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????297951

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com