I hope someone inhere can help me designing af powershell script which does the following:
1) - Find all windows 10 clients in AD, and get thier windows version.
Then also get the either SamAccountName OR last SamAccountName logged in on the found windows 10 clients!
2) - Export Last login "SamAccountName", "OperationSystem" and "OperationSystemVersion" to an excell document.
I have the following code sofar:
Get-ADComputer -Filter * -Property * | Select-Object Name,OperatingSystem,OperatingSystemVersion | Export-CSV C:\AllWindows1.csv -NoTypeInformation -Encoding UTF8
But i need this to fetch the logged in/last login of the SamAccountName also on the windows 10 clients in the AD, and also export this to an excell.xlmx, if possible.
Can anyone help me?
Let us know what the final code or the solution here ?
I am not real sure what you are asking for here. Only the original poster can say what there final code was, since as noted in my response, there are other considerations in play potentially and the OP (original poster) did not respond to.