Author Posts

May 14, 2015 at 9:22 pm

Hi,
I am just wondering what the below error is. I am trying to run my script from PS 4.0. Actully its completely developed in PS 2.0. In 2.0 all is good. Please suggest what should I do to avoid this?

Actually I am running my script on PS 4.0 which is connected to Exchange 2010 remotely. The below is the code I am using to establish the connection.

$Cred=Get-Credential "LAB\Administrator"

$s = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://dagn2.lab.com/PowerShell/ -Authentication Kerberos -credential $cred

Import-PSSession $s

I tried to google it, I found that it is something related to creating local profile for exchange server. I am not sure where to change it. Please help me to fix this.

A variable that cannot be referenced in restricted language mode or a Data section is being referenced. Variables that can be referenced include the following:
$PSCulture, $PSUICulture, $true, $false, and  $null.
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : VariableReferenceNotSupportedInDataSection
    + PSComputerName        : dagn2.lab.com

May 15, 2015 at 4:30 am

You are connecting to a Remoting endpoint that is in Restricted mode, which does not allow variables – amongst many other things. This is common in Exchange, and is configured server-side.