Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Home directory creation for local user accounts using powershell

$
0
0

Through Computer Management when I create a user, a home directory is created for the same user in the folder C:\Users.I am creating a user through powershell in a remote machine.I am using the following script to create user 

$comp = [ADSI]'WinNT://localhost,computer';
$user = $comp.Create('User', 'account7');
$user.SetPassword('Welcome1');
$user.SetInfo();

The account is getting created. But no home directory is created for this user. How to create a home directory for a user using powershell? Also the user created through GUI is a member of the group 'Users' by default. How to add the user created to the 'Users'  Group.



Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>