Hi.
I am trying to export the SharePoint list data to CSV by following this link :
https://www.sharepointdiary.com/2013/04/export-sharepoint-list-items-to-csv-using-powershell.html
I am following the last example given. i am trying the code as :
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
Variables
$SiteUrl="sharepoint site"
$ListName="list name"
$OutPutFile = "C:\path\ListData.csv"
Delete the Output File if exists
If (Test-Path $OutPutFile) { Remove-Item $OutPutFile }
Get Web and List Objects
$Web = Get-SPWeb $SiteUrl
$List = $Web.Lists[$ListName]
Write-host "Total Number of Items Found:"$List.Itemcount
I am getting error while running in powershell as Get-SPWeb : The term 'Get-SPWeb' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.
How to fix this ?
Thanks
Update 1: I have tried this :
PS C:\WINDOWS\system32> Install-Module -Name Microsoft.Online.SharePoint.PowerShell
PS C:\WINDOWS\system32>
Add-PSSnapin Microsoft.SharePoint.PowerShell
Add-PSSnapin : The Windows PowerShell snap-in 'Microsoft.SharePoint.PowerShell' is not installed on this computer.
At line:2 char:1
+ Add-PSSnapin Microsoft.SharePoint.PowerShell
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (Microsoft.SharePoint.PowerShell:String) [Add-PSSnapin], PSArgumentException
+ FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand
I do not see a folder named Microsoft.SharePoint.Powershell in the C:\Windows\Microsoft.NET\assembly\GAC_MSIL path.
Can powershell be run from client machine, where sharepoint is not installed ?


