In Focus

Office 365 - SharePoint Online - Resolving "Unapproved Verbs" Warning

In this article, I’ll explain in detail the meaning of the warning: "The names of some imported commands from the module 'Microsoft.Online.SharePoint.PowerShell' include unapproved verbs that might make them less discoverable." when importing the "Microsoft.Online.SharePoint.PowerShell" module.

For the last couple of months, I was continuously getting one warning while importing the "Microsoft.Online.SharePoint.PowerShell" module. In every PowerShell script, we import this module.

PS C:\WINDOWS\system32> Import-Module "C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell"

WARNING: The names of some imported commands from the module 'Microsoft.Online.SharePoint.PowerShell' 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.

Office 365 - SharePoint Online - Warning while importing "Microsoft.Online.SharePoint.PowerShell" module 
Figure 1: Office 365 - SharePoint Online - Warning while importing "Microsoft.Online.SharePoint.PowerShell" module

Though it's only a warning and doesn’t affect the successful execution of our PowerShell script,  this warning is still annoying to me. So, I thought to dig into it.

In one of the articles, I found that if we use switch "-DisableNameChecking", then the warning goes away as

Import-Module "C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell" -DisableNameChecking

Office 365 - SharePoint Online - importing "Microsoft.Online.SharePoint.PowerShell" module with “DisableNameChecking” switch to hide the default warning 
Figure 2: Office 365 - SharePoint Online - importing "Microsoft.Online.SharePoint.PowerShell" module with “DisableNameChecking” switch to hide the default warning

But then, this is a workaround. I wanted to know the actual reason so I dug more into it.

If we observe, PowerShell cmdlet has a specific syntax like -

<verb> - <noun>

For example - Get-SiteColumn is used to get the site column.

Here Verb - "Get" identifies the action cmdlet performs.

Noun – “SiteColumn” identifies the entity on which the action is performed.

PowerShell has provided the predefined verbs and the best practice is to use those verbs for cmdlets. We can get all the approved verbs or verbs provided by PowerShell using "Get-Verb" PowerShell cmdlet.

Following are the approved verbs by PowerShell.

AddClearCloseCopyEnter
ExitFindCheckpointCompareFormat
GetHideJoinLockMove
NewCompressConvertOpenOptimize
PopPushRedoRemoveRename
ConvertFromResetResizeSearchSelect
SetShowSkipSplitStep
UndoUnlockWatchBackupConvertTo
DismountEditExpandExportGroup
ImportInitializeLimitMergeMount
OutPPublishRestoreSaveSync
UnpublishUpdateApproveAssertComplete
ConfirmDenyDisableEnableInstall
InvokeRegisterRestartResumeStart
StopSubmitSuspendUninstallUnregister
DebugWaitMeasurePingRepair
ResolveTestTraceConnectDisconnect
ReadReceiveSendWriteBlock
GrantProtectRevokeUnblockUnprotect
Use    

Figure 3 - Office 365 - SharePoint Online - Output of "Get-Verb" cmdlet - PowerShell approved verbs

 Now, coming back to our warning, it says "To find the commands with unapproved verbs, run the Import-Module command again with the Verbose parameter".

So, we will run the Import-Module command again with Verbose parameter.

PS C:\WINDOWS\system32> Import-Module "C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell" -Verbose

Office 365 - SharePoint Online - importing "Microsoft.Online.SharePoint.PowerShell" module with “Verbose” switch to know the unapproved verbs which are reason behind the our original warning. 
Figure 4: Office 365 - SharePoint Online - importing "Microsoft.Online.SharePoint.PowerShell" module with “Verbose” switch to know the unapproved verbs, which is the reason behind our original warning.

At the end of the output, we will see

"VERBOSE: The 'Upgrade-SPOSite' command in the Microsoft.Online.SharePoint.PowerShell' module was imported, but because its name does not include an approved verb, it might be difficult to find. For a list of approved verbs, type Get-Verb. VERBOSE: Importing cmdlet 'Upgrade-SPOSite'."

Here, notice that the "Microsoft.Online.SharePoint.PowerShell" module contains the cmdlet "Upgrade-SPOSite" but "Upgrade" verb is not available in approved verbs as shown in figure 3 and that is why we get this warning.

Finally, I got the reason behind the warning.

Reference