Today I ran some adware removal tool on my SharePoint development server and after that I was not able to access SharePoint site from Server. But the SharePoint Sites worked fine when I accessed it from other computers.
I was able to access sharepoint server sp2013 only from .\Administrator account but non from other accounts.. I did some searching and tried all things but the following script I found might help any one.
The following powershell script basically changes the registry , host file and other places , You just need to run the script and restart the computer.
#Make backup copy of the Hosts file with today's date
$hostsfile = 'C:\Windows\System32\drivers\etc\hosts'
$date = Get-Date -UFormat "%y%m%d%H%M%S"
$filecopy = $hostsfile + '.' + $date + '.copy'
Copy-Item $hostsfile -Destination $filecopy
# Get a list of the AAMs and weed out the duplicates
$hosts = Get-SPAlternateURL | ForEach-Object {$_.incomingurl.replace("https://","").replace("http://","")} | where-Object { $_.tostring() -notlike "*:*" } | Select-Object -Unique
# Get the contents of the Hosts file
$file = Get-Content $hostsfile
$file = $file | Out-String
# write the AAMs to the hosts file, unless they already exist.
$hosts | ForEach-Object { if ($file.contains($_))
{Write-Host "Entry for $_ already exists. Skipping"} else
{Write-host "Adding entry for $_" ; add-content -path $hostsfile -value "127.0.0.1 `t $_ " }}
# Disable the loopback check, since everything we just did will fail if it's enabled
New-ItemProperty HKLM:\System\CurrentControlSet\Control\Lsa -Name "DisableLoopbackCheck" -Value "1" -PropertyType dword
SharePoint Restore-SPSite Error
Sunday, 19 April 2015
Wednesday, 15 April 2015
SharePoint Restore-SPSite alternative
Today I wanted to move the site collection to a new site
collection with new URL in same web application. I got error the following errors
Restore-SPSite : The operation that you are attempting to
perform cannot be completed successfully.
No content databases in the web application were available to store
your site collection.
The existing content databases may have reached the maximum number of
site collections, or be set to read-only, or be offline, or may already
contain a copy of this site collection. Create another content database for the Web
application and then try the operation again.
At line:3 char:1
+ Restore-SPSite http://careerscentral.cag.local/departments/test1/
-Path E:\Backu ...
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
CategoryInfo : InvalidData:
(Microsoft.Share...dletRestoreSite:SPCmdletRestoreSite) [Restore-SPSite],
InvalidOperationException
+
FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletRestoreSite
Reason: The old site collection is a publishing site
collection and GUID is in conflict in the Content Database.
Workaround : used the following stsadm command instead of
powershell it worked !!!
Other thing is you need to check if you have corrupt or orphan features, Use feature removal tool to clean the site collection prior to copying.
Other thing is you need to check if you have corrupt or orphan features, Use feature removal tool to clean the site collection prior to copying.
Following commands fixed my problem.
Export publishing
site first:
stsadm -o export
-url http://oldsite -filename
oldsite.cmp
Create a new site at
the target location
Now import the site
over the top of the blank site:
stsadm -o import -url
http://newsite -filename oldsite.cmp
..\3 days later I resolved my issue, it was related to Corrupt feature. In sharepoint 2013 we now have a new PowerShell commond to directly copy from site collection to other site collection as follows.
Copy-SPSite -Identity http://oldsite -Destination database db -TargetUrl -http://newsite
This should fix all kinds of problem.
And moves the site collection from old site to new site in same web application.
Subscribe to:
Comments
(
Atom
)