New-PSSession redirect message include null character - by BrianWatts

Status : 


Sign in
to vote
ID 800355 Comments
Status Active Workarounds
Type Bug Repros 0
Opened 9/12/2013 4:02:10 AM
Access Restriction Public


If I connect with New-PSSession to a target that gets redirected, for example:

New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri `
    -Credential $Cred -Authentication Basic -AllowRedirection

I receive the message:

WARNING: Your connection has been redirected to the following URI:

The string in quotes includes a NULL character before the closing quote.

This can cause problems if I am recording a transcript of the session which I then wish to mail out. Since nulls should not be in the body of a mail message (some mailers truncate the message at the null, others fail to see the message completely).
Sign in to post a comment.
Posted by BrianWatts on 10/22/2013 at 8:04 AM
Hi Tim,

I've put the skeleton code of what I now use to mail out the transcripts in the workarounds section.
It strips any nasty nulls and then puts the transcript into a plain text message.

That null character caused all kind of strange problems! ...

Posted by StoneReavers on 10/22/2013 at 6:57 AM
Brian, Thank you for posting this. I have been fighting with an issues related to this all morning. I have an automated script processing against O365 and trying to send an email with the PowerShell transcript as the body of the email and it keeps getting truncated. The only workarounds I have found are to format the email as HTML but them you loose all formatting and it is difficult to read, or just send the transcript as an attachment (which is not convenient to read).