Solved

multiple parameters within powershell

Posted on 2013-02-06
3
363 Views
Last Modified: 2013-02-06
Hi im looking to set 2 parameters within this function. I have $setrecieveconnector  but also want to change the IP to a param. Whats the best way to go about it. Thanks

function setrecieveconnector {
param(
    [Parameter(Mandatory=$true)]
    $setrecieveconnector
set-ReceiveConnector -Name 'Default $setrecieveconnector' -Bindings '172.31.90.101:25'
}
0
Comment
Question by:cwstad2
3 Comments
 
LVL 5

Accepted Solution

by:
coraxal earned 250 total points
ID: 38858774
You can try this:
 
function setrecieveconnector {
	param
	(
	[Parameter(Mandatory=$true,Position=0)]
	[string]
	$setrecieveconnector,
	[Parameter(Mandatory=$true,Position=1)]
	[string]
	$IPAddress
	)	
	set-ReceiveConnector -Name "Default $setrecieveconnector" -Bindings "$IPAddress:25"
}

Open in new window

0
 
LVL 40

Assisted Solution

by:Subsun
Subsun earned 250 total points
ID: 38858778
Try..
function setrecieveconnector {
param(
    [Parameter(Mandatory=$true)]
    $setrecieveconnector,
    $ip
)
set-ReceiveConnector -Name "Default $($setrecieveconnector)" -Bindings "$($ip):25"
}

Open in new window

0
 
LVL 15

Author Closing Comment

by:cwstad2
ID: 38859091
thanks
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
In this video we show how to create a mailbox database in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Servers >> Data…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question