Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

System.__ComObject cast to int64 (PowerShell)

$
0
0

I have been through 20 sites trying to understand this, but I just don't get it... How do you change System.__ComObjects. I use the [ADSI] accelerator a lot and when it comes to converting Active Dirctory Large Integer/Interval values to Int64, I just don't understand how it is suppose to work.

For example:

We have a custom schema attribute for our computer objects named ms-Mcs-AdmPwdExpirationTime. I know from looking in the Schema that the object is a Large Integer/Interval format.  I know it is convertible to int64, because when I use the [ADSIsearcher] accelerator it is converted for me. Knowing that it can be converted I started looking at the object to see if I could convert the attribute I get back when I use the [ADSI] accelerator. Keep in mind that I don't have a problem to resolve, I have a lack of understanding I am trying to over come...

First I tried get-member:

TypeName: System.__ComObject

NameMemberTypeDefinition
------------------------
CreateObjRefMethodSystem.Runtime.Remoting.ObjRef CreateObjRef(type ...
EqualsMethodbool Equals(System.Object obj)
GetHashCodeMethodint GetHashCode()
GetLifetimeServiceMethodSystem.Object GetLifetimeService()
GetTypeMethodtype GetType()
InitializeLifetimeServiceMethodSystem.Object InitializeLifetimeService()
ToStringMethodstring ToString()


Nothing here seemed exceptionally helpful to converting the object, so I tried GetType():

IsPublicIsSerialNameBaseType
----------------------------
TRUEFALSE__ComObjectSystem.MarshalByRefObject


I also tried looking at the PSObject

BaseObject          : System.__ComObject
Members             : {System.Object GetLifetimeService(), System.Object
                      InitializeLifetimeService(), System.Runtime.Remoting.ObjRef
                      CreateObjRef(type requestedType), string ToString()...}
Properties          : {}
Methods             : {System.Object GetLifetimeService(), System.Object
                      InitializeLifetimeService(), System.Runtime.Remoting.ObjRef
                      CreateObjRef(type requestedType), string ToString()...}
ImmediateBaseObject : System.__ComObject
TypeNames           : {System.__ComObject, System.MarshalByRefObject, System.Object}

I see absolutely no hint on how I should convert this... I know what this object is, and I know what I need it to be. How should I be looking at Com objects to determine how to convert them to other data types (Large Integer/Interval to Int64 for example)?



Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>