diff --git a/Get-ProjectFolders.ps1 b/Get-ProjectFolders.ps1 index b5c01c7..83d6207 100644 --- a/Get-ProjectFolders.ps1 +++ b/Get-ProjectFolders.ps1 @@ -22,7 +22,8 @@ param ( #refresh all data - causes the DB to be wiped clean and all file folders to be re-analyzed. - +$Path_To_Working_copy = "M:\00 - Egnyte PS Data Inventory\Output\MPE Data Inventory - Working.xlsx" +$PAth_To_Migration_Status = "M:\00 - Egnyte PS Data Inventory\Migration_status\Migration_Health_stat_MPE.xlsx" $PathToDB = "M:\IT\Egnyte\DuplicateFiles\WorkingRun\Dedupe.SQLite" $OutputFolder = "M:\IT\Egnyte\DuplicateFiles\WorkingRun\Output" $BaseDrive = 'X:\' @@ -101,7 +102,7 @@ $OfficeList | ForEach-Object -parallel { } elseif ($result.Length -ge 5) { $Server = $_.FullName.Substring(1, 4) -replace (':|\\', '') - $Path = $_.FullName.Replace("'", "''") #SQL Formatted Path + $Path = $_.FullName.Replace("'", "`'") #SQL Formatted Path $projectnumber = $result.tostring() $DBConnect = New-SqliteConnection -DataSource $PathToDB_Copy $Query = "Select Project FROM FolderData where Project = '$ProjectNumber' AND Server = '$Server' AND Path = '$Path';" @@ -119,7 +120,7 @@ $OfficeList | ForEach-Object -parallel { $result3 = [Regex]::Matches($_.FullName, "^(.*[\\\/])") # This gets everything up the last slash, thus the "parent" $FolderPath_Data = Get-ChildItem -Path $_.FullName -File -Depth 50 -Recurse - $folder_Parent = $result3.value.replace("'", "''") #SQL Formatting + $folder_Parent = $result3.value.replace("'", "`'") #SQL Formatting $folder_FileSize = ($FolderPath_Data | Measure -sum Length).sum / 1024 / 1024 / 1024 $folder_FileCount = ($FolderPath_Data | measure).Count $folder_LastWrite = ($FolderPath_Data | measure LastWriteTime -Maximum).Maximum @@ -140,6 +141,7 @@ $OfficeList | ForEach-Object -parallel { FileSize = $folder_FileSize FileLastWrite = $folder_LastWrite FileLastAccess = $folder_LastAccess + Status = $null # added to support Migration Status } | Out-DataTable Invoke-SQLiteBulkCopy -DataSource $PathToDB_Copy -Table "FolderData" -DataTable $out -Force @@ -161,6 +163,19 @@ $ServerProgress = @{ } Write-Progress @ServerProgress +<# +TODO Grab data from Egnyte Working Copy to re-incorporate into our DB. This will allow us to mark data as "in progress", and thus filter it out from future data inventory updates. +TODO Need to update Working Copy sheet to contain Project Number and Server for unique keys, and add antoher column for Egnyte Friendly Server Names to match the Migration Server names. +IE, +server,path,path2,etc,status,OriginalServer=RD,OriginalProject=ProjectNumber + + +#> + +$MigrationStatus_import = Import-Excel -Path $PAth_To_Migration_Status -WorksheetName "MPE Migration Tracker" -StartRow 2 | Out-DataTable +Invoke-SQLiteBulkCopy -DataSource $PathToDB -Table "MigrationStatus" -DataTable $MigrationStatus_import -Force -ConflictClause Replace + + ## Kick off GenTables