0 votes

Morning,

Since updating Adaxes to the latest version that uses Powershell 4.0 we are unable to query SQL 2008 R2 database in a scheduled task.

The Activity History provides the following error:
Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information. Stack trace: at <ScriptBlock>, <No file>: line 20

This is a sample of the script we are trying to run:

1: Import-Module Adaxes
2: add-pssnapin sqlserverprovidersnapin100
3: add-pssnapin sqlservercmdletsnapin100
...
20: $list= invoke-sqlcmd -query "SELECT ..." -Database 'DB' -ServerInstance 'Server' -Username 'User' -Password 'Pass'

Seems like we should be able to update a .config file to support mixed mode?
https://stackoverflow.com/questions/642 ... he-runtime

Any assistance would be appreciated.

Regards, Ben

by (130 points)

1 Answer

+1 vote
by (130 points)
selected by
Best answer

After trial and error the solution for us was the following.

Edit the Softerra.Adaxes.Service.exe.config file on the server (e.g. C:\Program Files\Softerra\Adaxes 3\Service\Softerra.Adaxes.Service.exe.config).

At the bottom of the file before the closing configuration tag add the highlighted section:

<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
</startup>

</configuration>

Save and restart the Softerra Adaxes Service.

0

Hello,

Thank you for sharing the solution.

The issue occurs because of a bug with the Invoke-Sqlcmd cmdlet in .NET framework 4.5.2 which Adaxes 2018.1 targets. Details can be found in the following post on Microsoft blogs: https://blogs.msdn.microsoft.com/aseemb ... formation/.

0

This also fixed my Related Problem with the current Microsoft.Online.SharePoint.PowerShell Module.

under Adaxes you got -

Import-Module : Could not load type 'Microsoft.SharePoint.Administration.DesignPackageType' from assembly 'Microsoft.SharePoint.Client, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'.

running it under a normal Powershell it worked fine. (Adaxes 2019.2)

Related questions

0 votes
1 answer

Is there a way to have a Scheduled Task with 4 different condition? I want to create a scheduled task start every Monday and the condition see: The next Saturday of the week ... of the week is the fifth of the month then no action Thanks in advance, Simone

asked Jan 18, 2022 by Simone.Vailati (430 points)
0 votes
1 answer

Dear support, The current limitation of powershell 2.0 in script is getting more and more a problem for us. I am for instance unable to use the ConverTo-Json cmdlet what ... in version 3.0 that is very very handy when working with web services. Regards,

asked Jan 22, 2016 by Pierre (750 points)
0 votes
1 answer

Hi, I have taken over support of Adaxes development server and am trying to clean up some errors in the Adaxes application log. We are running 2013.1. "Log ... LMSEXCH10 does not exist. My question is where is this exchange server configured within Adaxes?

asked Dec 17, 2014 by theckel (520 points)
0 votes
1 answer

I used the script below to try and accomplish this but I get an error. I did try to leave a comment but it would not let me. I tried running ... .adaxes.com/script-repository/add-users-located-in-particular-organizational-units-to-unmanaged-accounts-s178.htm

asked Nov 14, 2022 by raul.ramirez (210 points)
0 votes
1 answer

Greetings - I'm attempting to run a powershell script to create a Lync user and I'm running into an issue at the first step. When I call the custom command to run the ... be accessible by any user. Anyone have any ideas what I could be missing? Thanks! Jason

asked Mar 5, 2013 by NorthDigital (60 points)
3,346 questions
3,047 answers
7,777 comments
544,979 users