Tag Archives | Active Directory

Why do I have two profiles in Windows?

I hadn’t noticed this until today, but someone asked me why some computers had a profile for user01 and a profile for user01.domain. This got me to scratching my head because it seemed to be a good question for me and I usually dig until I find the answer out. This one wasn’t too hard to come up with, but it’s something that I hadn’t heard verbatim before. If there is already a profile folder with the same name as the user that you are logging on with, it will create the folder as user01.ComputerName or user01.DomainName. I’m still looking for how it decides that or what order it comes in, but that’s enough info to at least know what is happening.

Here’s a quote from wikipedia on user profile creation (windows xp but still seems applicable:
“At first logon, a folder will typically be created under “Documents and Settings” (standard folder on English version of Windows 2000, XP and Windows Server 2003) matching the logon name of the user. Should a folder of that name already exist, the profile-creation process will create a new one, typically named username.computername, on workgroup computers, or username.domainname on Active Directory member computers.”

Other Resources:
Fix a corrupt user profile in Windows 7

Update: Just found out a little more info about the possible order. If anyone has different experiences please post it in the comments.
Dave Patrick suggests the following order:
“On a newly-joined-to-the-domain PC if you logon to the pc first, then to the
domain you would end up with two profiles.
%username%
and
%username%.%userdomain%
Else if you logon to the domain first, then to the pc you would end up with
%username%
and
%username%.%computername%”

Comments { 0 } Posted on April 25, 2011 in Active Directory, Networking, Windows, Windows 7

Move Computer to New OU Using PowerShell

I’m going to assume you have some tool you are using for PowerShell if you are reading this. PowerGUI is the one that I like the best currently. Once you’ve installed that, you research and download the Quest AD cmdlets. You should be set up at this point.

I had run into this issue in the past, albeit learning the hard way when I move “just a few” computers into the wrong OU. So this time I thought I would ask more questions and do more testing before I pulled the trigger. You can find where the journey begin by looking at this Forum Thread over at powergui.org.

To summarize, I wanted to get a list of computers and pipe it into PowerShell to move the computers to a new OU if the name matched exactly. The code that I had used before would move both Computer1 and Computer12. So I decided to ask the experts in the field and through a little trial and error I found a working solution. Here’s how it ended up working.

csv file looks like this:
object,target
computer1,red.bird.net/Red Computers/Big Building/Windows XP SP2 Test Group

PowerShell looks like this:

#take the -WhatIf off when you are ready to actually do it
$csv = Import-Csv C:\ps\PSTextFiles\yourFile.csv
foreach($computer in $csv){
# Display QADComputer for each item in the CSV object
Get-QADComputer -Identity $computer.object | Where-Object {$computer.object -eq $_.name} | Move-QADObject -To $computer.target -WhatIf
}

Dmitry Sotnikov (Blog|Twitter) goes even further to blog about how we should be explicit in what we are asking for.

Poshoholic (Blog|Twitter) mentions the post in his PowerGuide – PowerGUI Weekly News.

Comments { 0 } Posted on April 19, 2011 in Active Directory, Networking, PowerShell