Bloqueada Office 365 Setting Permanment Passwords

  • martes, 18 de octubre de 2011 9:21
     
     

    Hi

    I was wondering if any one has a script that can set a unique permanent password for every user and disable password expiration with an Office 365 Subscription?

    I can do it one by one using "Set-MsolUserPassword" & "Set-MsolUser" but if there were a script that looped through each user and set the unique password and also disabled the password expiration that would be great

    Thanks Spud


    Spudney
    • Editado Spudney martes, 18 de octubre de 2011 9:21
    •  

Todas las respuestas

  • martes, 18 de octubre de 2011 12:49
     
     Respuesta propuesta

    Hi

    I wrote a simple manual-ish type script so it may help some people in small environments (<75) to set a permanent password and remove the password expiration every 90 days which is most anoying for small business

    Thaks

    Spud

    ..........................

    Save the below in notepad "all files" passwords.ps1

    Edit the UPN's and passwords for each users, each user requires two lines of code just copy and paste and edit. I have it set for just two users.

    This is the perfect job for the office intern :)

    Then run within powershell

    ---------------- cut


    Import-Module MSOnline

    $admin = Get-Credential

    Connect-MsolService –Credential $admin

    Get-MsolUser

    Set-MsolUserPassword -userPrincipalName mary@mycompany.ie -NewPassword "Ireland1001*" -ForceChangePassword $false

    Set-MsolUser -UserPrincipalName mary@mycompany.ie -PasswordNeverExpires $true

    Set-MsolUserPassword -userPrincipalName sean@mycompany.ie -NewPassword "Ireland1002*" -ForceChangePassword $false

    Set-MsolUser -UserPrincipalName sean@mycompany.ie -PasswordNeverExpires $true

    ---------------- cut

    If anyone can write a script that can read a list of UPN's from a csv file and set a permantent password and turn off password expiration that would be awesome !

     


    Spudney
    • Editado Spudney martes, 18 de octubre de 2011 12:51
    • Propuesto como respuesta Daniel Trautman miércoles, 08 de febrero de 2012 19:39
    •  
  • viernes, 27 de enero de 2012 2:45
     
     Respuesta propuesta Tiene código
    Create a CSV file with the following format:
    UPN,Password
    mary@mycompany.ie,Ireland1002*
    save it as resetuserpassword.csv

    then use this to import
    #Reset user password for users and disable force change
    Import-CSV "c:\scripts\resetuserpassword.csv" | foreach {Set-MsolUserPassword -userPrincipalName $_.UPN -NewPassword $_.Password -ForceChangePassword $false1}
    #set users passwords to never expire
    Import-CSV "c:\scripts\resetuserpassword.csv" | foreach {Set-MsolUser -UserPrincipalName $_.UPN -PasswordNeverExpires $true}
    

    • Editado Sam D Brown viernes, 27 de enero de 2012 5:18 typo
    • Propuesto como respuesta Daniel Trautman miércoles, 08 de febrero de 2012 19:39
    •  
  • lunes, 30 de enero de 2012 11:42
     
     Respuesta propuesta Tiene código
    Get-MSOLUser | Set-MsolUser -PasswordNeverExpires $true
    

    Will set the password to never expire on all users.
    • Editado FreeSoftDK lunes, 30 de enero de 2012 11:43 Explained
    • Propuesto como respuesta Daniel Trautman miércoles, 08 de febrero de 2012 19:39
    •  
  • domingo, 12 de febrero de 2012 5:12
     
     

    This is GREAT Spudney, thanks for sharing!  We usually see admins set this for their DirSync account, so that DirSync doesn't stop ever 90 days.  The alternative is to use Active Directory Federation Services (ADFS), which uses the on-premises Active Directory as the Identity and Authentication provider for Office 365 access.

    also, I have seen where people use the Get-MSOnlineUser -enabled | Set-MSOnlineUser -PasswordNeverExpires $True, using the -enabled parameter as the variable for pulling all enabled users, instead of having to populate a .csv spreadsheet.  Different ways to do this, but thanks to you and Sam for throwing this out there, will definitely be helpful for those smaller customers!

    To download and use this solution, please refer to:  http://onlinehelp.microsoft.com/en-us/office365-enterprises/hh124998.aspx

    Cheers


    Transitions Community Lead ...Ryan J. Phillips