Posts

Showing posts from September, 2014

Replacing user in SharePoint site collection and sub sites using power shell script

#Reading data from XML file. [xml]$userfile = Get-Content "C:\Users\cpco_qp_farm\Desktop\UserFile.xml" foreach( $user in $userfile.Users.User) {     Write-Host $user.Name -ForegroundColor Green } $site = Get-SPSite http://SP-2010:8080/sites/teamsite $WebCollection = $site.AllWebs foreach($Web in $WebCollection) { write-host "Site URL: " $Web.url $Web.name "users:" -foregroundcolor yellow foreach ($userw in $Web.users) { if ($userw.displayname -like "A.Organisation") { write-host "User Name: " $userw.displayname  -foregroundcolor white $Web.SiteUsers.Remove($userw) write-host "User Name: " $userw.displayname   " removed from Web" -foregroundcolor red }     } foreach ($group in $Web.Groups) { Write-host "Group Name: " $group.name: -foregroundcolor green foreach ($user in $group.users) { if ($user.displayname -like "A.Organisation") {  ...

Get data from unattached content database in SharePoint 2010

Use Windows Power Shell to recover content from an unattached content database in SharePoint You can recover content from an unattached content database by using Windows PowerShell. To recover content from an unattached content database by using Windows PowerShell Verify that you meet the following minimum requirements: See Add-SPShellAdmin . On the Start menu, click All Programs . Click Microsoft SharePoint 2010 Products . Click SharePoint 2010 Management Shell . At the Windows PowerShell command prompt, type the following command: Copy Get-SPContentDatabase -ConnectAsUnattachedDatabase -DatabaseName <DatabaseName> -DatabaseServer <DatabaseServer> Use Central Administration to recover content from an unattached content database in SharePoint You can recover content from an unattached content database by using Central Administration. To recover content from an unattached content database by using Central Admi...