I get the following error. Please help. --------------------------- Get-OSCLastLogo nTime : The term 'Get-OSCLastLog onTime' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + Get-OSCLastLogo nTime -CsvFilePath C:\Script\SamAc countName.txt + ~~~~~~~~~~~~~~~ ~~~~~ + CategoryInfo : ObjectNotFound: (Get-OSCLastLog onTime:String) [], CommandNotFound Exception + FullyQualifiedE rrorId : CommandNotFound Exception --------------- ------------
First (after download) you should run Import-Module C:\Script\GetADUserLastLogonTi me.psm1 After this Get-OSCLastLogo nTime is available
I had to edit the script to get it to successfully read the csv file. Change the line which imports the csv file to an object by removing ".SamAccountName" from the end of the line. After the change, it should be $SamAccountName = (Import-Csv -Path $CsvFilePath) Change the line that queries AD by suffixing $UserName with ".SamAccountNam e" so that only the contents of that column are passed to the function. After the change, it should be QueryActiveDire ctory -UserName $UserName.SamAc countName Once these changes are made and the modified script is imported with the -Force option, it should process your csv file successfully. No quotes or commas are required in the contents of your csv (unless your usernames contain embedded spaces).
Note that this script can be misleading, as it only queries the local AD DC. The script will only be accurate if you only have 1 DC in your domain, which makes the script kinda pointless for 99% of labs/organisations/domains!
For example on french Windows Server 2012 R2: AVERTISSEMENT : The SamAccountName 'DOE Oc?ane' cannot find. Please make sure that it exists.
I did this for my username, and a few other usernames. I've obviously logged in today, but it says the last time I logged in was yesterday morning. I tried signing out and in, restarting my PC. Still says the same time. This script doesn't work perfectly. By far.
Is it possible for this script to poll the other DC's on the network.
Quite simply, does not work. It says the user "Never Logon" when in fact the user logged in 2 days ago as shown in the security log. I'm not sure what this is actually trying to do, but it does not list the user's last login to the machine you're running the script on.
Is it possible to use the Get-OSCLastLogonTime -SamAccountName "username" command to see all the users at once? Rather than entering all of them manually.
For the scripts of get all Active Directory users account last logged on time, see https://gallery.technet.micros oft.com/How-to- get-all-Active- 832ca0c5
i checked with my samAccountName and it says i haven't logged on for a week now! I login everyday so why does it say i haven't?
I'm also having an issue when using trying to run more than one username from the csv. I just get a blank output file if I redirect it. any help would be great
Guys, You need to use the following format on .csv file "SamAccountName", "Mike.DUcilo", "Ary.Hai", "Marissa.Issa",