ptea
asked on
QAD-Cmdlets LastLogonTimestamp
Hi there,
I want to run this query using the Qest AD Powershell extensions:
get-qaduser -Enabled -includeallproperties -Sizelimit 0 | select -property name,samaccountname,lastlo gontimesta mp
The query works but after some hundret accounts it failed with the following error message:
Get-QADUser : '040930075424Z' is not generalized time UTC string.
At line:1 char:12
+ get-qaduser <<<< -Enabled -includeallproperties -Sizelimit 0 | select -property name,samaccountname,lastlo gontimesta
mp
+ CategoryInfo : NotSpecified: (:) [Get-QADUser], FormatException
+ FullyQualifiedErrorId : System.FormatException,Que st.ActiveR oles.ArsPo werShellSn apIn.Power shell.Cmdl ets.GetUse rCmdlet
Anyboday knows how to get rid of this? thx
I want to run this query using the Qest AD Powershell extensions:
get-qaduser -Enabled -includeallproperties -Sizelimit 0 | select -property name,samaccountname,lastlo
The query works but after some hundret accounts it failed with the following error message:
Get-QADUser : '040930075424Z' is not generalized time UTC string.
At line:1 char:12
+ get-qaduser <<<< -Enabled -includeallproperties -Sizelimit 0 | select -property name,samaccountname,lastlo
mp
+ CategoryInfo : NotSpecified: (:) [Get-QADUser], FormatException
+ FullyQualifiedErrorId : System.FormatException,Que
Anyboday knows how to get rid of this? thx
ASKER
Thx Chris - but the debugging is not working... get the same message as before, no additional information...
cheers
cheers
Hmm okay, this one?
I'm hoping it won't error until it gets to:
$_ | Select Name, SamAccountName, LastLogonTimeStamp
If it dies before that it's going to be a little more difficult.
Chris
$VerbosePreference = "continue"
Get-QADUser -Enabled -IncludeAllProperties -Sizelimit 0 |
ForEach-Object {
$User = ([ADSISearcher]"(distinguishedName=$($_.DN))").FindOne()
Write-Verbose "Name: $($_.Name)"
Write-Verbose "TimeStamp (raw): $($User.Properties['lastlogontimestamp'][0])"
$_ | Select Name, Samaccountname, LastLogonTimeStamp
}
ASKER
...in principle nice stuff - get the debug information of each user account, but crashes at the same position without showing debug-info...
I run the query without LogonTimeStamp to get the object which is causing the troubles. Verified the values and for me everything is fine... (checked it with the Sysinternals AD Explorer)...
But when I run the query against this user account only I get the same error... hmm strange stuff - I hope this is the only account doing bad things, is it possible to exclude it?
I run the query without LogonTimeStamp to get the object which is causing the troubles. Verified the values and for me everything is fine... (checked it with the Sysinternals AD Explorer)...
But when I run the query against this user account only I get the same error... hmm strange stuff - I hope this is the only account doing bad things, is it possible to exclude it?
You could feed it an LDAP filter to prevent it finding the account. e.g.
-LdapFilter "(!(name=TheBadAccount))"
It'd be nice to know why it's getting upset about the value though.
Chris
ASKER
thx for the input... nice to be able to use normal LdapFilters - i did not know.... strange whats going on with this account.... Yeah would be nice to figgure it out - but I can't find the bug...
really bad - I used the filter with the samaccountname -> same result. I disabled the account temporary, as I am using the switch "-Enabled" only active account should be checked -> same result... So we have the problem not only with this account - I identified the 2nd account and excluded it too.
Do you know is there an option like "SilentlyContinue" available for WMI?
The really bad thing is, that the query stops...
Thx for the good support...
really bad - I used the filter with the samaccountname -> same result. I disabled the account temporary, as I am using the switch "-Enabled" only active account should be checked -> same result... So we have the problem not only with this account - I identified the 2nd account and excluded it too.
Do you know is there an option like "SilentlyContinue" available for WMI?
The really bad thing is, that the query stops...
Thx for the good support...
There is, but it may not do any good if it's throwing a terminating error.
For those accounts, can you run:
([ADSISearcher]"(&(name=Th
Select-Object `
@{n='Name';e={ $_.Properties["name"][0] }},
@{n='lastLogonTimeStamp';e
It should give you a numeric value for lastLogonTimeStamp. Does it?
If so, please run:
[DateTime]::FromFileTime(T
See if that gives you a sane date?
Chris
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
This question has been classified as abandoned and is being closed as part of the Cleanup Program. See my comment at the end of the question for more details.
Neat...
It could be a bug. Lets see if we can dig a bit deeper. First we need to know who throws the error if we can. Debugging version attached.
Chris
Open in new window