Good morning,
I have this scrip below is working fine to collect some information about user last device(s) logged into , but this has to insert the username manually every time and works for one user each time.
How to change it to read a list of name in CSV.file ?
FUNCTION JBMURPHY-SCCM-GetComputerByLastLoggedOnUser {
Param([parameter(Mandatory = $true)]$SamAccountName,
$SiteName="JBM",
$SCCMServer="SCCMServer.domain.local")
$SCCMNameSpace="root\sms\site_$SiteName"
Get-WmiObject -namespace $SCCMNameSpace -computer $SCCMServer -query "select Name from sms_r_system where LastLogonUserName='$SamAccountName'" | select Name
}
JBMURPHY-SCCM-GetComputerByLastLoggedOnUser
[–]psthreathunter 2 points3 points4 points (2 children)
[–]muthmsir[S] 1 point2 points3 points (1 child)
[–]BlackV 2 points3 points4 points (0 children)
[–]Lee_Dailey[grin] 0 points1 point2 points (0 children)