Solved

multiple parameters within powershell

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Local Continuous Replication is a cost effective and quick way of backing up Exchange server data. The following article describes the steps required to configure Local Continuous Replication. Also, the article tells you how to restore from a backup…
Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now