2

当我尝试使用在Hudsonnet use中配置的批处理文件时遇到以下问题。

test在远程 Windows Server 2012 中将用户添加为管理员并设置了密码。

我的批处理脚本:

net use p: /delete  
net use p: "\\cazrt\C$" /USER:test /PERSISTENT:NO xxxxx
set "source=%~1"
set "target=p:/%~2"

echo "%source%" "%target%"

echo F|xcopy /S /I /Q /Y "%source%" "%target%"

执行输出:

[exec] C:\HudsonProjects\NGA>net use p: /delete   
[exec] 
[exec] C:\HudsonProjects\apps>net use p: "\\cazrt\C$" /USER:test /PERSISTENT:NO xxxxx 
[exec] System error 5 has occurred.
[exec] 
[exec] Access is denied.

如果我尝试不使用net usePERSISTENT我会收到相同的访问被拒绝错误,并且找不到网络连接。

执行输出:

[exec] C:\HudsonProjects\NGA>net use p: /delete   
[exec] 
[exec] C:\HudsonProjects\apps>net use p: "\\cazrt\C$" /USER:test xxxxx 
[exec] The network connection could not be found.
[exec] More help is available by typing NET HELPMSG 2250.
[exec] 
[exec] 
[exec] 
[exec] C:\HudsonProjects\apps>set "source=D:/target/DROP" 
[exec] 
[exec] C:\HudsonProjects\apps>set "target=p:/C:/temp" 
[exec] 
[exec] C:\HudsonProjeSystem error 5 has occurred.
[exec] 
[exec] Access is denied.

如果我net use从本地 Windows 机器键入,则显示:

\\cazrt\c$ command executed successful.
4

1 回答 1

2

您可以查看https://helgeklein.com/blog/2011/08/access-denied-trying-to-connect-to-administrative-shares-on-windows-7/解决方案

基本上:

不管你喜不喜欢,幸运的是,解决方案非常简单。可以通过将注册表值 LocalAccountTokenFilterPolicy 设置为 1 来禁用 UAC 远程限制:

键:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System 值:LocalAccountTokenFilterPolicy 数据:1(禁用,0 启用过滤) 类型:REG_DWORD(32 位) 重新启动后不再过滤来自远程连接的访问​​令牌. 在 Windows 8 和 Windows 10 上,甚至不再需要重新启动。

于 2019-01-03T01:39:08.600 回答