remove duplicate project SQL

This commit is contained in:
Erik Eckert 2023-10-02 16:20:36 -06:00
parent f507c76740
commit 65dac21d09

View File

@ -203,61 +203,61 @@ Invoke-SqliteQuery -DataSource $PathToDB -Query $Query
## Kick off GenTables ## Kick off GenTables
$SQLFile_to_Run = $PSScriptRoot + '\GenTables.sql' # $SQLFile_to_Run = $PSScriptRoot + '\GenTables.sql'
Invoke-SqliteQuery -DataSource $PathToDB -InputFile $SQLFile_to_Run # Invoke-SqliteQuery -DataSource $PathToDB -InputFile $SQLFile_to_Run
$SQLFile_to_Run = $PSScriptRoot + '\DuplicatePairing.sql' # $SQLFile_to_Run = $PSScriptRoot + '\DuplicatePairing.sql'
Invoke-SqliteQuery -DataSource $PathToDB -InputFile $SQLFile_to_Run # Invoke-SqliteQuery -DataSource $PathToDB -InputFile $SQLFile_to_Run
$DBConnect = New-SqliteConnection -DataSource $PathToDB $DBConnect = New-SqliteConnection -DataSource $PathToDB
foreach ($office in $OfficeList) { # foreach ($office in $OfficeList) {
$OfficeServer = $office.Name # $OfficeServer = $office.Name
$Query = "select * from OfficeDuplicates where Server = '$OfficeServer';" # $Query = "select * from OfficeDuplicates where Server = '$OfficeServer';"
$sql_result = Invoke-SqliteQuery -DataSource $PathToDB -Query $Query # $sql_result = Invoke-SqliteQuery -DataSource $PathToDB -Query $Query
if ($sql_result) { # if ($sql_result) {
$OutFile = $OutputFolder + "\$OfficeServer Duplicates.xlsx" # $OutFile = $OutputFolder + "\$OfficeServer Duplicates.xlsx"
Remove-Item -Path $OutFile -Force # Remove-Item -Path $OutFile -Force
$sql_result | Export-Excel -Path $OutFile -AutoFilter # $sql_result | Export-Excel -Path $OutFile -AutoFilter
} # }
} # }
# Generate MPE All Xlsx # Generate MPE All Xlsx
$Query = "select * from OfficeDuplicates;" # $Query = "select * from OfficeDuplicates;"
$sql_result = Invoke-SqliteQuery -DataSource $PathToDB -Query $Query # $sql_result = Invoke-SqliteQuery -DataSource $PathToDB -Query $Query
if ($sql_result) { # if ($sql_result) {
$OutFile = $OutputFolder + "\MPE All Duplicates.xlsx" # $OutFile = $OutputFolder + "\MPE All Duplicates.xlsx"
Remove-Item -Path $OutFile -Force # Remove-Item -Path $OutFile -Force
$sql_result | Export-Excel -Path $OutFile -AutoFilter # $sql_result | Export-Excel -Path $OutFile -AutoFilter
} # }
# Generate Parent Non-Duplicates # Generate Parent Non-Duplicates
$Query = "select * from NonDupParent;" # $Query = "select * from NonDupParent;"
$sql_result = Invoke-SqliteQuery -DataSource $PathToDB -Query $Query # $sql_result = Invoke-SqliteQuery -DataSource $PathToDB -Query $Query
if ($sql_result) { # if ($sql_result) {
$OutFile = $OutputFolder + "\MPE Non-Duplicates - Parent Folders.xlsx" # $OutFile = $OutputFolder + "\MPE Non-Duplicates - Parent Folders.xlsx"
Remove-Item -Path $OutFile -Force # Remove-Item -Path $OutFile -Force
$sql_result | Export-Excel -Path $OutFile -AutoFilter # $sql_result | Export-Excel -Path $OutFile -AutoFilter
} # }
# Generate Project Non-Duplicates # # Generate Project Non-Duplicates
$Query = "select * from NonDupProject where Path NOT IN (select Path from NonDupParent);" # $Query = "select * from NonDupProject where Path NOT IN (select Path from NonDupParent);"
$sql_result = Invoke-SqliteQuery -DataSource $PathToDB -Query $Query # $sql_result = Invoke-SqliteQuery -DataSource $PathToDB -Query $Query
if ($sql_result) { # if ($sql_result) {
$OutFile = $OutputFolder + "\MPE Non-Duplicates - Project Folders.xlsx" # $OutFile = $OutputFolder + "\MPE Non-Duplicates - Project Folders.xlsx"
Remove-Item -Path $OutFile -Force # Remove-Item -Path $OutFile -Force
$sql_result | Export-Excel -Path $OutFile -AutoFilter # $sql_result | Export-Excel -Path $OutFile -AutoFilter
} # }
## Generate Egnyte Data Inventory Sheet ## Generate Egnyte Data Inventory Sheet