Solved

multiple parameters within powershell

Posted on 2013-02-06
3
362 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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

MS Outlook is a world-class email client application that is mainly used for e-communication globally.  In this article, we will discuss the basic idea about MS Outlook, its advanced features, and types of MS Outlook File formats.
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…
In this video we show how to create an Address List 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 Organization >> Ad…
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…

776 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