Welcome to ServerForumz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Retrieving an object's GUID as a string from Active Direct..

 
   Windows Server (Home) -> Windows Server Scripting RSS
Next:  Check for existance of a registry key ?  
Author Message
Mr K

External


Since: Aug 04, 2005
Posts: 1



(Msg. 1) Posted: Thu Aug 04, 2005 8:31 am
Post subject: Retrieving an object's GUID as a string from Active Directory
Archived from groups: microsoft>public>windows>server>scripting (more info?)

I'm in over my head. I found some code that takes the mystery out of getting
an object's SID and formatting it as a string but unfortunately that code is
not going to work with an object's GUID. Can anybody help me out with a
snipet to convert the object's GUID to a string value?

 >> Stay informed about: Retrieving an object's GUID as a string from Active Direct.. 
Back to top
Login to vote
Mr K

External


Since: Aug 04, 2005
Posts: 4



(Msg. 2) Posted: Thu Aug 04, 2005 8:35 am
Post subject: RE: Retrieving an object's GUID as a string from Active Directory [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hmm... I should specify that a VBScript example would be the most useful to me.

"Mr K" wrote:

> I'm in over my head. I found some code that takes the mystery out of getting
> an object's SID and formatting it as a string but unfortunately that code is
> not going to work with an object's GUID. Can anybody help me out with a
> snipet to convert the object's GUID to a string value?

 >> Stay informed about: Retrieving an object's GUID as a string from Active Direct.. 
Back to top
Login to vote
Marty List

External


Since: Mar 25, 2005
Posts: 148



(Msg. 3) Posted: Thu Aug 04, 2005 9:38 am
Post subject: Re: Retrieving an object's GUID as a string from Active Directory [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Which scripting language are you using?


"Mr K" <Mr K RemoveThis @discussions.microsoft.com> wrote in message
news:1A044B0D-F033-436B-B1E0-E28B0395FABE@microsoft.com...
> I'm in over my head. I found some code that takes the mystery out of getting
> an object's SID and formatting it as a string but unfortunately that code is
> not going to work with an object's GUID. Can anybody help me out with a
> snipet to convert the object's GUID to a string value?
 >> Stay informed about: Retrieving an object's GUID as a string from Active Direct.. 
Back to top
Login to vote
Mr K

External


Since: Aug 04, 2005
Posts: 4



(Msg. 4) Posted: Thu Aug 04, 2005 9:38 am
Post subject: Re: Retrieving an object's GUID as a string from Active Directory [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

The page you supplied has a VB example but the problem is that things do not
seem so straight forward with VBScript.

If I run the following script the output is a bunch of question marks...

ADGroup = InputBox("I.E. F00-SQLSERVERENTMGR-2000", "Please enter Active
Directory group", "F00-SQLSERVERENTMGR-2000")

Set objGroup = GetObject("LDAP://CN=" & ADGroup & ",OU=Applications,OU=Users
and Groups,DC=f00bar,DC=f00")

WScript.Echo objGroup.objectGUID
Set GUID = objGroup.objectGUID
 >> Stay informed about: Retrieving an object's GUID as a string from Active Direct.. 
Back to top
Login to vote
Mr K

External


Since: Aug 04, 2005
Posts: 4



(Msg. 5) Posted: Thu Aug 04, 2005 9:55 am
Post subject: Re: Retrieving an object's GUID as a string from Active Directory [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

I found the issue. It is the way I am asking for data. I should be using
objGroup.GUID not objGroup.objectGUID.

"Mr K" wrote:

> The page you supplied has a VB example but the problem is that things do not
> seem so straight forward with VBScript.
>
> If I run the following script the output is a bunch of question marks...
>
> ADGroup = InputBox("I.E. F00-SQLSERVERENTMGR-2000", "Please enter Active
> Directory group", "F00-SQLSERVERENTMGR-2000")
>
> Set objGroup = GetObject("LDAP://CN=" & ADGroup & ",OU=Applications,OU=Users
> and Groups,DC=f00bar,DC=f00")
>
> WScript.Echo objGroup.objectGUID
> Set GUID = objGroup.objectGUID
 >> Stay informed about: Retrieving an object's GUID as a string from Active Direct.. 
Back to top
Login to vote
Wayne Tilton

External


Since: Oct 13, 2003
Posts: 30



(Msg. 6) Posted: Thu Aug 04, 2005 9:58 am
Post subject: Re: Retrieving an object's GUID as a string from Active Directory [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"=?Utf-8?B?TXIgSw==?=" <MrK RemoveThis @discussions.microsoft.com> wrote in
news:A37F76B2-7199-4EE7-8828-201CB5D2286E@microsoft.com:

> The page you supplied has a VB example but the problem is that things
> do not seem so straight forward with VBScript.
>
> If I run the following script the output is a bunch of question
> marks...
>
> ADGroup = InputBox("I.E. F00-SQLSERVERENTMGR-2000", "Please enter
> Active Directory group", "F00-SQLSERVERENTMGR-2000")
>
> Set objGroup = GetObject("LDAP://CN=" & ADGroup &
> ",OU=Applications,OU=Users and Groups,DC=f00bar,DC=f00")
>
> WScript.Echo objGroup.objectGUID
> Set GUID = objGroup.objectGUID
>

This function takes an AdsPath (i.e. full LDAP:// or WinNT:// path of the
object) and returns the GUID is readable format. Watch for line
wrapping.

HTH,

Wayne

Function GetGUID(theObject)
GUID = GetObject(theObject).Get("objectGUID")
strGUID = ""
For x = LBound(GUID) to UBound(GUID)
strGUID = strGUID & Right("00" & Hex(AscB(MidB(GUID, x+1))),2)
Next
vvvvvvvv = BigEndian(Mid(strGUID,1,Cool)
wwww = BigEndian(Mid(strGUID,9,4))
xxxx = BigEndian(Mid(strGUID,13,4))
yyyy = Mid(strGUID,17,4)
zzzzzzzzzzz = Mid(strGUID,21)
GetGUID = "{" & lcase(vvvvvvvv & "-" & wwww & "-" & xxxx & "-" & yyyy
& "-" & zzzzzzzzzzz) & "}"
End Function

' Flips the bytes in a string of bytes from little endian to big endian
format
' and converts to decimal
Function BigEndian(theBytes)
BigEndian = ""
For x = Len(theBytes) To 2 step -2
BigEndian = BigEndian & Mid(theBytes,x-1,2)
Next
End Function
 >> Stay informed about: Retrieving an object's GUID as a string from Active Direct.. 
Back to top
Login to vote
Mr K

External


Since: Aug 04, 2005
Posts: 4



(Msg. 7) Posted: Fri Aug 05, 2005 8:57 am
Post subject: Re: Retrieving an object's GUID as a string from Active Directory [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

hanks Wayne and Marty! My scripters block has been resolved.
 >> Stay informed about: Retrieving an object's GUID as a string from Active Direct.. 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Object required: '[string: "C:Documents and Set"] error me.. - I'm new to this forum and to vbscripting. I am getting the error message: Object required: '[string: "C:\Documents and Set"] when running the following script: Option Explicit Dim objFSO Set objFSO = CreateObject("Scripting.FileSystem...

Retrieving a list of users of an Active Directory server - I am new to all this so bare with me: I need to return a list of users from an Active Directory server called NET-SERV1. Any ideas on how to do this in VBscript? TIA! PB

Retrieving the last logon time and date for users in an ac.. - Is there a way to get the last logon time and date for users in the active directory? This is an Windows 2003 domain. -- Eric Sabo NT Administrator

Using IsObject to fetch Active Directory User object - Hi I am urgently needed to write a script to use IsObject to get Active directory User object attribute. Can some one help.. The script is as below: <html> <head><title></title> </head> <body> <% set objUser=Ge...

Auto Generate Active Directory Computer Object Description - I was wondering threw the power of VB Scripting would it be possible to auto generate computer object descriptions based on the user that is logged into that particular machine when the script runs. The description would look similar too: Assigned t...
   Windows Server (Home) -> Windows Server Scripting All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]