diff --git a/Get-ProjectFolders.ps1 b/Get-ProjectFolders.ps1 index 6339df1..e14c01b 100644 --- a/Get-ProjectFolders.ps1 +++ b/Get-ProjectFolders.ps1 @@ -100,10 +100,10 @@ $OfficeList | ForEach-Object -parallel { # Write-Progress @CurentLoopProgress } elseif ($result.Length -ge 5) { - - $projectnumber = $result + $Server = $_.FullName.Substring(1, 4) -replace (':|\\', '') + $projectnumber = $result.tostring() $DBConnect = New-SqliteConnection -DataSource $PathToDB_Copy - $Query = "Select Project FROM FolderData where Project = '$ProjectNumber'" + $Query = "Select Project FROM FolderData where Project = '$ProjectNumber' AND Server = '$Server';" $sql_result = Invoke-SqliteQuery -DataSource $PathToDB_Copy -Query $Query if (($sql_result.project -eq $null)) { @@ -131,7 +131,7 @@ $OfficeList | ForEach-Object -parallel { else { $out = [PSCustomObject]@{ - Server = $_.FullName.Substring(1, 4) -replace (':|\\', '') + Server = $Server Project = $ProjectNumber.ToString() Parent = $folder_Parent Path = $_.FullName @@ -230,5 +230,5 @@ if ($EgnyteExport) { $DBConnect.Close() - +Write-Progress @ServerProgress -completed