Tuesday, 26 July 2016

Exchange Free/Busy Calendar Sharing

1 comment :
Recently we had a request to be able to share calendar with an external organisation that we are working on a project with.  In the old days of Exchange, the only way of achieving this in a seamless way was to setup trusts or use things IIRU and IIFP.

Since Exchange 2010, Microsoft have introduced the Microsoft Federation Gateway.  This allows companies to setup a trust to Microsoft which can be used to gain scheduling information with a third parties once policies have been configured on both parties Exchange environment.

https://technet.microsoft.com/en-us/library/dd335198(v=exchg.141).aspx

This looked like a pretty straight forward task and certainly a LOT easier than setting up direct trusts or sharing keys.  Unfortunately it wasn't quite that straight forward.
These were the Issues we ran into and the relevant fix.

1.  Cannot create Organisational Relationship for third party. Also when running get-federationinformation Powershell cmdlet, it errors.

FIX = Allow unauthenticated proxy server access from CAS servers to autodiscover address of third party exchange.

2.  Cannot successfully complete a Test-OrganizationRelationship powershell cmdlet.


FIX = Enable WSsecurity for EWS and Autodiscover virtual directories.  This was already set to true, but resetting this to true fixed this issue.

3.  Lastly, Free/Busy information worked one way, but not the other.

Works from Lab into Enterprise

Fails from Enterprise into Lab

FIX = Enable Outlook logging, attempt the Free/Busy test and in resultant FB log file it shows a proxy 407 authentication issue.  The fix is to allow unauthenticated access to the EWS path from all the CAS servers.

I found the two following blogs very useful through this process.  If you are struggling and the above doesn't work for you, then go check these links out.

https://johanveldhuis.nl/exchange-federation-deel-i/
https://lynclogix.wordpress.com/2014/04/22/exchange-federation-freebusy-drops-the-soap-header/

Thanks
Sam

Tuesday, 1 March 2016

Cannot add certificate to Netscaler

1 comment :
Recently I blew the dust off my lab environment and decided to look into configuring ADFS proxy through Netscaler.  The first task of this install is to install a publicly trusted SSL certificate on the Netscaler.

Once I created a CSR and got it signed by my CA I was ready with the files I needed, namely

  • A PFX file (private key which is used to decrypt SSL traffic on the Netscaler)
  • CA bunlde (files which are used to encrypt traffic and for clients to decide whether to trust their connection to me)
When importing the files onto the Netscaler, I kept getting the following error message.

"Invalid private key, or PEM pass phrase required for this private key"

Quick Google search reveals an old CTX article.

The resolution is to export the private key to a new file on the shell of the Netscaler.  This didn't really satisfy my curiosity as to why this error was occurring.

After a bit more Googling I found the following CTX. 


This article explains that you can manually import the PFX file, but in a format that the Netscaler will be able to use.

Once this task was completed, adding the certificate bundle to this PFX file worked perfectly.

Sam




Thursday, 29 October 2015

Output SMS from Powershell (RedOxygen)

No comments :
I have been completing some investigatory work around SMS gateways recently, specifically for our new contact centre suite to contact our customers.

I came across a SaaS based gateway product called RedOxygen.  They have a number of methods of sending SMS messages, ranging from an Office plugin, to a documented API.

My interest was the latter option as this is what we plan to use.  You can sign up for a free account which gives you 25 free messages (very useful for testing).  There is an interface option for HTTP GET and POST to send your messages which is easy to combine with lots of programming/scripting languages.

I am not a programmer or developer but I have worked with Powershell before, so I set myself the challenge of creating a little GUI which will take input from a user to type a telephone number and a message which upon hitting a button, would send the message to a mobile phone.  I also wanted it to display a return result to inform the user if there was a problem.
Here is the result.

[system.reflection.assembly]::LoadWithPartialName( "System.Windows.Forms")
[system.reflection.assembly]::LoadWithPartialName("System.Drawing")

#if like me you have a authenticated proxy server in the way
$global:PSDefaultParameterValues = @{
        'Invoke-WebRequest:Proxy'='http://proxy:8080'
        '*:ProxyUseDefaultCredentials'=$true}

#Fill in RedOxygen account details here.
$AccountId='accountnumber'
$emailID='emailaddress'
$password='password'

#This function will send the SMS
Function SendText
{
$global:SMSresultlabel.text = ""

#Retrieve SMS message from textbox
$global:SMS = $smsinput.text
    
#Retrieve Telephone number and remove trailing 0
$global:number = $numberinput.text -replace '^0'

#build POST data
$POSTDATA = @"
[SENDER]
ID=$AccountID

[FROM]
Email=$emailID
PW=$password

[1]
Number=$number
Message=$sms
"@

#Run the HTTP POST command and return result
$global:result = Invoke-WebRequest -Uri https://www.redoxygen.net/sms.dll?Action=SendSMS -Method POST -Body $POSTDATA | select-object -ExpandProperty RawContent

#Display result in variable
$global:SMSresultlabel.text = $result
}

# General Form option
$form = New-Object Windows.Forms.Form
$Form.Size = New-Object System.Drawing.Size 400,500 
$form.text = "SMS Sender"

# This is a simple infolabel for Telephone Number
$Telinfolabel = New-Object Windows.Forms.label
$Telinfolabel.Location = New-Object Drawing.Point 50,30
$Telinfolabel.Size = New-Object Drawing.Point 300,20
$Telinfolabel.text = "Enter the telephone number below"

# This is where an user types Telephone Number
$numberinput = New-Object Windows.Forms.textbox
$numberinput.Location = New-Object Drawing.Point 50,60
$numberinput.Size = New-Object Drawing.Point 200,30

# This is a simple infolabel for SMS message
$SMSinfolabel = New-Object Windows.Forms.label
$SMSinfolabel.Location = New-Object Drawing.Point 50,90
$SMSinfolabel.Size = New-Object Drawing.Point 300,20
$SMSinfolabel.text = "Enter the message below"

# This is where an admin types in the SMS message
$SMSinput = New-Object Windows.Forms.textbox
$SMSinput.Location = New-Object Drawing.Point 50,120
$SMSinput.Size = New-Object Drawing.Point 200,200
$SMSinput.Add_KeyDown({if ($_.KeyCode -eq "Enter") 
    {SendText}})

# This button is used to run the SendText function
$Go1button = New-Object Windows.Forms.Button
$Go1button.text = "Go!"
$Go1button.Location = New-Object Drawing.Point 260,60
$Go1button.Add_Click({SendText})

# This is a simple infolabel for SMS result
$SMSresultlabel = New-Object Windows.Forms.label
$SMSresultlabel.Location = New-Object Drawing.Point 50,200
$SMSresultlabel.Size = New-Object Drawing.Point 300,200

# Add the controls to the Form
$form.controls.add($Go1button)
$form.controls.add($Telinfolabel)
$form.controls.add($SMSinfolabel)
$form.controls.add($SMSinput)
$form.controls.add($numberinput)
$form.controls.add($MsgBox)
$form.controls.add($SMSresultlabel)

# Puts focus in the text box on launch
$Form.Add_Shown({$Form.Activate(); $numberinput.focus()})

# Display the dialog
$form.ShowDialog()
}

Here is how it looks
Successful text

Text Received on my phone

Unsuccessful Text

Clearly the powershell code above could be improved upon with number validation and improved feedback rather than the RawContent from the Invoke-WebRequest.  The main thing I wanted to do is prove how easy you can send SMS's from Powershell.

I guess this might be useful for those weekend scripts or if certain systems fail.

Have fun with it.