I have been tasked with rolling out several hundred new computers.
The computers will all be imaged and will not be joined to the domain until they are physically on the clients desk. The trick is, I need to take some data from their local profile on their current machine, and migrate it to the new workstation.
So, I created a script to pull their data, and store it to a server until the new computer is added to the domain, and the user logs on with their Domain Account.
I read the solution here: http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_23091801.html, but I'd need the user's ID and Password. As it stands, an admin still has to logon when the new computer is booted up, so it can be added to the domain, and computer name changed.
I tried a solution where the registry keys that go along with the user's SID are created, but when the user logs on, Windows just overwrites the values with new information, and creates a profile folder called USERID123.DOMAINNAME. So, I tried modifying the folder path to create a profile folder called USERID123.DOMAINNAME, and again, it overwrote the registry keys and created a profile folder called USERID123... Yes, I wanted to slap myself multiple times about the face and neck, but I thought I might get canned for that. So I'm here asking for your help. I have no cookies though, sorry.
This is a working function I scraped together to try the above note.
Function createUserProfile(userSID, userID)
Const HKLM = &H80000002
'userSID = "S-1-5-21-12345678-1234567890-1234567890-12345"
'userID = "USERID123"
strKey = "Software\Microsoft\Windows NT\CurrentVersion\ProfileList"
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
strUserKeyPath = strKey & "\" & userSID
oReg.CreateKey HKLM, strUserKeyPath
strUserPathKeyName = "ProfileImagePath"
strUserPathValue = "%SystemDrive%\Documents and Settings\" & userID
oReg.SetExpandedStringValue HKLM,strUserKeyPath,strUserPathKeyName,strUserPathValue
strUserFlagKeyName = "Flags"
strUserFlagValue = 1
oReg.SetDWORDValue HKLM,strUserKeyPath,strUserFlagKeyName,strUserFlagValue
Set oReg = Nothing
Set objFSO = CreateObject("Scripting.FileSystemObject")
userFolderPath = "C:\Documents and Settings\" & userID
objFSO.CreateFolder userFolderPath
objFSO.CreateFolder userFolderpath & "\Cookies"
objFSO.CreateFolder userFolderpath & "\Desktop"
objFSO.CreateFolder userFolderpath & "\Favorites"
objFSO.CreateFolder userFolderpath & "\My Documents"
objFSO.CreateFolder userFolderpath & "\Start Menu"
Set objFSO = Nothing
createUserProfile = "Successfully created profile for " & userID
End Function
What I'm really getting at is, I want to create the a local profile for a domain user before they ever log on, and without having to use their ID/Password credentials.
Anyone? Anyone? BUELLER?
If you read all that, thank you!
by: RobSampsonPosted on 2009-03-10 at 22:46:40ID: 23854181
I do the same thing when I change PCs, and currently, we back up the profile on the old pc, get them to log into the new computer (which creates their profile with the right folder name against the right SID), then we reboot, log in as admin, and copy their old profile data into
c:\documents and settings\<username>
I would love to be able to copy the profile back into the new computer without having them log in first, and then have them log in and not have a new folder created. Your function looks interesting...I'll have to test it....you can't be far off with the ProfileList keys.....
I looked at MoveUser.exe but that's for account to account moving.....
Someone else may know how to do this easily, but I'll look into it in the meantime...
Regards,
Rob.