Local User and Local User Profile Creation
Hi Guys
I've to create a local administrator account on multiple machines and do some user-profile customisations afterwards. The problem i initially had was that creating an user-profile not automatically creates the corresponding local-profile too so i had to find a way to create the user and the user profile before i could customise it.
My fist thought was that i could solve it maybe using "userenv.dll" and the marshal-class in powershell to build the local user profile (folder structure) but i've recognized that this won't work cause the corresponding registry-entrys where missing. (It will create the folder-structure as it should, but as soon the user log-in that structure will be overwritten cause he won't find that user in HKEY_USERS Hive).
So finally - in lack of other ideas - i decided to split this in multiple steps. First i create the user account like:
net user <username> <password> /add /comment:"<somecomment>" /passwordchg:no
net localgroup Administrators <username> /add
In the next Step i configure Autologon.exe for the newly created user so that the system will auto-logon with that user at the next boot and create the user-profile during first logon:
Start-Process "<path-to>\Autologon.exe" -ArgumentList "<username>",".","<password>","/accepteula" -Wait
Then i will Reboot the System. Cause of the autologon set before the system will automatically boot to the newly created account and creates the user-profile structure which allowing me to do the customisations thereafter.
In general that way would work but i wonder if there's maybe a more elegant way to archieve this?
I'm also a bit concerned 'bout writing usernames and passwords in the scipts / steps in clear-text. I don't know exactly how pdq behaves concerning this. Will the steps / scripts i execute over PDQ be logged somewhere client- or serverside?
Kind regards
Comments
interesting, gonna use your idea, thanks