Error -MIM :incorrect windows powershell version 5.1 windows powershell version 2.0 is supported in current console

Debashis sahoo 1 Reputation point
2022-08-29T22:51:09.727+00:00

I am trying to run powershell script inside workflow in MIM 2016 , but getting below error .

"incorrect windows powershell version 5.1 windows powershell version 2.0 is supported in current console"
Could you please help here .

Microsoft Identity Manager
Microsoft Identity Manager
A family of Microsoft products that manage a user's digital identity using identity synchronization, certificate management, and user provisioning.
617 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Joe Zamora 96 Reputation points
    2022-09-06T18:09:12.987+00:00

    Save your original script as a PS1 file on your MIM Service servers and wrap it in Invoke-Command in the WAL workflow (example below). The tricky part of this approach is satisfying all the WinRM requirements to make this work. Hope this helps!

    [CmdletBinding()]  
    Param(  
        $Domain  
        ,$AccountName  
        ,$Email  
    )  
    Invoke-Command -ErrorAction Stop `  
        -ComputerName localhost `  
        -Credential $Credential `  
        -ArgumentList @($Domain,$AccountName,$Email) `  
        -ScriptBlock {  
        param(  
            $Domain  
            ,$AccountName  
            ,$Email  
        )  
        D:\MIM-Powershell-Live\RegisterPasswordResetUser.ps1 -Domain $Domain -AccountName $AccountName -Email $Email -Verbose  
    }   
      
    
    0 comments No comments

  2. Joe Zamora 96 Reputation points
    2022-09-06T20:31:11.087+00:00

    Update: I had some troubles with WinRM myself due to the SPN on the MIM Service and Portal server (HTTP/MIMService01). I was able to fix it by replacing "localhost" with the IPv4 address and adding that to WinRM TrustedHosts.

    Elevated Powershell terminal:

    Get-Item WSMan:\localhost\Client\TrustedHosts  
    Set-Item WSMan:\localhost\Client\TrustedHosts -Value 'MIMService01,localhost,10.xxx.yyy.zzz'  
    Get-Item WSMan:\localhost\Client\TrustedHosts  
    

    MIM WAL workflow wrapper script:

    [CmdletBinding()]  
    Param(  
        $Domain  
        ,$AccountName  
        ,$Email  
    )  
    Invoke-Command -ErrorAction Stop `  
        -ComputerName 10.xxx.yyy.zzz `  
        -Credential $Credential `  
        -ArgumentList @($Domain,$AccountName,$Email) `  
        -ScriptBlock {  
        param(  
            $Domain  
            ,$AccountName  
            ,$Email  
        )  
        D:\MIM-Powershell-Live\RegisterPasswordResetUser.ps1 -Domain $Domain -AccountName $AccountName -Email $Email -Verbose  
    }   
    
    0 comments No comments