?
Solved

add parameter on powershell script

Posted on 2012-03-12
1
Medium Priority
?
582 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 2000 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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

This article will help you understand what HashTables are and how to use them in PowerShell.
A recent project that involved parsing Tableau Desktop and Server log files to extract reusable user queries for use in other systems. I chose to use PowerShell to gather the data, and SharePoint to present it...
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…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

771 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