autmate egnte inventory sheet

This commit is contained in:
Erik Eckert 2023-09-14 15:29:46 -06:00
parent 2234bd9bce
commit f42a5cd079
2 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,22 @@
-- Generate Non-Duplicated PARENT FOLDER List
DROP TABLE DataInventory;
CREATE TABLE DataInventory AS
SELECT SERVER,
REPLACE(Parent,"X:\","\\mpe.ca\datadrive\") AS UNCPath,
REPLACE(REPLACE(Parent,("X:\" || Server),"/Shared/N-Data"),"\","/") AS EgnytePath,
sum(FileCount), Sum(FileSize), 'Parent' as Source from FolderData
Where Parent not in (
SELECT Parent FROM DuplicateList
)
UNION
SELECT SERVER,
REPLACE(PATH,"X:\","\\mpe.ca\datadrive\") AS UNCPath,
REPLACE(REPLACE(PATH,("X:\" || Server),"/Shared/N-Data"),"\","/") AS EgnytePath,
sum(FileCount), Sum(FileSize), 'Project' as Source from FolderData
Where Project not in (
SELECT A.Project FROM NonDupProject as A)
AND Parent not in (
Select B.Parent FROM NonDupParent as B
)
group by Server
ORDER BY Server;

View File

@ -215,6 +215,19 @@ if ($sql_result) {
} }
## Generate Egnyte Data Inventory Sheet
$OutFile = $OutputFolder + "\MPE Data Inventory " + (Get-Date -Format FileDateTime).DateTime + ".xlsx"
$SQLFile_to_Run = $PSScriptRoot + '\Generate Egnyte Export.sql'
$EgnyteExport = Invoke-SqliteQuery -DataSource $PathToDB -InputFile $SQLFile_to_Run
if ($EgnyteExport) {
$OutFile = Export-Excel -Path $OutputFile -AutoFilter
}
$DBConnect.Close() $DBConnect.Close()