Solved

add parameter on powershell script

Posted on 2012-03-12
1
576 Views
Last Modified: 2012-03-12
Hello,

I try to add parameters on powershell script but it doesn't work.
The code is :
[reflection.assembly]::loadwithpartialname('system.windows.forms') | Out-Null; 
		[system.Windows.Forms.MessageBox]::show("Installation MS Analysis Services Failover Cluster")
param 
( 
	[string]$A = "InstallCluster", 
	[string]$I = "MAS", 
	[string]$V = "MAS", 
	[string]$Help = "Help",
	[switch]$verbose,
	[switch]$debug
)
if ($A -eq "") 
	{
		Write-Debug "Setting the action parameter to InstallCluster, AddNode, Uninstall" 
		
	} 

Open in new window


How can I resolve this problem?

Thanks

Regards
bibi
0
Comment
Question by:bibi92
1 Comment
 
LVL 10

Accepted Solution

by:
JoeKlimis earned 500 total points
ID: 37710697
Hi

The Param statment needs to be the 1st line in t

Open in new window

he script
i have changed it round and this now works for me .

Give it a  try and let me know.

param 
( 
	[string]$A = "InstallCluster", 
	[string]$I = "MAS", 
	[string]$V = "MAS", 
	[string]$Help = "Help",
	[switch]$verbose,
	[switch]$debug
)
[reflection.assembly]::loadwithpartialname('system.windows.forms') | Out-Null; 
		[system.Windows.Forms.MessageBox]::show("Installation MS Analysis Services Failover Cluster")

if ($A -eq "") 
	{
		Write-Debug "Setting the action parameter to InstallCluster, AddNode, Uninstall" 
		
	} 
        

Open in new window

0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Are you one of those front-line IT Service Desk staff fielding calls, replying to emails, all-the-while working to resolve end-user technological nightmares? I am! That's why I have put together this brief overview of tools and techniques I use in o…
In this previous article (https://oddytee.wordpress.com/2016/05/05/provision-new-office-365-user-and-mailbox-from-exchange-hybrid-via-powershell/), we made basic license assignments to users in O365. When I say basic, the method is the simplest way …
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

744 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

13 Experts available now in Live!

Get 1:1 Help Now