Menu

ZMContext

How to use PowerShell to get the ZaphodsMap Context

If you want to have one PS1 script that acts differently depending on which machine it
is running on, and you use ZaphodsMap, then you can load
the default "context" into a string which you subsequently use for conditional processing.

Loading the default context is done like this:

$ZMContext=&($env:ZaphodsMap + 'ZMLookup.exe') /DefaultContext 2>&1
echo ("ZMContext is " + $ZMContext)

Example usage for conditional processing:

    if ($ZMContext -eq 'PRODUCTION')    { Set-Location "D:\Path1\Path2\WebHubDemos" }
    if ($ZMContext -eq 'DEVEL')         { Set-Location "D:\Projects\WebHubDemos" }

MongoDB Logo MongoDB