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