This is the actual script
$param = 'aleksey.test@abc.net'
$password = 'Exchange2015#'
$securepass = ConvertTo-SecureString -asPlainText $password -Force
$username = 'Delladmin'
$creds = New-Object System.Management.Automation.PSCredential($username,$securepass)
$rcpt = 'kjones-quartey@kbcc.cuny.edu'
$smtpServ = '172.17.0.60'
Send-MailMessage -To $rcpt -From 'wffirstapprover@kbcc.cuny.edu' -SmtpServer $smtpServ -Subject 'This was sent via Powershell' -Credential $creds;
System.TypeInitializationException: The type initializer for 'System.Management.Automation.SessionStateScope' threw an exception. ---> System.InvalidOperationException: Dynamic operations can only be performed in homogenous AppDomain.
at System.Runtime.CompilerServices.CallSiteBinder.BindCore[T](CallSite`1 site, Object[] args)
at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
at System.Management.Automation.PSVariable..ctor(String name, Object value, ScopedItemOptions options, Collection`1 attributes)
at System.Management.Automation.SessionStateScope..cctor()
--- End of inner exception stack trace ---
at System.Management.Automation.SessionStateScope.AddSessionStateScopeDefaultVariables()
at System.Management.Automation.SessionStateScope.GetPrivateVariables()
at System.Management.Automation.SessionStateScope.SetVariable(String name, Object value, Boolean asValue, Boolean force, SessionStateInternal sessionState, CommandOrigin origin, Boolean fastPath)
at System.Management.Automation.SessionStateInternal.InitializeSessionStateInternalSpecialVariables(Boolean clearVariablesTable)
at System.Management.Automation.SessionStateInternal..ctor(SessionStateInternal parent, Boolean linkToGlobal, ExecutionContext context)
at System.Management.Automation.ExecutionContext.InitializeCommon(AutomationEngine engine, PSHost hostInterface)
at System.Management.Automation.AutomationEngine..ctor(PSHost hostInterface, RunspaceConfiguration runspaceConfiguration, InitialSessionState iss)
at System.Management.Automation.Runspaces.LocalRunspace.DoOpenHelper()
at System.Management.Automation.Runspaces.RunspaceBase.CoreOpen(Boolean syncCall)
at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync)
at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
at System.Management.Automation.PowerShell.Invoke(IEnumerable input, PSInvocationSettings settings)
at ASP._15_41cf40fe_0f4b_4ba2_a906_8803d43e8670__1013487977.Page_Load(Object sender, EventArgs e)