Powershell:New-SMBshare cmdlet无法在远程服务器上运行。 [英] Powershell: New-SMBshare cmdlet not working on remote server.

查看:304
本文介绍了Powershell:New-SMBshare cmdlet无法在远程服务器上运行。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在尝试制作一个多功能一体的脚本,它将在服务器上创建一个共享文件夹,允许它(NTFS),共享它,设置共享权限,然后设置DFS文件夹和目标。到目前为止所有这些工作都很好(至少在个别部分),除了Share
部分。

I am trying to make an all-in-one script which will create a share folder on a server, permission it (NTFS), share it, set share permissions, then set the DFS folder and target. All of this works fine so far (at least in individual parts), except for the Share part.


我的代码看起来不错。

My code looks OK.


要测试,如果我在本地创建/许可共享,则没有问题。示例:

To test, If I create/permission the share locally, there is no problem. Example:


New-SmbShare -Name test1 -Path C:\ test -FullAccess Administrators

New-SmbShare –Name test1 –Path C:\test -FullAccess Administrators


这很好。


但是,如果我在服务器上尝试相同,我会收到此错误:"文件名,目录名称或卷标语法不正确。"示例:

BUT, if I try the same on the server, I get this error: "The filename, directory name, or volume label syntax is incorrect." Example:


New-SmbShare -name test1 -path \ \\\\ $ \ _data -FullAccess管理员

New-SmbShare -name test1 -path \ \server\e$\data -FullAccess Administrators


我不确定错误意味着什么(Google也不是),但我想知道我是否错误地输入了服务器地址语法......或者甚至可以使用Powershell进行远程共享创建?我在网上看到的每个例子都显示了本地创作。

I am not sure what the error means (Google was not either), but I am wondering if I am entering the server address syntax incorrectly...or is remote share creation even possible with Powershell? Every example I have seen on the web shows a local creation.


谢谢!

推荐答案

也许您不应该尝试使用网络语义来创建本地共享???
Perhaps you should not try to use network semantics to create a local share???


这篇关于Powershell:New-SMBshare cmdlet无法在远程服务器上运行。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆