I am writing a PowerShell Script that get users with Last interactive sign in but actually I am not sure about it and some codes are missing because I don't have background on it can someone help..
...
##if there is no sign in from user - - And- user not performed an interactive sign in
...
if ($Null -eq $User.SignInActivity ) {
#if company contains SP
if($User.companyName -eq 'company1') {
#if user not performed an interactive sign in
if ($Null -eq $User.SignInActivity.interactive ) {
$err= "No interactive sign in detected"
write-host "$upn $date $company $country $city $err "
}
...
I wanted the code to print the following : ErrorNumber,UPN,date,Service Provider,Country,City,Error,Last interactive sign in (UTC),Last interactive sign in (user local time),Last App
but I don't know how to get the last 3 attribute please help!! + user should has not performed an interactive sign in between 12.00 AM and 11.59 PM on the previous weekday Weekdays only: all worldwide staff have weekend on Friday and Saturday


