autmate egnte inventory sheet
This commit is contained in:
parent
2234bd9bce
commit
f42a5cd079
22
Generate Egnyte Export.sql
Normal file
22
Generate Egnyte Export.sql
Normal 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;
|
@ -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()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user