Solved

add parameter on powershell script

Posted on 2012-03-12
1
581 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 11

Accepted Solution

by:
Joe Klimis 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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

A brief introduction to what I consider to be the best editor for PowerShell.
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 …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

724 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