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.Security.SecurityException: Requested registry access is not allowed. at System.ThrowHelper.ThrowSecurityException(ExceptionResource resource) at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable) at System.Environment.GetEnvironmentVariable(String variable, EnvironmentVariableTarget target) at System.Management.Automation.ModuleIntrinsics.SetModulePath() 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) The Zone of the assembly that failed was: MyComputer