Trying to bypass the script warning

Welcome Forums General PowerShell Q&A Trying to bypass the script warning

This topic contains 5 replies, has 3 voices, and was last updated by

 
Participant
3 months ago.

  • Author
    Posts
  • #162404

    Participant
    Topics: 5
    Replies: 10
    Points: 69
    Rank: Member

    Hi Everyone,

    I'm hoping someone can help me with what may be a simple issue for an expert. I have a CSV file of users that I am using to create remote mailboxes on my hybrid Exchange server that will then sync to Office 365 via ADConnect. I am doing this via remoting into my Exchange box via this command....

    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://hybrid.exchange.com/PowerShell/ -Authentication Kerberos -Credential $UserCredential

    Then...

    Import-PSSession $Session -DisableNameChecking

    OK no problems there, I get connected. Once at the prompt, I am running this command to create the mailboxes....

    Import-CSV -Path "C:\users\nsaenz\Documents\FWtest.csv" | ForEach-Object {New-RemoteMailbox -UserPrincipalName $_.UserPrincipalName -Name $_.Name -OnPremisesOrganizationalUnit $_.OnPremiseOrganizationalUnit }

    It runs fine but for each user in my CSV file (there will be 100 or so), I get this warning for each mailbox...

    cmdlet Get-Credential at command pipeline position 1
    Supply values for the following parameters:
    Credential
    WARNING: A script or application on the remote computer HYBRID.EXCHANGE.COM is sending a prompt
    request. When you are prompted, enter sensitive information, such as credentials or passwords, only if
    you trust the remote computer and the application or script that is requesting the data.

    Is there a way to bypass this so that I don't have to enter my password 100 times?

    Thanks as always in advance.

    Nelson

  • #162414

    Participant
    Topics: 9
    Replies: 423
    Points: 676
    Helping Hand
    Rank: Major Contributor
  • #162428

    Participant
    Topics: 5
    Replies: 10
    Points: 69
    Rank: Member

    Thanks for replying. Is this a PS 6 specific feature? Doesn't seem to work when I try it. I'm on PS 5 here.

    Nelson

    • #162453

      Participant
      Topics: 1
      Replies: 1530
      Points: 2,591
      Helping Hand
      Rank: Community Hero

      Is this a PS 6 specific feature? Doesn't seem to work when I try it. I'm on PS 5 here.

      About CommonParameters exists since Powershell version 3.0 – released with Windows 8 – for almost 7 years now. 😉

  • #162465

    Participant
    Topics: 9
    Replies: 423
    Points: 676
    Helping Hand
    Rank: Major Contributor

    Thanks for replying. Is this a PS 6 specific feature? Doesn't seem to work when I try it. I'm on PS 5 here.

    Nelson

    You need to turn that on the remote computer where you're invoking the commands

  • #162471

    Participant
    Topics: 5
    Replies: 10
    Points: 69
    Rank: Member

    Ok, makes sense now. Thanks for explaining. Still learning so I appreciate it!

    Nelson

     

The topic ‘Trying to bypass the script warning’ is closed to new replies.