Why certain PowerShell Snapins do not load properly in Drop Downs and WebServices

Problem

The Appsetting differs between ClientWebService Calls and "Standard" PowerShell calls.

This may cause problems if you try to run Commands that depend on PowerShell Snap-ins such as SharePoint or FIM.

Solution

  • The Config FilePath used by ZP:
    C:\Program Files\Zipper\ZervicePoint\ProcessSystem\Zipper.ZervicePoint.ProcessSystem.WorkflowService.exe.config

    Config FilePath used by "Standard" powershell:
    C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe.cofig

  • A workaround is to run the code as a background job:

FIM Example

$result = Start-Job -ScriptBlock {
    param (
        [string]$search
    )
    # Import FIM Module
    # perform search

} | Wait-Job | Receive-Job

# return result to dropdown or webservice
$result