在sharepoint命令行管理程序中找不到sharepoint服务器
我试图在sharepoint列表中输入一些数据,但shell无法识别sharepoint应用程序的url,尽管当我执行Get-SPWebApplication |选择Display Name,url时,我能够看到我输入的实例。 这就是我得到的错误: 这是我试图执行的脚本:在sharepoint命令行管理程序中找不到sharepoint服务器,sharepoint,powershell,sharepoint-2010,windows-server-2008,powershell-2.0,Sharepoint,Powershell,Sharepoint 2010,Windows Server 2008,Powershell 2.0,我试图在sharepoint列表中输入一些数据,但shell无法识别sharepoint应用程序的url,尽管当我执行Get-SPWebApplication |选择Display Name,url时,我能够看到我输入的实例。 这就是我得到的错误: 这是我试图执行的脚本: #-------------------------------------------------------------------- # Name: Load CSV into SharePoint List #
#--------------------------------------------------------------------
# Name: Load CSV into SharePoint List
# NOTE: No warranty is expressed or implied by this code – use it at your
# own risk. If it doesn't work or breaks anything you are on your own
#--------------------------------------------------------------------
# Setup the correct modules for SharePoint Manipulation
if ( (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null )
{
Add-PsSnapin Microsoft.SharePoint.PowerShell
}
$host.Runspace.ThreadOptions = "ReuseThread"
#Open SharePoint List
$SPServer=http://win-pdp84ekkhr7/
$SPAppList="/Lists/Application List/"
$spWeb = Get-SPWeb $SPServer
$spData = $spWeb.GetList($SPAppList)
$InvFile="test.csv"
# Get Data from Inventory CSV File
$FileExists = (Test-Path $InvFile -PathType Leaf)
if ($FileExists) {
"Loading $InvFile for processing..."
$tblData = Import-CSV $InvFile
} else {
"$InvFile not found - stopping import!"
exit
}
# Loop through Applications add each one to SharePoint
"Uploading data to SharePoint...."
foreach ($row in $tblData)
{
"Adding entry for "+$row."Application Name".ToString()
$spItem = $spData.AddItem()
$spItem["Application Name"] = $row."Application Name".ToString()
$spItem["Application Vendor"] = $row."Application Vendor".ToString()
$spItem["Application Version"] = $row."Application Version".ToString()
$spItem["Install Count"] = $row."Install Count".ToString()
$spItem.Update()
}
"---------------"
"Upload Complete"
$spWeb.Dispose()
我不知道我是否需要配置一些权限,每个建议都会更受欢迎。
谢谢,Laziale您需要将url用双引号括起来,以便PowerShell将其视为字符串而不是命令
$SPServer= "http://win-pdp84ekkhr7/"
改变这一点,看看会发生什么:$SPServer=”“基本上把url用双引号括起来。这对我很有帮助,如果你能将其作为答案发布,我会将其标记为正确答案。谢谢