Hi Guys,
Requesting for your assistance, this error really bugging. Im not getting this error when applying to an OU with small number of users. But when applying to an OU with large number of Users Im getting the error above. And clueless how to solve it.
Also, Im newbie in powershell and still learing. Im wonder what is the line and Char mean from the error.
Thanks in advance.
#import the ActiveDirectory Module
Import-Module ActiveDirectory
#@{Label = "OU";Expression = {$_.Canonicalname}},
#@{Label = "Manager";Expression = {%{(Get-AdUser $_.Manager -server $ADServer -Properties DisplayName).DisplayName}}},
Get-ADUser -searchbase "ou=Accounts,dc=kamotegroup,dc=internal" -Properties * -Filter * |
Select-Object @{Label = "First Name";Expression = {$_.GivenName}},
@{Label = "Last Name";Expression = {$_.Surname}},
@{Label = "Display Name";Expression = {$_.DisplayName}},
@{Label = "Logon Name";Expression = {$_.sAMAccountName}},
@{Label = "City";Expression = {$_.City}},
@{Label = "State";Expression = {$_.st}},
@{Label = "Job Title";Expression = {$_.Title}},
@{Label = "Company";Expression = {$_.Company}},
@{Label = "Description";Expression = {$_.Description}},
@{Label = "Department";Expression = {$_.Department}},
@{Label = "Office";Expression = {$_.OfficeName}},
@{Label = "Phone";Expression = {$_.telephoneNumber}},
@{Label = "Email";Expression = {$_.Mail}},
@{Label = "OU";Expression = {$_.canonicalname -replace "/$($_.cn)",""}},
@{Label = "Manager";Expression = {%{(Get-AdUser $_.Manager -Properties DisplayName).DisplayName}}},
@{Label = "Account Status";Expression = {if (($_.Enabled -eq 'TRUE') ) {'Enabled'} Else {'Disabled'}}}, # the 'if statement# replaces $_.Enabled
@{Label = "Expiration Date";Expression = {$_.AccountExpirationDate}},
@{Label = "Last LogOn Date";Expression = {$_.lastlogondate}} |
#Export CSV report
Export-Csv -Path "C:\HPSA_Script_Results\alladusersAccounts.csv" -NoTypeInformation
Error:
Get-ADUser : Not a valid Win32 FileTime.
Parameter name: fileTime
At line:6 char:1
+ Get-ADUser -searchbase "ou=Accounts,dc=kamotegroup,dc=internal" -Properties * -F ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-ADUser], ArgumentOutOfRangeException
+ FullyQualifiedErrorId : ActiveDirectoryCmdlet:System.ArgumentOutOfRangeException,Microsoft.ActiveDirectory.Management.Commands.GetADUser