Hello,
We have a client requirement to collect a very large folders structure`s PGP Netshare data however the Symantec command line utility does not support recurelively listening directory structures. It will only do one folder at a time which is a HUGE time contraint. I have automated other command line utilities just fine however every method I try with PGP simply will not work.
How would Symantec suggest we get this data out on a huge folder tructure? below is the last revision of the PowerShell script. The same method works fine with Robocopy for instance why not with PGP?
function Get-PGPNetShare
{
Begin{#Test if the source CMD resides on x86 or x64
if (Test-Path -Path 'c:\program files\pgp corporation\pgp desktop\'){
$SourceCMDPath = 'c:\program files\pgp corporation\pgp desktop\pgpnetshare.exe'
}
else{$SourceCMDPath = 'c:\program files (x86)\pgp corporation\pgp desktop\pgpnetshare.exe'
}
$TargetFolder = Read-Host "Enter a folder path to scan"
$TargetOutput = Read-Host "Write output to: Example c:\temp\Output.txt?"
$ArgOutput = " --output-file $TargetOutput"
}
Process{$i = 10 #Used for Console % complete
#Mainloop - Collect and parse skipping empty directories (This might take a while and consume
#loads of memory on massive directory structures. Watch Powershell.exe memory useage.
$FullExPath = Get-ChildItem $TargetFolder -Recurse | ?{ $_.PSIsContainer } | Select-Object FullName
# Abandoned since PGP does not parse against files # Get-ChildItem $TargetFolder -Recurse | % {if($_.Parent.FullName -eq $null){$_.FullName}}
# Abandoned as well - $FullExPath = get-childitem "c:\temp\temp\" -recurse | where {$_.Attributes -eq 'Directory'}
foreach ($Item in $FullExPath){
#Join files + Arguments to be parsed
$PGPArgs = " -–list $Item $ArgOutput"
try {
Write-host -ForegroundColor Yellow -BackgroundColor Black "Parsing ---> $Item"
#Execute to PGP
Start-Process -FilePath $SourceCMDPath -ArgumentList "$PGPArgs"
#& $SourceCMDPath $PGPArgs
}
catch{
Write-host -ForegroundColor Red -BackgroundColor Black "Something went wrong with the Symantec parsed command for ---> $Item"
}
try{#Capture PGP output if it overwrites and use PowerShell to appent to a secondary log within the same path calld : PowerShell-Output.txt
Write-host -ForegroundColor Yellow -BackgroundColor Black "Parsing ---> $Item"
$PoSHOut = Start-Process -FilePath $SourceCMDPath -ArgumentList "$PGPArgs"
$PoshTarget = Get-Item $TargetOutput
$PoSHOut | Out-File ($PoshTarget.Directory.FullName + "\PowerShell-Output.txt" ) -Append
}
catch{
Write-host -ForegroundColor DarkRed -BackgroundColor Black "Something went wrong with the Powershell Output ---> ---> $Item"
}
$i++
Write-Progress -activity "Processing: $TargetFolder" -status "Scanned: $i of $($FullExPath.count)" -percentComplete (($i / $FullExPath.count) * 100)
}
}
End{Write-host -ForegroundColor Green -BackgroundColor Black "Script completed please check $TargetOutput"}
}
Get-PGPNetShare