다음을 통해 공유


Get User Profiles and Last User that Logged on to Desktop Computers

Another Powershell script that helps with a migration. In this instance the requirement was for a way of understanding the accounts that had previously logged onto desktop systems and the credentials of the last logged on user, for either all desktop systems in a Domain\OU structure or all desktop systems listed in a text file. Additionally, in this instance, there was a requirement to add a delay between each iteration of the data gathering to minimise impact on the script running system and to the network.

The challenge was that this information is stored differently in XP and Vista\Win7 in the registry and the Profile information is accessible on Vista\Win7 systems using Get-Profiles, but needs some registry scripting jiggery-pokery for XP\Win2k3 systems. Additionally, I could not find any script out there that did both these things, so I decided to use functions from other peoples work and stitch them together to get what is attached.

To understand what can be done with the script, read the header. If the script is run without parameters it will just get Profile information for all desktop systems in the currently logged on domain. The output is stored in 3 csv files that are suffixed with Date\Time stamps in the same location that the script is run from.

 The Syntax for running the script is this and none of the parameters are required.

.\Get-PCUserProfilePath.ps1 -srcDomainPath <SearchPathdnOrDNSName> -IterationDelay <TimeInSeconds> -ComputerType <ServerOrDesktop> -ComputerListFile <sAMAccountNameTextList>
 

I have not included a listing of the script here because it is too large, but the script can be downloaded at the bottom of this posting.

HTH

 

Get-PCsUserProfileInfo.ps1.txt

Comments

  • Anonymous
    January 01, 2003
    Dean, Unfortunately, the script works the other way round i.e. it queries specificlist of computers for a list of the users that have used it and not searches through each computer for a specific user logging onto them. But there is nothing to say that you couldn't take the csv files created by this script and sort and filter the data in Excel to get a list for a specific user which in turn will show the computers they have logged into. Carl H

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    July 03, 2012
    Can you run this script against a specific user? That will be quickly identify how many computers the user logged onto.

  • Anonymous
    July 06, 2012
    that should be fine. Just thought it could be very useful for our helpdesk to find out quickly how many desktops a user may log onto. thanks.