I'm creating a PowerShell Module, and when I import it get the following warning.

WARNING: The names of some imported commands from the module 'ModuleName' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.

This is caused by my cmdlet Is-WindowsServer. It returns $true or $false depending on if the server is running a Windows Operating System. But it turns out "IS" is not an approved PowerShell verb. I've looked through the list of approved PowerShell verbs but I don't see one that would work instead. https://msdn.microsoft.com/en-us/library/ms714428(v=vs.85).aspx

What is the best practice verb to use in this situation?

| improve this question | | | | |
  • 2
    Id suggest the verb Test` like in Test-Path also returning true/false – LotPings Dec 5 '16 at 20:56
  • @LotPings Best answer. Should be an answer... – Xalorous Dec 5 '16 at 21:04

I'd suggest the verb Test like in Test-Path also returning $true/$false.

Or any of the following:

Test-32Bit                        PowerShellPack
Test-32Bit                        PSSystemTools
Test-64Bit                        PowerShellPack
Test-64Bit                        PSSystemTools
Test-Dtc                          MsDtc
Test-IsAdministrator              PowerShellPack
Test-IsAdministrator              PSUserTools
Test-NetConnection                NetTCPIP
Test-ScriptFileInfo               PowerShellGet
Test-SFTPPath                     Posh-SSH
Test-AlternateDataStream          pscx
Test-AppLockerPolicy              AppLocker
Test-Assembly                     pscx
Test-Certificate                  PKI
Test-ComputerSecureChannel        Microsoft.PowerShell.Management
Test-Connection                   Microsoft.PowerShell.Management
Test-DscConfiguration             PSDesiredStateConfiguration
Test-FileCatalog                  Microsoft.PowerShell.Security
Test-KdsRootKey                   Kds
Test-ModuleManifest               Microsoft.PowerShell.Core
Test-MSMQueue                     pscx
Test-Path                         Microsoft.PowerShell.Management
Test-PSSessionConfigurationFile   Microsoft.PowerShell.Core
Test-Script                       pscx
Test-UevTemplate                  UEV
Test-UserGroupMembership          pscx
Test-WSMan                        Microsoft.WSMan.Management
Test-Xml                          pscx
| improve this answer | | | | |
  • I'd only add that to view a list of acceptable verbs run Get-Verb. It displays all the verb's which won't trigger the warning and a little hint about when to use them. – Colyn1337 Dec 8 '16 at 8:07

I agree with @LotPings' comment, the best verb for your test is Test.

If warning or error text refers you to a cmdlet, or 'about_*' topic, it's because you've made a common mistake. The referenced material will often contain a solution.

As the warning suggests, type Get-Verb for the list of approved verbs.

Keep in mind that understanding and using Get-Help and other cmdlets like it (Get-Command, Get-Verb, Get-Member, etc.) are very near manadatory to be successful with PowerShell. If you adopt the mindset, you can extend your experience to cover cmdlets that you have never used, due to the fact that everything is so standardized.

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.