Check the Parameters Expected for a PowerShell Script

Check the Parameters Expected for a PowerShell Script

Q. How can I quickly check in PowerShell what parameters a script expects?

A. One way is to simply open the PowerShell script and examine the code, but there's an even easier way:

help .\<script> -Full

This will output the parameters and the types expected. An example is shown below which demonstrates the script expects a string value to be passed.

PS C:\> help .\checkos.ps1 -Full
checkos.ps1 [[-computername] <string>]

 

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish