Trying to bypass the script warning

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

Viewing 4 reply threads
  • Author
    Posts
    • #162404
      Participant
      Topics: 9
      Replies: 21
      Points: 140
      Rank: Participant

      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: 12
      Replies: 525
      Points: 1,233
      Helping Hand
      Rank: Community Hero
    • #162428
      Participant
      Topics: 9
      Replies: 21
      Points: 140
      Rank: Participant

      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: 5
        Replies: 2373
        Points: 6,010
        Helping Hand
        Rank: Community MVP

        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: 12
      Replies: 525
      Points: 1,233
      Helping Hand
      Rank: Community Hero

      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: 9
      Replies: 21
      Points: 140
      Rank: Participant

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

      Nelson

       

Viewing 4 reply threads
  • The topic ‘Trying to bypass the script warning’ is closed to new replies.