Add users to SharePoint using PowerShell
Add-PSSnapin "Microsoft.Sharepoint.PowerShell" $web = Get-SPWeb "https://Marketing" $userObject = $web.EnsureUser("ABC\a.b") $group = $web.SiteGroups $group.AddUser($userObject)
Add-PSSnapin "Microsoft.Sharepoint.PowerShell" $web = Get-SPWeb "https://Marketing" $userObject = $web.EnsureUser("ABC\a.b") $group = $web.SiteGroups $group.AddUser($userObject)
::LoadWithPartialName("Microsoft.SharePoint") #For MOSS 2007 compatibility Function global:Get-SPWeb($url) { $site= New-Object Microsoft.SharePoint.SPSite($url) if($site -ne $null) { $web=$site.OpenWeb() } return $web } #Site URL and List Name variables $WebURL = "https://SharePoint" $LibraryName…