I often need to fetch the ID or Name of a layer (file) without having the SWV agent installed so instead of open up the compressed VSA/XPF/VPA and reading the info from the file(s) I created this powershell script to show the information and hope you will have use for it as I have.
- DotNetZip Library (download from http://dotnetzip.codeplex.com)
The Ionic.Zip.dll file needs to be in the same folder as the powershell script and is used to open the compressed VSA, XPF or VPA file and to enumerate the files until we find the file(s) containing the information we want.
- PowerShell Script Execution Policy
The script is not signed so the execution policy therefore needs to be set to unrestricted. If not it will "bomb out" with the error message "SWV_LayerInfo.ps1 cannot be loaded because the execution of scripts is disabled on this system."
To set the policy to unrestricted execute the below command in an elevated command prompt (cmd.exe)
powershell Set-ExecutionPolicy Unrestricted
For more information refer to Using the Set-ExecutionPolicy Cmdlet
The attached SWV_LayerInfo.zip contains two files: the powershell script (SWV_LayerInfo.ps1) and a batch file (SWV_LayerInfo.cmd) that I have a pinned shortcut to to easy execute the script from the start menu.