Solved

add parameter on powershell script

Posted on 2012-03-12
1
578 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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
This article will help you understand what HashTables are and how to use them in PowerShell.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

773 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