I'm currently doing a script in powershell to add some items to a SharePoint list and add some columns to the same list, but by doing the following:
param([Parameter(Mandatory=$true)][string] $urlSite, [Parameter(Mandatory=$true)][string] $urlList)
if((Get-PSSnapin "Microsoft.SharePoint.PowerShell") -eq $null)
{
Add-PSSnapin Microsoft.SharePoint.PowerShell
}
Write-Host "Url del Sitio" $urlSite -foregroundcolor yellow
[Microsoft.SharePoint.SPSecurity]::RunWithElevatedPrivileges(
{
#Aquí algo lo que se requiere hacer....
}
)
I get the following Error:
Get-PSSnapin: No Windows PowerShell snap-ins matching the pattern 'Microsoft.SharePoint.PowerShell' were found. Check the pattern and then try the command again.
It's like you can not load the assembly Microsoft.SharePoint.PowerShell
Am I doing something wrong?