Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

As per recommendations of Max I am opening a new thread.

The previous problem i had was to compare the integrity of data between sharepoint 2007 and sharepoint 2010. I have decided to go with the Powershell solution, i am retrieving (or trying to) the uniqueids and filenames for the files of the 2007 server and doing the same thing for the 2010 server (working) and then comparing them with an excel list to filter out the missing files to manually reupload them (I will write a tool/script in the near future to automate this.

The problem is the following: The 2010 script works flawlessly:

{
       $module = Import-Module $Module.Name -PassThru
}
Write-Host "Get registered PSSnapins."
    $pssnapins = Get-PSSnapin -Registered
if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) {
    Add-PSSnapin "Microsoft.SharePoint.PowerShell"
}
$sourceServer = "http://nameorip"
$sourceLibList = "listorlibname"
$spSourceWeb = Get-SPWeb $sourceServer
$spSourceList = $spSourceWeb.Lists[$sourceLibList]
$spSourceItems = $spSourceList.GetItems()

Write-Host "[ID];[Title];[UniqueId];[OldItemId]"
$ListItemCollection = @()
$spSourceItems | ForEach-Object {
$ExportItem = New-Object PSObject
$ExportItem | Add-Member -MemberType NoteProperty -name "ID" -value $_["ID"]
$ExportItem | Add-Member -MemberType NoteProperty -Name "Title" -value $_["Title"]
$ExportItem | Add-Member -MemberType NoteProperty -name "UniqueId" -value $_["UniqueId"]
$ExportItem | Add-Member -MemberType NoteProperty -name "OldItemId" -value $_["OldItemId"]  
$ListItemCollection += $ExportItem
}
$ListItemCollection | Export-CSV -NoTypeInformation -delimiter '|' -path D:\temp\Extract2010.csv

Now this script as i said works flawlessly and i am able to retrieve the currend UniqueID aswell as the "OldItemId" which was the Id before the migration occured on the 2007 servers.

The script for the 2007 servers on the other hand is having hiccups.

[Reflection.Assembly]::LoadWithPartialName("Microsoft.Sharepoint")
$site = New-Object Microsoft.SharePoint.SPSite("http://2007name")
$web = $site.OpenWeb()
$sourceLibList = "doclistname"
$sourceLib = $web.Lists[$sourceLibList]
$spSourceItems = $sourceLib.GetItems()

$spSourceItems | ForEach-Object {
$ExportItem = New-Object PSObject
$ExportItem | Add-Member -MemberType NoteProperty -name "ID" -value $_["ID"]
$ExportItem | Add-Member -MemberType NoteProperty -Name "Title" -value $_["Title"]
$ExportItem | Add-Member -MemberType NoteProperty -name "UniqueId" -value $_["UniqueId"]
$ExportItem | Add-Member -MemberType NoteProperty -name "OldItemId" -value $_["OldItemId"]

$ListItemCollection += $ExportItem
}
$ListItemCollection | Export-CSV -NoTypeInformation -delimiter '|' -path D:\temp\Extract2007test1234.csv 

The error I am receiving for the 2007 server is:

New-Object : Exception calling ".ctor" with "1" argument(s): "The Web application at http://domainname could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application."

This is problematic obviously, I have googled and searched but sofar the only viable reason i was able to find was: http://robertcgale.com/2013/01/11/wmf3-0-breaks-sharepoint-2007-powershell/

I have verified that the hotfix is indeed installed, the only issue though remains that we will not be able to remove this hotfix due to a plethora of reasons. If anybody has a solution or an alternative method to retrieve the UniqueIDs for the entire files inside a document library inside sharepoint 2007 then i would greatly appreciate it.

In case you are wondering why I am using an array method, unfortunately using select-object will work for most fields except for the OldItemId which is saved as a string, and i have tried 50 different rewrite methods and approaches, this seems to be the only one that works. Irregardless of this I would like to understand if anybody has had experience with this problem and was able to resolve it with powershell, or if I am stuck writing a CAML Query and retrieving the files UniqueIDs and names that way. If no alternative or viable powershell solutions are available then I would appreciate if anybody could inform me of already existing/available code for my current predicament.

P.S: I have already received comments regarding the fact that the migration is not running flawlessly and that the methodology and means should be improved and revisited since it is literally 90% of the item integrity problems that are being caused. Unfortunately the migration tool that has been written is not my doing and within the next two months i do not see myself rewriting it entirely. Even so the issue stands that there are a bit more than 80 servers that need to be migrated and even though the servers should be identical, there is a multitude of problems/factors which are causing the issue, so right now (from a time perspective this is my only viable option and quite frankly the only thing I can do)

I appreciate any and all comments. Thank you for your time.

EDIT: Small update, I have verified that the patch exists on at least one maschine that has 2010 running, but thats not the issue, the issue is i cannot find the Hotfix/Patch on the 2007 maschines. Since Get-Hotfix is not an option i checked systeminfo inside the command prompt and inside the registry editor.. i can see which ones are installed but the patch that is supposed to cause problems isnt in there. So yeah.. time to explore other potential issues. Will update if i find something.

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.