Coming Soon: GET:IT Endpoint Management 1-Day Conference on September 28th at 9:30 AM ET Coming Soon: GET:IT Endpoint Management 1-Day Conference on September 28th at 9:30 AM ET

Secure password rejected as bad but thats incorrect

Home Forums Scripting PowerShell Secure password rejected as bad but thats incorrect

Tagged: 

Viewing 1 post (of 1 total)
  • Author
    Posts

  • confuseis
    Participant
    #623404

    Hi

    Im doing some work with office 365

    Im looking to automate a task

    Im using below code but getting error on the last line

    “Connect-Msolservice : Authentication error: Bad username or password.

    Problem is the password works perfectly everywhere for me dont see why im getting such error so dont know how to troubleshoot. Searched online to no avail so far.

    $username = “Mickey”

    $password = “KnownGoodPassword”

    $securePWD = $password | ConvertToSecureString -AsPlainText -Force

    $MyCredential = NewObject -typename System.Management.Automation.PSCredential -Argumentlist $username,$securePWD

    Import-Module MSonline

    Connect-MSOlService -credential $MyCredential

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

Live Webinar: Active Directory Security: What Needs Immediate Priority!Live on Tuesday, October 12th at 1 PM ET

Attacks on Active Directory are at an all-time high. Companies that are not taking heed are being punished, both monetarily and with loss of production.

In this webinar, you will learn:

  • How to prioritize vulnerability management
  • What attackers are leveraging to breach organizations
  • Where Active Directory security needs immediate attention
  • Overall strategy to secure your environment and keep it secured

Sponsored by: