Page 1 of 1 1
Topic Options
#196192 - 2009-10-01 04:52 PM AD and large integer
5861king Offline
Fresh Scripter

Registered: 2006-09-28
Posts: 48
Loc: UK
i'm trying to kix to read a large integer value in the AD, and the name of this field in AD is pwdlastset which is a large integer. when reading this for what ever reason kix throws up an error. which says :-

IDispatch pointers not allowed in expressions!

is there away of reading this value and displaying in kix. below is my code snippet.

 Code:
Dim $selectedProperties, $propertynames, $oCn, $oCmd, $oRS, $i
$selectedProperties = "ADsPath"
$propertynames = Split($selectedProperties, ",")

$oCn = CreateObject("ADODB.Connection")
$oCmd = CreateObject("ADODB.Command")
$oCn.Provider = "ADsDSOObject"
$ = $oCn.Open("Active Directory Provider", "", "", -1)
$oCmd.ActiveConnection = $oCn
$oCmd.Properties("Page Size").Value = 1000
$oCmd.Properties("Searchscope").Value = 2 ;ADS_SCOPE_SUBTREE
; $oCmd.CommandText = "SELECT " + $selectedProperties + " FROM 'LDAP://server.co.uk' WHERE objectCategory='user' and objectClass = 'user' ORDER BY Name"

$oRS = $oCmd.Execute
While Not $oRS.EOF
	$obj = GetObject($oRS.Fields($propertynames[0]))
	? "CN Name: " +  + $obj.cn 
	? "First Name: " + $obj.givenname
	? "Surname: " + $obj.sn 
	? "Password set2: " + $obj.pwdlastset 
	? " "
	$oRS.MoveNext



TIA

Glyn

Top
#196193 - 2009-10-01 05:09 PM Re: AD and large integer [Re: 5861king]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Maybe try to insert something like
 Code:
$Values = $obj.pwdlastset
For Each $Value in $Values
	? $Value
Next

Top
#196194 - 2009-10-01 05:23 PM Re: AD and large integer [Re: Witto]
5861king Offline
Fresh Scripter

Registered: 2006-09-28
Posts: 48
Loc: UK
Thanks witto, no go however it did not throw up an error, but it did not display the value either. i have check the value in ADSI Edit and the value is 128988838262647554

Edited by 5861king (2009-10-01 05:32 PM)

Top
#196195 - 2009-10-01 05:32 PM Re: AD and large integer [Re: 5861king]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Sorry

IDispatch pointers not allowed in expressions!

just tells that what you get is (most probably) an array

Top
#196196 - 2009-10-01 05:34 PM Re: AD and large integer [Re: Witto]
5861king Offline
Fresh Scripter

Registered: 2006-09-28
Posts: 48
Loc: UK
o.k. sorry to be abit of newbie, can we get it to display the array value?
Top
#196197 - 2009-10-01 05:42 PM Re: AD and large integer [Re: 5861king]
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Check out fnInterger8Date() to convert your Integer8 value into a readable format.
Top
#196198 - 2009-10-01 05:47 PM Re: AD and large integer [Re: 5861king]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
don't you have to query for it first?

http://www.vistax64.com/vb-script/174244-look-up-when-password-last-set.html

look at the part

objCommand.CommandText = "SELECT Name, whenCreated, pwdLastSet FROM
'LDAP://dc=corp,dc=acme,dc=local' WHERE objectCategory='user' " & "AND
sAMAccountName='" & strUsername & "'"
Set objRecordSet = objCommand.Execute

Top
#196201 - 2009-10-01 05:55 PM Re: AD and large integer [Re: Chris S.]
5861king Offline
Fresh Scripter

Registered: 2006-09-28
Posts: 48
Loc: UK
 Originally Posted By: Chris S.
Check out fnInterger8Date() to convert your Integer8 value into a readable format.


Thanks Chris work perfect. i had to change my code to work with it. but it works!!!! thanks

Glyn


Edited by 5861king (2009-10-01 06:30 PM)

Top
#196202 - 2009-10-01 06:00 PM Re: AD and large integer [Re: Witto]
5861king Offline
Fresh Scripter

Registered: 2006-09-28
Posts: 48
Loc: UK
thanks witto, if you look at my code i am calling pwdlast set.

 Code:
$obj = GetObject($oRS.Fields($propertynames[0]))
	? "CN Name: " +  + $obj.cn 
	? "First Name: " + $obj.givenname
	? "Surname: " + $obj.sn 
	? "Password set2: " + $obj.pwdlastset 

Top
#196209 - 2009-10-01 10:45 PM Re: AD and large integer [Re: Chris S.]
5861king Offline
Fresh Scripter

Registered: 2006-09-28
Posts: 48
Loc: UK
 Originally Posted By: Chris S.
Check out fnInterger8Date() to convert your Integer8 value into a readable format.


Hi Chris S.

Is there away of getting this program to display the raw value instead of converting it into date format.

Thanks

Glyn

Top
#196211 - 2009-10-01 11:47 PM Re: AD and large integer [Re: 5861king]
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Sorta. The reason you can't display the whole number is because it is a 64-bit integer. You can look at the HighPart and LowPart individually if you want. See the remarks section of my UDF for more...
Top
#196212 - 2009-10-02 12:17 AM Re: AD and large integer [Re: 5861king]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Maybe SerialDate() is what you are looking for?
fnInteger8Date($obj.pwdlastset) returns 'yyyy/mm/dd h:mm:ss'
Split(fnInteger8Date($obj.pwdlastset), ' ')[0] returns 'yyyy/mm/dd'
SerialDate(Split(fnInteger8Date($obj.pwdlastset),' ')[0]) returns a number that represents the date

Top
#196243 - 2009-10-04 12:50 PM Re: AD and large integer [Re: Witto]
5861king Offline
Fresh Scripter

Registered: 2006-09-28
Posts: 48
Loc: UK
Thanks Chris S for the explanation and Witto, will give that a try on monday.

Thanks

Glyn

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 781 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.064 seconds in which 0.024 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org