【发布时间】:2015-05-28 08:14:48
【问题描述】:
我有两台服务器在同一个域上运行 Windows Server 2012 R2,\tt-sql.perf.corp 和 \tt-file.perf.corp。在文件服务器的共享文件夹\tt-file.perf.corp\fileshare\helloworld.ps1 中有一个Powershell 脚本。我在执行以下命令的 sql server 上有一个应用程序:
powershell -NonInteractive -InputFormat None -ExecutionPolicy Bypass -Command "& '\tt-file.perf.corp\fileshare\helloworld.ps1'"
失败并出现以下错误:
& : AuthorizationManager 检查失败。在行:1 字符:3 + & '\tt-file.perf.corp\fileshare\helloworld.ps1' + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~ + CategoryInfo : SecurityError: (:) [], PSSecurityException + FullyQualifiedErrorId : UnauthorizedAccess
如果我更改使用IP地址的路径也会失败。
但是,当脚本的路径不完全限定时,它可以工作:
powershell -NonInteractive -InputFormat None -ExecutionPolicy Bypass -Command "& '\tt-file\fileshare\helloworld.ps1'"
Windows Management Instrumentation 服务正在两台服务器上运行。我也在两台服务器上运行了 Get-ExecutionPolicy,并且都设置为 Unrestricted。两台服务器上都禁用了 UAC。怎么回事?
【问题讨论】:
标签: powershell windows-server-2012-r2 fully-qualified-naming