About Terminal Server, Citrix, Delphi and other stuff
Some Active Directory attributes return an 8 byte integer in the form of an IADsLargeInteger interface. An example is the pwdLastSet attribute from a user object.
Because the IADsLargeInteger object doesn’t provide type information PowerShell cannot read the HighPart and LowPart properties.
So I wrote the function below to get the Int64 value of an IADsLargeInteger:
|
1 2 3 4 5 6 |
function AdsLargeIntegerToIn64($adsLargeInteger)
{
[Int32]$highPart = $adsLargeInteger.GetType().InvokeMember("HighPart", [System.Reflection.BindingFlags]::GetProperty, $null, $adsLargeInteger, $null)
[Int32]$lowPart = $adsLargeInteger.GetType().InvokeMember("LowPart", [System.Reflection.BindingFlags]::GetProperty, $null, $adsLargeInteger, $null)
return [Int64]("0x{0:x8}{1:x8}" -f $highPart, $lowpart)
} |
Related posts:
Active Directory Altiris Automation Manager bug Citrix Dell Delphi Exchange Exchange2003 Exchange2010 Hack Hewlett-Packard HP iOS Jailbreak Java LinkedIn Linux Lync McAfee MSI MySQL Navigation Objects Office Outlook Passat Password PowerPoint PowerShell RES RNS315 RNS510 SasLibEx Terminal Server ThinApp TSAdminEx VBS VCDS Vista VMWare Volkswagen Windows PE Wordpress XenApp
WP Cumulus Flash tag cloud by Roy Tanck requires Flash Player 9 or better.
One Response for "Convert IADsLargeInteger to Int64 in PowerShell"
[...] out the maxPwdAge attribute is a trivial task in PowerShell (I am re-using the function AdsLargeIntegerToInt64):# Read Maximum Password Age (from Domain Policy) # Read maxPwdAge attribute and convert to Int64 [...]
Leave a reply