locked
Saved credential script keep promoting for password RRS feed

  • Question

  • Hi Folks,

    I use the below script to automatically execute without entering credentials.

    $Credential = Import-Clixml -Path "c:\finalized\cred.xml" 
    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $Credential -Authentication Basic -AllowRedirection  
    Import-PSSession $Session -ErrorAction SilentlyContinue 
    import-csv -Path C:\Automation\out.csv | foreach {Remove-MailboxPermission -Identity $_.Identity -User $_.User -AccessRights FullAccess -InheritanceType All -confirm:$false}

    It works when connecting to Exchange Online and import the module without promoting for credential. But when it goes to the Exchange Online command for the first time, it prompts for credential window along with User name and password need to be manually entered. with the message "Creating a new session for implicit remoting of "Remove-MailboxPermission" command..."

    This is going to be automated code block it should not require user to manually enter the password, how to avoid this prompt?

    Please help!!!!!!!

    Automation team

     

    Karthikeyan


    Friday, November 3, 2017 10:16 AM

Answers

All replies