Is there a limit to the size of the help description in a PowerShell script


I wrote a utility that monitor a UPS. It is at GitHub - chribonn/UPSMonitor: This is a PowerShell Script that monitors a UPS.

If I type UPSMonitor -help only the first few lines of the Description come up.

Is this intentional or am I doing something wrong?


Did you try

Get-Help UPSMonitor -Full


BTW: UPSMonitor is not a recommended name for a Powershell cmdlet / function :wink:

It works as expected with Get-Help ./UPSMonitor.ps1

You appear to have written a custom -help parameter and that outputs the text you specified:

if ($help) {
    write-host "UPSMonitor is a utility written and tested in Powershell script (v 7.1) that taps into the Microsoft OS Win32_Battery class in order to provide the following optional functions:"
    Write-Host "`tEmail alerts"
    Write-Host "`tAction script"
    Write-Host "`n`r"
    Write-Host "The most up-to-date version of this utility and documentation is available from"

Hello Olaf,

I wasn’t aware that PS scripts had a naming convention. Can you please point me to a guide on this topic.

The idea is that the utility will run from within taskmanager on comptuer start and will loop ad-infinitum.


I was modifying the description under .DESCRIPTION text :blush:

the general naming conventions in the powershell world adhere to Verb-Noun
ie an action on something.

here is the ms document on verbs and some of the rules around it

I believe Olaf is referring to the general syntax of Verb-Noun for PowerShell naming conventions for Scripts and Functions.

Thank you to everyone. I took on board the suggestions you made. (GitHub - chribonn/UPSMonitor: This is a PowerShell Script that monitors a UPS).

I am trying to setup a task in Task Scheduler but I am getting an error. My settings are:

  • Start in - - C:\UPSMonitor
  • Program - Script requires PS v7 - pwsh.exe
  • Arguments - -ExecutionPolicy Bypass Watch-Win32_UPS.ps1 -TriggerShutdownPerc 85 -TriggerShutDownRunTime 30 -EmailTo “” -EmailFromUn “” -EmailFromPw “” -EmailSMTP “smtp” -EmailSMTPPort 587 -EmailSMTPUseSSL 1 -PollFrequency 5 -ShutdownScript “.\Invoke-Shutdown.ps1” -LogDir “C:\UPSLog” -LogFile “Watch-Win32_UPS.log”

This was failing. When I tried to run this from a command prompt I get the following:

Watch-Win32_UPS.ps1: Cannot process argument transformation on parameter ‘EmailSMTPUseSSL’. Cannot convert value “System.String” to type “System.Boolean”. Boolean parameters accept only Boolean values and numbers, such as $True, $False, 1 or 0.

If I execute this within a PS window it works.


Instead of a boolean I’d recommend using a switch parameter.

I took a look at your script and I have a question, likely a stupid one so be gentle.

What is the benefit of defining your variables using New-Variable? I just use $var = ‘something’ and yes, I am aware of scoping. I have just never used New-Variable.

I am always looking at being better at PowerShell. Thanks in advance for your input.

Hello @tonyd,

I will admit that I don’t know the answer. I date back to COBOL and my BSc had a module on ADA. That’s how dated I am :-).

I landed on PowerShell coincidentally. I have a Socomec UPS and could not find a driver to make it shutdown my computers if there is a power failure. After failing to find a solution I decided to give up and write my own code.

My research led me to PS and I decided to write it in this language. I tend to have a preference for verbose code that I find easier to understand. Also I prefer to have formal variable definition and typecasting (influenced by development tools such as C++, C#, Pascal, etc).

My 2c

1 Like

Hello @Olaf

Switched solved the problem. Updated the documentation.

Thanks a million.


Great that it helped. Thanks for sharing. :wink:

Thanks for your 2c. I believe I am similar to you in verbose code. I write for clarity and for the next guy down the road that inherits my mess :slight_smile:

What I am hoping to understand is if Set-Variable will help clarify my code in the area of variable scope. I have one script that is very large and has global variables in the main body that I pass to functions in a Module as arguments. I believe I can also set these variables via my PowerShell data file but feedback from this site said to stick with passing as arguments.

I will play around with Set-Variable and see if it clarifies and or simplifies my code. Thanks again.

I tend to believe that not using global variables makes the code more robust and reliable and the functions more independent.

Thanks Olaf. So, I made an error. The question I posed to the forum some time back was the best method to pass parameters from the main body of the script to functions within a module. The advise I got was to stick with passing them as arguments to the functions within the module. Do you have any advise on that?

I’d say the same. What I meant is not to use global variables inside the functions. Instead it’s better to pass them as arguments. So the functions do not depend on nothing from outside their scope.

I tend to prefer solutions in which all variable used within the module are either passed as parameters from the calling module, are declared within the module (and destroyed with the module) and returned back to the calling module in a return value.

With PowerScript I had a problem passing an object as a parameter. In my code the Battery is an object.

I concur and agree. Thanks for your input :slight_smile: