how to change user status in bulk from mfa enabled to disabled.

%3CLINGO-SUB%20id%3D%22lingo-sub-30520%22%20slang%3D%22en-US%22%3Ehow%20to%20change%20user%20status%20in%20bulk%20from%20mfa%20enabled%20to%20disabled.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-30520%22%20slang%3D%22en-US%22%3E%3CP%3Ehow%20to%20change%20user%20status%20in%20bulk%20from%20mfa%20enabled%20to%20disabled.%20i%20am%20trying%20the%20script%20below%20which%20is%20not%20working%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%24users%3C%2FFONT%3E%20%3CFONT%20color%3D%22%23a9a9a9%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3D%3C%2FFONT%3E%20%3CFONT%20color%3D%22%230000ff%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3EImport-Csv%3C%2FFONT%3E%20%3CFONT%20color%3D%22%238b0000%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E'C%3A%5Csupport%5CBulkUpdateMFASampleFile.csv'%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%2300008b%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%2300008b%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%2300008b%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3Eforeach%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FFONT%3E%3CFONT%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%20(%3C%2FFONT%3E%3C%2FFONT%3E%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%24user%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FFONT%3E%20%3CFONT%20color%3D%22%2300008b%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%2300008b%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%2300008b%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3Ein%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FFONT%3E%20%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%24users%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FFONT%3E%3CFONT%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E)%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%7B%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%24st%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FFONT%3E%20%3CFONT%20color%3D%22%23a9a9a9%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%23a9a9a9%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%23a9a9a9%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3D%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FFONT%3E%20%3CFONT%20color%3D%22%230000ff%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%230000ff%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%230000ff%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3ENew-Object%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FFONT%3E%20%3CFONT%20color%3D%22%23000080%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%23000080%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%23000080%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E-TypeName%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FFONT%3E%20%3CFONT%20color%3D%22%238a2be2%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%238a2be2%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%238a2be2%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3EMicrosoft.Online.Administration.StrongAuthenticationRequirement%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%24st%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FFONT%3E%3CFONT%20color%3D%22%23a9a9a9%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%23a9a9a9%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%23a9a9a9%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E.%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FFONT%3E%3CFONT%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3ERelyingParty%20%3C%2FFONT%3E%3C%2FFONT%3E%3CFONT%20color%3D%22%23a9a9a9%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%23a9a9a9%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%23a9a9a9%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3D%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FFONT%3E%20%3CFONT%20color%3D%22%238b0000%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%238b0000%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%238b0000%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%22*%22%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%24st%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FFONT%3E%3CFONT%20color%3D%22%23a9a9a9%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%23a9a9a9%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%23a9a9a9%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E.%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FFONT%3E%3CFONT%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3EState%20%3C%2FFONT%3E%3C%2FFONT%3E%3CFONT%20color%3D%22%23a9a9a9%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%23a9a9a9%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%23a9a9a9%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3D%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FFONT%3E%20%3CFONT%20color%3D%22%238b0000%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%238b0000%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%238b0000%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%E2%80%9CEnabled%E2%80%9D%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%24sta%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FFONT%3E%20%3CFONT%20color%3D%22%23a9a9a9%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%23a9a9a9%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%23a9a9a9%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3D%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FFONT%3E%3CFONT%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%20%40(%3C%2FFONT%3E%3C%2FFONT%3E%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%24st%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FFONT%3E%3CFONT%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E)%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%230000ff%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%230000ff%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%230000ff%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3ESet-MsolUser%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FFONT%3E%20%3CFONT%20color%3D%22%23000080%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%23000080%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%23000080%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E-UserPrincipalName%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FFONT%3E%20%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%24user%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FFONT%3E%3CFONT%20color%3D%22%23a9a9a9%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%23a9a9a9%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%23a9a9a9%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E.%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FFONT%3E%3CFONT%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3EUsername%20%3C%2FFONT%3E%3C%2FFONT%3E%3CFONT%20color%3D%22%23000080%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%23000080%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%23000080%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E-StrongAuthenticationRequirements%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FFONT%3E%20%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%24sta%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%7D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-30520%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3Emfa%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-30539%22%20slang%3D%22en-US%22%3ERe%3A%20how%20to%20change%20user%20status%20in%20bulk%20from%20mfa%20enabled%20to%20disabled.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-30539%22%20slang%3D%22en-US%22%3E%3CP%3EManage%20to%20fix%20it%20put%20an%20old%20script%20and%20new%20script%20together%20to%20work%20it%20out%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%24users%20%3D%20Import-Csv%20'C%3A%5Csupport%5CBulkUpdateMFASampleFile.csv'%3C%2FP%3E%3CP%3Eforeach%20(%24user%20in%20%24users)%3C%2FP%3E%3CP%3E%7B%3C%2FP%3E%3CP%3E%24mfa%20%3D%20%40()%3C%2FP%3E%3CP%3ESet-MsolUser%20-UserPrincipalName%20%24user.Username%20-StrongAuthenticationRequirements%20%24mfa%3C%2FP%3E%3CP%3E%7D%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Contributor

how to change user status in bulk from mfa enabled to disabled. i am trying the script below which is not working

 

$users = Import-Csv 'C:\support\BulkUpdateMFASampleFile.csv'

foreach ($user in $users)

{

$st = New-Object -TypeName Microsoft.Online.Administration.StrongAuthenticationRequirement

$st.RelyingParty = "*"

$st.State = “Enabled”

$sta = @($st)

Set-MsolUser -UserPrincipalName $user.Username -StrongAuthenticationRequirements $sta

}

 

1 Reply
Highlighted

Manage to fix it put an old script and new script together to work it out

 

$users = Import-Csv 'C:\support\BulkUpdateMFASampleFile.csv'

foreach ($user in $users)

{

$mfa = @()

Set-MsolUser -UserPrincipalName $user.Username -StrongAuthenticationRequirements $mfa

}