Powershell 主目录未在文件服务器文件系统上创建

标签 powershell active-directory fileserver home-directory

我在使用 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 主目录未在文件服务器文件系统上创建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26592223/

相关文章:

java - 有没有办法在Windows中使用Java代码访问http ://<someserver. com> :<portnumber>/logs. log.txt

python - 如何从 SimpleHTTPServer 获取客户端 IP

Powershell验证范围参数错误

asp.net - 在 ASP.NET Core 应用程序中使用标准 Active Directory?

c# - 如何使用 powershell 为构建服务器构建、发布 ASP.NET 核心项目?

powershell - Powershell中特定组织单位的Get-ADComputer

bash - LaunchD Plist 不工作

sql-server - 考虑在哪里存储文档 - 文件服务器上还是数据库中?

powershell - 替换字符串中的第一个字符

file - Powershell:检查文件是否被锁定