gpt4 book ai didi

Powershell HomeDirectory 未在文件服务器文件系统上创建

转载 作者:行者123 更新时间:2023-12-02 23:28:23 25 4
gpt4 key购买 nike

我在使用 Powershell 并通过 cmdlet 设置 HomeDirectory 时遇到了一个奇怪的问题

Set-ADUser -Identity "user" -HomeDirectory "\\fileserver\home$\user"

即使 cmdlet 正在运行并在 AD 中设置值,文件服务器“\fileserver\home$\user”上的必要文件夹也不会被创建。

我也没有成功地尝试过最初的创建
New-ADUser -Name "user" -HomeDirectory "\\fileserver\home$\user"

我已通过 UAC 以域管理员身份在 Exchange 服务器上启动 Powershell,并通过以下方式导入模块 ActiveDirectory
Import-Module ActiveDirectory

而不是使用带有 NetBIOS 主机名的 UNC 路径,我还尝试了 FQDN\fileserver.domain.local\以及 ip 地址\ip\

如果我使用 cd 命令通过 Powershell 输入 UNC 路径,它也可以工作,我还可以创建目录。
cd \\fileserver\home$
mkdir test_dir

不过,不会创建该目录。
如果我使用 AD GUI,并尝试更改 HomeDirectory 路径,将创建该文件夹。

有什么提示吗?
非常感谢
PS:2008R2 x64、Exchange 2010、1x Exchange、1x AD Controller 、1x 文件服务器

最佳答案

值得一提的是Hey, Scripting Guy! Blog

Remember, all we have done is edit a field in Active Directory. The file system on the foreign server has no clue about the information presented within Active Directory. When you edit those fields in the GUI, the user folder and permissions are provisioned as a function of the code within that GUI interface—they are not a function of Active Directory.



就像保罗建议的那样,我认为您只需要自己创建文件夹即可。该文章中还链接了有关设置文件共享权限的信息。我想你已经完成了。
NEW-ITEM –path "\\fileserver\home$\user" -type directory -force

关于Powershell HomeDirectory 未在文件服务器文件系统上创建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26592223/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com