0

My current script prompts for user credentials in order to remote sign into exchange server. Is their a way to provide credentials in script and automatically sign into exchange server without prompt?

$UserCredential = Get-Credential

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://XXXXXX.XXXXXXXXdomain.local/PowerShell/ -Authentication Kerberos -Credential $UserCredential

Import-PSSession $Session -DisableNameChecking
Mathias R. Jessen
  • 157,619
  • 12
  • 148
  • 206
  • Can it be done? Yes, but you would have to leave your password in plain text saved in the script (or read in by the script). It is **not recommended** to do that! – TheMadTechnician Feb 03 '21 at 19:21
  • In an interactive session (ie. you launch powershell from your desktop session), or an unattended session (scheduled task for example)? – Mathias R. Jessen Feb 03 '21 at 19:25

0 Answers0