2016-06-23 99 views
1

我有一个Hyper-V的虚拟机与流浪1.8.4构建,我试图用“流浪者的PowerShell”命令启动在虚拟机上配置(使用puppet)的脚本。一些目录很容易被访问,比如C:\ users \ vagrant。我完全控制了这个文件夹和所有后续的目录。每当我尝试启动脚本,甚至使用'dir'命令访问某些文件夹时,我都会收到一个错误,指出“权限被拒绝”。流浪PowerShell的问题带有Hyper-V虚拟机(流浪者版本1.8.4)*权限被拒绝*

下面是一个简单的“流浪汉的PowerShell -c‘C:\供应\壳’”的输出命令:

vagrant : The following WinRM command responded with a non-zero exit status. 
    + CategoryInfo   : NotSpecified: (The following W...ro exit status.:String) [], RemoteException 
    + FullyQualifiedErrorId : NativeCommandError 

Vagrant assumes that this means the command failed! 
dir 'C:\provision\shell' 
Stdout from the command: 
Stderr from the command: 
#< CLIXML 
<Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><S S="Error">dir : Access to the 
path 'C:\provision\shell' is denied._x000D__x000A_</S><S S="Error">At line:1 char:40_x000D__x000A_</S><S 
S="Error">+ $ProgressPreference='SilentlyContinue';dir 'C:\provision\shell'_x000D__x000A_</S><S S="Error">+   
           ~~~~~~~~~~~~~~~~~~~~~~~~_x000D__x000A_</S><S S="Error"> + CategoryInfo   : 
PermissionDenied: (C:\provision\shell:String) [Get-ChildItem], UnauthorizedAccessExcepti _x000D__x000A_</S><S 
S="Error"> on_x000D__x000A_</S><S S="Error"> + FullyQualifiedErrorId : 
DirUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetChildItemCommand_x000D__x000A_</S><S S="Error"> 
_x000D__x000A_</S></Objs> 

如果有人可以帮助我弄清楚为什么我收到这些拒绝“权限”错误,这将是伟大的!

任何援助将不胜感激。

+0

嗯,我永远找不到一个原因,为什么我无法远程访问共享文件夹...我**是**但是能够提供一个脚本,将共享文件夹的内容复制到我有一个目录访问。有点丑陋和不雅,但它有效 –

回答

0

与这一个问题是,我尝试使用“流浪者的PowerShell”,而在一个远程的PSSession连接到虚拟机。 Windows没有通过我的凭证,因为我已远程登录并尝试将SMB文件夹存取回到VM主机,这不是我的本地计算机。 SMB共享文件夹是一个'符号链接',这是发生跳闸的地方。如果我拥有委托令牌(例如使用CredSSP),则可能已授予访问权限。

正如我的评论所述,我能够通过配置的PowerShell脚本复制共享文件夹的内容。丑陋,但工作。

感谢codekaizen帮助我制定了一个响应(信贷的信用到期)。