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, 2023 by mightycabal (1.0k 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, 2023 by Jeff.Briand (60 points)
0 votes
1 answer

This is the logic I ham useing. $criteria = New-AdmCriteria -Type "User" -Expression {customAttributeBoolean6 -eq $true} $usersC = Get-AdmUser -Filter $criteria -properties * - ... there a better way to get the list of users into this variable? error;

asked Dec 14, 2023 by mightycabal (1.0k 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, 2023 by ocanizales (40 points)
3,341 questions
3,041 answers
7,764 comments
544,925 users