PowerShell远程处理 - 无法访问本地服务器场 [英] PowerShell Remoting - Cannot access the local farm

查看:379
本文介绍了PowerShell远程处理 - 无法访问本地服务器场的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在尝试使用PowerShell远程会话访问我的SharePoint 2013服务器场。


但它赢了"工作。


这是我到目前为止尝试/完成的事情:


在服务器上我输入了这些命令以启用远程会话。

尝试{Enable-PSRemoting -Confirm:$ false} catch {$ Error} 
Set-Item WSMan:\\ \\ localhost \Client \ TrustedHosts" RemoteComputer" -Force
Set-Item WSMan:\ localhost \Shell \MaxMemoryPerShellMB 1024
restart-Service WinRM -Confirm:$ false


在客户端,我输入此命令以访问远程服务器。

 PS E:\ PowerShell-PowerUp> $ Session = New-PSSession -ComputerName spserver 
-Credential(Get-Credential)

cmdlet命令管道位置的Get-Credential 1
以下参数的供应值:
Credential
PS E:\ PowerShell-PowerUp>输入-PSSession $ Session
[spserver]:PS C:\Users\SP1_Admin \Documents> Add-PSSnapin Microsoft.ShareP
oint.PowerShell
[spserver]:PS C:\Users\SP1_Admin \Documents> Get-SPFarm
无法访问本地服务器场。验证本地服务器场是否正确配置了
,当前是否可用,以及您是否具有相应的权限
以便在再次尝试之前访问数据库。
+ CategoryInfo:InvalidData:(Microsoft.Share ... SpCmdletGetFarm:
SpCmdletGetFarm)[Get-SPFarm],SPCmdletException
+ FullyQualifiedErrorId:Microsoft.SharePoint.PowerShell.SpCmdletGetFarmAn

另外我可以提供以下信息:



  • 用户是psshell admin,是本地管理员,并且拥有足够的权限sharepoint。
  • 这在SharePoint 2010之前运行良好我已经更新到SharePoint 2013

我感谢各种帮助,一个很好的提示,提示甚至是正确的解决方案。


亲切的问候


Janik

解决方案

< blockquote>

您需要在invoke-Command脚本块中运行命令。请参阅此处获取完整指南:


http://blogs.msdn.com/b/varun_malhotra/archive/2010/06/10/configure-power-shell-for-remote-use- of-sp-2010.aspx


您的情况的解决方案从' 存储和使用脚本编制凭据


Hi,

I'm trying the access my SharePoint 2013 farm with a PowerShell Remote Session.

But it won't work.

Here's what I've tried/done so far:

On the server I've entered theses commands to enable remote sessions.

try{Enable-PSRemoting -Confirm:$false}catch{$Error}
Set-Item WSMan:\localhost\Client\TrustedHosts "RemoteComputer" -Force
Set-Item WSMan:\localhost\Shell\MaxMemoryPerShellMB 1024
restart-Service WinRM -Confirm:$false

On the client I enter this commands to access the remote server.

PS E:\PowerShell-PowerUp> $Session = New-PSSession -ComputerName spserver
-Credential (Get-Credential)

cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters:
Credential
PS E:\PowerShell-PowerUp> Enter-PSSession $Session
[spserver]: PS C:\Users\SP1_Admin\Documents> Add-PSSnapin Microsoft.ShareP
oint.PowerShell
[spserver]: PS C:\Users\SP1_Admin\Documents> Get-SPFarm
Cannot access the local farm. Verify that the local farm is properly
configured, currently available, and that you have the appropriate permissions
to access the database before trying again.
    + CategoryInfo          : InvalidData: (Microsoft.Share...SpCmdletGetFarm:
   SpCmdletGetFarm) [Get-SPFarm], SPCmdletException
    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SpCmdletGetFarmAn

In addtion I can give these informations:

  • The user is psshell admin, is local administrator and has enough privilegs on the sharepoint.
  • This worked well before on SharePoint 2010 I've updates to SharePoint 2013

I appreciate every kind of help, a good tip, hint or even the right solution.

kind regards

Janik

解决方案

You need to run the commands in an invoke-Command script block. See here for a full guide:

http://blogs.msdn.com/b/varun_malhotra/archive/2010/06/10/configure-power-shell-for-remote-use-of-sp-2010.aspx

The solution for your situation starts at 'Store and use credentials for scripting'


这篇关于PowerShell远程处理 - 无法访问本地服务器场的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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