0 votes

I am getting the following error...

The type initializer for 'System.Management.Automation.PSCredential' threw an exception.

The term 'Get-AdmUser' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

My powershell scripts have been working for months and then suddenly... BOOM! They started throwing this error.

by (380 points)
0

Here is the script that I have been using to strip group memberships as part of our Account Move process.

Import-Module Adaxes
    $user = Get-AdmUser "%distinguishedName%" -Properties MemberOf
    if ($user.MemberOf -ne $Null)
    {
        foreach ($groupDN in $user.MemberOf)
        {
            Remove-AdmGroupMember $groupDN -Members $user  -Confirm:$False
        }
    }
0

Hello,

Did you reinstall or upgrade Adaxes lately? If you did, did you also install Adaxes PowerShell module? It is not installed by default, it is an optional component.

How to install

0

Adaxes has been running fine for the last 6 month or more. No modifications were made to it. It just quit working.

1 Answer

0 votes
by (216k points)
selected by
Best answer

Hello,

We noticed that you receive the following error: The type initializer for 'System.Management.Automation.PSCredential' threw an exception. It can occur because of a bug in .Net Framework 3.5. Try restarting your Adaxes service. This should resolve the issue.

0

That actually resolved my issue! Thank you! I guess I will need to remember to restart the service when I get script errors.

Related questions

0 votes
1 answer

Hello, I am scripting user creation. I have created a custom command where an end user will submit info for the user to be created from: Here is the scirpt: # Import the ... Schema. I have tried using "Employee Type" as in the screen shot above but same error.

asked Apr 6 by mightycabal (810 points)
0 votes
0 answers

Over the last day or so we have been seeing this pop up under the exchange header in adaxes portal. cmdlet Get-CASMailbox is not present in the role definition of the current user

asked Jul 3 by Jeff.Briand (40 points)
0 votes
1 answer

I am trying to use this script from the script repository: https://www.adaxes.com/script-repository/enable-mfa-with-phone-number-for-a-user-in-microsoft-365-s686.htm I ... if I just didn't install it correctly because Adaxes Powershell doesn't recognize it.

asked Oct 10 by ocanizales (20 points)
0 votes
1 answer

I would like users to use Adaxes to add themselves or others to a group, but instead of it just working, it has to go thru an approval process and be approved by the group owner before they are added. Thanks!

asked Jun 30, 2021 by RayBilyk (230 points)
3,222 questions
2,924 answers
7,488 comments
533,020 users