We have about 70 servers that we are in the process of moving into a domain environment, so we are converting our users from local accounts to domain controlled accounts. How can we determine which users may have files on their desktop or documents folder they may want to back up before their profile is deleted. As part of joining to the domain, the users will be converting to using a domain login, instead of local logins. The only people who would have been logging into these machine would have been specific technical staff running client specific configurations against specific targets.

I was thinking there might be a bit of powershell I could do here, but there might be issues with that.

The users profiles are indeed in C:\Users\\ so I could list those directories and loop them, but I suspect there's a better "Microsofty way" to look for those folders which aren't empty per user, then report the username and hostname for easy collation later in Excel.

Ideally the code would be run from one head-machine and collect details back from all the other machines using some of the newer (PS3?) powershell remoting techniques .. or some other instrumentation.


This is my first attempt:

$Servers = @("localhost")
$Cred = Get-Credential

foreach ($Server in $Servers) {
    Invoke-Command -ComputerName $Server -Credential $Cred {
        @(GCI c:\Users\*\Desktop\. -Exclude *.lnk)

I'm one of the users whose profile will be deleted and I don't know if I have files on one of the servers but I can get IT to run powershell against all the machines if I can get a concept of the code to run.

Edits made due to comments

  • 1
    1. Why would users have user profiles on servers? 2. Why would the profiles be deleted by joining the domain? The local user profiles will still exist after the domain join. – joeqwerty Jan 26 '15 at 23:31
  • @joeqwerty because someone wants them to be deleted. But good question. As for 1), because sometime it is more advantageous for me to do things on the server. Someone has to make sure things work. – jcolebrand Jan 26 '15 at 23:50

Migwiz is microsoft way. Delete each profile when they got migrated. I would not personnaly delete the profile, you put yourself the burden if you delete an important file.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.