SOLVED

Powershell not recognizing cmdlet?

Copper Contributor

I'm launching Powershell ISE and attempting to use get-azureadmconditionalaccesspolicy.  This is from a shared server.  Another user is able to run the same script without issue.  I get the following response.

 

get-azureadmconditionalaccesspolicy : The term 'get-azureadmconditionalaccesspolicy' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ get-azureadmconditionalaccesspolicy
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (get-azureadmconditionalaccesspolicy:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

 

 

In Powershell ISE, I'm able to select the AzureADPreview module and locate the command.   When I run Get-installedmodule, I'm able to see the following entries.

 

 

2.0.2.140 AzureAD PSGallery Azure Active Directory V2 General Availability Module....
2.0.2.138 AzureADPreview PSGallery Azure Active Directory V2 Preview Module. ...

 

 

the command should be available, so I'm unsure what I'm missing.

2 Replies
best response confirmed by JamesA1675 (Copper Contributor)
Solution
The cmdlet is Get-AzureADMSConditionalAccessPolicy, make sure you type (paste) it correctly as your example is missing an "S".
I was having a hell of a day yesterday. I ran into the error, installed the module, but still couldn't run it. In my troubleshooting I went to manually typing in the command and ended up misspelling it. I checked today and the script is working for me. Thank you for pointing out the misspelling. Would have drove me crazy today again.
1 best response

Accepted Solutions
best response confirmed by JamesA1675 (Copper Contributor)
Solution
The cmdlet is Get-AzureADMSConditionalAccessPolicy, make sure you type (paste) it correctly as your example is missing an "S".

View solution in original post