troubleshooting Question

passing parameters to powershell script

Avatar of DevSupport
DevSupport asked on
2 Comments1 Solution409 ViewsLast Modified:
I am using the following script to compare values between two files:

#--beginning of powershellscript compare.ps1

param([string]$nodeA = "nodeA", [string]$nodeB = "nodeB",  [string]$hanode = "hanode")
Add-Content "List of Non-Synchronized Users in HA Cluster $hanode"
compare-object (get-content $nodeA) (get-content $nodeB)

#--end of powershell

I want to use command prompt to send the name of files like this and get output in a file:

powershell.exe -File compare.ps1  -nodeA "mynodeA.txt" -nodeB "mynodeB.txt" -hanode "mycentralnode" -Out-File Output.txt -append

When I run the command in command prompt I get this error:

cmdlet Add-Content at command pipeline position 1
Supply values for the following parameters:

Please let me know how to fix the powershell script and the command prompt parameter passing so that it takes those two text files as input and display the Add-Content properly

Thank You so much and appreciate your help!!
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros