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 :)

Office 365 – SharePoint Online – Resolving warning “The names of some imported commands from the module ‘Microsoft.Online.SharePoint.PowerShell’ include unapproved verbs that might make them less discoverable.” while importing module – Microsoft.Online.SharePoint.PowerShell

Hi All,

Today new and very interesting finding. You will definitely like this finding. 

Int his article I’ll explain in detail the meaning of warning – “The names of some imported commands from the module ‘Microsoft.Online.SharePoint.PowerShell’include unapproved verbs that might make them less discoverable.” when import the module – Microsoft.Online.SharePoint.PowerShell

Since last couple of months I was always getting one warning while importing the module “Microsoft.Online.SharePoint.PowerShell”. 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.

Figure 1: Office 365 – SharePoint Online – Warning while importing “Microsoft.Online.SharePoint.PowerShell” module

Though its only warning, it doesn’t affect in successfully executing our PowerShell script. But this warning is still annoying to me. So, thought to dig into it. In one of the article I found that if we use switch “-DisableNameChecking” then warning goes away as

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

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

But then this is again workaround, I want to know the actual reason so more dig into it 🙂

 If we observe, PowerShell cmdlet has specific syntax like

<verb> – <noun>

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

Here Verb – “Get” which identify the action cmdlet performs.

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

PowerShell has provided the predefined verbs and best practice is using those verbs for cmdlets. We can get the all approved verbs or verbs which are provided by PowerShell are using “Get-Verb” PowerShell cmdlet. Following are the approved verbs by PowerShell.

AddClear
Close Copy Enter
Find ExitCheckpointCompareFormat
GetHideJoinConvertOpen
LockMoveNewCompress
Optimize
PopPushRedoRemoveRename
ConvertFromResetResizeSearchSelect
SetStepSkipShowSplit
WatchBackup
UndoConvertToUnlock
DismountEditExpandExportGroup
ImportInitializeLimitMergeMount
OutPublishRestoreSaveUnpublish
SyncUpdateDisableEnableInstall
ApproveAssertCompleteConfirmDeny
InvokeRegisterResumeRestoreStart
StopSubmitSuspendUninstallUnregister
Debug
WaitMeasure
PingRepair
Resolve
TestTraceConnectDisconnect
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 as

Import-Module “C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell” -Verbose

Figure 4 : 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 🙂

at the end of 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 “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 why this warning.

Finally got the reason behind the warning 🙂

Reference: SharePoint OnlinePowerShell cmdlet
Approved Verbs forPowerShell Commands
Learning PowerShell names
Get-Verb

Thanks for reading 🙂 

Keep reading, share your thoughts, experiences. Feel free to contact us to discuss more. If you have any suggestion / feedback / doubt, you are most welcome.

Stay tuned on Knowledge-Junction, will come up with more such articles


Advertisements

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.