$server = Read-Host "Enter server name "

I believe that will do what you want.

To get environment variables, the exact syntax is something like 
$env:COMPUTERNAME.

Thanks,
Brian Desmond
br...@briandesmond.com

c - 312.731.3132

From: Gavin Wilby [mailto:gavin.wi...@gmail.com]
Sent: Friday, August 14, 2009 10:30 AM
To: NT System Admin Issues
Subject: Paging the Powershell gurus

Hi,

I use a anti-spam system that's on a remote server, and so I like to lock down 
my Receive Connectors/ SMTP servers to only accept email from certain IP 
addresses.

I have the following script that kinda does it for me:


[PS] C:\Windows\System32>Set-ReceiveConnector "Windows SBS Internet Receive 
%SERVERNAME%" -RemoteIPRanges (Get-Content 
c:\users\sys_adm\desktop\%youriplist%.txt)
its a little bit of a pain though, as I have to have the IP list in a text file 
somewhere and then modify the script to use it. and also the receive connector 
name is never the same so i have to change that in the script.

Id LIKE to have it so it asks for certain variables before it starts, so it 
picks up the right hostname for instance, a little like a set /p does.

Can this be done?

--
Gavin Wilby,
Twitter: http://twitter.com/gavin_wilby
GSXR Blog: http://www.stoof.co.uk





~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

Reply via email to