There was a requirement in automating the export and download of the WDE computers & their status report from a Symantec Encryption Server. The generating of the report is fairly straightforward, just SSH into the server and execute your PostgreSQL query but automating it took a little bit of work…
- Understanding How to Export a list of WDE Computers and their Status & Access Symantec Encryption Management Server via SSH Using PuTTY
- Generate SSH key file using PuTTY Key Generator
- Installation of SSH PowerShell Module – Posh-SSH
#Strangely we need to provide a password even though we're using a key file!
$localCred = New-Object -typename System.Management.Automation.PSCredential -argumentlist "root", (ConvertTo-SecureString "LovePOSH" -AsPlainText -Force)
# We connect to the Symantec Drive Encryption server
New-SSHSession -ComputerName "labekms.nokitel.im" -Credential $localCred -KeyFile "C:\Scripts\asecor\ekmsposh"
# We execute a script to export the list of computers and their status. This script resides locally on the encryption server
Invoke-SSHCommand -Index 0 -Command "./wdeexport"
# We then download the exported list to our desired location
Get-SCPFile -ComputerName "labekms.nokitel.im" -Credential $localCred -KeyFile "C:\Scripts\asecor\ekmsposh" -RemoteFile "wde_computers.csv" -LocalFile "\\labfs.nokitel.im\reports\wde_computers.csv"
I then saved the above as a .ps1 and scheduled it in Task Scheduler.