【发布时间】:2013-12-18 08:06:01
【问题描述】:
我尝试了以下方法来创建用户并为用户分配主目录。
$comp = [ADSI]'WinNT://localhost,computer';
$user = $comp.Create('User', 'account14');
$user.SetPassword('Welcome1$');
$user.put('HomeDirectory','C:\Users\account14');
$user.SetInfo();
这里的目录帐户不存在。所以理想情况下,它应该被创建并分配为主目录。如果我们检查用户 account14 的属性,C:\Users\account14 被列为本地路径,但没有创建目录。在用户的属性对话框中,如果我们单击应用,则在配置文件选项卡下,将创建目录。
【问题讨论】:
标签: windows powershell powershell-remoting home-directory