Is there any way, we can put the credentials in the script below that is used to connect exchange services.
after running below, it asked for credentials to enter.
i want credentials will not be asked, it required to mentioned in below Command
$cred = Get-Credential
$session = New-PSSession –ConfigurationName Microsoft.Exchange -ConnectionUri "http://exchangecasarray.contoso.com/powershell
"-Credential $cred -Authentication Kerberos -AllowRedirection
Set-AdServerSettings -ViewEntireForest $true