Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/sharepoint/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows Powershell:无法访问本地服务器场。未注册FeatureDependencyId为的cmdlet错误_Windows_Sharepoint_Powershell_Sharepoint 2010 - Fatal编程技术网

Windows Powershell:无法访问本地服务器场。未注册FeatureDependencyId为的cmdlet错误

Windows Powershell:无法访问本地服务器场。未注册FeatureDependencyId为的cmdlet错误,windows,sharepoint,powershell,sharepoint-2010,Windows,Sharepoint,Powershell,Sharepoint 2010,我正在尝试从*.cmd文件加载sharepoint脚本。 我已在Windows 7 x64和SQL server 2008r2上安装了Sharepoint 2010。 我的cmd文件是: Powershell-v2-非交互式-NoLogo-文件1.ps1 我的sharepoint文件1.ps1是: $snapin="Microsoft.SharePoint.PowerShell" if ($action -eq $null -or $action -eq '') {<br /> #

我正在尝试从*.cmd文件加载sharepoint脚本。 我已在Windows 7 x64和SQL server 2008r2上安装了Sharepoint 2010。 我的cmd文件是: Powershell-v2-非交互式-NoLogo-文件1.ps1

我的sharepoint文件1.ps1是:

$snapin="Microsoft.SharePoint.PowerShell"
if ($action -eq $null -or $action -eq '')
{<br />
# Action by default is complete uninstallation.
$action='uninstall'
$uninstall = $true
}
 else
{
$action = $action.ToLower()
    switch($action)
{
    { $_ -eq "uninstall" }           { $uninstall = $true; break }
    { $_ -eq "removesolution" }      { $removeSolution = $true; break }
    { $_ -eq "deactivatecorpus" }    { $deactivateCorpus = $true; break }
    { $_ -eq "deactivatesupport" }   { $deactivateSupport = $true; break }

    default                          { Write-Host -f Red "Error: Invalid action: $action "; Exit -1 }
}
}
Check the Sharepoint snapin availability.
if (Get-PSSnapin $snapin -ea "silentlycontinue")
{
Write-Host "PS snapin $snapin is loaded."
 }
  elseif (Get-PSSnapin $snapin -registered -ea "silentlycontinue")
 {
Write-Host "PS snapin $snapin is registered."
Add-PSSnapin $snapin
Write-Host "PS snapin $snapin is loaded."
  }
 else
  {
Write-Host -f Red "Error: PS snapin $snapin is not found."
Exit -1
 }

  $url = "http:///sites/GroupWork/"
 $site= new-Object Microsoft.SharePoint.SPSite($url )
 $loc= [System.Int32]::Parse(1033)
 $templates= $site.GetWebTemplates($loc)
 foreach ($child in $templates){    write-host $child.Name "  " $child.Title}<br />
 $site.Dispose()
从“开始”菜单启动shell后,该脚本在Sharepoint 2010命令行管理程序中运行良好,或者通过输入powershell-v 2从windows cmd启动该命令行:

PS C:\2>\1.ps1 已加载Microsoft.SharePoint.PowerShell中的PS管理单元。 全局模板 STS0队部 STS1空白站点 STS2文档工作区 MPS0基本会议工作区 MPS1空白会议工作区 MPS2决策会议工作区 MPS3社交会议工作区 MPS4多页会议工作区 CENTRALADMIN0中央管理站点 WIKI0 Wiki站点 BLOG0博客 SGS0小组工作现场 租户管理站点 {248A640A-AE86-42B7-90EC-45EC8618D6B4}MySite2 MySite2 {95629DC2-03B1-4C92-AD70-BC1FEAA49E7D}MySite1 MySite1 {7F01CFE4-F5E2-408B-AC87-E186D21F624C}新闻网站模板新闻网站模板 PS C:\2>

我可以从当前域用户和其他2个用户访问数据库Sharepoint_Config。所有用户都具有Sharepoint\u配置数据库的db\u所有者权限。 但是我已经从数据库dbo中的用户dbo加载了windows,该用户使用当前用户的domain\username进行windows身份验证。dbo用户在Sharepoint配置数据库中拥有do_所有者权限。 我尝试在其他用户下登录并启动cmd文件,但没有成功

我的PowerShell有2.0版: PS C:\2>$psversiontable 名称值 -- --- CLR版本2.0.50727.5477 构建版本6.1.7601.17514 PS2.0版 WSManStack2.0版 PSCompatibleVersions{1.0,2.0} 序列化版本1.1.0.1 PSRemotingProtocol2.1版

从1.cmd文件启动脚本后,我得到一个错误:

C:\2>Powershell-v2-NonInteractive-NoLogo-File 1.ps1 已注册Microsoft.SharePoint.PowerShell中的PS管理单元。 当地农场交通不便。FeatureDependencyId为的cmdlet不是regis 是的

无法读取文件夹CONFIG\PowerShell\Regist中的XML配置文件 定额 找不到路径“C:\2\CONFIG\PowerShell\Registration”的一部分。 没有加载xml配置文件。 无法注册核心产品cmdlet。 无法读取文件夹CONFIG\PowerShell\Types中的类型文件。 找不到路径“C:\2\CONFIG\PowerShell\types”的一部分。 找不到类型文件。 无法读取文件夹CONFIG\PowerShell\Format中的格式文件。 找不到路径“C:\2\CONFIG\PowerShell\format”的一部分。 找不到格式文件。 已加载Microsoft.SharePoint.PowerShell中的PS管理单元。 新对象:使用1个参数调用.ctor时发生异常:Web应用程序 在 找不到。验证t 您键入的URL是否正确。如果该URL应服务于现有con 系统管理员可能需要将新的请求URL映射添加到 预期用途。 在C:\2\1.ps1:48字符:18
+$site=新对象您的$url有一个输入错误:$url=http:///sites/GroupWork/I 如果没有这个技巧,就无法添加帖子-网站认为url就是链接。您应该在脚本中将url读为http://url是正确的