I'm trying to update the IIS 6 Virtual SMTP server relay restrictions to only allow 127.0.0.1. To do this I'm updating the following setting.
I can do this manually but I'd like to do it from PowerShell.
$settings = get-wmiobject -namespace root\MicrosoftIISv2 -computername localhost -Query "Select * from IIsSmtpServerSetting"
$settings.RelayIpList += @(127,0,0,1)
$settings.Put()
If I query the setting in powershell the value I've added is there, but it doesn't update in the UI. Am I using the correct setting? Or am I missing something else?
Best Answer
Hope it will help someone.
I found out that you can only do something like this to update the relayIPList, below is an example to add 127.0.0.1 to an empty relay ip list:
*Note the spaces in the array. They need to be there to ensure it's a byte array (it will not work even when you use strong type to create a byte array without the spaces). Also do not try to modify the content of the array
So, following won't work:
either will this: