This is my first time here. I need some help. I am collecting information from Distribution Lists. The exchange server is configured as default 30 days for retention. I have the tools installed on a remote jump server. I can open powershell and connect to the remote exchange server. I can run the ps1 successfully. The information is exported to a .csv. I would like to schedule a task. I don’t know how to add the connection commands to the existing ps1 so that I would not be prompted to enter my username and password each time the task runs. How do I automate that set of commands to automatically connect to the remote exchange server when the task runs?
So currently, on the jump box, I open powershell as administrator, and I type:
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://LMNOPServer/PowerShell/ -Authentication Kerberos -Credential $UserCredential
Import-PSSession $Session -DisableNameChecking
Then I launch the script and it collects the information I need. But when I run a scheduled task, from the jump box, then I think that PowerShell is not authenticating to the remote server?